linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] nubus: Rename pde_data var to fix conflict with external function
@ 2021-11-25  8:38 Geert Uytterhoeven
  2021-11-25 10:40 ` Muchun Song
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2021-11-25  8:38 UTC (permalink / raw)
  To: Finn Thain, Stephen Rothwell, Muchun Song, Christian Brauner,
	Andrew Morton
  Cc: linux-m68k, linux-kernel

In file included from drivers/nubus/proc.c:24:
drivers/nubus/proc.c: In function ‘nubus_proc_rsrc_show’:
./include/linux/proc_fs.h:123:21: error: called object ‘pde_data’ is not a function or function pointer
  123 | #define PDE_DATA(i) pde_data(i)
      |                     ^~~~~~~~
drivers/nubus/proc.c:112:13: note: in expansion of macro ‘PDE_DATA’
  112 |  pde_data = PDE_DATA(inode);
      |             ^~~~~~~~
drivers/nubus/proc.c:110:30: note: declared here
  110 |  struct nubus_proc_pde_data *pde_data;
      |                              ^~~~~~~~

Fix this by renaming the local variable to "pde".  Do this everywhere
for consistency.

Reported-by: noreply@ellerman.id.au
Fixes: e7e935db128e724f ("fs: proc: store PDE()->data into inode->i_private")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Not fixed by commit 5de6353a96bec91d ("proc: remove PDE_DATA()
completely"), which just removes the macro indirection.
---
 drivers/nubus/proc.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/nubus/proc.c b/drivers/nubus/proc.c
index 22fb11da519bfc43..aff1c5d257cd8183 100644
--- a/drivers/nubus/proc.c
+++ b/drivers/nubus/proc.c
@@ -93,30 +93,30 @@ struct nubus_proc_pde_data {
 static struct nubus_proc_pde_data *
 nubus_proc_alloc_pde_data(unsigned char *ptr, unsigned int size)
 {
-	struct nubus_proc_pde_data *pde_data;
+	struct nubus_proc_pde_data *pde;
 
-	pde_data = kmalloc(sizeof(*pde_data), GFP_KERNEL);
-	if (!pde_data)
+	pde = kmalloc(sizeof(*pde), GFP_KERNEL);
+	if (!pde)
 		return NULL;
 
-	pde_data->res_ptr = ptr;
-	pde_data->res_size = size;
-	return pde_data;
+	pde->res_ptr = ptr;
+	pde->res_size = size;
+	return pde;
 }
 
 static int nubus_proc_rsrc_show(struct seq_file *m, void *v)
 {
 	struct inode *inode = m->private;
-	struct nubus_proc_pde_data *pde_data;
+	struct nubus_proc_pde_data *pde;
 
-	pde_data = pde_data(inode);
-	if (!pde_data)
+	pde = pde_data(inode);
+	if (!pde)
 		return 0;
 
-	if (pde_data->res_size > m->size)
+	if (pde->res_size > m->size)
 		return -EFBIG;
 
-	if (pde_data->res_size) {
+	if (pde->res_size) {
 		int lanes = (int)proc_get_parent_data(inode);
 		struct nubus_dirent ent;
 
@@ -124,11 +124,11 @@ static int nubus_proc_rsrc_show(struct seq_file *m, void *v)
 			return 0;
 
 		ent.mask = lanes;
-		ent.base = pde_data->res_ptr;
+		ent.base = pde->res_ptr;
 		ent.data = 0;
-		nubus_seq_write_rsrc_mem(m, &ent, pde_data->res_size);
+		nubus_seq_write_rsrc_mem(m, &ent, pde->res_size);
 	} else {
-		unsigned int data = (unsigned int)pde_data->res_ptr;
+		unsigned int data = (unsigned int)pde->res_ptr;
 
 		seq_putc(m, data >> 16);
 		seq_putc(m, data >> 8);
@@ -142,18 +142,18 @@ void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir,
 			     unsigned int size)
 {
 	char name[9];
-	struct nubus_proc_pde_data *pde_data;
+	struct nubus_proc_pde_data *pde;
 
 	if (!procdir)
 		return;
 
 	snprintf(name, sizeof(name), "%x", ent->type);
 	if (size)
-		pde_data = nubus_proc_alloc_pde_data(nubus_dirptr(ent), size);
+		pde = nubus_proc_alloc_pde_data(nubus_dirptr(ent), size);
 	else
-		pde_data = NULL;
+		pde = NULL;
 	proc_create_single_data(name, S_IFREG | 0444, procdir,
-			nubus_proc_rsrc_show, pde_data);
+			nubus_proc_rsrc_show, pde);
 }
 
 void nubus_proc_add_rsrc(struct proc_dir_entry *procdir,
-- 
2.25.1


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

* Re: [PATCH -next] nubus: Rename pde_data var to fix conflict with external function
  2021-11-25  8:38 [PATCH -next] nubus: Rename pde_data var to fix conflict with external function Geert Uytterhoeven
@ 2021-11-25 10:40 ` Muchun Song
  2021-11-25 21:50 ` Finn Thain
  2021-11-25 22:41 ` Stephen Rothwell
  2 siblings, 0 replies; 4+ messages in thread
From: Muchun Song @ 2021-11-25 10:40 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Finn Thain, Stephen Rothwell, Christian Brauner, Andrew Morton,
	linux-m68k, LKML

On Thu, Nov 25, 2021 at 4:38 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> In file included from drivers/nubus/proc.c:24:
> drivers/nubus/proc.c: In function ‘nubus_proc_rsrc_show’:
> ./include/linux/proc_fs.h:123:21: error: called object ‘pde_data’ is not a function or function pointer
>   123 | #define PDE_DATA(i) pde_data(i)
>       |                     ^~~~~~~~
> drivers/nubus/proc.c:112:13: note: in expansion of macro ‘PDE_DATA’
>   112 |  pde_data = PDE_DATA(inode);
>       |             ^~~~~~~~
> drivers/nubus/proc.c:110:30: note: declared here
>   110 |  struct nubus_proc_pde_data *pde_data;
>       |                              ^~~~~~~~
>
> Fix this by renaming the local variable to "pde".  Do this everywhere
> for consistency.
>
> Reported-by: noreply@ellerman.id.au
> Fixes: e7e935db128e724f ("fs: proc: store PDE()->data into inode->i_private")

Since the commit ID is not stable, Fixes tag is unnecessary.

> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> Not fixed by commit 5de6353a96bec91d ("proc: remove PDE_DATA()
> completely"), which just removes the macro indirection.
> ---

My bad. I didn't realize this situation. Thanks for fixing this.

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

Thanks.

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

* Re: [PATCH -next] nubus: Rename pde_data var to fix conflict with external function
  2021-11-25  8:38 [PATCH -next] nubus: Rename pde_data var to fix conflict with external function Geert Uytterhoeven
  2021-11-25 10:40 ` Muchun Song
@ 2021-11-25 21:50 ` Finn Thain
  2021-11-25 22:41 ` Stephen Rothwell
  2 siblings, 0 replies; 4+ messages in thread
From: Finn Thain @ 2021-11-25 21:50 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Stephen Rothwell, Muchun Song, Christian Brauner, Andrew Morton,
	linux-m68k, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3815 bytes --]


On Thu, 25 Nov 2021, Geert Uytterhoeven wrote:

> In file included from drivers/nubus/proc.c:24:
> drivers/nubus/proc.c: In function ‘nubus_proc_rsrc_show’:
> ./include/linux/proc_fs.h:123:21: error: called object ‘pde_data’ is not a function or function pointer
>   123 | #define PDE_DATA(i) pde_data(i)
>       |                     ^~~~~~~~
> drivers/nubus/proc.c:112:13: note: in expansion of macro ‘PDE_DATA’
>   112 |  pde_data = PDE_DATA(inode);
>       |             ^~~~~~~~
> drivers/nubus/proc.c:110:30: note: declared here
>   110 |  struct nubus_proc_pde_data *pde_data;
>       |                              ^~~~~~~~
> 
> Fix this by renaming the local variable to "pde".  Do this everywhere
> for consistency.
> 
> Reported-by: noreply@ellerman.id.au
> Fixes: e7e935db128e724f ("fs: proc: store PDE()->data into inode->i_private")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Acked-by: Finn Thain <fthain@linux-m68k.org>

> ---
> Not fixed by commit 5de6353a96bec91d ("proc: remove PDE_DATA()
> completely"), which just removes the macro indirection.
> ---
>  drivers/nubus/proc.c | 36 ++++++++++++++++++------------------
>  1 file changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/nubus/proc.c b/drivers/nubus/proc.c
> index 22fb11da519bfc43..aff1c5d257cd8183 100644
> --- a/drivers/nubus/proc.c
> +++ b/drivers/nubus/proc.c
> @@ -93,30 +93,30 @@ struct nubus_proc_pde_data {
>  static struct nubus_proc_pde_data *
>  nubus_proc_alloc_pde_data(unsigned char *ptr, unsigned int size)
>  {
> -	struct nubus_proc_pde_data *pde_data;
> +	struct nubus_proc_pde_data *pde;
>  
> -	pde_data = kmalloc(sizeof(*pde_data), GFP_KERNEL);
> -	if (!pde_data)
> +	pde = kmalloc(sizeof(*pde), GFP_KERNEL);
> +	if (!pde)
>  		return NULL;
>  
> -	pde_data->res_ptr = ptr;
> -	pde_data->res_size = size;
> -	return pde_data;
> +	pde->res_ptr = ptr;
> +	pde->res_size = size;
> +	return pde;
>  }
>  
>  static int nubus_proc_rsrc_show(struct seq_file *m, void *v)
>  {
>  	struct inode *inode = m->private;
> -	struct nubus_proc_pde_data *pde_data;
> +	struct nubus_proc_pde_data *pde;
>  
> -	pde_data = pde_data(inode);
> -	if (!pde_data)
> +	pde = pde_data(inode);
> +	if (!pde)
>  		return 0;
>  
> -	if (pde_data->res_size > m->size)
> +	if (pde->res_size > m->size)
>  		return -EFBIG;
>  
> -	if (pde_data->res_size) {
> +	if (pde->res_size) {
>  		int lanes = (int)proc_get_parent_data(inode);
>  		struct nubus_dirent ent;
>  
> @@ -124,11 +124,11 @@ static int nubus_proc_rsrc_show(struct seq_file *m, void *v)
>  			return 0;
>  
>  		ent.mask = lanes;
> -		ent.base = pde_data->res_ptr;
> +		ent.base = pde->res_ptr;
>  		ent.data = 0;
> -		nubus_seq_write_rsrc_mem(m, &ent, pde_data->res_size);
> +		nubus_seq_write_rsrc_mem(m, &ent, pde->res_size);
>  	} else {
> -		unsigned int data = (unsigned int)pde_data->res_ptr;
> +		unsigned int data = (unsigned int)pde->res_ptr;
>  
>  		seq_putc(m, data >> 16);
>  		seq_putc(m, data >> 8);
> @@ -142,18 +142,18 @@ void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir,
>  			     unsigned int size)
>  {
>  	char name[9];
> -	struct nubus_proc_pde_data *pde_data;
> +	struct nubus_proc_pde_data *pde;
>  
>  	if (!procdir)
>  		return;
>  
>  	snprintf(name, sizeof(name), "%x", ent->type);
>  	if (size)
> -		pde_data = nubus_proc_alloc_pde_data(nubus_dirptr(ent), size);
> +		pde = nubus_proc_alloc_pde_data(nubus_dirptr(ent), size);
>  	else
> -		pde_data = NULL;
> +		pde = NULL;
>  	proc_create_single_data(name, S_IFREG | 0444, procdir,
> -			nubus_proc_rsrc_show, pde_data);
> +			nubus_proc_rsrc_show, pde);
>  }
>  
>  void nubus_proc_add_rsrc(struct proc_dir_entry *procdir,
> 

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

* Re: [PATCH -next] nubus: Rename pde_data var to fix conflict with external function
  2021-11-25  8:38 [PATCH -next] nubus: Rename pde_data var to fix conflict with external function Geert Uytterhoeven
  2021-11-25 10:40 ` Muchun Song
  2021-11-25 21:50 ` Finn Thain
@ 2021-11-25 22:41 ` Stephen Rothwell
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2021-11-25 22:41 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Finn Thain, Muchun Song, Christian Brauner, Andrew Morton,
	linux-m68k, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3886 bytes --]

