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

regulator: mcp16502: Remove setup_regulators function

It seems a little bit odd current code pass struct regulator_config rather
than a pointer to setup_regulators. The setup_regulators is so simple and
only has one caller, so remove it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Axel Lin and committed by
Mark Brown
784c24c3 4cf46953

+11 -26
+11 -26
drivers/regulator/mcp16502.c
··· 427 427 .wr_table = &mcp16502_yes_reg_table, 428 428 }; 429 429 430 - /* 431 - * set_up_regulators() - initialize all regulators 432 - */ 433 - static int setup_regulators(struct mcp16502 *mcp, struct device *dev, 434 - struct regulator_config config) 435 - { 436 - struct regulator_dev *rdev; 437 - int i; 438 - 439 - for (i = 0; i < NUM_REGULATORS; i++) { 440 - rdev = devm_regulator_register(dev, &mcp16502_desc[i], &config); 441 - if (IS_ERR(rdev)) { 442 - dev_err(dev, 443 - "failed to register %s regulator %ld\n", 444 - mcp16502_desc[i].name, PTR_ERR(rdev)); 445 - return PTR_ERR(rdev); 446 - } 447 - } 448 - 449 - return 0; 450 - } 451 - 452 430 static int mcp16502_probe(struct i2c_client *client, 453 431 const struct i2c_device_id *id) 454 432 { 455 433 struct regulator_config config = { }; 434 + struct regulator_dev *rdev; 456 435 struct device *dev; 457 436 struct mcp16502 *mcp; 458 437 struct regmap *rmap; 459 - int ret = 0; 438 + int i, ret; 460 439 461 440 dev = &client->dev; 462 441 config.dev = dev; ··· 461 482 return PTR_ERR(mcp->lpm); 462 483 } 463 484 464 - ret = setup_regulators(mcp, dev, config); 465 - if (ret != 0) 466 - return ret; 485 + for (i = 0; i < NUM_REGULATORS; i++) { 486 + rdev = devm_regulator_register(dev, &mcp16502_desc[i], &config); 487 + if (IS_ERR(rdev)) { 488 + dev_err(dev, 489 + "failed to register %s regulator %ld\n", 490 + mcp16502_desc[i].name, PTR_ERR(rdev)); 491 + return PTR_ERR(rdev); 492 + } 493 + } 467 494 468 495 mcp16502_gpio_set_mode(mcp, MCP16502_OPMODE_ACTIVE); 469 496