linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATH v3 0/3] iio: adc: xilinx: use even more devres
@ 2020-11-30 14:27 Bartosz Golaszewski
  2020-11-30 14:27 ` [PATH v3 1/3] iio: adc: xilinx: use helper variable for &pdev->dev Bartosz Golaszewski
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Bartosz Golaszewski @ 2020-11-30 14:27 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Michal Simek
  Cc: linux-iio, linux-arm-kernel, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

This is a follow-up to commit 750628c79bb1 ("iio: adc: xilinx-xadc: use
devm_krealloc()"). I noticed we can use even more devres helpers and entirely
drop the remove() callback.

v1 -> v2:
- squash three patches adding more devres calls into one for easier review
- don't insist on the 80 characters limit
- add a new helper: devm_krealloc_array() and use it

v2 -> v3:
- drop the devm_krealloc_array() helper

Bartosz Golaszewski (3):
  iio: adc: xilinx: use helper variable for &pdev->dev
  iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc()
  iio: adc: xilinx: use more devres helpers and remove remove()

 drivers/iio/adc/xilinx-xadc-core.c | 157 ++++++++++++++---------------
 1 file changed, 74 insertions(+), 83 deletions(-)

-- 
2.29.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATH v3 1/3] iio: adc: xilinx: use helper variable for &pdev->dev
  2020-11-30 14:27 [PATH v3 0/3] iio: adc: xilinx: use even more devres Bartosz Golaszewski
@ 2020-11-30 14:27 ` Bartosz Golaszewski
  2020-11-30 14:27 ` [PATH v3 2/3] iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc() Bartosz Golaszewski
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Bartosz Golaszewski @ 2020-11-30 14:27 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Michal Simek
  Cc: linux-iio, linux-arm-kernel, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

It's more elegant to use a helper local variable to store the address
of the underlying struct device than to dereference pdev everywhere.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/iio/adc/xilinx-xadc-core.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index f93c34fe5873..8494eb424b33 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -1186,6 +1186,7 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, struct device_node *np,
 
 static int xadc_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	const struct of_device_id *id;
 	struct iio_dev *indio_dev;
 	unsigned int bipolar_mask;
@@ -1195,10 +1196,10 @@ static int xadc_probe(struct platform_device *pdev)
 	int irq;
 	int i;
 
-	if (!pdev->dev.of_node)
+	if (!dev->of_node)
 		return -ENODEV;
 
-	id = of_match_node(xadc_of_match_table, pdev->dev.of_node);
+	id = of_match_node(xadc_of_match_table, dev->of_node);
 	if (!id)
 		return -EINVAL;
 
@@ -1206,7 +1207,7 @@ static int xadc_probe(struct platform_device *pdev)
 	if (irq <= 0)
 		return -ENXIO;
 
-	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*xadc));
+	indio_dev = devm_iio_device_alloc(dev, sizeof(*xadc));
 	if (!indio_dev)
 		return -ENOMEM;
 
@@ -1226,7 +1227,7 @@ static int xadc_probe(struct platform_device *pdev)
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &xadc_info;
 
-	ret = xadc_parse_dt(indio_dev, pdev->dev.of_node, &conf0);
+	ret = xadc_parse_dt(indio_dev, dev->of_node, &conf0);
 	if (ret)
 		return ret;
 
@@ -1250,7 +1251,7 @@ static int xadc_probe(struct platform_device *pdev)
 		}
 	}
 
-	xadc->clk = devm_clk_get(&pdev->dev, NULL);
+	xadc->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(xadc->clk)) {
 		ret = PTR_ERR(xadc->clk);
 		goto err_free_samplerate_trigger;
@@ -1276,7 +1277,7 @@ static int xadc_probe(struct platform_device *pdev)
 	}
 
 	ret = request_irq(xadc->irq, xadc->ops->interrupt_handler, 0,
-			dev_name(&pdev->dev), indio_dev);
+			  dev_name(dev), indio_dev);
 	if (ret)
 		goto err_clk_disable_unprepare;
 
-- 
2.29.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATH v3 2/3] iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc()
  2020-11-30 14:27 [PATH v3 0/3] iio: adc: xilinx: use even more devres Bartosz Golaszewski
  2020-11-30 14:27 ` [PATH v3 1/3] iio: adc: xilinx: use helper variable for &pdev->dev Bartosz Golaszewski
