linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Shradha Todi <shradha.t@samsung.com>,
	'Manivannan Sadhasivam' <manivannan.sadhasivam@linaro.org>,
	sboyd@kernel.org, mturquette@baylibre.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, 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,
	pankaj.dubey@samsung.com
Subject: Re: [PATCH v4 1/2] clk: Provide managed helper to get and enable bulk clocks
Date: Mon, 5 Feb 2024 10:19:16 +0100	[thread overview]
Message-ID: <8e336720-ce08-4391-ad36-b83fea246cab@samsung.com> (raw)
In-Reply-To: <08a901da55cf$4ee48000$ecad8000$@samsung.com>

On 02.02.2024 12:59, Shradha Todi wrote:
>> -----Original Message-----
>> From: Manivannan Sadhasivam<manivannan.sadhasivam@linaro.org>
>> Sent: 29 January 2024 12:25
>> To: Shradha Todi<shradha.t@samsung.com>
>> Subject: Re: [PATCH v4 1/2] clk: Provide managed helper to get and enable bulk
>> clocks
>>
>> On Wed, Jan 24, 2024 at 04:08:37PM +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 | 40
>> ++++++++++++++++++++++++++++++++++++++++
>>>   include/linux/clk.h      | 24 ++++++++++++++++++++++++
>>>   2 files changed, 64 insertions(+)
>>>
>>> diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c index
>>> 4fb4fd4b06bd..cbbd2cc339c3 100644
>>> --- a/drivers/clk/clk-devres.c
>>> +++ b/drivers/clk/clk-devres.c
>>> @@ -182,6 +182,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_enable(struct device *dev, void
>>> +*res) {
>>> +	struct clk_bulk_devres *devres = res;
>>> +
>>> +	clk_bulk_disable_unprepare(devres->num_clks, devres->clks);
>>> +	clk_bulk_put_all(devres->num_clks, devres->clks); }
>>> +
>>> +int __must_check devm_clk_bulk_get_all_enable(struct device *dev,
>>> +					      struct clk_bulk_data **clks) {
>>> +	struct clk_bulk_devres *devres;
>>> +	int ret;
>>> +
>>> +	devres = devres_alloc(devm_clk_bulk_release_all_enable,
>>> +			      sizeof(*devres), GFP_KERNEL);
>>> +	if (!devres)
>>> +		return -ENOMEM;
>>> +
>>> +	ret = clk_bulk_get_all(dev, &devres->clks);
>>> +	if (ret > 0) {
>>> +		*clks = devres->clks;
>>> +		devres->num_clks = ret;
>>> +	} else {
>>> +		devres_free(devres);
>>> +		return ret;
>>> +	}
>> How about:
>>
>> 	ret = clk_bulk_get_all(dev, &devres->clks);
>> 	if (ret <= 0) {
>> 		devres_free(devres);
>> 		return ret;
>> 	}
>>
>> 	*clks = devres->clks;
>> 	devres->num_clks = ret;
>>
>> Even though this patch follows the pattern used by the rest of the APIs in the
>> driver, IMO above makes it more readable.
>>
> Since I have usually seen that maintainers suggest to maintain the coding style of the file, I followed the same.
> If you have a stronger reason to change this, please let me know
> Marek, Michael, Stephen please let us know what do you think about this?

I suggest to keep the same style as is used in the modified file (if it 
doesn't conflict with the rules enforced by checkpatch and kernel's 
coding style).

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


  reply	other threads:[~2024-02-05  9:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240124103850epcas5p48fcb1e92172efd246b8292a294740dd1@epcas5p4.samsung.com>
2024-01-24 10:38 ` [PATCH v4 0/2] Add helper function to get and enable all bulk clocks Shradha Todi
     [not found]   ` <CGME20240124103855epcas5p27400bd95df42f36b9547a4e28aa26f5d@epcas5p2.samsung.com>
2024-01-24 10:38     ` [PATCH v4 1/2] clk: Provide managed helper to get and enable " Shradha Todi
2024-01-29  6:54       ` Manivannan Sadhasivam
2024-02-02 11:59         ` Shradha Todi
2024-02-05  9:19           ` Marek Szyprowski [this message]
2024-01-31  5:04       ` Alim Akhtar
     [not found]   ` <CGME20240124103858epcas5p3d96cdbe8a6c8f31ccc934025411a09b8@epcas5p3.samsung.com>
2024-01-24 10:38     ` [PATCH v4 2/2] PCI: exynos: Adapt to clk_bulk_* APIs Shradha Todi
2024-01-29  6:58       ` Manivannan Sadhasivam
2024-01-31  5:05       ` Alim Akhtar

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=8e336720-ce08-4391-ad36-b83fea246cab@samsung.com \
    --to=m.szyprowski@samsung.com \
    --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=manivannan.sadhasivam@linaro.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).