>On Tue, Apr 26, 2022 at 11:58:19AM +0000, Czerwacki, Eial wrote: >> >From: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> >> >Sent: Sunday, April 24, 2022 16:40 >> >To: Czerwacki, Eial <eial.czerwacki@xxxxxxx> >> >Cc: linux-staging@xxxxxxxxxxxxxxx <linux-staging@xxxxxxxxxxxxxxx>; SAP vSMP Linux Maintainer <linux.vsmp@xxxxxxx> >> >Subject: Re: [RFC V2] drivers/virt/vSMP: new driver >> > >> >On Sun, Apr 24, 2022 at 11:44:33AM +0000, Czerwacki, Eial wrote: >> [snip] >> >> >> +static struct kobject *vsmp_sysfs_kobj; >> >> +static struct pci_dev *vsmp_dev_obj; >> > >> >static variables are not global :) >> > >> >And you should not need this, again, use the proper PCI api insted. >> > >> [snip] >> >> > >> >Do not use global data for anything, that's a huge hint that your driver >> >is incorrectly written. >> > >> [snip] >> >> > >> >greg k-h >> >> I understand the logic behind that, however, I'm not sure I understand what PCI api I can use to replace such vars? > >pci_register_driver() is all you need. thanks, I'll look into it > >> for example for the pci_dev struct of the device or the sysfs object which is used for the other modules >> is there a doc on this I can be pointed to? > >I do not understand, why would your driver ever care about any other PCI >device in the system other than the one that you are wishing to be bound >to? ahh, I understand now, the structure I want to have for the driver is incompatible which the existing framework as it assumes that each module is for a specific device whereas my the structure I want to have is module per feature. I'll adjust the structure of the driver to match the framework's structure > >> as for saving the iomapping, I assume that I should map the bar regions rather than having it mapped all the time, am I right? > >I have no context here, sorry. I'll try to find some examples in the code, maybe someone did something similar Thanks Eial