From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752172AbdJCPSG (ORCPT ); Tue, 3 Oct 2017 11:18:06 -0400 Received: from esa7.dell-outbound.iphmx.com ([68.232.153.96]:45699 "EHLO esa7.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751942AbdJCPSD (ORCPT ); Tue, 3 Oct 2017 11:18:03 -0400 From: X-LoopCount0: from 10.166.132.187 X-IronPort-AV: E=Sophos;i="5.42,474,1500958800"; d="scan'208";a="68651407" X-DLP: DLP_GlobalPCIDSS To: CC: , , , , , , Subject: RE: [PATCH v3 4/8] platform/x86: wmi: create character devices when requested by drivers Thread-Topic: [PATCH v3 4/8] platform/x86: wmi: create character devices when requested by drivers Thread-Index: AQHTPClNs8ArSW0bhE6Px1JsMwinOaLSO+jw Date: Tue, 3 Oct 2017 15:13:35 +0000 Message-ID: References: <17fcf9748e83ede2751a00d8248cb32cbdc610d6.1506571188.git.mario.limonciello@dell.com> <20171003092342.GB13295@kroah.com> In-Reply-To: <20171003092342.GB13295@kroah.com> 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.18.86] Content-Type: text/plain; charset="utf-8" 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 base64 to 8bit by nfs id v93FIAG1031193 > -----Original Message----- > From: Greg KH [mailto:greg@kroah.com] > Sent: Tuesday, October 3, 2017 4:24 AM > To: Limonciello, Mario > Cc: dvhart@infradead.org; Andy Shevchenko ; > LKML ; platform-driver-x86@vger.kernel.org; > Andy Lutomirski ; quasisec@google.com; > pali.rohar@gmail.com > Subject: Re: [PATCH v3 4/8] platform/x86: wmi: create character devices when > requested by drivers > > On Wed, Sep 27, 2017 at 11:02:16PM -0500, Mario Limonciello wrote: > > For WMI operations that are only Set or Query read or write sysfs > > attributes created by WMI vendor drivers make sense. > > > > For other WMI operations that are run on Method, there needs to be a > > way to guarantee to userspace that the results from the method call > > belong to the data request to the method call. Sysfs attributes don't > > work well in this scenario because two userspace processes may be > > competing at reading/writing an attribute and step on each other's > > data. > > > > When a WMI vendor driver declares a set of functions in a > > file_operations object the WMI bus driver will create a character > > device that maps to those file operations. > > > > That character device will correspond to this path: > > /dev/wmi/$driver > > > > This policy is selected as one driver may map and use multiple > > GUIDs and it would be better to only expose a single character > > device. > > > > The WMI vendor drivers will be responsible for managing access to > > this character device and proper locking on it. > > > > When a WMI vendor driver is unloaded the WMI bus driver will clean > > up the character device. > > > > Signed-off-by: Mario Limonciello > > --- > > drivers/platform/x86/wmi.c | 98 > +++++++++++++++++++++++++++++++++++++++++++--- > > include/linux/wmi.h | 1 + > > 2 files changed, 94 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c > > index 4d73a87c2ddf..17399df87948 100644 > > --- a/drivers/platform/x86/wmi.c > > +++ b/drivers/platform/x86/wmi.c > > @@ -34,7 +34,9 @@ > > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > > > #include > > +#include > > #include > > +#include > > #include > > #include > > #include > > @@ -50,6 +52,9 @@ MODULE_AUTHOR("Carlos Corbacho"); > > MODULE_DESCRIPTION("ACPI-WMI Mapping Driver"); > > MODULE_LICENSE("GPL"); > > > > +#define WMI_MAX_DEVS MINORMASK > > +static DEFINE_IDR(wmi_idr); > > You never free the idr's memory when you unload the module :( Whoops thanks, will fix. ☹