Re: [PATCH 5/5] smiapp: Switch to gpiod API for GPIO control

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

 



Hi Sakari,

On Wed, Aug 31, 2016 at 10:42:05AM +0300, Sakari Ailus wrote:
> -	if (gpio_is_valid(sensor->hwcfg->xshutdown)) {
> +	if (client->dev.of_node) {
> +		sensor->xshutdown =
> +			devm_gpiod_get_optional(&client->dev, "xshutdown",
> +						GPIOD_OUT_LOW);
> +	} else if (gpio_is_valid(sensor->hwcfg->xshutdown)) {
>  		rval = devm_gpio_request_one(
>  			&client->dev, sensor->hwcfg->xshutdown, 0,
>  			"SMIA++ xshutdown");
> @@ -2581,8 +2582,13 @@ static int smiapp_init(struct smiapp_sensor *sensor)
>  				sensor->hwcfg->xshutdown);
>  			return rval;
>  		}
> +
> +		sensor->xshutdown = gpio_to_desc(sensor->hwcfg->xshutdown);
>  	}

You can drop the devm_gpio_request_one() part and xshutdown from
smiapp_platform_data. The gpiod consumer interface can also be
used with data provided from boardfiles as documented in
Documentation/gpio/board.txt, section "Platform Data". It basically
works like assigning regulators to devices from platform data.

You will obviously have to change every platform_device users of
smiapp, but it looks like upstream has none:

~/linux/arch $ git grep smiapp_platform_data || echo "Not found"
Not found

-- Sebastian

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux