diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-11-04 11:56:26 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-11-19 11:24:35 +0300 |
commit | 58383c78425e4ee1c077253cf297b641c861c02e (patch) | |
tree | 606949d2c6db8176c0659eaa935d022bf6d19974 /drivers/pinctrl/nomadik | |
parent | 8005c49d9aea74d382f474ce11afbbc7d7130bec (diff) | |
download | linux-58383c78425e4ee1c077253cf297b641c861c02e.tar.xz |
gpio: change member .dev to .parent
The name .dev in a struct is normally reserved for a struct device
that is let us say a superclass to the thing described by the struct.
struct gpio_chip stands out by confusingly using a struct device *dev
to point to the parent device (such as a platform_device) that
represents the hardware. As we want to give gpio_chip:s real devices,
this is not working. We need to rename this member to parent.
This was done by two coccinelle scripts, I guess it is possible to
combine them into one, but I don't know such stuff. They look like
this:
@@
struct gpio_chip *var;
@@
-var->dev
+var->parent
and:
@@
struct gpio_chip var;
@@
-var.dev
+var.parent
and:
@@
struct bgpio_chip *var;
@@
-var->gc.dev
+var->gc.parent
Plus a few instances of bgpio that I couldn't figure out how
to teach Coccinelle to rewrite.
This patch hits all over the place, but I *strongly* prefer this
solution to any piecemal approaches that just exercise patch
mechanics all over the place. It mainly hits drivers/gpio and
drivers/pinctrl which is my own backyard anyway.
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Rafał Miłecki <zajec5@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Alek Du <alek.du@intel.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/nomadik')
-rw-r--r-- | drivers/pinctrl/nomadik/pinctrl-abx500.c | 7 | ||||
-rw-r--r-- | drivers/pinctrl/nomadik/pinctrl-nomadik.c | 8 |
2 files changed, 8 insertions, 7 deletions
diff --git a/drivers/pinctrl/nomadik/pinctrl-abx500.c b/drivers/pinctrl/nomadik/pinctrl-abx500.c index b59fbb4b1fb1..434d5de0177b 100644 --- a/drivers/pinctrl/nomadik/pinctrl-abx500.c +++ b/drivers/pinctrl/nomadik/pinctrl-abx500.c @@ -986,7 +986,7 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev, param = pinconf_to_config_param(configs[i]); argument = pinconf_to_config_argument(configs[i]); - dev_dbg(chip->dev, "pin %d [%#lx]: %s %s\n", + dev_dbg(chip->parent, "pin %d [%#lx]: %s %s\n", pin, configs[i], (param == PIN_CONFIG_OUTPUT) ? "output " : "input", (param == PIN_CONFIG_OUTPUT) ? @@ -1077,7 +1077,8 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev, break; default: - dev_err(chip->dev, "illegal configuration requested\n"); + dev_err(chip->parent, + "illegal configuration requested\n"); } } /* for each config */ out: @@ -1172,7 +1173,7 @@ static int abx500_gpio_probe(struct platform_device *pdev) pct->dev = &pdev->dev; pct->parent = dev_get_drvdata(pdev->dev.parent); pct->chip = abx500gpio_chip; - pct->chip.dev = &pdev->dev; + pct->chip.parent = &pdev->dev; pct->chip.base = -1; /* Dynamic allocation */ match = of_match_device(abx500_gpio_match, &pdev->dev); diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c index eebfae0c9b7c..cb4a327425a0 100644 --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c @@ -438,7 +438,7 @@ nmk_gpio_disable_lazy_irq(struct nmk_gpio_chip *nmk_chip, unsigned offset) nmk_chip->addr + NMK_GPIO_FIMSC); } - dev_dbg(nmk_chip->chip.dev, "%d: clearing interrupt mask\n", gpio); + dev_dbg(nmk_chip->chip.parent, "%d: clearing interrupt mask\n", gpio); } static void nmk_write_masked(void __iomem *reg, u32 mask, u32 value) @@ -1188,7 +1188,7 @@ static struct nmk_gpio_chip *nmk_gpio_populate_chip(struct device_node *np, chip->base = id * NMK_GPIO_PER_CHIP; chip->ngpio = NMK_GPIO_PER_CHIP; chip->label = dev_name(&gpio_pdev->dev); - chip->dev = &gpio_pdev->dev; + chip->parent = &gpio_pdev->dev; res = platform_get_resource(gpio_pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(&pdev->dev, res); @@ -1890,7 +1890,7 @@ static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin, if (slpm_val) val = slpm_val - 1; - dev_dbg(nmk_chip->chip.dev, + dev_dbg(nmk_chip->chip.parent, "pin %d: sleep pull %s, dir %s, val %s\n", pin, slpm_pull ? pullnames[pull] : "same", @@ -1899,7 +1899,7 @@ static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin, slpm_val ? (val ? "high" : "low") : "same"); } - dev_dbg(nmk_chip->chip.dev, + dev_dbg(nmk_chip->chip.parent, "pin %d [%#lx]: pull %s, slpm %s (%s%s), lowemi %s\n", pin, cfg, pullnames[pull], slpmnames[slpm], output ? "output " : "input", |