All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tang Bin <tangbin@cmss.chinamobile.com>
To: gregkh@linuxfoundation.org, paul@crapouillou.net,
	jirislaby@kernel.org, ldewangan@nvidia.com,
	thierry.reding@gmail.com, jonathanh@nvidia.com,
	linux@prisktech.co.nz
Cc: linux-mips@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Tang Bin <tangbin@cmss.chinamobile.com>,
	Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Subject: [PATCH 2/3] serial: tegra: Use of_device_get_match_data
Date: Sun, 22 Aug 2021 11:28:05 +0800	[thread overview]
Message-ID: <20210822032806.3256-3-tangbin@cmss.chinamobile.com> (raw)
In-Reply-To: <20210822032806.3256-1-tangbin@cmss.chinamobile.com>

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




WARNING: multiple messages have this Message-ID (diff)
From: Tang Bin <tangbin@cmss.chinamobile.com>
To: gregkh@linuxfoundation.org, paul@crapouillou.net,
	jirislaby@kernel.org, ldewangan@nvidia.com,
	thierry.reding@gmail.com, jonathanh@nvidia.com,
	linux@prisktech.co.nz
Cc: linux-mips@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Tang Bin <tangbin@cmss.chinamobile.com>,
	Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Subject: [PATCH 2/3] serial: tegra: Use of_device_get_match_data
Date: Sun, 22 Aug 2021 11:28:05 +0800	[thread overview]
Message-ID: <20210822032806.3256-3-tangbin@cmss.chinamobile.com> (raw)
In-Reply-To: <20210822032806.3256-1-tangbin@cmss.chinamobile.com>

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




_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-08-22  3:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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  3:28 ` [PATCH 1/3] serial: 8250_ingenic: " Tang Bin
2021-08-22  3:28   ` Tang Bin
2021-08-22 11:16   ` Paul Cercueil
2021-08-22 11:16     ` Paul Cercueil
2021-08-22  3:28 ` Tang Bin [this message]
2021-08-22  3:28   ` [PATCH 2/3] serial: tegra: " Tang Bin
2021-08-22  3:28 ` [PATCH 3/3] serial: vt8500: " Tang Bin
2021-08-22  3:28   ` Tang Bin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210822032806.3256-3-tangbin@cmss.chinamobile.com \
    --to=tangbin@cmss.chinamobile.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux@prisktech.co.nz \
    --cc=paul@crapouillou.net \
    --cc=thierry.reding@gmail.com \
    --cc=zhangshengju@cmss.chinamobile.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.