Message ID | 20220602171948.2790690-8-farman@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | VFIO ccw/mdev rework | expand |
On Thu, Jun 02, 2022 at 07:19:37PM +0200, Eric Farman wrote: > The vfio_ccw_mdev_(un)reg routines are merely vfio-ccw routines that > pass control to mdev_(un)register_device. Since there's only one > caller of each, let's just call the mdev routines directly. > > Suggested-by: Jason Gunthorpe <jgg@nvidia.com> > Signed-off-by: Eric Farman <farman@linux.ibm.com> > --- > drivers/s390/cio/vfio_ccw_drv.c | 4 ++-- > drivers/s390/cio/vfio_ccw_ops.c | 12 +----------- > drivers/s390/cio/vfio_ccw_private.h | 4 +--- > 3 files changed, 4 insertions(+), 16 deletions(-) Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Jason
On 6/2/22 1:19 PM, Eric Farman wrote: > The vfio_ccw_mdev_(un)reg routines are merely vfio-ccw routines that > pass control to mdev_(un)register_device. Since there's only one > caller of each, let's just call the mdev routines directly. I'd reword slightly to reference the ops extern ".. caller of each, externalize vfio_ccw_mdev_ops and call..." regardless, Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> > > Suggested-by: Jason Gunthorpe <jgg@nvidia.com> > Signed-off-by: Eric Farman <farman@linux.ibm.com> > --- > drivers/s390/cio/vfio_ccw_drv.c | 4 ++-- > drivers/s390/cio/vfio_ccw_ops.c | 12 +----------- > drivers/s390/cio/vfio_ccw_private.h | 4 +--- > 3 files changed, 4 insertions(+), 16 deletions(-) > > diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c > index 9d817aa2f1c4..3784eb4cda85 100644 > --- a/drivers/s390/cio/vfio_ccw_drv.c > +++ b/drivers/s390/cio/vfio_ccw_drv.c > @@ -239,7 +239,7 @@ static int vfio_ccw_sch_probe(struct subchannel *sch) > > private->state = VFIO_CCW_STATE_STANDBY; > > - ret = vfio_ccw_mdev_reg(sch); > + ret = mdev_register_device(&sch->dev, &vfio_ccw_mdev_ops); > if (ret) > goto out_disable; > > @@ -261,7 +261,7 @@ static void vfio_ccw_sch_remove(struct subchannel *sch) > struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev); > > vfio_ccw_sch_quiesce(sch); > - vfio_ccw_mdev_unreg(sch); > + mdev_unregister_device(&sch->dev); > > dev_set_drvdata(&sch->dev, NULL); > > diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c > index 4a64c176facb..497e1b7ffd61 100644 > --- a/drivers/s390/cio/vfio_ccw_ops.c > +++ b/drivers/s390/cio/vfio_ccw_ops.c > @@ -656,18 +656,8 @@ struct mdev_driver vfio_ccw_mdev_driver = { > .remove = vfio_ccw_mdev_remove, > }; > > -static const struct mdev_parent_ops vfio_ccw_mdev_ops = { > +const struct mdev_parent_ops vfio_ccw_mdev_ops = { > .owner = THIS_MODULE, > .device_driver = &vfio_ccw_mdev_driver, > .supported_type_groups = mdev_type_groups, > }; > - > -int vfio_ccw_mdev_reg(struct subchannel *sch) > -{ > - return mdev_register_device(&sch->dev, &vfio_ccw_mdev_ops); > -} > - > -void vfio_ccw_mdev_unreg(struct subchannel *sch) > -{ > - mdev_unregister_device(&sch->dev); > -} > diff --git a/drivers/s390/cio/vfio_ccw_private.h b/drivers/s390/cio/vfio_ccw_private.h > index 5c128eec596b..2e0744ac6492 100644 > --- a/drivers/s390/cio/vfio_ccw_private.h > +++ b/drivers/s390/cio/vfio_ccw_private.h > @@ -117,12 +117,10 @@ struct vfio_ccw_private { > struct work_struct crw_work; > } __aligned(8); > > -extern int vfio_ccw_mdev_reg(struct subchannel *sch); > -extern void vfio_ccw_mdev_unreg(struct subchannel *sch); > - > extern int vfio_ccw_sch_quiesce(struct subchannel *sch); > > extern struct mdev_driver vfio_ccw_mdev_driver; > +extern const struct mdev_parent_ops vfio_ccw_mdev_ops; > > /* > * States of the device statemachine.
On Thu, 2022-06-02 at 15:14 -0400, Matthew Rosato wrote: > On 6/2/22 1:19 PM, Eric Farman wrote: > > The vfio_ccw_mdev_(un)reg routines are merely vfio-ccw routines > > that > > pass control to mdev_(un)register_device. Since there's only one > > caller of each, let's just call the mdev routines directly. > > I'd reword slightly to reference the ops extern > > ".. caller of each, externalize vfio_ccw_mdev_ops and call..." Of course vfio_ccw_mdev_ops was removed in 5.19 via commit 6b42f491e17c ("vfio/mdev: Remove mdev_parent_ops"), so the extern doesn't happen now. > > regardless, > > Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> > > > Suggested-by: Jason Gunthorpe <jgg@nvidia.com> > > Signed-off-by: Eric Farman <farman@linux.ibm.com> > > --- > > drivers/s390/cio/vfio_ccw_drv.c | 4 ++-- > > drivers/s390/cio/vfio_ccw_ops.c | 12 +----------- > > drivers/s390/cio/vfio_ccw_private.h | 4 +--- > > 3 files changed, 4 insertions(+), 16 deletions(-) > > > > diff --git a/drivers/s390/cio/vfio_ccw_drv.c > > b/drivers/s390/cio/vfio_ccw_drv.c > > index 9d817aa2f1c4..3784eb4cda85 100644 > > --- a/drivers/s390/cio/vfio_ccw_drv.c > > +++ b/drivers/s390/cio/vfio_ccw_drv.c > > @@ -239,7 +239,7 @@ static int vfio_ccw_sch_probe(struct subchannel > > *sch) > > > > private->state = VFIO_CCW_STATE_STANDBY; > > > > - ret = vfio_ccw_mdev_reg(sch); > > + ret = mdev_register_device(&sch->dev, &vfio_ccw_mdev_ops); > > if (ret) > > goto out_disable; > > > > @@ -261,7 +261,7 @@ static void vfio_ccw_sch_remove(struct > > subchannel *sch) > > struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev); > > > > vfio_ccw_sch_quiesce(sch); > > - vfio_ccw_mdev_unreg(sch); > > + mdev_unregister_device(&sch->dev); > > > > dev_set_drvdata(&sch->dev, NULL); > > > > diff --git a/drivers/s390/cio/vfio_ccw_ops.c > > b/drivers/s390/cio/vfio_ccw_ops.c > > index 4a64c176facb..497e1b7ffd61 100644 > > --- a/drivers/s390/cio/vfio_ccw_ops.c > > +++ b/drivers/s390/cio/vfio_ccw_ops.c > > @@ -656,18 +656,8 @@ struct mdev_driver vfio_ccw_mdev_driver = { > > .remove = vfio_ccw_mdev_remove, > > }; > > > > -static const struct mdev_parent_ops vfio_ccw_mdev_ops = { > > +const struct mdev_parent_ops vfio_ccw_mdev_ops = { > > .owner = THIS_MODULE, > > .device_driver = &vfio_ccw_mdev_driver, > > .supported_type_groups = mdev_type_groups, > > }; > > - > > -int vfio_ccw_mdev_reg(struct subchannel *sch) > > -{ > > - return mdev_register_device(&sch->dev, &vfio_ccw_mdev_ops); > > -} > > - > > -void vfio_ccw_mdev_unreg(struct subchannel *sch) > > -{ > > - mdev_unregister_device(&sch->dev); > > -} > > diff --git a/drivers/s390/cio/vfio_ccw_private.h > > b/drivers/s390/cio/vfio_ccw_private.h > > index 5c128eec596b..2e0744ac6492 100644 > > --- a/drivers/s390/cio/vfio_ccw_private.h > > +++ b/drivers/s390/cio/vfio_ccw_private.h > > @@ -117,12 +117,10 @@ struct vfio_ccw_private { > > struct work_struct crw_work; > > } __aligned(8); > > > > -extern int vfio_ccw_mdev_reg(struct subchannel *sch); > > -extern void vfio_ccw_mdev_unreg(struct subchannel *sch); > > - > > extern int vfio_ccw_sch_quiesce(struct subchannel *sch); > > > > extern struct mdev_driver vfio_ccw_mdev_driver; > > +extern const struct mdev_parent_ops vfio_ccw_mdev_ops; > > > > /* > > * States of the device statemachine.
diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c index 9d817aa2f1c4..3784eb4cda85 100644 --- a/drivers/s390/cio/vfio_ccw_drv.c +++ b/drivers/s390/cio/vfio_ccw_drv.c @@ -239,7 +239,7 @@ static int vfio_ccw_sch_probe(struct subchannel *sch) private->state = VFIO_CCW_STATE_STANDBY; - ret = vfio_ccw_mdev_reg(sch); + ret = mdev_register_device(&sch->dev, &vfio_ccw_mdev_ops); if (ret) goto out_disable; @@ -261,7 +261,7 @@ static void vfio_ccw_sch_remove(struct subchannel *sch) struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev); vfio_ccw_sch_quiesce(sch); - vfio_ccw_mdev_unreg(sch); + mdev_unregister_device(&sch->dev); dev_set_drvdata(&sch->dev, NULL); diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c index 4a64c176facb..497e1b7ffd61 100644 --- a/drivers/s390/cio/vfio_ccw_ops.c +++ b/drivers/s390/cio/vfio_ccw_ops.c @@ -656,18 +656,8 @@ struct mdev_driver vfio_ccw_mdev_driver = { .remove = vfio_ccw_mdev_remove, }; -static const struct mdev_parent_ops vfio_ccw_mdev_ops = { +const struct mdev_parent_ops vfio_ccw_mdev_ops = { .owner = THIS_MODULE, .device_driver = &vfio_ccw_mdev_driver, .supported_type_groups = mdev_type_groups, }; - -int vfio_ccw_mdev_reg(struct subchannel *sch) -{ - return mdev_register_device(&sch->dev, &vfio_ccw_mdev_ops); -} - -void vfio_ccw_mdev_unreg(struct subchannel *sch) -{ - mdev_unregister_device(&sch->dev); -} diff --git a/drivers/s390/cio/vfio_ccw_private.h b/drivers/s390/cio/vfio_ccw_private.h index 5c128eec596b..2e0744ac6492 100644 --- a/drivers/s390/cio/vfio_ccw_private.h +++ b/drivers/s390/cio/vfio_ccw_private.h @@ -117,12 +117,10 @@ struct vfio_ccw_private { struct work_struct crw_work; } __aligned(8); -extern int vfio_ccw_mdev_reg(struct subchannel *sch); -extern void vfio_ccw_mdev_unreg(struct subchannel *sch); - extern int vfio_ccw_sch_quiesce(struct subchannel *sch); extern struct mdev_driver vfio_ccw_mdev_driver; +extern const struct mdev_parent_ops vfio_ccw_mdev_ops; /* * States of the device statemachine.
The vfio_ccw_mdev_(un)reg routines are merely vfio-ccw routines that pass control to mdev_(un)register_device. Since there's only one caller of each, let's just call the mdev routines directly. Suggested-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Eric Farman <farman@linux.ibm.com> --- drivers/s390/cio/vfio_ccw_drv.c | 4 ++-- drivers/s390/cio/vfio_ccw_ops.c | 12 +----------- drivers/s390/cio/vfio_ccw_private.h | 4 +--- 3 files changed, 4 insertions(+), 16 deletions(-)