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: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
- Date: Tue, 6 Jul 2021 14:14:45 +0200
- Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, nvdimm@xxxxxxxxxxxxxxx, Alexey Kardashevskiy <aik@xxxxxxxxx>, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>, Samuel Iglesias Gonsalvez <siglesias@xxxxxxxxxx>, Jens Taprogge <jens.taprogge@xxxxxxxxxxxx>, Ulf Hansson <ulf.hansson@xxxxxxxxxx>, Jaroslav Kysela <perex@xxxxxxxx>, Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx>, Paul Mackerras <paulus@xxxxxxxxx>, Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>, "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx>, Mike Christie <michael.christie@xxxxxxxxxx>, Wei Liu <wei.liu@xxxxxxxxxx>, Maxim Levitsky <maximlevitsky@xxxxxxxxx>, Samuel Holland <samuel@xxxxxxxxxxxx>, Michael Ellerman <mpe@xxxxxxxxxxxxxx>, linux-acpi@xxxxxxxxxxxxxxx, linux-pci@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Tomas Winkler <tomas.winkler@xxxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, Ohad Ben-Cohen <ohad@xxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxxxxxx>, Alex Elder <elder@xxxxxxxxxx>, linux-parisc@xxxxxxxxxxxxxxx, Geoff Levand <geoff@xxxxxxxxxxxxx>, linux-fpga@xxxxxxxxxxxxxxx, linux-usb@xxxxxxxxxxxxxxx, "Rafael J. Wysocki" <rjw@xxxxxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, linux-spi@xxxxxxxxxxxxxxx, Thorsten Scherer <t.scherer@xxxxxxxxxxxx>, kernel@xxxxxxxxxxxxxx, Jon Mason <jdmason@xxxxxxxx>, linux-ntb@xxxxxxxxxxxxxxxx, Wu Hao <hao.wu@xxxxxxxxx>, David Woodhouse <dwmw@xxxxxxxxxxxx>, Krzysztof Wilczyński <kw@xxxxxxxxx>, Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>, Manohar Vanga <manohar.vanga@xxxxxxxxx>, linux-wireless@xxxxxxxxxxxxxxx, Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, "James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>, target-devel@xxxxxxxxxxxxxxx, Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>, linux-i2c@xxxxxxxxxxxxxxx, Kai-Heng Feng <kai.heng.feng@xxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Stephen Hemminger <sthemmin@xxxxxxxxxxxxx>, Ira Weiny <ira.weiny@xxxxxxxxx>, Helge Deller <deller@xxxxxx>, Rafał Miłecki <zajec5@xxxxxxxxx>, industrypack-devel@xxxxxxxxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, Len Brown <lenb@xxxxxxxxxx>, alsa-devel@xxxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx, Maxime Ripard <mripard@xxxxxxxxxx>, Johan Hovold <johan@xxxxxxxxxx>, greybus-dev@xxxxxxxxxxxxxxxx, Bjorn Helgaas <bhelgaas@xxxxxxxxxx>, Dave Jiang <dave.jiang@xxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, Johannes Thumshirn <morbidrsa@xxxxxxxxx>, Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>, Stephen Boyd <sboyd@xxxxxxxxxx>, Wolfram Sang <wsa@xxxxxxxxxx>, Joey Pabalan <jpabalanb@xxxxxxxxx>, Yehezkel Bernat <YehezkelShB@xxxxxxxxx>, Pali Rohár <pali@xxxxxxxxxx>, Bodo Stroesser <bostroesser@xxxxxxxxx>, Alison Schofield <alison.schofield@xxxxxxxxx>, Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>, Tyrel Datwyler <tyreld@xxxxxxxxxxxxx>, Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>, Tom Rix <trix@xxxxxxxxxx>, Jason Wang <jasowang@xxxxxxxxxx>, SeongJae Park <sjpark@xxxxxxxxx>, linux-hyperv@xxxxxxxxxxxxxxx, platform-driver-x86@xxxxxxxxxxxxxxx, Frank Li <lznuaa@xxxxxxxxx>, netdev@xxxxxxxxxxxxxxx, Qinglang Miao <miaoqinglang@xxxxxxxxxx>, Jiri Slaby <jirislaby@xxxxxxxxxx>, Rob Herring <robh@xxxxxxxxxx>, Lorenzo Pieralisi <lorenzo.pieralisi@xxxxxxx>, Mark Gross <mgross@xxxxxxxxxxxxxxx>, linux-staging@xxxxxxxxxxxxxxx, Dexuan Cui <decui@xxxxxxxxxxxxx>, Jernej Skrabec <jernej.skrabec@xxxxxxxxx>, Kishon Vijay Abraham I <kishon@xxxxxx>, Chen-Yu Tsai <wens@xxxxxxxx>, linux-input@xxxxxxxxxxxxxxx, Matt Porter <mporter@xxxxxxxxxxxxxxxxxxx>, Allen Hubbe <allenbh@xxxxxxxxx>, Alex Dubov <oakad@xxxxxxxxx>, Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>, Jiri Kosina <jikos@xxxxxxxxxx>, Vladimir Zapolskiy <vz@xxxxxxxxx>, Ben Widawsky <ben.widawsky@xxxxxxxxx>, Moritz Fischer <mdf@xxxxxxxxxx>, linux-cxl@xxxxxxxxxxxxxxx, Michael Buesch <m@xxxxxxx>, Dan Williams <dan.j.williams@xxxxxxxxx>, Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>, Cristian Marussi <cristian.marussi@xxxxxxx>, Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>, "Martin K. Petersen" <martin.petersen@xxxxxxxxxx>, Martyn Welch <martyn@xxxxxxxxxxxx>, Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>, linux-mmc@xxxxxxxxxxxxxxx, linux-sunxi@xxxxxxxxxxxxxxx, Stefan Richter <stefanr@xxxxxxxxxxxxxxxxx>, Sudeep Holla <sudeep.holla@xxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Sven Van Asbroeck <TheSven73@xxxxxxxxx>, kvm@xxxxxxxxxxxxxxx, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, linux-remoteproc@xxxxxxxxxxxxxxx, Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>, Kirti Wankhede <kwankhede@xxxxxxxxxx>, Andreas Noever <andreas.noever@xxxxxxxxx>, linux-i3c@xxxxxxxxxxxxxxxxxxx, linux1394-devel@xxxxxxxxxxxxxxxxxxxxx, Lee Jones <lee.jones@xxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, linux-scsi@xxxxxxxxxxxxxxx, Vishal Verma <vishal.l.verma@xxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, Andy Gross <agross@xxxxxxxxxx>, linux-serial@xxxxxxxxxxxxxxx, Jakub Kicinski <kuba@xxxxxxxxxx>, Michael Jamet <michael.jamet@xxxxxxxxx>, William Breathitt Gray <vilhelm.gray@xxxxxxxxx>, Hans de Goede <hdegoede@xxxxxxxxxx>, Hannes Reinecke <hare@xxxxxxx>, Adrian Hunter <adrian.hunter@xxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, linuxppc-dev@xxxxxxxxxxxxxxxx, Takashi Iwai <tiwai@xxxxxxxx>, Alexandre Bounine <alex.bou9@xxxxxxxxx>, Vinod Koul <vkoul@xxxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>, Marc Zyngier <maz@xxxxxxxxxx>, dmaengine@xxxxxxxxxxxxxxx, Johannes Berg <johannes@xxxxxxxxxxxxxxxx>, Maximilian Luz <luzmaximilian@xxxxxxxxx>
- In-reply-to: <87mtqzhesu.fsf@redhat.com>
- References: <20210706095037.1425211-1-u.kleine-koenig@pengutronix.de> <87pmvvhfqq.fsf@redhat.com> <87mtqzhesu.fsf@redhat.com>
On Tue, Jul 06, 2021 at 01:17:37PM +0200, Cornelia Huck wrote:
> 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;
This is fine to be squashed into my patch. In the long run: in a remove
callback dev->driver cannot be NULL, so this if could go away.
> 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);
Maybe the return type for this function pointer can be changed to void,
too.
I will add these changes to a v2 that I plan to send out after the dust
settles some more.
Thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
Attachment:
signature.asc
Description: PGP signature
[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]
|