2021-08-22 03:31:06

by Tang Bin

[permalink] [raw]
Subject: [PATCH 0/3] serial: Use of_device_get_match_data

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




2021-08-22 03:32:42

by Tang Bin

[permalink] [raw]
Subject: [PATCH 1/3] serial: 8250_ingenic: Use of_device_get_match_data

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 <[email protected]>
Signed-off-by: Tang Bin <[email protected]>
---
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



2021-08-22 03:33:21

by Tang Bin

[permalink] [raw]
Subject: [PATCH 3/3] serial: vt8500: Use of_device_get_match_data

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 <[email protected]>
Signed-off-by: Tang Bin <[email protected]>
---
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



2021-08-22 03:34:30

by Tang Bin

[permalink] [raw]
Subject: [PATCH 2/3] serial: tegra: Use of_device_get_match_data

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 <[email protected]>
Signed-off-by: Tang Bin <[email protected]>
---
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



2021-08-22 11:19:07

by Paul Cercueil

[permalink] [raw]
Subject: Re: [PATCH 1/3] serial: 8250_ingenic: Use of_device_get_match_data

Hi,

Le dim., ao?t 22 2021 at 11:28:04 +0800, Tang Bin
<[email protected]> 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 <[email protected]>
> Signed-off-by: Tang Bin <[email protected]>

Acked-by: Paul Cercueil <[email protected]>

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