Re: [PATCH 6/8] iio:magnetometer:bmc150_magn: protect runtime_resume with mutex

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

 



On 17/07/15 09:52, Hartmut Knaack wrote:
> Protect bmc150_magn_runtime_resume() with a mutex, as done with other
> suspend/resume functions.
> 
> Signed-off-by: Hartmut Knaack <knaack.h@xxxxxx>
Looks fine to me, but given we are getting into more complex patches, I'll
let this sit on the list for Irina and others to have a look at.

Jonathan
> ---
>  drivers/iio/magnetometer/bmc150_magn.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c
> index e1f804b2b244..ac0cdbde813b 100644
> --- a/drivers/iio/magnetometer/bmc150_magn.c
> +++ b/drivers/iio/magnetometer/bmc150_magn.c
> @@ -1052,9 +1052,14 @@ static int bmc150_magn_runtime_resume(struct device *dev)
>  {
>  	struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
>  	struct bmc150_magn_data *data = iio_priv(indio_dev);
> +	int ret;
>  
> -	return bmc150_magn_set_power_mode(data, BMC150_MAGN_POWER_MODE_NORMAL,
> -					  true);
> +	mutex_lock(&data->mutex);
> +	ret = bmc150_magn_set_power_mode(data, BMC150_MAGN_POWER_MODE_NORMAL,
> +					 true);
> +	mutex_unlock(&data->mutex);
> +
> +	return ret;
>  }
>  #endif
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux