Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp982783rdb; Wed, 24 Jan 2024 00:43:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8zq6DUtfl/U7tPBW72BXNnnRMRCK4gIK5+6uASoyFy+vNSbnt4QkXXDaFdxUdhTBSFDCp X-Received: by 2002:a05:6808:16ac:b0:3bd:6eaf:6f67 with SMTP id bb44-20020a05680816ac00b003bd6eaf6f67mr1320865oib.113.1706085814851; Wed, 24 Jan 2024 00:43:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706085814; cv=pass; d=google.com; s=arc-20160816; b=dbyu6E2eoBi2OxcLZE0UVllkDXAamoS2Hf1cs7kd79pMgv45sPf8zTS/Dy6RRHd3xj xwaNDJGPln1h4/0lhMUL6z+MoZlwqba/Jywd78ROzKfsRZpQWJoczw5Yajp4NHmEHe2s Qr0axfBZvy9WipV2Yq5T13ho4cPgM/KDspNdESVyoK1aUCRfG2a3bbhH338HH67XKTLV PXx+/oDam003AJqGJi8SzaE+k66e/FwGGSK1kytpA49YGS6HCKPcgp0nQlxo2eVt9w93 C16/wDum5FuE0RTzhUCJ4IpHle3p9oHXwmViqpo1dwxf+D/O5UPrQUIeDEoFSj/dfTfI y+Fw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5F77cepD96Xl+KWE10eagNpd7WlTaV/PHMJWTPQtzTE=; fh=oOG7v0ZB76hplAJLzWvdyr9gKLSPB0UPTujDOKkibPA=; b=K77FZHaHSOGAHny2/uiV/ilWaEZSrOTxJyzV5EYIrYlfAQzLMRacHQC8YUZEv5yUm3 vSlyBiBo72AjR2bi6mxgjkVYEZxRdrzwDSj+mTf08EkVMNhK7fj72N+RCF2wk8Bs+Jmk TfgTyA8bMXxjGASzAg8OnfX5KL8Ie/Po3hN7b5Lg26QUwXhK3zDvb940I05Ny4+PGG2K nC79q7OFSOu+WTDIGEF0R7DLWMbwNL7SOBaWLaD1IQLPpOP/WvWL9HhIIyUfYLd8+Nht fweu54CVXkPDoHpPiuwKrlIqIFFAB6VC8ez6Qot1J5W8RK5k6TyuaBUC+7Lciyqa7Q6i 37Pg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t5rB2M5+; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-36652-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36652-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a27-20020a05620a125b00b0077f5759e06bsi9588382qkl.781.2024.01.24.00.43.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 00:43:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36652-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t5rB2M5+; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-36652-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36652-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8A7DE1C21A28 for ; Wed, 24 Jan 2024 08:43:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C1EB17993; Wed, 24 Jan 2024 08:43:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="t5rB2M5+" Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5CE017980 for ; Wed, 24 Jan 2024 08:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706085807; cv=none; b=FUGPz+sz8eYRw7GeQ5v9DhUdSXwYqUwL47XTZJmwzp33cjKIaV8V6f4NjlyY11cmzvViCklItyBrOfT1R5SzNayU4RnWRcaHMlwkVGhZGgvw32SaUOtlB+Sl7nb/suEp6STBIcHu3+DXCCNgbHdKuiIEtOMNqcoQa2Wal0MGf3k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706085807; c=relaxed/simple; bh=a5+Y4PK8Tvf+sigWvxT2Oizf/v8oqo1GVxi7PwImtVY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SjWn/+NwWzXawKZ77LqrYcISWMGTIFkdyFph4oWqK1hEjwVkvH1AkXTppZTOGSonljN5WinakYPfzLJaZI2eT/2jq8LdlY5uh9Zvedm/O8easQctWXmi1CnLRuK4BmIvosC5+JtWhCdtaFHsXJwfaGScGbHpQ8pvtEbwH77gtno= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=t5rB2M5+; arc=none smtp.client-ip=209.85.167.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-3bd6581bca0so3306392b6e.0 for ; Wed, 24 Jan 2024 00:43:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706085804; x=1706690604; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=5F77cepD96Xl+KWE10eagNpd7WlTaV/PHMJWTPQtzTE=; b=t5rB2M5+MAajF2aV9uQKCMpPhUIeDzUSKVnfCNkSHl/CL1QkZJiTOo1juuU6mFlSMA pv1MwOhTUEc0Aop8nlSlEcz3dCt+qRhDkzZONQ8LcgwjQRdFtelJWPKb+l/NutDdspIc 6DM7FjDTmNrjrxtrPm5tR04FzonWwrCuhgaovkR8huepuM6LZ4e/wY2KSQNlwBSCEnUt z9N/u6MYNNSHIv63ippwl0nd4QvnQE2VkxQQqxtSurerPLwLu+csuVCxfPcXLX22aaRE Prmstzb7hAB+WRhsmj8ivh/ylHiDBIsOPLLzrpUjoSAWN2X3cI2swI1qV29vLPCTj+4f T0vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706085804; x=1706690604; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5F77cepD96Xl+KWE10eagNpd7WlTaV/PHMJWTPQtzTE=; b=SwvDN1GAjaRQb6U9QNbGper2XmnQ9qtCMfU+GvsDR24H1gZVSI31YNyezYxalBmK3z I6PywG+D6xlY5+W6m5A1aKfLCbP0M92PR7FxfhcY2cRv+rIa+Iz9qkkLJRRLDicgRRjA F1KN+6LDaaS6fW53whEQ3i9juuNJQqt9fzEvUhTbPhc1CZnRyLUMTSw/+dZt/a5+JOM+ dkR+VWcoilZNFpmJF72jR9AdS38dtabNX8ghN2Ppj8KukICTHc3Vr4xBkAFX1wx6okFi /mHk0imuSygDxJkaJglcl8uvp/I7GaI+pbXgiccY8IzJhY5+JfFVdxrqMOHP/LARdOoM n2jw== X-Gm-Message-State: AOJu0Yxk+ZKoBnxDnEkx6Br+3tQbPGinQ9beMx11YyQ2/eyDI9LxVaDe jVoPuJudeFCtfS10uRrBxFttsESIYo73fHuLU4szrCjriCJnyO3qTkPL0KkZGg== X-Received: by 2002:a05:6808:11c9:b0:3bd:9ff7:6051 with SMTP id p9-20020a05680811c900b003bd9ff76051mr1163124oiv.72.1706085804661; Wed, 24 Jan 2024 00:43:24 -0800 (PST) Received: from thinkpad ([117.217.189.109]) by smtp.gmail.com with ESMTPSA id s36-20020a056a0017a400b006dd89752e8asm1067422pfg.22.2024.01.24.00.43.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 00:43:24 -0800 (PST) Date: Wed, 24 Jan 2024 14:13:13 +0530 From: 'Manivannan Sadhasivam' To: Shradha Todi Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, mturquette@baylibre.com, sboyd@kernel.org, jingoohan1@gmail.com, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, bhelgaas@google.com, krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com, linux@armlinux.org.uk, m.szyprowski@samsung.com, pankaj.dubey@samsung.com Subject: Re: [PATCH v3 1/2] clk: Provide managed helper to get and enable bulk clocks Message-ID: <20240124084313.GD4906@thinkpad> References: <20240110110115.56270-1-shradha.t@samsung.com> <20240110110115.56270-2-shradha.t@samsung.com> <20240120150303.GB5405@thinkpad> <05ea01da4e92$0357d310$0a077930$@samsung.com> 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 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <05ea01da4e92$0357d310$0a077930$@samsung.com> On Wed, Jan 24, 2024 at 12:23:15PM +0530, Shradha Todi wrote: > > > > -----Original Message----- > > From: Manivannan Sadhasivam > > Sent: 20 January 2024 20:33 > > To: Shradha Todi > > Cc: linux-clk@vger.kernel.org; linux-kernel@vger.kernel.org; linux- > > pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-samsung- > > soc@vger.kernel.org; mturquette@baylibre.com; sboyd@kernel.org; > > jingoohan1@gmail.com; lpieralisi@kernel.org; kw@linux.com; robh@kernel.org; > > bhelgaas@google.com; krzysztof.kozlowski@linaro.org; > > alim.akhtar@samsung.com; linux@armlinux.org.uk; > > m.szyprowski@samsung.com > > Subject: Re: [PATCH v3 1/2] clk: Provide managed helper to get and enable bulk > > clocks > > > > On Wed, Jan 10, 2024 at 04:31:14PM +0530, Shradha Todi wrote: > > > Provide a managed devm_clk_bulk* wrapper to get and enable all bulk > > > clocks in order to simplify drivers that keeps all clocks enabled for > > > the time of driver operation. > > > > > > Suggested-by: Marek Szyprowski > > > Signed-off-by: Shradha Todi > > > --- > > > drivers/clk/clk-devres.c | 41 > > ++++++++++++++++++++++++++++++++++++++++ > > > include/linux/clk.h | 25 ++++++++++++++++++++++++ > > > 2 files changed, 66 insertions(+) > > > > > > diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c index > > > 4fb4fd4b06bd..05b0ff4bc1d4 100644 > > > --- a/drivers/clk/clk-devres.c > > > +++ b/drivers/clk/clk-devres.c > > > @@ -102,6 +102,7 @@ > > EXPORT_SYMBOL_GPL(devm_clk_get_optional_enabled); > > > struct clk_bulk_devres { > > > struct clk_bulk_data *clks; > > > int num_clks; > > > + void (*exit)(int num_clks, const struct clk_bulk_data *clks); > > > }; > > > > > > static void devm_clk_bulk_release(struct device *dev, void *res) @@ > > > -182,6 +183,46 @@ int __must_check devm_clk_bulk_get_all(struct device > > > *dev, } EXPORT_SYMBOL_GPL(devm_clk_bulk_get_all); > > > > > > +static void devm_clk_bulk_release_all_enabled(struct device *dev, > > > +void *res) { > > > + struct clk_bulk_devres *devres = res; > > > + > > > + if (devres->exit) > > > + devres->exit(devres->num_clks, devres->clks); > > > + > > > + clk_bulk_put_all(devres->num_clks, devres->clks); } > > > + > > > +int __must_check devm_clk_bulk_get_all_enabled(struct device *dev, > > > + struct clk_bulk_data **clks, int *num_clks) > > > > What is the user supposed to do with "num_clks" when you are already handling > > the enable part? > > > > Since the initial clk_bulk_get_all was returning the num_clks value, the thought was to maintain this > as the user might want to have a check in their driver whether x number of clocks were successfully > retrieved and enabled. > IIUC, the returned clock count is only used for enabling or disabling the clocks later. Since you are already handling it inside this API, I do not see a necessity to return the count. - Mani -- மணிவண்ணன் சதாசிவம்