From patchwork Tue Oct 12 15:39:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 1539885 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=CatonVOj; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HTKff3BFgz9sR4 for ; Wed, 13 Oct 2021 02:42:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=OuPOMFCWoKzGCCyXQhFKpfK6FPoar13NLeffDZcvriw=; b=CatonVOjNHLazz ILicKT9sGdXQ0RgXv26fvjENZuRU85dcW+db5I++oPrvROUC6edQYBApZx40cMMc1JGZRtiDIOq1I aIdYNajVYXnxfKRfHoKV4m2LojuHeHzdAajv/+99n+UkU3McY6N2d0MV2UUp5fFzbuTwS8W3yScN0 CzoMaP20GIV24zbSalZEU55V5Q00DEC4/llAvWHlEV669d6BiQlh+E3oZsWarxKEm1fJZenC/FTT0 3g9R0fVkiUbMmQdB/jDSsS6MXzNcfKCISy0Ya5rI0kyEFcdGY/m8LiAc27F/SxGSQxsmlyzta4Y5T jsDVPvz2fgLnqXmFefcA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1maJuQ-00DNYj-4c; Tue, 12 Oct 2021 15:41:42 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1maJtL-00DN8l-LB for linux-mtd@lists.infradead.org; Tue, 12 Oct 2021 15:40:37 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1maJsk-0008NN-05; Tue, 12 Oct 2021 17:39:58 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1maJsa-0004iS-RQ; Tue, 12 Oct 2021 17:39:48 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1maJsa-0004WY-O6; Tue, 12 Oct 2021 17:39:48 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Alexandre Torgue , Arnd Bergmann , Bartosz Golaszewski , Dmitry Torokhov , Eric Piel , Greg Kroah-Hartman , Guenter Roeck , Hans de Goede , Jarkko Sakkinen , Jason Gunthorpe , Jean Delvare , Jiri Slaby , Lee Jones , Linus Walleij , Mark Gross , Mauro Carvalho Chehab , Maxime Coquelin , Michael Hennerich , Miquel Raynal , Peter Huewe , Richard Weinberger , Thierry Reding , Vignesh Raghavendra , Yasunari Takiguchi Cc: Andy Shevchenko , Colin Ian King , Dan Carpenter , Fabio Estevam , Heiko Schocher , Len Baker , Mark Brown , Phil Reid , Sam Ravnborg , Tudor Ambarus , dri-devel@lists.freedesktop.org, kernel@pengutronix.de, linux-fbdev@vger.kernel.org, linux-gpio@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-input@vger.kernel.org, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mtd@lists.infradead.org, linux-serial@vger.kernel.org, linux-spi@vger.kernel.org, linux-staging@lists.linux.dev, linux-stm32@st-md-mailman.stormreply.com, platform-driver-x86@vger.kernel.org Subject: [PATCH v2 00/20] Make some spi device drivers return zero in .remove() Date: Tue, 12 Oct 2021 17:39:25 +0200 Message-Id: <20211012153945.2651412-1-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211012_084035_871918_848EC970 X-CRM114-Status: GOOD ( 25.53 ) X-Spam-Score: -2.3 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hello, this is v2 of my quest to make spi remove callbacks return void. Today they return an int, but the only result of returning a non-zero value is a warning message. So it's a bad idea to return an error [...] Content analysis details: (-2.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2001:67c:670:201:290:27ff:fe1d:cc33 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hello, this is v2 of my quest to make spi remove callbacks return void. Today they return an int, but the only result of returning a non-zero value is a warning message. So it's a bad idea to return an error code in the expectation that not freeing some resources is ok then. The same holds true for i2c and platform devices which benefit en passant for a few drivers. The patches in this series address some of the spi drivers that might return non-zero and adapt them accordingly to return zero instead. For most drivers it's just about not hiding the fact that they already return zero. Given that there are quite some more patches of this type to create before I can change the spi remove callback, I suggest the respective subsystem maintainers pick up these patches. There are no interdependencies in this series. Compared to (implicit) v1 - I fixed a few compiler issues (this series it build tested with an allmoddefconfig on arm64, m68k, powerpc, riscv, s390, sparc64 and x86_64). - A few new patches (2x gpio, 2x misc, 4x mtd) - One patch already landed in next, this one I dropped. The drm/panel patch as claimed to applied, too, but not yet in next. It's included here, but I assume I was just too impatient and this one should be ignored. Full range-diff below. Best regards Uwe Uwe Kleine-König (20): drm/panel: s6e63m0: Make s6e63m0_remove() return void gpio: max730x: Make __max730x_remove() return void gpio: mc33880: Drop if with an always false condition hwmon: max31722: Warn about failure to put device in stand-by in .remove() input: adxl34xx: Make adxl34x_remove() return void input: touchscreen: tsc200x: Make tsc200x_remove() return void media: cxd2880: Eliminate dead code mfd: mc13xxx: Make mc13xxx_common_exit() return void mfd: stmpe: Make stmpe_remove() return void mfd: tps65912: Make tps65912_device_exit() return void misc: ad525x_dpot: Make ad_dpot_remove() return void misc: lis3lv02d: Make lis3lv02d_remove_fs() return void mtd: dataflash: Warn about failure to unregister mtd device mtd: mchp23k256: Warn about failure to unregister mtd device mtd: mchp48l640: Warn about failure to unregister mtd device mtd: sst25l: Warn about failure to unregister mtd device serial: max310x: Make max310x_remove() return void serial: sc16is7xx: Make sc16is7xx_remove() return void staging: fbtft: Make fbtft_remove_common() return void tpm: st33zp24: Make st33zp24_remove() return void drivers/char/tpm/st33zp24/i2c.c | 5 +---- drivers/char/tpm/st33zp24/spi.c | 5 +---- drivers/char/tpm/st33zp24/st33zp24.c | 3 +-- drivers/char/tpm/st33zp24/st33zp24.h | 2 +- drivers/gpio/gpio-max7300.c | 4 +++- drivers/gpio/gpio-max7301.c | 4 +++- drivers/gpio/gpio-max730x.c | 6 +----- drivers/gpio/gpio-mc33880.c | 2 -- drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c | 3 ++- drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 3 ++- drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 4 +--- drivers/gpu/drm/panel/panel-samsung-s6e63m0.h | 2 +- drivers/hwmon/max31722.c | 8 +++++++- drivers/input/misc/adxl34x-i2c.c | 4 +++- drivers/input/misc/adxl34x-spi.c | 4 +++- drivers/input/misc/adxl34x.c | 4 +--- drivers/input/misc/adxl34x.h | 2 +- drivers/input/touchscreen/tsc2004.c | 4 +++- drivers/input/touchscreen/tsc2005.c | 4 +++- drivers/input/touchscreen/tsc200x-core.c | 4 +--- drivers/input/touchscreen/tsc200x-core.h | 2 +- drivers/media/spi/cxd2880-spi.c | 13 +------------ drivers/mfd/mc13xxx-core.c | 4 +--- drivers/mfd/mc13xxx-i2c.c | 3 ++- drivers/mfd/mc13xxx-spi.c | 3 ++- drivers/mfd/mc13xxx.h | 2 +- drivers/mfd/stmpe-i2c.c | 4 +++- drivers/mfd/stmpe-spi.c | 4 +++- drivers/mfd/stmpe.c | 4 +--- drivers/mfd/stmpe.h | 2 +- drivers/mfd/tps65912-core.c | 4 +--- drivers/mfd/tps65912-i2c.c | 4 +++- drivers/mfd/tps65912-spi.c | 4 +++- drivers/misc/ad525x_dpot-i2c.c | 3 ++- drivers/misc/ad525x_dpot-spi.c | 3 ++- drivers/misc/ad525x_dpot.c | 4 +--- drivers/misc/ad525x_dpot.h | 2 +- drivers/misc/lis3lv02d/lis3lv02d.c | 3 +-- drivers/misc/lis3lv02d/lis3lv02d.h | 2 +- drivers/misc/lis3lv02d/lis3lv02d_spi.c | 4 +++- drivers/mtd/devices/mchp23k256.c | 9 ++++++++- drivers/mtd/devices/mchp48l640.c | 8 +++++++- drivers/mtd/devices/mtd_dataflash.c | 5 ++++- drivers/mtd/devices/sst25l.c | 8 +++++++- drivers/platform/x86/hp_accel.c | 3 ++- drivers/staging/fbtft/fbtft-core.c | 8 +------- drivers/staging/fbtft/fbtft.h | 8 +++++--- drivers/tty/serial/max310x.c | 7 +++---- drivers/tty/serial/sc16is7xx.c | 12 +++++++----- include/linux/mfd/tps65912.h | 2 +- include/linux/spi/max7301.h | 2 +- 51 files changed, 119 insertions(+), 104 deletions(-) Range-diff against v1: 1: 73a1a54d9ea0 = 1: 87fd7940fbfd drm/panel: s6e63m0: Make s6e63m0_remove() return void 2: 3bcc8e8bd1a3 < -: ------------ hwmon: adt7x10: Make adt7x10_remove() return void -: ------------ > 2: 305311d63bbb gpio: max730x: Make __max730x_remove() return void -: ------------ > 3: 0cafc31ea5c5 gpio: mc33880: Drop if with an always false condition 3: 07f067732aa9 ! 4: f39467b50f06 hwmon: max31722: Warn about failure to put device in stand-by in .remove() @@ Commit message nothing happens apart from emitting a generic error message. Make this error message more device specific and return zero instead. - Signed-off-by: Uwe Kleine-König Acked-by: Michael Hennerich + Signed-off-by: Uwe Kleine-König ## drivers/hwmon/max31722.c ## @@ drivers/hwmon/max31722.c: static int max31722_probe(struct spi_device *spi) 4: 0b0a5497d105 = 5: de3a78214008 input: adxl34xx: Make adxl34x_remove() return void 5: 0d4f14bc2dd6 ! 6: 9629ac3f9e13 input: touchscreen: tsc200x: Make tsc200x_remove() return void @@ drivers/input/touchscreen/tsc2005.c: static int tsc2005_probe(struct spi_device - return tsc200x_remove(&spi->dev); + tsc200x_remove(&spi->dev); + -+ return 0 ++ return 0; } #ifdef CONFIG_OF 6: a68bbd23223b = 7: 1aab41df9262 media: cxd2880: Eliminate dead code 7: 3801b37ac18f ! 8: 745d1a5f840e mfd: mc13xxx: Make mc13xxx_common_exit() return void @@ drivers/mfd/mc13xxx-spi.c: static int mc13xxx_spi_probe(struct spi_device *spi) { - return mc13xxx_common_exit(&spi->dev); + mc13xxx_common_exit(&spi->dev); -+ return 0 ++ return 0; } static struct spi_driver mc13xxx_spi_driver = { 8: 22159093ce71 = 9: 7ee04277db66 mfd: stmpe: Make stmpe_remove() return void 9: f91da216c752 = 10: 4a21c90a57f8 mfd: tps65912: Make tps65912_device_exit() return void -: ------------ > 11: f92aa824fd1c misc: ad525x_dpot: Make ad_dpot_remove() return void -: ------------ > 12: 5b2fccd09a24 misc: lis3lv02d: Make lis3lv02d_remove_fs() return void -: ------------ > 13: 609ab18323fc mtd: dataflash: Warn about failure to unregister mtd device -: ------------ > 14: 3b220d5fa547 mtd: mchp23k256: Warn about failure to unregister mtd device -: ------------ > 15: baf6f4b3a8c7 mtd: mchp48l640: Warn about failure to unregister mtd device -: ------------ > 16: edf3788a30b0 mtd: sst25l: Warn about failure to unregister mtd device 10: f2def77b74d1 ! 17: 614f7c001377 serial: max310x: Make max310x_remove() return void @@ drivers/tty/serial/max310x.c: static int max310x_spi_probe(struct spi_device *sp { - return max310x_remove(&spi->dev); + max310x_remove(&spi->dev); -+ return 0 ++ return 0; } static const struct spi_device_id max310x_id_table[] = { 11: 283e4bbeff38 ! 18: 35d1f5b36de5 serial: sc16is7xx: Make sc16is7xx_remove() return void @@ drivers/tty/serial/sc16is7xx.c: static int sc16is7xx_probe(struct device *dev, { struct sc16is7xx_port *s = dev_get_drvdata(dev); int i; +@@ drivers/tty/serial/sc16is7xx.c: static int sc16is7xx_remove(struct device *dev) + kthread_stop(s->kworker_task); + + clk_disable_unprepare(s->clk); +- +- return 0; + } + + static const struct of_device_id __maybe_unused sc16is7xx_dt_ids[] = { @@ drivers/tty/serial/sc16is7xx.c: static int sc16is7xx_spi_probe(struct spi_device *spi) static int sc16is7xx_spi_remove(struct spi_device *spi) 12: 5093fbdceee5 ! 19: d9ec9a96fbb8 staging: fbtft: Make fbtft_remove_common() return void @@ drivers/staging/fbtft/fbtft-core.c: EXPORT_SYMBOL(fbtft_probe_common); ## drivers/staging/fbtft/fbtft.h ## +@@ drivers/staging/fbtft/fbtft.h: void fbtft_unregister_backlight(struct fbtft_par *par); + int fbtft_init_display(struct fbtft_par *par); + int fbtft_probe_common(struct fbtft_display *display, struct spi_device *sdev, + struct platform_device *pdev); +-int fbtft_remove_common(struct device *dev, struct fb_info *info); ++void fbtft_remove_common(struct device *dev, struct fb_info *info); + + /* fbtft-io.c */ + int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len); @@ drivers/staging/fbtft/fbtft.h: static int fbtft_driver_remove_spi(struct spi_device *spi) \ { \ struct fb_info *info = spi_get_drvdata(spi); \ 13: 9156e6380a5e = 20: 89d0b85968a9 tpm: st33zp24: Make st33zp24_remove() return void base-commit: 9e1ff307c779ce1f0f810c7ecce3d95bbae40896