summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-lpc18xx.c
diff options
context:
space:
mode:
authorVladimir Zapolskiy <vz@mleia.com>2018-11-29 00:28:47 +0200
committerLinus Walleij <linus.walleij@linaro.org>2018-12-07 10:49:18 +0100
commit9dd1a30cb4881328ae568f6c060446b52539a2dd (patch)
treefd1bb7e7704dff155c46d8d7eacb30adfff3ffa9 /drivers/gpio/gpio-lpc18xx.c
parent9b34d05aa9c8cdd516762f2b06c22fcd05a14072 (diff)
gpio: lpc18xx: add struct device local variable
This is a non-functional change, it simplifies multiple access to 'struct device' pointer derived from a platform device pointer, the new local variable will also be used in the following changes. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-lpc18xx.c')
-rw-r--r--drivers/gpio/gpio-lpc18xx.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-lpc18xx.c b/drivers/gpio/gpio-lpc18xx.c
index 59e6c0ba6b13..52246221328b 100644
--- a/drivers/gpio/gpio-lpc18xx.c
+++ b/drivers/gpio/gpio-lpc18xx.c
@@ -89,11 +89,12 @@ static const struct gpio_chip lpc18xx_chip = {
static int lpc18xx_gpio_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
struct lpc18xx_gpio_chip *gc;
struct resource *res;
int ret;
- gc = devm_kzalloc(&pdev->dev, sizeof(*gc), GFP_KERNEL);
+ gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL);
if (!gc)
return -ENOMEM;
@@ -101,29 +102,29 @@ static int lpc18xx_gpio_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, gc);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- gc->base = devm_ioremap_resource(&pdev->dev, res);
+ gc->base = devm_ioremap_resource(dev, res);
if (IS_ERR(gc->base))
return PTR_ERR(gc->base);
- gc->clk = devm_clk_get(&pdev->dev, NULL);
+ gc->clk = devm_clk_get(dev, NULL);
if (IS_ERR(gc->clk)) {
- dev_err(&pdev->dev, "input clock not found\n");
+ dev_err(dev, "input clock not found\n");
return PTR_ERR(gc->clk);
}
ret = clk_prepare_enable(gc->clk);
if (ret) {
- dev_err(&pdev->dev, "unable to enable clock\n");
+ dev_err(dev, "unable to enable clock\n");
return ret;
}
spin_lock_init(&gc->lock);
- gc->gpio.parent = &pdev->dev;
+ gc->gpio.parent = dev;
ret = gpiochip_add_data(&gc->gpio, gc);
if (ret) {
- dev_err(&pdev->dev, "failed to add gpio chip\n");
+ dev_err(dev, "failed to add gpio chip\n");
clk_disable_unprepare(gc->clk);
return ret;
}