Message ID | 1e8d09d17848e58e8fc6a46278b5e8fb0cf4618a.1708328466.git.u.kleine-koenig@pengutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-70863-ouuuleilei=gmail.com@vger.kernel.org> 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 <ouuuleilei@gmail.com> (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 <ouuuleilei@gmail.com>; 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 <linux-kernel@vger.kernel.org>; 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 <ukl@pengutronix.de>) 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 <ukl@pengutronix.de>) 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 <ukl@pengutronix.de>) id 1rbyMH-007bvV-1P; Mon, 19 Feb 2024 08:46:37 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de> To: Thorsten Scherer <t.scherer@eckelmann.de> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>, 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: <cover.1708328466.git.u.kleine-koenig@pengutronix.de> References: <cover.1708328466.git.u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 Content-Transfer-Encoding: 8bit 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 |
Series |
siox: Move some complexity into the core
|
|
Commit Message
Uwe Kleine-König
Feb. 19, 2024, 7:46 a.m. UTC
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 <u.kleine-koenig@pengutronix.de>
---
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);