From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Lee Jones <lee.jones@linaro.org>,
Darren Hart <dvhart@linux.intel.com>,
Jarkko Nikula <jarkko.nikula@linux.intel.com>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ACPI: Use ACPI companion to match only the first physical device
Date: Fri, 24 Oct 2014 17:10:51 +0300 [thread overview]
Message-ID: <20141024141051.GT1484@lahna.fi.intel.com> (raw)
In-Reply-To: <1442328.iYt6Cj5IOV@vostro.rjw.lan>
On Fri, Oct 24, 2014 at 04:20:41PM +0200, Rafael J. Wysocki wrote:
> > +static bool acpi_companion_match(const struct device *dev)
> > +{
> > + struct acpi_device *adev;
> > + bool ret;
> > +
> > + adev = ACPI_COMPANION(dev);
> > + if (!adev)
> > + return false;
> > +
> > + if (list_empty(&adev->pnp.ids))
> > + return false;
> > +
> > + ret = true;
>
> On a second thought, should we return true if the list of physical devices is
> empty? That surely means ACPI_COMPANION(dev) lied to us?
I didn't consider that it is even possible but yes, in that case we
should not return true here.
>
> > + mutex_lock(&adev->physical_node_lock);
> > + if (!list_empty(&adev->physical_node_list)) {
> > + const struct acpi_device_physical_node *node;
> > +
> > + node = list_first_entry(&adev->physical_node_list,
> > + struct acpi_device_physical_node, node);
> > + if (node->dev != dev)
> > + ret = false;
>
> And that may be simply
>
> ret = node->dev == dev;
OK.
> > + }
> > + mutex_unlock(&adev->physical_node_lock);
> > +
> > + return ret;
> > +}
> > +
next prev parent reply other threads:[~2014-10-24 14:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1414141950-228930-1-git-send-email-mika.westerberg@linux.intel.com>
2014-10-24 10:08 ` [PATCH] ACPI: Use ACPI companion to match only the first physical device Jarkko Nikula
2014-10-24 13:55 ` Rafael J. Wysocki
2014-10-24 13:50 ` Mika Westerberg
2014-10-24 14:20 ` Rafael J. Wysocki
2014-10-24 14:10 ` Mika Westerberg [this message]
2014-10-24 14:57 ` Rafael J. Wysocki
2014-10-24 18:16 ` Mika Westerberg
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=20141024141051.GT1484@lahna.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=dvhart@linux.intel.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=lee.jones@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/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