From: Thierry Reding <thierry.reding@gmail.com>
To: Chunfeng Yun <chunfeng.yun@mediatek.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
Heiko Stuebner <heiko@sntech.de>, Kukjin Kim <kgene@kernel.org>,
Krzysztof Kozlowski <krzk@kernel.org>,
Kamil Debski <kamil@wypas.org>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Lee Jones <lee.jones@linaro.org>,
Vivek Gautam <vivek.gautam@codeaurora.org>,
Axel Lin <axel.lin@ingics.com>,
Baoyou Xie <baoyou.xie@linaro.org>, Arnd Bergmann <arnd@arndb.de>,
Sekhar Nori <nsekhar@ti.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Jaehoon Chung <jh80.chung@samsung.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.orglin
Subject: Re: [PATCH 4/4] phy: tegra: use of_device_get_match_data()
Date: Fri, 18 Aug 2017 14:42:03 +0200 [thread overview]
Message-ID: <20170818124203.GA4556@ulmo> (raw)
In-Reply-To: <1502270280-13792-4-git-send-email-chunfeng.yun@mediatek.com>
[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]
On Wed, Aug 09, 2017 at 05:18:00PM +0800, Chunfeng Yun wrote:
> reduce the boilerplate code to get the specific data
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
> drivers/phy/tegra/xusb.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
You're not reducing by much here. =)
> diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
> index 3cbcb25..25cdfb1 100644
> --- a/drivers/phy/tegra/xusb.c
> +++ b/drivers/phy/tegra/xusb.c
> @@ -848,7 +848,6 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
> struct device_node *np = of_node_get(pdev->dev.of_node);
> const struct tegra_xusb_padctl_soc *soc;
> struct tegra_xusb_padctl *padctl;
> - const struct of_device_id *match;
> struct resource *res;
> int err;
>
> @@ -861,8 +860,9 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
>
> of_node_put(np);
>
> - match = of_match_node(tegra_xusb_padctl_of_match, pdev->dev.of_node);
> - soc = match->data;
> + soc = of_device_get_match_data(&pdev->dev);
> + if (!soc)
> + return -EINVAL;
This is never going to happen. There will always be a match, otherwise
this function would never be called.
Also, if you omit these last two lines, then you actually do reduce the
boilerplate.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2017-08-18 12:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-09 9:17 [PATCH 1/4] phy: rockchip: use of_device_get_match_data() Chunfeng Yun
2017-08-09 9:17 ` [PATCH 2/4] phy: samsung: " Chunfeng Yun
2017-08-09 9:17 ` [PATCH 3/4] phy: ti: " Chunfeng Yun
[not found] ` <1502270280-13792-1-git-send-email-chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2017-08-09 9:18 ` [PATCH 4/4] phy: tegra: " Chunfeng Yun
2017-08-18 12:42 ` Thierry Reding [this message]
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=20170818124203.GA4556@ulmo \
--to=thierry.reding@gmail.com \
--cc=arnd@arndb.de \
--cc=axel.lin@ingics.com \
--cc=b.zolnierkie@samsung.com \
--cc=baoyou.xie@linaro.org \
--cc=chunfeng.yun@mediatek.com \
--cc=heiko@sntech.de \
--cc=jh80.chung@samsung.com \
--cc=jonathanh@nvidia.com \
--cc=kamil@wypas.org \
--cc=kgene@kernel.org \
--cc=kishon@ti.com \
--cc=krzk@kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.orglin \
--cc=matthias.bgg@gmail.com \
--cc=nsekhar@ti.com \
--cc=s.nawrocki@samsung.com \
--cc=viresh.kumar@linaro.org \
--cc=vivek.gautam@codeaurora.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).