OpenCloudOS-Kernel/drivers/vfio/mdev
Jason Gunthorpe 9169cff168 vfio/mdev: Correct the function signatures for the mdev_type_attributes
The driver core standard is to pass in the properly typed object, the
properly typed attribute and the buffer data. It stems from the root
kobject method:

  ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr,..)

Each subclass of kobject should provide their own function with the same
signature but more specific types, eg struct device uses:

  ssize_t (*show)(struct device *dev, struct device_attribute *attr,..)

In this case the existing signature is:

  ssize_t (*show)(struct kobject *kobj, struct device *dev,..)

Where kobj is a 'struct mdev_type *' and dev is 'mdev_type->parent->dev'.

Change the mdev_type related sysfs attribute functions to:

  ssize_t (*show)(struct mdev_type *mtype, struct mdev_type_attribute *attr,..)

In order to restore type safety and match the driver core standard

There are no current users of 'attr', but if it is ever needed it would be
hard to add in retroactively, so do it now.

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Message-Id: <18-v2-d36939638fc6+d54-vfio2_jgg@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2021-04-12 10:36:00 -06:00
..
Kconfig docs: driver-api: add a series of orphaned documents 2019-07-15 11:03:02 -03:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mdev_core.c vfio/mdev: Correct the function signatures for the mdev_type_attributes 2021-04-12 10:36:00 -06:00
mdev_driver.c vfio/mdev: Simplify driver registration 2021-04-07 15:39:16 -06:00
mdev_private.h vfio/mdev: Add mdev/mtype_get_type_group_id() 2021-04-07 15:39:18 -06:00
mdev_sysfs.c vfio/mdev: Correct the function signatures for the mdev_type_attributes 2021-04-12 10:36:00 -06:00
vfio_mdev.c vfio/mdev: Remove duplicate storage of parent in mdev_device 2021-04-07 15:39:18 -06:00