Re: [PATCH v3 1/2] hwmon: Add support for ltc2947

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 21, 2019 at 05:41:14PM +0200, Nuno Sá wrote:
> The ltc2947 is a high precision power and energy monitor with an
> internal sense resistor supporting up to +/- 30A. Three internal no
> Latency ADCs ensure accurate measurement of voltage and current, while
> high-bandwidth analog multiplication of voltage and current provides
> accurate power measurement in a wide range of applications. Internal or
> external clocking options enable precise charge and energy measurements.
> 
> Signed-off-by: Nuno Sá <nuno.sa@xxxxxxxxxx>

[ ... ]

> +
> +static ssize_t ltc2947_show_value(struct device *dev,
> +				  struct device_attribute *da, char *buf)
> +{
> +	struct ltc2947_data *st = dev_get_drvdata(dev);
> +	struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
> +	int ret;
> +	s64 val = 0;
> +
> +	switch (attr->index) {
> +	case LTC2947_REG_ENERGY1:
> +	case LTC2947_REG_ENERGY2:
> +		ret = ltc2947_val_read(st, attr->index, PAGE0, 6, &val);
> +		break;
> +	default:
> +		return -EINVAL;
> +	}

This complexity is also unnecessary: index is either LTC2947_REG_ENERGY1 or
LTC2947_REG_ENERGY2. I removed the case statement when applying.

Guenter



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux