From patchwork Mon Feb 12 16:16:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13553472 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7CA12C4829B for ; Mon, 12 Feb 2024 16:26:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7013B10E813; Mon, 12 Feb 2024 16:26:52 +0000 (UTC) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by gabe.freedesktop.org (Postfix) with ESMTPS id 041B610E800 for ; Mon, 12 Feb 2024 16:26:51 +0000 (UTC) Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7508E1FD53; Mon, 12 Feb 2024 16:26:49 +0000 (UTC) Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 34E6F13A3D; Mon, 12 Feb 2024 16:26:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id gDOlC8lGymXmXgAAn2gu4w (envelope-from ); Mon, 12 Feb 2024 16:26:49 +0000 From: Thomas Zimmermann To: lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, deller@gmx.de, javierm@redhat.com Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-input@vger.kernel.org, linux-pwm@vger.kernel.org, Thomas Zimmermann Subject: [PATCH 01/10] backlight: Match backlight device against struct fb_info.bl_dev Date: Mon, 12 Feb 2024 17:16:34 +0100 Message-ID: <20240212162645.5661-2-tzimmermann@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240212162645.5661-1-tzimmermann@suse.de> References: <20240212162645.5661-1-tzimmermann@suse.de> MIME-Version: 1.0 Authentication-Results: smtp-out2.suse.de; none X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Rspamd-Queue-Id: 7508E1FD53 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Framebuffer drivers for devices with dedicated backlight are supposed to set struct fb_info.bl_dev to the backlight's respective device. Use the value to match backlight and framebuffer in the backlight core code. Signed-off-by: Thomas Zimmermann Reviewed-by: Daniel Thompson Reviewed-by: Javier Martinez Canillas --- drivers/video/backlight/backlight.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 86e1cdc8e3697..48844a4f28ad3 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -98,7 +98,8 @@ static int fb_notifier_callback(struct notifier_block *self, { struct backlight_device *bd; struct fb_event *evdata = data; - int node = evdata->info->node; + struct fb_info *info = evdata->info; + int node = info->node; int fb_blank = 0; /* If we aren't interested in this event, skip it immediately ... */ @@ -110,8 +111,12 @@ static int fb_notifier_callback(struct notifier_block *self, if (!bd->ops) goto out; - if (bd->ops->check_fb && !bd->ops->check_fb(bd, evdata->info)) + else if (bd->ops->check_fb && !bd->ops->check_fb(bd, info)) goto out; +#if IS_ENABLED(CONFIG_FB_BACKLIGHT) + else if (info->bl_dev && info->bl_dev != bd) + goto out; +#endif fb_blank = *(int *)evdata->data; if (fb_blank == FB_BLANK_UNBLANK && !bd->fb_bl_on[node]) {