* [PATCH] acpi: Use NULL from <linux/stddef.h>
@ 2016-11-14 16:50 Bart Van Assche
2016-11-14 20:20 ` Rafael J. Wysocki
0 siblings, 1 reply; 7+ messages in thread
From: Bart Van Assche @ 2016-11-14 16:50 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi@vger.kernel.org
Use the definition of NULL from <linux/stddef.h> instead of
redefining NULL. Additionally, change (void *)NULL into NULL.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
---
include/acpi/actypes.h | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 1d798ab..f019641 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -44,6 +44,8 @@
#ifndef __ACTYPES_H__
#define __ACTYPES_H__
+#include <linux/stddef.h> /* NULL */
+
/* acpisrc:struct_defs -- for acpisrc conversion */
/*
@@ -437,10 +439,6 @@ typedef u64 acpi_physical_address;
#endif
#define TRUE (1 == 1)
-#ifndef NULL
-#define NULL (void *) 0
-#endif
-
/*
* Miscellaneous types
*/
@@ -530,9 +528,9 @@ typedef u64 acpi_integer;
/* Pointer/Integer type conversions */
-#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(acpi_size) i)
-#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL)
-#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) NULL)
+#define ACPI_TO_POINTER(i) ACPI_ADD_PTR(void, NULL, (acpi_size) i)
+#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF(p, NULL)
+#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF(&(((d *) 0)->f), NULL)
#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
--
2.10.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] acpi: Use NULL from <linux/stddef.h>
2016-11-14 16:50 [PATCH] acpi: Use NULL from <linux/stddef.h> Bart Van Assche
@ 2016-11-14 20:20 ` Rafael J. Wysocki
2016-11-16 17:08 ` Moore, Robert
0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2016-11-14 20:20 UTC (permalink / raw)
To: Bart Van Assche, Lv, Robert Moore
Cc: Rafael J. Wysocki, Len Brown, linux-acpi@vger.kernel.org
On Mon, Nov 14, 2016 at 5:50 PM, Bart Van Assche
<bart.vanassche@sandisk.com> wrote:
> Use the definition of NULL from <linux/stddef.h> instead of
> redefining NULL. Additionally, change (void *)NULL into NULL.
>
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Len Brown <lenb@kernel.org>
> Cc: linux-acpi@vger.kernel.org
> ---
> include/acpi/actypes.h | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
> index 1d798ab..f019641 100644
> --- a/include/acpi/actypes.h
> +++ b/include/acpi/actypes.h
> @@ -44,6 +44,8 @@
> #ifndef __ACTYPES_H__
> #define __ACTYPES_H__
>
> +#include <linux/stddef.h> /* NULL */
This is file is based on upstream ACPICA code and it should not
contain Linux-specific includes etc. as a rule.
> +
> /* acpisrc:struct_defs -- for acpisrc conversion */
>
> /*
> @@ -437,10 +439,6 @@ typedef u64 acpi_physical_address;
> #endif
> #define TRUE (1 == 1)
>
> -#ifndef NULL
> -#define NULL (void *) 0
> -#endif
> -
> /*
> * Miscellaneous types
> */
> @@ -530,9 +528,9 @@ typedef u64 acpi_integer;
>
> /* Pointer/Integer type conversions */
>
> -#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(acpi_size) i)
> -#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL)
> -#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) NULL)
> +#define ACPI_TO_POINTER(i) ACPI_ADD_PTR(void, NULL, (acpi_size) i)
> +#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF(p, NULL)
> +#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF(&(((d *) 0)->f), NULL)
> #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
> #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
Lv, Bob, can you have a look at this, please?
Thanks,
Rafael
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] acpi: Use NULL from <linux/stddef.h>
2016-11-14 20:20 ` Rafael J. Wysocki
@ 2016-11-16 17:08 ` Moore, Robert
2016-11-16 17:15 ` Bart Van Assche
0 siblings, 1 reply; 7+ messages in thread
From: Moore, Robert @ 2016-11-16 17:08 UTC (permalink / raw)
To: Rafael J. Wysocki, Bart Van Assche, Zheng, Lv
Cc: Rafael J. Wysocki, Len Brown, linux-acpi@vger.kernel.org
What is the point of these changes?
> -----Original Message-----
> From: rjwysocki@gmail.com [mailto:rjwysocki@gmail.com] On Behalf Of
> Rafael J. Wysocki
> Sent: Monday, November 14, 2016 12:21 PM
> To: Bart Van Assche <bart.vanassche@sandisk.com>; Zheng, Lv
> <lv.zheng@intel.com>; Moore, Robert <robert.moore@intel.com>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>; Len Brown <lenb@kernel.org>;
> linux-acpi@vger.kernel.org
> Subject: Re: [PATCH] acpi: Use NULL from <linux/stddef.h>
>
> On Mon, Nov 14, 2016 at 5:50 PM, Bart Van Assche
> <bart.vanassche@sandisk.com> wrote:
> > Use the definition of NULL from <linux/stddef.h> instead of redefining
> > NULL. Additionally, change (void *)NULL into NULL.
> >
> > Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> > Cc: Len Brown <lenb@kernel.org>
> > Cc: linux-acpi@vger.kernel.org
> > ---
> > include/acpi/actypes.h | 12 +++++-------
> > 1 file changed, 5 insertions(+), 7 deletions(-)
> >
> > diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index
> > 1d798ab..f019641 100644
> > --- a/include/acpi/actypes.h
> > +++ b/include/acpi/actypes.h
> > @@ -44,6 +44,8 @@
> > #ifndef __ACTYPES_H__
> > #define __ACTYPES_H__
> >
> > +#include <linux/stddef.h> /* NULL */
>
> This is file is based on upstream ACPICA code and it should not contain
> Linux-specific includes etc. as a rule.
>
> > +
> > /* acpisrc:struct_defs -- for acpisrc conversion */
> >
> > /*
> > @@ -437,10 +439,6 @@ typedef u64 acpi_physical_address; #endif
> > #define TRUE (1 == 1)
> >
> > -#ifndef NULL
> > -#define NULL (void *) 0
> > -#endif
> > -
> > /*
> > * Miscellaneous types
> > */
> > @@ -530,9 +528,9 @@ typedef u64 acpi_integer;
> >
> > /* Pointer/Integer type conversions */
> >
> > -#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *)
> NULL,(acpi_size) i)
> > -#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *)
> NULL)
> > -#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF (&(((d *) 0)-
> >f), (void *) NULL)
> > +#define ACPI_TO_POINTER(i) ACPI_ADD_PTR(void, NULL,
> (acpi_size) i)
> > +#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF(p, NULL)
> > +#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF(&(((d *) 0)-
> >f), NULL)
> > #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
> > #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
>
>
> Lv, Bob, can you have a look at this, please?
>
> Thanks,
> Rafael
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] acpi: Use NULL from <linux/stddef.h>
2016-11-16 17:08 ` Moore, Robert
@ 2016-11-16 17:15 ` Bart Van Assche
2016-11-17 5:54 ` Zheng, Lv
2016-11-18 2:05 ` Moore, Robert
0 siblings, 2 replies; 7+ messages in thread
From: Bart Van Assche @ 2016-11-16 17:15 UTC (permalink / raw)
To: Moore, Robert, Rafael J. Wysocki, Zheng, Lv
Cc: Rafael J. Wysocki, Len Brown, linux-acpi@vger.kernel.org
On 11/16/2016 09:08 AM, Moore, Robert wrote:
> What is the point of these changes?
What's the point of redefining NULL? What's the point of casting a void
pointer to void *?
Bart.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] acpi: Use NULL from <linux/stddef.h>
2016-11-16 17:15 ` Bart Van Assche
@ 2016-11-17 5:54 ` Zheng, Lv
2016-11-18 2:27 ` Moore, Robert
2016-11-18 2:05 ` Moore, Robert
1 sibling, 1 reply; 7+ messages in thread
From: Zheng, Lv @ 2016-11-17 5:54 UTC (permalink / raw)
To: Bart Van Assche, Moore, Robert, Rafael J. Wysocki
Cc: Rafael J. Wysocki, Len Brown, linux-acpi@vger.kernel.org
Hi,
> From: Bart Van Assche [mailto:bart.vanassche@sandisk.com]
> Subject: Re: [PATCH] acpi: Use NULL from <linux/stddef.h>
>
> On 11/16/2016 09:08 AM, Moore, Robert wrote:
> > What is the point of these changes?
>
> What's the point of redefining NULL? What's the point of casting a void
> pointer to void *?
Maybe you only need to put the following line into aclinux.h:
+#include <linux/stddef.h> /* NULL */
And leave ACPICA protection there:
#ifndef NULL
...
#endif
For changing (void *) NULL to NULL, sounds minor.
It can be there for other OSPMs.
Thanks
Lv
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] acpi: Use NULL from <linux/stddef.h>
2016-11-16 17:15 ` Bart Van Assche
2016-11-17 5:54 ` Zheng, Lv
@ 2016-11-18 2:05 ` Moore, Robert
1 sibling, 0 replies; 7+ messages in thread
From: Moore, Robert @ 2016-11-18 2:05 UTC (permalink / raw)
To: Bart Van Assche, Rafael J. Wysocki, Zheng, Lv
Cc: Rafael J. Wysocki, Len Brown, linux-acpi@vger.kernel.org
> -----Original Message-----
> From: Bart Van Assche [mailto:bart.vanassche@sandisk.com]
> Sent: Wednesday, November 16, 2016 9:15 AM
> To: Moore, Robert; Rafael J. Wysocki; Zheng, Lv
> Cc: Rafael J. Wysocki; Len Brown; linux-acpi@vger.kernel.org
> Subject: Re: [PATCH] acpi: Use NULL from <linux/stddef.h>
>
> On 11/16/2016 09:08 AM, Moore, Robert wrote:
> > What is the point of these changes?
>
> What's the point of redefining NULL? What's the point of casting a void
> pointer to void *?
>
We are often forced to do things like this to enable other operating systems to work with ACPICA.
> Bart.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH] acpi: Use NULL from <linux/stddef.h>
2016-11-17 5:54 ` Zheng, Lv
@ 2016-11-18 2:27 ` Moore, Robert
0 siblings, 0 replies; 7+ messages in thread
From: Moore, Robert @ 2016-11-18 2:27 UTC (permalink / raw)
To: Zheng, Lv, Bart Van Assche, Rafael J. Wysocki
Cc: Rafael J. Wysocki, Len Brown, linux-acpi@vger.kernel.org
If we don't absolutely need to make any changes (if it ain't broke), then we should not try to fix it.
Yes, there are some strange things in the ACPICA headers.
Making the ACPICA code compile with many different C compilers for many different operating systems has been an extremely challenging and difficult project.
Even the smallest change has the potential to cause problems elsewhere.
> -----Original Message-----
> From: Zheng, Lv
> Sent: Wednesday, November 16, 2016 9:55 PM
> To: Bart Van Assche; Moore, Robert; Rafael J. Wysocki
> Cc: Rafael J. Wysocki; Len Brown; linux-acpi@vger.kernel.org
> Subject: RE: [PATCH] acpi: Use NULL from <linux/stddef.h>
>
> Hi,
>
> > From: Bart Van Assche [mailto:bart.vanassche@sandisk.com]
> > Subject: Re: [PATCH] acpi: Use NULL from <linux/stddef.h>
> >
> > On 11/16/2016 09:08 AM, Moore, Robert wrote:
> > > What is the point of these changes?
> >
> > What's the point of redefining NULL? What's the point of casting a
> > void pointer to void *?
>
> Maybe you only need to put the following line into aclinux.h:
> +#include <linux/stddef.h> /* NULL */
>
> And leave ACPICA protection there:
>
> #ifndef NULL
> ...
> #endif
>
> For changing (void *) NULL to NULL, sounds minor.
> It can be there for other OSPMs.
>
> Thanks
> Lv
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-11-18 2:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-14 16:50 [PATCH] acpi: Use NULL from <linux/stddef.h> Bart Van Assche
2016-11-14 20:20 ` Rafael J. Wysocki
2016-11-16 17:08 ` Moore, Robert
2016-11-16 17:15 ` Bart Van Assche
2016-11-17 5:54 ` Zheng, Lv
2016-11-18 2:27 ` Moore, Robert
2016-11-18 2:05 ` Moore, Robert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).