Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751480AbdINHmV (ORCPT ); Thu, 14 Sep 2017 03:42:21 -0400 Received: from esa3.dell-outbound.iphmx.com ([68.232.153.94]:5039 "EHLO esa3.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751265AbdINHmT (ORCPT ); Thu, 14 Sep 2017 03:42:19 -0400 From: X-LoopCount0: from 10.0.2.213 X-IronPort-AV: E=Sophos;i="5.42,391,1500958800"; d="scan'208";a="148196960" 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: AQHTLLSVuR5xYYUojUGNvKrrghaW4aKz7E6g Date: Thu, 14 Sep 2017 06:42:03 +0000 Message-ID: <27f4070678744d0f80761a95579b4cd3@ausx13mpc120.AMER.DELL.COM> References: <1504884191-16528-1-git-send-email-mario.limonciello@dell.com> <20170913172024.GA8782@wunner.de> In-Reply-To: <20170913172024.GA8782@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 v8E7gPeA009279 Content-Length: 1876 Lines: 50 > -----Original Message----- > From: Lukas Wunner [mailto:lukas@wunner.de] > Sent: Wednesday, September 13, 2017 12:20 PM > To: Limonciello, Mario > Cc: dvhart@infradead.org; LKML ; platform-driver- > x86@vger.kernel.org; Richard Hughes ; Yehezkel Bernat > ; Mika Westerberg > Subject: Re: [PATCH v3] Add driver to force WMI Thunderbolt controller power > status > > Sorry, late to the party. > > On Fri, Sep 08, 2017 at 10:23:11AM -0500, Mario Limonciello wrote: > > + mode = hex_to_bin(buf[0]); > > + if (mode == 0 || mode == 1) { > > + status = wmi_evaluate_method(INTEL_WMI_THUNDERBOLT_GUID, > 0, 1, > > + &input, NULL); > > + if (ACPI_FAILURE(status)) { > > + pr_err("intel-wmi-thunderbolt: failed setting %s\n", > > + buf); > > + return -ENODEV; > > + } > > + } else { > > + pr_err("intel-wmi-thunderbolt: unsupported mode: %d", mode); > > + } > > + return count; > > +} > > Seems odd to allow user space to fill the log by writing invalid data > to sysfs, likewise that success is returned in the else case. > I'd drop both pr_err() and return -EINVAL in the else case. > Seems fine to me. As Darren already queued the patch, I'll send a follow up patch to fix these two cases. > > > +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/e0f25a3f2d052e36ff67a9b4db835c3e27e950d8/include/linux/wmi.h#L55 https://github.com/torvalds/linux/blob/master/include/linux/device.h#L1487