linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mfd: Convert s5m core driver to use devm_kzalloc()
@ 2012-01-20  7:09 Sangbeom Kim
  2012-01-20  7:09 ` [PATCH 2/2] mfd: Add support for multiple s5m devices Sangbeom Kim
  2012-02-20 16:52 ` [PATCH 1/2] mfd: Convert s5m core driver to use devm_kzalloc() Samuel Ortiz
  0 siblings, 2 replies; 5+ messages in thread
From: Sangbeom Kim @ 2012-01-20  7:09 UTC (permalink / raw)
  To: sameo, linux-kernel; +Cc: broonie, Sangbeom Kim

Convert s5m core driver to use devm_kzalloc().

Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
---
 drivers/mfd/s5m-core.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/s5m-core.c b/drivers/mfd/s5m-core.c
index e075c11..38bd353 100644
--- a/drivers/mfd/s5m-core.c
+++ b/drivers/mfd/s5m-core.c
@@ -77,7 +77,8 @@ static int s5m87xx_i2c_probe(struct i2c_client *i2c,
 	int ret = 0;
 	int error;
 
-	s5m87xx = kzalloc(sizeof(struct s5m87xx_dev), GFP_KERNEL);
+	s5m87xx = devm_kzalloc(&i2c->dev, sizeof(struct s5m87xx_dev),
+				GFP_KERNEL);
 	if (s5m87xx == NULL)
 		return -ENOMEM;
 
@@ -126,7 +127,6 @@ err:
 	s5m_irq_exit(s5m87xx);
 	i2c_unregister_device(s5m87xx->rtc);
 	regmap_exit(s5m87xx->regmap);
-	kfree(s5m87xx);
 	return ret;
 }
 
@@ -138,7 +138,6 @@ static int s5m87xx_i2c_remove(struct i2c_client *i2c)
 	s5m_irq_exit(s5m87xx);
 	i2c_unregister_device(s5m87xx->rtc);
 	regmap_exit(s5m87xx->regmap);
-	kfree(s5m87xx);
 	return 0;
 }
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] mfd: Add support for multiple s5m devices
  2012-01-20  7:09 [PATCH 1/2] mfd: Convert s5m core driver to use devm_kzalloc() Sangbeom Kim
@ 2012-01-20  7:09 ` Sangbeom Kim
  2012-01-20 18:23   ` Mark Brown
  2012-02-20 16:54   ` Samuel Ortiz
  2012-02-20 16:52 ` [PATCH 1/2] mfd: Convert s5m core driver to use devm_kzalloc() Samuel Ortiz
  1 sibling, 2 replies; 5+ messages in thread
From: Sangbeom Kim @ 2012-01-20  7:09 UTC (permalink / raw)
  To: sameo, linux-kernel; +Cc: broonie, Sangbeom Kim

There are many samsung mfd devices.
The s5m core driver try to support various samsung s5m series.
It will cover S5M8767A and S5M8763 and S5M8751.
This patch is enable to support various s5m series.

Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
---
 drivers/mfd/s5m-core.c |   42 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/s5m-core.c b/drivers/mfd/s5m-core.c
index 38bd353..7daef55 100644
--- a/drivers/mfd/s5m-core.c
+++ b/drivers/mfd/s5m-core.c
@@ -26,7 +26,27 @@
 #include <linux/mfd/s5m87xx/s5m-rtc.h>
 #include <linux/regmap.h>
 
