Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1609173

Re: [PATCH 3/7] iio: cros_ec_sensors: Use devm to setup the triggered buffer.

From Jonathan Cameron <jic23@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 3/7] iio: cros_ec_sensors: Use devm to setup the triggered buffer.
Date 2017-03-25 16:20 +0100
Message-ID <toVDX-2C4-5@gated-at.bofh.it> (permalink)
References <toBvz-4Xj-1@gated-at.bofh.it> <toBvA-4Xj-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 24/03/17 17:44, Enric Balletbo i Serra wrote:
> Use resourced managed function devm_iio_triggered_buffer_setup
> to make error path simpler and be able to get rid of the remove
> function.
> 
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan
> ---
> 
>   This is an improvement that can wait to 4.12 merge window, again can be
> picked independently of the other patches and can go through IIO Jonathan's
> Cameron tree.
Thanks for these notes btw. Saves me having to figure out the dependencies
within the series.  Very useful.
> 
>  .../iio/common/cros_ec_sensors/cros_ec_sensors.c   | 26 +++-------------------
>  1 file changed, 3 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
> index c17596f..38e8783 100644
> --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
> +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
> @@ -267,31 +267,12 @@ static int cros_ec_sensors_probe(struct platform_device *pdev)
>  	else
>  		state->core.read_ec_sensors_data = cros_ec_sensors_read_cmd;
>  
> -	ret = iio_triggered_buffer_setup(indio_dev, NULL,
> -					 cros_ec_sensors_capture, NULL);
> +	ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL,
> +			cros_ec_sensors_capture, NULL);
>  	if (ret)
>  		return ret;
>  
> -	ret = iio_device_register(indio_dev);
> -	if (ret)
> -		goto error_uninit_buffer;
> -
> -	return 0;
> -
> -error_uninit_buffer:
> -	iio_triggered_buffer_cleanup(indio_dev);
> -
> -	return ret;
> -}
> -
> -static int cros_ec_sensors_remove(struct platform_device *pdev)
> -{
> -	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> -
> -	iio_device_unregister(indio_dev);
> -	iio_triggered_buffer_cleanup(indio_dev);
> -
> -	return 0;
> +	return devm_iio_device_register(dev, indio_dev);
>  }
>  
>  static const struct platform_device_id cros_ec_sensors_ids[] = {
> @@ -313,7 +294,6 @@ static struct platform_driver cros_ec_sensors_platform_driver = {
>  		.name	= "cros-ec-sensors",
>  	},
>  	.probe		= cros_ec_sensors_probe,
> -	.remove		= cros_ec_sensors_remove,
>  	.id_table	= cros_ec_sensors_ids,
>  };
>  module_platform_driver(cros_ec_sensors_platform_driver);
> 

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/7] mfd: cros-ec: Some fixes and improvements. Enric Balletbo i Serra <enric.balletbo@collabora.com> - 2017-03-24 18:50 +0100
  [PATCH 4/7] mfd: cros_ec: Get rid of cros_ec_check_features from cros_ec_dev. Enric Balletbo i Serra <enric.balletbo@collabora.com> - 2017-03-24 18:50 +0100
    Re: [PATCH 4/7] mfd: cros_ec: Get rid of cros_ec_check_features from  cros_ec_dev. Jonathan Cameron <jic23@kernel.org> - 2017-03-25 16:30 +0100
      Re: [PATCH 4/7] mfd: cros_ec: Get rid of cros_ec_check_features from  cros_ec_dev. Jonathan Cameron <jic23@kernel.org> - 2017-03-25 16:30 +0100
      Re: [PATCH 4/7] mfd: cros_ec: Get rid of cros_ec_check_features from  cros_ec_dev. Lee Jones <lee.jones@linaro.org> - 2017-03-27 14:50 +0200
  [PATCH 7/7] mfd: cros_ec: add RTC as mfd subdevice Enric Balletbo i Serra <enric.balletbo@collabora.com> - 2017-03-24 18:50 +0100
  [PATCH 1/7] mfd: cros-ec: Fix host command buffer size Enric Balletbo i Serra <enric.balletbo@collabora.com> - 2017-03-24 18:50 +0100
  [PATCH 6/7] rtc: cros-ec: add cros-ec-rtc driver. Enric Balletbo i Serra <enric.balletbo@collabora.com> - 2017-03-24 18:50 +0100
  [PATCH 5/7] mfd: cros_ec: Introduce RTC commands and events definitions. Enric Balletbo i Serra <enric.balletbo@collabora.com> - 2017-03-24 18:50 +0100
  [PATCH 2/7] iio: cros_ec_sensors: Fix return value to get raw and calibbias data. Enric Balletbo i Serra <enric.balletbo@collabora.com> - 2017-03-24 18:50 +0100
    Re: [PATCH 2/7] iio: cros_ec_sensors: Fix return value to get raw and  calibbias data. Jonathan Cameron <jic23@kernel.org> - 2017-03-25 16:10 +0100
  [PATCH 3/7] iio: cros_ec_sensors: Use devm to setup the triggered buffer. Enric Balletbo i Serra <enric.balletbo@collabora.com> - 2017-03-24 18:50 +0100
    Re: [PATCH 3/7] iio: cros_ec_sensors: Use devm to setup the triggered  buffer. Jonathan Cameron <jic23@kernel.org> - 2017-03-25 16:20 +0100

csiph-web