Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1732085

RE: [PATCH v3] Add driver to force WMI Thunderbolt controller power status

From <Mario.Limonciello@dell.com>
Newsgroups linux.kernel
Subject RE: [PATCH v3] Add driver to force WMI Thunderbolt controller power status
Date 2017-09-14 09:50 +0200
Message-ID <upx4n-293-11@gated-at.bofh.it> (permalink)
References <untoe-qu-21@gated-at.bofh.it> <upjE5-1RR-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> -----Original Message-----
> From: Lukas Wunner [mailto:lukas@wunner.de]
> Sent: Wednesday, September 13, 2017 12:20 PM
> To: Limonciello, Mario <Mario_Limonciello@Dell.com>
> Cc: dvhart@infradead.org; LKML <linux-kernel@vger.kernel.org>; platform-driver-
> x86@vger.kernel.org; Richard Hughes <hughsient@gmail.com>; Yehezkel Bernat
> <yehezkelshb@gmail.com>; Mika Westerberg <mika.westerberg@linux.intel.com>
> 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
 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v3] Add driver to force WMI Thunderbolt controller power  status Lukas Wunner <lukas@wunner.de> - 2017-09-13 19:30 +0200
  RE: [PATCH v3] Add driver to force WMI Thunderbolt controller power  status <Mario.Limonciello@dell.com> - 2017-09-14 09:50 +0200
    Re: [PATCH v3] Add driver to force WMI Thunderbolt controller power  status Lukas Wunner <lukas@wunner.de> - 2017-09-14 11:30 +0200
      RE: [PATCH v3] Add driver to force WMI Thunderbolt controller power  status <Mario.Limonciello@dell.com> - 2017-09-14 17:00 +0200
        Re: [PATCH v3] Add driver to force WMI Thunderbolt controller power  status Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-14 17:10 +0200
          Re: [PATCH v3] Add driver to force WMI Thunderbolt controller power  status Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-14 17:20 +0200
          Re: [PATCH v3] Add driver to force WMI Thunderbolt controller power  status Lukas Wunner <lukas@wunner.de> - 2017-09-15 09:50 +0200
            RE: [PATCH v3] Add driver to force WMI Thunderbolt controller power  status <Mario.Limonciello@dell.com> - 2017-09-15 18:40 +0200

csiph-web