* [PATCH] i2c: Convert to using %pOFn instead of device_node.name [not found] <20180828015252.28511-1-robh@kernel.org> @ 2018-08-28 1:52 ` Rob Herring 2018-08-28 6:33 ` Peter Rosin 0 siblings, 1 reply; 5+ messages in thread From: Rob Herring @ 2018-08-28 1:52 UTC (permalink / raw) To: linux-kernel Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, Peter Rosin, linux-i2c, linuxppc-dev In preparation to remove the node name pointer from struct device_node, convert printf users to use the %pOFn format specifier. Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Peter Rosin <peda@axentia.se> Cc: linux-i2c@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Rob Herring <robh@kernel.org> --- drivers/i2c/busses/i2c-powermac.c | 15 ++++++++------- drivers/i2c/muxes/i2c-mux-gpmux.c | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index f2a2067525ef..b706fd136ca5 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c @@ -390,7 +390,6 @@ static int i2c_powermac_probe(struct platform_device *dev) struct pmac_i2c_bus *bus = dev_get_platdata(&dev->dev); struct device_node *parent = NULL; struct i2c_adapter *adapter; - const char *basename; int rc; if (bus == NULL) @@ -407,23 +406,25 @@ static int i2c_powermac_probe(struct platform_device *dev) parent = of_get_parent(pmac_i2c_get_controller(bus)); if (parent == NULL) return -EINVAL; - basename = parent->name; + snprintf(adapter->name, sizeof(adapter->name), "%pOFn %d", + parent, + pmac_i2c_get_channel(bus)); + of_node_put(parent); break; case pmac_i2c_bus_pmu: - basename = "pmu"; + snprintf(adapter->name, sizeof(adapter->name), "pmu %d", + pmac_i2c_get_channel(bus)); break; case pmac_i2c_bus_smu: /* This is not what we used to do but I'm fixing drivers at * the same time as this change */ - basename = "smu"; + snprintf(adapter->name, sizeof(adapter->name), "smu %d", + pmac_i2c_get_channel(bus)); break; default: return -EINVAL; } - snprintf(adapter->name, sizeof(adapter->name), "%s %d", basename, - pmac_i2c_get_channel(bus)); - of_node_put(parent); platform_set_drvdata(dev, adapter); adapter->algo = &i2c_powermac_algorithm; diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-gpmux.c index 92cf5f48afe6..f60b670deff7 100644 --- a/drivers/i2c/muxes/i2c-mux-gpmux.c +++ b/drivers/i2c/muxes/i2c-mux-gpmux.c @@ -120,8 +120,8 @@ static int i2c_mux_probe(struct platform_device *pdev) ret = of_property_read_u32(child, "reg", &chan); if (ret < 0) { - dev_err(dev, "no reg property for node '%s'\n", - child->name); + dev_err(dev, "no reg property for node '%pOFn'\n", + child); goto err_children; } -- 2.17.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: Convert to using %pOFn instead of device_node.name 2018-08-28 1:52 ` [PATCH] i2c: Convert to using %pOFn instead of device_node.name Rob Herring @ 2018-08-28 6:33 ` Peter Rosin 2018-08-29 18:42 ` Rob Herring 0 siblings, 1 reply; 5+ messages in thread From: Peter Rosin @ 2018-08-28 6:33 UTC (permalink / raw) To: Rob Herring, linux-kernel Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, linux-i2c, linuxppc-dev On 2018-08-28 03:52, Rob Herring wrote: > In preparation to remove the node name pointer from struct device_node, > convert printf users to use the %pOFn format specifier. > > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> > Cc: Paul Mackerras <paulus@samba.org> > Cc: Michael Ellerman <mpe@ellerman.id.au> > Cc: Peter Rosin <peda@axentia.se> > Cc: linux-i2c@vger.kernel.org > Cc: linuxppc-dev@lists.ozlabs.org > Signed-off-by: Rob Herring <robh@kernel.org> > --- > drivers/i2c/busses/i2c-powermac.c | 15 ++++++++------- > drivers/i2c/muxes/i2c-mux-gpmux.c | 4 ++-- > 2 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c > index f2a2067525ef..b706fd136ca5 100644 > --- a/drivers/i2c/busses/i2c-powermac.c > +++ b/drivers/i2c/busses/i2c-powermac.c > @@ -390,7 +390,6 @@ static int i2c_powermac_probe(struct platform_device *dev) > struct pmac_i2c_bus *bus = dev_get_platdata(&dev->dev); > struct device_node *parent = NULL; Lose the initializer... > struct i2c_adapter *adapter; > - const char *basename; > int rc; > > if (bus == NULL) > @@ -407,23 +406,25 @@ static int i2c_powermac_probe(struct platform_device *dev) > parent = of_get_parent(pmac_i2c_get_controller(bus)); > if (parent == NULL) > return -EINVAL; > - basename = parent->name; > + snprintf(adapter->name, sizeof(adapter->name), "%pOFn %d", > + parent, > + pmac_i2c_get_channel(bus)); ...and I would have written "parent, pmac_i2c_get_channel(bus));" on one line, but maybe that's just me. Anyway, with the initializer fix, Reviewed-by: Peter Rosin <peda@axentia.se> (Wolfram, no need to split this, just take it in full.) Cheers, Peter > + of_node_put(parent); > break; > case pmac_i2c_bus_pmu: > - basename = "pmu"; > + snprintf(adapter->name, sizeof(adapter->name), "pmu %d", > + pmac_i2c_get_channel(bus)); > break; > case pmac_i2c_bus_smu: > /* This is not what we used to do but I'm fixing drivers at > * the same time as this change > */ > - basename = "smu"; > + snprintf(adapter->name, sizeof(adapter->name), "smu %d", > + pmac_i2c_get_channel(bus)); > break; > default: > return -EINVAL; > } > - snprintf(adapter->name, sizeof(adapter->name), "%s %d", basename, > - pmac_i2c_get_channel(bus)); > - of_node_put(parent); > > platform_set_drvdata(dev, adapter); > adapter->algo = &i2c_powermac_algorithm; > diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-gpmux.c > index 92cf5f48afe6..f60b670deff7 100644 > --- a/drivers/i2c/muxes/i2c-mux-gpmux.c > +++ b/drivers/i2c/muxes/i2c-mux-gpmux.c > @@ -120,8 +120,8 @@ static int i2c_mux_probe(struct platform_device *pdev) > > ret = of_property_read_u32(child, "reg", &chan); > if (ret < 0) { > - dev_err(dev, "no reg property for node '%s'\n", > - child->name); > + dev_err(dev, "no reg property for node '%pOFn'\n", > + child); > goto err_children; > } > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: Convert to using %pOFn instead of device_node.name 2018-08-28 6:33 ` Peter Rosin @ 2018-08-29 18:42 ` Rob Herring 2018-08-29 19:52 ` Peter Rosin 0 siblings, 1 reply; 5+ messages in thread From: Rob Herring @ 2018-08-29 18:42 UTC (permalink / raw) To: Peter Rosin Cc: linux-kernel@vger.kernel.org, Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, Linux I2C, linuxppc-dev On Wed, Aug 29, 2018 at 1:03 PM Peter Rosin <peda@axentia.se> wrote: > > On 2018-08-28 03:52, Rob Herring wrote: > > In preparation to remove the node name pointer from struct device_node, > > convert printf users to use the %pOFn format specifier. > > > > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> > > Cc: Paul Mackerras <paulus@samba.org> > > Cc: Michael Ellerman <mpe@ellerman.id.au> > > Cc: Peter Rosin <peda@axentia.se> > > Cc: linux-i2c@vger.kernel.org > > Cc: linuxppc-dev@lists.ozlabs.org > > Signed-off-by: Rob Herring <robh@kernel.org> > > --- > > drivers/i2c/busses/i2c-powermac.c | 15 ++++++++------- > > drivers/i2c/muxes/i2c-mux-gpmux.c | 4 ++-- > > 2 files changed, 10 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c > > index f2a2067525ef..b706fd136ca5 100644 > > --- a/drivers/i2c/busses/i2c-powermac.c > > +++ b/drivers/i2c/busses/i2c-powermac.c > > @@ -390,7 +390,6 @@ static int i2c_powermac_probe(struct platform_device *dev) > > struct pmac_i2c_bus *bus = dev_get_platdata(&dev->dev); > > struct device_node *parent = NULL; > > Lose the initializer... That's pretty much unrelated though. I'd have to write "Also, remove the unnecessary parent pointer init" in the commit message and we all know "Also" is a clue for belongs in a separate patch. Rob ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: Convert to using %pOFn instead of device_node.name 2018-08-29 18:42 ` Rob Herring @ 2018-08-29 19:52 ` Peter Rosin 2018-08-30 0:49 ` Rob Herring 0 siblings, 1 reply; 5+ messages in thread From: Peter Rosin @ 2018-08-29 19:52 UTC (permalink / raw) To: Rob Herring Cc: linux-kernel@vger.kernel.org, Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, Linux I2C, linuxppc-dev On 2018-08-29 20:42, Rob Herring wrote: > On Wed, Aug 29, 2018 at 1:03 PM Peter Rosin <peda@axentia.se> wrote: >> >> On 2018-08-28 03:52, Rob Herring wrote: >>> In preparation to remove the node name pointer from struct device_node, >>> convert printf users to use the %pOFn format specifier. >>> >>> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> >>> Cc: Paul Mackerras <paulus@samba.org> >>> Cc: Michael Ellerman <mpe@ellerman.id.au> >>> Cc: Peter Rosin <peda@axentia.se> >>> Cc: linux-i2c@vger.kernel.org >>> Cc: linuxppc-dev@lists.ozlabs.org >>> Signed-off-by: Rob Herring <robh@kernel.org> >>> --- >>> drivers/i2c/busses/i2c-powermac.c | 15 ++++++++------- >>> drivers/i2c/muxes/i2c-mux-gpmux.c | 4 ++-- >>> 2 files changed, 10 insertions(+), 9 deletions(-) >>> >>> diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c >>> index f2a2067525ef..b706fd136ca5 100644 >>> --- a/drivers/i2c/busses/i2c-powermac.c >>> +++ b/drivers/i2c/busses/i2c-powermac.c >>> @@ -390,7 +390,6 @@ static int i2c_powermac_probe(struct platform_device *dev) >>> struct pmac_i2c_bus *bus = dev_get_platdata(&dev->dev); >>> struct device_node *parent = NULL; >> >> Lose the initializer... > > That's pretty much unrelated though. I disagree. If you remove the need for the initializer, it's very much related to also remove the initializer. > I'd have to write "Also, remove > the unnecessary parent pointer init" in the commit message and we all > know "Also" is a clue for belongs in a separate patch. How about: "This makes the parent pointer initializer redundant, lose it." See, no "Also" in there, and no separate patch needed. Or don't mention it at all. Cheers, Peter ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] i2c: Convert to using %pOFn instead of device_node.name 2018-08-29 19:52 ` Peter Rosin @ 2018-08-30 0:49 ` Rob Herring 0 siblings, 0 replies; 5+ messages in thread From: Rob Herring @ 2018-08-30 0:49 UTC (permalink / raw) To: Peter Rosin Cc: linux-kernel@vger.kernel.org, Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, Linux I2C, linuxppc-dev On Wed, Aug 29, 2018 at 7:25 PM Peter Rosin <peda@axentia.se> wrote: > > On 2018-08-29 20:42, Rob Herring wrote: > > On Wed, Aug 29, 2018 at 1:03 PM Peter Rosin <peda@axentia.se> wrote: > >> > >> On 2018-08-28 03:52, Rob Herring wrote: > >>> In preparation to remove the node name pointer from struct device_node, > >>> convert printf users to use the %pOFn format specifier. > >>> > >>> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> > >>> Cc: Paul Mackerras <paulus@samba.org> > >>> Cc: Michael Ellerman <mpe@ellerman.id.au> > >>> Cc: Peter Rosin <peda@axentia.se> > >>> Cc: linux-i2c@vger.kernel.org > >>> Cc: linuxppc-dev@lists.ozlabs.org > >>> Signed-off-by: Rob Herring <robh@kernel.org> > >>> --- > >>> drivers/i2c/busses/i2c-powermac.c | 15 ++++++++------- > >>> drivers/i2c/muxes/i2c-mux-gpmux.c | 4 ++-- > >>> 2 files changed, 10 insertions(+), 9 deletions(-) > >>> > >>> diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c > >>> index f2a2067525ef..b706fd136ca5 100644 > >>> --- a/drivers/i2c/busses/i2c-powermac.c > >>> +++ b/drivers/i2c/busses/i2c-powermac.c > >>> @@ -390,7 +390,6 @@ static int i2c_powermac_probe(struct platform_device *dev) > >>> struct pmac_i2c_bus *bus = dev_get_platdata(&dev->dev); > >>> struct device_node *parent = NULL; > >> > >> Lose the initializer... > > > > That's pretty much unrelated though. > > I disagree. If you remove the need for the initializer, it's very much > related to also remove the initializer. You're right. I'd stared at it a bit and missed that in fact parent is only accessed within the case statement. Rob ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-08-30 0:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20180828015252.28511-1-robh@kernel.org>
2018-08-28 1:52 ` [PATCH] i2c: Convert to using %pOFn instead of device_node.name Rob Herring
2018-08-28 6:33 ` Peter Rosin
2018-08-29 18:42 ` Rob Herring
2018-08-29 19:52 ` Peter Rosin
2018-08-30 0:49 ` Rob Herring
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox