diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-11-04 09:56:26 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-11-19 09:24:35 +0100 |
commit | 58383c78425e4ee1c077253cf297b641c861c02e (patch) | |
tree | 606949d2c6db8176c0659eaa935d022bf6d19974 /drivers/gpio/gpio-viperboard.c | |
parent | 8005c49d9aea74d382f474ce11afbbc7d7130bec (diff) | |
download | linux-58383c78425e4ee1c077253cf297b641c861c02e.tar.bz2 |
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/gpio/gpio-viperboard.c')
-rw-r--r-- | drivers/gpio/gpio-viperboard.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/gpio/gpio-viperboard.c b/drivers/gpio/gpio-viperboard.c index e2a11f27807f..26e7edb74f42 100644 --- a/drivers/gpio/gpio-viperboard.c +++ b/drivers/gpio/gpio-viperboard.c @@ -173,7 +173,7 @@ static void vprbrd_gpioa_set(struct gpio_chip *chip, mutex_unlock(&vb->lock); if (ret != sizeof(struct vprbrd_gpioa_msg)) - dev_err(chip->dev, "usb error setting pin value\n"); + dev_err(chip->parent, "usb error setting pin value\n"); } } @@ -345,7 +345,7 @@ static void vprbrd_gpiob_set(struct gpio_chip *chip, mutex_unlock(&vb->lock); if (ret != sizeof(struct vprbrd_gpiob_msg)) - dev_err(chip->dev, "usb error setting pin value\n"); + dev_err(chip->parent, "usb error setting pin value\n"); } } @@ -366,7 +366,7 @@ static int vprbrd_gpiob_direction_input(struct gpio_chip *chip, mutex_unlock(&vb->lock); if (ret) - dev_err(chip->dev, "usb error setting pin to input\n"); + dev_err(chip->parent, "usb error setting pin to input\n"); return ret; } @@ -385,7 +385,7 @@ static int vprbrd_gpiob_direction_output(struct gpio_chip *chip, ret = vprbrd_gpiob_setdir(vb, offset, 1); if (ret) - dev_err(chip->dev, "usb error setting pin to output\n"); + dev_err(chip->parent, "usb error setting pin to output\n"); mutex_unlock(&vb->lock); @@ -409,7 +409,7 @@ static int vprbrd_gpio_probe(struct platform_device *pdev) vb_gpio->vb = vb; /* registering gpio a */ vb_gpio->gpioa.label = "viperboard gpio a"; - vb_gpio->gpioa.dev = &pdev->dev; + vb_gpio->gpioa.parent = &pdev->dev; vb_gpio->gpioa.owner = THIS_MODULE; vb_gpio->gpioa.base = -1; vb_gpio->gpioa.ngpio = 16; @@ -420,13 +420,13 @@ static int vprbrd_gpio_probe(struct platform_device *pdev) vb_gpio->gpioa.direction_output = vprbrd_gpioa_direction_output; ret = gpiochip_add(&vb_gpio->gpioa); if (ret < 0) { - dev_err(vb_gpio->gpioa.dev, "could not add gpio a"); + dev_err(vb_gpio->gpioa.parent, "could not add gpio a"); goto err_gpioa; } /* registering gpio b */ vb_gpio->gpiob.label = "viperboard gpio b"; - vb_gpio->gpiob.dev = &pdev->dev; + vb_gpio->gpiob.parent = &pdev->dev; vb_gpio->gpiob.owner = THIS_MODULE; vb_gpio->gpiob.base = -1; vb_gpio->gpiob.ngpio = 16; @@ -437,7 +437,7 @@ static int vprbrd_gpio_probe(struct platform_device *pdev) vb_gpio->gpiob.direction_output = vprbrd_gpiob_direction_output; ret = gpiochip_add(&vb_gpio->gpiob); if (ret < 0) { - dev_err(vb_gpio->gpiob.dev, "could not add gpio b"); + dev_err(vb_gpio->gpiob.parent, "could not add gpio b"); goto err_gpiob; } |