Message ID | 20230612141352.29939-2-tzimmermann@suse.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2620025vqr; Mon, 12 Jun 2023 07:15:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ53/LcnRa0bDt2MStxQPhr0rhDmi7kJFv3Tw4mP+8ywMpsg8YTQYOqSdbJ3J3G5jBoztmvj X-Received: by 2002:a19:d612:0:b0:4f7:4446:c333 with SMTP id n18-20020a19d612000000b004f74446c333mr1892433lfg.62.1686579322462; Mon, 12 Jun 2023 07:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686579322; cv=none; d=google.com; s=arc-20160816; b=t2MQZjz2LhPPplH4cBOaixjj/4kWm4FvfOAQCpV1vGrZuRe7SLJlw0vRNIVpGpauzT 7G1mO4X/+esU7W0vsJD23HAgUmpw8hVKjqyij0jUkiGhDB31QxNeSZjjeZeFdJmzROEj Yn242f4bD2ifpf/xJRkRvZZDp+iJKqEIB7D0tCiK+cdpDco6G3/OhFcxSWHFoDkVoivn rnXVVKzSIwNzCsvAaWz7BksDlWAFeSdhhRh9Os9daDsKdbLocKcuqip3DDYS2LtLjCJ7 4DcMM2OLGLvtBnP1jPex9u9FoPI7iKkYcLAlmZ2E26o1rc/QRhpPi0fYW2Ss9EN75PM0 smZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=3sJSCjaVrA7kDwsrSwIFOa10blfEXLpB2Uw9gtvLkjg=; b=KYgJpZ8YOXb/430ZegNU1ZT8SAxbcleiUowEHz5eeRFMWNDxCUELnjR8mWfGmPGfK4 jMx6s4qsAKqB7K2F1ylJcl3/CA0XX2UzaIrOlMsz/EbmAX8n8OJx8o6PIGfBh/JaD/m4 3B88OrHE5binhlGvKk7Xz7eZIaNJlLNGkC/kvg2EMOtrAZc+pbzTXTcTmoMXUDvvm+wA kyD1tCPWVY2T6r4tmffFZbvaLzSVVuEQcONgkcnB8klByGUNUf3MJ4VGwVm03GUJxYNJ f7AyHHAQUIz+5m1az2k61vrAJXKo6/4gCo3pwF82Z8uyN7luk29emPbkQNCfSE1c6Dpu yrtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=hSBd0hsG; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bo7-20020a0564020b2700b00514ad913e9csi6143185edb.99.2023.06.12.07.14.57; Mon, 12 Jun 2023 07:15:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=hSBd0hsG; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237426AbjFLOOL (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Mon, 12 Jun 2023 10:14:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237238AbjFLON5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 12 Jun 2023 10:13:57 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D3DA19C; Mon, 12 Jun 2023 07:13:56 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E923D2271D; Mon, 12 Jun 2023 14:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686579234; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3sJSCjaVrA7kDwsrSwIFOa10blfEXLpB2Uw9gtvLkjg=; b=hSBd0hsGveWAwWxApwvgqEoJMAbiHbtdo6ToeFC9hidvZd4Dj3dh9eMWiZ9HXxb6304RoF qm+dmkUJq5oihn7VHddM/vf0lwkeUfkKEzMPJvCv6rJkewBDlvJlNBIEPVO/axkFuF5P9/ SlpLfIpSmocHahtOoniSdFfgRnK02Lw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686579234; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3sJSCjaVrA7kDwsrSwIFOa10blfEXLpB2Uw9gtvLkjg=; b=S1Jgo2ktxPghsHrzmX5ucnsVoDw+3nWTiUxOOv9/3vDPBmzJHmE070HuxLR1cReJdfmdMM tC1mAtvhCy6U1dBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7A36A13A67; Mon, 12 Jun 2023 14:13:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kLPCHCIoh2RwGQAAMHmgww (envelope-from <tzimmermann@suse.de>); Mon, 12 Jun 2023 14:13:54 +0000 From: Thomas Zimmermann <tzimmermann@suse.de> To: daniel@ffwll.ch, javierm@redhat.com, sam@ravnborg.org, deller@gmx.de, geert+renesas@glider.be, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, dan.carpenter@linaro.org, michael.j.ruhl@intel.com Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sh@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Thomas Zimmermann <tzimmermann@suse.de>, Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>, stable@vger.kernel.org Subject: [PATCH v2 01/38] backlight/bd6107: Compare against struct fb_info.device Date: Mon, 12 Jun 2023 16:07:39 +0200 Message-ID: <20230612141352.29939-2-tzimmermann@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612141352.29939-1-tzimmermann@suse.de> References: <20230612141352.29939-1-tzimmermann@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768506599958287641?= X-GMAIL-MSGID: =?utf-8?q?1768506599958287641?= |
Series |
fbdev: Make userspace interfaces optional
|
|
Commit Message
Thomas Zimmermann
June 12, 2023, 2:07 p.m. UTC
Struct bd6107_platform_data refers to a platform device within the Linux device hierarchy. The test in bd6107_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device. Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional. v2: * move renames into separate patch (Javier, Sam, Michael) Fixes: 67b43e590415 ("backlight: Add ROHM BD6107 backlight driver") Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Cc: Lee Jones <lee@kernel.org> Cc: Daniel Thompson <daniel.thompson@linaro.org> Cc: Jingoo Han <jingoohan1@gmail.com> Cc: dri-devel@lists.freedesktop.org Cc: <stable@vger.kernel.org> # v3.12+ Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> --- drivers/video/backlight/bd6107.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, Jun 12, 2023 at 04:07:39PM +0200, Thomas Zimmermann wrote: > Struct bd6107_platform_data refers to a platform device within > the Linux device hierarchy. The test in bd6107_backlight_check_fb() > compares it against the fbdev device in struct fb_info.dev, which > is different. Fix the test by comparing to struct fb_info.device. > > Fixes a bug in the backlight driver and prepares fbdev for making > struct fb_info.dev optional. > > v2: > * move renames into separate patch (Javier, Sam, Michael) > Thanks. This helps a lot. I stared at this for a long time without seeing the fix. Then I misunderstood Sam's review comments (my fault, they were clear in retrospect) so I got completely lost. regards, dan carpenter
>-----Original Message----- >From: dri-devel <dri-devel-bounces@lists.freedesktop.org> On Behalf Of >Thomas Zimmermann >Sent: Monday, June 12, 2023 10:08 AM >To: daniel@ffwll.ch; javierm@redhat.com; sam@ravnborg.org; >deller@gmx.de; geert+renesas@glider.be; lee@kernel.org; >daniel.thompson@linaro.org; jingoohan1@gmail.com; >dan.carpenter@linaro.org; Ruhl, Michael J <michael.j.ruhl@intel.com> >Cc: linux-fbdev@vger.kernel.org; Laurent Pinchart ><laurent.pinchart+renesas@ideasonboard.com>; linux-sh@vger.kernel.org; >linux-staging@lists.linux.dev; linux-kernel@vger.kernel.org; dri- >devel@lists.freedesktop.org; stable@vger.kernel.org; Thomas Zimmermann ><tzimmermann@suse.de>; linux-omap@vger.kernel.org >Subject: [PATCH v2 01/38] backlight/bd6107: Compare against struct >fb_info.device > >Struct bd6107_platform_data refers to a platform device within >the Linux device hierarchy. The test in bd6107_backlight_check_fb() >compares it against the fbdev device in struct fb_info.dev, which >is different. Fix the test by comparing to struct fb_info.device. > >Fixes a bug in the backlight driver and prepares fbdev for making >struct fb_info.dev optional. > >v2: > * move renames into separate patch (Javier, Sam, Michael) > >Fixes: 67b43e590415 ("backlight: Add ROHM BD6107 backlight driver") >Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> >Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> >Cc: Lee Jones <lee@kernel.org> >Cc: Daniel Thompson <daniel.thompson@linaro.org> >Cc: Jingoo Han <jingoohan1@gmail.com> >Cc: dri-devel@lists.freedesktop.org >Cc: <stable@vger.kernel.org> # v3.12+ >Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> >--- > drivers/video/backlight/bd6107.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/drivers/video/backlight/bd6107.c >b/drivers/video/backlight/bd6107.c >index f4db6c064635b..e3410444ea235 100644 >--- a/drivers/video/backlight/bd6107.c >+++ b/drivers/video/backlight/bd6107.c >@@ -104,7 +104,7 @@ static int bd6107_backlight_check_fb(struct >backlight_device *backlight, > { > struct bd6107 *bd = bl_get_data(backlight); > >- return bd->pdata->fbdev == NULL || bd->pdata->fbdev == info->dev; >+ return bd->pdata->fbdev == NULL || bd->pdata->fbdev == info->device; Thomas, Looking at the fb.h file I see: struct device *device; /* This is the parent */ struct device *dev; /* This is this fb device */ Is this documentation "correct"? If so, how does that match what you are doing here? Thanks, M > } > > static const struct backlight_ops bd6107_backlight_ops = { >-- >2.41.0
Hi Am 12.06.23 um 17:17 schrieb Ruhl, Michael J: [...] > > Thomas, > > Looking at the fb.h file I see: > > struct device *device; /* This is the parent */ > struct device *dev; /* This is this fb device */ > > Is this documentation "correct"? If so, how does that match what you are doing here? The comments are correct. Let's go through what's happening here. The field 'device' is the Linux device (platform_device, pci_dev, etc.) and 'dev' is the fbdev character device that is /dev/fb*. We set 'device' where we allocate the fb_info in framebuffer_alloc() https://elixir.bootlin.com/linux/v6.3/source/drivers/video/fbdev/core/fbsysfs.c#L57 and we set 'dev' when we register the chrdev within register_framebuffer(). https://elixir.bootlin.com/linux/v6.3/source/drivers/video/fbdev/core/fbmem.c#L1555 (And the point of this patch series is to make the chrdev optional.) The problem with bd6107 is that is misses the part where it registers the platform device. The driver appears to be unused. But gpio_backlight from patches 3 and 4 works. The architecture code sets the 'fbdev' field from a platform-device structure at https://elixir.bootlin.com/linux/v6.3/source/arch/sh/boards/mach-ecovec24/setup.c#L389 and later creates the platform device as part of https://elixir.bootlin.com/linux/v6.3/source/arch/sh/boards/mach-ecovec24/setup.c#L1483 It will be used with the sh-mobile fbdev driver and become the 'device' field there. In the backlight code, the gpio_backlight driver copies the fbdev field at https://elixir.bootlin.com/linux/v6.3/source/drivers/video/backlight/gpio_backlight.c#L62 to later use it incorrectly in .check_fb. Hence, the helper has to compare the platform device to the 'device' field, not the 'dev' field; which is being fixed by this patchset. The two other drivers, bd6107 and lv5207lp, have the same bug. Best regards Thomas > > Thanks, > > M > >> } >> >> static const struct backlight_ops bd6107_backlight_ops = { >> -- >> 2.41.0 > -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
On Mon, Jun 12, 2023 at 04:07:39PM +0200, Thomas Zimmermann wrote: > Struct bd6107_platform_data refers to a platform device within > the Linux device hierarchy. The test in bd6107_backlight_check_fb() > compares it against the fbdev device in struct fb_info.dev, which > is different. Fix the test by comparing to struct fb_info.device. > > Fixes a bug in the backlight driver and prepares fbdev for making > struct fb_info.dev optional. > > v2: > * move renames into separate patch (Javier, Sam, Michael) > > Fixes: 67b43e590415 ("backlight: Add ROHM BD6107 backlight driver") > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> > Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > Cc: Lee Jones <lee@kernel.org> > Cc: Daniel Thompson <daniel.thompson@linaro.org> > Cc: Jingoo Han <jingoohan1@gmail.com> > Cc: dri-devel@lists.freedesktop.org > Cc: <stable@vger.kernel.org> # v3.12+ > Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Daniel. PS Please don't treat this as an Acked-by, if you want to land this patchset via a single tree please coordinate with Lee Jones!
Hi Am 13.06.23 um 12:37 schrieb Daniel Thompson: > On Mon, Jun 12, 2023 at 04:07:39PM +0200, Thomas Zimmermann wrote: >> Struct bd6107_platform_data refers to a platform device within >> the Linux device hierarchy. The test in bd6107_backlight_check_fb() >> compares it against the fbdev device in struct fb_info.dev, which >> is different. Fix the test by comparing to struct fb_info.device. >> >> Fixes a bug in the backlight driver and prepares fbdev for making >> struct fb_info.dev optional. >> >> v2: >> * move renames into separate patch (Javier, Sam, Michael) >> >> Fixes: 67b43e590415 ("backlight: Add ROHM BD6107 backlight driver") >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> >> Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> >> Cc: Lee Jones <lee@kernel.org> >> Cc: Daniel Thompson <daniel.thompson@linaro.org> >> Cc: Jingoo Han <jingoohan1@gmail.com> >> Cc: dri-devel@lists.freedesktop.org >> Cc: <stable@vger.kernel.org> # v3.12+ >> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> > > Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Thanks for going through the backlight patches. > > > Daniel. > > PS Please don't treat this as an Acked-by, if you want to land this > patchset via a single tree please coordinate with Lee Jones! I'd like to merge them via drm-misc-next together with the rest of the patchset. It's not DRM, but fbdev patches often go through that tree quite often. Best regards Thomas -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c index f4db6c064635b..e3410444ea235 100644 --- a/drivers/video/backlight/bd6107.c +++ b/drivers/video/backlight/bd6107.c @@ -104,7 +104,7 @@ static int bd6107_backlight_check_fb(struct backlight_device *backlight, { struct bd6107 *bd = bl_get_data(backlight); - return bd->pdata->fbdev == NULL || bd->pdata->fbdev == info->dev; + return bd->pdata->fbdev == NULL || bd->pdata->fbdev == info->device; } static const struct backlight_ops bd6107_backlight_ops = {