diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2014-01-10 17:02:05 +0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-01-10 13:27:24 +0000 |
commit | 989847967cd762598ff0caa2aafc4ddcb04bcda3 (patch) | |
tree | 5306d989eae95ae6e81731709dd7f0900f05ef47 /drivers/spi/spi-clps711x.c | |
parent | 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff) | |
download | linux-989847967cd762598ff0caa2aafc4ddcb04bcda3.tar.gz linux-989847967cd762598ff0caa2aafc4ddcb04bcda3.tar.xz |
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/spi-clps711x.c')
-rw-r--r-- | drivers/spi/spi-clps711x.c | 22 |
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 @@ /* * CLPS711X SPI bus driver * - * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru> + * Copyright (C) 2012-2014 Alexander Shiyan <shc_work@mail.ru> * * This program is free software; you can redistribute it and/or modify * 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) ret = -EINVAL; goto err_out; } - if (gpio_request(hw->chipselect[i], DRIVER_NAME)) { + if (devm_gpio_request(&pdev->dev, hw->chipselect[i], NULL)) { dev_err(&pdev->dev, "Can't get CS GPIO %i\n", i); ret = -EINVAL; goto err_out; @@ -240,35 +240,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); |