Hi all,

On Thu, 25 Nov 2021 09:38:08 +0100 Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> In file included from drivers/nubus/proc.c:24:
> drivers/nubus/proc.c: In function ‘nubus_proc_rsrc_show’:
> ./include/linux/proc_fs.h:123:21: error: called object ‘pde_data’ is not a function or function pointer
>   123 | #define PDE_DATA(i) pde_data(i)
>       |                     ^~~~~~~~
> drivers/nubus/proc.c:112:13: note: in expansion of macro ‘PDE_DATA’
>   112 |  pde_data = PDE_DATA(inode);
>       |             ^~~~~~~~
> drivers/nubus/proc.c:110:30: note: declared here
>   110 |  struct nubus_proc_pde_data *pde_data;
>       |                              ^~~~~~~~
> 
> Fix this by renaming the local variable to "pde".  Do this everywhere
> for consistency.
> 
> Reported-by: noreply@ellerman.id.au
> Fixes: e7e935db128e724f ("fs: proc: store PDE()->data into inode->i_private")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> Not fixed by commit 5de6353a96bec91d ("proc: remove PDE_DATA()
> completely"), which just removes the macro indirection.
> ---
>  drivers/nubus/proc.c | 36 ++++++++++++++++++------------------
>  1 file changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/nubus/proc.c b/drivers/nubus/proc.c
> index 22fb11da519bfc43..aff1c5d257cd8183 100644
> --- a/drivers/nubus/proc.c
> +++ b/drivers/nubus/proc.c
> @@ -93,30 +93,30 @@ struct nubus_proc_pde_data {
>  static struct nubus_proc_pde_data *
>  nubus_proc_alloc_pde_data(unsigned char *ptr, unsigned int size)
>  {
> -	struct nubus_proc_pde_data *pde_data;
> +	struct nubus_proc_pde_data *pde;
>  
> -	pde_data = kmalloc(sizeof(*pde_data), GFP_KERNEL);
> -	if (!pde_data)
> +	pde = kmalloc(sizeof(*pde), GFP_KERNEL);
> +	if (!pde)
>  		return NULL;
>  
> -	pde_data->res_ptr = ptr;
> -	pde_data->res_size = size;
> -	return pde_data;
> +	pde->res_ptr = ptr;
> +	pde->res_size = size;
> +	return pde;
>  }
>  
>  static int nubus_proc_rsrc_show(struct seq_file *m, void *v)
>  {
>  	struct inode *inode = m->private;
> -	struct nubus_proc_pde_data *pde_data;
> +	struct nubus_proc_pde_data *pde;
>  
> -	pde_data = pde_data(inode);
> -	if (!pde_data)
> +	pde = pde_data(inode);
> +	if (!pde)
>  		return 0;
>  
> -	if (pde_data->res_size > m->size)
> +	if (pde->res_size > m->size)
>  		return -EFBIG;
>  
> -	if (pde_data->res_size) {
> +	if (pde->res_size) {
>  		int lanes = (int)proc_get_parent_data(inode);
>  		struct nubus_dirent ent;
>  
> @@ -124,11 +124,11 @@ static int nubus_proc_rsrc_show(struct seq_file *m, void *v)
>  			return 0;
>  
>  		ent.mask = lanes;
> -		ent.base = pde_data->res_ptr;
> +		ent.base = pde->res_ptr;
>  		ent.data = 0;
> -		nubus_seq_write_rsrc_mem(m, &ent, pde_data->res_size);
> +		nubus_seq_write_rsrc_mem(m, &ent, pde->res_size);
>  	} else {
> -		unsigned int data = (unsigned int)pde_data->res_ptr;
> +		unsigned int data = (unsigned int)pde->res_ptr;
>  
>  		seq_putc(m, data >> 16);
>  		seq_putc(m, data >> 8);
> @@ -142,18 +142,18 @@ void nubus_proc_add_rsrc_mem(struct proc_dir_entry *procdir,
>  			     unsigned int size)
>  {
>  	char name[9];
> -	struct nubus_proc_pde_data *pde_data;
> +	struct nubus_proc_pde_data *pde;
>  
>  	if (!procdir)
>  		return;
>  
>  	snprintf(name, sizeof(name), "%x", ent->type);
>  	if (size)
> -		pde_data = nubus_proc_alloc_pde_data(nubus_dirptr(ent), size);
> +		pde = nubus_proc_alloc_pde_data(nubus_dirptr(ent), size);
>  	else
> -		pde_data = NULL;
> +		pde = NULL;
>  	proc_create_single_data(name, S_IFREG | 0444, procdir,
> -			nubus_proc_rsrc_show, pde_data);
> +			nubus_proc_rsrc_show, pde);
>  }
>  
>  void nubus_proc_add_rsrc(struct proc_dir_entry *procdir,

I will apply that to linux-next today.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2021-11-25 22:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-25  8:38 [PATCH -next] nubus: Rename pde_data var to fix conflict with external function Geert Uytterhoeven
2021-11-25 10:40 ` Muchun Song
2021-11-25 21:50 ` Finn Thain
2021-11-25 22:41 ` Stephen Rothwell

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