Skip to contentSkip to conversation

mfd: mc13xxx: Remove useless symbol MFD_MC13783

PATCH Applied Alexander Shiyan 2 participants 8 messages Dec 14, 2013 – Dec 16, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 mfd: mc13xxx: Remove useless symbol MFD_MC13783

Symbol MFD_MC13783 always selected by MFD_MC13XXX, so no need to keep additional symbol.

---
 drivers/input/misc/Kconfig        | 2 +-
 drivers/input/touchscreen/Kconfig | 2 +-
 drivers/mfd/Kconfig               | 4 ----
 drivers/regulator/Kconfig         | 2 +-
 sound/soc/fsl/Kconfig             | 2 +-
 5 files changed, 4 insertions(+), 8 deletions(-)
drivers/input/misc/Kconfig +1 -1
index 4ffc397..7904ab0 100644
@@ -168,7 +168,7 @@ config INPUT_MAX8997_HAPTIC
 
 config INPUT_MC13783_PWRBUTTON
 	tristate "MC13783 ON buttons"
-	depends on MFD_MC13783
+	depends on MFD_MC13XXX
 	help
 	  Support the ON buttons of MC13783 PMIC as an input device
 	  reporting power button status.
drivers/input/touchscreen/Kconfig +1 -1
index 961d58d..07e9e82 100644
@@ -717,7 +717,7 @@ config TOUCHSCREEN_USB_COMPOSITE
 
 config TOUCHSCREEN_MC13783
 	tristate "Freescale MC13783 touchscreen input driver"
-	depends on MFD_MC13783
+	depends on MFD_MC13XXX
 	help
 	  Say Y here if you have an Freescale MC13783 PMIC on your
 	  board and want to use its touchscreen
drivers/mfd/Kconfig +0 -4
index 58ed055..49bb445 100644
@@ -163,14 +163,10 @@ config MFD_DA9063
 	  Additional drivers must be enabled in order to use the functionality
 	  of the device.
 
-config MFD_MC13783
-	tristate
-
 config MFD_MC13XXX
 	tristate
 	depends on (SPI_MASTER || I2C)
 	select MFD_CORE
-	select MFD_MC13783
 	help
 	  Enable support for the Freescale MC13783 and MC13892 PMICs.
 	  This driver provides common support for accessing the device,
drivers/regulator/Kconfig +1 -1
index ce785f4..db9ae6f 100644
@@ -343,7 +343,7 @@ config REGULATOR_MC13XXX_CORE
 
 config REGULATOR_MC13783
 	tristate "Freescale MC13783 regulator driver"
-	depends on MFD_MC13783
+	depends on MFD_MC13XXX
 	select REGULATOR_MC13XXX_CORE
 	help
 	  Say y here to support the regulators found on the Freescale MC13783
sound/soc/fsl/Kconfig +1 -1
index b7ab71f..5b44c5c 100644
@@ -206,7 +206,7 @@ config SND_SOC_IMX_SPDIF
 
 config SND_SOC_IMX_MC13783
 	tristate "SoC Audio support for I.MX boards with mc13783"
-	depends on MFD_MC13783 && ARM
+	depends on MFD_MC13XXX && ARM
 	select SND_SOC_IMX_SSI
 	select SND_SOC_IMX_AUDMUX
 	select SND_SOC_MC13783
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 2/3 mfd: mc13xxx: Remove duplicate mc13xxx_get_flags() declaration

mc13xxx_get_flags() declaration given twice.
This patch removes this duplicate.

---
 include/linux/mfd/mc13xxx.h | 2 --
 1 file changed, 2 deletions(-)
include/linux/mfd/mc13xxx.h +0 -2
index f1b13b3..a326c85 100644
@@ -21,8 +21,6 @@ int mc13xxx_reg_write(struct mc13xxx *mc13xxx, unsigned int offset, u32 val);
 int mc13xxx_reg_rmw(struct mc13xxx *mc13xxx, unsigned int offset,
 		u32 mask, u32 val);
 
