From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJBF9-0003Zr-DL for qemu-devel@nongnu.org; Tue, 12 Jan 2016 21:33:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJBEr-0007Z8-1J for qemu-devel@nongnu.org; Tue, 12 Jan 2016 21:33:03 -0500 Date: Wed, 13 Jan 2016 10:07:32 +1100 From: David Gibson Message-ID: <20160112230732.GY22925@voom.redhat.com> References: <1452093205-30167-1-git-send-email-eric.auger@linaro.org> <1452093205-30167-4-git-send-email-eric.auger@linaro.org> <20160111023853.GB22925@voom.redhat.com> <56938586.5050503@linaro.org> <20160112042856.GQ22925@voom.redhat.com> <56953188.3040805@linaro.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NJ3GtppTlf/130kA" Content-Disposition: inline In-Reply-To: <56953188.3040805@linaro.org> Subject: Re: [Qemu-devel] [PATCH v2 3/7] device_tree: introduce qemu_fdt_node_path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Auger Cc: b.reynal@virtualopensystems.com, peter.maydell@linaro.org, thuth@redhat.com, eric.auger@st.com, patches@linaro.org, crosthwaitepeter@gmail.com, qemu-devel@nongnu.org, alex.williamson@redhat.com, qemu-arm@nongnu.org, suravee.suthikulpanit@amd.com, pbonzini@redhat.com, thomas.lendacky@amd.com, alex.bennee@linaro.org, christoffer.dall@linaro.org --NJ3GtppTlf/130kA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 12, 2016 at 06:02:00PM +0100, Eric Auger wrote: > Hi David, > On 01/12/2016 05:28 AM, David Gibson wrote: > > On Mon, Jan 11, 2016 at 11:35:50AM +0100, Eric Auger wrote: > >> Hi David, > >> On 01/11/2016 03:38 AM, David Gibson wrote: > >>> On Wed, Jan 06, 2016 at 03:13:21PM +0000, Eric Auger wrote: > >>>> This new helper routine returns the node path of a device > >>>> referred to by its node name and compat string. > >>> > >>> What if there are multiple nodes matching the name and compat? > >> The function would return the first one. I can improve the doc comment. > >> Do you think it is a problem stopping at the first one? Is it a real > >> life test case I have to handle here? > >=20 > > Well, I don't know of a specific system which will have this, but it's > > absolutely possible to get this situation: e.g. two different PCI > > busses, both of which have their own slot 0 populated with different > > instances of the same device. > >=20 > > Whether it's possible for platform devices will depend on the > > platform's specific bus toplogies, but you certainly can't rule it out > > in general. > OK I will handle that case then. I hope I will be able to test it. One case where this might occur in practice for platform devices is if you have a system built with multiple instances of a SoC. A peripheral on SoC 0 is likely to have the same name and compatible as the same peripheral on Soc 1, just inside a different parent node. > > I could consider adding a new libfdt function like > > fdt_node_offset_by_compatible() that searches by name as well. It's > > just I'm not sure that matching by name and compatible isn't a sign of > > a poor approach in the caller. > well I can't really comment. That looked the most straightforward to me > given the current libfdt API. But not sure it's worth to invest in a new > function in libfdt >=20 > Thanks! >=20 > Eric > >=20 >=20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --NJ3GtppTlf/130kA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWlYc0AAoJEGw4ysog2bOS3x0QALkseNGWT/rjfma0VHG4Ifew Tm4g5U+JT9oBT0M6RLNeEuZNC0xp7c7Oib1k/adRbKN+mWoKIffeXS+SMQaMRfVi dXWx4ekl5Pysj0AYRXcXfuX5+qJa7JUYiVvXCaxQoen2YSscf0pDK8s7PsZ0tVWL zW4JwSa/9ZqOs9urh2rI121LKpGNluJO2hTOUQQTilypfgwuFGBiqDFWp45j2UuV OiMShZzaeJBIDUsXFoVCLGufIKNz/bMQZs3GitzQMNcjXZ76gWMJ7kJPR3Ipp5rH X8iS0iKf3Q5/Do4Hx1fZSnu99d0xJA67+O84Zcl6WmK86g2PgEPO4LIwsj8bn86k KBy+GDgR8Z5OPb+Sk/aM1rRz1UOrahj7pTfsggjwTHaP5/Eaw1rqCyNOluJen8us 9P9NQIr49Ukf3tzPXZFJn2GnBZFtivGjzJEyh0m3nip5zgavxVxqgxtezzS1HpQE xPlxJa4e3egtf1LnvKHjnEA55iooBjBVwzX8C3SrnAALAIKw+HVkTz3iuxgfTWZU Y/Ak0ANe+rpp7SrzgASS0lWQFxgwhhWq4uqsccA/UaXZwCW4EpzJOy5SCRYKdbns y9M5Bg1zHmpxb1/oUP4VJYxwIV+YEhZ2+GWpmXDU7QXu9pz8uitnwq2WdWdfXETp +su50FZBJE5A2c+7w/DK =5H1e -----END PGP SIGNATURE----- --NJ3GtppTlf/130kA--