From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1A07C64990 for ; Thu, 25 Aug 2022 14:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242536AbiHYOl7 (ORCPT ); Thu, 25 Aug 2022 10:41:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241393AbiHYOkz (ORCPT ); Thu, 25 Aug 2022 10:40:55 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0E27AB4C1 for ; Thu, 25 Aug 2022 07:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661438364; h=from:from:reply-to:subject:subject: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=ZSViiSuhKNAdrLrYepEenjnf4H0dVHKO/KroQUbHaXc=; b=dx1AvbgzFWT4Mw/BbE9fwICEXfVtZEG3ULtvsIlmJxKgmEpELqDc6oNzn4csbkr4EWRROB L3i1LRoGEpSPsHN3YijqNUlLD4wLLAhYeR1RITnsBq2LXdLhSgi+8sEbFuRwlq5rpHJbH/ I6HK9q1nu5QlvR+0peWmqz1NBQ8jJJk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-362-bI0-f0_SMi69Q3m9OI_V0A-1; Thu, 25 Aug 2022 10:39:21 -0400 X-MC-Unique: bI0-f0_SMi69Q3m9OI_V0A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C79B185A794; Thu, 25 Aug 2022 14:39:20 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.193.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2ACA2166B26; Thu, 25 Aug 2022 14:39:16 +0000 (UTC) From: Hans de Goede To: Ben Skeggs , Karol Herbst , Lyude , Daniel Dadap , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , Pan@vger.kernel.org, Xinhui , "Rafael J . Wysocki" , Mika Westerberg , Lukas Wunner , Mark Gross , Andy Shevchenko Cc: Hans de Goede , nouveau@lists.freedesktop.org, Daniel Vetter , David Airlie , intel-gfx , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Len Brown , linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org, "Rafael J . Wysocki" Subject: [PATCH v5 27/31] ACPI: video: Remove acpi_video_set_dmi_backlight_type() Date: Thu, 25 Aug 2022 16:37:22 +0200 Message-Id: <20220825143726.269890-28-hdegoede@redhat.com> In-Reply-To: <20220825143726.269890-1-hdegoede@redhat.com> References: <20220825143726.269890-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org acpi_video_set_dmi_backlight_type() is troublesome because it may end up getting called after other backlight drivers have already called acpi_video_get_backlight_type() resulting in the other drivers already being registered even though they should not. In case of the acpi_video backlight, acpi_video_set_dmi_backlight_type() actually calls acpi_video_unregister_backlight() since that is often probed earlier, leading to userspace seeing the acpi_video0 class device being briefly available, leading to races in userspace where udev probe-rules try to access the device and it is already gone. All callers have been fixed to no longer call it, so remove acpi_video_set_dmi_backlight_type() now. This means we now also no longer need acpi_video_unregister_backlight() for the remove acpi_video backlight after it was wrongly registered hack, so remove that too. Acked-by: Rafael J. Wysocki Signed-off-by: Hans de Goede --- drivers/acpi/acpi_video.c | 10 ---------- drivers/acpi/video_detect.c | 16 ---------------- include/acpi/video.h | 4 ---- 3 files changed, 30 deletions(-) diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index d1e41f30c004..a7c3d11e0dac 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -2296,16 +2296,6 @@ void acpi_video_register_backlight(void) } EXPORT_SYMBOL(acpi_video_register_backlight); -void acpi_video_unregister_backlight(void) -{ - struct acpi_video_bus *video; - - mutex_lock(&video_list_lock); - list_for_each_entry(video, &video_bus_head, entry) - acpi_video_bus_unregister_backlight(video); - mutex_unlock(&video_list_lock); -} - bool acpi_video_handles_brightness_key_presses(void) { return may_report_brightness_keys && diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 3861d4121172..67a0211c07b4 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -38,8 +38,6 @@ #include #include -void acpi_video_unregister_backlight(void); - static enum acpi_backlight_type acpi_backlight_cmdline = acpi_backlight_undef; static enum acpi_backlight_type acpi_backlight_dmi = acpi_backlight_undef; @@ -817,17 +815,3 @@ bool acpi_video_backlight_use_native(void) return __acpi_video_get_backlight_type(true) == acpi_backlight_native; } EXPORT_SYMBOL(acpi_video_backlight_use_native); - -/* - * Set the preferred backlight interface type based on DMI info. - * This function allows DMI blacklists to be implemented by external - * platform drivers instead of putting a big blacklist in video_detect.c - */ -void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) -{ - acpi_backlight_dmi = type; - /* Remove acpi-video backlight interface if it is no longer desired */ - if (acpi_video_get_backlight_type() != acpi_backlight_video) - acpi_video_unregister_backlight(); -} -EXPORT_SYMBOL(acpi_video_set_dmi_backlight_type); diff --git a/include/acpi/video.h b/include/acpi/video.h index dbd48cb8bd23..a275c35e5249 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -60,7 +60,6 @@ extern int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, void **edid); extern enum acpi_backlight_type acpi_video_get_backlight_type(void); extern bool acpi_video_backlight_use_native(void); -extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type); /* * Note: The value returned by acpi_video_handles_brightness_key_presses() * may change over time and should not be cached. @@ -86,9 +85,6 @@ static inline bool acpi_video_backlight_use_native(void) { return true; } -static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) -{ -} static inline bool acpi_video_handles_brightness_key_presses(void) { return false; -- 2.37.2 From mboxrd@z Thu Jan 1 00:00:00 1970 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 1D524C64990 for ; Thu, 25 Aug 2022 14:41:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 31A9710E58A; Thu, 25 Aug 2022 14:39:38 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3D47E10E4F8 for ; Thu, 25 Aug 2022 14:39:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661438366; h=from:from:reply-to:subject:subject: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=ZSViiSuhKNAdrLrYepEenjnf4H0dVHKO/KroQUbHaXc=; b=F1zQV6TL7pGvGtn2GAtoJRJ16e7JqdOW0uuosvS8dXpjYQWDD97LK/YpufYWLwbeUdZgUE msC1BckwBMVUNPMQyq16l5dl+ChTxtzcea8n3MKdBCB1WfTqkboRszqk4D7rWrQA4kpok7 d6PbA5TsQf6k/5z+rDllT0HD1rSbhLM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-362-bI0-f0_SMi69Q3m9OI_V0A-1; Thu, 25 Aug 2022 10:39:21 -0400 X-MC-Unique: bI0-f0_SMi69Q3m9OI_V0A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C79B185A794; Thu, 25 Aug 2022 14:39:20 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.193.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2ACA2166B26; Thu, 25 Aug 2022 14:39:16 +0000 (UTC) From: Hans de Goede To: Ben Skeggs , Karol Herbst , Lyude , Daniel Dadap , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , Pan@freedesktop.org, Xinhui , "Rafael J . Wysocki" , Mika Westerberg , Lukas Wunner , Mark Gross , Andy Shevchenko Date: Thu, 25 Aug 2022 16:37:22 +0200 Message-Id: <20220825143726.269890-28-hdegoede@redhat.com> In-Reply-To: <20220825143726.269890-1-hdegoede@redhat.com> References: <20220825143726.269890-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Subject: [Nouveau] [PATCH v5 27/31] ACPI: video: Remove acpi_video_set_dmi_backlight_type() X-BeenThere: nouveau@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Nouveau development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-acpi@vger.kernel.org, nouveau@lists.freedesktop.org, intel-gfx , "Rafael J . Wysocki" , dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, Hans de Goede , amd-gfx@lists.freedesktop.org, Daniel Vetter , David Airlie , Len Brown Errors-To: nouveau-bounces@lists.freedesktop.org Sender: "Nouveau" acpi_video_set_dmi_backlight_type() is troublesome because it may end up getting called after other backlight drivers have already called acpi_video_get_backlight_type() resulting in the other drivers already being registered even though they should not. In case of the acpi_video backlight, acpi_video_set_dmi_backlight_type() actually calls acpi_video_unregister_backlight() since that is often probed earlier, leading to userspace seeing the acpi_video0 class device being briefly available, leading to races in userspace where udev probe-rules try to access the device and it is already gone. All callers have been fixed to no longer call it, so remove acpi_video_set_dmi_backlight_type() now. This means we now also no longer need acpi_video_unregister_backlight() for the remove acpi_video backlight after it was wrongly registered hack, so remove that too. Acked-by: Rafael J. Wysocki Signed-off-by: Hans de Goede --- drivers/acpi/acpi_video.c | 10 ---------- drivers/acpi/video_detect.c | 16 ---------------- include/acpi/video.h | 4 ---- 3 files changed, 30 deletions(-) diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index d1e41f30c004..a7c3d11e0dac 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -2296,16 +2296,6 @@ void acpi_video_register_backlight(void) } EXPORT_SYMBOL(acpi_video_register_backlight); -void acpi_video_unregister_backlight(void) -{ - struct acpi_video_bus *video; - - mutex_lock(&video_list_lock); - list_for_each_entry(video, &video_bus_head, entry) - acpi_video_bus_unregister_backlight(video); - mutex_unlock(&video_list_lock); -} - bool acpi_video_handles_brightness_key_presses(void) { return may_report_brightness_keys && diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 3861d4121172..67a0211c07b4 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -38,8 +38,6 @@ #include #include -void acpi_video_unregister_backlight(void); - static enum acpi_backlight_type acpi_backlight_cmdline = acpi_backlight_undef; static enum acpi_backlight_type acpi_backlight_dmi = acpi_backlight_undef; @@ -817,17 +815,3 @@ bool acpi_video_backlight_use_native(void) return __acpi_video_get_backlight_type(true) == acpi_backlight_native; } EXPORT_SYMBOL(acpi_video_backlight_use_native); - -/* - * Set the preferred backlight interface type based on DMI info. - * This function allows DMI blacklists to be implemented by external - * platform drivers instead of putting a big blacklist in video_detect.c - */ -void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) -{ - acpi_backlight_dmi = type; - /* Remove acpi-video backlight interface if it is no longer desired */ - if (acpi_video_get_backlight_type() != acpi_backlight_video) - acpi_video_unregister_backlight(); -} -EXPORT_SYMBOL(acpi_video_set_dmi_backlight_type); diff --git a/include/acpi/video.h b/include/acpi/video.h index dbd48cb8bd23..a275c35e5249 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -60,7 +60,6 @@ extern int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, void **edid); extern enum acpi_backlight_type acpi_video_get_backlight_type(void); extern bool acpi_video_backlight_use_native(void); -extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type); /* * Note: The value returned by acpi_video_handles_brightness_key_presses() * may change over time and should not be cached. @@ -86,9 +85,6 @@ static inline bool acpi_video_backlight_use_native(void) { return true; } -static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) -{ -} static inline bool acpi_video_handles_brightness_key_presses(void) { return false; -- 2.37.2 From mboxrd@z Thu Jan 1 00:00:00 1970 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 65F81C28D13 for ; Thu, 25 Aug 2022 14:42:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 78F4910E013; Thu, 25 Aug 2022 14:42:01 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D7D310E561 for ; Thu, 25 Aug 2022 14:39:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661438365; h=from:from:reply-to:subject:subject: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=ZSViiSuhKNAdrLrYepEenjnf4H0dVHKO/KroQUbHaXc=; b=EuPXCJS4VeXs1pKkhIVCBtnILzkx97iVVo4J0Np03Qg/NeWMJt7wRAs3dNiucD1F6h0TEc xL69PBlcPA2kwy6h2ENw3W34ltHbYkV4qPGagM8gHCgdt9VTccAE0gL4kJ5FGFjdD6dKkG cA0aRn0nbRP7a1wM0BB7ZmvmxlycXps= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-362-bI0-f0_SMi69Q3m9OI_V0A-1; Thu, 25 Aug 2022 10:39:21 -0400 X-MC-Unique: bI0-f0_SMi69Q3m9OI_V0A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C79B185A794; Thu, 25 Aug 2022 14:39:20 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.193.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2ACA2166B26; Thu, 25 Aug 2022 14:39:16 +0000 (UTC) From: Hans de Goede To: Ben Skeggs , Karol Herbst , Lyude , Daniel Dadap , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , Pan@freedesktop.org, Xinhui , "Rafael J . Wysocki" , Mika Westerberg , Lukas Wunner , Mark Gross , Andy Shevchenko Subject: [PATCH v5 27/31] ACPI: video: Remove acpi_video_set_dmi_backlight_type() Date: Thu, 25 Aug 2022 16:37:22 +0200 Message-Id: <20220825143726.269890-28-hdegoede@redhat.com> In-Reply-To: <20220825143726.269890-1-hdegoede@redhat.com> References: <20220825143726.269890-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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: , Cc: linux-acpi@vger.kernel.org, nouveau@lists.freedesktop.org, intel-gfx , "Rafael J . Wysocki" , dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, Hans de Goede , amd-gfx@lists.freedesktop.org, David Airlie , Len Brown Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" acpi_video_set_dmi_backlight_type() is troublesome because it may end up getting called after other backlight drivers have already called acpi_video_get_backlight_type() resulting in the other drivers already being registered even though they should not. In case of the acpi_video backlight, acpi_video_set_dmi_backlight_type() actually calls acpi_video_unregister_backlight() since that is often probed earlier, leading to userspace seeing the acpi_video0 class device being briefly available, leading to races in userspace where udev probe-rules try to access the device and it is already gone. All callers have been fixed to no longer call it, so remove acpi_video_set_dmi_backlight_type() now. This means we now also no longer need acpi_video_unregister_backlight() for the remove acpi_video backlight after it was wrongly registered hack, so remove that too. Acked-by: Rafael J. Wysocki Signed-off-by: Hans de Goede --- drivers/acpi/acpi_video.c | 10 ---------- drivers/acpi/video_detect.c | 16 ---------------- include/acpi/video.h | 4 ---- 3 files changed, 30 deletions(-) diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index d1e41f30c004..a7c3d11e0dac 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -2296,16 +2296,6 @@ void acpi_video_register_backlight(void) } EXPORT_SYMBOL(acpi_video_register_backlight); -void acpi_video_unregister_backlight(void) -{ - struct acpi_video_bus *video; - - mutex_lock(&video_list_lock); - list_for_each_entry(video, &video_bus_head, entry) - acpi_video_bus_unregister_backlight(video); - mutex_unlock(&video_list_lock); -} - bool acpi_video_handles_brightness_key_presses(void) { return may_report_brightness_keys && diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 3861d4121172..67a0211c07b4 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -38,8 +38,6 @@ #include #include -void acpi_video_unregister_backlight(void); - static enum acpi_backlight_type acpi_backlight_cmdline = acpi_backlight_undef; static enum acpi_backlight_type acpi_backlight_dmi = acpi_backlight_undef; @@ -817,17 +815,3 @@ bool acpi_video_backlight_use_native(void) return __acpi_video_get_backlight_type(true) == acpi_backlight_native; } EXPORT_SYMBOL(acpi_video_backlight_use_native); - -/* - * Set the preferred backlight interface type based on DMI info. - * This function allows DMI blacklists to be implemented by external - * platform drivers instead of putting a big blacklist in video_detect.c - */ -void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) -{ - acpi_backlight_dmi = type; - /* Remove acpi-video backlight interface if it is no longer desired */ - if (acpi_video_get_backlight_type() != acpi_backlight_video) - acpi_video_unregister_backlight(); -} -EXPORT_SYMBOL(acpi_video_set_dmi_backlight_type); diff --git a/include/acpi/video.h b/include/acpi/video.h index dbd48cb8bd23..a275c35e5249 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -60,7 +60,6 @@ extern int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, void **edid); extern enum acpi_backlight_type acpi_video_get_backlight_type(void); extern bool acpi_video_backlight_use_native(void); -extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type); /* * Note: The value returned by acpi_video_handles_brightness_key_presses() * may change over time and should not be cached. @@ -86,9 +85,6 @@ static inline bool acpi_video_backlight_use_native(void) { return true; } -static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) -{ -} static inline bool acpi_video_handles_brightness_key_presses(void) { return false; -- 2.37.2 From mboxrd@z Thu Jan 1 00:00:00 1970 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 A7309C64990 for ; Thu, 25 Aug 2022 14:41:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1CC510E512; Thu, 25 Aug 2022 14:39:52 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 975D010E51F for ; Thu, 25 Aug 2022 14:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661438364; h=from:from:reply-to:subject:subject: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=ZSViiSuhKNAdrLrYepEenjnf4H0dVHKO/KroQUbHaXc=; b=dx1AvbgzFWT4Mw/BbE9fwICEXfVtZEG3ULtvsIlmJxKgmEpELqDc6oNzn4csbkr4EWRROB L3i1LRoGEpSPsHN3YijqNUlLD4wLLAhYeR1RITnsBq2LXdLhSgi+8sEbFuRwlq5rpHJbH/ I6HK9q1nu5QlvR+0peWmqz1NBQ8jJJk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-362-bI0-f0_SMi69Q3m9OI_V0A-1; Thu, 25 Aug 2022 10:39:21 -0400 X-MC-Unique: bI0-f0_SMi69Q3m9OI_V0A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C79B185A794; Thu, 25 Aug 2022 14:39:20 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.193.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2ACA2166B26; Thu, 25 Aug 2022 14:39:16 +0000 (UTC) From: Hans de Goede To: Ben Skeggs , Karol Herbst , Lyude , Daniel Dadap , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , Pan@freedesktop.org, Xinhui , "Rafael J . Wysocki" , Mika Westerberg , Lukas Wunner , Mark Gross , Andy Shevchenko Date: Thu, 25 Aug 2022 16:37:22 +0200 Message-Id: <20220825143726.269890-28-hdegoede@redhat.com> In-Reply-To: <20220825143726.269890-1-hdegoede@redhat.com> References: <20220825143726.269890-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Subject: [Intel-gfx] [PATCH v5 27/31] ACPI: video: Remove acpi_video_set_dmi_backlight_type() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-acpi@vger.kernel.org, nouveau@lists.freedesktop.org, intel-gfx , "Rafael J . Wysocki" , dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, amd-gfx@lists.freedesktop.org, Daniel Vetter , David Airlie , Len Brown Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" acpi_video_set_dmi_backlight_type() is troublesome because it may end up getting called after other backlight drivers have already called acpi_video_get_backlight_type() resulting in the other drivers already being registered even though they should not. In case of the acpi_video backlight, acpi_video_set_dmi_backlight_type() actually calls acpi_video_unregister_backlight() since that is often probed earlier, leading to userspace seeing the acpi_video0 class device being briefly available, leading to races in userspace where udev probe-rules try to access the device and it is already gone. All callers have been fixed to no longer call it, so remove acpi_video_set_dmi_backlight_type() now. This means we now also no longer need acpi_video_unregister_backlight() for the remove acpi_video backlight after it was wrongly registered hack, so remove that too. Acked-by: Rafael J. Wysocki Signed-off-by: Hans de Goede --- drivers/acpi/acpi_video.c | 10 ---------- drivers/acpi/video_detect.c | 16 ---------------- include/acpi/video.h | 4 ---- 3 files changed, 30 deletions(-) diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index d1e41f30c004..a7c3d11e0dac 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -2296,16 +2296,6 @@ void acpi_video_register_backlight(void) } EXPORT_SYMBOL(acpi_video_register_backlight); -void acpi_video_unregister_backlight(void) -{ - struct acpi_video_bus *video; - - mutex_lock(&video_list_lock); - list_for_each_entry(video, &video_bus_head, entry) - acpi_video_bus_unregister_backlight(video); - mutex_unlock(&video_list_lock); -} - bool acpi_video_handles_brightness_key_presses(void) { return may_report_brightness_keys && diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 3861d4121172..67a0211c07b4 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -38,8 +38,6 @@ #include #include -void acpi_video_unregister_backlight(void); - static enum acpi_backlight_type acpi_backlight_cmdline = acpi_backlight_undef; static enum acpi_backlight_type acpi_backlight_dmi = acpi_backlight_undef; @@ -817,17 +815,3 @@ bool acpi_video_backlight_use_native(void) return __acpi_video_get_backlight_type(true) == acpi_backlight_native; } EXPORT_SYMBOL(acpi_video_backlight_use_native); - -/* - * Set the preferred backlight interface type based on DMI info. - * This function allows DMI blacklists to be implemented by external - * platform drivers instead of putting a big blacklist in video_detect.c - */ -void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) -{ - acpi_backlight_dmi = type; - /* Remove acpi-video backlight interface if it is no longer desired */ - if (acpi_video_get_backlight_type() != acpi_backlight_video) - acpi_video_unregister_backlight(); -} -EXPORT_SYMBOL(acpi_video_set_dmi_backlight_type); diff --git a/include/acpi/video.h b/include/acpi/video.h index dbd48cb8bd23..a275c35e5249 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -60,7 +60,6 @@ extern int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, void **edid); extern enum acpi_backlight_type acpi_video_get_backlight_type(void); extern bool acpi_video_backlight_use_native(void); -extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type); /* * Note: The value returned by acpi_video_handles_brightness_key_presses() * may change over time and should not be cached. @@ -86,9 +85,6 @@ static inline bool acpi_video_backlight_use_native(void) { return true; } -static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) -{ -} static inline bool acpi_video_handles_brightness_key_presses(void) { return false; -- 2.37.2 From mboxrd@z Thu Jan 1 00:00:00 1970 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 A94A0C65C0D for ; Thu, 25 Aug 2022 14:44:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6B0F510E441; Thu, 25 Aug 2022 14:44:06 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7E31B10E559 for ; Thu, 25 Aug 2022 14:39:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661438365; h=from:from:reply-to:subject:subject: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=ZSViiSuhKNAdrLrYepEenjnf4H0dVHKO/KroQUbHaXc=; b=EuPXCJS4VeXs1pKkhIVCBtnILzkx97iVVo4J0Np03Qg/NeWMJt7wRAs3dNiucD1F6h0TEc xL69PBlcPA2kwy6h2ENw3W34ltHbYkV4qPGagM8gHCgdt9VTccAE0gL4kJ5FGFjdD6dKkG cA0aRn0nbRP7a1wM0BB7ZmvmxlycXps= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-362-bI0-f0_SMi69Q3m9OI_V0A-1; Thu, 25 Aug 2022 10:39:21 -0400 X-MC-Unique: bI0-f0_SMi69Q3m9OI_V0A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C79B185A794; Thu, 25 Aug 2022 14:39:20 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.193.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2ACA2166B26; Thu, 25 Aug 2022 14:39:16 +0000 (UTC) From: Hans de Goede To: Ben Skeggs , Karol Herbst , Lyude , Daniel Dadap , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , Pan@freedesktop.org, Xinhui , "Rafael J . Wysocki" , Mika Westerberg , Lukas Wunner , Mark Gross , Andy Shevchenko Subject: [PATCH v5 27/31] ACPI: video: Remove acpi_video_set_dmi_backlight_type() Date: Thu, 25 Aug 2022 16:37:22 +0200 Message-Id: <20220825143726.269890-28-hdegoede@redhat.com> In-Reply-To: <20220825143726.269890-1-hdegoede@redhat.com> References: <20220825143726.269890-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Mailman-Approved-At: Thu, 25 Aug 2022 14:43:48 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-acpi@vger.kernel.org, nouveau@lists.freedesktop.org, intel-gfx , "Rafael J . Wysocki" , dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, Hans de Goede , amd-gfx@lists.freedesktop.org, Daniel Vetter , David Airlie , Len Brown Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" acpi_video_set_dmi_backlight_type() is troublesome because it may end up getting called after other backlight drivers have already called acpi_video_get_backlight_type() resulting in the other drivers already being registered even though they should not. In case of the acpi_video backlight, acpi_video_set_dmi_backlight_type() actually calls acpi_video_unregister_backlight() since that is often probed earlier, leading to userspace seeing the acpi_video0 class device being briefly available, leading to races in userspace where udev probe-rules try to access the device and it is already gone. All callers have been fixed to no longer call it, so remove acpi_video_set_dmi_backlight_type() now. This means we now also no longer need acpi_video_unregister_backlight() for the remove acpi_video backlight after it was wrongly registered hack, so remove that too. Acked-by: Rafael J. Wysocki Signed-off-by: Hans de Goede --- drivers/acpi/acpi_video.c | 10 ---------- drivers/acpi/video_detect.c | 16 ---------------- include/acpi/video.h | 4 ---- 3 files changed, 30 deletions(-) diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index d1e41f30c004..a7c3d11e0dac 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -2296,16 +2296,6 @@ void acpi_video_register_backlight(void) } EXPORT_SYMBOL(acpi_video_register_backlight); -void acpi_video_unregister_backlight(void) -{ - struct acpi_video_bus *video; - - mutex_lock(&video_list_lock); - list_for_each_entry(video, &video_bus_head, entry) - acpi_video_bus_unregister_backlight(video); - mutex_unlock(&video_list_lock); -} - bool acpi_video_handles_brightness_key_presses(void) { return may_report_brightness_keys && diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 3861d4121172..67a0211c07b4 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -38,8 +38,6 @@ #include #include -void acpi_video_unregister_backlight(void); - static enum acpi_backlight_type acpi_backlight_cmdline = acpi_backlight_undef; static enum acpi_backlight_type acpi_backlight_dmi = acpi_backlight_undef; @@ -817,17 +815,3 @@ bool acpi_video_backlight_use_native(void) return __acpi_video_get_backlight_type(true) == acpi_backlight_native; } EXPORT_SYMBOL(acpi_video_backlight_use_native); - -/* - * Set the preferred backlight interface type based on DMI info. - * This function allows DMI blacklists to be implemented by external - * platform drivers instead of putting a big blacklist in video_detect.c - */ -void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) -{ - acpi_backlight_dmi = type; - /* Remove acpi-video backlight interface if it is no longer desired */ - if (acpi_video_get_backlight_type() != acpi_backlight_video) - acpi_video_unregister_backlight(); -} -EXPORT_SYMBOL(acpi_video_set_dmi_backlight_type); diff --git a/include/acpi/video.h b/include/acpi/video.h index dbd48cb8bd23..a275c35e5249 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h @@ -60,7 +60,6 @@ extern int acpi_video_get_edid(struct acpi_device *device, int type, int device_id, void **edid); extern enum acpi_backlight_type acpi_video_get_backlight_type(void); extern bool acpi_video_backlight_use_native(void); -extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type); /* * Note: The value returned by acpi_video_handles_brightness_key_presses() * may change over time and should not be cached. @@ -86,9 +85,6 @@ static inline bool acpi_video_backlight_use_native(void) { return true; } -static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type) -{ -} static inline bool acpi_video_handles_brightness_key_presses(void) { return false; -- 2.37.2