lkml.org 
[lkml]   [2018]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 09/15] Platform: OLPC: add a regulator for the DCON
On Wed, Oct 10, 2018 at 8:23 PM Lubomir Rintel <lkundrak@v3.sk> wrote:
>
> All OLPC ECs are able to turn the power to the DCON on an off. Use the
> regulator framework to expose the functionality.

> +static int olpc_ec_set_dcon_power(struct olpc_ec_priv *ec, bool state)
> +{
> + unsigned char ec_byte = state;
> + int ret;
> +
> + if (ec->dcon_enabled == state)
> + return 0;
> +

> + ret = olpc_ec_cmd(EC_DCON_POWER_MODE, &ec_byte, 1, NULL, 0);
> + if (ret == 0)
> + ec->dcon_enabled = state;
> +
> + return ret;

I would prefer to see usual pattern, i.e.

if (ret)
return ret;

...
return 0;

This comment applies to entire series. (Yes, you might address an old
code in a separate patch to be on consistent side)

> +}

> + return olpc_ec_set_dcon_power(ec, 1);

defined as boolean, supplied an int. Not good.

> + return olpc_ec_set_dcon_power(ec, 0);

Ditto.

> +static int dcon_regulator_is_enabled(struct regulator_dev *rdev)
> + return ec->dcon_enabled;

Ditto.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2018-10-19 15:40    [W:0.150 / U:6.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site