From: "Jean-François Lessard" <jefflessard3@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Andy Shevchenko <andy@kernel.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org,
devicetree@vger.kernel.org,
Paolo Sabatino <paolo.sabatino@gmail.com>,
Christian Hewitt <christianshewitt@gmail.com>,
Boris Gjenero <boris.gjenero@gmail.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Subject: Re: [PATCH v4 3/6] auxdisplay: Add TM16xx 7-segment LED matrix display controllers driver
Date: Wed, 27 Aug 2025 14:37:47 -0400 [thread overview]
Message-ID: <49F7228C-0EE6-4202-A2AF-A023B4A4DE4B@gmail.com> (raw)
In-Reply-To: <3E7CE725-4C10-41C9-9B44-58E7EC6B5F4F@gmail.com>
Le 25 août 2025 13 h 48 min 45 s HAE, "Jean-François Lessard" <jefflessard3@gmail.com> a écrit :
>Le 25 août 2025 11 h 14 min 21 s HAE, Andy Shevchenko <andriy.shevchenko@intel.com> a écrit :
>>On Sun, Aug 24, 2025 at 11:32:29PM -0400, Jean-François Lessard wrote:
...
>>> + fwnode_for_each_child_node(digits_node, child)
>>> + display->num_digits++;
>>
>>Don't we have a _count API for this?
>>
>
>I'll use device_get_child_node_count() instead of manual counting loops.
>
>>> + dev_dbg(dev, "Number of digits: %u\n", display->num_digits);
>>> +
>>> + if (display->num_digits) {
>>> + display->digits = devm_kcalloc(dev, display->num_digits,
>>> + sizeof(*display->digits),
>>> + GFP_KERNEL);
>>> + if (!display->digits) {
>>
>>> + fwnode_handle_put(digits_node);
>>
>>Use RAII instead, we have defined __free() method for this.
>>
>>> + return -ENOMEM;
>>> + }
>>> +
>>> + i = 0;
>>> + fwnode_for_each_child_node(digits_node, child) {
>>
>>Ditto. Use _scoped variant.
>>
>
>Well received.
>
After further investigation, _scoped variant exists for
device_for_each_child_node_scoped() but not for fwnode_for_each_child_node().
I suggest to include an additional patch in next submission to add to
include/linux/property.h:
#define fwnode_for_each_child_node_scoped(fwnode, child) \
for (struct fwnode_handle *child __free(fwnode_handle) = \
fwnode_get_next_child_node(fwnode, NULL); \
child; child = fwnode_get_next_child_node(fwnode, child))
#define fwnode_for_each_named_child_node_scoped(fwnode, child, name) \
fwnode_for_each_child_node_scoped(fwnode, child) \
for_each_if(fwnode_name_eq(child, name))
#define fwnode_for_each_available_child_node_scoped(fwnode, child) \
for (struct fwnode_handle *child __free(fwnode_handle) = \
fwnode_get_next_available_child_node(fwnode, NULL); \
child; child = fwnode_get_next_available_child_node(fwnode, child))
...
next prev parent reply other threads:[~2025-08-27 18:37 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 3:32 [PATCH v4 0/6] auxdisplay: Add TM16xx 7-segment LED matrix display controllers driver Jean-François Lessard
2025-08-25 3:32 ` [PATCH v4 1/6] dt-bindings: vendor-prefixes: Add fdhisi, titanmec, princeton, winrise, wxicore Jean-François Lessard
2025-08-25 13:53 ` Andy Shevchenko
2025-08-26 2:57 ` Jean-François Lessard
2025-08-25 3:32 ` [PATCH v4 2/6] dt-bindings: auxdisplay: add Titan Micro Electronics TM16xx Jean-François Lessard
2025-08-25 18:26 ` Rob Herring
2025-08-26 1:33 ` Jean-François Lessard
2025-08-26 14:37 ` Jean-François Lessard
2025-08-29 15:26 ` Rob Herring
2025-08-29 16:26 ` Jean-François Lessard
2025-08-25 19:08 ` Per Larsson
2025-08-26 1:53 ` Jean-François Lessard
2025-08-25 3:32 ` [PATCH v4 3/6] auxdisplay: Add TM16xx 7-segment LED matrix display controllers driver Jean-François Lessard
2025-08-25 15:14 ` Andy Shevchenko
2025-08-25 17:48 ` Jean-François Lessard
2025-08-26 15:22 ` Andy Shevchenko
2025-08-26 20:44 ` Jean-François Lessard
2025-08-27 18:37 ` Jean-François Lessard [this message]
2025-09-01 6:04 ` Andy Shevchenko
2025-08-25 3:32 ` [PATCH v4 4/6] auxdisplay: TM16xx: Add keypad support for scanning matrix keys Jean-François Lessard
2025-08-25 3:32 ` [PATCH v4 5/6] auxdisplay: TM16xx: Add support for I2C-based controllers Jean-François Lessard
2025-08-25 15:18 ` Andy Shevchenko
2025-08-26 4:01 ` Jean-François Lessard
2025-08-26 15:30 ` Andy Shevchenko
2025-08-26 17:38 ` Jean-François Lessard
2025-08-26 18:26 ` Andy Shevchenko
2025-08-26 20:21 ` Jean-François Lessard
2025-08-25 3:32 ` [PATCH v4 6/6] auxdisplay: TM16xx: Add support for SPI-based controllers Jean-François Lessard
2025-08-25 15:19 ` Andy Shevchenko
2025-08-26 4:04 ` Jean-François Lessard
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=49F7228C-0EE6-4202-A2AF-A023B4A4DE4B@gmail.com \
--to=jefflessard3@gmail.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=boris.gjenero@gmail.com \
--cc=christianshewitt@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=geert@linux-m68k.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=paolo.sabatino@gmail.com \
--cc=robh@kernel.org \
/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).