Message ID | 20210428151207.1212258-9-andrey.grodzovsky@amd.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | RFC Support hot device unplug in amdgpu | expand |
In subject: s/PCI: add support/PCI: Add support/ to match convention ("git log --oneline drivers/pci/pci-driver.c" to learn this). On Wed, Apr 28, 2021 at 11:11:48AM -0400, Andrey Grodzovsky wrote: > This is exact copy of 'USB: add support for dev_groups to > struct usb_device_driver' patch by Greg but just for > the PCI case. Ideally this would be an imperative sentence telling us what the patch *does*, not just that it's a copy of something else. I'd also like a brief comment about why this is useful, i.e., why you need this and what you're going to use it for. The usual commit citation format is 7d9c1d2f7aca ("USB: add support for dev_groups to struct usb_device_driver") so it's easier to locate the commit. I see there is also b71b283e3d6d ("USB: add support for dev_groups to struct usb_driver"). I don't know enough about USB to know whether 7d9c1d2f7aca or b71b283e3d6d is a closer analogue to what you're doing here, but I do see that struct usb_driver is far more common than struct usb_device_driver. PCI has struct pci_driver, but doesn't have the concept of a struct pci_device_driver. > Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> > Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > --- > drivers/pci/pci-driver.c | 1 + > include/linux/pci.h | 3 +++ > 2 files changed, 4 insertions(+) > > diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c > index ec44a79e951a..3a72352aa5cf 100644 > --- a/drivers/pci/pci-driver.c > +++ b/drivers/pci/pci-driver.c > @@ -1385,6 +1385,7 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner, > drv->driver.owner = owner; > drv->driver.mod_name = mod_name; > drv->driver.groups = drv->groups; > + drv->driver.dev_groups = drv->dev_groups; > > spin_lock_init(&drv->dynids.lock); > INIT_LIST_HEAD(&drv->dynids.list); > diff --git a/include/linux/pci.h b/include/linux/pci.h > index 86c799c97b77..b57755b03009 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -858,6 +858,8 @@ struct module; > * number of VFs to enable via sysfs "sriov_numvfs" file. > * @err_handler: See Documentation/PCI/pci-error-recovery.rst > * @groups: Sysfs attribute groups. > + * @dev_groups: Attributes attached to the device that will be > + * created once it is bound to the driver. > * @driver: Driver model structure. > * @dynids: List of dynamically added device IDs. > */ > @@ -873,6 +875,7 @@ struct pci_driver { > int (*sriov_configure)(struct pci_dev *dev, int num_vfs); /* On PF */ > const struct pci_error_handlers *err_handler; > const struct attribute_group **groups; > + const struct attribute_group **dev_groups; > struct device_driver driver; > struct pci_dynids dynids; > }; > -- > 2.25.1 >
On 2021-04-28 12:53 p.m., Bjorn Helgaas wrote: > In subject: > > s/PCI: add support/PCI: Add support/ > > to match convention ("git log --oneline drivers/pci/pci-driver.c" to > learn this). > > On Wed, Apr 28, 2021 at 11:11:48AM -0400, Andrey Grodzovsky wrote: >> This is exact copy of 'USB: add support for dev_groups to >> struct usb_device_driver' patch by Greg but just for >> the PCI case. > > Ideally this would be an imperative sentence telling us what the patch > *does*, not just that it's a copy of something else. > > I'd also like a brief comment about why this is useful, i.e., why you > need this and what you're going to use it for. > > The usual commit citation format is 7d9c1d2f7aca ("USB: add support > for dev_groups to struct usb_device_driver") so it's easier to locate > the commit. > > I see there is also b71b283e3d6d ("USB: add support for dev_groups to > struct usb_driver"). I don't know enough about USB to know whether > 7d9c1d2f7aca or b71b283e3d6d is a closer analogue to what you're doing > here, but I do see that struct usb_driver is far more common than > struct usb_device_driver. > > PCI has struct pci_driver, but doesn't have the concept of a struct > pci_device_driver. Since we don't have pci_device_driver then pci_driver is the best place for it then, no ? Andrey > >> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> >> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> >> --- >> drivers/pci/pci-driver.c | 1 + >> include/linux/pci.h | 3 +++ >> 2 files changed, 4 insertions(+) >> >> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c >> index ec44a79e951a..3a72352aa5cf 100644 >> --- a/drivers/pci/pci-driver.c >> +++ b/drivers/pci/pci-driver.c >> @@ -1385,6 +1385,7 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner, >> drv->driver.owner = owner; >> drv->driver.mod_name = mod_name; >> drv->driver.groups = drv->groups; >> + drv->driver.dev_groups = drv->dev_groups; >> >> spin_lock_init(&drv->dynids.lock); >> INIT_LIST_HEAD(&drv->dynids.list); >> diff --git a/include/linux/pci.h b/include/linux/pci.h >> index 86c799c97b77..b57755b03009 100644 >> --- a/include/linux/pci.h >> +++ b/include/linux/pci.h >> @@ -858,6 +858,8 @@ struct module; >> * number of VFs to enable via sysfs "sriov_numvfs" file. >> * @err_handler: See Documentation/PCI/pci-error-recovery.rst >> * @groups: Sysfs attribute groups. >> + * @dev_groups: Attributes attached to the device that will be >> + * created once it is bound to the driver. >> * @driver: Driver model structure. >> * @dynids: List of dynamically added device IDs. >> */ >> @@ -873,6 +875,7 @@ struct pci_driver { >> int (*sriov_configure)(struct pci_dev *dev, int num_vfs); /* On PF */ >> const struct pci_error_handlers *err_handler; >> const struct attribute_group **groups; >> + const struct attribute_group **dev_groups; >> struct device_driver driver; >> struct pci_dynids dynids; >> }; >> -- >> 2.25.1 >>
On Thu, Apr 29, 2021 at 12:53:15PM -0400, Andrey Grodzovsky wrote: > On 2021-04-28 12:53 p.m., Bjorn Helgaas wrote: > > On Wed, Apr 28, 2021 at 11:11:48AM -0400, Andrey Grodzovsky wrote: > > > This is exact copy of 'USB: add support for dev_groups to > > > struct usb_device_driver' patch by Greg but just for > > > the PCI case. > > ... > > The usual commit citation format is 7d9c1d2f7aca ("USB: add support > > for dev_groups to struct usb_device_driver") so it's easier to locate > > the commit. > > > > I see there is also b71b283e3d6d ("USB: add support for dev_groups to > > struct usb_driver"). I don't know enough about USB to know whether > > 7d9c1d2f7aca or b71b283e3d6d is a closer analogue to what you're doing > > here, but I do see that struct usb_driver is far more common than > > struct usb_device_driver. > > > > PCI has struct pci_driver, but doesn't have the concept of a struct > > pci_device_driver. > > Since we don't have pci_device_driver then pci_driver is the best place > for it then, no ? Of course. My point was just that maybe you should say this is similar to b71b283e3d6d ("USB: add support for dev_groups to struct usb_driver"), not similar to 7d9c1d2f7aca ("USB: add support for dev_groups to struct usb_device_driver"). Bjorn
On 2021-04-29 3:23 p.m., Bjorn Helgaas wrote: > On Thu, Apr 29, 2021 at 12:53:15PM -0400, Andrey Grodzovsky wrote: >> On 2021-04-28 12:53 p.m., Bjorn Helgaas wrote: >>> On Wed, Apr 28, 2021 at 11:11:48AM -0400, Andrey Grodzovsky wrote: >>>> This is exact copy of 'USB: add support for dev_groups to >>>> struct usb_device_driver' patch by Greg but just for >>>> the PCI case. > >>> ... >>> The usual commit citation format is 7d9c1d2f7aca ("USB: add support >>> for dev_groups to struct usb_device_driver") so it's easier to locate >>> the commit. >>> >>> I see there is also b71b283e3d6d ("USB: add support for dev_groups to >>> struct usb_driver"). I don't know enough about USB to know whether >>> 7d9c1d2f7aca or b71b283e3d6d is a closer analogue to what you're doing >>> here, but I do see that struct usb_driver is far more common than >>> struct usb_device_driver. >>> >>> PCI has struct pci_driver, but doesn't have the concept of a struct >>> pci_device_driver. >> >> Since we don't have pci_device_driver then pci_driver is the best place >> for it then, no ? > > Of course. My point was just that maybe you should say this is > similar to b71b283e3d6d ("USB: add support for dev_groups to struct > usb_driver"), not similar to 7d9c1d2f7aca ("USB: add support for > dev_groups to struct usb_device_driver"). Got it. Andrey > > Bjorn > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Candrey.grodzovsky%40amd.com%7C9778eea1c3164f9fbc5f08d90b443ba6%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637553209952825202%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=tkycS4EST1Q%2BkEWlmzocPjCxaONVk5sPzPnWmrmbfcg%3D&reserved=0 >
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index ec44a79e951a..3a72352aa5cf 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1385,6 +1385,7 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner, drv->driver.owner = owner; drv->driver.mod_name = mod_name; drv->driver.groups = drv->groups; + drv->driver.dev_groups = drv->dev_groups; spin_lock_init(&drv->dynids.lock); INIT_LIST_HEAD(&drv->dynids.list); diff --git a/include/linux/pci.h b/include/linux/pci.h index 86c799c97b77..b57755b03009 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -858,6 +858,8 @@ struct module; * number of VFs to enable via sysfs "sriov_numvfs" file. * @err_handler: See Documentation/PCI/pci-error-recovery.rst * @groups: Sysfs attribute groups. + * @dev_groups: Attributes attached to the device that will be + * created once it is bound to the driver. * @driver: Driver model structure. * @dynids: List of dynamically added device IDs. */ @@ -873,6 +875,7 @@ struct pci_driver { int (*sriov_configure)(struct pci_dev *dev, int num_vfs); /* On PF */ const struct pci_error_handlers *err_handler; const struct attribute_group **groups; + const struct attribute_group **dev_groups; struct device_driver driver; struct pci_dynids dynids; };
This is exact copy of 'USB: add support for dev_groups to struct usb_device_driver' patch by Greg but just for the PCI case. Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/pci/pci-driver.c | 1 + include/linux/pci.h | 3 +++ 2 files changed, 4 insertions(+)