Thread (21 messages) 21 messages, 6 authors, 2017-10-11
STALE3166d
Revisions (4)
  1. v1 [diff vs current]
  2. v1 [diff vs current]
  3. v1 current
  4. v3 [diff vs current]

[PATCH 5/7] i2c: gpio: Local vars in probe

From: geert@linux-m68k.org (Geert Uytterhoeven)
Date: 2017-09-18 09:11:31
Also in: linux-i2c, linux-mips

Hi Linus,

On Sun, Sep 17, 2017 at 11:39 AM, Linus Walleij
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
By creating local variables for *dev and *np, the code become
much easier to read, in my opinion.

Signed-off-by: Linus Walleij <redacted>
---
I put this at the end of the series because compared to the
rest of the patches it is completely unimportant.
---
 drivers/i2c/busses/i2c-gpio.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index 97b9c29e9429..beb5ce523684 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
quoted hunk ↗ jump to hunk
@@ -99,15 +101,15 @@ static int i2c_gpio_probe(struct platform_device *pdev)
        bit_data = &priv->bit_data;
        pdata = &priv->pdata;

-       if (pdev->dev.of_node) {
-               of_i2c_gpio_get_props(pdev->dev.of_node, pdata);
+       if (np) {
+               of_i2c_gpio_get_props(np, pdata);
        } else {
                /*
                 * If all platform data settings are zero it is OK
                 * to not provide any platform data from the board.
                 */
-               if (dev_get_platdata(&pdev->dev))
-                       memcpy(pdata, dev_get_platdata(&pdev->dev),
+               if (dev_get_platdata(dev))
+                       memcpy(pdata, dev_get_platdata(dev),
                               sizeof(*pdata));
This fits on one line again (you have to do something to offset the LoC
increase 14 insertions(+), 12 deletions(-) ;-)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help