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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 23 Apr 2020 10:55:57 +0300
From:   Sakari Ailus <sakari.ailus@...ux.intel.com>
To:     Roman Kovalivskyi <roman.kovalivskyi@...ballogic.com>
Cc:     linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
        linux-renesas-soc@...r.kernel.org,
        Luis Oliveira <lolivei@...opsys.com>,
        Niklas Söderlund 
        <niklas.soderlund@...natech.se>, Jacopo Mondi <jacopo@...ndi.org>,
        Michael Rodin <mrodin@...adit-jv.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Hugues Fruchet <hugues.fruchet@...com>,
        Maxime Ripard <mripard@...nel.org>,
        Adam Ford <aford173@...il.com>,
        Todor Tomov <todor.tomov@...aro.org>,
        Suresh Udipi <sudipi@...adit-jv.com>,
        Andrew Gabbasov <andrew_gabbasov@...tor.com>,
        Eugeniu Rosca <erosca@...adit-jv.com>,
        Dave Stevenson <dave.stevenson@...pberrypi.org>
Subject: Re: [PATCH 4/4] media: ov5647: Use gpiod_set_value_cansleep

Hi Roman,

On Mon, Apr 13, 2020 at 12:17:47PM +0300, Roman Kovalivskyi wrote:
> From: Dave Stevenson <dave.stevenson@...pberrypi.org>
> 
> All calls to the gpio library are in contexts that can sleep,
> therefore there is no issue with having those GPIOs controlled
> by controllers which require sleeping (eg I2C GPIO expanders).
> 
> Switch to using gpiod_set_value_cansleep instead of gpiod_set_value
> to avoid triggering the warning in gpiolib should the GPIO
> controller need to sleep.
> 
> Signed-off-by: Dave Stevenson <dave.stevenson@...pberrypi.org>
> Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@...ballogic.com>

This should be merged with the second patch.

> ---
>  drivers/media/i2c/ov5647.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c
> index 8a1a515388e0..07550377be2e 100644
> --- a/drivers/media/i2c/ov5647.c
> +++ b/drivers/media/i2c/ov5647.c
> @@ -373,7 +373,7 @@ static int ov5647_sensor_power(struct v4l2_subdev *sd, int on)
>  		dev_dbg(&client->dev, "OV5647 power on\n");
>  
>  		if (ov5647->pwdn) {
> -			gpiod_set_value(ov5647->pwdn, 0);
> +			gpiod_set_value_cansleep(ov5647->pwdn, 0);
>  			msleep(PWDN_ACTIVE_DELAY_MS);
>  		}
>  
> @@ -415,7 +415,7 @@ static int ov5647_sensor_power(struct v4l2_subdev *sd, int on)
>  
>  		clk_disable_unprepare(ov5647->xclk);
>  
> -		gpiod_set_value(ov5647->pwdn, 1);
> +		gpiod_set_value_cansleep(ov5647->pwdn, 1);
>  	}
>  
>  	/* Update the power count. */
> @@ -648,13 +648,13 @@ static int ov5647_probe(struct i2c_client *client)
>  		goto mutex_remove;
>  
>  	if (sensor->pwdn) {
> -		gpiod_set_value(sensor->pwdn, 0);
> +		gpiod_set_value_cansleep(sensor->pwdn, 0);
>  		msleep(PWDN_ACTIVE_DELAY_MS);
>  	}
>  
>  	ret = ov5647_detect(sd);
>  
> -	gpiod_set_value(sensor->pwdn, 1);
> +	gpiod_set_value_cansleep(sensor->pwdn, 1);
>  
>  	if (ret < 0)
>  		goto error;
> -- 
> 2.17.1
> 

-- 
Sakari Ailus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