Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752933AbbBRBEG (ORCPT ); Tue, 17 Feb 2015 20:04:06 -0500 Received: from mail-wg0-f48.google.com ([74.125.82.48]:58644 "EHLO mail-wg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751768AbbBRBEE (ORCPT ); Tue, 17 Feb 2015 20:04:04 -0500 MIME-Version: 1.0 In-Reply-To: <1424059148.21410.37.camel@kernel.crashing.org> References: <1424059148.21410.37.camel@kernel.crashing.org> From: Rob Herring Date: Tue, 17 Feb 2015 19:03:41 -0600 Message-ID: Subject: Re: [PATCH 1/2] device: Add dev_of_node() accessor To: Benjamin Herrenschmidt , Greg Kroah-Hartman Cc: Grant Likely , Olof Johansson , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Arnd Bergmann Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1364 Lines: 48 +Greg KH On Sun, Feb 15, 2015 at 9:59 PM, Benjamin Herrenschmidt wrote: > Suggested by Arnd Bergmann, this gives a practical accessor for > the of_node field of struct device while instructing the compiler > that it will be NULL if CONFIG_OF is not set. > > Signed-off-by: Benjamin Herrenschmidt > --- I'll let Greg take this with the other patch: Acked-by: Rob Herring > > This is what we discussed back in November and I had forgotten > to finish :) > > include/linux/device.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/include/linux/device.h b/include/linux/device.h > index fb50673..08128288 100644 > --- a/include/linux/device.h > +++ b/include/linux/device.h > @@ -916,6 +916,13 @@ static inline void device_lock_assert(struct device *dev) > lockdep_assert_held(&dev->mutex); > } > > +static inline struct device_node *dev_of_node(struct device *dev) > +{ > + if (!IS_ENABLED(CONFIG_OF)) > + return NULL; > + return dev->of_node; > +} > + > void driver_init(void); > > /* > > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/