Re: [PATCH v2 1/4] PCI: Add pci_power_t helper functions

From: Habil Eren Türker

Date: Sat Nov 21 2026 - 06:05:14 EST


On Thu, Nov 19, 2026 at 07:18:44PM +0200, andriy.shevchenko@xxxxxxxxx wrote:
> On Thu, Nov 19, 2026 at 11:07:13AM -0600, Bjorn Helgaas wrote:
> > On Thu, Nov 19, 2026 at 06:51:06PM +0200, andriy.shevchenko@xxxxxxxxx wrote:
> > > On Thu, Nov 19, 2026 at 02:35:46PM +0000, Habil Eren Türker wrote:
> > > > Add helper functions to extract, set and compare PCI power
> > > > states in the Power Management Control/Status register.
>
> ...
>
> > > > +/* Helper functions for PCI power management */
> > > > +static inline pci_power_t pci_power_t_get(u32 csr)
> > >
> > > Why u32 as it seems the value is 16-bit?
> >
> > I think there's one reader of PCI_PM_CTRL that does a 32-bit read, and
> > I figured a u16->u32 promotion would be better than a u32->u16
> > truncation. But maybe that reader should be changed to a 16-bit read.
>
> Is it specific read on the specific HW that is always done as 32-bit?
> (Personally I do not believe there is such a requirement to even weirdest
> PCI HW. This register is way too standard.)

Hi,

The reason why I put u32 is that in drivers/net/ethernet/broadcom/bnx2.c,
there is a u32 read:
`pci_read_config_dword(bp->pdev, bp->pm_cap + PCI_PM_CTRL, &val1);`

However, using u16 is much better solution since the PCI core uses u16
reads.

I will change it to u16 in v3.

Thanks for the clarification.

Regards,
Türker