From 58383c78425e4ee1c077253cf297b641c861c02e Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Wed, 4 Nov 2015 09:56:26 +0100 Subject: gpio: change member .dev to .parent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Cc: Rafał Miłecki Cc: Richard Purdie Cc: Mauro Carvalho Chehab Cc: Alek Du Cc: Jaroslav Kysela Cc: Takashi Iwai Acked-by: Dmitry Torokhov Acked-by: Greg Kroah-Hartman Acked-by: Lee Jones Acked-by: Jiri Kosina Acked-by: Hans-Christian Egtvedt Acked-by: Jacek Anaszewski Signed-off-by: Linus Walleij --- drivers/gpio/gpio-viperboard.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/gpio/gpio-viperboard.c') 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; } -- cgit v1.2.3