[PATCH] regulator: max5970: Rename driver and remove wildcard

From: Naresh Solanki
Date: Tue Aug 01 2023 - 06:27:46 EST


The previous version of this driver included wildcards in file names and
descriptions. This patch renames the driver to only support MAX5970 and
MAX5978, which are the only chips that the driver actually supports.

Signed-off-by: Naresh Solanki <Naresh.Solanki@xxxxxxxxxxxxx>
---
drivers/regulator/Kconfig | 6 ++--
drivers/regulator/Makefile | 2 +-
...ax597x-regulator.c => max5970-regulator.c} | 28 +++++++++----------
3 files changed, 18 insertions(+), 18 deletions(-)
rename drivers/regulator/{max597x-regulator.c => max5970-regulator.c} (94%)

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 94f44736473e..a5c9de1cab2b 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -546,11 +546,11 @@ config REGULATOR_MAX1586
regulator via I2C bus. The provided regulator is suitable
for PXA27x chips to control VCC_CORE and VCC_USIM voltages.

-config REGULATOR_MAX597X
- tristate "Maxim 597x power switch and monitor"
+config REGULATOR_MAX5970
+ tristate "Maxim 5970/5978 power switch and monitor"
depends on I2C
depends on OF
- depends on MFD_MAX597X
+ depends on MFD_MAX5970
help
This driver controls a Maxim 5970/5978 switch via I2C bus.
The MAX5970/5978 is a smart switch with no output regulation, but
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 77b22bdd2791..453289cdd444 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -67,7 +67,7 @@ obj-$(CONFIG_REGULATOR_LTC3589) += ltc3589.o
obj-$(CONFIG_REGULATOR_LTC3676) += ltc3676.o
obj-$(CONFIG_REGULATOR_MAX14577) += max14577-regulator.o
obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
-obj-$(CONFIG_REGULATOR_MAX597X) += max597x-regulator.o
+obj-$(CONFIG_REGULATOR_MAX5970) += max5970-regulator.o
obj-$(CONFIG_REGULATOR_MAX77541) += max77541-regulator.o
obj-$(CONFIG_REGULATOR_MAX77620) += max77620-regulator.o
obj-$(CONFIG_REGULATOR_MAX77650) += max77650-regulator.o
diff --git a/drivers/regulator/max597x-regulator.c b/drivers/regulator/max5970-regulator.c
similarity index 94%
rename from drivers/regulator/max597x-regulator.c
rename to drivers/regulator/max5970-regulator.c
index 7873a5267555..b56a174cde3d 100644
--- a/drivers/regulator/max597x-regulator.c
+++ b/drivers/regulator/max5970-regulator.c
@@ -20,9 +20,9 @@
#include <linux/regulator/of_regulator.h>
#include <linux/platform_device.h>

-#include <linux/mfd/max597x.h>
+#include <linux/mfd/max5970.h>

-struct max597x_regulator {
+struct max5970_regulator {
int num_switches, mon_rng, irng, shunt_micro_ohms, lim_uA;
struct regmap *regmap;
};
@@ -58,7 +58,7 @@ static int max597x_set_vp(struct regulator_dev *rdev, int lim_uV, int severity,
bool enable, bool overvoltage)
{
int off_h, off_l, reg, ret;
- struct max597x_regulator *data = rdev_get_drvdata(rdev);
+ struct max5970_regulator *data = rdev_get_drvdata(rdev);
int channel = rdev_get_id(rdev);

if (overvoltage) {
@@ -140,7 +140,7 @@ static int max597x_set_ocp(struct regulator_dev *rdev, int lim_uA,
int val, reg;
unsigned int vthst, vthfst;

- struct max597x_regulator *data = rdev_get_drvdata(rdev);
+ struct max5970_regulator *data = rdev_get_drvdata(rdev);
int rdev_id = rdev_get_id(rdev);
/*
* MAX5970 doesn't has enable control for ocp.
@@ -222,7 +222,7 @@ static int max597x_dt_parse(struct device_node *np,
const struct regulator_desc *desc,
struct regulator_config *cfg)
{
- struct max597x_regulator *data = cfg->driver_data;
+ struct max5970_regulator *data = cfg->driver_data;
int ret = 0;

ret =
@@ -274,7 +274,7 @@ static int max597x_irq_handler(int irq, struct regulator_irq_data *rid,
unsigned long *dev_mask)
{
struct regulator_err_state *stat;
- struct max597x_regulator *d = (struct max597x_regulator *)rid->data;
+ struct max5970_regulator *d = (struct max5970_regulator *)rid->data;
int val, ret, i;

ret = max597x_regmap_read_clear(d->regmap, MAX5970_REG_FAULT0, &val);
@@ -394,7 +394,7 @@ static int max597x_adc_range(struct regmap *regmap, const int ch,
static int max597x_setup_irq(struct device *dev,
int irq,
struct regulator_dev *rdevs[MAX5970_NUM_SWITCHES],
- int num_switches, struct max597x_regulator *data)
+ int num_switches, struct max5970_regulator *data)
{
struct regulator_irq_desc max597x_notif = {
.name = "max597x-irq",
@@ -425,9 +425,9 @@ static int max597x_setup_irq(struct device *dev,

static int max597x_regulator_probe(struct platform_device *pdev)
{
- struct max597x_data *max597x;
+ struct max5970_data *max597x;
struct regmap *regmap = dev_get_regmap(pdev->dev.parent, NULL);
- struct max597x_regulator *data;
+ struct max5970_regulator *data;
struct i2c_client *i2c = to_i2c_client(pdev->dev.parent);
struct regulator_config config = { };
struct regulator_dev *rdev;
@@ -438,16 +438,16 @@ static int max597x_regulator_probe(struct platform_device *pdev)
if (!regmap)
return -EPROBE_DEFER;

- max597x = devm_kzalloc(&i2c->dev, sizeof(struct max597x_data), GFP_KERNEL);
+ max597x = devm_kzalloc(&i2c->dev, sizeof(struct max5970_data), GFP_KERNEL);
if (!max597x)
return -ENOMEM;

i2c_set_clientdata(i2c, max597x);

if (of_device_is_compatible(i2c->dev.of_node, "maxim,max5978"))
- max597x->num_switches = MAX597x_TYPE_MAX5978;
+ max597x->num_switches = MAX5978_NUM_SWITCHES;
else if (of_device_is_compatible(i2c->dev.of_node, "maxim,max5970"))
- max597x->num_switches = MAX597x_TYPE_MAX5970;
+ max597x->num_switches = MAX5970_NUM_SWITCHES;
else
return -ENODEV;

@@ -456,7 +456,7 @@ static int max597x_regulator_probe(struct platform_device *pdev)

for (i = 0; i < num_switches; i++) {
data =
- devm_kzalloc(&i2c->dev, sizeof(struct max597x_regulator),
+ devm_kzalloc(&i2c->dev, sizeof(struct max5970_regulator),
GFP_KERNEL);
if (!data)
return -ENOMEM;
@@ -500,7 +500,7 @@ static int max597x_regulator_probe(struct platform_device *pdev)

static struct platform_driver max597x_regulator_driver = {
.driver = {
- .name = "max597x-regulator",
+ .name = "max5970-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = max597x_regulator_probe,

base-commit: 1519454ab7686d3902ae65aef422c3c662b5944a
--
2.41.0