[PATCH v5 6/8] i2c: demux: Use changeset helpers for clarity

From: Laurent Pinchart
Date: Wed Feb 21 2018 - 19:05:40 EST


From: Pantelis Antoniou <pantelis.antoniou@xxxxxxxxxxxx>

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

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

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;
--
Regards,

Laurent Pinchart