On 6/30/2016 12:42 PM, Jike Song wrote: > On 06/29/2016 09:51 PM, Xiao Guangrong wrote: >> On 06/21/2016 12:31 AM, Kirti Wankhede wrote: >>> + mutex_unlock(&parent_devices.list_lock); >>> + return parent; >>> +} >>> + >>> +static int mdev_device_create_ops(struct mdev_device *mdev, char *mdev_params) >>> +{ >>> + struct parent_device *parent = mdev->parent; >>> + int ret; >>> + >>> + mutex_lock(&parent->ops_lock); >>> + if (parent->ops->create) { >>> + ret = parent->ops->create(mdev->dev.parent, mdev->uuid, >>> + mdev->instance, mdev_params); >> >> I think it is better if we pass @mdev to this callback, then the parent driver >> can do its specified operations and associate it with the instance, >> e.g, via mdev->private. >> > > Just noticed that mdev->driver_data is missing in v5, I'd like to have it back :) > Actually, I added mdev_get_drvdata() and mdev_set_drvdata() but I missed earlier that mdev->dev->driver_data is used by vfio module to keep reference of vfio_device. So adding driver_data to struct mdev_device again and updating mdev_get_drvdata() and mdev_set_drvdata() as below. static inline void *mdev_get_drvdata(struct mdev_device *mdev) { - return dev_get_drvdata(&mdev->dev); + return mdev->driver_data; } static inline void mdev_set_drvdata(struct mdev_device *mdev, void *data) { - dev_set_drvdata(&mdev->dev, data); + mdev->driver_data = data; } > Yes either mdev need to be passed to parent driver (preferred), or find_mdev_device to > be exported for parent driver (less preferred, but at least functional). > Updating argument to create to have mdev. Thanks, Kirti. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html