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

Jason Wang jasowang at redhat.com
Fri Sep 27 08:04:25 UTC 2019


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



More information about the dri-devel mailing list