linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] powerpc/prom_init: Move custom isspace() to its own namespace
@ 2021-05-10 14:49 Andy Shevchenko
  2021-06-07 17:12 ` Andy Shevchenko
  2021-06-18  3:51 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2021-05-10 14:49 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev, linux-kernel
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Andy Shevchenko,
	kernel test robot

If by some reason any of the headers will include ctype.h
we will have a name collision. Avoid this by moving isspace()
to the dedicate namespace.

First appearance of the code is in the commit cf68787b68a2
("powerpc/prom_init: Evaluate mem kernel parameter for early allocation").

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/powerpc/kernel/prom_init.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 41ed7e33d897..6845cbbc0cd4 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -701,13 +701,13 @@ static int __init prom_setprop(phandle node, const char *nodename,
 }
 
 /* We can't use the standard versions because of relocation headaches. */
-#define isxdigit(c)	(('0' <= (c) && (c) <= '9') \
-			 || ('a' <= (c) && (c) <= 'f') \
-			 || ('A' <= (c) && (c) <= 'F'))
+#define prom_isxdigit(c)	(('0' <= (c) && (c) <= '9') \
+				 || ('a' <= (c) && (c) <= 'f') \
+				 || ('A' <= (c) && (c) <= 'F'))
 
-#define isdigit(c)	('0' <= (c) && (c) <= '9')
-#define islower(c)	('a' <= (c) && (c) <= 'z')
-#define toupper(c)	(islower(c) ? ((c) - 'a' + 'A') : (c))
+#define prom_isdigit(c)		('0' <= (c) && (c) <= '9')
+#define prom_islower(c)		('a' <= (c) && (c) <= 'z')
+#define prom_toupper(c)		(prom_islower(c) ? ((c) - 'a' + 'A') : (c))
 
 static unsigned long prom_strtoul(const char *cp, const char **endp)
 {
@@ -716,14 +716,14 @@ static unsigned long prom_strtoul(const char *cp, const char **endp)
 	if (*cp == '0') {
 		base = 8;
 		cp++;
-		if (toupper(*cp) == 'X') {
+		if (prom_toupper(*cp) == 'X') {
 			cp++;
 			base = 16;
 		}
 	}
 
-	while (isxdigit(*cp) &&
-	       (value = isdigit(*cp) ? *cp - '0' : toupper(*cp) - 'A' + 10) < base) {
+	while (prom_isxdigit(*cp) &&
+	       (value = prom_isdigit(*cp) ? *cp - '0' : prom_toupper(*cp) - 'A' + 10) < base) {
 		result = result * base + value;
 		cp++;
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] powerpc/prom_init: Move custom isspace() to its own namespace
  2021-05-10 14:49 [PATCH v1 1/1] powerpc/prom_init: Move custom isspace() to its own namespace Andy Shevchenko
@ 2021-06-07 17:12 ` Andy Shevchenko
  2021-06-09  7:00   ` Michael Ellerman
  2021-06-18  3:51 ` Michael Ellerman
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2021-06-07 17:12 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev, linux-kernel
  Cc: Benjamin Herrenschmidt, Paul Mackerras, kernel test robot

On Mon, May 10, 2021 at 05:49:25PM +0300, Andy Shevchenko wrote:
> If by some reason any of the headers will include ctype.h
> we will have a name collision. Avoid this by moving isspace()
> to the dedicate namespace.
> 
> First appearance of the code is in the commit cf68787b68a2
> ("powerpc/prom_init: Evaluate mem kernel parameter for early allocation").

Any comments on this?

> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  arch/powerpc/kernel/prom_init.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index 41ed7e33d897..6845cbbc0cd4 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -701,13 +701,13 @@ static int __init prom_setprop(phandle node, const char *nodename,
>  }
>  
>  /* We can't use the standard versions because of relocation headaches. */
> -#define isxdigit(c)	(('0' <= (c) && (c) <= '9') \
> -			 || ('a' <= (c) && (c) <= 'f') \
> -			 || ('A' <= (c) && (c) <= 'F'))
> +#define prom_isxdigit(c)	(('0' <= (c) && (c) <= '9') \
> +				 || ('a' <= (c) && (c) <= 'f') \
> +				 || ('A' <= (c) && (c) <= 'F'))
>  
> -#define isdigit(c)	('0' <= (c) && (c) <= '9')
> -#define islower(c)	('a' <= (c) && (c) <= 'z')
> -#define toupper(c)	(islower(c) ? ((c) - 'a' + 'A') : (c))
> +#define prom_isdigit(c)		('0' <= (c) && (c) <= '9')
> +#define prom_islower(c)		('a' <= (c) && (c) <= 'z')
> +#define prom_toupper(c)		(prom_islower(c) ? ((c) - 'a' + 'A') : (c))
>  
>  static unsigned long prom_strtoul(const char *cp, const char **endp)
>  {
> @@ -716,14 +716,14 @@ static unsigned long prom_strtoul(const char *cp, const char **endp)
>  	if (*cp == '0') {
>  		base = 8;
>  		cp++;
> -		if (toupper(*cp) == 'X') {
> +		if (prom_toupper(*cp) == 'X') {
>  			cp++;
>  			base = 16;
>  		}
>  	}
>  
> -	while (isxdigit(*cp) &&
> -	       (value = isdigit(*cp) ? *cp - '0' : toupper(*cp) - 'A' + 10) < base) {
> +	while (prom_isxdigit(*cp) &&
> +	       (value = prom_isdigit(*cp) ? *cp - '0' : prom_toupper(*cp) - 'A' + 10) < base) {
>  		result = result * base + value;
>  		cp++;
>  	}
> -- 
> 2.30.2
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] powerpc/prom_init: Move custom isspace() to its own namespace
  2021-06-07 17:12 ` Andy Shevchenko
@ 2021-06-09  7:00   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2021-06-09  7:00 UTC (permalink / raw)
  To: Andy Shevchenko, linuxppc-dev, linux-kernel
  Cc: Benjamin Herrenschmidt, Paul Mackerras, kernel test robot

Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:
> On Mon, May 10, 2021 at 05:49:25PM +0300, Andy Shevchenko wrote:
>> If by some reason any of the headers will include ctype.h
>> we will have a name collision. Avoid this by moving isspace()
>> to the dedicate namespace.
>> 
>> First appearance of the code is in the commit cf68787b68a2
>> ("powerpc/prom_init: Evaluate mem kernel parameter for early allocation").
>
> Any comments on this?

Looks fine. Thanks.

I just missed it because it came in a bit early, I tend not to pick
things up until rc2.

I tweaked the formatting of prom_isxdigit() slightly now that we allow
100 column lines.

Have put it in my next-test now.

cheers

>> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
>> index 41ed7e33d897..6845cbbc0cd4 100644
>> --- a/arch/powerpc/kernel/prom_init.c
>> +++ b/arch/powerpc/kernel/prom_init.c
>> @@ -701,13 +701,13 @@ static int __init prom_setprop(phandle node, const char *nodename,
>>  }
>>  
>>  /* We can't use the standard versions because of relocation headaches. */
>> -#define isxdigit(c)	(('0' <= (c) && (c) <= '9') \
>> -			 || ('a' <= (c) && (c) <= 'f') \
>> -			 || ('A' <= (c) && (c) <= 'F'))
>> +#define prom_isxdigit(c)	(('0' <= (c) && (c) <= '9') \
>> +				 || ('a' <= (c) && (c) <= 'f') \
>> +				 || ('A' <= (c) && (c) <= 'F'))
>>  
>> -#define isdigit(c)	('0' <= (c) && (c) <= '9')
>> -#define islower(c)	('a' <= (c) && (c) <= 'z')
>> -#define toupper(c)	(islower(c) ? ((c) - 'a' + 'A') : (c))
>> +#define prom_isdigit(c)		('0' <= (c) && (c) <= '9')
>> +#define prom_islower(c)		('a' <= (c) && (c) <= 'z')
>> +#define prom_toupper(c)		(prom_islower(c) ? ((c) - 'a' + 'A') : (c))
>>  
>>  static unsigned long prom_strtoul(const char *cp, const char **endp)
>>  {
>> @@ -716,14 +716,14 @@ static unsigned long prom_strtoul(const char *cp, const char **endp)
>>  	if (*cp == '0') {
>>  		base = 8;
>>  		cp++;
>> -		if (toupper(*cp) == 'X') {
>> +		if (prom_toupper(*cp) == 'X') {
>>  			cp++;
>>  			base = 16;
>>  		}
>>  	}
>>  
>> -	while (isxdigit(*cp) &&
>> -	       (value = isdigit(*cp) ? *cp - '0' : toupper(*cp) - 'A' + 10) < base) {
>> +	while (prom_isxdigit(*cp) &&
>> +	       (value = prom_isdigit(*cp) ? *cp - '0' : prom_toupper(*cp) - 'A' + 10) < base) {
>>  		result = result * base + value;
>>  		cp++;
>>  	}
>> -- 
>> 2.30.2
>> 
>
> -- 
> With Best Regards,
> Andy Shevchenko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] powerpc/prom_init: Move custom isspace() to its own namespace
  2021-05-10 14:49 [PATCH v1 1/1] powerpc/prom_init: Move custom isspace() to its own namespace Andy Shevchenko
  2021-06-07 17:12 ` Andy Shevchenko
@ 2021-06-18  3:51 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2021-06-18  3:51 UTC (permalink / raw)
  To: linuxppc-dev, Michael Ellerman, Andy Shevchenko, linux-kernel
  Cc: kernel test robot, Paul Mackerras, Benjamin Herrenschmidt

On Mon, 10 May 2021 17:49:25 +0300, Andy Shevchenko wrote:
> If by some reason any of the headers will include ctype.h
> we will have a name collision. Avoid this by moving isspace()
> to the dedicate namespace.
> 
> First appearance of the code is in the commit cf68787b68a2
> ("powerpc/prom_init: Evaluate mem kernel parameter for early allocation").

Applied to powerpc/next.

[1/1] powerpc/prom_init: Move custom isspace() to its own namespace
      https://git.kernel.org/powerpc/c/4cfdd9201cfb85538975f5c8fb83941c3d463ed2

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-18  4:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 14:49 [PATCH v1 1/1] powerpc/prom_init: Move custom isspace() to its own namespace Andy Shevchenko
2021-06-07 17:12 ` Andy Shevchenko
2021-06-09  7:00   ` Michael Ellerman
2021-06-18  3:51 ` Michael Ellerman

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).