From: Dejin Zheng <zhengdejin5@gmail.com>
To: gregkh@linuxfoundation.org, thierry.reding@gmail.com,
jonathanh@nvidia.com
Cc: linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org, Dejin Zheng <zhengdejin5@gmail.com>
Subject: [PATCH] usb: phy: tegra: make the code simple by devm_platform_ioremap_resource()
Date: Mon, 27 Jan 2020 21:58:41 +0800 [thread overview]
Message-ID: <20200127135841.17935-1-zhengdejin5@gmail.com> (raw)
make the code simple by use devm_platform_ioremap_resource() function
to replace platform_get_resource() and devm_ioremap().
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
drivers/usb/phy/phy-tegra-usb.c | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
index ea7ef1dc0b42..8220bb4ce1ed 100644
--- a/drivers/usb/phy/phy-tegra-usb.c
+++ b/drivers/usb/phy/phy-tegra-usb.c
@@ -944,20 +944,12 @@ static int read_utmi_param(struct platform_device *pdev, const char *param,
static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy,
struct platform_device *pdev)
{
- struct resource *res;
int err;
struct tegra_utmip_config *config;
tegra_phy->is_ulpi_phy = false;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (!res) {
- dev_err(&pdev->dev, "Failed to get UTMI pad regs\n");
- return -ENXIO;
- }
-
- tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start,
- resource_size(res));
+ tegra_phy->pad_regs = devm_platform_ioremap_resource(pdev, 1);
if (!tegra_phy->pad_regs) {
dev_err(&pdev->dev, "Failed to remap UTMI pad regs\n");
return -ENOMEM;
@@ -1054,7 +1046,6 @@ MODULE_DEVICE_TABLE(of, tegra_usb_phy_id_table);
static int tegra_usb_phy_probe(struct platform_device *pdev)
{
const struct of_device_id *match;
- struct resource *res;
struct tegra_usb_phy *tegra_phy = NULL;
struct device_node *np = pdev->dev.of_node;
enum usb_phy_interface phy_type;
@@ -1071,14 +1062,7 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
}
tegra_phy->soc_config = match->data;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "Failed to get I/O memory\n");
- return -ENXIO;
- }
-
- tegra_phy->regs = devm_ioremap(&pdev->dev, res->start,
- resource_size(res));
+ tegra_phy->regs = devm_platform_ioremap_resource(pdev, 0);
if (!tegra_phy->regs) {
dev_err(&pdev->dev, "Failed to remap I/O memory\n");
return -ENOMEM;
--
2.25.0
next reply other threads:[~2020-01-27 13:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-27 13:58 Dejin Zheng [this message]
2020-01-27 19:47 ` [PATCH] usb: phy: tegra: make the code simple by devm_platform_ioremap_resource() Dmitry Osipenko
2020-01-28 5:06 ` Dejin Zheng
2020-01-31 13:21 ` Felipe Balbi
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=20200127135841.17935-1-zhengdejin5@gmail.com \
--to=zhengdejin5@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=thierry.reding@gmail.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 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).