Hi,
This small series adds modularization support to the gpio-tegra driver,
i.e. driver now could be built as a loadable kernel module.
Dmitry Osipenko (3):
gpio: tegra: Use debugfs_create_devm_seqfile()
gpio: tegra: Clean up whitespaces in tegra_gpio_driver
gpio: tegra: Support building driver as a loadable module
drivers/gpio/Kconfig | 2 +-
drivers/gpio/gpio-tegra.c | 31 ++++++++++++++++---------------
2 files changed, 17 insertions(+), 16 deletions(-)
--
2.29.2
Use resource-managed variant of debugfs_create_file(0444) to prepare code
for the modularization of the driver.
Signed-off-by: Dmitry Osipenko <[email protected]>
---
drivers/gpio/gpio-tegra.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 9a43129313fa..06f033375e40 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -605,7 +605,7 @@ static void tegra_gpio_irq_release_resources(struct irq_data *d)
static int tegra_dbg_gpio_show(struct seq_file *s, void *unused)
{
- struct tegra_gpio_info *tgi = s->private;
+ struct tegra_gpio_info *tgi = dev_get_drvdata(s->private);
unsigned int i, j;
for (i = 0; i < tgi->bank_count; i++) {
@@ -627,12 +627,10 @@ static int tegra_dbg_gpio_show(struct seq_file *s, void *unused)
return 0;
}
-DEFINE_SHOW_ATTRIBUTE(tegra_dbg_gpio);
-
static void tegra_gpio_debuginit(struct tegra_gpio_info *tgi)
{
- debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
- &tegra_dbg_gpio_fops);
+ debugfs_create_devm_seqfile(tgi->dev, "tegra_gpio", NULL,
+ tegra_dbg_gpio_show);
}
#else
--
2.29.2
Clean up inconsistent whitespaces and tabs in the definition of
tegra_gpio_driver to make code look better a tad.
Signed-off-by: Dmitry Osipenko <[email protected]>
---
drivers/gpio/gpio-tegra.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 06f033375e40..1efd6fb642c7 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -800,12 +800,12 @@ static const struct of_device_id tegra_gpio_of_match[] = {
};
static struct platform_driver tegra_gpio_driver = {
- .driver = {
- .name = "tegra-gpio",
- .pm = &tegra_gpio_pm_ops,
+ .driver = {
+ .name = "tegra-gpio",
+ .pm = &tegra_gpio_pm_ops,
.of_match_table = tegra_gpio_of_match,
},
- .probe = tegra_gpio_probe,
+ .probe = tegra_gpio_probe,
};
static int __init tegra_gpio_init(void)
--
2.29.2
On Fri, Jan 22, 2021 at 7:59 PM Dmitry Osipenko <[email protected]> wrote:
> This small series adds modularization support to the gpio-tegra driver,
> i.e. driver now could be built as a loadable kernel module.
>
> Dmitry Osipenko (3):
> gpio: tegra: Use debugfs_create_devm_seqfile()
> gpio: tegra: Clean up whitespaces in tegra_gpio_driver
> gpio: tegra: Support building driver as a loadable module
As these three patches clearly make the kernel look better after
than before:
Reviewed-by: Linus Walleij <[email protected]>
However when we are doing this I would strongly encourage you
to also make a patch implementing remove() so you can insmod
rmmod the module at runtime.
Yours,
Linus Walleij
24.01.2021 01:50, Linus Walleij пишет:
> On Fri, Jan 22, 2021 at 7:59 PM Dmitry Osipenko <[email protected]> wrote:
>
>> This small series adds modularization support to the gpio-tegra driver,
>> i.e. driver now could be built as a loadable kernel module.
>>
>> Dmitry Osipenko (3):
>> gpio: tegra: Use debugfs_create_devm_seqfile()
>> gpio: tegra: Clean up whitespaces in tegra_gpio_driver
>> gpio: tegra: Support building driver as a loadable module
>
> As these three patches clearly make the kernel look better after
> than before:
> Reviewed-by: Linus Walleij <[email protected]>
>
> However when we are doing this I would strongly encourage you
> to also make a patch implementing remove() so you can insmod
> rmmod the module at runtime.
The remove() is optional for drivers, it doesn't prevent the rmmod.
On Sun, Jan 24, 2021 at 12:56 AM Dmitry Osipenko <[email protected]> wrote:
> 24.01.2021 01:50, Linus Walleij пишет:
> > On Fri, Jan 22, 2021 at 7:59 PM Dmitry Osipenko <[email protected]> wrote:
> >
> >> This small series adds modularization support to the gpio-tegra driver,
> >> i.e. driver now could be built as a loadable kernel module.
> >>
> >> Dmitry Osipenko (3):
> >> gpio: tegra: Use debugfs_create_devm_seqfile()
> >> gpio: tegra: Clean up whitespaces in tegra_gpio_driver
> >> gpio: tegra: Support building driver as a loadable module
> >
> > As these three patches clearly make the kernel look better after
> > than before:
> > Reviewed-by: Linus Walleij <[email protected]>
> >
> > However when we are doing this I would strongly encourage you
> > to also make a patch implementing remove() so you can insmod
> > rmmod the module at runtime.
>
> The remove() is optional for drivers, it doesn't prevent the rmmod.
Aha you mean all resources are managed (devm_*) so that
rmmod/insmod works fine with this driver?
OK then! :) the work is finished.
Yours,
Linus Walleij
25.01.2021 01:46, Linus Walleij пишет:
> On Sun, Jan 24, 2021 at 12:56 AM Dmitry Osipenko <[email protected]> wrote:
>> 24.01.2021 01:50, Linus Walleij пишет:
>>> On Fri, Jan 22, 2021 at 7:59 PM Dmitry Osipenko <[email protected]> wrote:
>>>
>>>> This small series adds modularization support to the gpio-tegra driver,
>>>> i.e. driver now could be built as a loadable kernel module.
>>>>
>>>> Dmitry Osipenko (3):
>>>> gpio: tegra: Use debugfs_create_devm_seqfile()
>>>> gpio: tegra: Clean up whitespaces in tegra_gpio_driver
>>>> gpio: tegra: Support building driver as a loadable module
>>>
>>> As these three patches clearly make the kernel look better after
>>> than before:
>>> Reviewed-by: Linus Walleij <[email protected]>
>>>
>>> However when we are doing this I would strongly encourage you
>>> to also make a patch implementing remove() so you can insmod
>>> rmmod the module at runtime.
>>
>> The remove() is optional for drivers, it doesn't prevent the rmmod.
>
> Aha you mean all resources are managed (devm_*) so that
> rmmod/insmod works fine with this driver?
yes
> OK then! :) the work is finished.
The work on the modularization indeed should be finished, thanks.
On Fri, Jan 22, 2021 at 7:59 PM Dmitry Osipenko <[email protected]> wrote:
>
> Hi,
>
> This small series adds modularization support to the gpio-tegra driver,
> i.e. driver now could be built as a loadable kernel module.
>
> Dmitry Osipenko (3):
> gpio: tegra: Use debugfs_create_devm_seqfile()
> gpio: tegra: Clean up whitespaces in tegra_gpio_driver
> gpio: tegra: Support building driver as a loadable module
>
> drivers/gpio/Kconfig | 2 +-
> drivers/gpio/gpio-tegra.c | 31 ++++++++++++++++---------------
> 2 files changed, 17 insertions(+), 16 deletions(-)
>
> --
> 2.29.2
>
Series applied, thanks!
Bartosz