mirror of
https://github.com/torvalds/linux.git
synced 2024-12-10 21:21:54 +00:00
a0386bba70
The value returned by an spi driver's remove function is mostly ignored. (Only an error message is printed if the value is non-zero that the error is ignored.) So change the prototype of the remove function to return no value. This way driver authors are not tempted to assume that passing an error to the upper layer is a good idea. All drivers are adapted accordingly. There is no intended change of behaviour, all callbacks were prepared to return 0 before. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Acked-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Claudius Heine <ch@denx.de> Acked-by: Stefan Schmidt <stefan@datenfreihafen.org> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC Acked-by: Marcus Folkesson <marcus.folkesson@gmail.com> Acked-by: Łukasz Stelmach <l.stelmach@samsung.com> Acked-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20220123175201.34839-6-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
80 lines
2.2 KiB
C
80 lines
2.2 KiB
C
/*
|
|
* SPI access driver for TI TPS65912x PMICs
|
|
*
|
|
* Copyright (C) 2015 Texas Instruments Incorporated - https://www.ti.com/
|
|
* Andrew F. Davis <afd@ti.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
|
|
* kind, whether expressed or implied; without even the implied warranty
|
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License version 2 for more details.
|
|
*
|
|
* Based on the TPS65218 driver and the previous TPS65912 driver by
|
|
* Margarita Olaya Cabrera <magi@slimlogic.co.uk>
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/regmap.h>
|
|
#include <linux/spi/spi.h>
|
|
|
|
#include <linux/mfd/tps65912.h>
|
|
|
|
static const struct of_device_id tps65912_spi_of_match_table[] = {
|
|
{ .compatible = "ti,tps65912", },
|
|
{ /* sentinel */ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, tps65912_spi_of_match_table);
|
|
|
|
static int tps65912_spi_probe(struct spi_device *spi)
|
|
{
|
|
struct tps65912 *tps;
|
|
|
|
tps = devm_kzalloc(&spi->dev, sizeof(*tps), GFP_KERNEL);
|
|
if (!tps)
|
|
return -ENOMEM;
|
|
|
|
spi_set_drvdata(spi, tps);
|
|
tps->dev = &spi->dev;
|
|
tps->irq = spi->irq;
|
|
|
|
tps->regmap = devm_regmap_init_spi(spi, &tps65912_regmap_config);
|
|
if (IS_ERR(tps->regmap)) {
|
|
dev_err(tps->dev, "Failed to initialize register map\n");
|
|
return PTR_ERR(tps->regmap);
|
|
}
|
|
|
|
return tps65912_device_init(tps);
|
|
}
|
|
|
|
static void tps65912_spi_remove(struct spi_device *spi)
|
|
{
|
|
struct tps65912 *tps = spi_get_drvdata(spi);
|
|
|
|
tps65912_device_exit(tps);
|
|
}
|
|
|
|
static const struct spi_device_id tps65912_spi_id_table[] = {
|
|
{ "tps65912", 0 },
|
|
{ /* sentinel */ }
|
|
};
|
|
MODULE_DEVICE_TABLE(spi, tps65912_spi_id_table);
|
|
|
|
static struct spi_driver tps65912_spi_driver = {
|
|
.driver = {
|
|
.name = "tps65912",
|
|
.of_match_table = tps65912_spi_of_match_table,
|
|
},
|
|
.probe = tps65912_spi_probe,
|
|
.remove = tps65912_spi_remove,
|
|
.id_table = tps65912_spi_id_table,
|
|
};
|
|
module_spi_driver(tps65912_spi_driver);
|
|
|
|
MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
|
|
MODULE_DESCRIPTION("TPS65912x SPI Interface Driver");
|
|
MODULE_LICENSE("GPL v2");
|