All of lore.kernel.org
 help / color / mirror / Atom feed
From: 'Manivannan Sadhasivam' <manivannan.sadhasivam@linaro.org>
To: Shradha Todi <shradha.t@samsung.com>
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
Date: Wed, 24 Jan 2024 14:13:13 +0530	[thread overview]
Message-ID: <20240124084313.GD4906@thinkpad> (raw)
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 <manivannan.sadhasivam@linaro.org>
> > Sent: 20 January 2024 20:33
> > To: Shradha Todi <shradha.t@samsung.com>
> > 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 <m.szyprowski@samsung.com>
> > > Signed-off-by: Shradha Todi <shradha.t@samsung.com>
> > > ---
> > >  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

-- 
மணிவண்ணன் சதாசிவம்

WARNING: multiple messages have this Message-ID (diff)
From: 'Manivannan Sadhasivam' <manivannan.sadhasivam@linaro.org>
To: Shradha Todi <shradha.t@samsung.com>
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
Date: Wed, 24 Jan 2024 14:13:13 +0530	[thread overview]
Message-ID: <20240124084313.GD4906@thinkpad> (raw)
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 <manivannan.sadhasivam@linaro.org>
> > Sent: 20 January 2024 20:33
> > To: Shradha Todi <shradha.t@samsung.com>
> > 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 <m.szyprowski@samsung.com>
> > > Signed-off-by: Shradha Todi <shradha.t@samsung.com>
> > > ---
> > >  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

-- 
மணிவண்ணன் சதாசிவம்

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-01-24  8:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240110110143epcas5p2692ec3cbabfdaf2c3387b5a98f072943@epcas5p2.samsung.com>
2024-01-10 11:01 ` [PATCH v3 0/2] Add helper function to get and enable all bulk clocks Shradha Todi
2024-01-10 11:01   ` Shradha Todi
2024-01-10 11:01   ` [PATCH v3 1/2] clk: Provide managed helper to get and enable " Shradha Todi
2024-01-10 11:01     ` Shradha Todi
2024-01-10 12:31     ` Alim Akhtar
2024-01-10 12:31       ` Alim Akhtar
2024-01-24  6:39       ` Shradha Todi
2024-01-24  6:39         ` Shradha Todi
2024-01-20 15:03     ` Manivannan Sadhasivam
2024-01-20 15:03       ` Manivannan Sadhasivam
2024-01-24  6:53       ` Shradha Todi
2024-01-24  6:53         ` Shradha Todi
2024-01-24  8:43         ` 'Manivannan Sadhasivam' [this message]
2024-01-24  8:43           ` 'Manivannan Sadhasivam'
2024-01-10 11:01   ` [PATCH v3 2/2] PCI: exynos: Adapt to clk_bulk_* APIs Shradha Todi
2024-01-10 11:01     ` Shradha Todi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240124084313.GD4906@thinkpad \
    --to=manivannan.sadhasivam@linaro.org \
    --cc=alim.akhtar@samsung.com \
    --cc=bhelgaas@google.com \
    --cc=jingoohan1@gmail.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lpieralisi@kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mturquette@baylibre.com \
    --cc=pankaj.dubey@samsung.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=shradha.t@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.