lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200128050356.GA21357@nuc8i5>
Date:   Tue, 28 Jan 2020 13:06:46 +0800
From:   Dejin Zheng <zhengdejin5@...il.com>
To:     Dmitry Osipenko <digetx@...il.com>
Cc:     gregkh@...uxfoundation.org, thierry.reding@...il.com,
        jonathanh@...dia.com, linux-usb@...r.kernel.org,
        linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: phy: tegra: make the code simple by
 devm_platform_ioremap_resource()

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 <zhengdejin5@...il.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;
> > 
> 
> 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.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