Re: [PATCH v8 RESEND 2/5] regulator: rk808: add RK809 and RK817 support.

From: Mark Brown
Date: Mon Jun 03 2019 - 14:26:23 EST


On Mon, Jun 03, 2019 at 07:08:57PM +0200, Heiko Stuebner wrote:

> default:
> - pr_warn("%s ramp_delay: %d not supported, setting 10000\n",
> - rdev->desc->name, ramp_delay);
> + dev_warn(&rdev->dev,
> + "%s ramp_delay: %d not supported, setting 10000\n",
> + rdev->desc->name, ramp_delay);

This appears to be unrelated and should've been a separate patch.

> +static int rk817_check_suspend_voltage(int id)
> +{
> + if (id >= RK817_ID_DCDC1 && id <= RK817_ID_LDO9)
> + return 0;
> + return -1;
> +}

Rather than have these checks in the implementation you should just not
define these operations for regulators that don't have the
functionality.

> +static unsigned int rk8xx_regulator_of_map_mode(unsigned int mode)
> +{
> + if (mode == 1)
> + return REGULATOR_MODE_FAST;
> + if (mode == 2)
> + return REGULATOR_MODE_NORMAL;
> +
> + return -EINVAL;
> +}

This should be written as a switch statement for clarity.

Attachment: signature.asc
Description: PGP signature