alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Frank Rowand <frowand.list@gmail.com>
To: Adam, Adam.Thomson.Opensource@diasemi.com,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Jaroslav Kysela <perex@perex.cz>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>,
	Rob Herring <rob.herring@linaro.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Support Opensource <Support.Opensource@diasemi.com>,
	Hanjun Guo <hanjun.guo@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Takashi Iwai <tiwai@suse.com>,
	Robert Moore <robert.moore@intel.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	Mark Brown <broonie@kernel.org>, Lv Zheng <lv.zheng@intel.com>,
	Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"devel@acpica.org" <devel@acpica.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Len Brown <lenb@kernel.org>
Subject: Re: [RESEND PATCH v2 1/2] device property: Add function to search for named child of device
Date: Mon, 13 Jun 2016 12:32:32 -0700	[thread overview]
Message-ID: <575F0A50.1090107@gmail.com> (raw)
In-Reply-To: <2E89032DDAA8B9408CB92943514A0337D46421B6@SW-EX-MBX01.diasemi.com>

Hi Adam,

(comment below and adding Rob to the cc:)

On 06/10/16 02:58, Opensource [Adam Thomson] wrote:
> On 10 June 2016 00:11, Rafael J. Wysocki wrote:
> 
>> For some reason that didn't make it into the linux-acpi list, or at
>> least I can't see it there.
> 
> That's strange. I'm not a subscriber to that mailing list, but I assume that
> shouldn't matter here? Strangely though the only mailing list these seem to have
> made it to is the ALSA one. :( Will see if I can find out why as I've not
> seen this problem before.
> 
>>> + * device_get_named_child_node - Return first matching named child node
>> handle
>>> + * @dev: Device to find the named child node for.
>>> + * @childname: String to match child node name against.
>>> + */
>>> +struct fwnode_handle *device_get_named_child_node(struct device *dev,
>>> +						  const char *childname)
>>> +{
>>> +	struct fwnode_handle *child;
>>> +
>>> +	/*
>>> +	 * Find first matching named child node of this device.
>>> +	 * For ACPI this will be a data only sub-node.
>>> +	 */
>>> +	device_for_each_child_node(dev, child) {
>>> +		if (is_of_node(child)) {
>>> +			if (!strcasecmp(to_of_node(child)->name, childname))
>>
>> Why do you use strcasecmp() here?
> 
> DT node names are case insensitive. The of.h header does provide a helper macro
> which is equivalent to this, but that macro is part of the '#ifdef CONFIG_OF'
> block. If I were to use it then it would cause non-DT builds to fail. I opted
> for strcasecmp() directly as I didn't think for just this one scenario it made
> sense to reorganise the of.h header with regards to the helper macros. Of course
> if there are other opinions on this then am happy to listen.

DT node names are not always case insensitive.  Please us of_node_cmp().

-Frank

> 
>>> +static inline bool acpi_data_node_match(struct fwnode_handle *fwnode,
>>> +					const char *name)
>>> +{
>>> +	return is_acpi_data_node(fwnode) ?
>>> +		(!strcasecmp(to_acpi_data_node(fwnode)->name, name)) : false;
>>> +}
>>
>> Is there any particular reason to introduce this function instead of
>> doing the test in device_get_named_child_node() directly?
> 
> Again this is a build related design option (I mention it in the patch
> description). In a non-DT build there is no access to the acpi_data_node struct
> (returned by to_acpi_data_node() call) so if we call this in that scenario then
> the build will fail. I could have added some #ifdefs to the
> device_get_named_child_node() function directly, but that would have been a bit
> messy I think. To me it made more sense to have this helper function which can
> be called regardless of build type, and for non-ACPI builds its definition
> always returns false.
> 

  parent reply	other threads:[~2016-06-13 19:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-01 18:06 [PATCH v2 0/2] ASoC: da7219: Convert driver to use generic FW functions Adam Thomson
2016-06-01 18:06 ` [PATCH v2 1/2] device property: Add function to search for named child of device Adam Thomson
2016-06-09 23:11   ` [RESEND PATCH " Rafael J. Wysocki
2016-06-10  9:58     ` Opensource [Adam Thomson]
2016-06-13  8:47       ` Mark Brown
2016-06-13 12:16         ` Opensource [Adam Thomson]
2016-06-13 19:32       ` Frank Rowand [this message]
2016-06-14  8:39         ` Opensource [Adam Thomson]
2016-06-01 18:06 ` [PATCH v3 2/2] ASoC: da7219: Convert driver to use generic device/fwnode functions Adam Thomson

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=575F0A50.1090107@gmail.com \
    --to=frowand.list@gmail.com \
    --cc=Adam.Thomson.Opensource@diasemi.com \
    --cc=Support.Opensource@diasemi.com \
    --cc=Suravee.Suthikulpanit@amd.com \
    --cc=akpm@linux-foundation.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=broonie@kernel.org \
    --cc=devel@acpica.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hanjun.guo@linaro.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=perex@perex.cz \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rob.herring@linaro.org \
    --cc=robert.moore@intel.com \
    --cc=sathyanarayana.nujella@intel.com \
    --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;
as well as URLs for NNTP newsgroup(s).