From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tomasz Figa Subject: Re: [PATCH v3 03/16] driver/core: cpu: initialize of_node in cpu's device struture Date: Thu, 15 Aug 2013 13:35:37 +0200 Message-ID: <1804645.BcbkbcfKAA@flatron> References: <1374069984-20567-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> <1374492747-13879-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> <1374492747-13879-4-git-send-email-Sudeep.KarkadaNagesha@arm.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1593743.3tsGmby197"; micalg="pgp-sha1"; protocol="application/pgp-signature" Return-path: In-Reply-To: <1374492747-13879-4-git-send-email-Sudeep.KarkadaNagesha@arm.com> Sender: cpufreq-owner@vger.kernel.org To: linux-arm-kernel@lists.infradead.org Cc: Sudeep KarkadaNagesha , linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, Lorenzo Pieralisi , Russell King , Arnd Bergmann , Sudeep KarkadaNagesha , Viresh Kumar , Olof Johansson , Rob Herring , "Rafael J. Wysocki" , Grant Likely , Greg Kroah-Hartman , Gregory Clement , Shawn Guo List-Id: linux-pm@vger.kernel.org --nextPart1593743.3tsGmby197 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi Sudeep, On Monday 22 of July 2013 12:32:14 Sudeep KarkadaNagesha wrote: > From: Sudeep KarkadaNagesha > > CPUs are also registered as devices but the of_node in these cpu > devices are not initialized. Currently different drivers requiring > to access cpu device node are parsing the nodes themselves and > initialising the of_node in cpu device. > > The of_node in all the cpu devices needs to be initialized properly > and at one place. The best place to update this is CPU subsystem > driver when registering the cpu devices. > > The OF/DT core library now provides of_get_cpu_node to retrieve a cpu > device node for a given logical index by abstracting the architecture > specific details. > > This patch uses of_get_cpu_node to assign of_node when registering the > cpu devices. > > Cc: Greg Kroah-Hartman > Acked-by: Rob Herring > Signed-off-by: Sudeep KarkadaNagesha > --- > drivers/base/cpu.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c > index 4c358bc..ea51c6d 100644 > --- a/drivers/base/cpu.c > +++ b/drivers/base/cpu.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > > #include "base.h" > > @@ -289,6 +290,7 @@ int register_cpu(struct cpu *cpu, int num) > cpu->dev.release = cpu_device_release; > cpu->dev.offline_disabled = !cpu->hotpluggable; > cpu->dev.offline = !cpu_online(num); > + cpu->dev.of_node = of_get_cpu_node(num); Aha, so this would be the only place where of_get_cpu_node() gets called, so the parsing would be done only once and then any code that needs CPU DT node would just simply grab it from CPU dev. Fair enough. Not sure if this makes the need for such helper to be globally available in of/base.c, but I guess this won't hurt. Best regards, Tomasz --nextPart1593743.3tsGmby197 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iQIcBAABAgAGBQJSDL0MAAoJEIv3Hb8G/XruHhQQAMwrPrJW7AHY2OW8wcNywxUg g/HucVy/LwayRHvrMeNY4knEDqw+eK3Hv3pyhuvbaIUnbol/ZxDvG430L0LRRni/ XWf4/IvWdxLc3LEVMlYZssJJzUV5odnLcXP1ate1i0LShWj2Atf9H1QmnTJlVMmx OZTwaznLZlOFr1A0/3lrSxUhsbjIJKkesg3kOCS4nYOigE2oxakWQEJiWAErYG21 9dh/E7ptP2tdATuu2jAn6dhfmT6t8mTMSP+I0qb3Iq3ht6HxqN2nNkflBtpMzCBH 52SpV4gJd18PxJd7qRNRqPLf8pwRuIttiqOCCPfINCW1qAXp+71MJn9e4STyhYTS pPQhXXe4SVDaBpNju/M4WKZqPpJ0iBaPI8LwkLsaED+W8Pqsv/5VjoggBYG5q3x0 kJ0MYw1tQHiZjw3FgbdGQHLCm/M1pWM8pglMfZex5bgQem85FM0ke3U1I1kE+P/J D/S66R8ea/w+NMXdxxzIxasMPFwv3/Z9XokDVRnz4OJJW90dg2/unngKsIgWuabJ pKtx6aX0jW2491cBRmqrwG627iomcvGVlLhg0xH/iZlkGVJlYEqSa6olUO/wXXbe 8UKHudVMU+VRRZHbNCMC6je+ZE8gbscEUqwdhAdLmuqPPmtgiMkbQHxMnZA1ye+8 J8pVzM0274H6tN14syA3 =ZBux -----END PGP SIGNATURE----- --nextPart1593743.3tsGmby197--