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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de. [217.72.192.73]) by gmr-mx.google.com with ESMTPS id w128si112740wmd.0.2016.03.02.01.05.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Mar 2016 01:05:26 -0800 (PST) From: Arnd Bergmann To: Geert Uytterhoeven Cc: Alexandre Belloni , "linux-arm-kernel@lists.infradead.org" , Kyle McMartin , RTCLINUX , Alessandro Zummo , "linuxppc-dev@lists.ozlabs.org" , Linux-sh list , Parisc List , linux-m68k , "linux-kernel@vger.kernel.org" Subject: [rtc-linux] 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> In-Reply-To: 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=UTF-8 Reply-To: rtc-linux@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , 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 -- -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Date: Wed, 02 Mar 2016 09:05:18 +0000 Subject: Re: [PATCH 1/6] rtc: generic: allow building on all architectures Message-Id: <1620536.OtjnSSLgCT@wuerfel> List-Id: References: <1456851608-3374907-1-git-send-email-arnd@arndb.de> <1456851608-3374907-2-git-send-email-arnd@arndb.de> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-arm-kernel@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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.73]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 1C1DE1A0BA9 for ; Wed, 2 Mar 2016 20:06:12 +1100 (AEDT) From: Arnd Bergmann To: Geert Uytterhoeven Cc: Alexandre Belloni , "linux-arm-kernel@lists.infradead.org" , Kyle McMartin , RTCLINUX , Alessandro Zummo , "linuxppc-dev@lists.ozlabs.org" , Linux-sh list , Parisc List , linux-m68k , "linux-kernel@vger.kernel.org" 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> In-Reply-To: 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" List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Wed, 02 Mar 2016 10:05:18 +0100 Subject: [PATCH 1/6] rtc: generic: allow building on all architectures In-Reply-To: References: <1456851608-3374907-1-git-send-email-arnd@arndb.de> <1456851608-3374907-2-git-send-email-arnd@arndb.de> Message-ID: <1620536.OtjnSSLgCT@wuerfel> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754256AbcCBJGV (ORCPT ); Wed, 2 Mar 2016 04:06:21 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:56460 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753416AbcCBJGF (ORCPT ); Wed, 2 Mar 2016 04:06:05 -0500 From: Arnd Bergmann To: Geert Uytterhoeven Cc: Alexandre Belloni , "linux-arm-kernel@lists.infradead.org" , Kyle McMartin , RTCLINUX , Alessandro Zummo , "linuxppc-dev@lists.ozlabs.org" , Linux-sh list , Parisc List , linux-m68k , "linux-kernel@vger.kernel.org" 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> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <1456851608-3374907-1-git-send-email-arnd@arndb.de> <1456851608-3374907-2-git-send-email-arnd@arndb.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:of3NxZWSdf9LSuKmjrteQirvXyDuQsXTses1t18z8UoKSbW+eI7 LEyDKaSvVgotbpNEruzoyWKsBDM6ht35Tjkn+mxyYdvSr2WjoxDcwSKeGhPECzfujYc/Y0L 1WeKi0zaALNePLiKavP1+yRLakZ+q5CqQnFgC9MNukg99lXjGvCj41jfOiRessxRADs2svc YHRo2/AAQw4Sbowna3DKA== X-UI-Out-Filterresults: notjunk:1;V01:K0:BXMOME6xkgA=:BUOEs1lNzYpPcf7Q08LVBG RfGy2myakPvdrL+ulo42CUwMlgtRKtRhq4Iii4H7YeVU0CpgbKzb1Gjg4hX0dNEuMat8D/xQX XrlRM+xYdtQKDlDZcBOlm4r/zCf+i5LARNdAqw4/NcK7BdBr4kQ/Igd3C4Wt5XIowX6taSYCm aENOq7QqJTom0p8mDkKJtUzSa48TWgp1HsqPYeOzOZOqcZb3QFq53RSiI3YcECaYnf6pyOQkG mjwVi+mOGSdorK/dV1TEH/Qbooh9OzD8xC5dr4rHk3Od9NgLtpylf9Qunf6KTUtDuFvpAP2Ev jA1XLSt9E0IEgVK6DmCHmVN+Cxk7Vlgfyq8MSQ7yifLM0iv27IaK0j2iNJ+g/L0ptaj0mZ57K qQYuhqlDsJCQbhdkCFkv36ik/yO3RcMRWkH5pxvDcJBW0t7SJKM0Pd9bWM07l3rsAdvMZHboS 7M8q8MHOH6IVLit8yVHOrRXlR1Qtp2CDIbRp5+85sMC+WUAe42ijegYZ+v5QiQ17s/zADxh3N di+r2YwXQwpoWTV1HoY8LyILruNjkBgS/hnQxWOZicv/8w5HGKykZZLrQ6+luD+P5TiBPiLeJ oEmb4LvrMoj6VN4/8r3Ns35a3t6WXRWASGLuqU5wL2aM7Kvwgk9EikmJ0DuRGz9awQ3HKIfpo geshCE3oo8/m+Qz5RZ9HrpZPDnl4S+jkKQs+45qTteLvyXbN68y+dEUzUUwa03ztfhRCTLutt LiCA1HaRoZ0LGGN1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.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