Re: [PATCH v2 2/5] PCI/pwrctrl: Move pci_pwrctrl_init() before turning ON the supplies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Sep 07, 2025 at 04:22:42PM GMT, Bjorn Helgaas wrote:
> On Wed, Sep 03, 2025 at 12:43:24PM +0530, Manivannan Sadhasivam via B4 Relay wrote:
> > From: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
> > 
> > To allow pwrctrl core to parse the generic resources such as PERST# GPIO
> > before turning on the supplies.
> 
> Can we expand this a little bit?  Which function does that parsing,
> for example?  pci_pwrctrl_init() itself doesn't do any of that, so the
> connection isn't obious.
> 

Sure.

Pwrctrl core function pci_pwrctrl_device_set_ready() deasserts PERST# if the
callback is available. Since that requires accessing 'pwrctrl->dev',
pci_pwrctrl_init() that is setting 'pwrctrl->dev' needs to be called earlier.

I will change the description to be more elaborative. It also requires rewording
since the pwrctrl core is not parsing PERST# on its own now.

- Mani

> > Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
> > ---
> >  drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c | 4 ++--
> >  drivers/pci/pwrctrl/slot.c               | 4 ++--
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c b/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c
> > index 4e664e7b8dd23f592c0392efbf6728fc5bf9093f..b65955adc7bd44030593e8c49d60db0f39b03d03 100644
> > --- a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c
> > +++ b/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c
> > @@ -80,6 +80,8 @@ static int pci_pwrctrl_pwrseq_probe(struct platform_device *pdev)
> >  	if (!data)
> >  		return -ENOMEM;
> >  
> > +	pci_pwrctrl_init(&data->ctx, dev);
> > +
> >  	data->pwrseq = devm_pwrseq_get(dev, pdata->target);
> >  	if (IS_ERR(data->pwrseq))
> >  		return dev_err_probe(dev, PTR_ERR(data->pwrseq),
> > @@ -95,8 +97,6 @@ static int pci_pwrctrl_pwrseq_probe(struct platform_device *pdev)
> >  	if (ret)
> >  		return ret;
> >  
> > -	pci_pwrctrl_init(&data->ctx, dev);
> > -
> >  	ret = devm_pci_pwrctrl_device_set_ready(dev, &data->ctx);
> >  	if (ret)
> >  		return dev_err_probe(dev, ret,
> > diff --git a/drivers/pci/pwrctrl/slot.c b/drivers/pci/pwrctrl/slot.c
> > index 6e138310b45b9f7e930b6814e0a24f7111d25fee..b68406a6b027e4d9f853e86d4340e0ab267b6126 100644
> > --- a/drivers/pci/pwrctrl/slot.c
> > +++ b/drivers/pci/pwrctrl/slot.c
> > @@ -38,6 +38,8 @@ static int pci_pwrctrl_slot_probe(struct platform_device *pdev)
> >  	if (!slot)
> >  		return -ENOMEM;
> >  
> > +	pci_pwrctrl_init(&slot->ctx, dev);
> > +
> >  	ret = of_regulator_bulk_get_all(dev, dev_of_node(dev),
> >  					&slot->supplies);
> >  	if (ret < 0) {
> > @@ -63,8 +65,6 @@ static int pci_pwrctrl_slot_probe(struct platform_device *pdev)
> >  				     "Failed to enable slot clock\n");
> >  	}
> >  
> > -	pci_pwrctrl_init(&slot->ctx, dev);
> > -
> >  	ret = devm_pci_pwrctrl_device_set_ready(dev, &slot->ctx);
> >  	if (ret)
> >  		return dev_err_probe(dev, ret, "Failed to register pwrctrl driver\n");
> > 
> > -- 
> > 2.45.2
> > 
> > 

-- 
மணிவண்ணன் சதாசிவம்




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux