Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751797AbdINOxv (ORCPT ); Thu, 14 Sep 2017 10:53:51 -0400 Received: from esa1.dell-outbound.iphmx.com ([68.232.153.90]:9989 "EHLO esa1.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751733AbdINOxr (ORCPT ); Thu, 14 Sep 2017 10:53:47 -0400 From: X-LoopCount0: from 10.175.216.251 X-IronPort-AV: E=Sophos;i="5.42,393,1500958800"; d="scan'208";a="148400535" X-DLP: DLP_GlobalPCIDSS To: CC: , , , , , Subject: RE: [PATCH v3] Add driver to force WMI Thunderbolt controller power status Thread-Topic: [PATCH v3] Add driver to force WMI Thunderbolt controller power status Thread-Index: AQHTLLSVuR5xYYUojUGNvKrrghaW4aKz7E6ggACBxwCAAApgoA== Date: Thu, 14 Sep 2017 14:52:27 +0000 Message-ID: <58820c0d563845659030881cd44cfe97@ausx13mpc120.AMER.DELL.COM> References: <1504884191-16528-1-git-send-email-mario.limonciello@dell.com> <20170913172024.GA8782@wunner.de> <27f4070678744d0f80761a95579b4cd3@ausx13mpc120.AMER.DELL.COM> <20170914091416.GA28049@wunner.de> In-Reply-To: <20170914091416.GA28049@wunner.de> 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 v8EErvFf009741 Content-Length: 1773 Lines: 40 > -----Original Message----- > From: Lukas Wunner [mailto:lukas@wunner.de] > Sent: Thursday, September 14, 2017 4:14 AM > To: Limonciello, Mario > Cc: dvhart@infradead.org; linux-kernel@vger.kernel.org; platform-driver- > x86@vger.kernel.org; hughsient@gmail.com; yehezkelshb@gmail.com; > mika.westerberg@linux.intel.com > Subject: Re: [PATCH v3] Add driver to force WMI Thunderbolt controller power > status > > On Thu, Sep 14, 2017 at 06:42:03AM +0000, Mario.Limonciello@dell.com wrote: > > > On Fri, Sep 08, 2017 at 10:23:11AM -0500, Mario Limonciello wrote: > > > > +static const struct wmi_device_id intel_wmi_thunderbolt_id_table[] = { > > > > + { .guid_string = INTEL_WMI_THUNDERBOLT_GUID }, > > > > + { }, > > > > +}; > > > > > > I'm not familiar with WMI, but don't you need a MODULE_DEVICE_TABLE here? > > > How does user space know which module to load upon receiving the uevent? > > > > Some macros for WMI bus devices. > > > https://github.com/torvalds/linux/blob/e0f25a3f2d052e36ff67a9b4db835c3e27e9 > 50d8/include/linux/wmi.h#L55 > > https://github.com/torvalds/linux/blob/master/include/linux/device.h#L1487 > > No, the init and exit hooks defined by this macro are executed > *after* the module has been loaded. The question was, how does > the module get loaded in the first place? > > Looking at drivers/platform/x86/wmi.c:wmi_dev_uevent() it seems that > a modalias consisting of "wmi:" followed by the GUID is sent to udevd. > For udevd to then load the module, I suspect you need to add a > MODULE_DEVICE_TABLE(wmi, ...) to your driver. Ah, you're looking for this code from the WMI bus driver: https://github.com/torvalds/linux/blob/master/drivers/platform/x86/wmi.c#L724 That happens when the bus is initialized.