LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/3] serial: Use of_device_get_match_data
@ 2021-08-22  3:28 Tang Bin
  2021-08-22  3:28 ` [PATCH 1/3] serial: 8250_ingenic: " Tang Bin
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tang Bin @ 2021-08-22  3:28 UTC (permalink / raw)
  To: gregkh, paul, jirislaby, ldewangan, thierry.reding, jonathanh, linux
  Cc: linux-mips, linux-serial, linux-kernel, linux-tegra,
	linux-arm-kernel, Tang Bin

Hi all:

This patch series replace 'of_match_device' with
'of_device_get_match_data', to make code cleaner and better.

Thanks

Tang Bin (3):
  serial: 8250_ingenic: Use of_device_get_match_data
  serial: tegra: Use of_device_get_match_data
  serial: vt8500: Use of_device_get_match_data

 drivers/tty/serial/8250/8250_ingenic.c | 6 ++----
 drivers/tty/serial/serial-tegra.c      | 6 ++----
 drivers/tty/serial/vt8500_serial.c     | 7 ++-----
 3 files changed, 6 insertions(+), 13 deletions(-)

-- 
2.20.1.windows.1




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

* [PATCH 1/3] serial: 8250_ingenic: Use of_device_get_match_data
  2021-08-22  3:28 [PATCH 0/3] serial: Use of_device_get_match_data Tang Bin
@ 2021-08-22  3:28 ` Tang Bin
  2021-08-22 11:16   ` Paul Cercueil
  2021-08-22  3:28 ` [PATCH 2/3] serial: tegra: " Tang Bin
  2021-08-22  3:28 ` [PATCH 3/3] serial: vt8500: " Tang Bin
  2 siblings, 1 reply; 5+ messages in thread
From: Tang Bin @ 2021-08-22  3:28 UTC (permalink / raw)
  To: gregkh, paul, jirislaby, ldewangan, thierry.reding, jonathanh, linux
  Cc: linux-mips, linux-serial, linux-kernel, linux-tegra,
	linux-arm-kernel, Tang Bin, Zhang Shengju

Retrieve OF match data, it's better and cleaner to use
'of_device_get_match_data' over 'of_match_device'.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/tty/serial/8250/8250_ingenic.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/8250/8250_ingenic.c
index 988bf6bcc..65402d05e 100644
--- a/drivers/tty/serial/8250/8250_ingenic.c
+++ b/drivers/tty/serial/8250/8250_ingenic.c
@@ -209,16 +209,14 @@ static int ingenic_uart_probe(struct platform_device *pdev)
 	struct uart_8250_port uart = {};
 	struct ingenic_uart_data *data;
 	const struct ingenic_uart_config *cdata;
-	const struct of_device_id *match;
 	struct resource *regs;
 	int irq, err, line;
 
-	match = of_match_device(of_match, &pdev->dev);
-	if (!match) {
+	cdata = of_device_get_match_data(&pdev->dev);
+	if (!cdata) {
 		dev_err(&pdev->dev, "Error: No device match found\n");
 		return -ENODEV;
 	}
-	cdata = match->data;
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-- 
2.20.1.windows.1




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

* [PATCH 2/3] serial: tegra: Use of_device_get_match_data
  2021-08-22  3:28 [PATCH 0/3] serial: Use of_device_get_match_data Tang Bin
  2021-08-22  3:28 ` [PATCH 1/3] serial: 8250_ingenic: " Tang Bin
@ 2021-08-22  3:28 ` Tang Bin
  2021-08-22  3:28 ` [PATCH 3/3] serial: vt8500: " Tang Bin
  2 siblings, 0 replies; 5+ messages in thread
From: Tang Bin @ 2021-08-22  3:28 UTC (permalink / raw)
  To: gregkh, paul, jirislaby, ldewangan, thierry.reding, jonathanh, linux
  Cc: linux-mips, linux-serial, linux-kernel, linux-tegra,
	linux-arm-kernel, Tang Bin, Zhang Shengju

Retrieve OF match data, it's better and cleaner to use
'of_device_get_match_data' over 'of_match_device'.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/tty/serial/serial-tegra.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index eba5b9ecb..45e2e4109 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -1568,14 +1568,12 @@ static int tegra_uart_probe(struct platform_device *pdev)
 	struct resource *resource;
 	int ret;
 	const struct tegra_uart_chip_data *cdata;
-	const struct of_device_id *match;
 
