[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1620536.OtjnSSLgCT@wuerfel>
Date: Wed, 02 Mar 2016 10:05:18 +0100
From: Arnd Bergmann <arnd@...db.de>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
Kyle McMartin <kyle@...artin.ca>,
RTCLINUX <rtc-linux@...glegroups.com>,
Alessandro Zummo <a.zummo@...ertech.it>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
Linux-sh list <linux-sh@...r.kernel.org>,
Parisc List <linux-parisc@...r.kernel.org>,
linux-m68k <linux-m68k@...ts.linux-m68k.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/6] rtc: generic: allow building on all architectures
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
Powered by blists - more mailing lists