Commit 0c2c7e13 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski

gpio: exar: use a helper variable for &pdev->dev

It's more elegant to use a helper local variable to store the address
of the underlying struct device than to dereference pdev everywhere. It
also has the benefit of avoiding unnecessary line breaks.
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 8e27c2ae
...@@ -120,7 +120,8 @@ static int exar_direction_input(struct gpio_chip *chip, unsigned int offset) ...@@ -120,7 +120,8 @@ static int exar_direction_input(struct gpio_chip *chip, unsigned int offset)
static int gpio_exar_probe(struct platform_device *pdev) static int gpio_exar_probe(struct platform_device *pdev)
{ {
struct pci_dev *pcidev = to_pci_dev(pdev->dev.parent); struct device *dev = &pdev->dev;
struct pci_dev *pcidev = to_pci_dev(dev->parent);
struct exar_gpio_chip *exar_gpio; struct exar_gpio_chip *exar_gpio;
u32 first_pin, ngpios; u32 first_pin, ngpios;
void __iomem *p; void __iomem *p;
...@@ -134,16 +135,15 @@ static int gpio_exar_probe(struct platform_device *pdev) ...@@ -134,16 +135,15 @@ static int gpio_exar_probe(struct platform_device *pdev)
if (!p) if (!p)
return -ENOMEM; return -ENOMEM;
ret = device_property_read_u32(&pdev->dev, "exar,first-pin", ret = device_property_read_u32(dev, "exar,first-pin", &first_pin);
&first_pin);
if (ret) if (ret)
return ret; return ret;
ret = device_property_read_u32(&pdev->dev, "ngpios", &ngpios); ret = device_property_read_u32(dev, "ngpios", &ngpios);
if (ret) if (ret)
return ret; return ret;
exar_gpio = devm_kzalloc(&pdev->dev, sizeof(*exar_gpio), GFP_KERNEL); exar_gpio = devm_kzalloc(dev, sizeof(*exar_gpio), GFP_KERNEL);
if (!exar_gpio) if (!exar_gpio)
return -ENOMEM; return -ENOMEM;
...@@ -157,7 +157,7 @@ static int gpio_exar_probe(struct platform_device *pdev) ...@@ -157,7 +157,7 @@ static int gpio_exar_probe(struct platform_device *pdev)
sprintf(exar_gpio->name, "exar_gpio%d", index); sprintf(exar_gpio->name, "exar_gpio%d", index);
exar_gpio->gpio_chip.label = exar_gpio->name; exar_gpio->gpio_chip.label = exar_gpio->name;
exar_gpio->gpio_chip.parent = &pdev->dev; exar_gpio->gpio_chip.parent = dev;
exar_gpio->gpio_chip.direction_output = exar_direction_output; exar_gpio->gpio_chip.direction_output = exar_direction_output;
exar_gpio->gpio_chip.direction_input = exar_direction_input; exar_gpio->gpio_chip.direction_input = exar_direction_input;
exar_gpio->gpio_chip.get_direction = exar_get_direction; exar_gpio->gpio_chip.get_direction = exar_get_direction;
...@@ -169,8 +169,7 @@ static int gpio_exar_probe(struct platform_device *pdev) ...@@ -169,8 +169,7 @@ static int gpio_exar_probe(struct platform_device *pdev)
exar_gpio->index = index; exar_gpio->index = index;
exar_gpio->first_pin = first_pin; exar_gpio->first_pin = first_pin;
ret = devm_gpiochip_add_data(&pdev->dev, ret = devm_gpiochip_add_data(dev, &exar_gpio->gpio_chip, exar_gpio);
&exar_gpio->gpio_chip, exar_gpio);
if (ret) if (ret)
goto err_destroy; goto err_destroy;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment