Re: [PATCH v5 09/16] regulator: bd71828: Basic support for ROHM bd71828 PMIC regulators

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 18, 2019 at 08:57:57AM +0200, Matti Vaittinen wrote:

> +static int ramp_delay_supported(struct regulator_dev *rdev)
> +{
> +	switch (rdev->desc->id) {
> +	case BD71828_BUCK1:
> +	case BD71828_BUCK2:
> +	case BD71828_BUCK6:
> +	case BD71828_BUCK7:
> +		return 1;
> +	default:
> +		break;
> +	}
> +	return 0;
> +}
> +
> +static int bd71828_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
> +{
> +	unsigned int val;
> +
> +	if (!ramp_delay_supported(rdev)) {
> +		dev_err(&rdev->dev, "%s: can't set ramp-delay\n",
> +			rdev->desc->name);
> +		return -EINVAL;

Rather than doing this it's better to just not provide the operation for
devices that don't support it, that makes the handling in the core
easier.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux