regulator: max5970: Drop unused structs
After splitting the max5970 into a MFD device clean the remaining code and drop unused structs. The struct max5970_data and enum max5970_chip_type aren't used. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Acked-by: Lee Jones <lee@kernel.org> Link: https://patch.msgid.link/20241002125500.78278-1-patrick.rudolph@9elements.com Signed-off-by: Mark Brown <broonie@kernel.org>pull/1083/head
parent
4e9a2c91bf
commit
fceffbfe57
|
|
@ -485,7 +485,7 @@ static int max597x_irq_handler(int irq, struct regulator_irq_data *rid,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int max597x_adc_range(struct regmap *regmap, const int ch,
|
static int max597x_adc_range(struct regmap *regmap, const int ch,
|
||||||
u32 *irng, u32 *mon_rng)
|
int *irng, int *mon_rng)
|
||||||
{
|
{
|
||||||
unsigned int reg;
|
unsigned int reg;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
@ -552,7 +552,6 @@ static int max597x_setup_irq(struct device *dev,
|
||||||
|
|
||||||
static int max597x_regulator_probe(struct platform_device *pdev)
|
static int max597x_regulator_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct max5970_data *max597x;
|
|
||||||
struct regmap *regmap = dev_get_regmap(pdev->dev.parent, NULL);
|
struct regmap *regmap = dev_get_regmap(pdev->dev.parent, NULL);
|
||||||
struct max5970_regulator *data;
|
struct max5970_regulator *data;
|
||||||
struct i2c_client *i2c = to_i2c_client(pdev->dev.parent);
|
struct i2c_client *i2c = to_i2c_client(pdev->dev.parent);
|
||||||
|
|
@ -566,26 +565,18 @@ static int max597x_regulator_probe(struct platform_device *pdev)
|
||||||
if (!regmap)
|
if (!regmap)
|
||||||
return -EPROBE_DEFER;
|
return -EPROBE_DEFER;
|
||||||
|
|
||||||
max597x = devm_kzalloc(&i2c->dev, sizeof(struct max5970_data), GFP_KERNEL);
|
|
||||||
if (!max597x)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
rdevs = devm_kcalloc(&i2c->dev, MAX5970_NUM_SWITCHES, sizeof(struct regulator_dev *),
|
rdevs = devm_kcalloc(&i2c->dev, MAX5970_NUM_SWITCHES, sizeof(struct regulator_dev *),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!rdevs)
|
if (!rdevs)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
i2c_set_clientdata(i2c, max597x);
|
|
||||||
|
|
||||||
if (of_device_is_compatible(i2c->dev.of_node, "maxim,max5978"))
|
if (of_device_is_compatible(i2c->dev.of_node, "maxim,max5978"))
|
||||||
max597x->num_switches = MAX5978_NUM_SWITCHES;
|
num_switches = MAX5978_NUM_SWITCHES;
|
||||||
else if (of_device_is_compatible(i2c->dev.of_node, "maxim,max5970"))
|
else if (of_device_is_compatible(i2c->dev.of_node, "maxim,max5970"))
|
||||||
max597x->num_switches = MAX5970_NUM_SWITCHES;
|
num_switches = MAX5970_NUM_SWITCHES;
|
||||||
else
|
else
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
num_switches = max597x->num_switches;
|
|
||||||
|
|
||||||
for (i = 0; i < num_switches; i++) {
|
for (i = 0; i < num_switches; i++) {
|
||||||
data =
|
data =
|
||||||
devm_kzalloc(&i2c->dev, sizeof(struct max5970_regulator),
|
devm_kzalloc(&i2c->dev, sizeof(struct max5970_regulator),
|
||||||
|
|
@ -596,13 +587,10 @@ static int max597x_regulator_probe(struct platform_device *pdev)
|
||||||
data->num_switches = num_switches;
|
data->num_switches = num_switches;
|
||||||
data->regmap = regmap;
|
data->regmap = regmap;
|
||||||
|
|
||||||
ret = max597x_adc_range(regmap, i, &max597x->irng[i], &max597x->mon_rng[i]);
|
ret = max597x_adc_range(regmap, i, &data->irng, &data->mon_rng);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
data->irng = max597x->irng[i];
|
|
||||||
data->mon_rng = max597x->mon_rng[i];
|
|
||||||
|
|
||||||
config.dev = &i2c->dev;
|
config.dev = &i2c->dev;
|
||||||
config.driver_data = (void *)data;
|
config.driver_data = (void *)data;
|
||||||
config.regmap = data->regmap;
|
config.regmap = data->regmap;
|
||||||
|
|
@ -614,7 +602,6 @@ static int max597x_regulator_probe(struct platform_device *pdev)
|
||||||
return PTR_ERR(rdev);
|
return PTR_ERR(rdev);
|
||||||
}
|
}
|
||||||
rdevs[i] = rdev;
|
rdevs[i] = rdev;
|
||||||
max597x->shunt_micro_ohms[i] = data->shunt_micro_ohms;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_REACHABLE(CONFIG_HWMON)) {
|
if (IS_REACHABLE(CONFIG_HWMON)) {
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,6 @@
|
||||||
#define MAX5978_NUM_SWITCHES 1
|
#define MAX5978_NUM_SWITCHES 1
|
||||||
#define MAX5970_NUM_LEDS 4
|
#define MAX5970_NUM_LEDS 4
|
||||||
|
|
||||||
struct max5970_data {
|
|
||||||
int num_switches;
|
|
||||||
u32 irng[MAX5970_NUM_SWITCHES];
|
|
||||||
u32 mon_rng[MAX5970_NUM_SWITCHES];
|
|
||||||
u32 shunt_micro_ohms[MAX5970_NUM_SWITCHES];
|
|
||||||
};
|
|
||||||
|
|
||||||
enum max5970_chip_type {
|
|
||||||
TYPE_MAX5978 = 1,
|
|
||||||
TYPE_MAX5970,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define MAX5970_REG_CURRENT_L(ch) (0x01 + (ch) * 4)
|
#define MAX5970_REG_CURRENT_L(ch) (0x01 + (ch) * 4)
|
||||||
#define MAX5970_REG_CURRENT_H(ch) (0x00 + (ch) * 4)
|
#define MAX5970_REG_CURRENT_H(ch) (0x00 + (ch) * 4)
|
||||||
#define MAX5970_REG_VOLTAGE_L(ch) (0x03 + (ch) * 4)
|
#define MAX5970_REG_VOLTAGE_L(ch) (0x03 + (ch) * 4)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue