diff mbox series

gpio: tegra: Fix build error without CONFIG_DEBUG_FS

Message ID 20190705123220.54008-1-yuehaibing@huawei.com
State Deferred
Headers show
Series gpio: tegra: Fix build error without CONFIG_DEBUG_FS | expand

Commit Message

Yue Haibing July 5, 2019, 12:32 p.m. UTC
If CONFIG_DEBUG_FS is not set, building fails:

drivers/gpio/gpio-tegra.c: In function tegra_gpio_probe:
drivers/gpio/gpio-tegra.c:665:2: error: implicit declaration of function debugfs_create_file;
 did you mean bus_create_file? [-Werror=implicit-function-declaration]
  debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
  ^~~~~~~~~~~~~~~~~~~
  bus_create_file
drivers/gpio/gpio-tegra.c:666:9: error: tegra_dbg_gpio_fops undeclared (first use in this function);
 did you mean tegra_gpio_pm_ops?
        &tegra_dbg_gpio_fops);
         ^~~~~~~~~~~~~~~~~~~
         tegra_gpio_pm_ops

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: a4de43049a1d ("gpio: tegra: Clean-up debugfs initialisation")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/gpio/gpio-tegra.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Bartosz Golaszewski July 5, 2019, 12:40 p.m. UTC | #1
pt., 5 lip 2019 o 14:34 YueHaibing <yuehaibing@huawei.com> napisał(a):
>
> If CONFIG_DEBUG_FS is not set, building fails:
>
> drivers/gpio/gpio-tegra.c: In function tegra_gpio_probe:
> drivers/gpio/gpio-tegra.c:665:2: error: implicit declaration of function debugfs_create_file;
>  did you mean bus_create_file? [-Werror=implicit-function-declaration]
>   debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
>   ^~~~~~~~~~~~~~~~~~~
>   bus_create_file
> drivers/gpio/gpio-tegra.c:666:9: error: tegra_dbg_gpio_fops undeclared (first use in this function);
>  did you mean tegra_gpio_pm_ops?
>         &tegra_dbg_gpio_fops);
>          ^~~~~~~~~~~~~~~~~~~
>          tegra_gpio_pm_ops
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes: a4de43049a1d ("gpio: tegra: Clean-up debugfs initialisation")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/gpio/gpio-tegra.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
> index 59b99d8..40fd6bd 100644
> --- a/drivers/gpio/gpio-tegra.c
> +++ b/drivers/gpio/gpio-tegra.c
> @@ -662,8 +662,10 @@ static int tegra_gpio_probe(struct platform_device *pdev)
>                 }
>         }
>
> +#ifdef CONFIG_DEBUG_FS
>         debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
>                             &tegra_dbg_gpio_fops);
> +#endif
>
>         return 0;
>  }
> --
> 2.7.4
>
>

Nack, there are inline stubs for all debugfs functions in
./include/linux/debugfs.h if CONFIG_DEBUG_FS is not selected. Just
move the #include <linux/debugfs.h> to the top of the source file.

Bart
Yue Haibing July 5, 2019, 12:44 p.m. UTC | #2
On 2019/7/5 20:40, Bartosz Golaszewski wrote:
> pt., 5 lip 2019 o 14:34 YueHaibing <yuehaibing@huawei.com> napisał(a):
>>
>> If CONFIG_DEBUG_FS is not set, building fails:
>>
>> drivers/gpio/gpio-tegra.c: In function tegra_gpio_probe:
>> drivers/gpio/gpio-tegra.c:665:2: error: implicit declaration of function debugfs_create_file;
>>  did you mean bus_create_file? [-Werror=implicit-function-declaration]
>>   debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
>>   ^~~~~~~~~~~~~~~~~~~
>>   bus_create_file
>> drivers/gpio/gpio-tegra.c:666:9: error: tegra_dbg_gpio_fops undeclared (first use in this function);
>>  did you mean tegra_gpio_pm_ops?
>>         &tegra_dbg_gpio_fops);
>>          ^~~~~~~~~~~~~~~~~~~
>>          tegra_gpio_pm_ops
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Fixes: a4de43049a1d ("gpio: tegra: Clean-up debugfs initialisation")
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>>  drivers/gpio/gpio-tegra.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
>> index 59b99d8..40fd6bd 100644
>> --- a/drivers/gpio/gpio-tegra.c
>> +++ b/drivers/gpio/gpio-tegra.c
>> @@ -662,8 +662,10 @@ static int tegra_gpio_probe(struct platform_device *pdev)
>>                 }
>>         }
>>
>> +#ifdef CONFIG_DEBUG_FS
>>         debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
>>                             &tegra_dbg_gpio_fops);
>> +#endif
>>
>>         return 0;
>>  }
>> --
>> 2.7.4
>>
>>
> 
> Nack, there are inline stubs for all debugfs functions in
> ./include/linux/debugfs.h if CONFIG_DEBUG_FS is not selected. Just
> move the #include <linux/debugfs.h> to the top of the source file.

yes, agree this, but 'tegra_dbg_gpio_fops' is still undeclared.

