From patchwork Mon Jul 15 10:22:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep KarkadaNagesha X-Patchwork-Id: 2827383 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C0CE4C0AB2 for ; Mon, 15 Jul 2013 10:28:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9D9E1201BC for ; Mon, 15 Jul 2013 10:28:32 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 039BB201B7 for ; Mon, 15 Jul 2013 10:28:31 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UyfxJ-0001Fu-A5; Mon, 15 Jul 2013 10:24:34 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UyfwX-0008HA-Ja; Mon, 15 Jul 2013 10:23:45 +0000 Received: from service87.mimecast.com ([91.220.42.44]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UyfvZ-00088O-Jy for linux-arm-kernel@lists.infradead.org; Mon, 15 Jul 2013 10:22:53 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 15 Jul 2013 11:22:21 +0100 Received: from e103737-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Mon, 15 Jul 2013 11:22:18 +0100 From: Sudeep.KarkadaNagesha@arm.com To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 01/11] driver/core: cpu: initialize of_node in cpu's device struture Date: Mon, 15 Jul 2013 11:22:02 +0100 Message-Id: <1373883732-26303-2-git-send-email-Sudeep.KarkadaNagesha@arm.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1373883732-26303-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> References: <1373883732-26303-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> X-OriginalArrivalTime: 15 Jul 2013 10:22:18.0331 (UTC) FILETIME=[2F1A6AB0:01CE8145] X-MC-Unique: 113071511222104101 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130715_062245_892582_D0771010 X-CRM114-Status: GOOD ( 10.38 ) X-Spam-Score: -2.6 (--) Cc: lorenzo.pieralisi@arm.com, linux@arm.linux.org.uk, arnd@arndb.de, Sudeep KarkadaNagesha , viresh.kumar@linaro.org, rob.herring@calxeda.com, rjw@sisk.pl, grant.likely@linaro.org, cpufreq@vger.kernel.org, kernel@pengutronix.de, gregkh@linuxfoundation.org, olof@lixom.net, gregory.clement@free-electrons.com, shawn.guo@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 properly needs to be initialized properly and at one place. The best place to update this is CPU subsystem driver when registering the cpu devices. This patch introduces a new function arch_of_get_cpu_node and uses it to assign of_node. The definition of this function can be overridden by architecture specific implementation. Signed-off-by: Sudeep KarkadaNagesha --- drivers/base/cpu.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index a16d20e..4b3047a 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -28,6 +28,24 @@ static int cpu_subsys_match(struct device *dev, struct device_driver *drv) return 0; } +/** + * arch_of_get_cpu_node - Get device node associated with the given logical CPU + * @cpu: CPU number(logical index) for which device node is required + * + * The only purpose of this function is to retrieve the device node for the + * given logical CPU index. It should be used to intialise the of_node in + * cpu device. Once of_node in cpu device is populated, all the further + * references can use that instead. + * + * CPU logical to physical index mapping is architecure specific and is built + * before booting secondary cores. Hence this function is marked __weak and + * can be overridden by architecture specific implementation. + */ +struct device_node * __weak arch_of_get_cpu_node(int cpu) +{ + return NULL; +} + #ifdef CONFIG_HOTPLUG_CPU static void change_cpu_under_node(struct cpu *cpu, unsigned int from_nid, unsigned int to_nid) @@ -289,6 +307,7 @@ int __cpuinit 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 = arch_of_get_cpu_node(num); #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE cpu->dev.bus->uevent = arch_cpu_uevent; #endif