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

From: Mark Brown
Date: Mon Jul 14 2014 - 14:01:44 EST

On Mon, Jul 14, 2014 at 12:57:18PM +0100, Charles Keepax wrote:
> 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.

> 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.

It's because it's returning something defined as a bitmask, though since
we don't even have enough modes for 8 bits that's not really a strong
reason and we should just be returning an error code as everyone is
clearly already assuming we do.

Attachment: signature.asc
Description: Digital signature