From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Tian Tao <tiantao6@hisilicon.com>,
wim@linux-watchdog.org, linux@roeck-us.net, khilman@baylibre.com
Cc: linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] watchdog: meson_wdt: Use device_get_match_data() helper
Date: Thu, 1 Apr 2021 07:04:58 +0200 [thread overview]
Message-ID: <77b2534d-8a3c-381a-af2a-4bf7e2d06736@csgroup.eu> (raw)
In-Reply-To: <1617243921-56774-1-git-send-email-tiantao6@hisilicon.com>
Le 01/04/2021 à 04:25, Tian Tao a écrit :
> Use the device_get_match_data() helper instead of open coding.
>
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
> drivers/watchdog/meson_wdt.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/watchdog/meson_wdt.c b/drivers/watchdog/meson_wdt.c
> index 459f3ae..539feaa 100644
> --- a/drivers/watchdog/meson_wdt.c
> +++ b/drivers/watchdog/meson_wdt.c
> @@ -162,7 +162,6 @@ static int meson_wdt_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct meson_wdt_dev *meson_wdt;
> - const struct of_device_id *of_id;
> int err;
>
> meson_wdt = devm_kzalloc(dev, sizeof(*meson_wdt), GFP_KERNEL);
> @@ -173,12 +172,7 @@ static int meson_wdt_probe(struct platform_device *pdev)
> if (IS_ERR(meson_wdt->wdt_base))
> return PTR_ERR(meson_wdt->wdt_base);
>
> - of_id = of_match_device(meson_wdt_dt_ids, dev);
> - if (!of_id) {
> - dev_err(dev, "Unable to initialize WDT data\n");
> - return -ENODEV;
> - }
> - meson_wdt->data = of_id->data;
> + meson_wdt->data = device_get_match_data(dev);
Previously, it was returning -ENODEV on failure.
What happens now when device_get_match_data() returns NULL ?
>
> meson_wdt->wdt_dev.parent = dev;
> meson_wdt->wdt_dev.info = &meson_wdt_info;
>
Christophe
next prev parent reply other threads:[~2021-04-01 5:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 2:25 [PATCH] watchdog: meson_wdt: Use device_get_match_data() helper Tian Tao
2021-04-01 5:04 ` Christophe Leroy [this message]
2021-04-05 14:49 ` Guenter Roeck
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=77b2534d-8a3c-381a-af2a-4bf7e2d06736@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=khilman@baylibre.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=tiantao6@hisilicon.com \
--cc=wim@linux-watchdog.org \
/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 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).