All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] mfd: max8997: Simplify getting of_device_id match data
@ 2021-04-19  8:17 Krzysztof Kozlowski
  2021-04-19  8:17 ` [PATCH 2/7] mfd: max8998: " Krzysztof Kozlowski
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-19  8:17 UTC (permalink / raw)
  To: Support Opensource, Lee Jones, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches

Use of_device_get_match_data() to make the code slightly smaller.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 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..f89b1eb121c9 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 (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node)
+		return (unsigned long)of_device_get_match_data(&i2c->dev);
+
 	return id->driver_data;
 }
 
-- 
2.25.1


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

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

Use of_device_get_match_data() to make the code slightly smaller.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 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..42c60d4d97fb 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 (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node)
+		return (unsigned long)of_device_get_match_data(&i2c->dev);
 
 	return id->driver_data;
 }
-- 
2.25.1


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

* [PATCH 3/7] mfd: da9052: Simplify getting of_device_id match data
  2021-04-19  8:17 [PATCH 1/7] mfd: max8997: Simplify getting of_device_id match data Krzysztof Kozlowski
  2021-04-19  8:17 ` [PATCH 2/7] mfd: max8998: " Krzysztof Kozlowski
@ 2021-04-19  8:17 ` Krzysztof Kozlowski
  2021-04-19 11:00   ` Adam Thomson
  2021-04-19  8:17 ` [PATCH 4/7] " Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-19  8:17 UTC (permalink / raw)
  To: Support Opensource, Lee Jones, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches

Use of_device_get_match_data() to make the code slightly smaller.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 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 related	[flat|nested] 15+ messages in thread

* [PATCH 4/7] mfd: da9052: Simplify getting of_device_id match data
  2021-04-19  8:17 [PATCH 1/7] mfd: max8997: Simplify getting of_device_id match data Krzysztof Kozlowski
  2021-04-19  8:17 ` [PATCH 2/7] mfd: max8998: " Krzysztof Kozlowski
  2021-04-19  8:17 ` [PATCH 3/7] mfd: da9052: " Krzysztof Kozlowski
@ 2021-04-19  8:17 ` Krzysztof Kozlowski
  2021-04-19 11:00   ` Adam Thomson
  2021-04-19 11:04   ` Krzysztof Kozlowski
  2021-04-19  8:17 ` [PATCH 5/7] mfd: sec: " Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-19  8:17 UTC (permalink / raw)
  To: Support Opensource, Lee Jones, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches

Use of_device_get_match_data() to make the code slightly smaller.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 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 related	[flat|nested] 15+ messages in thread

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

Use of_device_get_match_data() to make the code slightly smaller.

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

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 8d55992da19e..3126c39f3203 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>
@@ -324,12 +325,8 @@ 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;
-
-		match = of_match_node(sec_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);
 #endif
 	return id->driver_data;
 }
-- 
2.25.1


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

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

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>
---
 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 related	[flat|nested] 15+ messages in thread

* [PATCH 7/7] mfd: twl: Correct kerneldoc
  2021-04-19  8:17 [PATCH 1/7] mfd: max8997: Simplify getting of_device_id match data Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2021-04-19  8:17 ` [PATCH 6/7] mfd: wm831x: Correct kerneldoc Krzysztof Kozlowski
@ 2021-04-19  8:17 ` Krzysztof Kozlowski
  5 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-19  8:17 UTC (permalink / raw)
  To: Support Opensource, Lee Jones, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches

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 related	[flat|nested] 15+ messages in thread

* Re: [PATCH 6/7] mfd: wm831x: Correct kerneldoc
  2021-04-19  8:17 ` [PATCH 6/7] mfd: wm831x: Correct kerneldoc Krzysztof Kozlowski
@ 2021-04-19  8:41   ` Charles Keepax
  0 siblings, 0 replies; 15+ messages in thread
From: Charles Keepax @ 2021-04-19  8:41 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Support Opensource, Lee Jones, Bartlomiej Zolnierkiewicz,
	Tony Lindgren, linux-kernel, linux-samsung-soc, linux-omap,
	patches

On Mon, Apr 19, 2021 at 10:17:25AM +0200, 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>

Thanks,
Charles

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

* RE: [PATCH 3/7] mfd: da9052: Simplify getting of_device_id match data
  2021-04-19  8:17 ` [PATCH 3/7] mfd: da9052: " Krzysztof Kozlowski
@ 2021-04-19 11:00   ` Adam Thomson
  0 siblings, 0 replies; 15+ messages in thread
From: Adam Thomson @ 2021-04-19 11:00 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Support Opensource, Lee Jones,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches

On 19 April 2021 09:17, Krzysztof Kozlowski wrote:

> 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>

>  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] 15+ messages in thread

* RE: [PATCH 4/7] mfd: da9052: Simplify getting of_device_id match data
  2021-04-19  8:17 ` [PATCH 4/7] " Krzysztof Kozlowski
@ 2021-04-19 11:00   ` Adam Thomson
  2021-04-19 11:04   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 15+ messages in thread
From: Adam Thomson @ 2021-04-19 11:00 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Support Opensource, Lee Jones,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches

On 19 April 2021 09:17, Krzysztof Kozlowski wrote:

> 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>

>  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] 15+ messages in thread

* Re: [PATCH 4/7] mfd: da9052: Simplify getting of_device_id match data
  2021-04-19  8:17 ` [PATCH 4/7] " Krzysztof Kozlowski
  2021-04-19 11:00   ` Adam Thomson
@ 2021-04-19 11:04   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-19 11:04 UTC (permalink / raw)
  To: Support Opensource, Lee Jones, Bartlomiej Zolnierkiewicz,
	Tony Lindgren, linux-kernel, linux-samsung-soc, linux-omap,
	patches

On 19/04/2021 10:17, Krzysztof Kozlowski wrote:
> Use of_device_get_match_data() to make the code slightly smaller.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>  drivers/mfd/da9062-core.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)

Copy-paste error in the subject - the prefix should be:
mfd: da9062:


Best regards,
Krzysztof

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

* Re: [PATCH 5/7] mfd: sec: Simplify getting of_device_id match data
  2021-04-19  8:17 ` [PATCH 5/7] mfd: sec: " Krzysztof Kozlowski
@ 2021-04-20  5:25   ` Marek Szyprowski
  2021-04-20  7:03     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 15+ messages in thread
From: Marek Szyprowski @ 2021-04-20  5:25 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Support Opensource, Lee Jones,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches


On 19.04.2021 10:17, Krzysztof Kozlowski wrote:
> Use of_device_get_match_data() to make the code slightly smaller.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>   drivers/mfd/sec-core.c | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
> index 8d55992da19e..3126c39f3203 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>
> @@ -324,12 +325,8 @@ 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;
> -
> -		match = of_match_node(sec_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);
>   #endif

Does it make any sense to keep the #ifdef CONFIG_OF after this change? I 
would also skip (i2c->dev.of_node) check, because 
of_device_get_match_data() already does that (although indirectly).

>   	return id->driver_data;
>   }

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


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

* Re: [PATCH 5/7] mfd: sec: Simplify getting of_device_id match data
  2021-04-20  5:25   ` Marek Szyprowski
@ 2021-04-20  7:03     ` Krzysztof Kozlowski
  2021-04-20  7:12       ` Marek Szyprowski
  0 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20  7:03 UTC (permalink / raw)
  To: Marek Szyprowski, Support Opensource, Lee Jones,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches

On 20/04/2021 07:25, Marek Szyprowski wrote:
> 
> On 19.04.2021 10:17, Krzysztof Kozlowski wrote:
>> Use of_device_get_match_data() to make the code slightly smaller.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>> ---
>>   drivers/mfd/sec-core.c | 9 +++------
>>   1 file changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
>> index 8d55992da19e..3126c39f3203 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>
>> @@ -324,12 +325,8 @@ 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;
>> -
>> -		match = of_match_node(sec_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);
>>   #endif
> 
> Does it make any sense to keep the #ifdef CONFIG_OF after this change?

Good point, it was only to hide usage of of_device_id table.

> I would also skip (i2c->dev.of_node) check, because 
> of_device_get_match_data() already does that (although indirectly).

First, the enum sec_device_type would need to be changed so it starts
from 1, not 0. It's because the value returned by this function is later
assigned to that enum and there is no way currently to differentiate
between NULL and S5M8767X.

Second, it wouldn't make the code smaller;

unsigned long data;
data = of_device_get_match_data(&i2c->dev);
if (data)
	return data;

Best regards,
Krzysztof

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

* Re: [PATCH 5/7] mfd: sec: Simplify getting of_device_id match data
  2021-04-20  7:03     ` Krzysztof Kozlowski
@ 2021-04-20  7:12       ` Marek Szyprowski
  2021-04-20  7:25         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 15+ messages in thread
From: Marek Szyprowski @ 2021-04-20  7:12 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Support Opensource, Lee Jones,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches

On 20.04.2021 09:03, Krzysztof Kozlowski wrote:
> On 20/04/2021 07:25, Marek Szyprowski wrote:
>> On 19.04.2021 10:17, Krzysztof Kozlowski wrote:
>>> Use of_device_get_match_data() to make the code slightly smaller.
>>>
>>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>>> ---
>>>    drivers/mfd/sec-core.c | 9 +++------
>>>    1 file changed, 3 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
>>> index 8d55992da19e..3126c39f3203 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>
>>> @@ -324,12 +325,8 @@ 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;
>>> -
>>> -		match = of_match_node(sec_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);
>>>    #endif
>> Does it make any sense to keep the #ifdef CONFIG_OF after this change?
> Good point, it was only to hide usage of of_device_id table.
>
>> I would also skip (i2c->dev.of_node) check, because
>> of_device_get_match_data() already does that (although indirectly).
> First, the enum sec_device_type would need to be changed so it starts
> from 1, not 0. It's because the value returned by this function is later
> assigned to that enum and there is no way currently to differentiate
> between NULL and S5M8767X.
>
> Second, it wouldn't make the code smaller;
>
> unsigned long data;
> data = of_device_get_match_data(&i2c->dev);
> if (data)
> 	return data;

Then maybe one should go further and remove legacy, non-of based 
initialization, because it is not used at all. This will simplify it 
even more.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


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

* Re: [PATCH 5/7] mfd: sec: Simplify getting of_device_id match data
  2021-04-20  7:12       ` Marek Szyprowski
@ 2021-04-20  7:25         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20  7:25 UTC (permalink / raw)
  To: Marek Szyprowski, Support Opensource, Lee Jones,
	Bartlomiej Zolnierkiewicz, Tony Lindgren, linux-kernel,
	linux-samsung-soc, linux-omap, patches

On 20/04/2021 09:12, Marek Szyprowski wrote:
> On 20.04.2021 09:03, Krzysztof Kozlowski wrote:
>> On 20/04/2021 07:25, Marek Szyprowski wrote:
>>> On 19.04.2021 10:17, Krzysztof Kozlowski wrote:
>>>> Use of_device_get_match_data() to make the code slightly smaller.
>>>>
>>>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>>>> ---
>>>>    drivers/mfd/sec-core.c | 9 +++------
>>>>    1 file changed, 3 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
>>>> index 8d55992da19e..3126c39f3203 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>
>>>> @@ -324,12 +325,8 @@ 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;
>>>> -
>>>> -		match = of_match_node(sec_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);
>>>>    #endif
>>> Does it make any sense to keep the #ifdef CONFIG_OF after this change?
>> Good point, it was only to hide usage of of_device_id table.
>>
>>> I would also skip (i2c->dev.of_node) check, because
>>> of_device_get_match_data() already does that (although indirectly).
>> First, the enum sec_device_type would need to be changed so it starts
>> from 1, not 0. It's because the value returned by this function is later
>> assigned to that enum and there is no way currently to differentiate
>> between NULL and S5M8767X.
>>
>> Second, it wouldn't make the code smaller;
>>
>> unsigned long data;
>> data = of_device_get_match_data(&i2c->dev);
>> if (data)
>> 	return data;
> 
> Then maybe one should go further and remove legacy, non-of based 
> initialization, because it is not used at all. This will simplify it 
> even more.

Indeed maybe it's the time to get rid of board-file support...

Thanks for the feedback!

Best regards,
Krzysztof

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

end of thread, other threads:[~2021-04-20  7:25 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19  8:17 [PATCH 1/7] mfd: max8997: Simplify getting of_device_id match data Krzysztof Kozlowski
2021-04-19  8:17 ` [PATCH 2/7] mfd: max8998: " Krzysztof Kozlowski
2021-04-19  8:17 ` [PATCH 3/7] mfd: da9052: " Krzysztof Kozlowski
2021-04-19 11:00   ` Adam Thomson
2021-04-19  8:17 ` [PATCH 4/7] " Krzysztof Kozlowski
2021-04-19 11:00   ` Adam Thomson
2021-04-19 11:04   ` Krzysztof Kozlowski
2021-04-19  8:17 ` [PATCH 5/7] mfd: sec: " Krzysztof Kozlowski
2021-04-20  5:25   ` Marek Szyprowski
2021-04-20  7:03     ` Krzysztof Kozlowski
2021-04-20  7:12       ` Marek Szyprowski
2021-04-20  7:25         ` Krzysztof Kozlowski
2021-04-19  8:17 ` [PATCH 6/7] mfd: wm831x: Correct kerneldoc Krzysztof Kozlowski
2021-04-19  8:41   ` Charles Keepax
2021-04-19  8:17 ` [PATCH 7/7] mfd: twl: " Krzysztof Kozlowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.