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

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

 



Hi,

On Wed, Aug 31, 2016 at 04:00:56PM +0300, Sakari Ailus wrote:
> Switch from the old gpio API to the new descriptor based gpiod API.
>
> [...]
>
> @@ -2572,17 +2569,10 @@ static int smiapp_init(struct smiapp_sensor *sensor)
>  		}
>  	}
>  
> -	if (gpio_is_valid(sensor->hwcfg->xshutdown)) {
> -		rval = devm_gpio_request_one(
> -			&client->dev, sensor->hwcfg->xshutdown, 0,
> -			"SMIA++ xshutdown");
> -		if (rval < 0) {
> -			dev_err(&client->dev,
> -				"unable to acquire reset gpio %d\n",
> -				sensor->hwcfg->xshutdown);
> -			return rval;
> -		}
> -	}
> +	sensor->xshutdown = devm_gpiod_get_optional(&client->dev, "xshutdown",
> +						    GPIOD_OUT_LOW);
> +	if (!sensor->xshutdown)
> +		dev_dbg(&client->dev, "no xshutdown GPIO available\n");

devm_gpiod_get_optional may return an error pointer, e.g. for
-EPROBE_DEFER, so you should add:

if (IS_ERR(sensor->xshutdown)) {
    rval = PTR_ERR(sensor->xshutdown);
    dev_err(&client->dev, "Could not get gpio (%ld)\n", rval);
    return rval;
}

> [...]

Otherwise the patch looks fine, so with this fixed:

Reviewed-By: Sebastian Reichel <sre@xxxxxxxxxx>

-- 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