mbox series

[00/13] Unify device * to platform_device *

Message ID cover.1638022048.git.ffclaire1224@gmail.com (mailing list archive)
Headers show
Series Unify device * to platform_device * | expand

Message

Fan Fei Nov. 27, 2021, 2:11 p.m. UTC
Some PCI controller structs contain "device *", while others contain
"platform_device *". These patches unify "device *dev" to 
"platform_device *pdev" in 13 controller struct, to make the controller 
struct more consistent. Consider that PCI controllers interact with 
platform_device directly, not device, to enumerate the controlled device.

Fan Fei (13):
  PCI: xilinx: Replace device * with platform_device *
  PCI: mediatek: Replace device * with platform_device *
  PCI: tegra: Replace device * with platform_device *
  PCI: xegene: Replace device * with platform_device *
  PCI: microchip: Replace device * with platform_device *
  PCI: brcmstb: Replace device * with platform_device *
  PCI: mediatek-gen3: Replace device * with platform_device *
  PCI: rcar-gen2: Replace device * with platform_device *
  PCI: ftpci100: Replace device * with platform_device *
  PCI: v3-semi: Replace device * with platform_device *
  PCI: ixp4xx: Replace device * with platform_device *
  PCI: xilinx-nwl: Replace device * with platform_device *
  PCI: rcar: Replace device * with platform_device *

 drivers/pci/controller/pci-ftpci100.c        |  15 +-
 drivers/pci/controller/pci-ixp4xx.c          |  47 ++--
 drivers/pci/controller/pci-rcar-gen2.c       |  10 +-
 drivers/pci/controller/pci-tegra.c           |  85 +++----
 drivers/pci/controller/pci-v3-semi.c         |  19 +-
 drivers/pci/controller/pci-xgene.c           | 222 +++++++++----------
 drivers/pci/controller/pcie-brcmstb.c        |  35 +--
 drivers/pci/controller/pcie-mediatek-gen3.c  |  36 +--
 drivers/pci/controller/pcie-mediatek.c       |  31 +--
 drivers/pci/controller/pcie-microchip-host.c |  18 +-
 drivers/pci/controller/pcie-rcar-ep.c        |  40 ++--
 drivers/pci/controller/pcie-rcar-host.c      |  27 +--
 drivers/pci/controller/pcie-rcar.h           |   2 +-
 drivers/pci/controller/pcie-xilinx-nwl.c     |  28 +--
 drivers/pci/controller/pcie-xilinx.c         |  21 +-
 15 files changed, 328 insertions(+), 308 deletions(-)

Comments

Bjorn Helgaas Dec. 23, 2021, 12:43 a.m. UTC | #1
On Sat, Nov 27, 2021 at 03:11:08PM +0100, Fan Fei wrote:
> Some PCI controller structs contain "device *", while others contain
> "platform_device *". These patches unify "device *dev" to 
> "platform_device *pdev" in 13 controller struct, to make the controller 
> struct more consistent. Consider that PCI controllers interact with 
> platform_device directly, not device, to enumerate the controlled device.

I went through all the controller drivers using a command like this:

  git grep -A4 -E "^struct .*_pci.?\> \{$" drivers/pci/controller/

and found that almost all of them hang onto the "struct device *", not
the "struct platform_device *".  Many of these are buried inside
struct dw_pcie and struct cdns_pcie.

I know I've gone back and forth on this, but I don't think the churn
of converting some of them to keep the "struct platform_device *"
would be worthwhile.

The preceding series that renamed the controller structs made this
exploration quite a bit easier, so I do plan to apply that series.

> Fan Fei (13):
>   PCI: xilinx: Replace device * with platform_device *
>   PCI: mediatek: Replace device * with platform_device *
>   PCI: tegra: Replace device * with platform_device *
>   PCI: xegene: Replace device * with platform_device *
>   PCI: microchip: Replace device * with platform_device *
>   PCI: brcmstb: Replace device * with platform_device *
>   PCI: mediatek-gen3: Replace device * with platform_device *
>   PCI: rcar-gen2: Replace device * with platform_device *
>   PCI: ftpci100: Replace device * with platform_device *
>   PCI: v3-semi: Replace device * with platform_device *
>   PCI: ixp4xx: Replace device * with platform_device *
>   PCI: xilinx-nwl: Replace device * with platform_device *
>   PCI: rcar: Replace device * with platform_device *
> 
>  drivers/pci/controller/pci-ftpci100.c        |  15 +-
>  drivers/pci/controller/pci-ixp4xx.c          |  47 ++--
>  drivers/pci/controller/pci-rcar-gen2.c       |  10 +-
>  drivers/pci/controller/pci-tegra.c           |  85 +++----
>  drivers/pci/controller/pci-v3-semi.c         |  19 +-
>  drivers/pci/controller/pci-xgene.c           | 222 +++++++++----------
>  drivers/pci/controller/pcie-brcmstb.c        |  35 +--
>  drivers/pci/controller/pcie-mediatek-gen3.c  |  36 +--
>  drivers/pci/controller/pcie-mediatek.c       |  31 +--
>  drivers/pci/controller/pcie-microchip-host.c |  18 +-
>  drivers/pci/controller/pcie-rcar-ep.c        |  40 ++--
>  drivers/pci/controller/pcie-rcar-host.c      |  27 +--
>  drivers/pci/controller/pcie-rcar.h           |   2 +-
>  drivers/pci/controller/pcie-xilinx-nwl.c     |  28 +--
>  drivers/pci/controller/pcie-xilinx.c         |  21 +-
>  15 files changed, 328 insertions(+), 308 deletions(-)
> 
> -- 
> 2.25.1
>
Fan Fei Dec. 28, 2021, 7:38 p.m. UTC | #2
On Wed, Dec 22, 2021 at 06:43:37PM -0600, Bjorn Helgaas wrote:
Hi, Bjorn
> On Sat, Nov 27, 2021 at 03:11:08PM +0100, Fan Fei wrote:
> > Some PCI controller structs contain "device *", while others contain
> > "platform_device *". These patches unify "device *dev" to
> > "platform_device *pdev" in 13 controller struct, to make the controller
> > struct more consistent. Consider that PCI controllers interact with
> > platform_device directly, not device, to enumerate the controlled
> > device.
> 
> I went through all the controller drivers using a command like this:
> 
>   git grep -A4 -E "^struct .*_pci.?\> \{$" drivers/pci/controller/
> 
> and found that almost all of them hang onto the "struct device *", not
> the "struct platform_device *".  Many of these are buried inside struct
> dw_pcie and struct cdns_pcie.
>
Do you mean most of these structs contain dw_pcie and cdns_pcie, both of
which contain "sturct device *"? I did realize this is not consistent with
other controller device if we make this change.
> I know I've gone back and forth on this, but I don't think the churn of
> converting some of them to keep the "struct platform_device *" would be
> worthwhile.
> 
I could convert "platform_device *" back to "device *", e.g. in the
pcie-altear.c. What do you think?
> The preceding series that renamed the controller structs made this
> exploration quite a bit easier, so I do plan to apply that series.
> 
> > Fan Fei (13): PCI: xilinx: Replace device * with platform_device * PCI:
> > mediatek: Replace device * with platform_device * PCI: tegra: Replace
> > device * with platform_device * PCI: xegene: Replace device * with
> > platform_device * PCI: microchip: Replace device * with platform_device
> > * PCI: brcmstb: Replace device * with platform_device * PCI:
> > mediatek-gen3: Replace device * with platform_device * PCI: rcar-gen2:
> > Replace device * with platform_device * PCI: ftpci100: Replace device *
> > with platform_device * PCI: v3-semi: Replace device * with
> > platform_device * PCI: ixp4xx: Replace device * with platform_device *
> > PCI: xilinx-nwl: Replace device * with platform_device * PCI: rcar:
> > Replace device * with platform_device *
> > 
> >  drivers/pci/controller/pci-ftpci100.c        |  15 +-
> >  drivers/pci/controller/pci-ixp4xx.c          |  47 ++--
> >  drivers/pci/controller/pci-rcar-gen2.c       |  10 +-
> >  drivers/pci/controller/pci-tegra.c           |  85 +++----
> >  drivers/pci/controller/pci-v3-semi.c         |  19 +-
> >  drivers/pci/controller/pci-xgene.c           | 222 +++++++++----------
> >  drivers/pci/controller/pcie-brcmstb.c        |  35 +--
> >  drivers/pci/controller/pcie-mediatek-gen3.c  |  36 +--
> >  drivers/pci/controller/pcie-mediatek.c       |  31 +--
> >  drivers/pci/controller/pcie-microchip-host.c |  18 +-
> >  drivers/pci/controller/pcie-rcar-ep.c        |  40 ++--
> >  drivers/pci/controller/pcie-rcar-host.c      |  27 +--
> >  drivers/pci/controller/pcie-rcar.h           |   2 +-
> >  drivers/pci/controller/pcie-xilinx-nwl.c     |  28 +--
> >  drivers/pci/controller/pcie-xilinx.c         |  21 +- 15 files
> >  changed, 328 insertions(+), 308 deletions(-)
> > 
> > -- 2.25.1
> >
Bjorn Helgaas Dec. 29, 2021, 5:14 p.m. UTC | #3
On Tue, Dec 28, 2021 at 08:38:01PM +0100, Fan Fei wrote:
> On Wed, Dec 22, 2021 at 06:43:37PM -0600, Bjorn Helgaas wrote:
> > On Sat, Nov 27, 2021 at 03:11:08PM +0100, Fan Fei wrote:
> > > Some PCI controller structs contain "device *", while others contain
> > > "platform_device *". These patches unify "device *dev" to
> > > "platform_device *pdev" in 13 controller struct, to make the controller
> > > struct more consistent. Consider that PCI controllers interact with
> > > platform_device directly, not device, to enumerate the controlled
> > > device.
> > 
> > I went through all the controller drivers using a command like this:
> > 
> >   git grep -A4 -E "^struct .*_pci.?\> \{$" drivers/pci/controller/
> > 
> > and found that almost all of them hang onto the "struct device *", not
> > the "struct platform_device *".  Many of these are buried inside struct
> > dw_pcie and struct cdns_pcie.
> >
> Do you mean most of these structs contain dw_pcie and cdns_pcie, both of
> which contain "sturct device *"?

Yes.

> > I know I've gone back and forth on this, but I don't think the churn of
> > converting some of them to keep the "struct platform_device *" would be
> > worthwhile.
> > 
> I could convert "platform_device *" back to "device *", e.g. in the
> pcie-altear.c. What do you think?

No, I don't think we should do that.  I don't think there's really any
benefit right now.

Bjorn