Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp988628rdb; Sun, 18 Feb 2024 23:49:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCULGCUAkn7iwDdTPD5bMe24KHdEoZAxiMtMy6BrFx2P3CdunyTWiuyvocNpEgzqbLrAHoW8zZRisrjQl0NPboLGcispPJN0cnTeQlzcRw== X-Google-Smtp-Source: AGHT+IFG7mH/t7yZX/MH8JY6CAjnhWr3tszoe0Q0IDtLxWZRnq3duMNuG/eb1srvk+gvpaDz4QbD X-Received: by 2002:a05:6a20:9c8b:b0:19a:fad2:518b with SMTP id mj11-20020a056a209c8b00b0019afad2518bmr10829737pzb.5.1708328943739; Sun, 18 Feb 2024 23:49:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708328943; cv=pass; d=google.com; s=arc-20160816; b=wk9Ht1wQOtFF64pYqqH888Ubd0CyDkVRvZ1/bm+F0Ai4Nkw6Utoqn0Hd5nBZClBpSs lGh72qZtecBhMN4w53gky7lyeLFgepC63tzzifR5lkdojtXA5nq1KvlBqCJEaWrNv3su fVHM5nlfuAhSCpjBhdg8I6egurnyvOErIT3kOIXUsulYkEhHTOMoCBgxWzh4t3glsbhd wCvVb61LnQ32SqBBaxlhWAuR6RMzH9QCSr+4XlbjOijQNdnoY3iw7XxUAJa7XQVZwaBl Cv75bVaScinc1FTyAcNSV9SgEOdcXkQ/VkeYPGdU60GBRxQTVfMSbpkyA0/0r205dQuJ 3dGg== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70861-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 4-20020a17090a098400b00298e649da8csi4134766pjo.135.2024.02.18.23.49.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 23:49:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70861-linux.lists.archive=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-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70861-linux.lists.archive=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 74CF628324C for ; Mon, 19 Feb 2024 07:49:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 829E92209E; Mon, 19 Feb 2024 07:46:42 +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=20Kleine-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 Content-Type: text/plain; charset=UTF-8 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 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 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); -- 2.43.0