Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1347867

Re: [PATCH 1/6] rtc: generic: allow building on all architectures

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH 1/6] rtc: generic: allow building on all architectures
Date 2016-03-02 10:10 +0100
Message-ID <r8aX8-5yy-13@gated-at.bofh.it> (permalink)
References <r7VY6-3zV-17@gated-at.bofh.it> <r7VY6-3zV-33@gated-at.bofh.it> <r8aNs-5fM-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/6] rtc: generic: allow building on all architectures Arnd Bergmann <arnd@arndb.de> - 2016-03-01 18:10 +0100
  Re: [PATCH 1/6] rtc: generic: allow building on all architectures Geert Uytterhoeven <geert@linux-m68k.org> - 2016-03-02 10:00 +0100
    Re: [PATCH 1/6] rtc: generic: allow building on all architectures Arnd Bergmann <arnd@arndb.de> - 2016-03-02 10:10 +0100
    Re: [PATCH 1/6] rtc: generic: allow building on all architectures Andreas Schwab <schwab@linux-m68k.org> - 2016-03-02 10:30 +0100
      Re: [PATCH 1/6] rtc: generic: allow building on all architectures Geert Uytterhoeven <geert@linux-m68k.org> - 2016-03-02 10:40 +0100

csiph-web