@ 2020-11-30 14:27 ` Bartosz Golaszewski
  2020-11-30 14:27 ` [PATH v3 3/3] iio: adc: xilinx: use more devres helpers and remove remove() Bartosz Golaszewski
  2020-11-30 20:21 ` [PATH v3 0/3] iio: adc: xilinx: use even more devres Jonathan Cameron
  3 siblings, 0 replies; 11+ messages in thread
From: Bartosz Golaszewski @ 2020-11-30 14:27 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Michal Simek
  Cc: linux-iio, linux-arm-kernel, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

We now have devm_krealloc() in the kernel Use it indstead of calling
kfree() and kcalloc() separately.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/iio/adc/xilinx-xadc-core.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index 8494eb424b33..6f89a97bb127 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -19,6 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/overflow.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/sysfs.h>
@@ -585,15 +586,22 @@ static int xadc_update_scan_mode(struct iio_dev *indio_dev,
 	const unsigned long *mask)
 {
 	struct xadc *xadc = iio_priv(indio_dev);
-	unsigned int n;
+	size_t new_size, n;
+	void *data;
 
 	n = bitmap_weight(mask, indio_dev->masklength);
 
-	kfree(xadc->data);
-	xadc->data = kcalloc(n, sizeof(*xadc->data), GFP_KERNEL);
-	if (!xadc->data)
+	if (check_mul_overflow(n, sizeof(*xadc->data), &new_size))
+		return -ENOMEM;
+
+	data = devm_krealloc(indio_dev->dev.parent, xadc->data,
+			     new_size, GFP_KERNEL);
+	if (!data)
 		return -ENOMEM;
 
+	memset(data, 0, new_size);
+	xadc->data = data;
+
 	return 0;
 }
 
@@ -1372,7 +1380,6 @@ static int xadc_remove(struct platform_device *pdev)
 	free_irq(xadc->irq, indio_dev);
 	cancel_delayed_work_sync(&xadc->zynq_unmask_work);
 	clk_disable_unprepare(xadc->clk);
-	kfree(xadc->data);
 
 	return 0;
 }
-- 
2.29.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATH v3 3/3] iio: adc: xilinx: use more devres helpers and remove remove()
  2020-11-30 14:27 [PATH v3 0/3] iio: adc: xilinx: use even more devres Bartosz Golaszewski
  2020-11-30 14:27 ` [PATH v3 1/3] iio: adc: xilinx: use helper variable for &pdev->dev Bartosz Golaszewski
  2020-11-30 14:27 ` [PATH v3 2/3] iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc() Bartosz Golaszewski
@ 2020-11-30 14:27 ` Bartosz Golaszewski
  2020-11-30 14:30   ` Bartosz Golaszewski
  2020-11-30 20:21 ` [PATH v3 0/3] iio: adc: xilinx: use even more devres Jonathan Cameron
  3 siblings, 1 reply; 11+ messages in thread
From: Bartosz Golaszewski @ 2020-11-30 14:27 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Michal Simek
  Cc: linux-iio, linux-arm-kernel, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

In order to simplify resource management and error paths in probe() and
entirely drop the remove() callback - use devres helpers wherever
possible. Define devm actions for cancelling the delayed work and
disabling the clock.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/iio/adc/xilinx-xadc-core.c | 129 +++++++++++++----------------
 1 file changed, 56 insertions(+), 73 deletions(-)

diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index 6f89a97bb127..495b3422b266 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -713,11 +713,12 @@ static const struct iio_trigger_ops xadc_trigger_ops = {
 static struct iio_trigger *xadc_alloc_trigger(struct iio_dev *indio_dev,
 	const char *name)
 {
+	struct device *dev = indio_dev->dev.parent;
 	struct iio_trigger *trig;
 	int ret;
 
-	trig = iio_trigger_alloc("%s%d-%s", indio_dev->name,
-				indio_dev->id, name);
+	trig = devm_iio_trigger_alloc(dev, "%s%d-%s", indio_dev->name,
+				      indio_dev->id, name);
 	if (trig == NULL)
 		return ERR_PTR(-ENOMEM);
 
@@ -725,15 +726,11 @@ static struct iio_trigger *xadc_alloc_trigger(struct iio_dev *indio_dev,
 	trig->ops = &xadc_trigger_ops;
 	iio_trigger_set_drvdata(trig, iio_priv(indio_dev));
 
-	ret = iio_trigger_register(trig);
+	ret = devm_iio_trigger_register(dev, trig);
 	if (ret)
-		goto error_free_trig;
+		return ERR_PTR(ret);
 
 	return trig;
-
-error_free_trig:
-	iio_trigger_free(trig);
-	return ERR_PTR(ret);
 }
 
 static int xadc_power_adc_b(struct xadc *xadc, unsigned int seq_mode)
@@ -1192,6 +1189,20 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, struct device_node *np,
 	return 0;
 }
 
+static void xadc_clk_disable_unprepare(void *data)
+{
+	struct clk *clk = data;
+
+	clk_disable_unprepare(clk);
+}
+
+static void xadc_cancel_delayed_work(void *data)
+{
+	struct delayed_work *work = data;
+
+	cancel_delayed_work_sync(work);
+}
+
 static int xadc_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -1240,34 +1251,35 @@ static int xadc_probe(struct platform_device *pdev)
 		return ret;
 
 	if (xadc->ops->flags & XADC_FLAGS_BUFFERED) {
-		ret = iio_triggered_buffer_setup(indio_dev,
-			&iio_pollfunc_store_time, &xadc_trigger_handler,
-			&xadc_buffer_ops);
+		ret = devm_iio_triggered_buffer_setup(dev, indio_dev,
+						      &iio_pollfunc_store_time,
+						      &xadc_trigger_handler,
+						      &xadc_buffer_ops);
 		if (ret)
 			return ret;
 
 		xadc->convst_trigger = xadc_alloc_trigger(indio_dev, "convst");
-		if (IS_ERR(xadc->convst_trigger)) {
-			ret = PTR_ERR(xadc->convst_trigger);
-			goto err_triggered_buffer_cleanup;
-		}
+		if (IS_ERR(xadc->convst_trigger))
+			return PTR_ERR(xadc->convst_trigger);
+
 		xadc->samplerate_trigger = xadc_alloc_trigger(indio_dev,
 			"samplerate");
-		if (IS_ERR(xadc->samplerate_trigger)) {
-			ret = PTR_ERR(xadc->samplerate_trigger);
-			goto err_free_convst_trigger;
-		}
+		if (IS_ERR(xadc->samplerate_trigger))
+			return PTR_ERR(xadc->samplerate_trigger);
 	}
 
 	xadc->clk = devm_clk_get(dev, NULL);
-	if (IS_ERR(xadc->clk)) {
-		ret = PTR_ERR(xadc->clk);
-		goto err_free_samplerate_trigger;
-	}
+	if (IS_ERR(xadc->clk))
+		return PTR_ERR(xadc->clk);
 
 	ret = clk_prepare_enable(xadc->clk);
 	if (ret)
-		goto err_free_samplerate_trigger;
+		return ret;
+
+	ret = devm_add_action_or_reset(dev,
+				       xadc_clk_disable_unprepare, xadc->clk);
+	if (ret)
+		return ret;
 
 	/*
 	 * Make sure not to exceed the maximum samplerate since otherwise the
@@ -1276,22 +1288,28 @@ static int xadc_probe(struct platform_device *pdev)
 	if (xadc->ops->flags & XADC_FLAGS_BUFFERED) {
 		ret = xadc_read_samplerate(xadc);
 		if (ret < 0)
-			goto err_free_samplerate_trigger;
+			return ret;
+
 		if (ret > XADC_MAX_SAMPLERATE) {
 			ret = xadc_write_samplerate(xadc, XADC_MAX_SAMPLERATE);
 			if (ret < 0)
-				goto err_free_samplerate_trigger;
+				return ret;
 		}
 	}
 
-	ret = request_irq(xadc->irq, xadc->ops->interrupt_handler, 0,
-			  dev_name(dev), indio_dev);
+	ret = devm_request_irq(dev, xadc->irq, xadc->ops->interrupt_handler, 0,
+			       dev_name(dev), indio_dev);
+	if (ret)
+		return ret;
+
+	ret = devm_add_action_or_reset(dev, xadc_cancel_delayed_work,
+				       &xadc->zynq_unmask_work);
 	if (ret)
-		goto err_clk_disable_unprepare;
+		return ret;
 
 	ret = xadc->ops->setup(pdev, indio_dev, xadc->irq);
 	if (ret)
-		goto err_free_irq;
+		return ret;
 
 	for (i = 0; i < 16; i++)
 		xadc_read_adc_reg(xadc, XADC_REG_THRESHOLD(i),
@@ -1299,7 +1317,7 @@ static int xadc_probe(struct platform_device *pdev)
 
 	ret = xadc_write_adc_reg(xadc, XADC_REG_CONF0, conf0);
 	if (ret)
-		goto err_free_irq;
+		return ret;
 
 	bipolar_mask = 0;
 	for (i = 0; i < indio_dev->num_channels; i++) {
@@ -1309,17 +1327,18 @@ static int xadc_probe(struct platform_device *pdev)
 
 	ret = xadc_write_adc_reg(xadc, XADC_REG_INPUT_MODE(0), bipolar_mask);
 	if (ret)
-		goto err_free_irq;
+		return ret;
+
 	ret = xadc_write_adc_reg(xadc, XADC_REG_INPUT_MODE(1),
 		bipolar_mask >> 16);
 	if (ret)
-		goto err_free_irq;
+		return ret;
 
 	/* Disable all alarms */
 	ret = xadc_update_adc_reg(xadc, XADC_REG_CONF1, XADC_CONF1_ALARM_MASK,
 				  XADC_CONF1_ALARM_MASK);
 	if (ret)
-		goto err_free_irq;
+		return ret;
 
 	/* Set thresholds to min/max */
 	for (i = 0; i < 16; i++) {
@@ -1334,59 +1353,23 @@ static int xadc_probe(struct platform_device *pdev)
 		ret = xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i),
 			xadc->threshold[i]);
 		if (ret)
