lkml.org 
[lkml]   [2022]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH v1 4/7] vfio/ccw: move private to mdev lifecycle
From
Date
On Tue, 2022-11-01 at 09:08 +0000, Tian, Kevin wrote:
> > From: Eric Farman <farman@linux.ibm.com>
> > Sent: Thursday, October 20, 2022 12:22 AM
> >
> > @@ -101,15 +101,20 @@ static int vfio_ccw_mdev_probe(struct
> > mdev_device *mdev)
> >  {
> >         struct subchannel *sch = to_subchannel(mdev->dev.parent);
> >         struct vfio_ccw_parent *parent = dev_get_drvdata(&sch-
> > >dev);
> > -       struct vfio_ccw_private *private = dev_get_drvdata(&parent-
> > >dev);
> > +       struct vfio_ccw_private *private;
> >         int ret;
> >
> > -       if (private->state == VFIO_CCW_STATE_NOT_OPER)
> > -               return -ENODEV;
>
> Not familiar with ccw but just want to double confirm this removal
> is intentional w/o side-effect?

Right, it's intentional and fine. The concern previously was re-probing
the mdev when a device had gone into a non-recoverable state and the
private data was left hanging around. With the private now being
cleaned up in mdev_remove instead of the subchannel side, that's no
longer an issue.

>
> > +       private = vfio_ccw_alloc_private(sch);
> > +       if (!private)
> > +               return -ENOMEM;
> >
> >         ret = vfio_init_device(&private->vdev, &mdev->dev,
> > &vfio_ccw_dev_ops);
> > -       if (ret)
> > +       if (ret) {
> > +               kfree(private);
> >                 return ret;
> > +       }
> > +
> > +       dev_set_drvdata(&parent->dev, private);
> >
> >         VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: create\n",
> >                            sch->schid.cssid,
> > @@ -123,6 +128,7 @@ static int vfio_ccw_mdev_probe(struct
> > mdev_device
> > *mdev)
> >         return 0;
> >
> >  err_put_vdev:
> > +       dev_set_drvdata(&parent->dev, NULL);
>
> No need to set drvdata to NULL, iiuc

Fair.
\
 
 \ /
  Last update: 2022-11-01 15:07    [W:0.070 / U:1.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site