Re: [lm-sensors] [PATCHv3 6/11] HWMON: HWMON module of DA9052device driver

From: Guenter Roeck
Date: Thu Dec 23 2010 - 17:21:11 EST


On Tue, Dec 21, 2010 at 12:52:50PM -0500, dd diasemi wrote:
> HWMON module for DA9052 PMIC device from Dialog Semiconductor.
>
> Changes made since last submission:
> . removed the DA9052 customized success and error codes
> . changed da9052_manual_read() return type
>
> Linux Kernel Version: 2.6.34
>
> Signed-off-by: D. Chen <dchen@xxxxxxxxxxx>

[ ... ]

> +
> +static DEVICE_ATTR(name, S_IRUGO, da9052_adc_show_name, NULL);
> +static SENSOR_DEVICE_ATTR(read_vddout, S_IRUGO,
> + da9052_adc_read_start_stop, NULL,
> + DA9052_ADC_VDDOUT);
> +static SENSOR_DEVICE_ATTR(read_ich, S_IRUGO, da9052_adc_read_ich, NULL,
> + DA9052_ADC_ICH);
> +static SENSOR_DEVICE_ATTR(read_tbat, S_IRUGO, da9052_adc_read_tbat, NULL,
> + DA9052_ADC_TBAT);
> +static SENSOR_DEVICE_ATTR(read_vbat, S_IRUGO, da9052_adc_read_vbat, NULL,
> + DA9052_ADC_VBAT);
> +#if (DA9052_ADC_CONF_ADC4 == 1)
> +static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, da9052_adc_read_start_stop, NULL,
> + DA9052_ADC_ADCIN4);
> +#endif
> +#if (DA9052_ADC_CONF_ADC5 == 1)
> +static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, da9052_adc_read_start_stop, NULL,
> + DA9052_ADC_ADCIN5);
> +#endif
> +#if (DA9052_ADC_CONF_ADC6 == 1)
> +static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, da9052_adc_read_start_stop, NULL,
> + DA9052_ADC_ADCIN6);
> +#endif
> +static SENSOR_DEVICE_ATTR(read_tjunc, S_IRUGO, da9052_adc_read_tjunc, NULL,
> + DA9052_ADC_TJUNC);
> +static SENSOR_DEVICE_ATTR(read_vbbat, S_IRUGO, da9052_adc_read_vbbat, NULL,
> + DA9052_ADC_VBBAT);
> +

Driver doesn't follow hwmon sysfs ABI, with no good reason.
As for the labels, I am not sure if the provided labels reflect chip data
or the use of the chip on a specific board. The product brief seems to indicate
the latter. If so, defining label attribute files is not appropriate. Labels
can then be assigned through sensors.conf.

The use of ifdefs in the code is excessive. There should be a single Kconfig entry
to enable the driver. Remaining data can be provided with platform data if it is
mandatory, or sensors not supported on a given board can be configured to be
ignored via sensors.conf.

Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/