From patchwork Mon Aug 15 08:02:25 2022 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: 598329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F49DC282E7 for ; Mon, 15 Aug 2022 08:03:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229912AbiHOIDI (ORCPT ); Mon, 15 Aug 2022 04:03:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241189AbiHOICw (ORCPT ); Mon, 15 Aug 2022 04:02:52 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCA011E3CC for ; Mon, 15 Aug 2022 01:02:50 -0700 (PDT) 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 1oNV3h-0001xA-4b; Mon, 15 Aug 2022 10:02:49 +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.94.2) (envelope-from ) id 1oNV3d-003sP0-Kn; Mon, 15 Aug 2022 10:02:47 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1oNV3f-00BoQl-5S; Mon, 15 Aug 2022 10:02:47 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, kernel@pengutronix.de, David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/6] drm/i2c/sil164: Drop no-op remove function Date: Mon, 15 Aug 2022 10:02:25 +0200 Message-Id: <20220815080230.37408-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220815080230.37408-1-u.kleine-koenig@pengutronix.de> References: <20220815080230.37408-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1025; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=3mH+Pfn2yhZ6mw2Objn19k5vu3rCFYAMQYl9q6ZMsJI=; b=owEBbAGT/pANAwAKAcH8FHityuwJAcsmYgBi+f187poqvxpUYi8P/230KIv0pd18lzbW6AvuvB+U CQ/EQGmJATIEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYvn9fAAKCRDB/BR4rcrsCSKuB/ j3CUa5IQdH1k7H0Ja0JHtL6jq++c0roApwA2B6zMntEZX1Y/TOMQP4Mjr1ujfwqETG0Wnb2QRH84EX mJIY6+Qc3olTA0eVMuPUeDbDUOT/Fh/8m1RFROngrERS//Germs+yPIvVc688DAQN6xLBncJLGHtCa q9HNINViQoW/ByjsizMahJIJL9tJ2mQug4+wHLLCSND8pkAYGXSajARvnnqx6mB26wzxJIVh2I4slv 3SQcdI/gcTCKqFgSz16yPSFs15qpP+oMMtTu/dYcvcHTkH4MPUjzkuDtHg4JGjpw9KAB5okhScRh20 0IK3hoWg37YyFRyquDMF/pgQDZ4/E= X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 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-i2c@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org A remove callback that just returns 0 is equivalent to no callback at all as can be seen in i2c_device_remove(). So simplify accordingly. Signed-off-by: Uwe Kleine-König --- drivers/gpu/drm/i2c/sil164_drv.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/gpu/drm/i2c/sil164_drv.c b/drivers/gpu/drm/i2c/sil164_drv.c index 741886b54419..1bc0b5de4499 100644 --- a/drivers/gpu/drm/i2c/sil164_drv.c +++ b/drivers/gpu/drm/i2c/sil164_drv.c @@ -370,12 +370,6 @@ sil164_probe(struct i2c_client *client, const struct i2c_device_id *id) return 0; } -static int -sil164_remove(struct i2c_client *client) -{ - return 0; -} - static struct i2c_client * sil164_detect_slave(struct i2c_client *client) { @@ -427,7 +421,6 @@ MODULE_DEVICE_TABLE(i2c, sil164_ids); static struct drm_i2c_encoder_driver sil164_driver = { .i2c_driver = { .probe = sil164_probe, - .remove = sil164_remove, .driver = { .name = "sil164", }, From patchwork Mon Aug 15 08:02:26 2022 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: 597386 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B374C00140 for ; Mon, 15 Aug 2022 08:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241105AbiHOIDJ (ORCPT ); Mon, 15 Aug 2022 04:03:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241377AbiHOICx (ORCPT ); Mon, 15 Aug 2022 04:02:53 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A73C1AD95 for ; Mon, 15 Aug 2022 01:02:52 -0700 (PDT) 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 1oNV3h-0001xB-4b; Mon, 15 Aug 2022 10:02:49 +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.94.2) (envelope-from ) id 1oNV3d-003sP3-NT; Mon, 15 Aug 2022 10:02:48 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1oNV3f-00BoQo-A0; Mon, 15 Aug 2022 10:02:47 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, kernel@pengutronix.de, Pavel Machek , linux-leds@vger.kernel.org Subject: [PATCH v2 2/6] leds: lm3697: Remove duplicated error reporting in .remove() Date: Mon, 15 Aug 2022 10:02:26 +0200 Message-Id: <20220815080230.37408-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220815080230.37408-1-u.kleine-koenig@pengutronix.de> References: <20220815080230.37408-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1273; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=49m5Mlz/xntnovFLTKtruR/PsCk3+nd04qGYhuWz6fU=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBi+f2A86TlETl9BfwwQeug3nbHFGqn+0QXz3cpjTqs 926TS7aJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYvn9gAAKCRDB/BR4rcrsCbLsB/ 9ZXK1Nv+IeqRtr4AvSiqHBuNFiaR3LUMDUeaGDIjLJuD25BeiCBmna4IXr97f9+UAXPCatIKJoKpyz pAraBqbTtuBx5z28m/xXTJuy7kcNymXpmT07I4dlhg9u4dvuSWgJXZuEOUAWk0N+thTsgmWGwW1tT0 0mk0KIlXuH+tF0kWGnedzvYTPKoI6R7AsFiqG4GDTLJG6yMCIRWjhlKpfQD4Rw060G95SJIXQkVrC7 SbzMn/G5KqIW6NwQHUhdKT7cII2a024K2Y7gnFNAlneDG6qHpg1sKaS/cQN3N5+o+PmyLijd39ss29 v55OPKmKy3U9H0XQ3t0y3jOQKlVDSC X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 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-i2c@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Returning an error value from an i2c remove callback results in an error message being emitted by the i2c core, but otherwise it doesn't make a difference. The device goes away anyhow and the devm cleanups are called. As lm3697_remove() already emits an error message on failure and the additional error message by the i2c core doesn't add any useful information, don't pass the error value up the stack. Instead continue to clean up and return 0. This patch is a preparation for making i2c remove callbacks return void. Acked-by: Pavel Machek Signed-off-by: Uwe Kleine-König --- drivers/leds/leds-lm3697.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/leds/leds-lm3697.c b/drivers/leds/leds-lm3697.c index a8c9322558cc..3ecf90fbc06c 100644 --- a/drivers/leds/leds-lm3697.c +++ b/drivers/leds/leds-lm3697.c @@ -345,10 +345,8 @@ static int lm3697_remove(struct i2c_client *client) ret = regmap_update_bits(led->regmap, LM3697_CTRL_ENABLE, LM3697_CTRL_A_B_EN, 0); - if (ret) { + if (ret) dev_err(dev, "Failed to disable the device\n"); - return ret; - } if (led->enable_gpio) gpiod_direction_output(led->enable_gpio, 0); From patchwork Mon Aug 15 08:02:27 2022 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: 598328 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 806F6C28B2B for ; Mon, 15 Aug 2022 08:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241189AbiHOIDJ (ORCPT ); Mon, 15 Aug 2022 04:03:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241105AbiHOICv (ORCPT ); Mon, 15 Aug 2022 04:02:51 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D62411E3C6 for ; Mon, 15 Aug 2022 01:02:50 -0700 (PDT) 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 1oNV3h-0001xE-4b; Mon, 15 Aug 2022 10:02:49 +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.94.2) (envelope-from ) id 1oNV3e-003sP7-0Q; Mon, 15 Aug 2022 10:02:48 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1oNV3f-00BoQr-Ei; Mon, 15 Aug 2022 10:02:47 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, kernel@pengutronix.de, Pavel Machek Subject: [PATCH v2 3/6] leds: lm3601x: Don't use mutex after it was destroyed Date: Mon, 15 Aug 2022 10:02:27 +0200 Message-Id: <20220815080230.37408-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220815080230.37408-1-u.kleine-koenig@pengutronix.de> References: <20220815080230.37408-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=963; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=MrYNIq4ffMvLqyL7sdB2b2LADgcbYl8bJHDTYkm0LAo=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBi+f2FUMjFizSFhPKNdrmqRCondHtgkYWXbckzIGvu 5EOY7iWJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYvn9hQAKCRDB/BR4rcrsCe5IB/ 9F6iw21UWqC/12thr65z7cBX6flfcAWesyg4ugX0VdOb5qYHXBROPwFdFYGYyDtlgpuN4asZbpUWOX h1kE0PoEl1YlyMK/cvajXAjbeYdekJ/rCGfFNN6lJAbdutEZtB3fIYFUIPOjlxV0swopkbbQQRwEs2 skLeFOikI2PugYyAlW7OgX2/1RQf2JOMOdR4HotUyU7wCGlqRdDIlKqBmVXGOHuLbOozn8LSOqNCi6 nDOFToR3GGTHl/Z30ul5AB7ssRHSaxwbwgI8YFTFEoGH5M1/8pCdOeYPyxnE11xJPxPrG/hItQ/1xD ivpHYoEoEpwiuacClbaGGKOoMRlWG9 X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 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-i2c@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The mutex might still be in use until the devm cleanup callback devm_led_classdev_flash_release() is called. This only happens some time after lm3601x_remove() completed. Fixes: e63a744871a3 ("leds: lm3601x: Convert class registration to device managed") Acked-by: Pavel Machek Signed-off-by: Uwe Kleine-König --- drivers/leds/flash/leds-lm3601x.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/leds/flash/leds-lm3601x.c b/drivers/leds/flash/leds-lm3601x.c index d0e1d4814042..3d1272748201 100644 --- a/drivers/leds/flash/leds-lm3601x.c +++ b/drivers/leds/flash/leds-lm3601x.c @@ -444,8 +444,6 @@ static int lm3601x_remove(struct i2c_client *client) { struct lm3601x_led *led = i2c_get_clientdata(client); - mutex_destroy(&led->lock); - return regmap_update_bits(led->regmap, LM3601X_ENABLE_REG, LM3601X_ENABLE_MASK, LM3601X_MODE_STANDBY); From patchwork Mon Aug 15 08:02:28 2022 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: 597387 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AC86C25B0D for ; Mon, 15 Aug 2022 08:03:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241541AbiHOIDI (ORCPT ); Mon, 15 Aug 2022 04:03:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229912AbiHOICv (ORCPT ); Mon, 15 Aug 2022 04:02:51 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D610D1DA5F for ; Mon, 15 Aug 2022 01:02:50 -0700 (PDT) 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 1oNV3h-0001xG-5I; Mon, 15 Aug 2022 10:02:49 +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.94.2) (envelope-from ) id 1oNV3e-003sPA-32; Mon, 15 Aug 2022 10:02:48 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1oNV3f-00BoQu-JR; Mon, 15 Aug 2022 10:02:47 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, kernel@pengutronix.de, Pavel Machek Subject: [PATCH v2 4/6] leds: lm3601x: Improve error reporting for problems during .remove() Date: Mon, 15 Aug 2022 10:02:28 +0200 Message-Id: <20220815080230.37408-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220815080230.37408-1-u.kleine-koenig@pengutronix.de> References: <20220815080230.37408-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1510; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=4k2owBO1cbWNWEMGwdulDbEaUhh8fVNgqezhIxzQZ0g=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBi+f2J695EeOWJc7NO9VeCaLoF3LXndQHTr4YiriR7 /q5YMMWJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYvn9iQAKCRDB/BR4rcrsCfUwCA CeXQYsAnUbAbMm/4OawOw2G7fo92RQfwf4YgPTijiK7RYjjOM9SxrH56zq9bpkHPOw66bZMKW02Gom h6lqh3sHZLJKYLR7f61IfX8863SlwBmv8a3i+eLdLEUdq/Jf6hzlOXPSQ3jjOJJHeUMTZegg81EoAD VbmQn7TM7kHjBa4ZWqmtJa0slczDhqwMCDU7/6TzTVWk4R+jSJltPn9ZV2lrFBlPLOlvlO+UrJ9kg4 y0iNZlc47DLSFaCS77J2lcXxQ55lPIo2hBP9JjKmP3OA+VrYjzGwYlvJ+7Gsfa0pIzOQSEzRRYP7rY 47T0MfQMhovPHURVzulpWAmJgtpr68 X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 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-i2c@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Returning an error value in an i2c remove callback results in a generic error message being emitted by the i2c core, but otherwise it doesn't make a difference. The device goes away anyhow and the devm cleanups are called. So instead of triggering the generic i2c error message, emit a more helpful message if a problem occurs and return 0 to suppress the generic message. This patch is a preparation for making i2c remove callbacks return void. Acked-by: Pavel Machek Signed-off-by: Uwe Kleine-König --- drivers/leds/flash/leds-lm3601x.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/leds/flash/leds-lm3601x.c b/drivers/leds/flash/leds-lm3601x.c index 3d1272748201..37e1d6e68687 100644 --- a/drivers/leds/flash/leds-lm3601x.c +++ b/drivers/leds/flash/leds-lm3601x.c @@ -443,10 +443,15 @@ static int lm3601x_probe(struct i2c_client *client) static int lm3601x_remove(struct i2c_client *client) { struct lm3601x_led *led = i2c_get_clientdata(client); + int ret; - return regmap_update_bits(led->regmap, LM3601X_ENABLE_REG, - LM3601X_ENABLE_MASK, - LM3601X_MODE_STANDBY); + ret = regmap_update_bits(led->regmap, LM3601X_ENABLE_REG, + LM3601X_ENABLE_MASK, LM3601X_MODE_STANDBY); + if (ret) + dev_warn(&client->dev, + "Failed to put into standby (%pe)\n", ERR_PTR(ret)); + + return 0; } static const struct i2c_device_id lm3601x_id[] = { From patchwork Mon Aug 15 08:02:29 2022 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: 598330 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACF82C25B0E for ; Mon, 15 Aug 2022 08:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241548AbiHOIDH (ORCPT ); Mon, 15 Aug 2022 04:03:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241332AbiHOICw (ORCPT ); Mon, 15 Aug 2022 04:02:52 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E21E1E3CE for ; Mon, 15 Aug 2022 01:02:51 -0700 (PDT) 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 1oNV3h-0001xT-NB; Mon, 15 Aug 2022 10:02:49 +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.94.2) (envelope-from ) id 1oNV3e-003sPE-Fz; Mon, 15 Aug 2022 10:02:48 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1oNV3f-00BoQx-PH; Mon, 15 Aug 2022 10:02:47 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, kernel@pengutronix.de, Bartosz Golaszewski , Sekhar Nori , Andy Shevchenko Subject: [PATCH v2 5/6] gpio: pca953x: Make platform teardown callback return void Date: Mon, 15 Aug 2022 10:02:29 +0200 Message-Id: <20220815080230.37408-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220815080230.37408-1-u.kleine-koenig@pengutronix.de> References: <20220815080230.37408-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3557; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=cAjt1YY9jC8jFw9Ej2dl2N46JscHeTjH9B9Lc5ZNKaQ=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBi+f2NlKyaAbWssz8ux6GT4UNHgVKigAb6rmeSQ8eT txI0p12JATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYvn9jQAKCRDB/BR4rcrsCXANB/ 4sge+PVwj0m1Dm2szTy/wCLnPucXN1kHyqT1O+AFUkwIRYXLYTzkS3QJOFiWMzNMmvdZyUxnTTjVu2 Eq8BUbV4qjyXqrAWzH1wi6ECcrd0A4Ef9fPHzZYp4673guoQzEYyC37UZ4mK9fqOaUf/VrsKdQnCGd 6sbOZ6Rv5J/f0c7nhlqZFU81bCQtaOvvE/wI13A9aEcnr+d7DQwpVEx+e6sW9Aky+0EZB15mGbGcPa jkuAApkYR2yPnrdo7ZZ1vKrJvmMqfyRxU6zdijW8/L2tSciTxyHNW7RFZ+HjlM+vnIXNW3m4i2y4GA xhhoZ4Jd1Vsn0hmS2X61HE55UmIQiP X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 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-i2c@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org All platforms that provide a teardown callback return 0. New users are supposed to not make use of platform support, so there is no functionality lost. This patch is a preparation for making i2c remove callbacks return void. Reviewed-by: Andy Shevchenko Signed-off-by: Uwe Kleine-König --- arch/arm/mach-davinci/board-da850-evm.c | 12 ++++-------- drivers/gpio/gpio-pca953x.c | 11 +++-------- include/linux/platform_data/pca953x.h | 2 +- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 92d74bc71967..d752ee2b30ff 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -516,8 +516,8 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio, return ret; } -static int da850_evm_ui_expander_teardown(struct i2c_client *client, - unsigned gpio, unsigned ngpio, void *c) +static void da850_evm_ui_expander_teardown(struct i2c_client *client, + unsigned gpio, unsigned ngpio, void *c) { platform_device_unregister(&da850_evm_ui_keys_device); @@ -529,8 +529,6 @@ static int da850_evm_ui_expander_teardown(struct i2c_client *client, gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C); gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B); gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A); - - return 0; } /* assign the baseboard expander's GPIOs after the UI board's */ @@ -697,13 +695,11 @@ static int da850_evm_bb_expander_setup(struct i2c_client *client, return ret; } -static int da850_evm_bb_expander_teardown(struct i2c_client *client, - unsigned gpio, unsigned ngpio, void *c) +static void da850_evm_bb_expander_teardown(struct i2c_client *client, + unsigned gpio, unsigned ngpio, void *c) { platform_device_unregister(&da850_evm_bb_leds_device); platform_device_unregister(&da850_evm_bb_keys_device); - - return 0; } static struct pca953x_platform_data da850_evm_ui_expander_info = { diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index ecd7d169470b..1860e566eb94 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -1105,20 +1105,15 @@ static int pca953x_remove(struct i2c_client *client) { struct pca953x_platform_data *pdata = dev_get_platdata(&client->dev); struct pca953x_chip *chip = i2c_get_clientdata(client); - int ret; if (pdata && pdata->teardown) { - ret = pdata->teardown(client, chip->gpio_chip.base, - chip->gpio_chip.ngpio, pdata->context); - if (ret < 0) - dev_err(&client->dev, "teardown failed, %d\n", ret); - } else { - ret = 0; + pdata->teardown(client, chip->gpio_chip.base, + chip->gpio_chip.ngpio, pdata->context); } regulator_disable(chip->regulator); - return ret; + return 0; } #ifdef CONFIG_PM_SLEEP diff --git a/include/linux/platform_data/pca953x.h b/include/linux/platform_data/pca953x.h index 4eb53e023997..96c1a14ab365 100644 --- a/include/linux/platform_data/pca953x.h +++ b/include/linux/platform_data/pca953x.h @@ -22,7 +22,7 @@ struct pca953x_platform_data { int (*setup)(struct i2c_client *client, unsigned gpio, unsigned ngpio, void *context); - int (*teardown)(struct i2c_client *client, + void (*teardown)(struct i2c_client *client, unsigned gpio, unsigned ngpio, void *context); const char *const *names;