Re: [PATCH v8 08/12] mfd: intel-peci-client: Add PECI client MFD driver

2018-10-24 Thread Lee Jones
On Wed, 24 Oct 2018, Jae Hyun Yoo wrote: > On 10/24/2018 3:59 AM, Lee Jones wrote: > > On Tue, 18 Sep 2018, Jae Hyun Yoo wrote: > > > > > This commit adds PECI client MFD driver. > > > > > [...] > > > +bool peci_temp_need_update(struct temp_data *temp) > > > +{ > > > + if (temp->valid && > >

Re: [PATCH v3 1/5] hwmon: (core) Inherit power properties to hdev

2018-10-24 Thread Nicolin Chen
On Wed, Oct 24, 2018 at 06:01:16PM -0700, Nicolin Chen wrote: > On Thu, Oct 25, 2018 at 12:13:01AM +, li...@roeck-us.net wrote: > > > > + if (dev) { > > > + hdev->driver = dev->driver; > > > + hdev->power = dev->power; > > > + hdev->pm_domain = dev->pm_domain; > > > +

Re: [PATCH v3 1/5] hwmon: (core) Inherit power properties to hdev

2018-10-24 Thread Nicolin Chen
On Thu, Oct 25, 2018 at 12:13:01AM +, li...@roeck-us.net wrote: > > + if (dev) { > > + hdev->driver = dev->driver; > > + hdev->power = dev->power; > > + hdev->pm_domain = dev->pm_domain; > > + hdev->of_node = dev->of_node; > > + } > > We'l need to

Re: [PATCH v1] hwmon: Fix double-free in __hwmon_device_register()

2018-10-24 Thread linux
Quoting Dmitry Osipenko : Fix double-free that happens when thermal zone setup fails, see KASAN log below. Good catch. I'll apply this as soon as I manage to convince AT to restore my internet service. Thanks, Guenter ==

Re: [PATCH v3 1/5] hwmon: (core) Inherit power properties to hdev

2018-10-24 Thread linux
Quoting Nicolin Chen : The new hdev is a child device related to the original parent hwmon driver and its device. However, it doesn't support the power features, typically being defined in the parent driver. So this patch inherits three necessary power properties from the parent dev to hdev:

Re: [PATCH v8 08/12] mfd: intel-peci-client: Add PECI client MFD driver

2018-10-24 Thread Jae Hyun Yoo
Hi Lee, On 10/24/2018 3:59 AM, Lee Jones wrote: On Tue, 18 Sep 2018, Jae Hyun Yoo wrote: This commit adds PECI client MFD driver. +config MFD_INTEL_PECI_CLIENT + bool "Intel PECI client" + depends on (PECI || COMPILE_TEST) + select MFD_CORE + help + If

[PATCH v1] hwmon: Fix double-free in __hwmon_device_register()

2018-10-24 Thread Dmitry Osipenko
Fix double-free that happens when thermal zone setup fails, see KASAN log below. == BUG: KASAN: double-free or invalid-free in __hwmon_device_register+0x5dc/0xa7c CPU: 0 PID: 132 Comm: kworker/0:2 Tainted: GB

[PATCH v3 4/5] hwmon: (ina3221) Make sure data is ready before reading

2018-10-24 Thread Nicolin Chen
The data might need some time to get ready after channel enabling, although the data register is always readable. The CVRF bit is to indicate that data conversion is finished, so polling the CVRF bit before data reading could ensure the result being valid. An alternative way could be to wait for

[PATCH v3 1/5] hwmon: (core) Inherit power properties to hdev

2018-10-24 Thread Nicolin Chen
The new hdev is a child device related to the original parent hwmon driver and its device. However, it doesn't support the power features, typically being defined in the parent driver. So this patch inherits three necessary power properties from the parent dev to hdev: power, pm_domain and driver

[PATCH v3 5/5] hwmon: (ina3221) Add PM runtime support

2018-10-24 Thread Nicolin Chen
If all three channels are disabled via in[123]_enable ABI, the driver could suspend the chip for power saving purpose. So this patch adds the PM runtime support in order to gain more power control than system suspend and resume use case. For PM runtime, there are a few related changes happening:

[PATCH v3 2/5] hwmon: (ina3221) Check channel status for alarms attribute read

2018-10-24 Thread Nicolin Chen
There is nothing critically wrong to read these two attributes without having a is_enabled() check at this point. But reading the MASK_ENABLE register would clear the CVRF bit according to the datasheet. So it'd be safer to fence for disabled channels in order to add pm runtime feature.

[PATCH v3 3/5] hwmon: (ina3221) Serialize sysfs ABI accesses

2018-10-24 Thread Nicolin Chen
This change adds a mutex to serialize accesses of sysfs attributes. This is required when polling CVRF bit of the MASK/ENABLE register because this bit is cleared on a read of this MASK/ENABLE register or a write to CONFIG register, which means that this bit might be accidentally cleared by

Re: [PATCH v2 5/5] hwmon: (ina3221) Add PM runtime support

2018-10-24 Thread Nicolin Chen
On Wed, Oct 24, 2018 at 09:24:18AM +, li...@roeck-us.net wrote: > > +fail: > > + if (enable) { > > + dev_err(dev, "Reverting channel%d enabling: %d\n", > > + channel, ret); > > This message is confusing. Something like "Failed to enable channel %d: > error %d"

Re: [PATCH v2 4/5] hwmon: (ina3221) Make sure data is ready before reading

2018-10-24 Thread Nicolin Chen
On Wed, Oct 24, 2018 at 09:10:35AM +, li...@roeck-us.net wrote: > > @@ -150,6 +183,12 @@ static int ina3221_read_in(struct device *dev, u32 > > attr, int channel, long *val) > > if (!ina3221_is_enabled(ina, channel)) > > return -ENODATA; > > > > + ret

Re: [PATCH v8 07/12] dt-bindings: mfd: Add a document for PECI client MFD

2018-10-24 Thread Jae Hyun Yoo
Hi Lee, On 10/24/2018 12:25 AM, Lee Jones wrote: On Tue, 18 Sep 2018, Jae Hyun Yoo wrote: +Required properties: +- compatible : Should be "intel,peci-client". +- reg: Should contain address of a client CPU. Address range of CPU + clients starts from 0x30 based on PECI

Re: [PATCH v8 08/12] mfd: intel-peci-client: Add PECI client MFD driver

2018-10-24 Thread Lee Jones
On Tue, 18 Sep 2018, Jae Hyun Yoo wrote: > This commit adds PECI client MFD driver. > > Cc: Lee Jones > Cc: Randy Dunlap > Cc: Rob Herring > Cc: Andrew Jeffery > Cc: James Feist > Cc: Jason M Biils > Cc: Joel Stanley > Cc: Vernon Mauery > Signed-off-by: Jae Hyun Yoo > --- >

Re: [PATCH v2 5/5] hwmon: (ina3221) Add PM runtime support

2018-10-24 Thread linux
Quoting Nicolin Chen : If all three channels are disabled via in[123]_enable ABI, the driver could suspend the chip for power saving purpose. So this patch addsd the PM runtime support in order to gain more power control than system suspend and resume use case. For PM runtime, there are a

Re: [PATCH v2 4/5] hwmon: (ina3221) Make sure data is ready before reading

2018-10-24 Thread linux
Quoting Nicolin Chen : The data might need some time to get ready after channel enabling, although the data register is always readable. The CVRF bit is to indicate that data conversion is finished, so polling the CVRF bit before data reading could ensure the result being valid. An

Re: [PATCH v8 07/12] dt-bindings: mfd: Add a document for PECI client MFD

2018-10-24 Thread Lee Jones
On Tue, 18 Sep 2018, Jae Hyun Yoo wrote: > This commit adds a dt-bindings document for PECI client MFD. > > Cc: Lee Jones > Cc: Rob Herring > Cc: Mark Rutland > Cc: Andrew Jeffery > Cc: James Feist > Cc: Jason M Biils > Cc: Joel Stanley > Cc: Vernon Mauery > Signed-off-by: Jae Hyun Yoo