From: Alexander Aring Date: Thu, 24 Apr 2014 17:09:09 +0000 (+0200) Subject: at86rf230: use devm_gpio_request_one X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0679e29b0c06979f4c2d4561eee0361548d4c80b;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git at86rf230: use devm_gpio_request_one This patch replace the gpio_request functions with devm_gpio_request_one functions. Then we don't need to take care about freeing gpios. Signed-off-by: Alexander Aring Signed-off-by: David S. Miller --- diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 5856488ebd61..d52700f7e74d 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c @@ -1074,27 +1074,17 @@ static int at86rf230_probe(struct spi_device *spi) } if (gpio_is_valid(pdata->rstn)) { - rc = gpio_request(pdata->rstn, "rstn"); + rc = devm_gpio_request_one(&spi->dev, pdata->rstn, + GPIOF_OUT_INIT_HIGH, "rstn"); if (rc) return rc; } if (gpio_is_valid(pdata->slp_tr)) { - rc = gpio_request(pdata->slp_tr, "slp_tr"); + rc = devm_gpio_request_one(&spi->dev, pdata->slp_tr, + GPIOF_OUT_INIT_LOW, "slp_tr"); if (rc) - goto err_slp_tr; - } - - if (gpio_is_valid(pdata->rstn)) { - rc = gpio_direction_output(pdata->rstn, 1); - if (rc) - goto err_gpio_dir; - } - - if (gpio_is_valid(pdata->slp_tr)) { - rc = gpio_direction_output(pdata->slp_tr, 0); - if (rc) - goto err_gpio_dir; + return rc; } /* Reset */ @@ -1108,13 +1098,12 @@ static int at86rf230_probe(struct spi_device *spi) rc = __at86rf230_detect_device(spi, &man_id, &part, &version); if (rc < 0) - goto err_gpio_dir; + return rc; if (man_id != 0x001f) { dev_err(&spi->dev, "Non-Atmel dev found (MAN_ID %02x %02x)\n", man_id >> 8, man_id & 0xFF); - rc = -EINVAL; - goto err_gpio_dir; + return -EINVAL; } switch (part) { @@ -1141,16 +1130,12 @@ static int at86rf230_probe(struct spi_device *spi) } dev_info(&spi->dev, "Detected %s chip version %d\n", chip, version); - if (!ops) { - rc = -ENOTSUPP; - goto err_gpio_dir; - } + if (!ops) + return -ENOTSUPP; dev = ieee802154_alloc_device(sizeof(*lp), ops); - if (!dev) { - rc = -ENOMEM; - goto err_gpio_dir; - } + if (!dev) + return -ENOMEM; lp = dev->priv; lp->dev = dev; @@ -1212,35 +1197,21 @@ err_hw_init: mutex_destroy(&lp->bmux); ieee802154_free_device(lp->dev); -err_gpio_dir: - if (gpio_is_valid(pdata->slp_tr)) - gpio_free(pdata->slp_tr); -err_slp_tr: - if (gpio_is_valid(pdata->rstn)) - gpio_free(pdata->rstn); return rc; } static int at86rf230_remove(struct spi_device *spi) { struct at86rf230_local *lp = spi_get_drvdata(spi); - struct at86rf230_platform_data *pdata = spi->dev.platform_data; /* mask all at86rf230 irq's */ at86rf230_write_subreg(lp, SR_IRQ_MASK, 0); ieee802154_unregister_device(lp->dev); - flush_work(&lp->irqwork); - - if (gpio_is_valid(pdata->slp_tr)) - gpio_free(pdata->slp_tr); - if (gpio_is_valid(pdata->rstn)) - gpio_free(pdata->rstn); - mutex_destroy(&lp->bmux); ieee802154_free_device(lp->dev); - dev_dbg(&spi->dev, "unregistered at86rf230\n"); + return 0; }