lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 12 Mar 2020 19:53:03 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Saravanan Sekar <sravanhome@...il.com>
Cc:     lee.jones@...aro.org, robh+dt@...nel.org, jic23@...nel.org,
        knaack.h@....de, lars@...afoo.de, pmeerw@...erw.net,
        sre@...nel.org, mchehab+huawei@...nel.org, davem@...emloft.net,
        gregkh@...uxfoundation.org, fabrice.gasnier@...com,
        beniamin.bia@...log.com, linus.walleij@...aro.org,
        u.kleine-koenig@...gutronix.de, fabrizio.castro@...renesas.com,
        info@...ux.net, hancock@...systems.ca, gregory.clement@...tlin.com,
        renatogeh@...il.com, plr.vincent@...il.com,
        miquel.raynal@...tlin.com, marcelo.schmitt1@...il.com,
        paul@...pouillou.net, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org,
        linux-pm@...r.kernel.org
Subject: Re: [PATCH 3/5] iio: adc: mp2629: Add support for mp2629 ADC driver

On Thu, Mar 12, 2020 at 06:26:47PM +0100, Saravanan Sekar wrote:
> Add support for 8-bit resolution ADC readings for input power
> supply and battery charging measurement. Provides voltage, current
> readings to mp2629 power supply driver.

...

> +	struct mp2629_info *info = adc_info->info;
> +	unsigned int rval;
> +	int ret;
> +
> +	switch (mask) {
> +	case IIO_CHAN_INFO_RAW:
> +		ret = mp2629_get_value(info->regmap, chan->address, &rval);
> +		if (ret < 0)
> +			return ret;
> +
> +		if (chan->address == MP2629_INPUT_VOLT)
> +			rval &= 0x7f;
> +		*val = rval;
> +		return IIO_VAL_INT;
> +
> +	case IIO_CHAN_INFO_SCALE:
> +		switch (chan->channel) {
> +		case MP2629_BATT_VOLT:
> +		case MP2629_SYSTEM_VOLT:
> +			*val = 20;
> +			return IIO_VAL_INT;
> +
> +		case MP2629_INPUT_VOLT:
> +			*val = 60;
> +			return IIO_VAL_INT;
> +
> +		case MP2629_BATT_CURRENT:
> +			*val = 175;
> +			*val2 = 10;
> +			return IIO_VAL_FRACTIONAL;
> +
> +		case MP2629_INPUT_CURRENT:
> +			*val = 133;
> +			*val2 = 10;
> +			return IIO_VAL_FRACTIONAL;
> +		}
> +		break;
> +
> +	default:

> +		ret = -EINVAL;
> +		break;

return -EINVAL;

> +	}
> +

> +	return ret;

	return 0;
?

What is default case for wrong channel in INFO_SCALE?

> +}

...

> +static const struct of_device_id mp2629_adc_of_match[] = {
> +	{ .compatible = "mps,mp2629_adc"},

> +	{},

No comma needed.

> +};

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists