All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Alison Schofield <amsfield22@gmail.com>, jic23@kernel.org
Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
	kgene@kernel.org, k.kozlowski@samsung.com,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH 1/9] iio: adc: exynos_adc: use regmap to retrieve struct device
Date: Wed, 06 Apr 2016 09:03:00 +0200	[thread overview]
Message-ID: <5704B4A4.1070704@samsung.com> (raw)
In-Reply-To: <2329d20396db00b60f4e7d2e783ea46b48eea9c1.1459918214.git.amsfield22@gmail.com>

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


WARNING: multiple messages have this Message-ID (diff)
From: m.szyprowski@samsung.com (Marek Szyprowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/9] iio: adc: exynos_adc: use regmap to retrieve struct device
Date: Wed, 06 Apr 2016 09:03:00 +0200	[thread overview]
Message-ID: <5704B4A4.1070704@samsung.com> (raw)
In-Reply-To: <2329d20396db00b60f4e7d2e783ea46b48eea9c1.1459918214.git.amsfield22@gmail.com>

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

  reply	other threads:[~2016-04-06  7:03 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-06  5:15 [PATCH 0/9] iio: use regmap to retrieve struct device Alison Schofield
2016-04-06  5:15 ` Alison Schofield
2016-04-06  5:15 ` [PATCH 1/9] iio: adc: exynos_adc: " Alison Schofield
2016-04-06  5:15   ` Alison Schofield
2016-04-06  7:03   ` Marek Szyprowski [this message]
2016-04-06  7:03     ` Marek Szyprowski
2016-04-06 20:33     ` Alison Schofield
2016-04-06 20:33       ` Alison Schofield
2016-04-06 20:33       ` Alison Schofield
2016-04-07  5:33       ` Marek Szyprowski
2016-04-07  5:33         ` Marek Szyprowski
2016-04-07  5:33         ` Marek Szyprowski
2016-04-10 13:45         ` Jonathan Cameron
2016-04-10 13:45           ` Jonathan Cameron
2016-04-10 13:45           ` Jonathan Cameron
2016-04-06  5:16 ` [PATCH 2/9] iio: adc: qcom-spmi-iadc: " Alison Schofield
2016-04-06  5:16   ` Alison Schofield
2016-04-06  5:16   ` Alison Schofield
2016-04-10 13:54   ` Jonathan Cameron
2016-04-10 13:54     ` Jonathan Cameron
2016-04-06  5:17 ` [PATCH 3/9] iio: adc: qcom-spmi-vadc: " Alison Schofield
2016-04-06  5:17   ` Alison Schofield
2016-04-10 13:55   ` Jonathan Cameron
2016-04-10 13:55     ` Jonathan Cameron
2016-04-06  5:18 ` [PATCH 4/9] iio: accel: bmc150: " Alison Schofield
2016-04-06  5:18   ` Alison Schofield
2016-04-06  5:18 ` [PATCH 5/9] iio: accel: mma7455: " Alison Schofield
2016-04-06  5:18   ` Alison Schofield
2016-04-06  5:18   ` Alison Schofield
2016-04-06  7:35   ` Joachim Eastwood
2016-04-06  7:35     ` Joachim Eastwood
2016-04-10 13:51     ` Jonathan Cameron
2016-04-10 13:51       ` Jonathan Cameron
2016-04-06  5:19 ` [PATCH 6/9] iio: accel: mxc4005: " Alison Schofield
2016-04-06  5:19   ` Alison Schofield
2016-04-06  5:19   ` Alison Schofield
2016-04-06  5:20 ` [PATCH 7/9] iio: health: afe4403: " Alison Schofield
2016-04-06  5:20   ` Alison Schofield
2016-04-06  5:20   ` Alison Schofield
2016-04-06  5:20 ` [PATCH 8/9] iio: health: afe4404: " Alison Schofield
2016-04-06  5:20   ` Alison Schofield
2016-04-06  5:21 ` [PATCH 9/9] iio: gyro: bmg160_core: " Alison Schofield
2016-04-06  5:21   ` Alison Schofield
2016-04-06  5:21   ` Alison Schofield
2016-04-10 19:03 ` [PATCH v2 0/5] iio: " Alison Schofield
2016-04-10 19:03   ` Alison Schofield
2016-04-10 19:05   ` [PATCH v2 1/5] iio: accel: bmc150: " Alison Schofield
2016-04-10 19:05     ` Alison Schofield
2016-04-10 19:05     ` Alison Schofield
2016-04-16 19:20     ` Jonathan Cameron
2016-04-16 19:20       ` Jonathan Cameron
2016-04-18 12:18       ` Tirdea, Irina
2016-04-18 12:18         ` Tirdea, Irina
2016-04-18 14:59       ` Srinivas Pandruvada
2016-04-18 14:59         ` Srinivas Pandruvada
2016-04-18 14:59         ` Srinivas Pandruvada
2016-04-18 19:16         ` Jonathan Cameron
2016-04-18 19:16           ` Jonathan Cameron
2016-04-18 19:16           ` Jonathan Cameron
2016-04-10 19:06   ` [PATCH v2 2/5] iio: accel: mxc4005: " Alison Schofield
2016-04-10 19:06     ` Alison Schofield
2016-04-16 19:21     ` Jonathan Cameron
2016-04-16 19:21       ` Jonathan Cameron
2016-04-10 19:07   ` [PATCH v2 3/5] iio: health: afe4403: " Alison Schofield
2016-04-10 19:07     ` Alison Schofield
2016-04-10 19:07     ` Alison Schofield
2016-04-16 19:22     ` Jonathan Cameron
2016-04-16 19:22       ` Jonathan Cameron
2016-04-10 19:07   ` [PATCH v2 4/5] iio: health: afe4404: " Alison Schofield
2016-04-10 19:07     ` Alison Schofield
2016-04-10 19:07     ` Alison Schofield
2016-04-16 19:22     ` Jonathan Cameron
2016-04-16 19:22       ` Jonathan Cameron
2016-04-17 18:07       ` Andrew F. Davis
2016-04-17 18:07         ` Andrew F. Davis
2016-04-17 18:07         ` Andrew F. Davis
2016-04-18  4:56         ` Alison Schofield
2016-04-18 15:53           ` Andrew F. Davis
2016-04-18 19:25             ` Jonathan Cameron
2016-04-10 19:08   ` [PATCH v2 5/5] iio: gyro: bmg160: " Alison Schofield
2016-04-10 19:08     ` Alison Schofield
2016-04-16 19:24     ` Jonathan Cameron
2016-04-16 19:24       ` Jonathan Cameron
2016-04-17  4:33       ` Alison Schofield
2016-04-18 15:03       ` Srinivas Pandruvada
2016-04-18 15:03         ` Srinivas Pandruvada
2016-04-18 15:03         ` Srinivas Pandruvada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5704B4A4.1070704@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=amsfield22@gmail.com \
    --cc=jic23@kernel.org \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.