Re: [PATCH] bus: Make remove callback return void
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [PATCH] bus: Make remove callback return void
- From: Cornelia Huck <cohuck@xxxxxxxxxx>
- Date: Tue, 06 Jul 2021 13:17:37 +0200
- Cc: kernel@xxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Russell King <linux@xxxxxxxxxxxxxxx>, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, "James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>, Helge Deller <deller@xxxxxx>, Geoff Levand <geoff@xxxxxxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>, Paul Mackerras <paulus@xxxxxxxxx>, "Rafael J. Wysocki" <rjw@xxxxxxxxxxxxx>, Len Brown <lenb@xxxxxxxxxx>, William Breathitt Gray <vilhelm.gray@xxxxxxxxx>, Rafał Miłecki <zajec5@xxxxxxxxx>, Maxime Ripard <mripard@xxxxxxxxxx>, Chen-Yu Tsai <wens@xxxxxxxx>, Jernej Skrabec <jernej.skrabec@xxxxxxxxx>, Alison Schofield <alison.schofield@xxxxxxxxx>, Vishal Verma <vishal.l.verma@xxxxxxxxx>, Ira Weiny <ira.weiny@xxxxxxxxx>, Ben Widawsky <ben.widawsky@xxxxxxxxx>, Dan Williams <dan.j.williams@xxxxxxxxx>, Dave Jiang <dave.jiang@xxxxxxxxx>, Vinod Koul <vkoul@xxxxxxxxxx>, Stefan Richter <stefanr@xxxxxxxxxxxxxxxxx>, Sudeep Holla <sudeep.holla@xxxxxxx>, Cristian Marussi <cristian.marussi@xxxxxxx>, Wu Hao <hao.wu@xxxxxxxxx>, Tom Rix <trix@xxxxxxxxxx>, Moritz Fischer <mdf@xxxxxxxxxx>, Jiri Kosina <jikos@xxxxxxxxxx>, Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx>, Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>, "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx>, Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>, Stephen Hemminger <sthemmin@xxxxxxxxxxxxx>, Wei Liu <wei.liu@xxxxxxxxxx>, Dexuan Cui <decui@xxxxxxxxxxxxx>, Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>, Wolfram Sang <wsa@xxxxxxxxxx>, Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>, Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>, Samuel Iglesias Gonsalvez <siglesias@xxxxxxxxxx>, Jens Taprogge <jens.taprogge@xxxxxxxxxxxx>, Johannes Thumshirn <morbidrsa@xxxxxxxxx>, Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>, Maxim Levitsky <maximlevitsky@xxxxxxxxx>, Alex Dubov <oakad@xxxxxxxxx>, Ulf Hansson <ulf.hansson@xxxxxxxxxx>, Lee Jones <lee.jones@xxxxxxxxxx>, Tomas Winkler <tomas.winkler@xxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Jon Mason <jdmason@xxxxxxxx>, Allen Hubbe <allenbh@xxxxxxxxx>, Kishon Vijay Abraham I <kishon@xxxxxx>, Lorenzo Pieralisi <lorenzo.pieralisi@xxxxxxx>, Krzysztof Wilczyński <kw@xxxxxxxxx>, Bjorn Helgaas <bhelgaas@xxxxxxxxxx>, Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>, Maximilian Luz <luzmaximilian@xxxxxxxxx>, Hans de Goede <hdegoede@xxxxxxxxxx>, Mark Gross <mgross@xxxxxxxxxxxxxxx>, Matt Porter <mporter@xxxxxxxxxxxxxxxxxxx>, Alexandre Bounine <alex.bou9@xxxxxxxxx>, Ohad Ben-Cohen <ohad@xxxxxxxxxx>, Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>, Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>, "Martin K. Petersen" <martin.petersen@xxxxxxxxxx>, Thorsten Scherer <t.scherer@xxxxxxxxxxxx>, Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>, Andy Gross <agross@xxxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>, Stephen Boyd <sboyd@xxxxxxxxxx>, Michael Buesch <m@xxxxxxx>, Sven Van Asbroeck <TheSven73@xxxxxxxxx>, Johan Hovold <johan@xxxxxxxxxx>, Alex Elder <elder@xxxxxxxxxx>, Andreas Noever <andreas.noever@xxxxxxxxx>, Michael Jamet <michael.jamet@xxxxxxxxx>, Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>, Yehezkel Bernat <YehezkelShB@xxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>, Jiri Slaby <jirislaby@xxxxxxxxxx>, Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Jason Wang <jasowang@xxxxxxxxxx>, Kirti Wankhede <kwankhede@xxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxxxxxx>, Martyn Welch <martyn@xxxxxxxxxxxx>, Manohar Vanga <manohar.vanga@xxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Johannes Berg <johannes@xxxxxxxxxxxxxxxx>, Jaroslav Kysela <perex@xxxxxxxx>, Takashi Iwai <tiwai@xxxxxxxx>, Marc Zyngier <maz@xxxxxxxxxx>, Tyrel Datwyler <tyreld@xxxxxxxxxxxxx>, Vladimir Zapolskiy <vz@xxxxxxxxx>, Samuel Holland <samuel@xxxxxxxxxxxx>, Qinglang Miao <miaoqinglang@xxxxxxxxxx>, Alexey Kardashevskiy <aik@xxxxxxxxx>, Kai-Heng Feng <kai.heng.feng@xxxxxxxxxxxxx>, Joey Pabalan <jpabalanb@xxxxxxxxx>, Pali Rohár <pali@xxxxxxxxxx>, Adrian Hunter <adrian.hunter@xxxxxxxxx>, Frank Li <lznuaa@xxxxxxxxx>, Mike Christie <michael.christie@xxxxxxxxxx>, Bodo Stroesser <bostroesser@xxxxxxxxx>, Hannes Reinecke <hare@xxxxxxx>, David Woodhouse <dwmw@xxxxxxxxxxxx>, SeongJae Park <sjpark@xxxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-acpi@xxxxxxxxxxxxxxx, linux-wireless@xxxxxxxxxxxxxxx, linux-sunxi@xxxxxxxxxxxxxxx, linux-cxl@xxxxxxxxxxxxxxx, nvdimm@xxxxxxxxxxxxxxx, dmaengine@xxxxxxxxxxxxxxx, linux1394-devel@xxxxxxxxxxxxxxxxxxxxx, linux-fpga@xxxxxxxxxxxxxxx, linux-input@xxxxxxxxxxxxxxx, linux-hyperv@xxxxxxxxxxxxxxx, linux-i2c@xxxxxxxxxxxxxxx, linux-i3c@xxxxxxxxxxxxxxxxxxx, industrypack-devel@xxxxxxxxxxxxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx, linux-mmc@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, linux-ntb@xxxxxxxxxxxxxxxx, linux-pci@xxxxxxxxxxxxxxx, platform-driver-x86@xxxxxxxxxxxxxxx, linux-remoteproc@xxxxxxxxxxxxxxx, linux-scsi@xxxxxxxxxxxxxxx, alsa-devel@xxxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx, linux-spi@xxxxxxxxxxxxxxx, linux-staging@xxxxxxxxxxxxxxx, greybus-dev@xxxxxxxxxxxxxxxx, target-devel@xxxxxxxxxxxxxxx, linux-usb@xxxxxxxxxxxxxxx, linux-serial@xxxxxxxxxxxxxxx, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
- In-reply-to: <87pmvvhfqq.fsf@redhat.com>
- Organization: Red Hat GmbH
- References: <20210706095037.1425211-1-u.kleine-koenig@pengutronix.de> <87pmvvhfqq.fsf@redhat.com>
- User-agent: Notmuch/0.32.1 (https://notmuchmail.org)
On Tue, Jul 06 2021, Cornelia Huck <cohuck@xxxxxxxxxx> wrote:
> On Tue, Jul 06 2021, Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
>
>> The driver core ignores the return value of this callback because there
>> is only little it can do when a device disappears.
>>
>> This is the final bit of a long lasting cleanup quest where several
>> buses were converted to also return void from their remove callback.
>> Additionally some resource leaks were fixed that were caused by drivers
>> returning an error code in the expectation that the driver won't go
>> away.
>>
>> With struct bus_type::remove returning void it's prevented that newly
>> implemented buses return an ignored error code and so don't anticipate
>> wrong expectations for driver authors.
>
> Yay!
>
>>
>> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
>> ---
>> Hello,
>>
>> this patch depends on "PCI: endpoint: Make struct pci_epf_driver::remove
>> return void" that is not yet applied, see
>> https://lore.kernel.org/r/20210223090757.57604-1-u.kleine-koenig@xxxxxxxxxxxxxx.
>>
>> I tested it using allmodconfig on amd64 and arm, but I wouldn't be
>> surprised if I still missed to convert a driver. So it would be great to
>> get this into next early after the merge window closes.
>
> I'm afraid you missed the s390-specific busses in drivers/s390/cio/
> (css/ccw/ccwgroup).
The change for vfio/mdev looks good.
The following should do the trick for s390; not sure if other
architectures have easy-to-miss busses as well.
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index 9748165e08e9..a66f416138ab 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -439,17 +439,15 @@ module_exit(cleanup_ccwgroup);
/************************** driver stuff ******************************/
-static int ccwgroup_remove(struct device *dev)
+static void ccwgroup_remove(struct device *dev)
{
struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
struct ccwgroup_driver *gdrv = to_ccwgroupdrv(dev->driver);
if (!dev->driver)
- return 0;
+ return;
if (gdrv->remove)
gdrv->remove(gdev);
-
- return 0;
}
static void ccwgroup_shutdown(struct device *dev)
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index a974943c27da..ebc321edba51 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -1371,15 +1371,14 @@ static int css_probe(struct device *dev)
return ret;
}
-static int css_remove(struct device *dev)
+static void 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;
}
static void css_shutdown(struct device *dev)
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 84f659cafe76..61d5d55bd9c8 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -1742,7 +1742,7 @@ ccw_device_probe (struct device *dev)
return 0;
}
-static int ccw_device_remove(struct device *dev)
+static void ccw_device_remove(struct device *dev)
{
struct ccw_device *cdev = to_ccwdev(dev);
struct ccw_driver *cdrv = cdev->drv;
@@ -1776,8 +1776,6 @@ static int ccw_device_remove(struct device *dev)
spin_unlock_irq(cdev->ccwlock);
io_subchannel_quiesce(sch);
__disable_cmf(cdev);
-
- return 0;
}
static void ccw_device_shutdown(struct device *dev)
diff --git a/drivers/s390/cio/scm.c b/drivers/s390/cio/scm.c
index 9f26d4310bb3..b6b4589c70bd 100644
--- a/drivers/s390/cio/scm.c
+++ b/drivers/s390/cio/scm.c
@@ -28,12 +28,13 @@ static int scmdev_probe(struct device *dev)
return scmdrv->probe ? scmdrv->probe(scmdev) : -ENODEV;
}
-static int scmdev_remove(struct device *dev)
+static void scmdev_remove(struct device *dev)
{
struct scm_device *scmdev = to_scm_dev(dev);
struct scm_driver *scmdrv = to_scm_drv(dev->driver);
- return scmdrv->remove ? scmdrv->remove(scmdev) : -ENODEV;
+ if (scmdrv->remove)
+ scmdrv->remove(scmdev);
}
static int scmdev_uevent(struct device *dev, struct kobj_uevent_env *env)
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index d2560186d771..8a0d37c0e2a5 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -884,7 +884,7 @@ static int ap_device_probe(struct device *dev)
return rc;
}
-static int ap_device_remove(struct device *dev)
+static void ap_device_remove(struct device *dev)
{
struct ap_device *ap_dev = to_ap_dev(dev);
struct ap_driver *ap_drv = ap_dev->drv;
@@ -909,8 +909,6 @@ static int ap_device_remove(struct device *dev)
ap_dev->drv = NULL;
put_device(dev);
-
- return 0;
}
struct ap_queue *ap_get_qdev(ap_qid_t qid)
[Index of Archives]
[Linux Kernel]
[Linux ARM (vger)]
[Linux ARM MSM]
[Linux Omap]
[Linux Arm]
[Linux Tegra]
[Fedora ARM]
[Linux for Samsung SOC]
[eCos]
[Linux Fastboot]
[Gcc Help]
[Git]
[DCCP]
[IETF Announce]
[Security]
[Linux MIPS]
[Yosemite Campsites]
|