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


Groups > linux.kernel > #1372244

Re: [PATCH 1/9] iio: adc: exynos_adc: use regmap to retrieve struct device

From Marek Szyprowski <m.szyprowski@samsung.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/9] iio: adc: exynos_adc: use regmap to retrieve struct device
Date 2016-04-06 09:10 +0200
Message-ID <rkPLc-gu-15@gated-at.bofh.it> (permalink)
References <rkO2K-7uk-9@gated-at.bofh.it> <rkO2K-7uk-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hello,

On 2016-04-06 07:15, Alison Schofield wrote:
> Driver includes struct regmap and struct device in its global data.
> Remove the struct device and use regmap API to retrieve device info.
>
> Patch created using Coccinelle plus manual edits.
>
> Signed-off-by: Alison Schofield <amsfield22@gmail.com>

This patch changes the struct device which is used by the driver to 
report errors. The driver used correctly the struct device associated 
with its device tree node, while after the patch it will use device 
which is associated with PMU regmap, which is a different device. PMU 
regmap is there only to enable/disable the ADC block and it is not the 
regmap used to access registers of the ADC device.

I would prefer to drop this patch.

> ---
>   drivers/iio/adc/exynos_adc.c | 18 +++++++++---------
>   1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
> index c15756d..0313e0f 100644
> --- a/drivers/iio/adc/exynos_adc.c
> +++ b/drivers/iio/adc/exynos_adc.c
> @@ -130,7 +130,6 @@
>   
>   struct exynos_adc {
>   	struct exynos_adc_data	*data;
> -	struct device		*dev;
>   	struct input_dev	*input;
>   	void __iomem		*regs;
>   	struct regmap		*pmu_map;
> @@ -173,11 +172,12 @@ static void exynos_adc_unprepare_clk(struct exynos_adc *info)
>   
>   static int exynos_adc_prepare_clk(struct exynos_adc *info)
>   {
> +	struct device *dev = regmap_get_device(info->pmu_map);
>   	int ret;
>   
>   	ret = clk_prepare(info->clk);
>   	if (ret) {
> -		dev_err(info->dev, "failed preparing adc clock: %d\n", ret);
> +		dev_err(dev, "failed preparing adc clock: %d\n", ret);
>   		return ret;
>   	}
>   
> @@ -185,7 +185,7 @@ static int exynos_adc_prepare_clk(struct exynos_adc *info)
>   		ret = clk_prepare(info->sclk);
>   		if (ret) {
>   			clk_unprepare(info->clk);
> -			dev_err(info->dev,
> +			dev_err(dev,
>   				"failed preparing sclk_adc clock: %d\n", ret);
>   			return ret;
>   		}
> @@ -203,11 +203,12 @@ static void exynos_adc_disable_clk(struct exynos_adc *info)
>   
>   static int exynos_adc_enable_clk(struct exynos_adc *info)
>   {
> +	struct device *dev = regmap_get_device(info->pmu_map);
>   	int ret;
>   
>   	ret = clk_enable(info->clk);
>   	if (ret) {
> -		dev_err(info->dev, "failed enabling adc clock: %d\n", ret);
> +		dev_err(dev, "failed enabling adc clock: %d\n", ret);
>   		return ret;
>   	}
>   
> @@ -215,7 +216,7 @@ static int exynos_adc_enable_clk(struct exynos_adc *info)
>   		ret = clk_enable(info->sclk);
>   		if (ret) {
>   			clk_disable(info->clk);
> -			dev_err(info->dev,
> +			dev_err(dev,
>   				"failed enabling sclk_adc clock: %d\n", ret);
>   			return ret;
>   		}
> @@ -610,13 +611,14 @@ static irqreturn_t exynos_adc_isr(int irq, void *dev_id)
>   static irqreturn_t exynos_ts_isr(int irq, void *dev_id)
>   {
>   	struct exynos_adc *info = dev_id;
> -	struct iio_dev *dev = dev_get_drvdata(info->dev);
> +	struct device *dev = regmap_get_device(info->pmu_map);
> +	struct iio_dev *indio_dev = dev_get_drvdata(dev);
>   	u32 x, y;
>   	bool pressed;
>   	int ret;
>   
>   	while (info->input->users) {
> -		ret = exynos_read_s3c64xx_ts(dev, &x, &y);
> +		ret = exynos_read_s3c64xx_ts(indio_dev, &x, &y);
>   		if (ret == -ETIMEDOUT)
>   			break;
>   
> @@ -800,8 +802,6 @@ static int exynos_adc_probe(struct platform_device *pdev)
>   
>   	info->tsirq = irq;
>   
> -	info->dev = &pdev->dev;
> -
>   	init_completion(&info->completion);
>   
>   	info->clk = devm_clk_get(&pdev->dev, "adc");

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

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


Thread

[PATCH 0/9] iio: use regmap to retrieve struct device Alison Schofield <amsfield22@gmail.com> - 2016-04-06 07:20 +0200
  [PATCH 1/9] iio: adc: exynos_adc: use regmap to retrieve struct  device Alison Schofield <amsfield22@gmail.com> - 2016-04-06 07:20 +0200
    Re: [PATCH 1/9] iio: adc: exynos_adc: use regmap to retrieve struct  device Marek Szyprowski <m.szyprowski@samsung.com> - 2016-04-06 09:10 +0200
      Re: [PATCH 1/9] iio: adc: exynos_adc: use regmap to retrieve struct  device Alison Schofield <amsfield22@gmail.com> - 2016-04-06 22:40 +0200
        Re: [PATCH 1/9] iio: adc: exynos_adc: use regmap to retrieve struct  device Marek Szyprowski <m.szyprowski@samsung.com> - 2016-04-07 07:40 +0200
          Re: [PATCH 1/9] iio: adc: exynos_adc: use regmap to retrieve struct  device Jonathan Cameron <jic23@kernel.org> - 2016-04-10 15:50 +0200
  [PATCH 3/9] iio: adc: qcom-spmi-vadc: use regmap to retrieve struct  device Alison Schofield <amsfield22@gmail.com> - 2016-04-06 07:20 +0200
    Re: [PATCH 3/9] iio: adc: qcom-spmi-vadc: use regmap to retrieve  struct device Jonathan Cameron <jic23@kernel.org> - 2016-04-10 16:00 +0200
  [PATCH 6/9] iio: accel: mxc4005: use regmap to retrieve struct device Alison Schofield <amsfield22@gmail.com> - 2016-04-06 07:20 +0200
  [PATCH 4/9] iio: accel: bmc150: use regmap to retrieve struct device Alison Schofield <amsfield22@gmail.com> - 2016-04-06 07:20 +0200
  [PATCH 8/9] iio: health: afe4404: use regmap to retrieve struct  device Alison Schofield <amsfield22@gmail.com> - 2016-04-06 07:30 +0200
  [PATCH 7/9] iio: health: afe4403: use regmap to retrieve struct  device Alison Schofield <amsfield22@gmail.com> - 2016-04-06 07:30 +0200
  [PATCH 9/9] iio: gyro: bmg160_core: use regmap to retrieve struct  device Alison Schofield <amsfield22@gmail.com> - 2016-04-06 07:30 +0200
  [PATCH v2 0/5] iio: use regmap to retrieve struct device Alison Schofield <amsfield22@gmail.com> - 2016-04-10 21:10 +0200
    [PATCH v2 2/5] iio: accel: mxc4005: use regmap to retrieve struct device Alison Schofield <amsfield22@gmail.com> - 2016-04-10 21:10 +0200

csiph-web