Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexander Shiyan and committed by
Mark Brown
98984796 6ce4eac1

+2 -20
+2 -20
drivers/spi/spi-clps711x.c
··· 1 1 /* 2 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 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License as published by ··· 198 198 ret = -EINVAL; 199 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 202 dev_err(&pdev->dev, "Can't get CS GPIO %i\n", i); 203 203 ret = -EINVAL; 204 204 goto err_out; ··· 240 240 dev_err(&pdev->dev, "Failed to register master\n"); 241 241 242 242 err_out: 243 - while (--i >= 0) 244 - if (gpio_is_valid(hw->chipselect[i])) 245 - gpio_free(hw->chipselect[i]); 246 - 247 243 spi_master_put(master); 248 244 249 245 return ret; 250 - } 251 - 252 - static 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 246 } 264 247 265 248 static struct platform_driver clps711x_spi_driver = { ··· 251 268 .owner = THIS_MODULE, 252 269 }, 253 270 .probe = spi_clps711x_probe, 254 - .remove = spi_clps711x_remove, 255 271 }; 256 272 module_platform_driver(clps711x_spi_driver); 257 273