Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18548ybl; Mon, 27 Jan 2020 21:08:23 -0800 (PST) X-Google-Smtp-Source: APXvYqytA0pexffYitTQsqQ6MTWuH2J4cHHFImGwqnGqoYsb1D+91B+yFtz6LyCh1nEdebWXaQ51 X-Received: by 2002:a05:6830:200d:: with SMTP id e13mr3797207otp.364.1580188103181; Mon, 27 Jan 2020 21:08:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580188103; cv=none; d=google.com; s=arc-20160816; b=ydIpvy3HEkfZbj+XW2Yf9esitaM1tRZ/PpJHYwf8lVv+W6qmzIiz6S1wclhTG04dC9 PVhXTruESnvbKm44sEMYYobpmip5piEq0keV+CY2/8/gI3Tcpw2a9ogcKIcwyo0aQl9l Ndc9TSi3ZXOcdhE6hTlMx0LJj9zWAi/hf4rbRe3EDD5M2dwqHn2SIUt+jE5zGze1CMA9 PdCTfiFgKRXkWnJUS/wtY/dqa3of2UdHgtBsDbEQG9zC5tzqUGLStF+lWEILLU2mjD6O nh8DemvoMMWQoZqNQgkCpPWD26TtsrMrhS385ttulhedROLhKU+x8U74/PCLw+qNY+JI XN/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EOkHPlApR03+KhenapKgHCCTfxWORvo9CWa7thX8FjQ=; b=SmjvcA96O7mKTUp+bSL7GORbTfa83iNti1zTSib3KNQuXII1S8clZIIGo6WVErdjcN Vh/hWDyi/0M3QYcnjsSb1O/bmC03YQcaWctbbDEYZsjEC9f9uqUe6sF6ENVYtXu10D5X JlTlhaHIFZifrZgcQtlS8W8ZnPdv8uE9kimEsWyLci5HUOHe6ceqtZO7holW1kXJeAAR cn9DLUTVnxJEtc9Kahia8Spx2qSQxU2EmSPkn5cg+Go30s+7Iq5kTr89Atj3r/aXr1qX Cln22kptCcKDaI8r+SmAOH6v6KjL29FmIUiKotqpzHKokV351Im3lJvO7iNjGvoLh4Od fXug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Q7Xqv/Ib"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w18si8272539otl.54.2020.01.27.21.08.05; Mon, 27 Jan 2020 21:08:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Q7Xqv/Ib"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725855AbgA1FGv (ORCPT + 99 others); Tue, 28 Jan 2020 00:06:51 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:54720 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725283AbgA1FGv (ORCPT ); Tue, 28 Jan 2020 00:06:51 -0500 Received: by mail-pj1-f68.google.com with SMTP id dw13so465506pjb.4; Mon, 27 Jan 2020 21:06:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=EOkHPlApR03+KhenapKgHCCTfxWORvo9CWa7thX8FjQ=; b=Q7Xqv/Ibjua4Tt2a8EOs16LRmagni8jh3H0Cmuoli7nocDi388E7DfsZU+nCzL964V B5yJjQNSEDLXqoLUV4NtWg4ITl36qnKwWlOI+cH38K08zZunrEImrxtvJVJf6NERNIcu oE7v5RmNVWz45efpchd6T8Gbst86Kxe/V6oRAbDnORtMTaZhKw49QiE6wF5sKNFZp4dW P6JfMrb98Rk78ELB8PuOGCvJU+lCX9swioyzKHB1Tv79mmSN6e/mcD3rP8Q9sq8CLDcq VJPLFAmMUrAqStKU9ym6kDBj2WN73YgnPDznP4t7DoUo99qcIX+b64g5wL0EoydtKDmg k4nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=EOkHPlApR03+KhenapKgHCCTfxWORvo9CWa7thX8FjQ=; b=iXGKnD4YEKn6MvlL1Y1HmGEbld8bIUEa2Meds6QYXtqSw2bU0K7/C6Bx8lEZMv5Pbi ktzm8O6cl88G+z2UsujEqqMwt21zgiZ/fDTBjCkbsZOYTAZoL1ucXnJ0RYz9iFpf+lnI 1Zr8VfLiPsg+OF3OxfJz9WgTwejDd1nBQr/b8GIA30yR1VnHgZwTMAGLpt+VeQqxRPcO 9Wwm0nGvGpSwLVR+KEWJOV42b0wz8RhKhLYHudkSQM+fqvRVEqxeIjQSi5mg/O2Fc4W6 yPoRe+4AzgPMWIjWRf0d85lFkqq1PhFQ1fzf6Hkvr7ubyWJ2E0I64pzCn04CLlehTbbq 7nqQ== X-Gm-Message-State: APjAAAXg2Sm68tZqfaKAcModchLHo8YhjjLJbIiOjqaWHAVmy/nqE6Z2 3JWRa7hIbdXKHAECIGsg5KurNc3M X-Received: by 2002:a17:902:34d:: with SMTP id 71mr20148831pld.316.1580188010847; Mon, 27 Jan 2020 21:06:50 -0800 (PST) Received: from localhost (216.24.177.237.16clouds.com. [216.24.177.237]) by smtp.gmail.com with ESMTPSA id b1sm762486pjw.4.2020.01.27.21.06.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jan 2020 21:06:50 -0800 (PST) Date: Tue, 28 Jan 2020 13:06:46 +0800 From: Dejin Zheng To: Dmitry Osipenko Cc: gregkh@linuxfoundation.org, thierry.reding@gmail.com, jonathanh@nvidia.com, linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: phy: tegra: make the code simple by devm_platform_ioremap_resource() Message-ID: <20200128050356.GA21357@nuc8i5> References: <20200127135841.17935-1-zhengdejin5@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 27, 2020 at 10:47:36PM +0300, Dmitry Osipenko wrote: > 27.01.2020 16:58, Dejin Zheng пишет: > > make the code simple by use devm_platform_ioremap_resource() function > > to replace platform_get_resource() and devm_ioremap(). > > > > Signed-off-by: Dejin Zheng > > --- > > 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; > > > > Hello Dejin, > > Unfortunately this is not a correct change because registers are shared > by both PHY and USB controllers on Tegra SoCs. The > devm_platform_ioremap_resource() can't be used here because it makes the > mapping exclusive for a single driver, while it should be shared. Dmitry, Thanks a lot for your comment! and abandon this commit.