-static struct mfd_cell s5m87xx_devs[] = {
+static struct mfd_cell s5m8751_devs[] = {
+	{
+		.name = "s5m8751-pmic",
+	}, {
+		.name = "s5m-charger",
+	}, {
+		.name = "s5m8751-codec",
+	},
+};
+
+static struct mfd_cell s5m8763_devs[] = {
+	{
+		.name = "s5m8763-pmic",
+	}, {
+		.name = "s5m-rtc",
+	}, {
+		.name = "s5m-charger",
+	},
+};
+
+static struct mfd_cell s5m8767_devs[] = {
 	{
 		.name = "s5m8767-pmic",
 	}, {
@@ -113,9 +133,23 @@ static int s5m87xx_i2c_probe(struct i2c_client *i2c,
 
 	pm_runtime_set_active(s5m87xx->dev);
 
-	ret = mfd_add_devices(s5m87xx->dev, -1,
-				s5m87xx_devs, ARRAY_SIZE(s5m87xx_devs),
-				NULL, 0);
+	switch (s5m87xx->device_type) {
+	case S5M8751X:
+		ret = mfd_add_devices(s5m87xx->dev, -1, s5m8751_devs,
+					ARRAY_SIZE(s5m8751_devs), NULL, 0);
+		break;
+	case S5M8763X:
+		ret = mfd_add_devices(s5m87xx->dev, -1, s5m8763_devs,
+					ARRAY_SIZE(s5m8763_devs), NULL, 0);
+		break;
+	case S5M8767X:
+		ret = mfd_add_devices(s5m87xx->dev, -1, s5m8767_devs,
+					ARRAY_SIZE(s5m8767_devs), NULL, 0);
+		break;
+	default:
+		/* If this happens the probe function is problem */
+		BUG();
+	}
 
 	if (ret < 0)
 		goto err;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] mfd: Add support for multiple s5m devices
  2012-01-20  7:09 ` [PATCH 2/2] mfd: Add support for multiple s5m devices Sangbeom Kim
@ 2012-01-20 18:23   ` Mark Brown
  2012-02-20 16:54   ` Samuel Ortiz
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2012-01-20 18:23 UTC (permalink / raw)
  To: Sangbeom Kim; +Cc: sameo, linux-kernel

On Fri, Jan 20, 2012 at 04:09:12PM +0900, Sangbeom Kim wrote:

Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

> +	switch (s5m87xx->device_type) {
> +	case S5M8751X:
> +		ret = mfd_add_devices(s5m87xx->dev, -1, s5m8751_devs,
> +					ARRAY_SIZE(s5m8751_devs), NULL, 0);
> +		break;

Does the hardware have ID registers you can use to confirm if the user
got the right device?  Cut'n'pasting of machine definitions can be a bit
error prone.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] mfd: Convert s5m core driver to use devm_kzalloc()
  2012-01-20  7:09 [PATCH 1/2] mfd: Convert s5m core driver to use devm_kzalloc() Sangbeom Kim
  2012-01-20  7:09 ` [PATCH 2/2] mfd: Add support for multiple s5m devices Sangbeom Kim
@ 2012-02-20 16:52 ` Samuel Ortiz
  1 sibling, 0 replies; 5+ messages in thread
From: Samuel Ortiz @ 2012-02-20 16:52 UTC (permalink / raw)
  To: Sangbeom Kim; +Cc: linux-kernel, broonie

Hi Sangbeom,

On Fri, Jan 20, 2012 at 04:09:11PM +0900, Sangbeom Kim wrote:
> Convert s5m core driver to use devm_kzalloc().
Thanks, patch applied.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] mfd: Add support for multiple s5m devices
  2012-01-20  7:09 ` [PATCH 2/2] mfd: Add support for multiple s5m devices Sangbeom Kim
  2012-01-20 18:23   ` Mark Brown
@ 2012-02-20 16:54   ` Samuel Ortiz
  1 sibling, 0 replies; 5+ messages in thread
From: Samuel Ortiz @ 2012-02-20 16:54 UTC (permalink / raw)
  To: Sangbeom Kim; +Cc: linux-kernel, broonie

Hi Sangbeom,

On Fri, Jan 20, 2012 at 04:09:12PM +0900, Sangbeom Kim wrote:
> There are many samsung mfd devices.
> The s5m core driver try to support various samsung s5m series.
> It will cover S5M8767A and S5M8763 and S5M8751.
> This patch is enable to support various s5m series.
Patch applied as well, thanks.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-02-20 16:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-20  7:09 [PATCH 1/2] mfd: Convert s5m core driver to use devm_kzalloc() Sangbeom Kim
2012-01-20  7:09 ` [PATCH 2/2] mfd: Add support for multiple s5m devices Sangbeom Kim
2012-01-20 18:23   ` Mark Brown
2012-02-20 16:54   ` Samuel Ortiz
2012-02-20 16:52 ` [PATCH 1/2] mfd: Convert s5m core driver to use devm_kzalloc() Samuel Ortiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).