Re: [PATCH v2 1/2] Staging: iio: Place driver in sleep mode on error

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

 



On 22/03/15 00:26, Cristina Opriceana wrote:
> Put device in sleep mode if an error is encountered after
> initialization in order to avoid wasting power.
The patch title should definitely include the name of the driver in question!
Otherwise you'll not generally get reviews from the relevant people.
Staging:iio:hmc5843 Place driver in sleep mode on error during probe.

Also try to cc relevant people and the relevant list.
See MAINTAINERS and you'll notice we have both a list and a
set of designated reviewers who would like to be cc'd on IIO patches.
They may not respond, but if you don't send it to them then they
definitely won't!



Jonathan

> 
> Signed-off-by: Cristina Opriceana <cristina.opriceana@xxxxxxxxx>
> ---
>  drivers/staging/iio/magnetometer/hmc5843_core.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c b/drivers/staging/iio/magnetometer/hmc5843_core.c
> index 0074af2..7de19c2 100644
> --- a/drivers/staging/iio/magnetometer/hmc5843_core.c
> +++ b/drivers/staging/iio/magnetometer/hmc5843_core.c
> @@ -611,7 +611,7 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
>  	ret = iio_triggered_buffer_setup(indio_dev, NULL,
>  					 hmc5843_trigger_handler, NULL);
>  	if (ret < 0)
> -		return ret;
> +		goto buffer_setup_err;
>  
>  	ret = iio_device_register(indio_dev);
>  	if (ret < 0)
> @@ -619,8 +619,12 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
>  
>  	return 0;
>  
> +buffer_setup_err:
> +	hmc5843_set_mode(iio_priv(indio_dev), HMC5843_MODE_SLEEP);
> +	return ret;
>  buffer_cleanup:
>  	iio_triggered_buffer_cleanup(indio_dev);
> +	hmc5843_set_mode(iio_priv(indio_dev), HMC5843_MODE_SLEEP);
>  	return ret;
Single exit path that reverses the ordering of creation.

e.g.
buffer_setup_err:
	hmc_set_mode(iio_priv(indio_dev), HMC5843_MODE_SLEEP);
buffer_cleanup:
	iio_triggered_buffer_cleanup(indio_dev);
	return ret;
>  }
>  EXPORT_SYMBOL(hmc5843_common_probe);
> 

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