Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp989927rdb; Sun, 18 Feb 2024 23:53:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWiHtKAE3ymZUahpfDbWvuya3ixyfiaBSEGAa3pvB8HT/JcNeaGmvK6Hf9cyHG5g7Rm6m3VL5yxrH3eU88pooX3ByJoFuo7SKpvNbXrqA== X-Google-Smtp-Source: AGHT+IFXgmM3ceWrifs9Q9JbthA2oqQdpkKp53FUgNNlSIsl6C/BQREE5J57C0dm2MFsY9oTSr0n X-Received: by 2002:a25:dc92:0:b0:dc7:46e7:7aea with SMTP id y140-20020a25dc92000000b00dc746e77aeamr9545806ybe.47.1708329198036; Sun, 18 Feb 2024 23:53:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708329197; cv=pass; d=google.com; s=arc-20160816; b=pMq9oUVDUpf1duJVXinsrYp5Gb8oXVhB3GAzg8QTHQ5HylNX/6g3MWu/cdJ32DsqUQ TU9H21za65N1Cd1IDWtQeVEG3N4Clpw0JOzi1Jh++FK4sOXRcjQ571zJ909eqrebnHKd GQJ+CpdP2LkZbvvC0IpaVMjYYvZ3ASaUrCLskpFVw9I/5B66Mo/yAGbbROsceC/8f8pJ sc18CL6Aw/x3k7xacFt/kWvB2YxMT4EdIQWOpChId99gYyL4A1lOrUoI65uLipQRkbN/ l7sT+M7DH3gSsru6YzHHejgEvq8Q08epk/zcpp/H5opeoVa7y36NyO54p1w28jNGVhCo AWEQ== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70862-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bn16-20020a056a02031000b005d8bb95ce76si4130643pgb.285.2024.02.18.23.53.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 23:53:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70862-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-70862-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70862-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B80B5B226E0 for ; Mon, 19 Feb 2024 07:49:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BBC9822330; 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 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=20Kleine-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 Content-Type: text/plain; charset=UTF-8 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 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 | 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); -- 2.43.0