-int mc13xxx_get_flags(struct mc13xxx *mc13xxx);
-
 int mc13xxx_irq_request(struct mc13xxx *mc13xxx, int irq,
 		irq_handler_t handler, const char *name, void *dev);
 int mc13xxx_irq_request_nounmask(struct mc13xxx *mc13xxx, int irq,
Signature · 1 line
1.8.3.2
Applied
#2 lore raw

Re: [PATCH 2/3] mfd: mc13xxx: Remove duplicate mc13xxx_get_flags() declaration

Quoted 7 lines · Alexander Shiyan

mc13xxx_get_flags() declaration given twice.
This patch removes this duplicate.

---
 include/linux/mfd/mc13xxx.h | 2 --
 1 file changed, 2 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#3 lore raw

PATCH 3/3 mfd: mc13xxx: Simplify "probe" & "remove"

In reply to Alexander Shiyan

This patch simplifies "probe" and "remove" functions by moving some initialization code in the driver core.

---
 drivers/mfd/mc13xxx-core.c | 36 +++++++++++++++++-------------------
 drivers/mfd/mc13xxx-i2c.c  | 18 ++++--------------
 drivers/mfd/mc13xxx-spi.c  | 19 ++++++-------------
 drivers/mfd/mc13xxx.h      |  6 ++----
 4 files changed, 29 insertions(+), 50 deletions(-)
drivers/mfd/mc13xxx-core.c +17 -19
index b0c7cb0..06e64b6 100644
@@ -636,42 +636,36 @@ static inline int mc13xxx_probe_flags_dt(struct mc13xxx *mc13xxx)
 }
 #endif
 
