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

mfd: tps65217: Introduce dependency on CONFIG_OF

Currently the driver boots only via device tree hence add a
dependency on CONFIG_OF. This leaves with a bunch of unused code
so clean that up. This patch also makes use of probe_new function
in place of the probe function so as to avoid passing i2c_device_id.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Keerthy and committed by
Lee Jones
511cb174 cfc95173

+9 -46
+1 -1
drivers/mfd/Kconfig
··· 1338 1338 1339 1339 config MFD_TPS65217 1340 1340 tristate "TI TPS65217 Power Management / White LED chips" 1341 - depends on I2C 1341 + depends on I2C && OF 1342 1342 select MFD_CORE 1343 1343 select REGMAP_I2C 1344 1344 select IRQ_DOMAIN
+5 -23
drivers/mfd/tps65217.c
··· 311 311 }; 312 312 313 313 static const struct of_device_id tps65217_of_match[] = { 314 - { .compatible = "ti,tps65217", .data = (void *)TPS65217 }, 314 + { .compatible = "ti,tps65217"}, 315 315 { /* sentinel */ }, 316 316 }; 317 317 MODULE_DEVICE_TABLE(of, tps65217_of_match); 318 318 319 - static int tps65217_probe(struct i2c_client *client, 320 - const struct i2c_device_id *ids) 319 + static int tps65217_probe(struct i2c_client *client) 321 320 { 322 321 struct tps65217 *tps; 323 322 unsigned int version; 324 - unsigned long chip_id = ids->driver_data; 325 - const struct of_device_id *match; 326 323 bool status_off = false; 327 324 int ret; 328 325 329 - if (client->dev.of_node) { 330 - match = of_match_device(tps65217_of_match, &client->dev); 331 - if (!match) { 332 - dev_err(&client->dev, 333 - "Failed to find matching dt id\n"); 334 - return -EINVAL; 335 - } 336 - chip_id = (unsigned long)match->data; 337 - status_off = of_property_read_bool(client->dev.of_node, 338 - "ti,pmic-shutdown-controller"); 339 - } 340 - 341 - if (!chip_id) { 342 - dev_err(&client->dev, "id is null.\n"); 343 - return -ENODEV; 344 - } 326 + status_off = of_property_read_bool(client->dev.of_node, 327 + "ti,pmic-shutdown-controller"); 345 328 346 329 tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); 347 330 if (!tps) ··· 332 349 333 350 i2c_set_clientdata(client, tps); 334 351 tps->dev = &client->dev; 335 - tps->id = chip_id; 336 352 337 353 tps->regmap = devm_regmap_init_i2c(client, &tps65217_regmap_config); 338 354 if (IS_ERR(tps->regmap)) { ··· 412 430 .of_match_table = tps65217_of_match, 413 431 }, 414 432 .id_table = tps65217_id_table, 415 - .probe = tps65217_probe, 433 + .probe_new = tps65217_probe, 416 434 .remove = tps65217_remove, 417 435 }; 418 436
-5
drivers/regulator/tps65217-regulator.c
··· 228 228 int i, ret; 229 229 unsigned int val; 230 230 231 - if (tps65217_chip_id(tps) != TPS65217) { 232 - dev_err(&pdev->dev, "Invalid tps chip version\n"); 233 - return -ENODEV; 234 - } 235 - 236 231 /* Allocate memory for strobes */ 237 232 tps->strobes = devm_kzalloc(&pdev->dev, sizeof(u8) * 238 233 TPS65217_NUM_REGULATOR, GFP_KERNEL);
+3 -11
drivers/video/backlight/tps65217_bl.c
··· 275 275 struct tps65217_bl_pdata *pdata; 276 276 struct backlight_properties bl_props; 277 277 278 - if (tps->dev->of_node) { 279 - pdata = tps65217_bl_parse_dt(pdev); 280 - if (IS_ERR(pdata)) 281 - return PTR_ERR(pdata); 282 - } else { 283 - pdata = dev_get_platdata(&pdev->dev); 284 - if (!pdata) { 285 - dev_err(&pdev->dev, "no platform data provided\n"); 286 - return -EINVAL; 287 - } 288 - } 278 + pdata = tps65217_bl_parse_dt(pdev); 279 + if (IS_ERR(pdata)) 280 + return PTR_ERR(pdata); 289 281 290 282 tps65217_bl = devm_kzalloc(&pdev->dev, sizeof(*tps65217_bl), 291 283 GFP_KERNEL);
-6
include/linux/mfd/tps65217.h
··· 263 263 struct tps65217 { 264 264 struct device *dev; 265 265 struct tps65217_board *pdata; 266 - unsigned long id; 267 266 struct regulator_desc desc[TPS65217_NUM_REGULATOR]; 268 267 struct regmap *regmap; 269 268 u8 *strobes; ··· 275 276 static inline struct tps65217 *dev_to_tps65217(struct device *dev) 276 277 { 277 278 return dev_get_drvdata(dev); 278 - } 279 - 280 - static inline unsigned long tps65217_chip_id(struct tps65217 *tps65217) 281 - { 282 - return tps65217->id; 283 279 } 284 280 285 281 int tps65217_reg_read(struct tps65217 *tps, unsigned int reg,