From patchwork Mon Feb 19 07:46:29 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: 202925 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1135169dyc; Sun, 18 Feb 2024 23:49:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW68U1zfW2sI3UlRc4Aw23RRNYcfk3kOWZznxXkj1QVZpOVil06VqEs8dR6IodJXFeppKiy86s67oM28hGfRaUYHAV7XA== X-Google-Smtp-Source: AGHT+IGl6/o/NI9xgGcaeFn79/B0g2Yxz6gmhP8XHqHWZ4Hne6Isl+ZHFiKYLHMaigaMbn1QhMAp X-Received: by 2002:a17:906:481b:b0:a3e:c1f5:836a with SMTP id w27-20020a170906481b00b00a3ec1f5836amr348002ejq.16.1708328987422; Sun, 18 Feb 2024 23:49:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708328987; cv=pass; d=google.com; s=arc-20160816; b=Cb/IDPijcqJmdYoaHFA/7QkH1P4QEChvQ4LZct8O9OEWLWeSY+a86fcBk+Mg+TlJE/ ++olcv2hI3Jh2PxLgD8DrYLOY7F2VmqSatLTgV1oo7SatIlMuQT3Dhdoj66fQZOJC45a Jq7ybxmHlfeIi48Mef2LiwT0jb8StbP9x3wiRWkCdapD+d7TUI+6nc1OZTW7rHfpVzST RAWA5ru552ZKfX1nm+8WhBmQvk5lINBqox5Nxb99hC3WKgM7o/UvGQSdbqsESzwni/g2 z+hM2LmpvEILeaTLsZQtrWuU2Lk7CPZvpDr75fDrPN7kVfzfsuWxyTF4LmWf3/v+HoPv CHtg== 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=7AAEYAcGCIMBHDDozI/9n4v4gxd13fA9BDL5AIuLWEU=; fh=9JZBrvtwCG5066tN718e69nt6/Z/miRqupfdz0ojAcY=; b=kV/kTk829uUoLxVr9Gbut7EV1WBqofwAyCIY+tAv0HNndiqKVORNY28Tt+SYiJPG6g poV3lHBsYMKVmn48TIH9f3j1ZRyLlznJmVTCLyJ6GsuwGAwPTpQp8lSlVnpWjJf998uD zbh0hQY6QvcjGSrDU0LUa2+GRU0YmZx86KmAOaHji3ed7i+37KE9qxc7JiwzGHyHPgC8 +3O4gD0PspoGGgC+LRxI5D+slg0pVj/NLET/CSBOMLCuyCtxuFnM8i4SX8Ud6N1bp80R rlXlQ9AQM6EMR9WYt7+aNCtWdeCrrSFMuKDM84Cj20wlRMl9JNXm9zeZpDSO3/+20Soy 8OPw==; 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-70863-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70863-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bt22-20020a170906b15600b00a3cf4e9be1asi2283962ejb.999.2024.02.18.23.49.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 23:49:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70863-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-70863-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70863-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0E31C1F210B7 for ; Mon, 19 Feb 2024 07:49:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D12E228E2E; Mon, 19 Feb 2024 07:46:43 +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 B149E208B9 for ; Mon, 19 Feb 2024 07:46:39 +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=o9SwOayLXY3Y1h/b6wwxzqtOvxDGadWqcSxoR0z6c3N/B05boAZiRu+8AkqGsvGArNlRcd0I9QgfuvSTsFURu+Pj9JMkQDwUXI+ib90w8Xw2+ralRvUqHklJa/MgmICOS4Ww47LBlhzpNmDlo8HKZR8kxpGB5DPfYjErOAgAmdo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708328802; c=relaxed/simple; bh=QZqbPBhPYmmHIl+LVwHKgs3Du4oSnfjsBLIeKUtJ4R0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mW7YMM7pn2JAX6TCZLthJwciU8ECbrBwIzXB5tEHq4x7htDffTVd/WLqUh4iS8uyGt8Qb88Tzv3RtbGNWrHO5D0p375Xex0dPLHuYQVefSkVQa+B3cDET+ALHuHjDIr51mR+yKnouN+PvhaknmtNG3h0buOLkdv/q1oiL5Zi5W8= 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 1rbyMH-0000QD-TM; Mon, 19 Feb 2024 08:46:37 +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 1rbyMH-001bHu-Gb; Mon, 19 Feb 2024 08:46:37 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rbyMH-007bvV-1P; Mon, 19 Feb 2024 08:46:37 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thorsten Scherer Cc: Pengutronix Kernel Team , linux-kernel@vger.kernel.org Subject: [PATCH 1/4] siox: Don't pass the reference on a master in siox_master_register() Date: Mon, 19 Feb 2024 08:46:29 +0100 Message-ID: <1e8d09d17848e58e8fc6a46278b5e8fb0cf4618a.1708328466.git.u.kleine-koenig@pengutronix.de> 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=1309; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=QZqbPBhPYmmHIl+LVwHKgs3Du4oSnfjsBLIeKUtJ4R0=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBl0wdWQIu5tDnIFdc4N1sCtCpl7yfMajaokhN6X zhaCNQH6vaJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZdMHVgAKCRCPgPtYfRL+ TmucCACzAy5qlIT/7W4Sm4FWw3zBPiSj1dbaIYxgNHhkg4SB+a8KSq2XtyAx2Rl76t1DKcrrohc oqlSrwKqMOJ5+bW7uRZArvofTevc3xNiGPLsUHOYuRqWUMEDRHo+8wo//phN3noWK7j0IQaW+A/ BytMKxoYFadNh99eR8l1b49XiQKAJRuLIZar6dAFAAohwT50v8oKYBhCfh8D4EO2DHrPZLqPvYF RzgrcPvZwQyHbvrgcDOCPDKdDicPZsraXEhCepcpOJyHXmy4QZGffp9eiQDPIAJ5PtAenaLrNCX I5iKqhL/1cCcmZO9Myf6pHypVYQO86Xn4BsqGZCsBa7OCa9K 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: 1791312776163671979 X-GMAIL-MSGID: 1791312776163671979 While it's technically fine to pass the ownership of the reference on a struct siox_master from the caller of siox_master_register() to the framework this is hard to use. Instead let the framework take its own reference (that is freed in siox_master_unregister()) and drop the bus driver's reference in its remove callback. Signed-off-by: Uwe Kleine-König --- drivers/siox/siox-bus-gpio.c | 2 ++ drivers/siox/siox-core.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/siox/siox-bus-gpio.c b/drivers/siox/siox-bus-gpio.c index aeefeb725524..fdf20fe80059 100644 --- a/drivers/siox/siox-bus-gpio.c +++ b/drivers/siox/siox-bus-gpio.c @@ -149,6 +149,8 @@ static int siox_gpio_remove(struct platform_device *pdev) siox_master_unregister(master); + siox_master_put(master); + return 0; } diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c index 561408583b2b..d4acab7036d6 100644 --- a/drivers/siox/siox-core.c +++ b/drivers/siox/siox-core.c @@ -717,6 +717,8 @@ int siox_master_register(struct siox_master *smaster) if (!smaster->pushpull) return -EINVAL; + get_device(&smaster->dev); + dev_set_name(&smaster->dev, "siox-%d", smaster->busno); mutex_init(&smaster->lock); From patchwork Mon Feb 19 07:46:30 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: 202924 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1135161dyc; Sun, 18 Feb 2024 23:49:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWN8N/k0dd5DZfwj1V2lcfWbieMqQIyWPh8m8ofgqADSL1W9kFc1yub99/T012Wa7T5SLzn9phtvUEjbnBawIUXatrrPQ== X-Google-Smtp-Source: AGHT+IHw0y/00koEgA2H/WotDOJ61dC4D9lmwrcZ9IWMkJTYyAlLHscGKf2kbpCdKh0AppE/0YSx X-Received: by 2002:a0c:e0d0:0:b0:68f:4b3c:6448 with SMTP id x16-20020a0ce0d0000000b0068f4b3c6448mr5317410qvk.11.1708328985738; Sun, 18 Feb 2024 23:49:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708328985; cv=pass; d=google.com; s=arc-20160816; b=qvEwgOlkNtBUs/MpIoKG68TQEhf5CMGyB5/h4CjBeifvRxpPcjNPOXNE6IHPBgVaJJ StUC8jO5hY50aJfDI/pEYRpTQxGuTyCkkjMInP3TlT2m6gN5vN7LyzWk7EQ6V1OGym2J ArNX15exmg/HggYUPQLckTBVpxiaplYazoDLfD5w0wj7OI81YnQ/l9y+YAr/wZ1q+4C/ w3ilhZD9Xpec67e9HReHDYJpOAuAjWH6+uRnJAVf7ndg3soCvubmeWB9oK3SIL2KstRF wLdoo6Fr3ER9pd5bvYxIhh9dvuKyEuhmM/DZfyfRndk81H4bhTYn7hsXpkP84E1d+9q/ aH6g== 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=Tz+o3vI9KlvHiRG29EdJARxLzt+Yvz/b+TvJFHIdhXw=; fh=9JZBrvtwCG5066tN718e69nt6/Z/miRqupfdz0ojAcY=; b=g7y5ZkB+XXAemB4FottGuWLj6bAqTZSdkVvmOxHZUECQS1IqjjEYhGjM5ZIWtul0/3 1uUPmY+OGT5jEYi8xfv/eA3YpznNo4IGYyM0jFno7WK+vJE56Z35d9vsW2bV7jKaiR9p qOV0wuryYg6dGYg7JI9o7y+11geUCDrAhIVVqeFOOE1EWjqARmHEiCIIGbRQpD0aj5gH 6T1xRAuJiAmpA1lqU3BcqoXedp6r8wDcsSKCxX1aX7kD0neeFDgFQ3JTeimPelibf0c6 I6k89Qkss3EvZefSQEpJyO/XBN+mUeT9zGbMRvgumD9ROPiprIbw0lh68V2K5I2cYwAv sgZA==; 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-70862-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70862-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a7-20020ad45c47000000b0068f30acaec5si5997304qva.607.2024.02.18.23.49.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 23:49:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70862-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-70862-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70862-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 872611C21CA8 for ; Mon, 19 Feb 2024 07:49:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D065E28E2B; Mon, 19 Feb 2024 07:46:43 +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 0753C20DC3 for ; Mon, 19 Feb 2024 07:46:39 +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=hd3RTLJuPv18c0uzimDjAIKPX3XdqsbBeqetFh1Ik1h6hdskJzRXYjn4u6pbzX4fLuVikyUjSsZTtGthcHeSXupjeLNN3K050spMnX3O93FvCxmSCHDDKYquZCwAzCYpqz3UD68aH+y27y9bHrGnIFjWv+m58Vp+5MTBQ2lotW8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708328802; c=relaxed/simple; bh=m49ew6tZDWmkpcYRR5eY0qxk5vXybz95BmqhredgINc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UQOva2PeUrpVmOJoeF1DLHce6tmCgSgrc2OiJ/Zwww91mvMAjWLc4JOnEC9mcAOxXBYNkaR8AMHTGjDFpirQ+d1y/+4b55aQSyT3oWDmq9+rVqWzrx+kXy1za9V75P357jHCPewE2kneQg5q0VjD+Uts0/L4O6gWk6xXVEtXiEk= 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-0000QL-3c; 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 1rbyMH-001bHx-MP; Mon, 19 Feb 2024 08:46:37 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rbyMH-007bvZ-1v; Mon, 19 Feb 2024 08:46:37 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thorsten Scherer Cc: Pengutronix Kernel Team , linux-kernel@vger.kernel.org Subject: [PATCH 2/4] siox: Provide a devm variant of siox_master_alloc() Date: Mon, 19 Feb 2024 08:46:30 +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=1597; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=m49ew6tZDWmkpcYRR5eY0qxk5vXybz95BmqhredgINc=; b=owGbwMvMwMXY3/A7olbonx/jabUkhtTL7OF+bGLK5TNznuVIxMWvfO/Iy1z88lvj5NopNl8nL Dh67/qqTkZjFgZGLgZZMUUW+8Y1mVZVcpGda/9dhhnEygQyhYGLUwAm0qzL/s+S8dgEt9XVrFZf 7rGm/5n71kR59Zwba40iCsptfeTfne9aUci9ctvZvRJq25PjmJ+Y5YdO+PjqhgJr/seDu0y01BY H1xd0Z9V9Ez9fwhwR25ap51KYs9g3X/hA3wSeuNTi+QGORox8s+7Jebj2Ot5U4k7yU0hhiZnKso X3tNUqXkXLk5xlzyM6Ns+4fWLqGl83heutwnMlpmdXyLHPt1LITBERNY/at75z5SXbzb4NgvqvF yzivjg1UnizatiHVwdmmWY3f9tvwaM5pVSjpeT5a2FbTpbFc17JLZ7K7igWl53Tns1U12jCc8M4 +cjupROv/w/4uMk4aaX1xbts+/5ZWs98teLAiqMt5ltbAA== 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: 1791312774625490492 X-GMAIL-MSGID: 1791312774625490492 This allows to simplify siox master drivers in the next step. Signed-off-by: Uwe Kleine-König --- drivers/siox/siox-core.c | 24 ++++++++++++++++++++++++ drivers/siox/siox.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c index d4acab7036d6..9dd0bda03db3 100644 --- a/drivers/siox/siox-core.c +++ b/drivers/siox/siox-core.c @@ -707,6 +707,30 @@ struct siox_master *siox_master_alloc(struct device *dev, } EXPORT_SYMBOL_GPL(siox_master_alloc); +static void devm_siox_master_put(void *data) +{ + struct siox_master *smaster = data; + + siox_master_put(smaster); +} + +struct siox_master *devm_siox_master_alloc(struct device *dev, + size_t size) +{ + struct siox_master *smaster; + int ret; + + smaster = siox_master_alloc(dev, size); + if (!smaster) + return NULL; + + ret = devm_add_action_or_reset(dev, devm_siox_master_put, smaster); + if (ret) + return NULL; + + return smaster; +} + int siox_master_register(struct siox_master *smaster) { int ret; diff --git a/drivers/siox/siox.h b/drivers/siox/siox.h index f08b43b713c5..b227e18b697a 100644 --- a/drivers/siox/siox.h +++ b/drivers/siox/siox.h @@ -45,5 +45,7 @@ static inline void siox_master_put(struct siox_master *smaster) put_device(&smaster->dev); } +struct siox_master *devm_siox_master_alloc(struct device *dev, size_t size); + int siox_master_register(struct siox_master *smaster); void siox_master_unregister(struct siox_master *smaster); From patchwork Mon Feb 19 07:46:31 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: 202923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1135131dyc; Sun, 18 Feb 2024 23:49:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWfGG/QuPGHZaBGWIGLAYjrG491rg/3dmlUJuOvLW7xUJ6zJapgyOC84cvujzh71RkOcAoV/dgaf3CLGwGV7xJDbP/adA== X-Google-Smtp-Source: AGHT+IH8CQEn8fobPCZvf376iq6fotmT66s/Z8V5qEcs6NXs8+T7l0f4TcsQY9Bqo1P6J64mRmOv X-Received: by 2002:a05:6902:220f:b0:dcb:d8d1:2d59 with SMTP id dm15-20020a056902220f00b00dcbd8d12d59mr12371024ybb.38.1708328980275; Sun, 18 Feb 2024 23:49:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708328980; cv=pass; d=google.com; s=arc-20160816; b=gwSeDi3BZiKBkMOGe6t6qonkSbUfxlfex8fxPgp9aazqpqEAbeNJ51VFm3Q64ItFs3 hDDjXA4ZTracIvpVbV7zclSSBn2XZIoAmqgUWAblE12td9XPxi3R+/UMo8XiGOhef77R UUQvJC9KXZY1ZoYr3nXVmdGtF0IAWcebIFkFkmPrRy83LO/k5d916jE0FQCEkbZIabUz RnNM1dIr3p22GqsrSLy1vWVrf1w1RdDQgJphFflck0rBuYmc7BT8Bvpwisb+VQoeeL94 iY3t06wj0lASDnSJujNBlAUKId02FhE5UqtS4UPZWs/4qzOn80SUiA5e2aawqTroikMR ms9g== 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=ZpyA/r9kyiK6BnjA5FOgMeo7D877goYyM0NW7Mnf4wM=; fh=9JZBrvtwCG5066tN718e69nt6/Z/miRqupfdz0ojAcY=; b=L0iZt/iQYSIg6acIOX/sc26i5zP5Ck4vVA7Xocmmer3wi8My9r8SUMBOiLQs3r5Z+s l83awGUduUNkv6eFzif84JOxAwgDqwmjnmln6qr02EG73opYAmny3zNTvcUEe7G4ssCW IKF2XGmeOs5LKS6D/6H2v+0YFx4NpDsQ+Jd99hDGgCeAV7irKN9eLXAZR4bJmtZl70PM VY/9qhuwlOslECQl2qLyXtl8ibdL3FP1JYKMuDaqiI5pCCuvjUhmNaPWIUcnDYcWYzk8 IQA7YAAIVQv8/Z8IbhDqgl/IYqVe6yjLIj4t1weYXYjZUUiAUUKci6bHMCa1fI10d+Ic 9Hlw==; 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-70861-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70861-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 l8-20020a63ba48000000b005dc351748dfsi4040171pgu.121.2024.02.18.23.49.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 23:49:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70861-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-70861-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70861-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 15DEC2832CA for ; Mon, 19 Feb 2024 07:49:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A1B9228DDA; Mon, 19 Feb 2024 07:46:43 +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 0757220DCB for ; Mon, 19 Feb 2024 07:46:39 +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=1708328801; cv=none; b=qf+MsOv3qMh0kj+KdwPFTctYkHWVomvHmUWYqNWlfiNKKGs2n8spZeKCppRsZpHTqysvvB+MlbrFRlOjKcXuxYDK/xCrX3XsHmhHdwIkR9iKJJ9gBKODIc0HBT2hN3aSnorLnwBUOHkN0A+HO07XGANTICARi8XpLFYqZWwu3ZI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708328801; c=relaxed/simple; bh=5n374oK69anYKzr186W3GbJnE/m/Yv82dp/vgrHEbcQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Rg6lbBhxSbDPV5wcQLxcgY198dSSimFTucwfFpSwDGK9aoAZGBgyE6r5IOjQV/zddafMvb+1ndpfRP2j+yN+8o54zt8gu2TYdturRdULU1xHpvNR1gM9TZJ5/maVSPhV7a2EvsEpb2zk6TIIjWiFsMzyuaLuIbE0bxslKLWg5rk= 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-0000Qa-9v; 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 1rbyMH-001bI0-TH; Mon, 19 Feb 2024 08:46:37 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rbyMH-007bwV-2f; Mon, 19 Feb 2024 08:46:37 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thorsten Scherer Cc: Pengutronix Kernel Team , linux-kernel@vger.kernel.org Subject: [PATCH 3/4] siox: Provide a devm variant of siox_master_register() Date: Mon, 19 Feb 2024 08:46:31 +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=1637; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=5n374oK69anYKzr186W3GbJnE/m/Yv82dp/vgrHEbcQ=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBl0wdZMfEcZi8q8rmWm9FEXF5CfGlEFTwMlt1RD K8+7NIunyeJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZdMHWQAKCRCPgPtYfRL+ TiczB/96bCoLprpEiH7fVeWwFAW3Q/3nTdWc1kdgE57eBPs4YlwkF9uikIJEJeVvTX/CNQaN+Ym pVTGAwCs85cff4iLQsIh1wLLv1oE4jXSQRCd3hNlFlfP1bkyoZfL13hpK+6tm3MOxln/VP4isO4 V/qlMUMVr12V7STOVPjdFbexomt+JBrd3p8V06/dLC73YIaixjB7+mATDlXSuMXVasqSKJSQu1K dOz33blyY3o73Ec992k/c42yerph5eQ+UncZNrq6fhlwH5S+tc/V8Q9i4WSi3Vmurqdhostg+Fb D0uiKPCn3goewnjV3sYcrJezTgKF9G8Xn3B8/7gxL0tNSsas 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: 1791312768967854693 X-GMAIL-MSGID: 1791312768967854693 This allows to simplify siox master drivers in the next step. Signed-off-by: Uwe Kleine-König --- drivers/siox/siox-core.c | 19 +++++++++++++++++++ drivers/siox/siox.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c index 9dd0bda03db3..8d7cb9e24efb 100644 --- a/drivers/siox/siox-core.c +++ b/drivers/siox/siox-core.c @@ -794,6 +794,25 @@ void siox_master_unregister(struct siox_master *smaster) } EXPORT_SYMBOL_GPL(siox_master_unregister); +static void devm_siox_master_unregister(void *data) +{ + struct siox_master *smaster = data; + + siox_master_unregister(smaster); +} + +int devm_siox_master_register(struct device *dev, struct siox_master *smaster) +{ + int ret; + + ret = siox_master_register(smaster); + if (ret) + return ret; + + return devm_add_action_or_reset(dev, devm_siox_master_unregister, smaster); +} +EXPORT_SYMBOL_GPL(devm_siox_master_register); + static struct siox_device *siox_device_add(struct siox_master *smaster, const char *type, size_t inbytes, size_t outbytes, u8 statustype) diff --git a/drivers/siox/siox.h b/drivers/siox/siox.h index b227e18b697a..513f2c8312f7 100644 --- a/drivers/siox/siox.h +++ b/drivers/siox/siox.h @@ -49,3 +49,5 @@ struct siox_master *devm_siox_master_alloc(struct device *dev, size_t size); int siox_master_register(struct siox_master *smaster); void siox_master_unregister(struct siox_master *smaster); + +int devm_siox_master_register(struct device *dev, struct siox_master *smaster); 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,