* [PATCH] spi: clps711x: Convert to devm_gpio_request()
@ 2014-01-12 7:33 Axel Lin
2014-01-12 7:37 ` Alexander Shiyan
2014-01-13 10:17 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2014-01-12 7:33 UTC (permalink / raw)
To: Mark Brown; +Cc: Alexander Shiyan, linux-spi-u79uwXL29TY76Z2rM5mHXA
Also drop unneeded gpio_is_valid() call, the checking is done in the
implementation of gpio_request().
With this conversion, then we can also remove spi_clps711x_remove().
Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
drivers/spi/spi-clps711x.c | 26 ++------------------------
1 file changed, 2 insertions(+), 24 deletions(-)
diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c
index 6f03d7e..45a7619 100644
--- a/drivers/spi/spi-clps711x.c
+++ b/drivers/spi/spi-clps711x.c
@@ -193,12 +193,8 @@ static int spi_clps711x_probe(struct platform_device *pdev)
for (i = 0; i < master->num_chipselect; i++) {
hw->chipselect[i] = pdata->chipselect[i];
- if (!gpio_is_valid(hw->chipselect[i])) {
- dev_err(&pdev->dev, "Invalid CS GPIO %i\n", i);
- ret = -EINVAL;
- goto err_out;
- }
- if (gpio_request(hw->chipselect[i], DRIVER_NAME)) {
+ if (devm_gpio_request(&pdev->dev, hw->chipselect[i],
+ DRIVER_NAME)) {
dev_err(&pdev->dev, "Can't get CS GPIO %i\n", i);
ret = -EINVAL;
goto err_out;
@@ -240,35 +236,17 @@ static int spi_clps711x_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Failed to register master\n");
err_out:
- while (--i >= 0)
- if (gpio_is_valid(hw->chipselect[i]))
- gpio_free(hw->chipselect[i]);
-
spi_master_put(master);
return ret;
}
-static int spi_clps711x_remove(struct platform_device *pdev)
-{
- int i;
- struct spi_master *master = platform_get_drvdata(pdev);
- struct spi_clps711x_data *hw = spi_master_get_devdata(master);
-
- for (i = 0; i < master->num_chipselect; i++)
- if (gpio_is_valid(hw->chipselect[i]))
- gpio_free(hw->chipselect[i]);
-
- return 0;
-}
-
static struct platform_driver clps711x_spi_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
},
.probe = spi_clps711x_probe,
- .remove = spi_clps711x_remove,
};
module_platform_driver(clps711x_spi_driver);
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: clps711x: Convert to devm_gpio_request()
2014-01-12 7:33 [PATCH] spi: clps711x: Convert to devm_gpio_request() Axel Lin
@ 2014-01-12 7:37 ` Alexander Shiyan
2014-01-13 10:17 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Shiyan @ 2014-01-12 7:37 UTC (permalink / raw)
To: Axel Lin; +Cc: Mark Brown, linux-spi-u79uwXL29TY76Z2rM5mHXA
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 555 bytes --]
ÐоÑкÑеÑенÑе, 12 ÑнваÑÑ 2014, 15:33 +08:00 Ð¾Ñ Axel Lin <axel.lin@ingics.com>:
> Also drop unneeded gpio_is_valid() call, the checking is done in the
> implementation of gpio_request().
> With this conversion, then we can also remove spi_clps711x_remove().
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
https://git.kernel.org/cgit/linux/kernel/git/broonie/spi.git/commit/?h=topic/clps711x
---
N§²æìr¸yúèØb²X¬¶Ç§vØ^)Þº{.nÇ+·¥{±²¢Ø^nr¡ö¦zË\x1aëh¨èÚ&¢îý»\x05ËÛÔØï¦v¬Îf\x1dp)¹¹br ê+Ê+zf£¢·h§~Ûiÿûàz¹\x1e®w¥¢¸?¨èÚ&¢)ߢ^[f
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: clps711x: Convert to devm_gpio_request()
2014-01-12 7:33 [PATCH] spi: clps711x: Convert to devm_gpio_request() Axel Lin
2014-01-12 7:37 ` Alexander Shiyan
@ 2014-01-13 10:17 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-01-13 10:17 UTC (permalink / raw)
To: Axel Lin; +Cc: Alexander Shiyan, linux-spi-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 298 bytes --]
On Sun, Jan 12, 2014 at 03:33:39PM +0800, Axel Lin wrote:
> Also drop unneeded gpio_is_valid() call, the checking is done in the
> implementation of gpio_request().
> With this conversion, then we can also remove spi_clps711x_remove().
This is a duplicate of a patch Alexander sent the other day.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-13 10:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-12 7:33 [PATCH] spi: clps711x: Convert to devm_gpio_request() Axel Lin
2014-01-12 7:37 ` Alexander Shiyan
2014-01-13 10:17 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.