mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Philipp Zabel <p.zabel@pengutronix.de>,
	Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Banajit Goswami <bgoswami@quicinc.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>, Peter Rosin <peda@axentia.se>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
	Chris Packham <chris.packham@alliedtelesis.co.nz>,
	Sean Anderson <sean.anderson@seco.com>
Subject: Re: [PATCH v3 2/5] reset: Instantiate reset GPIO controller for shared reset-gpios
Date: Mon, 22 Jan 2024 14:02:54 +0100	[thread overview]
Message-ID: <64f125e8-53c9-4a2d-9629-cb2011443d58@linaro.org> (raw)
In-Reply-To: <289c4af00bcc46e83555dacbc76f56477126d645.camel@pengutronix.de>

On 15/01/2024 18:32, Philipp Zabel wrote:
> On Mo, 2024-01-15 at 17:13 +0100, Krzysztof Kozlowski wrote:
>> On 15/01/2024 17:06, Bartosz Golaszewski wrote:
>>>> +
>>>> +static int __reset_add_reset_gpio_lookup(int id, struct device_node *np,
>>>> +                                        unsigned int gpio,
>>>> +                                        unsigned int of_flags)
>>>> +{
>>>> +       struct gpiod_lookup_table *lookup __free(kfree) = NULL;
>>>> +       struct gpio_device *gdev __free(gpio_device_put) = NULL;
>>>> +       char *label __free(kfree) = NULL;
>>>
>>> I got yelled at by Linus Torvalds personally for doing it like this. I
>>> know this is a common pattern in code using GLib but Linus wants auto
>>> variables to be initialized where they're declared...
>>
>> Declaration is here. Initialization is here. Therefore this is
>> initialized where it is declared. What's more it is initialized to a
>> valid value, because __free() accepts NULLs.
> [...]
>>> ... so this should become:
>>>
>>>   struct gpio_device *gdev __free(gpio_device_put) = gpio_device_find(...)
>>>
>>> and same for the rest.
>>>
>>> Don't get me wrong, I love cleanup.h but there's a (unofficial for
>>> now) coding style.
>>
>> So you just want to declare it not in top-part of the function but just
>> before first use?
> 
> IIUC, Linus wants exactly this:
> 
> https://lore.kernel.org/all/CAHk-=wgRHiV5VSxtfXA4S6aLUmcQYEuB67u3BJPJPtuESs1JyA@mail.gmail.com/

Sure.



Best regards,
Krzysztof


  reply	other threads:[~2024-01-22 13:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12 16:36 [PATCH v3 0/5] reset: gpio: ASoC: shared GPIO resets Krzysztof Kozlowski
2024-01-12 16:36 ` [PATCH v3 1/5] reset: gpio: Add GPIO-based reset controller Krzysztof Kozlowski
2024-01-15 14:44   ` Bartosz Golaszewski
2024-01-12 16:36 ` [PATCH v3 2/5] reset: Instantiate reset GPIO controller for shared reset-gpios Krzysztof Kozlowski
2024-01-15 16:06   ` Bartosz Golaszewski
2024-01-15 16:13     ` Krzysztof Kozlowski
2024-01-15 17:32       ` Philipp Zabel
2024-01-22 13:02         ` Krzysztof Kozlowski [this message]
2024-01-15 16:55   ` Philipp Zabel
2024-01-22 13:11     ` Krzysztof Kozlowski
2024-01-17 11:26   ` Philipp Zabel
2024-01-22 13:14     ` Krzysztof Kozlowski
2024-01-12 16:36 ` [PATCH v3 3/5] ASoC: dt-bindings: qcom,wsa8840: Add reset-gpios for shared line Krzysztof Kozlowski
2024-01-16 18:27   ` Rob Herring
2024-01-12 16:36 ` [PATCH v3 4/5] ASoC: codecs: wsa884x: Allow sharing reset GPIO Krzysztof Kozlowski
2024-01-12 16:36 ` [PATCH v3 5/5] i2c: muxes: pca954x: " Krzysztof Kozlowski
2024-01-16 15:18   ` Philipp Zabel
2024-01-16 19:58     ` Chris Packham
2024-01-17 11:16       ` Philipp Zabel
2024-01-17 19:56         ` Chris Packham

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=64f125e8-53c9-4a2d-9629-cb2011443d58@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=andersson@kernel.org \
    --cc=bgoswami@quicinc.com \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=peda@axentia.se \
    --cc=perex@perex.cz \
    --cc=robh+dt@kernel.org \
    --cc=sean.anderson@seco.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tiwai@suse.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

all inboxes | Powered by JetHome®