-			goto err_free_irq;
+			return ret;
 	}
 
 	/* Go to non-buffered mode */
 	xadc_postdisable(indio_dev);
 
-	ret = iio_device_register(indio_dev);
+	ret = devm_iio_device_register(dev, indio_dev);
 	if (ret)
-		goto err_free_irq;
+		return ret;
 
 	platform_set_drvdata(pdev, indio_dev);
 
-	return 0;
-
-err_free_irq:
-	free_irq(xadc->irq, indio_dev);
-	cancel_delayed_work_sync(&xadc->zynq_unmask_work);
-err_clk_disable_unprepare:
-	clk_disable_unprepare(xadc->clk);
-err_free_samplerate_trigger:
-	if (xadc->ops->flags & XADC_FLAGS_BUFFERED)
-		iio_trigger_free(xadc->samplerate_trigger);
-err_free_convst_trigger:
-	if (xadc->ops->flags & XADC_FLAGS_BUFFERED)
-		iio_trigger_free(xadc->convst_trigger);
-err_triggered_buffer_cleanup:
-	if (xadc->ops->flags & XADC_FLAGS_BUFFERED)
-		iio_triggered_buffer_cleanup(indio_dev);
-
-	return ret;
-}
-
-static int xadc_remove(struct platform_device *pdev)
-{
-	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
-	struct xadc *xadc = iio_priv(indio_dev);
-
-	iio_device_unregister(indio_dev);
-	if (xadc->ops->flags & XADC_FLAGS_BUFFERED) {
-		iio_trigger_free(xadc->samplerate_trigger);
-		iio_trigger_free(xadc->convst_trigger);
-		iio_triggered_buffer_cleanup(indio_dev);
-	}
-	free_irq(xadc->irq, indio_dev);
-	cancel_delayed_work_sync(&xadc->zynq_unmask_work);
-	clk_disable_unprepare(xadc->clk);
-
 	return 0;
 }
 
 static struct platform_driver xadc_driver = {
 	.probe = xadc_probe,
-	.remove = xadc_remove,
 	.driver = {
 		.name = "xadc",
 		.of_match_table = xadc_of_match_table,
-- 
2.29.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATH v3 3/3] iio: adc: xilinx: use more devres helpers and remove remove()
  2020-11-30 14:27 ` [PATH v3 3/3] iio: adc: xilinx: use more devres helpers and remove remove() Bartosz Golaszewski
@ 2020-11-30 14:30   ` Bartosz Golaszewski
  2020-11-30 16:16     ` Jonathan Cameron
  0 siblings, 1 reply; 11+ messages in thread
From: Bartosz Golaszewski @ 2020-11-30 14:30 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Michal Simek
  Cc: linux-iio, Linux ARM, Linux Kernel Mailing List, Bartosz Golaszewski

On Mon, Nov 30, 2020 at 3:28 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> In order to simplify resource management and error paths in probe() and
> entirely drop the remove() callback - use devres helpers wherever
> possible. Define devm actions for cancelling the delayed work and
> disabling the clock.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---

[snip]

>
>         /* Set thresholds to min/max */
>         for (i = 0; i < 16; i++) {
> @@ -1334,59 +1353,23 @@ static int xadc_probe(struct platform_device *pdev)
>                 ret = xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i),
>                         xadc->threshold[i]);
>                 if (ret)
> -                       goto err_free_irq;
> +                       return ret;
>         }
>
>         /* Go to non-buffered mode */
>         xadc_postdisable(indio_dev);
>
> -       ret = iio_device_register(indio_dev);
> +       ret = devm_iio_device_register(dev, indio_dev);
>         if (ret)
> -               goto err_free_irq;
> +               return ret;
>
>         platform_set_drvdata(pdev, indio_dev);
>

Cr*p I was supposed to drop this line...

Jonathan: can you drop it when applying?

Bartosz

[snip]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATH v3 3/3] iio: adc: xilinx: use more devres helpers and remove remove()
  2020-11-30 14:30   ` Bartosz Golaszewski
@ 2020-11-30 16:16     ` Jonathan Cameron
  0 siblings, 0 replies; 11+ messages in thread
From: Jonathan Cameron @ 2020-11-30 16:16 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Michal Simek, linux-iio, Bartosz Golaszewski,
	Linux Kernel Mailing List, Linux ARM

On Mon, 30 Nov 2020 15:30:22 +0100
Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> On Mon, Nov 30, 2020 at 3:28 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > In order to simplify resource management and error paths in probe() and
> > entirely drop the remove() callback - use devres helpers wherever
> > possible. Define devm actions for cancelling the delayed work and
> > disabling the clock.
> >
> > Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > ---  
> 
> [snip]
> 
> >
> >         /* Set thresholds to min/max */
> >         for (i = 0; i < 16; i++) {
> > @@ -1334,59 +1353,23 @@ static int xadc_probe(struct platform_device *pdev)
> >                 ret = xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i),
> >                         xadc->threshold[i]);
> >                 if (ret)
> > -                       goto err_free_irq;
> > +                       return ret;
> >         }
> >
> >         /* Go to non-buffered mode */
> >         xadc_postdisable(indio_dev);
> >
> > -       ret = iio_device_register(indio_dev);
> > +       ret = devm_iio_device_register(dev, indio_dev);
> >         if (ret)
> > -               goto err_free_irq;
> > +               return ret;
> >
> >         platform_set_drvdata(pdev, indio_dev);
> >  
> 
> Cr*p I was supposed to drop this line...
> 
> Jonathan: can you drop it when applying?
Sure. 

J

> 
> Bartosz
> 
> [snip]
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATH v3 0/3] iio: adc: xilinx: use even more devres
  2020-11-30 14:27 [PATH v3 0/3] iio: adc: xilinx: use even more devres Bartosz Golaszewski
                   ` (2 preceding siblings ...)
  2020-11-30 14:27 ` [PATH v3 3/3] iio: adc: xilinx: use more devres helpers and remove remove() Bartosz Golaszewski
@ 2020-11-30 20:21 ` Jonathan Cameron
  2020-12-11 12:15   ` Anand Ashok Dumbre
  3 siblings, 1 reply; 11+ messages in thread
From: Jonathan Cameron @ 2020-11-30 20:21 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Lars-Peter Clausen, Peter Meerwald-Stadler, Michal Simek,
	linux-iio, linux-arm-kernel, linux-kernel, Bartosz Golaszewski,
	Anand Ashok Dumbre

On Mon, 30 Nov 2020 15:27:56 +0100
Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> This is a follow-up to commit 750628c79bb1 ("iio: adc: xilinx-xadc: use
> devm_krealloc()"). I noticed we can use even more devres helpers and entirely
> drop the remove() callback.
> 
> v1 -> v2:
> - squash three patches adding more devres calls into one for easier review
> - don't insist on the 80 characters limit
> - add a new helper: devm_krealloc_array() and use it
> 
> v2 -> v3:
> - drop the devm_krealloc_array() helper
> 
> Bartosz Golaszewski (3):
>   iio: adc: xilinx: use helper variable for &pdev->dev
>   iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc()
>   iio: adc: xilinx: use more devres helpers and remove remove()
> 
>  drivers/iio/adc/xilinx-xadc-core.c | 157 ++++++++++++++---------------
>  1 file changed, 74 insertions(+), 83 deletions(-)
> 

Series looks good to me but would like to leave it a little longer to let
others take a look at it. That will probably mean it falls into next cycle
now.

+CC Anand who is looking at another series touching this driver and might
give this one a spin as well.

Thanks,

Jonathan


^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATH v3 0/3] iio: adc: xilinx: use even more devres
  2020-11-30 20:21 ` [PATH v3 0/3] iio: adc: xilinx: use even more devres Jonathan Cameron
@ 2020-12-11 12:15   ` Anand Ashok Dumbre
  2020-12-13 12:04     ` Jonathan Cameron
  0 siblings, 1 reply; 11+ messages in thread
From: Anand Ashok Dumbre @ 2020-12-11 12:15 UTC (permalink / raw)
  To: Jonathan Cameron, Bartosz Golaszewski
  Cc: Lars-Peter Clausen, Peter Meerwald-Stadler, Michal Simek,
	linux-iio, linux-arm-kernel, linux-kernel, Bartosz Golaszewski

> -----Original Message-----
> From: Jonathan Cameron <jic23@kernel.org>
> Sent: Monday 30 November 2020 8:21 PM
> To: Bartosz Golaszewski <brgl@bgdev.pl>
> Cc: Lars-Peter Clausen <lars@metafoo.de>; Peter Meerwald-Stadler
> <pmeerw@pmeerw.net>; Michal Simek <michals@xilinx.com>; linux-
> iio@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> kernel@vger.kernel.org; Bartosz Golaszewski
> <bgolaszewski@baylibre.com>; Anand Ashok Dumbre
> <ANANDASH@xilinx.com>
> Subject: Re: [PATH v3 0/3] iio: adc: xilinx: use even more devres
> 
> On Mon, 30 Nov 2020 15:27:56 +0100
> Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> 
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > This is a follow-up to commit 750628c79bb1 ("iio: adc: xilinx-xadc:
> > use devm_krealloc()"). I noticed we can use even more devres helpers
> > and entirely drop the remove() callback.
> >
> > v1 -> v2:
> > - squash three patches adding more devres calls into one for easier
> > review
> > - don't insist on the 80 characters limit
> > - add a new helper: devm_krealloc_array() and use it
> >
> > v2 -> v3:
> > - drop the devm_krealloc_array() helper
> >
> > Bartosz Golaszewski (3):
> >   iio: adc: xilinx: use helper variable for &pdev->dev
> >   iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc()
> >   iio: adc: xilinx: use more devres helpers and remove remove()
> >
> >  drivers/iio/adc/xilinx-xadc-core.c | 157
> > ++++++++++++++---------------
> >  1 file changed, 74 insertions(+), 83 deletions(-)
> >
> 
> Series looks good to me but would like to leave it a little longer to let others
> take a look at it. That will probably mean it falls into next cycle now.
> 
> +CC Anand who is looking at another series touching this driver and
> +might
> give this one a spin as well.
> 
> Thanks,
> 
> Jonathan

Hi Jonathan, Bartosz,

I have tested and reviewed the patch and everything looks good.
I have another patch series on the same files that might cause conflicts.

Reviewed-by: Anand Ashok Dumbre <anandash@xilinx.com>
Tested-by: Anand Ashok Dumbre <anandash@xilinx.com>

Thanks,
Anand

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATH v3 0/3] iio: adc: xilinx: use even more devres
  2020-12-11 12:15   ` Anand Ashok Dumbre
@ 2020-12-13 12:04     ` Jonathan Cameron
  2021-01-18  9:09       ` Bartosz Golaszewski
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Cameron @ 2020-12-13 12:04 UTC (permalink / raw)
  To: Anand Ashok Dumbre
  Cc: Bartosz Golaszewski, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Michal Simek, linux-iio, linux-arm-kernel, linux-kernel,
	Bartosz Golaszewski

On Fri, 11 Dec 2020 12:15:15 +0000
Anand Ashok Dumbre <ANANDASH@xilinx.com> wrote:

> > -----Original Message-----
> > From: Jonathan Cameron <jic23@kernel.org>
> > Sent: Monday 30 November 2020 8:21 PM
> > To: Bartosz Golaszewski <brgl@bgdev.pl>
> > Cc: Lars-Peter Clausen <lars@metafoo.de>; Peter Meerwald-Stadler
> > <pmeerw@pmeerw.net>; Michal Simek <michals@xilinx.com>; linux-
> > iio@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> > kernel@vger.kernel.org; Bartosz Golaszewski
> > <bgolaszewski@baylibre.com>; Anand Ashok Dumbre
> > <ANANDASH@xilinx.com>
> > Subject: Re: [PATH v3 0/3] iio: adc: xilinx: use even more devres
> > 
> > On Mon, 30 Nov 2020 15:27:56 +0100
> > Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >   
> > > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > >
> > > This is a follow-up to commit 750628c79bb1 ("iio: adc: xilinx-xadc:
> > > use devm_krealloc()"). I noticed we can use even more devres helpers
> > > and entirely drop the remove() callback.
> > >
> > > v1 -> v2:
> > > - squash three patches adding more devres calls into one for easier
> > > review
> > > - don't insist on the 80 characters limit
> > > - add a new helper: devm_krealloc_array() and use it
> > >
> > > v2 -> v3:
> > > - drop the devm_krealloc_array() helper
> > >
> > > Bartosz Golaszewski (3):
> > >   iio: adc: xilinx: use helper variable for &pdev->dev
> > >   iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc()
> > >   iio: adc: xilinx: use more devres helpers and remove remove()
> > >
> > >  drivers/iio/adc/xilinx-xadc-core.c | 157
> > > ++++++++++++++---------------
> > >  1 file changed, 74 insertions(+), 83 deletions(-)
> > >  
> > 
> > Series looks good to me but would like to leave it a little longer to let others
> > take a look at it. That will probably mean it falls into next cycle now.
> > 
> > +CC Anand who is looking at another series touching this driver and
> > +might
> > give this one a spin as well.
> > 
> > Thanks,
> > 
> > Jonathan  
> 
> Hi Jonathan, Bartosz,
> 
> I have tested and reviewed the patch and everything looks good.
> I have another patch series on the same files that might cause conflicts.
> 
> Reviewed-by: Anand Ashok Dumbre <anandash@xilinx.com>
> Tested-by: Anand Ashok Dumbre <anandash@xilinx.com>
Thanks,

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

There was a small amount of fuzz.

Thanks,

Jonathan

> 
> Thanks,
> Anand


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATH v3 0/3] iio: adc: xilinx: use even more devres
  2020-12-13 12:04     ` Jonathan Cameron
@ 2021-01-18  9:09       ` Bartosz Golaszewski
  2021-01-18 13:38         ` Jonathan Cameron
  0 siblings, 1 reply; 11+ messages in thread
From: Bartosz Golaszewski @ 2021-01-18  9:09 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Anand Ashok Dumbre, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Michal Simek, linux-iio, linux-arm-kernel, linux-kernel,
	Bartosz Golaszewski

On Sun, Dec 13, 2020 at 1:04 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Fri, 11 Dec 2020 12:15:15 +0000
> Anand Ashok Dumbre <ANANDASH@xilinx.com> wrote:
>
> > > -----Original Message-----
> > > From: Jonathan Cameron <jic23@kernel.org>
> > > Sent: Monday 30 November 2020 8:21 PM
> > > To: Bartosz Golaszewski <brgl@bgdev.pl>
> > > Cc: Lars-Peter Clausen <lars@metafoo.de>; Peter Meerwald-Stadler
> > > <pmeerw@pmeerw.net>; Michal Simek <michals@xilinx.com>; linux-
> > > iio@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> > > kernel@vger.kernel.org; Bartosz Golaszewski
> > > <bgolaszewski@baylibre.com>; Anand Ashok Dumbre
> > > <ANANDASH@xilinx.com>
> > > Subject: Re: [PATH v3 0/3] iio: adc: xilinx: use even more devres
> > >
> > > On Mon, 30 Nov 2020 15:27:56 +0100
> > > Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > >
> > > > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > > >
> > > > This is a follow-up to commit 750628c79bb1 ("iio: adc: xilinx-xadc:
> > > > use devm_krealloc()"). I noticed we can use even more devres helpers
> > > > and entirely drop the remove() callback.
> > > >
> > > > v1 -> v2:
> > > > - squash three patches adding more devres calls into one for easier
> > > > review
> > > > - don't insist on the 80 characters limit
> > > > - add a new helper: devm_krealloc_array() and use it
> > > >
> > > > v2 -> v3:
> > > > - drop the devm_krealloc_array() helper
> > > >
> > > > Bartosz Golaszewski (3):
> > > >   iio: adc: xilinx: use helper variable for &pdev->dev
> > > >   iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc()
> > > >   iio: adc: xilinx: use more devres helpers and remove remove()
> > > >
> > > >  drivers/iio/adc/xilinx-xadc-core.c | 157
> > > > ++++++++++++++---------------
> > > >  1 file changed, 74 insertions(+), 83 deletions(-)
> > > >
> > >
> > > Series looks good to me but would like to leave it a little longer to let others
> > > take a look at it. That will probably mean it falls into next cycle now.
> > >
> > > +CC Anand who is looking at another series touching this driver and
> > > +might
> > > give this one a spin as well.
> > >
> > > Thanks,
> > >
> > > Jonathan
> >
> > Hi Jonathan, Bartosz,
> >
> > I have tested and reviewed the patch and everything looks good.
> > I have another patch series on the same files that might cause conflicts.
> >
> > Reviewed-by: Anand Ashok Dumbre <anandash@xilinx.com>
> > Tested-by: Anand Ashok Dumbre <anandash@xilinx.com>
> Thanks,
>
> Applied to the togreg branch of iio.git and pushed out as testing for
> the autobuilders to play with it.
>
> There was a small amount of fuzz.
>
> Thanks,
>
> Jonathan
>

Hi Jonathan,

I still don't see these patches in next - is any action required of me
to get this in for the next release?

Bartosz

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATH v3 0/3] iio: adc: xilinx: use even more devres
  2021-01-18  9:09       ` Bartosz Golaszewski
@ 2021-01-18 13:38         ` Jonathan Cameron
  0 siblings, 0 replies; 11+ messages in thread
From: Jonathan Cameron @ 2021-01-18 13:38 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Jonathan Cameron, Lars-Peter Clausen, linux-iio, linux-kernel,
	Anand Ashok Dumbre, Bartosz Golaszewski, Michal Simek,
	Peter Meerwald-Stadler, linux-arm-kernel

On Mon, 18 Jan 2021 10:09:56 +0100
Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> On Sun, Dec 13, 2020 at 1:04 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > On Fri, 11 Dec 2020 12:15:15 +0000
> > Anand Ashok Dumbre <ANANDASH@xilinx.com> wrote:
> >  
> > > > -----Original Message-----
> > > > From: Jonathan Cameron <jic23@kernel.org>
> > > > Sent: Monday 30 November 2020 8:21 PM
> > > > To: Bartosz Golaszewski <brgl@bgdev.pl>
> > > > Cc: Lars-Peter Clausen <lars@metafoo.de>; Peter Meerwald-Stadler
> > > > <pmeerw@pmeerw.net>; Michal Simek <michals@xilinx.com>; linux-
> > > > iio@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> > > > kernel@vger.kernel.org; Bartosz Golaszewski
> > > > <bgolaszewski@baylibre.com>; Anand Ashok Dumbre
> > > > <ANANDASH@xilinx.com>
> > > > Subject: Re: [PATH v3 0/3] iio: adc: xilinx: use even more devres
> > > >
> > > > On Mon, 30 Nov 2020 15:27:56 +0100
> > > > Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > > >  
> > > > > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > > > >
> > > > > This is a follow-up to commit 750628c79bb1 ("iio: adc: xilinx-xadc:
> > > > > use devm_krealloc()"). I noticed we can use even more devres helpers
> > > > > and entirely drop the remove() callback.
> > > > >
> > > > > v1 -> v2:
> > > > > - squash three patches adding more devres calls into one for easier
> > > > > review
> > > > > - don't insist on the 80 characters limit
> > > > > - add a new helper: devm_krealloc_array() and use it
> > > > >
> > > > > v2 -> v3:
> > > > > - drop the devm_krealloc_array() helper
> > > > >
> > > > > Bartosz Golaszewski (3):
> > > > >   iio: adc: xilinx: use helper variable for &pdev->dev
> > > > >   iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc()
> > > > >   iio: adc: xilinx: use more devres helpers and remove remove()
> > > > >
> > > > >  drivers/iio/adc/xilinx-xadc-core.c | 157
> > > > > ++++++++++++++---------------
> > > > >  1 file changed, 74 insertions(+), 83 deletions(-)
> > > > >  
> > > >
> > > > Series looks good to me but would like to leave it a little longer to let others
> > > > take a look at it. That will probably mean it falls into next cycle now.
> > > >
> > > > +CC Anand who is looking at another series touching this driver and
> > > > +might
> > > > give this one a spin as well.
> > > >
> > > > Thanks,
> > > >
> > > > Jonathan  
> > >
> > > Hi Jonathan, Bartosz,
> > >
> > > I have tested and reviewed the patch and everything looks good.
> > > I have another patch series on the same files that might cause conflicts.
> > >
> > > Reviewed-by: Anand Ashok Dumbre <anandash@xilinx.com>
> > > Tested-by: Anand Ashok Dumbre <anandash@xilinx.com>  
> > Thanks,
> >
> > Applied to the togreg branch of iio.git and pushed out as testing for
> > the autobuilders to play with it.
> >
> > There was a small amount of fuzz.
> >
> > Thanks,
> >
> > Jonathan
> >  
> 
> Hi Jonathan,
> 
> I still don't see these patches in next - is any action required of me
> to get this in for the next release?

Nope.  I still haven't gotten round to asking for the iio tree itself
to be pulled into next, and I've been a bit busy so haven't yet sent a
pull request to Greg KH this cycle.

I'll get the second sorted, probably later this week.

J

> 
> Bartosz
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-01-18 20:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-30 14:27 [PATH v3 0/3] iio: adc: xilinx: use even more devres Bartosz Golaszewski
2020-11-30 14:27 ` [PATH v3 1/3] iio: adc: xilinx: use helper variable for &pdev->dev Bartosz Golaszewski
2020-11-30 14:27 ` [PATH v3 2/3] iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc() Bartosz Golaszewski
2020-11-30 14:27 ` [PATH v3 3/3] iio: adc: xilinx: use more devres helpers and remove remove() Bartosz Golaszewski
2020-11-30 14:30   ` Bartosz Golaszewski
2020-11-30 16:16     ` Jonathan Cameron
2020-11-30 20:21 ` [PATH v3 0/3] iio: adc: xilinx: use even more devres Jonathan Cameron
2020-12-11 12:15   ` Anand Ashok Dumbre
2020-12-13 12:04     ` Jonathan Cameron
2021-01-18  9:09       ` Bartosz Golaszewski
2021-01-18 13:38         ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).