Re: [PATCH] regulator: drivers: fix return value of get_mode callback

From: Charles Keepax
Date: Mon Jul 14 2014 - 07:57:32 EST


On Mon, Jul 14, 2014 at 04:03:17PM +0530, Laxman Dewangan wrote:
> The function get_mode() should return 0 on error and REGULATOR_MODE_*
> on success. The return type of this function is defined as unsigned int.
>
> Some of driver who implements this callback return -ve error number when
> it fails which is incorrect as per function definitions. Correcting the
> implemnetation on different drivers to return 0 (zero) on error and
> REGULATOR_MODE_* on success.
>
> Signed-off-by: Laxman Dewangan <ldewangan@xxxxxxxxxx>
> ---
> drivers/regulator/ab8500-ext.c | 4 ++--
> drivers/regulator/ab8500.c | 4 ++--
> drivers/regulator/as3711-regulator.c | 4 ++--
> drivers/regulator/as3722-regulator.c | 4 ++--
> drivers/regulator/da9055-regulator.c | 4 ++--
> drivers/regulator/da9063-regulator.c | 2 +-
> drivers/regulator/fan53555.c | 2 +-
> drivers/regulator/lp872x.c | 4 ++--
> drivers/regulator/lp8788-buck.c | 2 +-
> drivers/regulator/max8649.c | 2 +-
> drivers/regulator/max8973-regulator.c | 2 +-
> drivers/regulator/mc13892-regulator.c | 2 +-
> drivers/regulator/tps62360-regulator.c | 2 +-
> drivers/regulator/tps65910-regulator.c | 4 ++--
> drivers/regulator/tps65912-regulator.c | 2 +-
> drivers/regulator/wm831x-dcdc.c | 4 ++--
> drivers/regulator/wm831x-ldo.c | 8 ++++----
> drivers/regulator/wm8350-regulator.c | 2 +-
> 18 files changed, 29 insertions(+), 29 deletions(-)

Looks like _regulator_get_mode in core.c would need updated too.
I can't help but wonder if it might be better to just make
get/set mode use an int instead, although I don't know for what
reasons an unsigned int was choosen in the first place so I might
be missing something.

Thanks,
Charles
--
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/