From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753227AbdKCOm7 (ORCPT ); Fri, 3 Nov 2017 10:42:59 -0400 Received: from esa1.dell-outbound.iphmx.com ([68.232.153.90]:59192 "EHLO esa1.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751304AbdKCOm5 (ORCPT ); Fri, 3 Nov 2017 10:42:57 -0400 From: X-LoopCount0: from 10.166.132.198 X-IronPort-AV: E=Sophos;i="5.44,339,1505797200"; d="scan'208";a="82787360" X-DLP: DLP_GlobalPCIDSS To: CC: , , , Subject: RE: [PATCH] platform/x86: dell-*wmi*: Relay failed initial probe to dependent drivers Thread-Topic: [PATCH] platform/x86: dell-*wmi*: Relay failed initial probe to dependent drivers Thread-Index: AQHTVD6bd+NDI4rRK0yMcS5QoHJWk6MCu2UQ Date: Fri, 3 Nov 2017 14:42:55 +0000 Message-ID: <8a19372f91e34d96ab16e8d4c31b0c86@ausx13mpc124.AMER.DELL.COM> References: <20171103005632.GB7971@fury> In-Reply-To: <20171103005632.GB7971@fury> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.143.242.75] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id vA3Eh4VT015945 > -----Original Message----- > From: Darren Hart [mailto:dvhart@infradead.org] > Sent: Thursday, November 2, 2017 7:57 PM > To: Limonciello, Mario > Cc: Andy Shevchenko ; LKML kernel@vger.kernel.org>; platform-driver-x86@vger.kernel.org; > pali.rohar@gmail.com > Subject: Re: [PATCH] platform/x86: dell-*wmi*: Relay failed initial probe to > dependent drivers > > On Wed, Nov 01, 2017 at 02:28:21PM -0500, Mario Limonciello wrote: > > dell-wmi and dell-smbios-wmi are dependent upon dell-wmi-descriptor > > finishing probe successfully to probe themselves. > > > > Currently if dell-wmi-descriptor fails probing in a non-recoverable way > > (such as invalid header) dell-wmi and dell-smbios-wmi will continue to > > try to redo probing due to deferred probing. > > > > To solve this have the dependent drivers query the dell-wmi-descriptor > > driver whether the descriptor has been determined valid. The possible > > results are: > > -EPROBE_DEFER: Descriptor not yet probed, dependent driver should wait > > and use deferred probing > > < 0: Descriptor probed, invalid. Dependent driver should return an > > error. > > 0: Successful descriptor probe, dependent driver can continue > > > > Successful descriptor probe still doesn't mean that the descriptor driver > > is necessarily bound at the time of initialization of dependent driver. > > Userspace can unbind the driver, so all methods used from driver > > should still be verified to return success values otherwise deferred > > probing be used. > > > > Signed-off-by: Mario Limonciello > > > diff --git a/drivers/platform/x86/dell-wmi-descriptor.c > b/drivers/platform/x86/dell-wmi-descriptor.c > > index 3204c408e261..33c6c7d66f8c 100644 > > --- a/drivers/platform/x86/dell-wmi-descriptor.c > > +++ b/drivers/platform/x86/dell-wmi-descriptor.c > > @@ -26,9 +26,16 @@ struct descriptor_priv { > > u32 interface_version; > > u32 size; > > }; > > +static int descriptor_valid; > > This initializes to 0, which I believe creates an odd race window between when > this init is called and when the first driver calls > dell_wmi_get_descriptor_valid(). Seems like initializing to -EPROBE_DEFER here > in the declaration would be a better right approach. > > -- Thanks, good catch. I'll adjust.