lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 10 Jun 2019 16:59:19 +0100
From:   Charles Keepax <ckeepax@...nsource.cirrus.com>
To:     Linus Walleij <linus.walleij@...aro.org>
CC:     Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        <linux-kernel@...r.kernel.org>,
        Richard Fitzgerald <rf@...nsource.cirrus.com>,
        <patches@...nsource.cirrus.com>
Subject: Re: [PATCH] regulator: wm831x: Convert to use GPIO descriptors

On Sun, Jun 09, 2019 at 11:00:25PM +0200, Linus Walleij wrote:
> This converts the Wolfson Micro WM831x DCDC converter to use
> a GPIO descriptor for the GPIO driving the DVS pin.
> 
> There is just one (non-DT) machine in the kernel using this, and
> that is the Wolfson Micro (now Cirrus) Cragganmore 6410 so we
> patch this board to pass a descriptor table and fix up the driver
> accordingly.
> 
> Cc: Charles Keepax <ckeepax@...nsource.cirrus.com>
> Cc: Richard Fitzgerald <rf@...nsource.cirrus.com>
> Cc: patches@...nsource.cirrus.com
> Signed-off-by: Linus Walleij <linus.walleij@...aro.org>
> ---
> +/*
> + * VDDARM is eventually ending up as a regulator hanging on the MFD cell device
> + * "wm831x-buckv.1" spawn from drivers/mfd/wm831x-core.c.
> + *
> + * From the note on the platform data we can see that this is clearly DVS1
> + * and assigned as dcdc1 resource to the MFD core which sets .id of the cell
> + * spawning the DVS1 platform device to 1, resulting in the device name
> + * "wm831x-buckv.1".
> + */
> +static struct gpiod_lookup_table crag_pmic_gpiod_table = {
> +	.dev_id = "wm831x-buckv.1",

This is not correct, the mfd_add_devices in wm831x-core passes an
ID to the MFD core. Which is calculated from wm831x_num  * 10,
taken from the pdata. So this should be "wm831x-buckv.11".

> +	.table = {
> +		GPIO_LOOKUP("GPIOK", 0, "dvs", GPIO_ACTIVE_HIGH),
> +		{ },
> +	},
> +};
> +

<snip>

> -	ret = devm_gpio_request_one(&pdev->dev, pdata->dvs_gpio,
> -				    dcdc->dvs_gpio_state ? GPIOF_INIT_HIGH : 0,
> -				    "DCDC DVS");
> -	if (ret < 0) {
> -		dev_err(wm831x->dev, "Failed to get %s DVS GPIO: %d\n",
> -			dcdc->name, ret);
> +	dcdc->dvs_gpiod = devm_gpiod_get_optional(&pdev->dev, "dvs",
> +			dcdc->dvs_gpio_state ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW);
> +	if (IS_ERR(dcdc->dvs_gpiod)) {
> +		dev_err(wm831x->dev, "Failed to get %s DVS GPIO: %ld\n",
> +			dcdc->name, PTR_ERR(dcdc->dvs_gpiod));
>  		return;
>  	}
>  

Whats the thinking behind using get_optional here? A plain
devm_gpiod_get looks like it would be closer to the original
code. Previously if there was no GPIO we would log an error and
not execute the rest of the function, this is I think no longer
the case after this change.

Thanks,
Charles

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