Re: [PATCH V2 5/8] mdev: introduce device specific ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2019/9/25 下午10:11, Rob Miller wrote:

> >     mdev_set_class_id(mdev, MDEV_ID_VFIO);
> > +   mdev_set_dev_ops(mdev, &intel_vfio_vgpu_dev_ops);
>
> This seems rather unrefined.  We're registering interdependent data in
> separate calls.  All drivers need to make both of these calls.  I'm not
> sure if this is a good idea, but what if we had:
>
> static const struct vfio_mdev_device_ops intel_vfio_vgpu_dev_ops = {
>       .id                     = MDEV_ID_VFIO,
>       .open                   = intel_vgpu_open,
>       .release                = intel_vgpu_release,
>         ...
>
> And the set function passed &intel_vfio_vgpu_dev_ops.id <http://intel_vfio_vgpu_dev_ops.id> and the mdev
> bus drivers used container_of to get to their callbacks?

or just make it explicit? e.g.

mdev_set_class(mdev, MDEV_ID_VFIO, &intel_vfio_vgpu_dev_ops);


Yes, this seems even better.

Will do this in V3.

Thanks

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux