From patchwork Tue Jun 28 14:03:07 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: 586203 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 4602ECCA479 for ; Tue, 28 Jun 2022 14:03:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347331AbiF1ODY (ORCPT ); Tue, 28 Jun 2022 10:03:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347329AbiF1ODX (ORCPT ); Tue, 28 Jun 2022 10:03:23 -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 B20F529CA3 for ; Tue, 28 Jun 2022 07:03:22 -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 1o6BoG-0008KM-Eu; Tue, 28 Jun 2022 16:03:20 +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 1o6BoB-003DSp-EF; Tue, 28 Jun 2022 16:03:18 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1o6BoE-001gzB-69; Tue, 28 Jun 2022 16:03:18 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, kernel@pengutronix.de, linux-i2c@vger.kernel.org Subject: [PATCH 1/6] drm/i2c/sil164: Drop no-op remove function Date: Tue, 28 Jun 2022 16:03:07 +0200 Message-Id: <20220628140313.74984-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628140313.74984-1-u.kleine-koenig@pengutronix.de> References: <20220628140313.74984-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1096; h=from:subject; bh=CQ7TN6D6r4hRl9yUpOYDAsNsGGA68o6Un056TERuUpM=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBiuwoFzQL0YrVffntniiGmjx15gJBrqYBudDhy8/e+ NMQDH9eJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYrsKBQAKCRDB/BR4rcrsCejaCA Cg0szUXxQuGzgIZ5GTOcdqp/LDDuRzqcCKBvoUWKlSgVsvvo4TpqGTDyOVt9M/NsvTcjAjBVc3X4Fb veSir5gjC7QwSpKsB8lzuvMNNHmWobKsUoOcNVCtGkzQcErDVGmqH3jUOjDfUfeAjdvF0TrwDybIUN 3QPlmK0/whY+cuZ8dpLnTSjIpVGS1w86OfcVN7/niBVcQqcRyMl+ZP++e4G9tFuLKkPJ53XOwJXkWn Mgkhoqgf8x5VwGQmhI7M+ea1bZ6yNQOvEBwMk61wFUtYUPPbmIdX2rAa5L0PNR9M0ZYO2q8r+Zlvw0 jpq3Sho5SN3BNVm7nDwnNShnJ3taPh 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 Forwarded: id:20220526202538.1723142-1-u.kleine-koenig@pengutronix.de --- 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 Tue Jun 28 14:03:08 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: 585709 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 809B7C43334 for ; Tue, 28 Jun 2022 14:03:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347338AbiF1OD3 (ORCPT ); Tue, 28 Jun 2022 10:03:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347336AbiF1OD1 (ORCPT ); Tue, 28 Jun 2022 10:03:27 -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 6CCBD1F618 for ; Tue, 28 Jun 2022 07:03:24 -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 1o6BoG-0008KR-Et; Tue, 28 Jun 2022 16:03:20 +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 1o6BoB-003DSx-UA; Tue, 28 Jun 2022 16:03:19 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1o6BoE-001gzE-Cy; Tue, 28 Jun 2022 16:03:18 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Pavel Machek Cc: linux-leds@vger.kernel.org, kernel@pengutronix.de, linux-i2c@vger.kernel.org Subject: [PATCH 2/6] leds: lm3697: Remove duplicated error reporting in .remove() Date: Tue, 28 Jun 2022 16:03:08 +0200 Message-Id: <20220628140313.74984-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628140313.74984-1-u.kleine-koenig@pengutronix.de> References: <20220628140313.74984-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1304; h=from:subject; bh=Jv1SF4GucMG7dlUgDb+wn5QLjamws7d27rtReMSltaY=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBiuwoJ93Y2xyuLHdEFdevI1uC7TKsgc7car9elRxg4 goimJGeJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYrsKCQAKCRDB/BR4rcrsCZgcCA CKMUBqfl9fo6I9xLxz47A6i4xRxn9iNUQ7/RGpki7O50fvZ9VY1gta/P3qwEKuijMJ4UW8DJOp/KHY 1GQSJRvX8Ute+FwG5XsxRddVHEhqC9Cn5IFuJ3hSYQojBm6OADPvdjYS8gBnbc3HtY2NeeRLecWfba b1kBO2+Tkdj6KT+LTLyFfQYGGjtJ4ieqNfR9SbTlxvQMsQx0ah8Cm2CamBnFBZwU/RaHsHysVJ42On 7npbLMkMEizwRf33D3O+UXE97n2PjjoyJte9VO7wEwYAUMlicxRbkMrsRRnbXGjE12AJn1Xth8M0zP v2VP1ViQmACJv2Vo7/G/y7SAc5RfVp 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. Signed-off-by: Uwe Kleine-König Forwarded: id:20220515161227.339514-2-u.kleine-koenig@pengutronix.de --- 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 Tue Jun 28 14:03:09 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: 585710 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 2DD0BC43334 for ; Tue, 28 Jun 2022 14:03:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347343AbiF1OD2 (ORCPT ); Tue, 28 Jun 2022 10:03:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347335AbiF1OD1 (ORCPT ); Tue, 28 Jun 2022 10:03:27 -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 47DEE2E0A9 for ; Tue, 28 Jun 2022 07:03:24 -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 1o6BoG-0008KT-Ov; Tue, 28 Jun 2022 16:03:20 +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 1o6BoC-003DT0-0i; Tue, 28 Jun 2022 16:03:19 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1o6BoE-001gzH-Jb; Tue, 28 Jun 2022 16:03:18 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Pavel Machek , Linus Walleij , Dan Murphy Cc: linux-leds@vger.kernel.org, kernel@pengutronix.de, linux-i2c@vger.kernel.org Subject: [PATCH 3/6] leds: lm3601x: Don't use mutex after it was destroyed Date: Tue, 28 Jun 2022 16:03:09 +0200 Message-Id: <20220628140313.74984-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628140313.74984-1-u.kleine-koenig@pengutronix.de> References: <20220628140313.74984-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=994; h=from:subject; bh=EsInce88HYeHFMRoYmy8/2ZrNKMbIYaMWaDzIC3C+qY=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBiuwoN7cAf2ei8+tU45xAilSNmDo2H31Pwth6qa5Jf ZKVMwseJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYrsKDQAKCRDB/BR4rcrsCdcCCA CZzSBPgzMU5YcOO4wroDwQRF6NgftgkgTKfByfdA3pHvEg/5XzvrZbbW7RMEYJOOMdmGB+uOsa4aPo EAP9LndHemzv2IHzcfg5brG0xMplVzyiNbv4C+B/cpDe16lgobHhFLQmd5sc5y8VZ0dxYP3jqmOaNM I3zvXFkMTo24Zgxrx1DgJD5PSYhFm9xqlAUS8eiqNgkn85eC5C8ngpe0o8TgA+wuj09gAURScMoPi4 rp+nyqetYLcPCBBY07m67wi07a9wKdwX0+v/ItmF/7YG2bdIbg3NF0mYJaH3IQ3mZOUOxypwzKFbfD JCh0uJFmN/OzfgTi7z0kzd0E/x4Vxc 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") Signed-off-by: Uwe Kleine-König Forwarded: id:20220513081832.263863-1-u.kleine-koenig@pengutronix.de --- 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 Tue Jun 28 14:03:10 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: 586202 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 81E83C433EF for ; Tue, 28 Jun 2022 14:03:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347329AbiF1OD2 (ORCPT ); Tue, 28 Jun 2022 10:03:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347334AbiF1OD1 (ORCPT ); Tue, 28 Jun 2022 10:03:27 -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 F12E22E09A for ; Tue, 28 Jun 2022 07:03:23 -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 1o6BoH-0008Ko-3A; Tue, 28 Jun 2022 16:03:21 +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 1o6BoC-003DTA-RZ; Tue, 28 Jun 2022 16:03:20 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1o6BoE-001gzK-Q5; Tue, 28 Jun 2022 16:03:18 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Pavel Machek , Linus Walleij Cc: linux-leds@vger.kernel.org, kernel@pengutronix.de, linux-i2c@vger.kernel.org Subject: [PATCH 4/6] leds: lm3601x: Improve error reporting for problems during .remove() Date: Tue, 28 Jun 2022 16:03:10 +0200 Message-Id: <20220628140313.74984-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628140313.74984-1-u.kleine-koenig@pengutronix.de> References: <20220628140313.74984-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1541; h=from:subject; bh=KYZrnMIsHWPEQ0VMi38pLX+3N1MFh5aofr4bwRSMKj8=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBiuwoQedus2oXqZ4lI1Y7ykicmNsI6/10UBQjPhQof kzxCC1qJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYrsKEAAKCRDB/BR4rcrsCbcaB/ 45l952SnWhWwVGYrGXrGIq2ENWvFSEXwsGGIXxflWkNC6ZcUKnh+l9powkiWgrSTHVCA0TNemxsKzE V4lQyZYwo/Chp+nZxT46S/7NSOO22lgTfVI+ssVDQdXZkKuRn0XwJV1FXahhhzSlAzv4yK3/juoGy0 9zU6mve+I2dD4pr5qavC2P9dDMNWoJN1l/4oBzm17p5dC7j20LC7JN70RaNnqut5RSHNcpVF5J3IBJ eeAJWCQf15BilBfwAiya8f04SDeYfmk6yybww2ermpHzsQPYceTZdUZYOrXArjF63q89uzMVa96M18 /F7pA2Ak8HF7TBvjhkhHo+xCUF9WV+ 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. Signed-off-by: Uwe Kleine-König Forwarded: id:20220513102516.271920-1-u.kleine-koenig@pengutronix.de --- 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 Tue Jun 28 14:03:11 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: 586201 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 C378DC433EF for ; Tue, 28 Jun 2022 14:03:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347344AbiF1ODc (ORCPT ); Tue, 28 Jun 2022 10:03:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347336AbiF1ODb (ORCPT ); Tue, 28 Jun 2022 10:03:31 -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 C6EF92E098 for ; Tue, 28 Jun 2022 07:03:30 -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 1o6BoG-0008Ka-UJ; Tue, 28 Jun 2022 16:03:20 +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 1o6BoC-003DT7-Ln; Tue, 28 Jun 2022 16:03:20 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1o6BoF-001gzN-0L; Tue, 28 Jun 2022 16:03:19 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Sekhar Nori , Bartosz Golaszewski , Russell King , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, kernel@pengutronix.de, linux-i2c@vger.kernel.org Subject: [PATCH 5/6] gpio: pca953x: Make platform teardown callback return void Date: Tue, 28 Jun 2022 16:03:11 +0200 Message-Id: <20220628140313.74984-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220628140313.74984-1-u.kleine-koenig@pengutronix.de> References: <20220628140313.74984-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3568; h=from:subject; bh=QXt4mJ3H+NGdOsmDjNtywoIO4ywvdWEcvDHh7lh6T6s=; b=owGbwMvMwMV48I9IxdpTbzgZT6slMSTt5hIVfL5mxdXA93cKJ/wrtEgVZFq4OtLERqV+eucBnlOS 8T2fOhmNWRgYuRhkxRRZ6oq0xCZIrPlvV7KEG2YQKxPIFAYuTgGYyPE77P/r8kVs2v/a1PU8eT+1/P ENwemeiXdTV12qeHTbnOtFzPd35yLtixLNN+5j/iec48D0ccXhg8Y6tmt8osQjJcVOW0bLshUwGLOY LLp5/mLF/6Jz3yvOBlS+3CtadVY9R8kuws93rf4tkcg9izvUWA/5BRnoe98qsLF8lvmbubZac59l+o +HhwVdElSXOuXIswmIqWV/Vnc4byDYnaXu7/HzwB456RX/2SQ51iy3i+6+x8+3NaNAyfxQRP5CiVK+ I/6XvOyui7yNcXj88Hv25nPrjp4SeLuB/bFMxsdSe5uWvvcLA5iezKmVSCp6s6fr+Ncyf59yQfWiH6 u9hPe+tc1p/zRpnuiujk3e1sFhAA== 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. Signed-off-by: Uwe Kleine-König Forwarded: id:20220502170555.51183-1-u.kleine-koenig@pengutronix.de --- 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 efc26b472ef8..09253e70d0dc 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -518,8 +518,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); @@ -531,8 +531,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 */ @@ -699,13 +697,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 08bc52c3cdcb..3eedeac9ec8d 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -1099,20 +1099,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;