* Re: [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision
2011-09-09 10:12 [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision wether Hans de Goede
@ 2011-09-12 17:23 ` Guenter Roeck
2011-09-12 17:26 ` Hans de Goede
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2011-09-12 17:23 UTC (permalink / raw)
To: lm-sensors
On Fri, 2011-09-09 at 06:12 -0400, Hans de Goede wrote:
> Before this patch the f71882fg driver completely fails to initialize
> on systems which have reserved settings in the pwm enable register, and
> it disables all auto pwm sysfs attributes if any fan is controlled by
> a digital sensor reading.
>
> This patch changes the fail to initialize into don't register any attributes
> for the fan for which there are reserved settings in the pwm enable register
> and also makes the not registering of auto pwm sysfs attributes a per fan
> thing.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Given that this is no longer a pure hwmon driver, it may make sense to
split it into separate mfd/hwmon/watchdog drivers. But on the other side
I notice that other drivers in the hwmon directory implement watchdog
functionality as well. Bad precedent :(. Wonder what happens with those
watchdogs if HWMON is disabled.
Not really sure if we should let this happen, or start being more
restrictive and enforce cleaner code. Jean, any thoughts/comments ?
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision
2011-09-09 10:12 [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision wether Hans de Goede
2011-09-12 17:23 ` [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision Guenter Roeck
@ 2011-09-12 17:26 ` Hans de Goede
2011-09-12 17:31 ` Guenter Roeck
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Hans de Goede @ 2011-09-12 17:26 UTC (permalink / raw)
To: lm-sensors
Hi,
On 09/12/2011 07:23 PM, Guenter Roeck wrote:
> On Fri, 2011-09-09 at 06:12 -0400, Hans de Goede wrote:
>> Before this patch the f71882fg driver completely fails to initialize
>> on systems which have reserved settings in the pwm enable register, and
>> it disables all auto pwm sysfs attributes if any fan is controlled by
>> a digital sensor reading.
>>
>> This patch changes the fail to initialize into don't register any attributes
>> for the fan for which there are reserved settings in the pwm enable register
>> and also makes the not registering of auto pwm sysfs attributes a per fan
>> thing.
>>
>> Signed-off-by: Hans de Goede<hdegoede@redhat.com>
>
> Given that this is no longer a pure hwmon driver, it may make sense to
> split it into separate mfd/hwmon/watchdog drivers. But on the other side
> I notice that other drivers in the hwmon directory implement watchdog
> functionality as well. Bad precedent :(. Wonder what happens with those
> watchdogs if HWMON is disabled.
>
> Not really sure if we should let this happen, or start being more
> restrictive and enforce cleaner code. Jean, any thoughts/comments ?
It seems that you put this reply in the wrong thread? Can you please copy
paste to the right thread (with the CC list intact so that the watchdog people
get it too). Then I'll reply there.
Thanks,
Hans
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision
2011-09-09 10:12 [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision wether Hans de Goede
2011-09-12 17:23 ` [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision Guenter Roeck
2011-09-12 17:26 ` Hans de Goede
@ 2011-09-12 17:31 ` Guenter Roeck
2011-09-12 18:47 ` Guenter Roeck
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2011-09-12 17:31 UTC (permalink / raw)
To: lm-sensors
On Mon, 2011-09-12 at 13:26 -0400, Hans de Goede wrote:
> Hi,
>
> On 09/12/2011 07:23 PM, Guenter Roeck wrote:
> > On Fri, 2011-09-09 at 06:12 -0400, Hans de Goede wrote:
> >> Before this patch the f71882fg driver completely fails to initialize
> >> on systems which have reserved settings in the pwm enable register, and
> >> it disables all auto pwm sysfs attributes if any fan is controlled by
> >> a digital sensor reading.
> >>
> >> This patch changes the fail to initialize into don't register any attributes
> >> for the fan for which there are reserved settings in the pwm enable register
> >> and also makes the not registering of auto pwm sysfs attributes a per fan
> >> thing.
> >>
> >> Signed-off-by: Hans de Goede<hdegoede@redhat.com>
> >
> > Given that this is no longer a pure hwmon driver, it may make sense to
> > split it into separate mfd/hwmon/watchdog drivers. But on the other side
> > I notice that other drivers in the hwmon directory implement watchdog
> > functionality as well. Bad precedent :(. Wonder what happens with those
> > watchdogs if HWMON is disabled.
> >
> > Not really sure if we should let this happen, or start being more
> > restrictive and enforce cleaner code. Jean, any thoughts/comments ?
>
> It seems that you put this reply in the wrong thread? Can you please copy
> paste to the right thread (with the CC list intact so that the watchdog people
> get it too). Then I'll reply there.
>
Oops. Not my day :(.
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision
2011-09-09 10:12 [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision wether Hans de Goede
` (2 preceding siblings ...)
2011-09-12 17:31 ` Guenter Roeck
@ 2011-09-12 18:47 ` Guenter Roeck
2011-09-12 19:13 ` Jean Delvare
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2011-09-12 18:47 UTC (permalink / raw)
To: lm-sensors
On Fri, 2011-09-09 at 06:12 -0400, Hans de Goede wrote:
> Before this patch the f71882fg driver completely fails to initialize
> on systems which have reserved settings in the pwm enable register, and
> it disables all auto pwm sysfs attributes if any fan is controlled by
> a digital sensor reading.
>
> This patch changes the fail to initialize into don't register any attributes
> for the fan for which there are reserved settings in the pwm enable register
> and also makes the not registering of auto pwm sysfs attributes a per fan
> thing.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nice cleanup. One minor comment:
[ ... ]
>
> static int __devinit f71882fg_create_fan_sysfs_files(
> - struct platform_device *pdev, int idx, bool pwm_auto_point)
> + struct platform_device *pdev, int idx)
> {
> struct f71882fg_data *data = platform_get_drvdata(pdev);
> int err;
>
> + /* Sanity check the pwm setting */
> + err = 0;
> + switch (data->type) {
> + case f71858fg:
> + if (((data->pwm_enable >> (idx * 2)) & 3) = 3)
> + err = 1;
> + break;
> + case f71862fg:
> + if (((data->pwm_enable >> (idx * 2)) & 1) != 1)
> + err = 1;
> + break;
> + case f8000:
> + if (idx = 2)
> + err = data->pwm_enable & 0x20;
> + break;
> + default:
> + break;
> + }
> + if (err) {
> + dev_err(&pdev->dev,
> + "Invalid (reserved) pwm settings: 0x%02x, "
> + "skipping fan %d\n",
> + (data->pwm_enable >> (idx * 2)) & 3, idx + 1);
> + return 0; /* This is a non fatal condition */
> + }
Since this is no longer a fatal condition, it might make sense to use
dev_warn instead.
Otherwise
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Jean, do you want to take the series (and maybe have another look), or
do you want me to take it ?
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision
2011-09-09 10:12 [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision wether Hans de Goede
` (3 preceding siblings ...)
2011-09-12 18:47 ` Guenter Roeck
@ 2011-09-12 19:13 ` Jean Delvare
2011-09-13 7:19 ` Hans de Goede
2011-09-13 13:20 ` Guenter Roeck
6 siblings, 0 replies; 8+ messages in thread
From: Jean Delvare @ 2011-09-12 19:13 UTC (permalink / raw)
To: lm-sensors
On Mon, 12 Sep 2011 11:47:15 -0700, Guenter Roeck wrote:
> Jean, do you want to take the series (and maybe have another look), or
> do you want me to take it ?
Please take it, this will free me some time for the coretemp work +
reviewing your own patches.
Thanks,
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision
2011-09-09 10:12 [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision wether Hans de Goede
` (4 preceding siblings ...)
2011-09-12 19:13 ` Jean Delvare
@ 2011-09-13 7:19 ` Hans de Goede
2011-09-13 13:20 ` Guenter Roeck
6 siblings, 0 replies; 8+ messages in thread
From: Hans de Goede @ 2011-09-13 7:19 UTC (permalink / raw)
To: lm-sensors
Hi,
On 09/12/2011 08:47 PM, Guenter Roeck wrote:
> On Fri, 2011-09-09 at 06:12 -0400, Hans de Goede wrote:
>> Before this patch the f71882fg driver completely fails to initialize
>> on systems which have reserved settings in the pwm enable register, and
>> it disables all auto pwm sysfs attributes if any fan is controlled by
>> a digital sensor reading.
>>
>> This patch changes the fail to initialize into don't register any attributes
>> for the fan for which there are reserved settings in the pwm enable register
>> and also makes the not registering of auto pwm sysfs attributes a per fan
>> thing.
>>
>> Signed-off-by: Hans de Goede<hdegoede@redhat.com>
>
> Nice cleanup. One minor comment:
>
> [ ... ]
>>
>> static int __devinit f71882fg_create_fan_sysfs_files(
>> - struct platform_device *pdev, int idx, bool pwm_auto_point)
>> + struct platform_device *pdev, int idx)
>> {
>> struct f71882fg_data *data = platform_get_drvdata(pdev);
>> int err;
>>
>> + /* Sanity check the pwm setting */
>> + err = 0;
>> + switch (data->type) {
>> + case f71858fg:
>> + if (((data->pwm_enable>> (idx * 2))& 3) = 3)
>> + err = 1;
>> + break;
>> + case f71862fg:
>> + if (((data->pwm_enable>> (idx * 2))& 1) != 1)
>> + err = 1;
>> + break;
>> + case f8000:
>> + if (idx = 2)
>> + err = data->pwm_enable& 0x20;
>> + break;
>> + default:
>> + break;
>> + }
>> + if (err) {
>> + dev_err(&pdev->dev,
>> + "Invalid (reserved) pwm settings: 0x%02x, "
>> + "skipping fan %d\n",
>> + (data->pwm_enable>> (idx * 2))& 3, idx + 1);
>> + return 0; /* This is a non fatal condition */
>> + }
>
> Since this is no longer a fatal condition, it might make sense to use
> dev_warn instead.
Despite being non fatal, this is still very much an error. f71882fg has
been doing these checks for quite some time now, and Daniel's mobo is the
first one to actual trigger them. Who knows this error may even point out
to some BIOS developer that he is doing something wrong (yeah right BIOS
developers testing with Linux, well we can always hope).
iow I would prefer to keep this as is :)
Regards,
Hans
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision
2011-09-09 10:12 [lm-sensors] [PATCH 3/3] hwmon/f71882fg: Make the decision wether Hans de Goede
` (5 preceding siblings ...)
2011-09-13 7:19 ` Hans de Goede
@ 2011-09-13 13:20 ` Guenter Roeck
6 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2011-09-13 13:20 UTC (permalink / raw)
To: lm-sensors
On Tue, Sep 13, 2011 at 03:19:32AM -0400, Hans de Goede wrote:
> Hi,
>
> On 09/12/2011 08:47 PM, Guenter Roeck wrote:
> > On Fri, 2011-09-09 at 06:12 -0400, Hans de Goede wrote:
> >> Before this patch the f71882fg driver completely fails to initialize
> >> on systems which have reserved settings in the pwm enable register, and
> >> it disables all auto pwm sysfs attributes if any fan is controlled by
> >> a digital sensor reading.
> >>
> >> This patch changes the fail to initialize into don't register any attributes
> >> for the fan for which there are reserved settings in the pwm enable register
> >> and also makes the not registering of auto pwm sysfs attributes a per fan
> >> thing.
> >>
> >> Signed-off-by: Hans de Goede<hdegoede@redhat.com>
> >
> > Nice cleanup. One minor comment:
> >
> > [ ... ]
> >>
> >> static int __devinit f71882fg_create_fan_sysfs_files(
> >> - struct platform_device *pdev, int idx, bool pwm_auto_point)
> >> + struct platform_device *pdev, int idx)
> >> {
> >> struct f71882fg_data *data = platform_get_drvdata(pdev);
> >> int err;
> >>
> >> + /* Sanity check the pwm setting */
> >> + err = 0;
> >> + switch (data->type) {
> >> + case f71858fg:
> >> + if (((data->pwm_enable>> (idx * 2))& 3) = 3)
> >> + err = 1;
> >> + break;
> >> + case f71862fg:
> >> + if (((data->pwm_enable>> (idx * 2))& 1) != 1)
> >> + err = 1;
> >> + break;
> >> + case f8000:
> >> + if (idx = 2)
> >> + err = data->pwm_enable& 0x20;
> >> + break;
> >> + default:
> >> + break;
> >> + }
> >> + if (err) {
> >> + dev_err(&pdev->dev,
> >> + "Invalid (reserved) pwm settings: 0x%02x, "
> >> + "skipping fan %d\n",
> >> + (data->pwm_enable>> (idx * 2))& 3, idx + 1);
> >> + return 0; /* This is a non fatal condition */
> >> + }
> >
> > Since this is no longer a fatal condition, it might make sense to use
> > dev_warn instead.
>
> Despite being non fatal, this is still very much an error. f71882fg has
> been doing these checks for quite some time now, and Daniel's mobo is the
> first one to actual trigger them. Who knows this error may even point out
> to some BIOS developer that he is doing something wrong (yeah right BIOS
> developers testing with Linux, well we can always hope).
>
> iow I would prefer to keep this as is :)
>
Ok, I'll accept that. All three patches applied to -next.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 8+ messages in thread