Skip to content

Commit e68ce0f

Browse files
mchehabLee Jones
authored andcommitted
mfd: hi6421-spmi-pmic: Cleanup drvdata to only include regmap
There are lots of fields in struct hi6421_spmi_pmic that aren't used. As a matter of fact, only regmap is needed. So, drop the struct as a whole, and set regmap as the drvdata. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Acked-by: Mark Brown <broonie@kernel.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/1828cb783b1ebca0b98bf0b3077d8701adb228f7.1630586862.git.mchehab+huawei@kernel.org
1 parent 6880fa6 commit e68ce0f

4 files changed

Lines changed: 14 additions & 46 deletions

File tree

‎drivers/mfd/hi6421-spmi-pmic.c‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99

1010
#include <linux/mfd/core.h>
11-
#include <linux/mfd/hi6421-spmi-pmic.h>
1211
#include <linux/module.h>
1312
#include <linux/platform_device.h>
1413
#include <linux/regmap.h>
@@ -30,19 +29,14 @@ static const struct regmap_config regmap_config = {
3029
static int hi6421_spmi_pmic_probe(struct spmi_device *sdev)
3130
{
3231
struct device *dev = &sdev->dev;
32+
struct regmap *regmap;
3333
int ret;
34-
struct hi6421_spmi_pmic *ddata;
35-
ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
36-
if (!ddata)
37-
return -ENOMEM;
3834

39-
ddata->regmap = devm_regmap_init_spmi_ext(sdev, &regmap_config);
40-
if (IS_ERR(ddata->regmap))
41-
return PTR_ERR(ddata->regmap);
35+
regmap = devm_regmap_init_spmi_ext(sdev, &regmap_config);
36+
if (IS_ERR(regmap))
37+
return PTR_ERR(regmap);
4238

43-
ddata->dev = dev;
44-
45-
dev_set_drvdata(&sdev->dev, ddata);
39+
dev_set_drvdata(&sdev->dev, regmap);
4640

4741
ret = devm_mfd_add_devices(&sdev->dev, PLATFORM_DEVID_NONE,
4842
hi6421v600_devs, ARRAY_SIZE(hi6421v600_devs),

‎drivers/misc/hi6421v600-irq.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <linux/bitops.h>
1111
#include <linux/interrupt.h>
1212
#include <linux/irq.h>
13-
#include <linux/mfd/hi6421-spmi-pmic.h>
1413
#include <linux/module.h>
1514
#include <linux/of_gpio.h>
1615
#include <linux/platform_device.h>
@@ -220,7 +219,7 @@ static int hi6421v600_irq_probe(struct platform_device *pdev)
220219
struct platform_device *pmic_pdev;
221220
struct device *dev = &pdev->dev;
222221
struct hi6421v600_irq *priv;
223-
struct hi6421_spmi_pmic *pmic;
222+
struct regmap *regmap;
224223
unsigned int virq;
225224
int i, ret;
226225

@@ -229,16 +228,16 @@ static int hi6421v600_irq_probe(struct platform_device *pdev)
229228
* which should first set drvdata. If this doesn't happen, hit
230229
* a warn on and return.
231230
*/
232-
pmic = dev_get_drvdata(pmic_dev);
233-
if (WARN_ON(!pmic))
231+
regmap = dev_get_drvdata(pmic_dev);
232+
if (WARN_ON(!regmap))
234233
return -ENODEV;
235234

236235
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
237236
if (!priv)
238237
return -ENOMEM;
239238

240239
priv->dev = dev;
241-
priv->regmap = pmic->regmap;
240+
priv->regmap = regmap;
242241

243242
spin_lock_init(&priv->lock);
244243

‎drivers/regulator/hi6421v600-regulator.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// Guodong Xu <guodong.xu@linaro.org>
1010

1111
#include <linux/delay.h>
12-
#include <linux/mfd/hi6421-spmi-pmic.h>
1312
#include <linux/module.h>
13+
#include <linux/of.h>
1414
#include <linux/platform_device.h>
1515
#include <linux/regmap.h>
1616
#include <linux/regulator/driver.h>
@@ -237,7 +237,7 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev)
237237
struct hi6421_spmi_reg_priv *priv;
238238
struct hi6421_spmi_reg_info *info;
239239
struct device *dev = &pdev->dev;
240-
struct hi6421_spmi_pmic *pmic;
240+
struct regmap *regmap;
241241
struct regulator_dev *rdev;
242242
int i;
243243

@@ -246,8 +246,8 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev)
246246
* which should first set drvdata. If this doesn't happen, hit
247247
* a warn on and return.
248248
*/
249-
pmic = dev_get_drvdata(pmic_dev);
250-
if (WARN_ON(!pmic))
249+
regmap = dev_get_drvdata(pmic_dev);
250+
if (WARN_ON(!regmap))
251251
return -ENODEV;
252252

253253
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -261,7 +261,7 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev)
261261

262262
config.dev = pdev->dev.parent;
263263
config.driver_data = priv;
264-
config.regmap = pmic->regmap;
264+
config.regmap = regmap;
265265

266266
rdev = devm_regulator_register(dev, &info->desc, &config);
267267
if (IS_ERR(rdev)) {

‎include/linux/mfd/hi6421-spmi-pmic.h‎

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)