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

Configure Feed

Select the types of activity you want to include in your feed.

mfd: tps65912: Use devm helper functions to simplify probe

This simplifies probe and also allows us to remove the remove
callbacks from the core and interface drivers. Do that here.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240613175430.57698-1-afd@ti.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Andrew Davis and committed by
Lee Jones
13c151a9 0ddabc8c

+7 -31
+7 -14
drivers/mfd/tps65912-core.c
··· 90 90 { 91 91 int ret; 92 92 93 - ret = regmap_add_irq_chip(tps->regmap, tps->irq, IRQF_ONESHOT, 0, 94 - &tps65912_irq_chip, &tps->irq_data); 93 + ret = devm_regmap_add_irq_chip(tps->dev, tps->regmap, tps->irq, 94 + IRQF_ONESHOT, 0, &tps65912_irq_chip, 95 + &tps->irq_data); 95 96 if (ret) 96 97 return ret; 97 98 98 - ret = mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65912_cells, 99 - ARRAY_SIZE(tps65912_cells), NULL, 0, 100 - regmap_irq_get_domain(tps->irq_data)); 101 - if (ret) { 102 - regmap_del_irq_chip(tps->irq, tps->irq_data); 99 + ret = devm_mfd_add_devices(tps->dev, PLATFORM_DEVID_AUTO, tps65912_cells, 100 + ARRAY_SIZE(tps65912_cells), NULL, 0, 101 + regmap_irq_get_domain(tps->irq_data)); 102 + if (ret) 103 103 return ret; 104 - } 105 104 106 105 return 0; 107 106 } 108 107 EXPORT_SYMBOL_GPL(tps65912_device_init); 109 - 110 - void tps65912_device_exit(struct tps65912 *tps) 111 - { 112 - regmap_del_irq_chip(tps->irq, tps->irq_data); 113 - } 114 - EXPORT_SYMBOL_GPL(tps65912_device_exit); 115 108 116 109 MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>"); 117 110 MODULE_DESCRIPTION("TPS65912x MFD Driver");
-8
drivers/mfd/tps65912-i2c.c
··· 42 42 return tps65912_device_init(tps); 43 43 } 44 44 45 - static void tps65912_i2c_remove(struct i2c_client *client) 46 - { 47 - struct tps65912 *tps = i2c_get_clientdata(client); 48 - 49 - tps65912_device_exit(tps); 50 - } 51 - 52 45 static const struct i2c_device_id tps65912_i2c_id_table[] = { 53 46 { "tps65912" }, 54 47 { /* sentinel */ } ··· 54 61 .of_match_table = tps65912_i2c_of_match_table, 55 62 }, 56 63 .probe = tps65912_i2c_probe, 57 - .remove = tps65912_i2c_remove, 58 64 .id_table = tps65912_i2c_id_table, 59 65 }; 60 66 module_i2c_driver(tps65912_i2c_driver);
-8
drivers/mfd/tps65912-spi.c
··· 42 42 return tps65912_device_init(tps); 43 43 } 44 44 45 - static void tps65912_spi_remove(struct spi_device *spi) 46 - { 47 - struct tps65912 *tps = spi_get_drvdata(spi); 48 - 49 - tps65912_device_exit(tps); 50 - } 51 - 52 45 static const struct spi_device_id tps65912_spi_id_table[] = { 53 46 { "tps65912", 0 }, 54 47 { /* sentinel */ } ··· 54 61 .of_match_table = tps65912_spi_of_match_table, 55 62 }, 56 63 .probe = tps65912_spi_probe, 57 - .remove = tps65912_spi_remove, 58 64 .id_table = tps65912_spi_id_table, 59 65 }; 60 66 module_spi_driver(tps65912_spi_driver);
-1
include/linux/mfd/tps65912.h
··· 314 314 extern const struct regmap_config tps65912_regmap_config; 315 315 316 316 int tps65912_device_init(struct tps65912 *tps); 317 - void tps65912_device_exit(struct tps65912 *tps); 318 317 319 318 #endif /* __LINUX_MFD_TPS65912_H */