summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-bd71828.c
diff options
context:
space:
mode:
authorBartosz Golaszewski <bgolaszewski@baylibre.com>2021-01-06 11:11:33 +0100
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2021-02-15 11:43:27 +0100
commitcb38cd70354f6c6d94c072c65e2dfd19c8724c04 (patch)
treeab7eb519b22ab3b95afc50a2d572dcecbb5d4941 /drivers/gpio/gpio-bd71828.c
parent66fecef5bde07857d6306f569d71af5bd092c00b (diff)
downloadlinux-stable-cb38cd70354f6c6d94c072c65e2dfd19c8724c04.tar.gz
linux-stable-cb38cd70354f6c6d94c072c65e2dfd19c8724c04.tar.bz2
linux-stable-cb38cd70354f6c6d94c072c65e2dfd19c8724c04.zip
gpio: bd7xxxx: use helper variable for pdev->dev
Using a helper local variable to store the address of &pdev->dev adds to readability and allows us to avoid unnecessary line breaks. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Diffstat (limited to 'drivers/gpio/gpio-bd71828.c')
-rw-r--r--drivers/gpio/gpio-bd71828.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/gpio/gpio-bd71828.c b/drivers/gpio/gpio-bd71828.c
index fcdcbb57c76d..c8e382b53f2f 100644
--- a/drivers/gpio/gpio-bd71828.c
+++ b/drivers/gpio/gpio-bd71828.c
@@ -97,15 +97,15 @@ static int bd71828_get_direction(struct gpio_chip *chip, unsigned int offset)
static int bd71828_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
struct bd71828_gpio *bdgpio;
- bdgpio = devm_kzalloc(&pdev->dev, sizeof(*bdgpio),
- GFP_KERNEL);
+ bdgpio = devm_kzalloc(dev, sizeof(*bdgpio), GFP_KERNEL);
if (!bdgpio)
return -ENOMEM;
- bdgpio->dev = &pdev->dev;
- bdgpio->gpio.parent = pdev->dev.parent;
+ bdgpio->dev = dev;
+ bdgpio->gpio.parent = dev->parent;
bdgpio->gpio.label = "bd71828-gpio";
bdgpio->gpio.owner = THIS_MODULE;
bdgpio->gpio.get_direction = bd71828_get_direction;
@@ -121,13 +121,12 @@ static int bd71828_probe(struct platform_device *pdev)
* "gpio-reserved-ranges" and exclude them from control
*/
bdgpio->gpio.ngpio = 4;
- bdgpio->gpio.of_node = pdev->dev.parent->of_node;
- bdgpio->regmap = dev_get_regmap(pdev->dev.parent, NULL);
+ bdgpio->gpio.of_node = dev->parent->of_node;
+ bdgpio->regmap = dev_get_regmap(dev->parent, NULL);
if (!bdgpio->regmap)
return -ENODEV;
- return devm_gpiochip_add_data(&pdev->dev, &bdgpio->gpio,
- bdgpio);
+ return devm_gpiochip_add_data(dev, &bdgpio->gpio, bdgpio);
}
static struct platform_driver bd71828_gpio = {