From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from service87.mimecast.com (service87.mimecast.com [91.220.42.44]) by ozlabs.org (Postfix) with ESMTP id 038582C0108 for ; Tue, 20 Aug 2013 19:30:15 +1000 (EST) From: Sudeep KarkadaNagesha To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH v4 07/19] of/device: add helper to get cpu device node from logical cpu index Date: Tue, 20 Aug 2013 10:30:09 +0100 Message-Id: <1376991021-12160-8-git-send-email-Sudeep.KarkadaNagesha@arm.com> In-Reply-To: <1376991021-12160-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> References: <1374492747-13879-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> <1376991021-12160-1-git-send-email-Sudeep.KarkadaNagesha@arm.com> Content-Type: text/plain; charset=WINDOWS-1252 Cc: Jonas Bonn , Michal Simek , Greg Kroah-Hartman , Sudeep KarkadaNagesha , Viresh Kumar , Rob Herring , "Rafael J. Wysocki" , Grant Likely List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sudeep KarkadaNagesha Multiple drivers need to get the cpu device node from the cpu logical index and then access the of_node. This patch adds helper function to fetch the device node directly. Acked-by: Rob Herring Signed-off-by: Sudeep KarkadaNagesha --- include/linux/of_device.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 9d27475..82ce324 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -1,6 +1,7 @@ #ifndef _LINUX_OF_DEVICE_H #define _LINUX_OF_DEVICE_H =20 +#include #include #include /* temporary until merge */ =20 @@ -43,6 +44,15 @@ static inline void of_device_node_put(struct device *dev= ) =09of_node_put(dev->of_node); } =20 +static inline struct device_node *of_cpu_device_node_get(int cpu) +{ +=09struct device *cpu_dev; +=09cpu_dev =3D get_cpu_device(cpu); +=09if (!cpu_dev) +=09=09return NULL; +=09return of_node_get(cpu_dev->of_node); +} + #else /* CONFIG_OF */ =20 static inline int of_driver_match_device(struct device *dev, @@ -67,6 +77,11 @@ static inline const struct of_device_id *of_match_device= ( { =09return NULL; } + +static inline struct device_node *of_cpu_device_node_get(int cpu) +{ +=09return NULL; +} #endif /* CONFIG_OF */ =20 #endif /* _LINUX_OF_DEVICE_H */ --=20 1.8.1.2