-int mc13xxx_common_init(struct mc13xxx *mc13xxx,
-		struct mc13xxx_platform_data *pdata, int irq)
+int mc13xxx_common_init(struct device *dev)
 {
+	struct mc13xxx_platform_data *pdata = dev_get_platdata(dev);
+	struct mc13xxx *mc13xxx = dev_get_drvdata(dev);
 	int ret;
 	u32 revision;
 
-	mc13xxx_lock(mc13xxx);
+	mc13xxx->dev = dev;
 
 	ret = mc13xxx_reg_read(mc13xxx, MC13XXX_REVISION, &revision);
 	if (ret)
-		goto err_revision;
+		return ret;
 
 	mc13xxx->variant->print_revision(mc13xxx, revision);
 
 	/* mask all irqs */
 	ret = mc13xxx_reg_write(mc13xxx, MC13XXX_IRQMASK0, 0x00ffffff);
 	if (ret)
-		goto err_mask;
+		return ret;
 
 	ret = mc13xxx_reg_write(mc13xxx, MC13XXX_IRQMASK1, 0x00ffffff);
 	if (ret)
-		goto err_mask;
+		return ret;
 
-	ret = request_threaded_irq(irq, NULL, mc13xxx_irq_thread,
+	ret = request_threaded_irq(mc13xxx->irq, NULL, mc13xxx_irq_thread,
 			IRQF_ONESHOT | IRQF_TRIGGER_HIGH, "mc13xxx", mc13xxx);
-
-	if (ret) {
-err_mask:
-err_revision:
-		mc13xxx_unlock(mc13xxx);
+	if (ret)
 		return ret;
-	}
-
-	mc13xxx->irq = irq;
 
-	mc13xxx_unlock(mc13xxx);
+	mutex_init(&mc13xxx->lock);
 
 	if (mc13xxx_probe_flags_dt(mc13xxx) < 0 && pdata)
 		mc13xxx->flags = pdata->flags;
@@ -707,13 +701,17 @@ err_revision:
 }
 EXPORT_SYMBOL_GPL(mc13xxx_common_init);
 
-void mc13xxx_common_cleanup(struct mc13xxx *mc13xxx)
+int mc13xxx_common_exit(struct device *dev)
 {
+	struct mc13xxx *mc13xxx = dev_get_drvdata(dev);
+
 	free_irq(mc13xxx->irq, mc13xxx);
+	mfd_remove_devices(dev);
+	mutex_destroy(&mc13xxx->lock);
 
-	mfd_remove_devices(mc13xxx->dev);
+	return 0;
 }
-EXPORT_SYMBOL_GPL(mc13xxx_common_cleanup);
+EXPORT_SYMBOL_GPL(mc13xxx_common_exit);
 
 MODULE_DESCRIPTION("Core driver for Freescale MC13XXX PMIC");
 MODULE_AUTHOR("Uwe Kleine-Koenig <[email protected]>");
drivers/mfd/mc13xxx-i2c.c +4 -14
index 898bd33..ae3addb 100644
@@ -10,7 +10,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
-#include <linux/mutex.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/mc13xxx.h>
 #include <linux/of.h>
@@ -60,7 +59,6 @@ static int mc13xxx_i2c_probe(struct i2c_client *client,
 		const struct i2c_device_id *id)
 {
 	struct mc13xxx *mc13xxx;
-	struct mc13xxx_platform_data *pdata = dev_get_platdata(&client->dev);
 	int ret;
 
 	mc13xxx = devm_kzalloc(&client->dev, sizeof(*mc13xxx), GFP_KERNEL);
@@ -69,15 +67,13 @@ static int mc13xxx_i2c_probe(struct i2c_client *client,
 
 	dev_set_drvdata(&client->dev, mc13xxx);
 
-	mc13xxx->dev = &client->dev;
-	mutex_init(&mc13xxx->lock);
+	mc13xxx->irq = client->irq;
 
 	mc13xxx->regmap = devm_regmap_init_i2c(client,
 					       &mc13xxx_regmap_i2c_config);
 	if (IS_ERR(mc13xxx->regmap)) {
 		ret = PTR_ERR(mc13xxx->regmap);
-		dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n",
-				ret);
+		dev_err(&client->dev, "Failed to initialize regmap: %d\n", ret);
 		return ret;
 	}
 
@@ -89,18 +85,12 @@ static int mc13xxx_i2c_probe(struct i2c_client *client,
 		mc13xxx->variant = (void *)id->driver_data;
 	}
 
-	ret = mc13xxx_common_init(mc13xxx, pdata, client->irq);
-
-	return ret;
+	return mc13xxx_common_init(&client->dev);
 }
 
 static int mc13xxx_i2c_remove(struct i2c_client *client)
 {
-	struct mc13xxx *mc13xxx = dev_get_drvdata(&client->dev);
-
-	mc13xxx_common_cleanup(mc13xxx);
-
-	return 0;
+	return mc13xxx_common_exit(&client->dev);
 }
 
 static struct i2c_driver mc13xxx_i2c_driver = {
drivers/mfd/mc13xxx-spi.c +6 -13
index cbcc86d..38ab678 100644
@@ -13,7 +13,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
-#include <linux/mutex.h>
 #include <linux/interrupt.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/mc13xxx.h>
@@ -129,26 +128,24 @@ static struct regmap_bus regmap_mc13xxx_bus = {
 static int mc13xxx_spi_probe(struct spi_device *spi)
 {
 	struct mc13xxx *mc13xxx;
-	struct mc13xxx_platform_data *pdata = dev_get_platdata(&spi->dev);
 	int ret;
 
 	mc13xxx = devm_kzalloc(&spi->dev, sizeof(*mc13xxx), GFP_KERNEL);
 	if (!mc13xxx)
 		return -ENOMEM;
 
-	spi_set_drvdata(spi, mc13xxx);
+	dev_set_drvdata(&spi->dev, mc13xxx);
+
 	spi->mode = SPI_MODE_0 | SPI_CS_HIGH;
 
-	mc13xxx->dev = &spi->dev;
-	mutex_init(&mc13xxx->lock);
+	mc13xxx->irq = spi->irq;
 
 	mc13xxx->regmap = devm_regmap_init(&spi->dev, &regmap_mc13xxx_bus,
 					   &spi->dev,
 					   &mc13xxx_regmap_spi_config);
 	if (IS_ERR(mc13xxx->regmap)) {
 		ret = PTR_ERR(mc13xxx->regmap);
-		dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n",
-				ret);
+		dev_err(&spi->dev, "Failed to initialize regmap: %d\n", ret);
 		return ret;
 	}
 
@@ -163,16 +160,12 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
 		mc13xxx->variant = (void *)id_entry->driver_data;
 	}
 
-	return mc13xxx_common_init(mc13xxx, pdata, spi->irq);
+	return mc13xxx_common_init(&spi->dev);
 }
 
 static int mc13xxx_spi_remove(struct spi_device *spi)
 {
-	struct mc13xxx *mc13xxx = spi_get_drvdata(spi);
-
-	mc13xxx_common_cleanup(mc13xxx);
-
-	return 0;
+	return mc13xxx_common_exit(&spi->dev);
 }
 
 static struct spi_driver mc13xxx_spi_driver = {
drivers/mfd/mc13xxx.h +2 -4
index 460ec5c..ae7f165 100644
@@ -43,9 +43,7 @@ struct mc13xxx {
 	int adcflags;
 };
 
-int mc13xxx_common_init(struct mc13xxx *mc13xxx,
-		struct mc13xxx_platform_data *pdata, int irq);
-
-void mc13xxx_common_cleanup(struct mc13xxx *mc13xxx);
+int mc13xxx_common_init(struct device *dev);
+int mc13xxx_common_exit(struct device *dev);
 
 #endif /* __DRIVERS_MFD_MC13XXX_H */
Signature · 1 line
1.8.3.2
#4 lore raw

Re: [PATCH 3/3] mfd: mc13xxx: Simplify "probe" & "remove"

Quoted 15 lines

This patch simplifies "probe" and "remove" functions by moving some initialization code in the driver core.

---
 drivers/mfd/mc13xxx-core.c | 36 +++++++++++++++++-------------------
 drivers/mfd/mc13xxx-i2c.c  | 18 ++++--------------
 drivers/mfd/mc13xxx-spi.c  | 19 ++++++-------------
 drivers/mfd/mc13xxx.h      |  6 ++----
 4 files changed, 29 insertions(+), 50 deletions(-)
drivers/mfd/mc13xxx-core.c +0 -0
index b0c7cb0..06e64b6 100644

<snip>

drivers/mfd/mc13xxx-core.c static inline int mc13xxx_probe_flags_dt(struct mc13xxx *mc13xxx) · line 664

Quoted 3 lines
drivers/mfd/mc13xxx-core.c +1 -1
-	ret = request_threaded_irq(irq, NULL, mc13xxx_irq_thread,
+	ret = request_threaded_irq(mc13xxx->irq, NULL, mc13xxx_irq_thread,
 			IRQF_ONESHOT | IRQF_TRIGGER_HIGH, "mc13xxx", mc13xxx);

Please use devm_* managed resources, then you can remove the free_irq().

<snip>

drivers/mfd/mc13xxx-core.c err_revision: · line 708

Quoted 6 lines
drivers/mfd/mc13xxx-core.c +3 -1
-void mc13xxx_common_cleanup(struct mc13xxx *mc13xxx)
+int mc13xxx_common_exit(struct device *dev)
 {
+	struct mc13xxx *mc13xxx = dev_get_drvdata(dev);
+
 	free_irq(mc13xxx->irq, mc13xxx);

Here.

drivers/mfd/mc13xxx-core.c

Quoted 3 lines
drivers/mfd/mc13xxx-core.c +2 -1
-	spi_set_drvdata(spi, mc13xxx);
+	dev_set_drvdata(&spi->dev, mc13xxx);
+

What's the point of this? It does the same thing?

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#5 lore raw

Re: [PATCH 3/3] mfd: mc13xxx: Simplify "probe" & "remove"

Quoted 18 lines
Quoted 15 lines

This patch simplifies "probe" and "remove" functions by moving some initialization code in the driver core.

---
 drivers/mfd/mc13xxx-core.c | 36 +++++++++++++++++-------------------
 drivers/mfd/mc13xxx-i2c.c  | 18 ++++--------------
 drivers/mfd/mc13xxx-spi.c  | 19 ++++++-------------
 drivers/mfd/mc13xxx.h      |  6 ++----
 4 files changed, 29 insertions(+), 50 deletions(-)
drivers/mfd/mc13xxx-core.c +0 -0
index b0c7cb0..06e64b6 100644

<snip>

Quoted 5 lines

drivers/mfd/mc13xxx-core.c static inline int mc13xxx_probe_flags_dt(struct mc13xxx *mc13xxx) · line 664

Quoted 3 lines
drivers/mfd/mc13xxx-core.c +1 -1
-	ret = request_threaded_irq(irq, NULL, mc13xxx_irq_thread,
+	ret = request_threaded_irq(mc13xxx->irq, NULL, mc13xxx_irq_thread,
 			IRQF_ONESHOT | IRQF_TRIGGER_HIGH, "mc13xxx", mc13xxx);

Please use devm_* managed resources, then you can remove the free_irq().

Using devm-* is not possible at this time since we need to avoid interrupts before removing mc13xxx childs.
This could be converted to use devm-* functions once we migrate to IRQ domains. I work on this now.

---
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

#6 lore raw

Re: [PATCH 3/3] mfd: mc13xxx: Simplify "probe" & "remove"

In reply to Alexander Shiyan
Quoted 10 lines · Alexander Shiyan

This patch simplifies "probe" and "remove" functions by moving some initialization code in the driver core.

---
 drivers/mfd/mc13xxx-core.c | 36 +++++++++++++++++-------------------
 drivers/mfd/mc13xxx-i2c.c  | 18 ++++--------------
 drivers/mfd/mc13xxx-spi.c  | 19 ++++++-------------
 drivers/mfd/mc13xxx.h      |  6 ++----
 4 files changed, 29 insertions(+), 50 deletions(-)

I've changed the commit message a little and applied the patch.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
Applied
#7 lore raw
In reply to Alexander Shiyan
Quoted 4 lines

Symbol MFD_MC13783 always selected by MFD_MC13XXX, so no need to keep additional symbol.

Quoted 8 lines
---
 drivers/input/misc/Kconfig        | 2 +-
 drivers/input/touchscreen/Kconfig | 2 +-
 drivers/mfd/Kconfig               | 4 ----
 drivers/regulator/Kconfig         | 2 +-
 sound/soc/fsl/Kconfig             | 2 +-
 5 files changed, 4 insertions(+), 8 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog