All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] i2c: sh_mobile: remove platform_data support
@ 2017-05-18 21:11 Wolfram Sang
  2017-05-18 21:11 ` [RFC PATCH 1/2] i2c: sh_mobile: remove platform_data Wolfram Sang
  2017-05-18 21:11 ` [RFC PATCH 2/2] i2c: sh_mobile: drop needless check for of_node Wolfram Sang
  0 siblings, 2 replies; 7+ messages in thread
From: Wolfram Sang @ 2017-05-18 21:11 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-renesas-soc, Wolfram Sang

Here is a cleanup series for the i2c-sh_mobile driver. Patch 1 states why I
think it can safely be removed, but I certainly want others people feedback on
this, so this is RFC for now. Found while cleaning up include/linux/i2c.

Wolfram Sang (2):
  i2c: sh_mobile: remove platform_data
  i2c: sh_mobile: drop needless check for of_node

 drivers/i2c/busses/i2c-sh_mobile.c | 28 ++++++++--------------------
 include/linux/i2c/i2c-sh_mobile.h  | 11 -----------
 2 files changed, 8 insertions(+), 31 deletions(-)
 delete mode 100644 include/linux/i2c/i2c-sh_mobile.h

-- 
2.11.0

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

* [RFC PATCH 1/2] i2c: sh_mobile: remove platform_data
  2017-05-18 21:11 [RFC PATCH 0/2] i2c: sh_mobile: remove platform_data support Wolfram Sang
@ 2017-05-18 21:11 ` Wolfram Sang
  2017-05-19  7:42   ` Geert Uytterhoeven
  2017-06-02 20:53   ` Wolfram Sang
  2017-05-18 21:11 ` [RFC PATCH 2/2] i2c: sh_mobile: drop needless check for of_node Wolfram Sang
  1 sibling, 2 replies; 7+ messages in thread
From: Wolfram Sang @ 2017-05-18 21:11 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-renesas-soc, Wolfram Sang

No platform currently upstream makes use of this platform_data anymore.
The ones that did are converted to DT meanwhile. So, remove it. The old
platforms likely don't have the 'clks_per_cnt' feature, otherwise it
would have been implemented by now. And in the unlikely case they need
to setup a different bus speed, we should rather go for a generic i2c
platform data just for that.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-sh_mobile.c |  8 --------
 include/linux/i2c/i2c-sh_mobile.h  | 11 -----------
 2 files changed, 19 deletions(-)
 delete mode 100644 include/linux/i2c/i2c-sh_mobile.h

diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 3d75593487454c..d5e39eccae9b97 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -24,7 +24,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/err.h>
 #include <linux/i2c.h>
-#include <linux/i2c/i2c-sh_mobile.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
@@ -879,7 +878,6 @@ static int sh_mobile_i2c_hook_irqs(struct platform_device *dev, struct sh_mobile
 
 static int sh_mobile_i2c_probe(struct platform_device *dev)
 {
-	struct i2c_sh_mobile_platform_data *pdata = dev_get_platdata(&dev->dev);
 	struct sh_mobile_i2c_data *pd;
 	struct i2c_adapter *adap;
 	struct resource *res;
@@ -910,7 +908,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	if (IS_ERR(pd->reg))
 		return PTR_ERR(pd->reg);
 
-	/* Use platform data bus speed or STANDARD_MODE */
 	ret = of_property_read_u32(dev->dev.of_node, "clock-frequency", &bus_speed);
 	pd->bus_speed = ret ? STANDARD_MODE : bus_speed;
 
@@ -929,11 +926,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 			if (config->setup)
 				config->setup(pd);
 		}
-	} else {
-		if (pdata && pdata->bus_speed)
-			pd->bus_speed = pdata->bus_speed;
-		if (pdata && pdata->clks_per_count)
-			pd->clks_per_count = pdata->clks_per_count;
 	}
 
 	/* The IIC blocks on SH-Mobile ARM processors
diff --git a/include/linux/i2c/i2c-sh_mobile.h b/include/linux/i2c/i2c-sh_mobile.h
deleted file mode 100644
index 06e3089795fbee..00000000000000
--- a/include/linux/i2c/i2c-sh_mobile.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __I2C_SH_MOBILE_H__
-#define __I2C_SH_MOBILE_H__
-
-#include <linux/platform_device.h>
-
-struct i2c_sh_mobile_platform_data {
-	unsigned long bus_speed;
-	unsigned int clks_per_count;
-};
-
-#endif /* __I2C_SH_MOBILE_H__ */
-- 
2.11.0

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

* [RFC PATCH 2/2] i2c: sh_mobile: drop needless check for of_node
  2017-05-18 21:11 [RFC PATCH 0/2] i2c: sh_mobile: remove platform_data support Wolfram Sang
  2017-05-18 21:11 ` [RFC PATCH 1/2] i2c: sh_mobile: remove platform_data Wolfram Sang
@ 2017-05-18 21:11 ` Wolfram Sang
  2017-05-19  7:46   ` Geert Uytterhoeven
  2017-06-02 20:53   ` Wolfram Sang
  1 sibling, 2 replies; 7+ messages in thread
From: Wolfram Sang @ 2017-05-18 21:11 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-renesas-soc, Wolfram Sang

After removal of platform_data support, we can simplify OF handling.
of_match_device() evaluates to NULL if !CONFIG_OF or if there is no node
pointer for that device, so we can remove the check for the node ptr.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-sh_mobile.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index d5e39eccae9b97..92c002c5bb0abe 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -881,6 +881,7 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	struct sh_mobile_i2c_data *pd;
 	struct i2c_adapter *adap;
 	struct resource *res;
+	const struct of_device_id *match;
 	int ret;
 	u32 bus_speed;
 
@@ -910,22 +911,17 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 
 	ret = of_property_read_u32(dev->dev.of_node, "clock-frequency", &bus_speed);
 	pd->bus_speed = ret ? STANDARD_MODE : bus_speed;
-
 	pd->clks_per_count = 1;
 
-	if (dev->dev.of_node) {
-		const struct of_device_id *match;
-
-		match = of_match_device(sh_mobile_i2c_dt_ids, &dev->dev);
-		if (match) {
-			const struct sh_mobile_dt_config *config;
+	match = of_match_device(sh_mobile_i2c_dt_ids, &dev->dev);
+	if (match) {
+		const struct sh_mobile_dt_config *config;
 
-			config = match->data;
-			pd->clks_per_count = config->clks_per_count;
+		config = match->data;
+		pd->clks_per_count = config->clks_per_count;
 
-			if (config->setup)
-				config->setup(pd);
-		}
+		if (config->setup)
+			config->setup(pd);
 	}
 
 	/* The IIC blocks on SH-Mobile ARM processors
-- 
2.11.0

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

* Re: [RFC PATCH 1/2] i2c: sh_mobile: remove platform_data
  2017-05-18 21:11 ` [RFC PATCH 1/2] i2c: sh_mobile: remove platform_data Wolfram Sang
@ 2017-05-19  7:42   ` Geert Uytterhoeven
  2017-06-02 20:53   ` Wolfram Sang
  1 sibling, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2017-05-19  7:42 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Linux I2C, Linux-Renesas

On Thu, May 18, 2017 at 11:11 PM, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> No platform currently upstream makes use of this platform_data anymore.
> The ones that did are converted to DT meanwhile. So, remove it. The old
> platforms likely don't have the 'clks_per_cnt' feature, otherwise it
> would have been implemented by now. And in the unlikely case they need
> to setup a different bus speed, we should rather go for a generic i2c
> platform data just for that.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [RFC PATCH 2/2] i2c: sh_mobile: drop needless check for of_node
  2017-05-18 21:11 ` [RFC PATCH 2/2] i2c: sh_mobile: drop needless check for of_node Wolfram Sang
@ 2017-05-19  7:46   ` Geert Uytterhoeven
  2017-06-02 20:53   ` Wolfram Sang
  1 sibling, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2017-05-19  7:46 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Linux I2C, Linux-Renesas

On Thu, May 18, 2017 at 11:11 PM, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> After removal of platform_data support, we can simplify OF handling.
> of_match_device() evaluates to NULL if !CONFIG_OF or if there is no node
> pointer for that device, so we can remove the check for the node ptr.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- a/drivers/i2c/busses/i2c-sh_mobile.c
> +++ b/drivers/i2c/busses/i2c-sh_mobile.c

> +       if (match) {
> +               const struct sh_mobile_dt_config *config;
>
> -                       config = match->data;
> -                       pd->clks_per_count = config->clks_per_count;
> +               config = match->data;

You could have combined the assignment with the variable declaration.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [RFC PATCH 1/2] i2c: sh_mobile: remove platform_data
  2017-05-18 21:11 ` [RFC PATCH 1/2] i2c: sh_mobile: remove platform_data Wolfram Sang
  2017-05-19  7:42   ` Geert Uytterhoeven
@ 2017-06-02 20:53   ` Wolfram Sang
  1 sibling, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2017-06-02 20:53 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

On Thu, May 18, 2017 at 11:11:39PM +0200, Wolfram Sang wrote:
> No platform currently upstream makes use of this platform_data anymore.
> The ones that did are converted to DT meanwhile. So, remove it. The old
> platforms likely don't have the 'clks_per_cnt' feature, otherwise it
> would have been implemented by now. And in the unlikely case they need
> to setup a different bus speed, we should rather go for a generic i2c
> platform data just for that.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [RFC PATCH 2/2] i2c: sh_mobile: drop needless check for of_node
  2017-05-18 21:11 ` [RFC PATCH 2/2] i2c: sh_mobile: drop needless check for of_node Wolfram Sang
  2017-05-19  7:46   ` Geert Uytterhoeven
@ 2017-06-02 20:53   ` Wolfram Sang
  1 sibling, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2017-06-02 20:53 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

On Thu, May 18, 2017 at 11:11:40PM +0200, Wolfram Sang wrote:
> After removal of platform_data support, we can simplify OF handling.
> of_match_device() evaluates to NULL if !CONFIG_OF or if there is no node
> pointer for that device, so we can remove the check for the node ptr.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Fixed the assignment as mentioned by Geert (thanks!) and applied to
for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2017-06-02 20:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-18 21:11 [RFC PATCH 0/2] i2c: sh_mobile: remove platform_data support Wolfram Sang
2017-05-18 21:11 ` [RFC PATCH 1/2] i2c: sh_mobile: remove platform_data Wolfram Sang
2017-05-19  7:42   ` Geert Uytterhoeven
2017-06-02 20:53   ` Wolfram Sang
2017-05-18 21:11 ` [RFC PATCH 2/2] i2c: sh_mobile: drop needless check for of_node Wolfram Sang
2017-05-19  7:46   ` Geert Uytterhoeven
2017-06-02 20:53   ` Wolfram Sang

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.