[RFT 4/4] mfd: max14577: Remove platform data and instantiation from I2C

From: Krzysztof Kozlowski
Date: Fri Feb 17 2017 - 15:02:39 EST


max14577 family of drivers can be now instantiated only from DeviceTree
thus we can remove any I2C device id code and platform data. This
simplifies the driver a little bit.

Signed-off-by: Krzysztof Kozlowski <krzk@xxxxxxxxxx>
---
drivers/mfd/max14577.c | 22 ----------------------
include/linux/mfd/max14577.h | 20 --------------------
2 files changed, 42 deletions(-)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index f6772d64a6a4..a6ec1451af94 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -373,7 +373,6 @@ static int max14577_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct max14577 *max14577;
- struct max14577_platform_data *pdata = dev_get_platdata(&i2c->dev);
struct device_node *np = i2c->dev.of_node;
int ret = 0;
const struct regmap_irq_chip *irq_chip;
@@ -381,18 +380,6 @@ static int max14577_i2c_probe(struct i2c_client *i2c,
unsigned int mfd_devs_size;
int irq_flags;

- if (np) {
- pdata = devm_kzalloc(&i2c->dev, sizeof(*pdata), GFP_KERNEL);
- if (!pdata)
- return -ENOMEM;
- i2c->dev.platform_data = pdata;
- }
-
- if (!pdata) {
- dev_err(&i2c->dev, "No platform data found.\n");
- return -EINVAL;
- }
-
max14577 = devm_kzalloc(&i2c->dev, sizeof(*max14577), GFP_KERNEL);
if (!max14577)
return -ENOMEM;
@@ -486,13 +473,6 @@ static int max14577_i2c_remove(struct i2c_client *i2c)
return 0;
}

-static const struct i2c_device_id max14577_i2c_id[] = {
- { "max14577", MAXIM_DEVICE_TYPE_MAX14577, },
- { "max77836", MAXIM_DEVICE_TYPE_MAX77836, },
- { }
-};
-MODULE_DEVICE_TABLE(i2c, max14577_i2c_id);
-
#ifdef CONFIG_PM_SLEEP
static int max14577_suspend(struct device *dev)
{
@@ -538,12 +518,10 @@ static struct i2c_driver max14577_i2c_driver = {
},
.probe = max14577_i2c_probe,
.remove = max14577_i2c_remove,
- .id_table = max14577_i2c_id,
};

static int __init max14577_i2c_init(void)
{
- BUILD_BUG_ON(ARRAY_SIZE(max14577_i2c_id) != MAXIM_DEVICE_TYPE_NUM);
BUILD_BUG_ON(ARRAY_SIZE(max14577_dt_match) != MAXIM_DEVICE_TYPE_NUM);

/* Valid charger current values must be provided for each chipset */
diff --git a/include/linux/mfd/max14577.h b/include/linux/mfd/max14577.h
index d81b52bb8bee..a97155662713 100644
--- a/include/linux/mfd/max14577.h
+++ b/include/linux/mfd/max14577.h
@@ -62,26 +62,6 @@ struct max14577_charger_platform_data {
};

/*
- * MAX14577 MFD platform data
- */
-struct max14577_platform_data {
- /* IRQ */
- int irq_base;
-
- /* current control GPIOs */
- int gpio_pogo_vbatt_en;
- int gpio_pogo_vbus_en;
-
- /* current control GPIO control function */
- int (*set_gpio_pogo_vbatt_en) (int gpio_val);
- int (*set_gpio_pogo_vbus_en) (int gpio_val);
-
- int (*set_gpio_pogo_cb) (int new_dev);
-
- struct max14577_regulator_platform_data *regulators;
-};
-
-/*
* Valid limits of current for max14577 and max77836 chargers.
* They must correspond to MBCICHWRCL and MBCICHWRCH fields in CHGCTRL4
* register for given chipset.
--
2.9.3