> 
> Bart
> 
> .
>
Bartosz Golaszewski July 5, 2019, 12:56 p.m. UTC | #3
pt., 5 lip 2019 o 14:44 Yuehaibing <yuehaibing@huawei.com> napisał(a):
>
> On 2019/7/5 20:40, Bartosz Golaszewski wrote:
> > pt., 5 lip 2019 o 14:34 YueHaibing <yuehaibing@huawei.com> napisał(a):
> >>
> >> If CONFIG_DEBUG_FS is not set, building fails:
> >>
> >> drivers/gpio/gpio-tegra.c: In function tegra_gpio_probe:
> >> drivers/gpio/gpio-tegra.c:665:2: error: implicit declaration of function debugfs_create_file;
> >>  did you mean bus_create_file? [-Werror=implicit-function-declaration]
> >>   debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
> >>   ^~~~~~~~~~~~~~~~~~~
> >>   bus_create_file
> >> drivers/gpio/gpio-tegra.c:666:9: error: tegra_dbg_gpio_fops undeclared (first use in this function);
> >>  did you mean tegra_gpio_pm_ops?
> >>         &tegra_dbg_gpio_fops);
> >>          ^~~~~~~~~~~~~~~~~~~
> >>          tegra_gpio_pm_ops
> >>
> >> Reported-by: Hulk Robot <hulkci@huawei.com>
> >> Fixes: a4de43049a1d ("gpio: tegra: Clean-up debugfs initialisation")
> >> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> >> ---
> >>  drivers/gpio/gpio-tegra.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
> >> index 59b99d8..40fd6bd 100644
> >> --- a/drivers/gpio/gpio-tegra.c
> >> +++ b/drivers/gpio/gpio-tegra.c
> >> @@ -662,8 +662,10 @@ static int tegra_gpio_probe(struct platform_device *pdev)
> >>                 }
> >>         }
> >>
> >> +#ifdef CONFIG_DEBUG_FS
> >>         debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
> >>                             &tegra_dbg_gpio_fops);
> >> +#endif
> >>
> >>         return 0;
> >>  }
> >> --
> >> 2.7.4
> >>
> >>
> >
> > Nack, there are inline stubs for all debugfs functions in
> > ./include/linux/debugfs.h if CONFIG_DEBUG_FS is not selected. Just
> > move the #include <linux/debugfs.h> to the top of the source file.
>
> yes, agree this, but 'tegra_dbg_gpio_fops' is still undeclared.
>
> >
> > Bart
> >
> > .
> >
>

Can you attach the config you're using?

Bart
Bartosz Golaszewski July 5, 2019, 12:59 p.m. UTC | #4
pt., 5 lip 2019 o 14:56 Bartosz Golaszewski
<bgolaszewski@baylibre.com> napisał(a):
>
> pt., 5 lip 2019 o 14:44 Yuehaibing <yuehaibing@huawei.com> napisał(a):
> >
> > On 2019/7/5 20:40, Bartosz Golaszewski wrote:
> > > pt., 5 lip 2019 o 14:34 YueHaibing <yuehaibing@huawei.com> napisał(a):
> > >>
> > >> If CONFIG_DEBUG_FS is not set, building fails:
> > >>
> > >> drivers/gpio/gpio-tegra.c: In function tegra_gpio_probe:
> > >> drivers/gpio/gpio-tegra.c:665:2: error: implicit declaration of function debugfs_create_file;
> > >>  did you mean bus_create_file? [-Werror=implicit-function-declaration]
> > >>   debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
> > >>   ^~~~~~~~~~~~~~~~~~~
> > >>   bus_create_file
> > >> drivers/gpio/gpio-tegra.c:666:9: error: tegra_dbg_gpio_fops undeclared (first use in this function);
> > >>  did you mean tegra_gpio_pm_ops?
> > >>         &tegra_dbg_gpio_fops);
> > >>          ^~~~~~~~~~~~~~~~~~~
> > >>          tegra_gpio_pm_ops
> > >>
> > >> Reported-by: Hulk Robot <hulkci@huawei.com>
> > >> Fixes: a4de43049a1d ("gpio: tegra: Clean-up debugfs initialisation")
> > >> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > >> ---
> > >>  drivers/gpio/gpio-tegra.c | 2 ++
> > >>  1 file changed, 2 insertions(+)
> > >>
> > >> diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
> > >> index 59b99d8..40fd6bd 100644
> > >> --- a/drivers/gpio/gpio-tegra.c
> > >> +++ b/drivers/gpio/gpio-tegra.c
> > >> @@ -662,8 +662,10 @@ static int tegra_gpio_probe(struct platform_device *pdev)
> > >>                 }
> > >>         }
> > >>
> > >> +#ifdef CONFIG_DEBUG_FS
> > >>         debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
> > >>                             &tegra_dbg_gpio_fops);
> > >> +#endif
> > >>
> > >>         return 0;
> > >>  }
> > >> --
> > >> 2.7.4
> > >>
> > >>
> > >
> > > Nack, there are inline stubs for all debugfs functions in
> > > ./include/linux/debugfs.h if CONFIG_DEBUG_FS is not selected. Just
> > > move the #include <linux/debugfs.h> to the top of the source file.
> >
> > yes, agree this, but 'tegra_dbg_gpio_fops' is still undeclared.
> >
> > >
> > > Bart
> > >
> > > .
> > >
> >
>
> Can you attach the config you're using?
>
> Bart

Wait, nevermind. I think that commit a4de43049a1d ("gpio: tegra:
Clean-up debugfs initialisation") is wrong and we missed that. Linus
what do you think about reverting it?

Bart
Linus Walleij July 6, 2019, 10:34 p.m. UTC | #5
On Fri, Jul 5, 2019 at 2:59 PM Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:

> Wait, nevermind. I think that commit a4de43049a1d ("gpio: tegra:
> Clean-up debugfs initialisation") is wrong and we missed that. Linus
> what do you think about reverting it?

OK I reverted it.

Linus
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 59b99d8..40fd6bd 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -662,8 +662,10 @@  static int tegra_gpio_probe(struct platform_device *pdev)
 		}
 	}
 
+#ifdef CONFIG_DEBUG_FS
 	debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
 			    &tegra_dbg_gpio_fops);
+#endif
 
 	return 0;
 }