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]
Date:   Mon, 9 Dec 2019 11:57:51 +0530
From:   Nagarjuna Kristam <nkristam@...dia.com>
To:     Thierry Reding <thierry.reding@...il.com>
CC:     <balbi@...nel.org>, <gregkh@...uxfoundation.org>,
        <jonathanh@...dia.com>, <mark.rutland@....com>,
        <robh+dt@...nel.org>, <kishon@...com>,
        <devicetree@...r.kernel.org>, <linux-tegra@...r.kernel.org>,
        <linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 05/18] phy: tegra: xusb: Add support to get companion USB
 3 port



On 06-12-2019 20:27, Thierry Reding wrote:
> On Fri, Dec 06, 2019 at 04:20:08PM +0530, Nagarjuna Kristam wrote:
>> Tegra XUSB host, device mode driver requires the USB 3 companion port
>> number for corresponding USB 2 port. Add API to retrieve the same.
>>
>> Signed-off-by: Nagarjuna Kristam <nkristam@...dia.com>
>> ---
>>  drivers/phy/tegra/xusb.c       | 21 +++++++++++++++++++++
>>  include/linux/phy/tegra/xusb.h |  2 ++
>>  2 files changed, 23 insertions(+)
>>
>> diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
>> index 4c86c99..2e73cf8 100644
>> --- a/drivers/phy/tegra/xusb.c
>> +++ b/drivers/phy/tegra/xusb.c
>> @@ -1254,6 +1254,27 @@ int tegra_phy_xusb_utmi_port_reset(struct phy *phy)
>>  }
>>  EXPORT_SYMBOL_GPL(tegra_phy_xusb_utmi_port_reset);
>>  
>> +int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl,
>> +				    unsigned int port)
>> +{
>> +	struct tegra_xusb_usb2_port *usb2 = tegra_xusb_find_usb2_port(padctl,
>> +								      port);
>> +	struct tegra_xusb_usb3_port *usb3;
>> +	int i;
>> +
>> +	if (!usb2)
>> +		return -EINVAL;
>> +
>> +	for (i = 0; i < padctl->soc->ports.usb3.count; i++) {
>> +		usb3 = tegra_xusb_find_usb3_port(padctl, i);
>> +		if (usb3 && usb3->port == usb2->base.index)
>> +			return usb3->base.index;
>> +	}
>> +
>> +	return -1;
> Since you return -EINVAL above, callers will have to interpret negative
> return values as standard errors, which would make this EPERM. That does
> not really make sense. Perhaps something like -ENODEV would be more
> appropriate in this case?
> 
> Thierry
> 
Yes, making -ENODEV instead of -1 makes it inline with generic error codes.
Will update accordingly.

-Nagarjuna
>> +}
>> +EXPORT_SYMBOL_GPL(tegra_xusb_padctl_get_usb3_companion);
>> +
>>  MODULE_AUTHOR("Thierry Reding <treding@...dia.com>");
>>  MODULE_DESCRIPTION("Tegra XUSB Pad Controller driver");
>>  MODULE_LICENSE("GPL v2");
>> diff --git a/include/linux/phy/tegra/xusb.h b/include/linux/phy/tegra/xusb.h
>> index 1235865..71d9569 100644
>> --- a/include/linux/phy/tegra/xusb.h
>> +++ b/include/linux/phy/tegra/xusb.h
>> @@ -21,4 +21,6 @@ int tegra_xusb_padctl_usb3_set_lfps_detect(struct tegra_xusb_padctl *padctl,
>>  int tegra_xusb_padctl_set_vbus_override(struct tegra_xusb_padctl *padctl,
>>  					bool val);
>>  int tegra_phy_xusb_utmi_port_reset(struct phy *phy);
>> +int tegra_xusb_padctl_get_usb3_companion(struct tegra_xusb_padctl *padctl,
>> +					 unsigned int port);
>>  #endif /* PHY_TEGRA_XUSB_H */
>> -- 
>> 2.7.4
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