Message ID | 162163569407.260470.8069733178174299145.stgit@djiang5-desk3.ch.intel.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | Fix idxd sub-drivers setup | expand |
On Fri, May 21, 2021 at 03:21:34PM -0700, Dave Jiang wrote: > Add name field in idxd_device_driver so we don't have to touch the > 'struct device_driver' during declaration. I'm not actually sure these two patches are an improvement. I view this idiom as being valuable if there is a huge number of kernel users as it does simplify them, but for something small like this I'd keep rather it clear and explicitly set the .drv instead of burning CPU code to do it. But it isn't a big deal either way Jason
diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h index da4195a5e2f1..06bf23dabc82 100644 --- a/drivers/dma/idxd/idxd.h +++ b/drivers/dma/idxd/idxd.h @@ -34,6 +34,7 @@ enum idxd_type { #define IDXD_PMU_EVENT_MAX 64 struct idxd_device_driver { + const char *name; struct device_driver drv; }; diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c index c46421452c9b..cc6779968bec 100644 --- a/drivers/dma/idxd/init.c +++ b/drivers/dma/idxd/init.c @@ -800,6 +800,7 @@ int __idxd_driver_register(struct idxd_device_driver *idxd_drv, struct module *o { struct device_driver *drv = &idxd_drv->drv; + drv->name = idxd_drv->name; drv->bus = &dsa_bus_type; drv->owner = owner; drv->mod_name = mod_name; diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c index c614ffa9a610..9b209788255c 100644 --- a/drivers/dma/idxd/sysfs.c +++ b/drivers/dma/idxd/sysfs.c @@ -323,9 +323,7 @@ struct bus_type dsa_bus_type = { }; static struct idxd_device_driver dsa_drv = { - .drv = { - .name = "dsa", - }, + .name = "dsa", }; /* IDXD generic driver setup */