On Wed, Jun 07, 2023 at 06:55:49PM +0800, Sui Jingfeng wrote: > From: Sui Jingfeng <suijingfeng@xxxxxxxxxxx> > > This patch adds PCI driver support on top of what we already have. Take > the GC1000 in LS7A1000/LS2K1000 as the first instance of the PCI device > driver. There is only one GPU core for the GC1000 in the LS7A1000 and > LS2K1000. Therefore, component frameworks can be avoided. > +#ifdef CONFIG_DRM_ETNAVIV_PCI_DRIVER > +#include "etnaviv_pci_drv.h" > +#endif With trivial stubs for etnaviv_register_pci_driver() and etnaviv_unregister_pci_driver(), I think you could get rid of all these #ifdefs. > +void etnaviv_drm_unbind(struct device *dev, bool component) > { > struct etnaviv_drm_private *priv = etna_private_ptr; > struct drm_device *drm = priv->drm; > @@ -746,6 +750,12 @@ static int __init etnaviv_init(void) > if (ret != 0) > goto unregister_gpu_driver; > > +#ifdef CONFIG_DRM_ETNAVIV_PCI_DRIVER > + ret = etnaviv_register_pci_driver(); > + if (ret != 0) > + goto unregister_platform_driver; > +#endif > + > /* > * If the DT contains at least one available GPU device, instantiate > * the DRM platform device. > @@ -763,7 +773,7 @@ static int __init etnaviv_init(void) > break; > } > > - return 0; > + return ret; > > unregister_platform_driver: > platform_driver_unregister(&etnaviv_platform_driver); > @@ -778,6 +788,10 @@ static void __exit etnaviv_exit(void) > etnaviv_destroy_platform_device(&etnaviv_platform_device); > platform_driver_unregister(&etnaviv_platform_driver); > platform_driver_unregister(&etnaviv_gpu_driver); > + > +#ifdef CONFIG_DRM_ETNAVIV_PCI_DRIVER > + etnaviv_unregister_pci_driver(); > +#endif > +static const struct pci_device_id etnaviv_pci_id_lists[] = { > + {PCI_VENDOR_ID_LOONGSON, 0x7a15, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, > + {PCI_VENDOR_ID_LOONGSON, 0x7a05, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, PCI_VDEVICE() Bjorn