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: <b2003710-fbc2-803b-134d-22b930342cd5@nvidia.com>
Date:   Wed, 14 Oct 2020 16:37:57 +0800
From:   JC Kuo <jckuo@...dia.com>
To:     Thierry Reding <thierry.reding@...il.com>
CC:     <gregkh@...uxfoundation.org>, <robh@...nel.org>,
        <jonathanh@...dia.com>, <kishon@...com>,
        <linux-tegra@...r.kernel.org>, <linux-usb@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
        <nkristam@...dia.com>
Subject: Re: [PATCH v3 10/15] phy: tegra: xusb: Add wake/sleepwalk for
 Tegra210

On 9/28/20 9:40 PM, Thierry Reding wrote:
> On Wed, Sep 09, 2020 at 04:10:36PM +0800, JC Kuo wrote:
> [...]
>> diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c
> [...]
> 
> Could we add function pointers to struct tegra_xusb_lane_ops for all of
> these? That would allow us to assign them once during probe and then we
> don't have to bother with these is_*() functions and multiplexing but
> instead just call ->enable_phy_wake() and ->disable_phy_wake() directly.
Yes, I will implement in this way. Thanks for the suggestion.

> 
>> +
>> +
> 
> There's an extra blank line here.
> 
I will remove it. Thanks.

>>  static struct tegra_xusb_pad *
>>  tegra210_sata_pad_probe(struct tegra_xusb_padctl *padctl,
>>  			const struct tegra_xusb_pad_soc *soc,
>> @@ -2293,6 +3225,8 @@ tegra210_xusb_padctl_probe(struct device *dev,
>>  			   const struct tegra_xusb_padctl_soc *soc)
>>  {
>>  	struct tegra210_xusb_padctl *padctl;
>> +	struct device_node *node, *np = dev->of_node;
> 
> We only need dev->of_node once, so I don't think we need to store it in
> a local variable. Just make this:
> 
> 	struct device_node *np;
> 
>> +	struct platform_device *pmc_dev;
> 
> I'd call this pdev, which is the canonical name for variables pointing
> to a platform device.
> 
>>  	int err;
>>  
>>  	padctl = devm_kzalloc(dev, sizeof(*padctl), GFP_KERNEL);
>> @@ -2306,6 +3240,23 @@ tegra210_xusb_padctl_probe(struct device *dev,
>>  	if (err < 0)
>>  		return ERR_PTR(err);
>>  
>> +	node = of_parse_phandle(np, "nvidia,pmc", 0);
>> +	if (!node) {
> 
> And make this:
> 
> 	np = of_parse_phandle(dev->of_node, "nvidia,pmc", 0);
> 	if (!np) {
> 
>> +		dev_info(dev, "nvidia,pmc property is missing\n");
> 
> It might be better for this to be a warning, to make it easier to catch.
> 
>> +		goto no_pmc;
>> +	}
>> +
>> +	pmc_dev = of_find_device_by_node(node);
>> +	if (!pmc_dev) {
>> +		dev_info(dev, "pmc device is not available\n");
> 
> Same here. Also s/pmc/PMC/ in the message
> 
>> +		goto no_pmc;
> 
> Maybe call the label "out", "done" or something similar. "no_pmc" makes
> it sound like it's meant for error cases, which makes it confusing when
> you fallthrough for the success case as well.
> 
I will amend accordingly. Thanks.

> Actually, in this case it might be easier to just return here instead of
> using a goto.
> 
>> +	}
>> +
>> +	padctl->regmap = dev_get_regmap(&pmc_dev->dev, "usb_sleepwalk");
>> +	if (!padctl->regmap)
>> +		dev_info(dev, "pmc regmap is not available.\n");
> 
> Do we perhaps want to defer probe here?
The return value of dev_get_regmap() doesn't tell if PMC driver is loaded.

I will add the following to for defer probe.
	if (!device_is_bound(&pdev->dev))
		return -EPROBE_DEFER;
> 
> Thierry
> 

Thanks for review.
JC

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