Skip to content

Commit

Permalink
staging: fieldbus: anybus: Make remove callback return void
Browse files Browse the repository at this point in the history
The driver core ignores the return value of struct bus_type::remove()
because there is only little that can be done. To simplify the quest to
make this function return void, let struct
anybuss_client_driver::remove() return void, too. All users already
unconditionally return 0, this commit makes it obvious that returning an
error code is a bad idea.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20210505202923.198607-1-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 May 10, 2021
1 parent cc1966a commit 32dcd07
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/fieldbus/anybuss/anybuss-client.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct anybuss_client {
struct anybuss_client_driver {
struct device_driver driver;
int (*probe)(struct anybuss_client *adev);
int (*remove)(struct anybuss_client *adev);
void (*remove)(struct anybuss_client *adev);
u16 anybus_id;
};

Expand Down
3 changes: 1 addition & 2 deletions drivers/staging/fieldbus/anybuss/hms-profinet.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,11 @@ static int profinet_probe(struct anybuss_client *client)
return 0;
}

static int profinet_remove(struct anybuss_client *client)
static void profinet_remove(struct anybuss_client *client)
{
struct profi_priv *priv = anybuss_get_drvdata(client);

fieldbus_dev_unregister(&priv->fbdev);
return 0;
}

static struct anybuss_client_driver profinet_driver = {
Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/fieldbus/anybuss/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,8 @@ static int anybus_bus_remove(struct device *dev)
to_anybuss_client_driver(dev->driver);

if (adrv->remove)
return adrv->remove(to_anybuss_client(dev));
adrv->remove(to_anybuss_client(dev));

return 0;
}

Expand Down

0 comments on commit 32dcd07

Please sign in to comment.