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: [email protected]
Fixes: e7e935db128e724f ("fs: proc: store PDE()->data into inode->i_private")
Signed-off-by: Geert Uytterhoeven <[email protected]>
---
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
On Thu, Nov 25, 2021 at 4:38 PM Geert Uytterhoeven <[email protected]> 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: [email protected]
> 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 <[email protected]>
> ---
> 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 <[email protected]>
Thanks.
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: [email protected]
> Fixes: e7e935db128e724f ("fs: proc: store PDE()->data into inode->i_private")
> Signed-off-by: Geert Uytterhoeven <[email protected]>
Acked-by: Finn Thain <[email protected]>
> ---
> 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,
>
Hi all,
On Thu, 25 Nov 2021 09:38:08 +0100 Geert Uytterhoeven <[email protected]> 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: [email protected]
> Fixes: e7e935db128e724f ("fs: proc: store PDE()->data into inode->i_private")
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> 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