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);