From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Daniel Scally <djrscally@gmail.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Hugo Villeneuve <hvilleneuve@dimonoff.com>,
Nuno Sa <nuno.sa@analog.com>,
David Lechner <dlechner@baylibre.com>,
Javier Carrasco <javier.carrasco.cruz@gmail.com>,
Guillaume Stols <gstols@baylibre.com>,
Olivier Moysan <olivier.moysan@foss.st.com>,
Dumitru Ceclan <mitrutzceclan@gmail.com>,
Trevor Gamblin <tgamblin@baylibre.com>,
Matteo Martelli <matteomartelli3@gmail.com>,
Alisa-Dariana Roman <alisadariana@gmail.com>,
Ramona Alexandra Nechita <ramona.nechita@analog.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-renesas-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev
Subject: Re: [PATCH v4 02/10] property: Add device_get_child_node_count_named()
Date: Thu, 27 Feb 2025 17:05:53 +0200 [thread overview]
Message-ID: <c9424f3e-1ff0-4c01-823a-19801cc3e7a7@gmail.com> (raw)
In-Reply-To: <Z8B7h4_IWz43gFhO@smile.fi.intel.com>
On 27/02/2025 16:49, Andy Shevchenko wrote:
> On Thu, Feb 27, 2025 at 10:01:49AM +0200, Matti Vaittinen wrote:
>> On 26/02/2025 16:11, Andy Shevchenko wrote:
>>> On Wed, Feb 26, 2025 at 04:04:02PM +0200, Matti Vaittinen wrote:
>>>> On 25/02/2025 15:59, Andy Shevchenko wrote:
>>>>> On Tue, Feb 25, 2025 at 03:29:17PM +0200, Matti Vaittinen wrote:
>>>>>> On 25/02/2025 12:39, Andy Shevchenko wrote:
>>>>>>> On Tue, Feb 25, 2025 at 12:29:31PM +0200, Matti Vaittinen wrote:
>>>>>>>> On 25/02/2025 12:21, Andy Shevchenko wrote:
>>>>>>>>> On Tue, Feb 25, 2025 at 11:40:16AM +0200, Heikki Krogerus wrote:
>
> ...
>
>>>>>>>>>>
>>>>>>>>>> I did not check how many users are you proposing for this, but if
>>>>>>>>>> there's only one, then IMO this should not be a global function yet.
>>>>>>>>>> It just feels to special case to me. But let's see what the others
>>>>>>>>>> think.
>>>>>>>>>
>>>>>>>>> The problem is that if somebody hides it, we might potentially see
>>>>>>>>> a duplication in the future. So I _slightly_ prefer to publish and
>>>>>>>>> then drop that after a few cycles if no users appear.
>>>>>>>>
>>>>>>>> After taking a very quick grep I spotted one other existing place where we
>>>>>>>> might be able to do direct conversion to use this function.
>>>>>>>>
>>>>>>>> drivers/net/ethernet/freescale/gianfar.c
>>>>>>>>
>>>>>>>> That'd be 2 users.
>>>>>>>
>>>>>>> I haven't checked myself, I believe your judgement,
>>>>>>
>>>>>> I took a better look and you obviously shouldn't believe :) The gianfar used
>>>>>> of_node instead of the fwnode. So, it'd be a single caller at starters.
>>>>>
>>>>> ...which is the same as dev_of_node(), which means that you can use your
>>>>> function there.
>>>>
>>>> I'm unsure what you mean. The proposed function
>>>> device_get_child_node_count_named() takes device pointer. I don't see how
>>>> dev_of_node() helps converting node to device?
>>>
>>> dev_of_node() takes the device pointer and dev_fwnode() takes that as well,
>>> it means that there is no difference which one to use OF-centric or fwnode
>>
>> The proposed device_get_child_node_count_named() takes a device pointer. I
>> don't see how dev_of_node() helps if there is just of_node and no device
>> pointer available in the calling code.
>
> ???
>
> The loops are working on
>
> struct device_node *np = pdev->dev.np;
>
> which is the equivalent to
>
> struct device_node *np = dev_of_node(&pdev->dev);
>
> which takes device pointer.
>
>> (Well, as I wrote below, I could
>> alter the gianfar code by dropping the gfar_of_group_count(), so that I have
>> the device pointer in caller). Anyways, I don't see how dev_of_node() should
>> help unless you're proposing I add a of_get_child_node_count_named() or
>> somesuch - which I don't think makes sense.
>
> Are you forbidding yourself to change the function prototype to take a device
> pointer instead of device_node one? :-)
>
This is our point of misunderstanding. As I wrote, and as you can see
from the prototype, the function _is_ taking the device pointer. Hence I
didn't understand how dev_of_node() should help us.
>>> API in this particular case. Just make sure that the function (and there
>>> is also a second loop AFAICS) takes struct device *dev instead of struct
>>> device_node *np as a parameter.
>>
>> I think I lost the track here :)
>
> Make gfar_of_group_count() to take device pointer. As simple as that.
that'd just make the gfar_of_group_count() a wrapper of the
of_get_child_node_count_named(). I prefer killing whole
gfar_of_group_count().
Yours,
-- Matti
next prev parent reply other threads:[~2025-02-27 15:05 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 18:32 [PATCH v4 00/10] Support ROHM BD79124 ADC Matti Vaittinen
2025-02-24 18:32 ` [PATCH v4 01/10] dt-bindings: ROHM BD79124 ADC/GPO Matti Vaittinen
2025-02-24 18:32 ` [PATCH v4 02/10] property: Add device_get_child_node_count_named() Matti Vaittinen
2025-02-25 9:40 ` Heikki Krogerus
2025-02-25 10:07 ` Matti Vaittinen
2025-02-25 10:21 ` Andy Shevchenko
2025-02-25 10:29 ` Matti Vaittinen
2025-02-25 10:39 ` Andy Shevchenko
2025-02-25 10:52 ` Matti Vaittinen
2025-02-25 13:29 ` Matti Vaittinen
2025-02-25 13:59 ` Andy Shevchenko
2025-02-26 14:04 ` Matti Vaittinen
2025-02-26 14:11 ` Andy Shevchenko
2025-02-27 8:01 ` Matti Vaittinen
2025-02-27 14:49 ` Andy Shevchenko
2025-02-27 15:05 ` Matti Vaittinen [this message]
2025-02-28 16:59 ` Rob Herring
2025-03-02 12:21 ` Matti Vaittinen
2025-02-25 10:56 ` Matti Vaittinen
2025-02-28 17:07 ` Rob Herring
2025-02-28 18:51 ` Andy Shevchenko
2025-03-02 12:22 ` Matti Vaittinen
2025-02-24 18:33 ` [PATCH v4 03/10] iio: adc: add helpers for parsing ADC nodes Matti Vaittinen
2025-02-26 0:26 ` David Lechner
2025-02-26 6:28 ` Matti Vaittinen
2025-02-26 16:10 ` David Lechner
2025-02-27 7:46 ` Matti Vaittinen
2025-03-02 3:20 ` Jonathan Cameron
2025-03-02 12:54 ` Matti Vaittinen
2025-03-04 23:59 ` Jonathan Cameron
2025-03-02 3:35 ` Jonathan Cameron
2025-03-02 13:00 ` Matti Vaittinen
2025-03-02 3:48 ` Jonathan Cameron
2025-03-02 13:01 ` Matti Vaittinen
2025-02-24 18:33 ` [PATCH v4 04/10] iio: adc: rzg2l_adc: Use adc-helpers Matti Vaittinen
2025-03-02 3:40 ` Jonathan Cameron
2025-03-02 13:06 ` Matti Vaittinen
2025-02-24 18:33 ` [PATCH v4 05/10] iio: adc: sun20i-gpadc: " Matti Vaittinen
2025-03-02 3:42 ` Jonathan Cameron
2025-02-24 18:34 ` [PATCH v4 06/10] iio: adc: ti-ads7924 Drop unnecessary function parameters Matti Vaittinen
2025-03-02 3:46 ` Jonathan Cameron
2025-03-03 7:33 ` Matti Vaittinen
2025-02-24 18:34 ` [PATCH v4 07/10] iio: adc: ti-ads7924: Respect device tree config Matti Vaittinen
2025-02-26 0:09 ` David Lechner
2025-02-26 6:39 ` Matti Vaittinen
2025-03-02 3:27 ` Jonathan Cameron
2025-03-02 13:10 ` Matti Vaittinen
2025-03-03 14:57 ` Hugo Villeneuve
2025-02-24 18:34 ` [PATCH v4 08/10] iio: adc: Support ROHM BD79124 ADC Matti Vaittinen
2025-03-02 4:10 ` Jonathan Cameron
2025-03-02 13:15 ` Matti Vaittinen
2025-02-24 18:34 ` [PATCH v4 09/10] MAINTAINERS: Add IIO ADC helpers Matti Vaittinen
2025-02-24 18:34 ` [PATCH v4 10/10] MAINTAINERS: Add ROHM BD79124 ADC/GPO Matti Vaittinen
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=c9424f3e-1ff0-4c01-823a-19801cc3e7a7@gmail.com \
--to=mazziesaccount@gmail.com \
--cc=alisadariana@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor+dt@kernel.org \
--cc=dakr@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=djrscally@gmail.com \
--cc=dlechner@baylibre.com \
--cc=gregkh@linuxfoundation.org \
--cc=gstols@baylibre.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=hvilleneuve@dimonoff.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=jernej.skrabec@gmail.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=matteomartelli3@gmail.com \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=mitrutzceclan@gmail.com \
--cc=nuno.sa@analog.com \
--cc=olivier.moysan@foss.st.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=rafael@kernel.org \
--cc=ramona.nechita@analog.com \
--cc=robh@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=samuel@sholland.org \
--cc=tgamblin@baylibre.com \
--cc=wens@csie.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