From patchwork Mon Feb 19 07:46:32 2024 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: 202927 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1135351dyc; Sun, 18 Feb 2024 23:50:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXns5/9Az73g9Ps0CEitCo6WXyzx5BvIz2QXf7F3UKNwZ170iVATAxzD0TkM3eHDQaIXGIBtNHLtBUV6QbsI5fEhizKpA== X-Google-Smtp-Source: AGHT+IGFoqgjUugXKFddJKef50nCKJWbPdET+w316iqkc7ZKus7vFlBOjS/t+jHI+k0zCvSrinIW X-Received: by 2002:a05:6808:2c9:b0:3bf:ec86:d744 with SMTP id a9-20020a05680802c900b003bfec86d744mr12183330oid.53.1708329023222; Sun, 18 Feb 2024 23:50:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708329023; cv=pass; d=google.com; s=arc-20160816; b=HKo2uNjeU82UbY0G+TeT5aD9EEA50JONxCzan471725gpT3OtzB8Y5iPKXT23/Nbpz Hjp7mwrdKaTNXuafY3zXrRCzQ6zJtTK2S4UVMygZo+LdrhpgGIfJqqyq+Un5gsVNsSjx GnAETJVh0urlnKQAtTEw6uh0OJxrYobGbsC8NbhWaCEQLZETM8z0Z1/bfUayQfknjojE knJs3uSRc6dw8JmLWhHEKfXF8cAZ2LBuA/hJfQJDXcDrvSssstzn1QRrebDM2dn9Nic7 dri181KjUs1mLT0GtdX25jq/5OA8aBnA1aU3r8Jpya/HFsIDtpc3Ie2nTFbNmeTRlfjb nNTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=6cS7LU41WlNQxWxuYPjmxmO6lOgaBzGtSFXtcs6gAGo=; fh=9JZBrvtwCG5066tN718e69nt6/Z/miRqupfdz0ojAcY=; b=gEwLG9NN5hgTsvw2Gu4zUgLG8JMGKa+bbz+bn5fVyyfbc1IQe04hRA+8gZojqvsVgM 6XqflfuMBDLDn1qPl8CK/B3usIGOGgFDF0H4lAaxo30h5IinDpBcAZFFLNuy9aKCxh80 7zImjxL2k5rAYoakEU3pad+RVpj0jIepuoaA6qj013cxRFSzCc92M+zAjMss2nhA4AJ4 u/2qWwbFkbe9Nex+Ko6IWQYAGDne/AS5/1lQQ1IWX3ErdVpZiuAeM84JlOLjgofwLZgh Wu9KWInuznF1OKHhMzHaNW9Aq8ciIfoOWvb0ywmqpzE6S7UvzuQd6TlIzCXHWHNfbUiP QsEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-70864-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70864-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bq9-20020a056a02044900b005d8bb422554si4133408pgb.195.2024.02.18.23.50.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 23:50:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70864-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-70864-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70864-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A422B281A50 for ; Mon, 19 Feb 2024 07:49:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D27E2C19D; Mon, 19 Feb 2024 07:46:44 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A177220B28 for ; Mon, 19 Feb 2024 07:46:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708328802; cv=none; b=bZcovw+zbvbgBubUjKKr5MYE2RZRW9svCAAbRyxyzhC9HOkIUXsK04sxj4HhGsauoaHbJ+No5Gs57ihyneZ0Ipmf7Rq2S99zyhT/MhQxirftYj0Mldr/sz+S6GdfGkFv9PV5GyPe0cqoj2XEPdN67aUkWLRESNoHvJ0KF58moZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708328802; c=relaxed/simple; bh=84E5HYzwICcsAPLnGxCzOsWHLdNNcdnvBZ7Nk0uz224=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lhBq8ulMkEAxPrpCHObnZc1SQBgvrjSKH+NqhcLLcZ6STDJPuoF6sB5I5MprUtXP0LzwuKzWQ0TDzcmTKmerRCwf2GxW2ficYvMLsJIdoEIoYrOUHyj4dqX++sa+wQEN/g4UGfc9GZww1ZBJ2OCrBjumPLRyltG20VRnzkVqaMY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rbyMI-0000Qp-J0; Mon, 19 Feb 2024 08:46:38 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rbyMI-001bI5-6E; Mon, 19 Feb 2024 08:46:38 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rbyMI-007bww-0K; Mon, 19 Feb 2024 08:46:38 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thorsten Scherer Cc: Pengutronix Kernel Team , linux-kernel@vger.kernel.org Subject: [PATCH 4/4] siox: bus-gpio: Simplify using devm_siox_* functions Date: Mon, 19 Feb 2024 08:46:32 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3289; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=84E5HYzwICcsAPLnGxCzOsWHLdNNcdnvBZ7Nk0uz224=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBl0wda5i95eWYtLzV7dp2r82PwaiG/Al22sh7A4 IxDlp2A3suJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZdMHWgAKCRCPgPtYfRL+ TsWVB/9o4X1BhVmx/VNaWI/raXJXVqyiMDTneymjJWwFm2+yElDqB6sQ4Gcbmy7WAOc5+ruQMjr TkBbc9cVTtL7X4W35KgRkhUUpZHjzSsaasKFW4rBxh8gtuauVmPSC8e5nRC+u0Kgv4q0cubMpNB 1xmJwqfwgbpkuMn9PyvZyQhXnv6310yqGK7MRpBorBrVmYGlcejbr6/lYsbJPJEIrhjhCsNaq3e tdffpXxxe/fkXiZ4qJWkZQHv58zpEv6LYdUax9UkHNzgb1C5OghtxcCXMwFOqaOt4EM42AMz9GS Iiqc4AD+7Vh6XzV8BXnX0NQbxV/VBRWAQl84WaT6IkjiG9Pb 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791312814069701038 X-GMAIL-MSGID: 1791312814069701038 With the devm variant of siox_master_allocate() and siox_master_register() the remove callback can be dropped. This also simplifies the error paths in the probe function. Signed-off-by: Uwe Kleine-König --- drivers/siox/siox-bus-gpio.c | 64 +++++++++++------------------------- 1 file changed, 20 insertions(+), 44 deletions(-) diff --git a/drivers/siox/siox-bus-gpio.c b/drivers/siox/siox-bus-gpio.c index fdf20fe80059..9e01642e72de 100644 --- a/drivers/siox/siox-bus-gpio.c +++ b/drivers/siox/siox-bus-gpio.c @@ -91,65 +91,42 @@ static int siox_gpio_probe(struct platform_device *pdev) int ret; struct siox_master *smaster; - smaster = siox_master_alloc(&pdev->dev, sizeof(*ddata)); - if (!smaster) { - dev_err(dev, "failed to allocate siox master\n"); - return -ENOMEM; - } + smaster = devm_siox_master_alloc(dev, sizeof(*ddata)); + if (!smaster) + return dev_err_probe(dev, -ENOMEM, + "failed to allocate siox master\n"); platform_set_drvdata(pdev, smaster); ddata = siox_master_get_devdata(smaster); ddata->din = devm_gpiod_get(dev, "din", GPIOD_IN); - if (IS_ERR(ddata->din)) { - ret = dev_err_probe(dev, PTR_ERR(ddata->din), - "Failed to get din GPIO\n"); - goto err; - } + if (IS_ERR(ddata->din)) + return dev_err_probe(dev, PTR_ERR(ddata->din), + "Failed to get din GPIO\n"); ddata->dout = devm_gpiod_get(dev, "dout", GPIOD_OUT_LOW); - if (IS_ERR(ddata->dout)) { - ret = dev_err_probe(dev, PTR_ERR(ddata->dout), - "Failed to get dout GPIO\n"); - goto err; - } + if (IS_ERR(ddata->dout)) + return dev_err_probe(dev, PTR_ERR(ddata->dout), + "Failed to get dout GPIO\n"); ddata->dclk = devm_gpiod_get(dev, "dclk", GPIOD_OUT_LOW); - if (IS_ERR(ddata->dclk)) { - ret = dev_err_probe(dev, PTR_ERR(ddata->dclk), - "Failed to get dclk GPIO\n"); - goto err; - } + if (IS_ERR(ddata->dclk)) + return dev_err_probe(dev, PTR_ERR(ddata->dclk), + "Failed to get dclk GPIO\n"); ddata->dld = devm_gpiod_get(dev, "dld", GPIOD_OUT_LOW); - if (IS_ERR(ddata->dld)) { - ret = dev_err_probe(dev, PTR_ERR(ddata->dld), - "Failed to get dld GPIO\n"); - goto err; - } + if (IS_ERR(ddata->dld)) + return dev_err_probe(dev, PTR_ERR(ddata->dld), + "Failed to get dld GPIO\n"); smaster->pushpull = siox_gpio_pushpull; /* XXX: determine automatically like spi does */ smaster->busno = 0; - ret = siox_master_register(smaster); - if (ret) { - dev_err_probe(dev, ret, - "Failed to register siox master\n"); -err: - siox_master_put(smaster); - } - - return ret; -} - -static int siox_gpio_remove(struct platform_device *pdev) -{ - struct siox_master *master = platform_get_drvdata(pdev); - - siox_master_unregister(master); - - siox_master_put(master); + ret = devm_siox_master_register(dev, smaster); + if (ret) + return dev_err_probe(dev, ret, + "Failed to register siox master\n"); return 0; } @@ -162,7 +139,6 @@ MODULE_DEVICE_TABLE(of, siox_gpio_dt_ids); static struct platform_driver siox_gpio_driver = { .probe = siox_gpio_probe, - .remove = siox_gpio_remove, .driver = { .name = DRIVER_NAME,