[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210706121445.o3nxgi4bhzrw5w73@pengutronix.de>
Date: Tue, 6 Jul 2021 14:14:45 +0200
From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To: Cornelia Huck <cohuck@...hat.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
nvdimm@...ts.linux.dev, Alexey Kardashevskiy <aik@...abs.ru>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Samuel Iglesias Gonsalvez <siglesias@...lia.com>,
Jens Taprogge <jens.taprogge@...rogge.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
Jaroslav Kysela <perex@...ex.cz>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
Paul Mackerras <paulus@...ba.org>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Mike Christie <michael.christie@...cle.com>,
Wei Liu <wei.liu@...nel.org>,
Maxim Levitsky <maximlevitsky@...il.com>,
Samuel Holland <samuel@...lland.org>,
Michael Ellerman <mpe@...erman.id.au>,
linux-acpi@...r.kernel.org, linux-pci@...r.kernel.org,
xen-devel@...ts.xenproject.org,
Tomas Winkler <tomas.winkler@...el.com>,
Julien Grall <jgrall@...zon.com>,
Ohad Ben-Cohen <ohad@...ery.com>,
Alex Williamson <alex.williamson@...hat.com>,
Alex Elder <elder@...nel.org>, linux-parisc@...r.kernel.org,
Geoff Levand <geoff@...radead.org>, linux-fpga@...r.kernel.org,
linux-usb@...r.kernel.org, "Rafael J. Wysocki" <rjw@...ysocki.net>,
linux-kernel@...r.kernel.org, linux-spi@...r.kernel.org,
Thorsten Scherer <t.scherer@...elmann.de>,
kernel@...gutronix.de, Jon Mason <jdmason@...zu.us>,
linux-ntb@...glegroups.com, Wu Hao <hao.wu@...el.com>,
David Woodhouse <dwmw@...zon.co.uk>,
Krzysztof Wilczyński <kw@...ux.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Manohar Vanga <manohar.vanga@...il.com>,
linux-wireless@...r.kernel.org,
Dominik Brodowski <linux@...inikbrodowski.net>,
virtualization@...ts.linux-foundation.org,
"James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
target-devel@...r.kernel.org,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
linux-i2c@...r.kernel.org,
Kai-Heng Feng <kai.heng.feng@...onical.com>,
Stefano Stabellini <sstabellini@...nel.org>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Ira Weiny <ira.weiny@...el.com>, Helge Deller <deller@....de>,
Rafał Miłecki <zajec5@...il.com>,
industrypack-devel@...ts.sourceforge.net,
linux-mips@...r.kernel.org, Len Brown <lenb@...nel.org>,
alsa-devel@...a-project.org, linux-arm-msm@...r.kernel.org,
linux-media@...r.kernel.org, Maxime Ripard <mripard@...nel.org>,
Johan Hovold <johan@...nel.org>, greybus-dev@...ts.linaro.org,
Bjorn Helgaas <bhelgaas@...gle.com>,
Dave Jiang <dave.jiang@...el.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
linux-arm-kernel@...ts.infradead.org,
Johannes Thumshirn <morbidrsa@...il.com>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Stephen Boyd <sboyd@...nel.org>, Wolfram Sang <wsa@...nel.org>,
Joey Pabalan <jpabalanb@...il.com>,
Yehezkel Bernat <YehezkelShB@...il.com>,
Pali Rohár <pali@...nel.org>,
Bodo Stroesser <bostroesser@...il.com>,
Alison Schofield <alison.schofield@...el.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Tyrel Datwyler <tyreld@...ux.ibm.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Tom Rix <trix@...hat.com>, Jason Wang <jasowang@...hat.com>,
SeongJae Park <sjpark@...zon.de>, linux-hyperv@...r.kernel.org,
platform-driver-x86@...r.kernel.org, Frank Li <lznuaa@...il.com>,
netdev@...r.kernel.org, Qinglang Miao <miaoqinglang@...wei.com>,
Jiri Slaby <jirislaby@...nel.org>,
Rob Herring <robh@...nel.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Mark Gross <mgross@...ux.intel.com>,
linux-staging@...ts.linux.dev, Dexuan Cui <decui@...rosoft.com>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Kishon Vijay Abraham I <kishon@...com>,
Chen-Yu Tsai <wens@...e.org>, linux-input@...r.kernel.org,
Matt Porter <mporter@...nel.crashing.org>,
Allen Hubbe <allenbh@...il.com>, Alex Dubov <oakad@...oo.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Jiri Kosina <jikos@...nel.org>,
Vladimir Zapolskiy <vz@...ia.com>,
Ben Widawsky <ben.widawsky@...el.com>,
Moritz Fischer <mdf@...nel.org>, linux-cxl@...r.kernel.org,
Michael Buesch <m@...s.ch>,
Dan Williams <dan.j.williams@...el.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Cristian Marussi <cristian.marussi@....com>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Martyn Welch <martyn@...chs.me.uk>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
linux-mmc@...r.kernel.org, linux-sunxi@...ts.linux.dev,
Stefan Richter <stefanr@...6.in-berlin.de>,
Sudeep Holla <sudeep.holla@....com>,
"David S. Miller" <davem@...emloft.net>,
Sven Van Asbroeck <TheSven73@...il.com>, kvm@...r.kernel.org,
"Michael S. Tsirkin" <mst@...hat.com>,
linux-remoteproc@...r.kernel.org,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Kirti Wankhede <kwankhede@...dia.com>,
Andreas Noever <andreas.noever@...il.com>,
linux-i3c@...ts.infradead.org,
linux1394-devel@...ts.sourceforge.net,
Lee Jones <lee.jones@...aro.org>,
Arnd Bergmann <arnd@...db.de>, linux-scsi@...r.kernel.org,
Vishal Verma <vishal.l.verma@...el.com>,
Russell King <linux@...linux.org.uk>,
Andy Gross <agross@...nel.org>, linux-serial@...r.kernel.org,
Jakub Kicinski <kuba@...nel.org>,
Michael Jamet <michael.jamet@...el.com>,
William Breathitt Gray <vilhelm.gray@...il.com>,
Hans de Goede <hdegoede@...hat.com>,
Hannes Reinecke <hare@...e.de>,
Adrian Hunter <adrian.hunter@...el.com>,
Juergen Gross <jgross@...e.com>, linuxppc-dev@...ts.ozlabs.org,
Takashi Iwai <tiwai@...e.com>,
Alexandre Bounine <alex.bou9@...il.com>,
Vinod Koul <vkoul@...nel.org>, Mark Brown <broonie@...nel.org>,
Marc Zyngier <maz@...nel.org>, dmaengine@...r.kernel.org,
Johannes Berg <johannes@...solutions.net>,
Maximilian Luz <luzmaximilian@...il.com>
Subject: Re: [PATCH] bus: Make remove callback return void
On Tue, Jul 06, 2021 at 01:17:37PM +0200, Cornelia Huck wrote:
> On Tue, Jul 06 2021, Cornelia Huck <cohuck@...hat.com> wrote:
>
> > On Tue, Jul 06 2021, Uwe Kleine-König <u.kleine-koenig@...gutronix.de> 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@...gutronix.de>
> >> ---
> >> 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@pengutronix.de.
> >>
> >> 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/ |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists