Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2618029lqz; Wed, 3 Apr 2024 03:45:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQCC3B93hO/WeUW066SXwmkEsdXI/whFLpQ25W0SFXO2gpWrdxHVM6m+S77G0am2MHlWLugpAJQthCHPsgIkrfFEheEzGSce4/5p/Srw== X-Google-Smtp-Source: AGHT+IHQXvrTlitXg2JF6tlTYi0la3nquuQZjeShyv0UnmMkZtmG2m7WSeInF2DsteIqvM1n1i2X X-Received: by 2002:a17:90a:710b:b0:29f:cf88:c2d2 with SMTP id h11-20020a17090a710b00b0029fcf88c2d2mr13704489pjk.12.1712141139722; Wed, 03 Apr 2024 03:45:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712141139; cv=pass; d=google.com; s=arc-20160816; b=SLuduEDk0rjoawoGa6fq7WzwkdYPsKC5QeO1jhIoQeDN6U8Orrc9fL8zgBuMNb7qc9 AVQc8hLcFnvLjgGcQHUl2EPi+NO1vA9WXE/JC00kjYKkXXg9HdnY3rL8R4woCv5Bs+bB n0CvYHx4qZymrH/QBaZdzJ8KyYJ4FDrSCKEqqNlyZe5WdODQkBZqwZvKOjXxDTQCN0dq ElsajhcYkWXP+x0Wx/Mg8+cxo0CGXA/5Kot2UpKpxrT/n+3Umq1i2qNPUagwmJHhum4p aI8ahsGsOqnDMxxLqcqT3YdAIldRzmfz9gomiljsIBRfuRQ+2acI27Q93GzehdxdZ5Iu 2Uyg== 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:to:from:dkim-signature; bh=tmLgm9Qq7srg8c2mrdhIjORjGo8nAKOj/ZnxTGPuYos=; fh=FbN112dYGc1hX+4GonpeFIx0mboSHk/5a5IUjwmjIQ4=; b=X9K7Xfk2Nl4g3UkrQuh3HZuzQMrdJUHjE0np0MHIRU/cXGDlwa6bIvwMW4sHvLGMRA wIbifuCUx591Rq7fyFQthKaWpJ7Kw7oa2+dEp9O+q8HJHYS4nRLI7yic4a1V84RH/Ryk 1/YwG3fH3eh0jy+wJI4RkTp+QcHCFNUUpfHjOfnVg3sWkAKSxOK7CAK1BOB27vT1rRIT 1btRlHqS76xQotvunfY2yYa216uvt3HEmgCpvyDI1k7meJZRypJotgGfB5HXcYrIxM9A CiIqMRInBMozrHmKptxCaH5rt2hWhIV9I3lztfCwgf0wOgljcTbor1Im2CTQfFkUm0Ig 4rCQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=kSbUqnTG; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-129593-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129593-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id kb8-20020a17090ae7c800b002a212bb52c8si11506521pjb.105.2024.04.03.03.45.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 03:45:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129593-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=kSbUqnTG; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-129593-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129593-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com 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 06EE328D59D for ; Wed, 3 Apr 2024 10:44:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B87AF1474A1; Wed, 3 Apr 2024 10:42:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="kSbUqnTG" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 4855D146D5E; Wed, 3 Apr 2024 10:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712140971; cv=none; b=t9wC98COIDGgAybsTzBieWyTG/5msqCEDslpYHuLHoYSystxfEvDznq2Xp+ohVeu5yAYewAnxVJ7mzaLECzzySgk17nVzFjav2SfFVVR8p/RgIsa1edUZ4Uy1dCXiWoVnJj7tl/gXjY7ai+RJxcd+M6UZYxEwpAp5iSzzCchKhI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712140971; c=relaxed/simple; bh=QT7IGi6vS9P8M9vRUSvueUyuwCOIJiAhi3xVvotuTQg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JiO5nUqB0MTM5Im2DKq4oKGsTof75JD1Vag9hiLWrXw8f4RWDnhi7W44nU3ab6eHV6FSOnQoT+Tpzfyfv7i+3URGSBN+FAb7Rt5stsLgGsa2mhM9YwSTswig/X/h8+Uq7Bv1axcr4fV8rGA+wCxxYcsw4/K7nj42Smyku5ckNe8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=kSbUqnTG; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4337Dfde027522; Wed, 3 Apr 2024 10:42:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=tmLgm9Qq7srg8c2mrdhIjORjGo8nAKOj/ZnxTGPuYos=; b=kS bUqnTGO4folVWp3SidSB8ZXNR/00DUiGUt8sdB1U0FysZGUGi3n03nLDSY8IV2/6 dUZzFX45vtzGGHl3QKdpNR3W9X+MCLOmxOnZ2kEVmT8h8gsEyry/7L0WGBu8oe3R KDXjxfuFp/Jdb1tREztH65gFtHLPdpz5CqwyhbdXkaetmBn2RGd4lhh7dQhGz7p3 bR8dBXXylZfvSTcFmXfi88iZ8m6FbV5lMY0rtQEwg1OGEU3LS9e4LdxWAlH27Tkw Vaf50AwHdrryqTYcpyQbSpspBctH5lwDLB6ovEftswu8SqE6Qrdzt4WbBM8iTNV/ 5fSizS6SF/hc3NdiuN0w== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3x92hb0ea7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 03 Apr 2024 10:42:45 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 433AgjgQ027513 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 3 Apr 2024 10:42:45 GMT Received: from hu-varada-blr.qualcomm.com (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 3 Apr 2024 03:42:40 -0700 From: Varadarajan Narayanan To: , , , , , , , , , , , , , , , Subject: [PATCH v7 2/5] interconnect: icc-clk: Add devm_icc_clk_register Date: Wed, 3 Apr 2024 16:12:17 +0530 Message-ID: <20240403104220.1092431-3-quic_varada@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240403104220.1092431-1-quic_varada@quicinc.com> References: <20240403104220.1092431-1-quic_varada@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: z4_oS6p8iO8l-AOBZ7XDjxS3fytRTS1x X-Proofpoint-ORIG-GUID: z4_oS6p8iO8l-AOBZ7XDjxS3fytRTS1x X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-03_09,2024-04-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 mlxscore=0 clxscore=1015 adultscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403210001 definitions=main-2404030073 Wrap icc_clk_register to create devm_icc_clk_register to be able to release the resources properly. Signed-off-by: Varadarajan Narayanan --- v7: Simplify devm_icc_clk_register implementation as suggested in review v5: Introduced devm_icc_clk_register --- drivers/interconnect/icc-clk.c | 18 ++++++++++++++++++ include/linux/interconnect-clk.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/drivers/interconnect/icc-clk.c b/drivers/interconnect/icc-clk.c index d787f2ea36d9..bce946592c98 100644 --- a/drivers/interconnect/icc-clk.c +++ b/drivers/interconnect/icc-clk.c @@ -148,6 +148,24 @@ struct icc_provider *icc_clk_register(struct device *dev, } EXPORT_SYMBOL_GPL(icc_clk_register); +static void devm_icc_release(void *res) +{ + icc_clk_unregister(res); +} + +int devm_icc_clk_register(struct device *dev, unsigned int first_id, + unsigned int num_clocks, const struct icc_clk_data *data) +{ + struct icc_provider *prov; + + prov = icc_clk_register(dev, first_id, num_clocks, data); + if (IS_ERR(prov)) + return PTR_ERR(prov); + + return devm_add_action_or_reset(dev, devm_icc_release, prov); +} +EXPORT_SYMBOL_GPL(devm_icc_clk_register); + /** * icc_clk_unregister() - unregister a previously registered clk interconnect provider * @provider: provider returned by icc_clk_register() diff --git a/include/linux/interconnect-clk.h b/include/linux/interconnect-clk.h index 0cd80112bea5..5c611a8b0892 100644 --- a/include/linux/interconnect-clk.h +++ b/include/linux/interconnect-clk.h @@ -17,6 +17,8 @@ struct icc_provider *icc_clk_register(struct device *dev, unsigned int first_id, unsigned int num_clocks, const struct icc_clk_data *data); +int devm_icc_clk_register(struct device *dev, unsigned int first_id, + unsigned int num_clocks, const struct icc_clk_data *data); void icc_clk_unregister(struct icc_provider *provider); #endif -- 2.34.1