lkml.org 
[lkml]   [2019]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V1 3/3] regulator: slg51000: add slg51000 regulator driver
On Tue, Apr 16, 2019 at 01:37:27PM +0900, Eric Jeong wrote:

> +static int slg51000_regulator_is_enabled(struct regulator_dev *rdev)
> +{
> + struct slg51000 *chip = rdev_get_drvdata(rdev);
> + int ret, id = rdev_get_id(rdev);
> + unsigned int state;
> +
> + ret = regmap_read(chip->regmap, es_reg[id].sreg, &state);
> + if (ret < 0) {
> + dev_err(chip->dev, "Failed to read status register(%d)\n",
> + ret);
> + return ret;
> + }
> +
> + if (!(state & SLG51000_STA_ILIM_FLAG_MASK) &&
> + (state & SLG51000_STA_VOUT_OK_FLAG_MASK))
> + return 1;
> + else
> + return 0;

This looks like it should be a get_status() operation as it's reading
status bits rather than the command we sent to the device - for that
just use regulator_is_enabled_regmap().

Otherwise this all looks great.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2019-04-16 17:25    [W:0.079 / U:24.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site