From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH 1/6] rtc: generic: allow building on all architectures Date: Wed, 02 Mar 2016 10:05:18 +0100 Message-ID: <1620536.OtjnSSLgCT@wuerfel> References: <1456851608-3374907-1-git-send-email-arnd@arndb.de> <1456851608-3374907-2-git-send-email-arnd@arndb.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: Alessandro Zummo , Parisc List , RTCLINUX , Linux-sh list , "linux-kernel@vger.kernel.org" , Kyle McMartin , linux-m68k , Alexandre Belloni , "linuxppc-dev@lists.ozlabs.org" , "linux-arm-kernel@lists.infradead.org" To: Geert Uytterhoeven Return-path: In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org On Wednesday 02 March 2016 09:57:27 Geert Uytterhoeven wrote: > > @@ -33,13 +35,21 @@ static const struct rtc_class_ops generic_rtc_ops = { > > .read_time = generic_get_time, > > .set_time = generic_set_time, > > }; > > +#else > > +#define generic_rtc_ops *(struct rtc_class_ops*)NULL > > +#endif > > > > static int __init generic_rtc_probe(struct platform_device *dev) > > { > > struct rtc_device *rtc; > > + const struct rtc_class_ops *ops; > > + > > + ops = dev_get_platdata(&dev->dev); > > + if (!ops) > > + ops = &generic_rtc_ops; > > I hope no compiler version treats "&*(struct rtc_class_ops*)NULL" as > undefined behavior? It's a bit odd, but I think it's syntactically correct C, and not much too different from #define offsetof(TYPE, MEMBER) ((size_t)&((TYPE *)0)->MEMBER) is it? My last patch gets rid of it again. Arnd