mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
vfio/mdev: simplify mdev_type handling
Instead of abusing struct attribute_group to control initialization of struct mdev_type, just define the actual attributes in the mdev_driver, allocate the mdev_type structures in the caller and pass them to mdev_register_parent. This allows the caller to use container_of to get at the containing structure and thus significantly simplify the code. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com> Reviewed-by: Eric Farman <farman@linux.ibm.com> Link: https://lore.kernel.org/r/20220923092652.100656-6-hch@lst.de Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
committed by
Alex Williamson
parent
89345d5177
commit
da44c340c4
@@ -56,10 +56,9 @@ EXPORT_SYMBOL_GPL(mdev_bus_type);
|
||||
**/
|
||||
int mdev_register_driver(struct mdev_driver *drv)
|
||||
{
|
||||
/* initialize common driver fields */
|
||||
if (!drv->types_attrs)
|
||||
return -EINVAL;
|
||||
drv->driver.bus = &mdev_bus_type;
|
||||
|
||||
/* register with core */
|
||||
return driver_register(&drv->driver);
|
||||
}
|
||||
EXPORT_SYMBOL(mdev_register_driver);
|
||||
|
||||
Reference in New Issue
Block a user