aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2014-01-10 08:02:05 -0500
committerMark Brown <broonie@linaro.org>2014-01-10 08:27:24 -0500
commit989847967cd762598ff0caa2aafc4ddcb04bcda3 (patch)
tree5306d989eae95ae6e81731709dd7f0900f05ef47 /drivers/spi
parent6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff)
spi: clps711x: Use devm_gpio_request()
This patch replaces gpio_request() with devm_ API. As a result this simplifies error path and eliminates "remove" function. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-clps711x.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c
index 6f03d7e6435d..dafb243a9143 100644
--- a/drivers/spi/spi-clps711x.c
+++ b/drivers/spi/spi-clps711x.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * CLPS711X SPI bus driver 2 * CLPS711X SPI bus driver
3 * 3 *
4 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru> 4 * Copyright (C) 2012-2014 Alexander Shiyan <shc_work@mail.ru>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -198,7 +198,7 @@ static int spi_clps711x_probe(struct platform_device *pdev)
198 ret = -EINVAL; 198 ret = -EINVAL;
199 goto err_out; 199 goto err_out;
200 } 200 }
201 if (gpio_request(hw->chipselect[i], DRIVER_NAME)) { 201 if (devm_gpio_request(&pdev->dev, hw->chipselect[i], NULL)) {
202 dev_err(&pdev->dev, "Can't get CS GPIO %i\n", i); 202 dev_err(&pdev->dev, "Can't get CS GPIO %i\n", i);
203 ret = -EINVAL; 203 ret = -EINVAL;
204 goto err_out; 204 goto err_out;
@@ -240,35 +240,17 @@ static int spi_clps711x_probe(struct platform_device *pdev)
240 dev_err(&pdev->dev, "Failed to register master\n"); 240 dev_err(&pdev->dev, "Failed to register master\n");
241 241
242err_out: 242err_out:
243 while (--i >= 0)
244 if (gpio_is_valid(hw->chipselect[i]))
245 gpio_free(hw->chipselect[i]);
246
247 spi_master_put(master); 243 spi_master_put(master);
248 244
249 return ret; 245 return ret;
250} 246}
251 247
252static int spi_clps711x_remove(struct platform_device *pdev)
253{
254 int i;
255 struct spi_master *master = platform_get_drvdata(pdev);
256 struct spi_clps711x_data *hw = spi_master_get_devdata(master);
257
258 for (i = 0; i < master->num_chipselect; i++)
259 if (gpio_is_valid(hw->chipselect[i]))
260 gpio_free(hw->chipselect[i]);
261
262 return 0;
263}
264
265static struct platform_driver clps711x_spi_driver = { 248static struct platform_driver clps711x_spi_driver = {
266 .driver = { 249 .driver = {
267 .name = DRIVER_NAME, 250 .name = DRIVER_NAME,
268 .owner = THIS_MODULE, 251 .owner = THIS_MODULE,
269 }, 252 },
270 .probe = spi_clps711x_probe, 253 .probe = spi_clps711x_probe,
271 .remove = spi_clps711x_remove,
272}; 254};
273module_platform_driver(clps711x_spi_driver); 255module_platform_driver(clps711x_spi_driver);
274 256