-	match = of_match_device(tegra_uart_of_match, &pdev->dev);
-	if (!match) {
+	cdata = of_device_get_match_data(&pdev->dev);
+	if (!cdata) {
 		dev_err(&pdev->dev, "Error: No device match found\n");
 		return -ENODEV;
 	}
-	cdata = match->data;
 
 	tup = devm_kzalloc(&pdev->dev, sizeof(*tup), GFP_KERNEL);
 	if (!tup) {
-- 
2.20.1.windows.1




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

* [PATCH 3/3] serial: vt8500: Use of_device_get_match_data
  2021-08-22  3:28 [PATCH 0/3] serial: Use of_device_get_match_data Tang Bin
  2021-08-22  3:28 ` [PATCH 1/3] serial: 8250_ingenic: " Tang Bin
  2021-08-22  3:28 ` [PATCH 2/3] serial: tegra: " Tang Bin
@ 2021-08-22  3:28 ` Tang Bin
  2 siblings, 0 replies; 5+ messages in thread
From: Tang Bin @ 2021-08-22  3:28 UTC (permalink / raw)
  To: gregkh, paul, jirislaby, ldewangan, thierry.reding, jonathanh, linux
  Cc: linux-mips, linux-serial, linux-kernel, linux-tegra,
	linux-arm-kernel, Tang Bin, Zhang Shengju

Retrieve OF match data, it's better and cleaner to use
'of_device_get_match_data' over 'of_match_device'.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/tty/serial/vt8500_serial.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
index c5edd56ff..e15b2bf69 100644
--- a/drivers/tty/serial/vt8500_serial.c
+++ b/drivers/tty/serial/vt8500_serial.c
@@ -623,17 +623,14 @@ static int vt8500_serial_probe(struct platform_device *pdev)
 	struct vt8500_port *vt8500_port;
 	struct resource *mmres, *irqres;
 	struct device_node *np = pdev->dev.of_node;
-	const struct of_device_id *match;
 	const unsigned int *flags;
 	int ret;
 	int port;
 
-	match = of_match_device(wmt_dt_ids, &pdev->dev);
-	if (!match)
+	flags = of_device_get_match_data(&pdev->dev);
+	if (!flags)
 		return -EINVAL;
 
-	flags = match->data;
-
 	mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irqres = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (!mmres || !irqres)
-- 
2.20.1.windows.1




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

* Re: [PATCH 1/3] serial: 8250_ingenic: Use of_device_get_match_data
  2021-08-22  3:28 ` [PATCH 1/3] serial: 8250_ingenic: " Tang Bin
@ 2021-08-22 11:16   ` Paul Cercueil
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Cercueil @ 2021-08-22 11:16 UTC (permalink / raw)
  To: Tang Bin
  Cc: gregkh, jirislaby, ldewangan, thierry.reding, jonathanh, linux,
	linux-mips, linux-serial, linux-kernel, linux-tegra,
	linux-arm-kernel, Zhang Shengju

Hi,

Le dim., août 22 2021 at 11:28:04 +0800, Tang Bin 
<tangbin@cmss.chinamobile.com> a écrit :
> Retrieve OF match data, it's better and cleaner to use
> 'of_device_get_match_data' over 'of_match_device'.
> 
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>

Acked-by: Paul Cercueil <paul@crapouillou.net>

Cheers,
-Paul

> ---
>  drivers/tty/serial/8250/8250_ingenic.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_ingenic.c 
> b/drivers/tty/serial/8250/8250_ingenic.c
> index 988bf6bcc..65402d05e 100644
> --- a/drivers/tty/serial/8250/8250_ingenic.c
> +++ b/drivers/tty/serial/8250/8250_ingenic.c
> @@ -209,16 +209,14 @@ static int ingenic_uart_probe(struct 
> platform_device *pdev)
>  	struct uart_8250_port uart = {};
>  	struct ingenic_uart_data *data;
>  	const struct ingenic_uart_config *cdata;
> -	const struct of_device_id *match;
>  	struct resource *regs;
>  	int irq, err, line;
> 
> -	match = of_match_device(of_match, &pdev->dev);
> -	if (!match) {
> +	cdata = of_device_get_match_data(&pdev->dev);
> +	if (!cdata) {
>  		dev_err(&pdev->dev, "Error: No device match found\n");
>  		return -ENODEV;
>  	}
> -	cdata = match->data;
> 
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0)
> --
> 2.20.1.windows.1
> 
> 
> 



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

end of thread, other threads:[~2021-08-22 11:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-22  3:28 [PATCH 0/3] serial: Use of_device_get_match_data Tang Bin
2021-08-22  3:28 ` [PATCH 1/3] serial: 8250_ingenic: " Tang Bin
2021-08-22 11:16   ` Paul Cercueil
2021-08-22  3:28 ` [PATCH 2/3] serial: tegra: " Tang Bin
2021-08-22  3:28 ` [PATCH 3/3] serial: vt8500: " Tang Bin

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