[PATCH v3 17/18] PCI: j721e: add reset GPIO to struct j721e_pcie

Andy Shevchenko andy at kernel.org
Mon Feb 26 09:54:25 PST 2024


On Mon, Feb 26, 2024 at 06:05:16PM +0100, Thomas Richard wrote:
> On 2/15/24 17:04, Andy Shevchenko wrote:
> > On Thu, Feb 15, 2024 at 04:18:02PM +0100, Thomas Richard wrote:
> >> From: Théo Lebrun <theo.lebrun at bootlin.com>

...

> >>  	case PCI_MODE_RC:
> >> -		gpiod = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
> >> -		if (IS_ERR(gpiod)) {
> >> -			ret = PTR_ERR(gpiod);
> >> +		pcie->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
> >> +		if (IS_ERR(pcie->reset_gpio)) {
> >> +			ret = PTR_ERR(pcie->reset_gpio);
> >>  			if (ret != -EPROBE_DEFER)
> >>  				dev_err(dev, "Failed to get reset GPIO\n");
> >>  			goto err_get_sync;
> >> @@ -504,9 +504,9 @@ static int j721e_pcie_probe(struct platform_device *pdev)
> >>  		 * mode is selected while enabling the PHY. So deassert PERST#
> >>  		 * after 100 us.
> >>  		 */
> >> -		if (gpiod) {
> >> +		if (pcie->reset_gpio) {
> >>  			usleep_range(100, 200);
> >> -			gpiod_set_value_cansleep(gpiod, 1);
> >> +			gpiod_set_value_cansleep(pcie->reset_gpio, 1);
> >>  		}
> > 
> > Instead of all this, just add one line assignment. Moreover, before or after
> > this patch refactor the code to use ret = dev_err_probe(...); pattern that
> > eliminates those deferral probe checks.
> 
> Hi Andy,
> 
> I'm not sure what you exactly want when you write "just add one line
> assignment".

		pcie->reset_gpio = gpiod;

That's it. No additional code changes are needed (WRT the above context,
of course you want to have a new structure member).

-- 
With Best Regards,
Andy Shevchenko





More information about the linux-arm-kernel mailing list