From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752203AbcAEMUl (ORCPT ); Tue, 5 Jan 2016 07:20:41 -0500 Received: from v094114.home.net.pl ([79.96.170.134]:59824 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751614AbcAEMUh (ORCPT ); Tue, 5 Jan 2016 07:20:37 -0500 From: "Rafael J. Wysocki" To: Hans de Goede Cc: Adrien Schildknecht , rui.zhang@intel.com, lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Pali =?ISO-8859-1?Q?Roh=E1r?= , jmmahler@gmail.com, ibm-acpi@hmh.eng.br Subject: Re: [PATCH] ACPI / video: driver must be registered before checking for keypresses Date: Tue, 05 Jan 2016 13:51:17 +0100 Message-ID: <5472545.fTVKdflT9H@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.1.0-rc5+; KDE/4.11.5; x86_64; ; ) In-Reply-To: <568BAC7A.5040907@redhat.com> References: <1451946148-24948-1-git-send-email-adrien+dev@schischi.me> <568BAC7A.5040907@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, January 05, 2016 12:43:54 PM Hans de Goede wrote: > Hi, > > On 04-01-16 23:22, Adrien Schildknecht wrote: > > acpi_video_handles_brightness_key_presses() may use an uninitialized mutex. > > The error has been reported by lockdep: DEBUG_LOCKS_WARN_ON(l->magic != l). > > The function assumes that the video driver has been registered before being > > called. As explained in the comment of acpi_video_init(), the registration > > of the video class may be defered and thus may not take place in the init > > function of the module. > > > > Use completion mechanisms to make sure that > > acpi_video_handles_brightness_key_presses() wait for the completion of > > acpi_video_register() before using the mutex. > > Also get rid of register_count since task completion can replace it. > > > > Signed-off-by: Adrien Schildknecht > > Thanks for the fix, my first instinct was that there should be an easier > fix, but thinking more about it this and how this function is used > in thinkpad_acpi. this is indeed the correct way to fix this: > > Reviewed-by: Hans de Goede > > Rafael, can you please add this fix to acpi-next ? I will, thanks! Rafael