diff mbox

[v4,07/16] i2c: demux: Use changeset helpers for clarity

Message ID 20180220231046.32638-8-laurent.pinchart+renesas@ideasonboard.com (mailing list archive)
State Not Applicable
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Laurent Pinchart Feb. 20, 2018, 11:10 p.m. UTC
From: Pantelis Antoniou <pantelis.antoniou@konsulko.com>

The changeset helpers are easier to use, use them instead of
using the static property.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
["okay" -> "ok"]
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/i2c/muxes/i2c-demux-pinctrl.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Comments

Wolfram Sang Feb. 21, 2018, 8:06 a.m. UTC | #1
On Wed, Feb 21, 2018 at 01:10:37AM +0200, Laurent Pinchart wrote:
> From: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> 
> The changeset helpers are easier to use, use them instead of
> using the static property.
> 
> Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
> Acked-by: Wolfram Sang <wsa@the-dreams.de>

My ack still holds. Good luck pushing this series!
diff mbox

Patch

diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c
index 33ce032cb701..0f0046831492 100644
--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c
+++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c
@@ -220,10 +220,7 @@  static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv)
 			   + num_chan * sizeof(struct i2c_demux_pinctrl_chan), GFP_KERNEL);
-
-	props = devm_kcalloc(&pdev->dev, num_chan, sizeof(*props), GFP_KERNEL);
-
-	if (!priv || !props)
+	if (!priv)
 		return -ENOMEM;
 
 	err = of_property_read_string(np, "i2c-bus-name", &priv->bus_name);
@@ -241,12 +238,9 @@  static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
 		}
 		priv->chan[i].parent_np = adap_np;
 
-		props[i].name = devm_kstrdup(&pdev->dev, "status", GFP_KERNEL);
-		props[i].value = devm_kstrdup(&pdev->dev, "ok", GFP_KERNEL);
-		props[i].length = 3;
-
 		of_changeset_init(&priv->chan[i].chgset);
-		of_changeset_update_property(&priv->chan[i].chgset, adap_np, &props[i]);
+		of_changeset_update_property_string(&priv->chan[i].chgset,
+						    adap_np, "status", "ok");
 	}
 
 	priv->num_chan = num_chan;