Skip to content

Commit

Permalink
s390/cio: Make struct css_driver::remove return void
Browse files Browse the repository at this point in the history
The driver core ignores the return value of css_remove()
(because there is only little it can do when a device disappears) and
all callbacks return 0 anyhow.

So make it impossible for future drivers to return an unused error code
by changing the remove prototype to return void.

The real motivation for this change is the quest to make struct
bus_type::remove return void, too.

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20210713193522.1770306-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Uwe Kleine-König authored and Greg Kroah-Hartman committed Jul 21, 2021
1 parent dde0a31 commit a7bdb9a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
3 changes: 1 addition & 2 deletions drivers/s390/cio/chsc_sch.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static int chsc_subchannel_probe(struct subchannel *sch)
return ret;
}

static int chsc_subchannel_remove(struct subchannel *sch)
static void chsc_subchannel_remove(struct subchannel *sch)
{
struct chsc_private *private;

Expand All @@ -112,7 +112,6 @@ static int chsc_subchannel_remove(struct subchannel *sch)
put_device(&sch->dev);
}
kfree(private);
return 0;
}

static void chsc_subchannel_shutdown(struct subchannel *sch)
Expand Down
7 changes: 4 additions & 3 deletions drivers/s390/cio/css.c
Original file line number Diff line number Diff line change
Expand Up @@ -1374,12 +1374,13 @@ static int css_probe(struct device *dev)
static int css_remove(struct device *dev)
{
struct subchannel *sch;
int ret;

sch = to_subchannel(dev);
ret = sch->driver->remove ? sch->driver->remove(sch) : 0;
if (sch->driver->remove)
sch->driver->remove(sch);
sch->driver = NULL;
return ret;

return 0;
}

static void css_shutdown(struct device *dev)
Expand Down
2 changes: 1 addition & 1 deletion drivers/s390/cio/css.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct css_driver {
int (*chp_event)(struct subchannel *, struct chp_link *, int);
int (*sch_event)(struct subchannel *, int);
int (*probe)(struct subchannel *);
int (*remove)(struct subchannel *);
void (*remove)(struct subchannel *);
void (*shutdown)(struct subchannel *);
int (*settle)(void);
};
Expand Down
5 changes: 2 additions & 3 deletions drivers/s390/cio/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static int ccw_uevent(struct device *dev, struct kobj_uevent_env *env)

static void io_subchannel_irq(struct subchannel *);
static int io_subchannel_probe(struct subchannel *);
static int io_subchannel_remove(struct subchannel *);
static void io_subchannel_remove(struct subchannel *);
static void io_subchannel_shutdown(struct subchannel *);
static int io_subchannel_sch_event(struct subchannel *, int);
static int io_subchannel_chp_event(struct subchannel *, struct chp_link *,
Expand Down Expand Up @@ -1101,7 +1101,7 @@ static int io_subchannel_probe(struct subchannel *sch)
return 0;
}

static int io_subchannel_remove(struct subchannel *sch)
static void io_subchannel_remove(struct subchannel *sch)
{
struct io_subchannel_private *io_priv = to_io_private(sch);
struct ccw_device *cdev;
Expand All @@ -1120,7 +1120,6 @@ static int io_subchannel_remove(struct subchannel *sch)
io_priv->dma_area, io_priv->dma_area_dma);
kfree(io_priv);
sysfs_remove_group(&sch->dev.kobj, &io_subchannel_attr_group);
return 0;
}

static void io_subchannel_verify(struct subchannel *sch)
Expand Down
4 changes: 1 addition & 3 deletions drivers/s390/cio/eadm_sch.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ static void eadm_quiesce(struct subchannel *sch)
spin_unlock_irq(sch->lock);
}

static int eadm_subchannel_remove(struct subchannel *sch)
static void eadm_subchannel_remove(struct subchannel *sch)
{
struct eadm_private *private = get_eadm_private(sch);

Expand All @@ -297,8 +297,6 @@ static int eadm_subchannel_remove(struct subchannel *sch)
spin_unlock_irq(sch->lock);

kfree(private);

return 0;
}

static void eadm_subchannel_shutdown(struct subchannel *sch)
Expand Down
3 changes: 1 addition & 2 deletions drivers/s390/cio/vfio_ccw_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ static int vfio_ccw_sch_probe(struct subchannel *sch)
return ret;
}

static int vfio_ccw_sch_remove(struct subchannel *sch)
static void vfio_ccw_sch_remove(struct subchannel *sch)
{
struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev);
struct vfio_ccw_crw *crw, *temp;
Expand All @@ -257,7 +257,6 @@ static int vfio_ccw_sch_remove(struct subchannel *sch)
VFIO_CCW_MSG_EVENT(4, "unbound from subchannel %x.%x.%04x\n",
sch->schid.cssid, sch->schid.ssid,
sch->schid.sch_no);
return 0;
}

static void vfio_ccw_sch_shutdown(struct subchannel *sch)
Expand Down

0 comments on commit a7bdb9a

Please sign in to comment.