Linux-Samsung-soc Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2 1/7] mfd: max8997: Simplify getting of_device_id match data
@ 2021-04-20 11:39 Krzysztof Kozlowski
  2021-04-20 11:39 ` [PATCH v2 2/7] mfd: max8998: " Krzysztof Kozlowski
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 11:39 UTC (permalink / raw)
  To: Support Opensource, Lee Jones, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches
  Cc: Marek Szyprowski, Sylwester Nawrocki

Use of_device_get_match_data() to make the code slightly smaller.  There
is also no need to wrap it in a check for CONFIG_OF, because dev.of_node
will be set only with OF support.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

---

Changes since v1:
1. Remove check for CONFIG_OF
---
 drivers/mfd/max8997.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c
index 68d8f2b95287..2141de78115d 100644
--- a/drivers/mfd/max8997.c
+++ b/drivers/mfd/max8997.c
@@ -11,6 +11,7 @@
 #include <linux/slab.h>
 #include <linux/i2c.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/interrupt.h>
 #include <linux/pm_runtime.h>
@@ -145,11 +146,9 @@ static struct max8997_platform_data *max8997_i2c_parse_dt_pdata(
 static inline unsigned long max8997_i2c_get_driver_data(struct i2c_client *i2c,
 						const struct i2c_device_id *id)
 {
-	if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node) {
-		const struct of_device_id *match;
-		match = of_match_node(max8997_pmic_dt_match, i2c->dev.of_node);
-		return (unsigned long)match->data;
-	}
+	if (i2c->dev.of_node)
+		return (unsigned long)of_device_get_match_data(&i2c->dev);
+
 	return id->driver_data;
 }
 
-- 
2.25.1


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

* [PATCH v2 2/7] mfd: max8998: Simplify getting of_device_id match data
  2021-04-20 11:39 [PATCH v2 1/7] mfd: max8997: Simplify getting of_device_id match data Krzysztof Kozlowski
@ 2021-04-20 11:39 ` Krzysztof Kozlowski
  2021-04-20 11:39 ` [PATCH v2 3/7] mfd: da9052: " Krzysztof Kozlowski
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 11:39 UTC (permalink / raw)
  To: Support Opensource, Lee Jones, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches
  Cc: Marek Szyprowski, Sylwester Nawrocki

Use of_device_get_match_data() to make the code slightly smaller.  There
is also no need to wrap it in a check for CONFIG_OF, because dev.of_node
will be set only with OF support.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

---

Changes since v1:
1. Remove check for CONFIG_OF
---
 drivers/mfd/max8998.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c
index 785f8e9841b7..0eb15e611b67 100644
--- a/drivers/mfd/max8998.c
+++ b/drivers/mfd/max8998.c
@@ -12,6 +12,7 @@
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/pm_runtime.h>
 #include <linux/mutex.h>
@@ -155,11 +156,8 @@ static struct max8998_platform_data *max8998_i2c_parse_dt_pdata(
 static inline unsigned long max8998_i2c_get_driver_data(struct i2c_client *i2c,
 						const struct i2c_device_id *id)
 {
-	if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node) {
-		const struct of_device_id *match;
-		match = of_match_node(max8998_dt_match, i2c->dev.of_node);
-		return (unsigned long)match->data;
-	}
+	if (i2c->dev.of_node)
+		return (unsigned long)of_device_get_match_data(&i2c->dev);
 
 	return id->driver_data;
 }
-- 
2.25.1


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

* [PATCH v2 3/7] mfd: da9052: Simplify getting of_device_id match data
  2021-04-20 11:39 [PATCH v2 1/7] mfd: max8997: Simplify getting of_device_id match data Krzysztof Kozlowski
  2021-04-20 11:39 ` [PATCH v2 2/7] mfd: max8998: " Krzysztof Kozlowski
@ 2021-04-20 11:39 ` Krzysztof Kozlowski
  2021-04-20 11:39 ` [PATCH v2 4/7] mfd: da9062: " Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 11:39 UTC (permalink / raw)
  To: Support Opensource, Lee Jones, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches
  Cc: Marek Szyprowski, Sylwester Nawrocki, Adam Thomson

Use of_device_get_match_data() to make the code slightly smaller.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

---

Changes since v1:
1. Add Ack
---
 drivers/mfd/da9052-i2c.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c
index 47556d2d9abe..5d8ce8dca3fc 100644
--- a/drivers/mfd/da9052-i2c.c
+++ b/drivers/mfd/da9052-i2c.c
@@ -154,13 +154,8 @@ static int da9052_i2c_probe(struct i2c_client *client,
 		return ret;
 
 #ifdef CONFIG_OF
-	if (!id) {
-		struct device_node *np = client->dev.of_node;
-		const struct of_device_id *deviceid;
-
-		deviceid = of_match_node(dialog_dt_ids, np);
-		id = deviceid->data;
-	}
+	if (!id)
+		id = of_device_get_match_data(&client->dev);
 #endif
 
 	if (!id) {
-- 
2.25.1


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

* [PATCH v2 4/7] mfd: da9062: Simplify getting of_device_id match data
  2021-04-20 11:39 [PATCH v2 1/7] mfd: max8997: Simplify getting of_device_id match data Krzysztof Kozlowski
  2021-04-20 11:39 ` [PATCH v2 2/7] mfd: max8998: " Krzysztof Kozlowski
  2021-04-20 11:39 ` [PATCH v2 3/7] mfd: da9052: " Krzysztof Kozlowski
@ 2021-04-20 11:39 ` Krzysztof Kozlowski
  2021-04-20 11:39 ` [PATCH v2 5/7] mfd: sec: " Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 11:39 UTC (permalink / raw)
  To: Support Opensource, Lee Jones, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches
  Cc: Marek Szyprowski, Sylwester Nawrocki, Adam Thomson

Use of_device_get_match_data() to make the code slightly smaller.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

---

Changes since v1:
1. Add Ack
2. Correct subject prefix
---
 drivers/mfd/da9062-core.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
index 8d913375152d..01f8e10dfa55 100644
--- a/drivers/mfd/da9062-core.c
+++ b/drivers/mfd/da9062-core.c
@@ -9,6 +9,7 @@
 #include <linux/init.h>
 #include <linux/device.h>
 #include <linux/interrupt.h>
+#include <linux/of_device.h>
 #include <linux/regmap.h>
 #include <linux/irq.h>
 #include <linux/mfd/core.h>
@@ -622,7 +623,6 @@ static int da9062_i2c_probe(struct i2c_client *i2c,
 	const struct i2c_device_id *id)
 {
 	struct da9062 *chip;
-	const struct of_device_id *match;
 	unsigned int irq_base;
 	const struct mfd_cell *cell;
 	const struct regmap_irq_chip *irq_chip;
@@ -635,15 +635,10 @@ static int da9062_i2c_probe(struct i2c_client *i2c,
 	if (!chip)
 		return -ENOMEM;
 
-	if (i2c->dev.of_node) {
-		match = of_match_node(da9062_dt_ids, i2c->dev.of_node);
-		if (!match)
-			return -EINVAL;
-
-		chip->chip_type = (uintptr_t)match->data;
-	} else {
+	if (i2c->dev.of_node)
+		chip->chip_type = (uintptr_t)of_device_get_match_data(&i2c->dev);
+	else
 		chip->chip_type = id->driver_data;
-	}
 
 	i2c_set_clientdata(i2c, chip);
 	chip->dev = &i2c->dev;
-- 
2.25.1


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

* [PATCH v2 5/7] mfd: sec: Simplify getting of_device_id match data
  2021-04-20 11:39 [PATCH v2 1/7] mfd: max8997: Simplify getting of_device_id match data Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2021-04-20 11:39 ` [PATCH v2 4/7] mfd: da9062: " Krzysztof Kozlowski
@ 2021-04-20 11:39 ` Krzysztof Kozlowski
  2021-04-20 11:39 ` [PATCH v2 6/7] mfd: wm831x: Correct kerneldoc Krzysztof Kozlowski
  2021-04-20 11:39 ` [PATCH v2 7/7] mfd: twl: " Krzysztof Kozlowski
  5 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 11:39 UTC (permalink / raw)
  To: Support Opensource, Lee Jones, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches
  Cc: Marek Szyprowski, Sylwester Nawrocki

Use of_device_get_match_data() to make the code slightly smaller.  There
is also no need to wrap it in a check for CONFIG_OF, because dev.of_node
will be set only with OF support.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

---

Changes since v1:
1. Remove check for CONFIG_OF as suggested by Marek
---
 drivers/mfd/sec-core.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 8d55992da19e..15dd4c579937 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -10,6 +10,7 @@
 #include <linux/slab.h>
 #include <linux/i2c.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/interrupt.h>
 #include <linux/pm_runtime.h>
@@ -323,14 +324,9 @@ sec_pmic_i2c_parse_dt_pdata(struct device *dev)
 static inline unsigned long sec_i2c_get_driver_data(struct i2c_client *i2c,
 						const struct i2c_device_id *id)
 {
-#ifdef CONFIG_OF
-	if (i2c->dev.of_node) {
-		const struct of_device_id *match;
+	if (i2c->dev.of_node)
+		return (unsigned long)of_device_get_match_data(&i2c->dev);
 
-		match = of_match_node(sec_dt_match, i2c->dev.of_node);
-		return (unsigned long)match->data;
-	}
-#endif
 	return id->driver_data;
 }
 
-- 
2.25.1


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

* [PATCH v2 6/7] mfd: wm831x: Correct kerneldoc
  2021-04-20 11:39 [PATCH v2 1/7] mfd: max8997: Simplify getting of_device_id match data Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2021-04-20 11:39 ` [PATCH v2 5/7] mfd: sec: " Krzysztof Kozlowski
@ 2021-04-20 11:39 ` Krzysztof Kozlowski
  2021-04-23  8:05   ` Lee Jones
  2021-04-20 11:39 ` [PATCH v2 7/7] mfd: twl: " Krzysztof Kozlowski
  5 siblings, 1 reply; 9+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 11:39 UTC (permalink / raw)
  To: Support Opensource, Lee Jones, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches
  Cc: Marek Szyprowski, Sylwester Nawrocki, Charles Keepax

Correct kerneldoc function name to fix W=1 warning:

  drivers/mfd/wm831x-core.c:121: warning:
    expecting prototype for wm831x_reg_unlock(). Prototype was for wm831x_reg_lock() instead

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

---

Changes since v1:
1. Add Ack
---
 drivers/mfd/wm831x-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index bcef08f58fb3..c31809b17547 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -109,7 +109,7 @@ static int wm831x_reg_locked(struct wm831x *wm831x, unsigned short reg)
 }
 
 /**
- * wm831x_reg_unlock: Unlock user keyed registers
+ * wm831x_reg_lock: Unlock user keyed registers
  *
  * The WM831x has a user key preventing writes to particularly
  * critical registers.  This function locks those registers,
-- 
2.25.1


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

* [PATCH v2 7/7] mfd: twl: Correct kerneldoc
  2021-04-20 11:39 [PATCH v2 1/7] mfd: max8997: Simplify getting of_device_id match data Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2021-04-20 11:39 ` [PATCH v2 6/7] mfd: wm831x: Correct kerneldoc Krzysztof Kozlowski
@ 2021-04-20 11:39 ` Krzysztof Kozlowski
  2021-04-23  8:04   ` Lee Jones
  5 siblings, 1 reply; 9+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 11:39 UTC (permalink / raw)
  To: Support Opensource, Lee Jones, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches
  Cc: Marek Szyprowski, Sylwester Nawrocki

Correct kerneldoc function name to fix W=1 warning:

  drivers/mfd/twl-core.c:496: warning:
    expecting prototype for twl_regcache_bypass(). Prototype was for twl_set_regcache_bypass() instead

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/mfd/twl-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 20cf8cfe4f3b..24b77b18b725 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -485,8 +485,8 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
 EXPORT_SYMBOL(twl_i2c_read);
 
 /**
- * twl_regcache_bypass - Configure the regcache bypass for the regmap associated
- *			 with the module
+ * twl_set_regcache_bypass - Configure the regcache bypass for the regmap
+ *			     associated with the module
  * @mod_no: module number
  * @enable: Regcache bypass state
  *
-- 
2.25.1


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

* Re: [PATCH v2 7/7] mfd: twl: Correct kerneldoc
  2021-04-20 11:39 ` [PATCH v2 7/7] mfd: twl: " Krzysztof Kozlowski
@ 2021-04-23  8:04   ` Lee Jones
  0 siblings, 0 replies; 9+ messages in thread
From: Lee Jones @ 2021-04-23  8:04 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Support Opensource, Bartlomiej Zolnierkiewicz, Tony Lindgren,
	linux-kernel, linux-samsung-soc, linux-omap, patches,
	Marek Szyprowski, Sylwester Nawrocki

On Tue, 20 Apr 2021, Krzysztof Kozlowski wrote:

> Correct kerneldoc function name to fix W=1 warning:
> 
>   drivers/mfd/twl-core.c:496: warning:
>     expecting prototype for twl_regcache_bypass(). Prototype was for twl_set_regcache_bypass() instead
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>  drivers/mfd/twl-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

FYI, a patch already exists for fixing this.

> diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
> index 20cf8cfe4f3b..24b77b18b725 100644
> --- a/drivers/mfd/twl-core.c
> +++ b/drivers/mfd/twl-core.c
> @@ -485,8 +485,8 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
>  EXPORT_SYMBOL(twl_i2c_read);
>  
>  /**
> - * twl_regcache_bypass - Configure the regcache bypass for the regmap associated
> - *			 with the module
> + * twl_set_regcache_bypass - Configure the regcache bypass for the regmap
> + *			     associated with the module
>   * @mod_no: module number
>   * @enable: Regcache bypass state
>   *

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v2 6/7] mfd: wm831x: Correct kerneldoc
  2021-04-20 11:39 ` [PATCH v2 6/7] mfd: wm831x: Correct kerneldoc Krzysztof Kozlowski
@ 2021-04-23  8:05   ` Lee Jones
  0 siblings, 0 replies; 9+ messages in thread
From: Lee Jones @ 2021-04-23  8:05 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Support Opensource, Bartlomiej Zolnierkiewicz, Tony Lindgren,
	linux-kernel, linux-samsung-soc, linux-omap, patches,
	Marek Szyprowski, Sylwester Nawrocki, Charles Keepax

On Tue, 20 Apr 2021, Krzysztof Kozlowski wrote:

> Correct kerneldoc function name to fix W=1 warning:
> 
>   drivers/mfd/wm831x-core.c:121: warning:
>     expecting prototype for wm831x_reg_unlock(). Prototype was for wm831x_reg_lock() instead
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> 
> ---
> 
> Changes since v1:
> 1. Add Ack
> ---
>  drivers/mfd/wm831x-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

FYI, a patch already exists for fixing this.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 11:39 [PATCH v2 1/7] mfd: max8997: Simplify getting of_device_id match data Krzysztof Kozlowski
2021-04-20 11:39 ` [PATCH v2 2/7] mfd: max8998: " Krzysztof Kozlowski
2021-04-20 11:39 ` [PATCH v2 3/7] mfd: da9052: " Krzysztof Kozlowski
2021-04-20 11:39 ` [PATCH v2 4/7] mfd: da9062: " Krzysztof Kozlowski
2021-04-20 11:39 ` [PATCH v2 5/7] mfd: sec: " Krzysztof Kozlowski
2021-04-20 11:39 ` [PATCH v2 6/7] mfd: wm831x: Correct kerneldoc Krzysztof Kozlowski
2021-04-23  8:05   ` Lee Jones
2021-04-20 11:39 ` [PATCH v2 7/7] mfd: twl: " Krzysztof Kozlowski
2021-04-23  8:04   ` Lee Jones

Linux-Samsung-soc Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-samsung-soc/0 linux-samsung-soc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-samsung-soc linux-samsung-soc/ https://lore.kernel.org/linux-samsung-soc \
		linux-samsung-soc@vger.kernel.org
	public-inbox-index linux-samsung-soc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-samsung-soc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git