diff mbox series

[1/3] gpio: zynq: use module_platform_driver to simplify the code

Message ID 20210409140806.31824-2-srinivas.neeli@xilinx.com
State Accepted
Commit c43ce4740249b485846093f8a66220b25fb86290
Headers show
Series gpio: zynq: Update on gpio zynq driver | expand

Commit Message

Srinivas Neeli April 9, 2021, 2:08 p.m. UTC
module_platform_driver() makes the code simpler by eliminating
boilerplate code.

Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
---
 drivers/gpio/gpio-zynq.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

Comments

Bartosz Golaszewski April 13, 2021, 10:43 a.m. UTC | #1
On Sat, Apr 10, 2021 at 12:08 AM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>

>

>

> On Friday, April 9, 2021, Srinivas Neeli <srinivas.neeli@xilinx.com> wrote:

>>

>> module_platform_driver() makes the code simpler by eliminating

>> boilerplate code.

>>

>> Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>

>> ---

>>  drivers/gpio/gpio-zynq.c | 17 +----------------

>>  1 file changed, 1 insertion(+), 16 deletions(-)

>>

>> diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c

>> index 3521c1dc3ac0..bb1ac0c5cf26 100644

>> --- a/drivers/gpio/gpio-zynq.c

>> +++ b/drivers/gpio/gpio-zynq.c

>> @@ -1020,22 +1020,7 @@ static struct platform_driver zynq_gpio_driver = {

>>         .remove = zynq_gpio_remove,

>>  };

>>

>> -/**

>> - * zynq_gpio_init - Initial driver registration call

>> - *

>> - * Return: value from platform_driver_register

>> - */

>> -static int __init zynq_gpio_init(void)

>> -{

>> -       return platform_driver_register(&zynq_gpio_driver);

>> -}

>> -postcore_initcall(zynq_gpio_init);

>

>

>

> It’s not an equivalent. Have you tested on actual hardware? If no, there is no go for this change.

>


Yep, this has been like this since the initial introduction of this
driver. Unfortunately there's no documented reason so unless we can
test it, it has to stay this way.

Bartosz
Srinivas Neeli April 14, 2021, 2:45 p.m. UTC | #2
HI baratosz and Andy,

> -----Original Message-----

> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

> Sent: Tuesday, April 13, 2021 4:14 PM

> To: Andy Shevchenko <andy.shevchenko@gmail.com>

> Cc: Srinivas Neeli <sneeli@xilinx.com>; linus.walleij@linaro.org; Michal Simek

> <michals@xilinx.com>; Shubhrajyoti Datta <shubhraj@xilinx.com>; Srinivas

> Goud <sgoud@xilinx.com>; linux-gpio@vger.kernel.org; linux-arm-

> kernel@lists.infradead.org; linux-kernel@vger.kernel.org; git

> <git@xilinx.com>

> Subject: Re: [PATCH 1/3] gpio: zynq: use module_platform_driver to simplify

> the code

> 

> On Sat, Apr 10, 2021 at 12:08 AM Andy Shevchenko

> <andy.shevchenko@gmail.com> wrote:

> >

> >

> >

> > On Friday, April 9, 2021, Srinivas Neeli <srinivas.neeli@xilinx.com> wrote:

> >>

> >> module_platform_driver() makes the code simpler by eliminating

> >> boilerplate code.

> >>

> >> Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>

> >> ---

> >>  drivers/gpio/gpio-zynq.c | 17 +----------------

> >>  1 file changed, 1 insertion(+), 16 deletions(-)

> >>

> >> diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c

> >> index 3521c1dc3ac0..bb1ac0c5cf26 100644

> >> --- a/drivers/gpio/gpio-zynq.c

> >> +++ b/drivers/gpio/gpio-zynq.c

> >> @@ -1020,22 +1020,7 @@ static struct platform_driver zynq_gpio_driver

> = {

> >>         .remove = zynq_gpio_remove,

> >>  };

> >>

> >> -/**

> >> - * zynq_gpio_init - Initial driver registration call

> >> - *

> >> - * Return: value from platform_driver_register

> >> - */

> >> -static int __init zynq_gpio_init(void) -{

> >> -       return platform_driver_register(&zynq_gpio_driver);

> >> -}

> >> -postcore_initcall(zynq_gpio_init);

> >

> >

> >

> > It’s not an equivalent. Have you tested on actual hardware? If no, there is

> no go for this change.

> >

> 

> Yep, this has been like this since the initial introduction of this driver.

> Unfortunately there's no documented reason so unless we can test it, it has

> to stay this way.

> 

I tested driver, functionality wise everything working fine.
Based on below conversation, I moved driver to module driver.
https://lore.kernel.org/patchwork/patch/818202/

Thanks
Srinivas Neeli

> Bartosz
Bartosz Golaszewski April 16, 2021, 6:27 p.m. UTC | #3
On Wed, Apr 14, 2021 at 4:45 PM Srinivas Neeli <sneeli@xilinx.com> wrote:
>

> HI baratosz and Andy,

>


It's Bartosz. You literally just need to copy & paste the name from my email...

> > -----Original Message-----

> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

> > Sent: Tuesday, April 13, 2021 4:14 PM

> > To: Andy Shevchenko <andy.shevchenko@gmail.com>

> > Cc: Srinivas Neeli <sneeli@xilinx.com>; linus.walleij@linaro.org; Michal Simek

> > <michals@xilinx.com>; Shubhrajyoti Datta <shubhraj@xilinx.com>; Srinivas

> > Goud <sgoud@xilinx.com>; linux-gpio@vger.kernel.org; linux-arm-

> > kernel@lists.infradead.org; linux-kernel@vger.kernel.org; git

> > <git@xilinx.com>

> > Subject: Re: [PATCH 1/3] gpio: zynq: use module_platform_driver to simplify

> > the code

> >

> > On Sat, Apr 10, 2021 at 12:08 AM Andy Shevchenko

> > <andy.shevchenko@gmail.com> wrote:

> > >

> > >

> > >

> > > On Friday, April 9, 2021, Srinivas Neeli <srinivas.neeli@xilinx.com> wrote:

> > >>

> > >> module_platform_driver() makes the code simpler by eliminating

> > >> boilerplate code.

> > >>

> > >> Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>

> > >> ---

> > >>  drivers/gpio/gpio-zynq.c | 17 +----------------

> > >>  1 file changed, 1 insertion(+), 16 deletions(-)

> > >>

> > >> diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c

> > >> index 3521c1dc3ac0..bb1ac0c5cf26 100644

> > >> --- a/drivers/gpio/gpio-zynq.c

> > >> +++ b/drivers/gpio/gpio-zynq.c

> > >> @@ -1020,22 +1020,7 @@ static struct platform_driver zynq_gpio_driver

> > = {

> > >>         .remove = zynq_gpio_remove,

> > >>  };

> > >>

> > >> -/**

> > >> - * zynq_gpio_init - Initial driver registration call

> > >> - *

> > >> - * Return: value from platform_driver_register

> > >> - */

> > >> -static int __init zynq_gpio_init(void) -{

> > >> -       return platform_driver_register(&zynq_gpio_driver);

> > >> -}

> > >> -postcore_initcall(zynq_gpio_init);

> > >

> > >

> > >

> > > It’s not an equivalent. Have you tested on actual hardware? If no, there is

> > no go for this change.

> > >

> >

> > Yep, this has been like this since the initial introduction of this driver.

> > Unfortunately there's no documented reason so unless we can test it, it has

> > to stay this way.

> >

> I tested driver, functionality wise everything working fine.

> Based on below conversation, I moved driver to module driver.

> https://lore.kernel.org/patchwork/patch/818202/

>


Andy: How about we give it a try then? If anyone yells, we'll just revert it.

> Thanks

> Srinivas Neeli

>

> > Bartosz


Bartosz
Andy Shevchenko April 17, 2021, 11:06 a.m. UTC | #4
On Fri, Apr 16, 2021 at 9:28 PM Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:
> On Wed, Apr 14, 2021 at 4:45 PM Srinivas Neeli <sneeli@xilinx.com> wrote:

> > > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

> > > Sent: Tuesday, April 13, 2021 4:14 PM

> > > On Sat, Apr 10, 2021 at 12:08 AM Andy Shevchenko

> > > <andy.shevchenko@gmail.com> wrote:


...

> > > Yep, this has been like this since the initial introduction of this driver.

> > > Unfortunately there's no documented reason so unless we can test it, it has

> > > to stay this way.

> > >

> > I tested driver, functionality wise everything working fine.

> > Based on below conversation, I moved driver to module driver.

> > https://lore.kernel.org/patchwork/patch/818202/

> >

>

> Andy: How about we give it a try then? If anyone yells, we'll just revert it.


Sounds like a plan!

-- 
With Best Regards,
Andy Shevchenko
Srinivas Neeli June 14, 2021, 10:39 a.m. UTC | #5
Hi,

> -----Original Message-----

> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

> Sent: Friday, April 16, 2021 11:58 PM

> To: Srinivas Neeli <sneeli@xilinx.com>

> Cc: Andy Shevchenko <andy.shevchenko@gmail.com>;

> linus.walleij@linaro.org; Michal Simek <michals@xilinx.com>; Shubhrajyoti

> Datta <shubhraj@xilinx.com>; Srinivas Goud <sgoud@xilinx.com>; linux-

> gpio@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-

> kernel@vger.kernel.org; git <git@xilinx.com>

> Subject: Re: [PATCH 1/3] gpio: zynq: use module_platform_driver to simplify

> the code

> 

> On Wed, Apr 14, 2021 at 4:45 PM Srinivas Neeli <sneeli@xilinx.com> wrote:

> >

> > HI baratosz and Andy,

> >

> 

> It's Bartosz. You literally just need to copy & paste the name from my email...

> 

> > > -----Original Message-----

> > > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

> > > Sent: Tuesday, April 13, 2021 4:14 PM

> > > To: Andy Shevchenko <andy.shevchenko@gmail.com>

> > > Cc: Srinivas Neeli <sneeli@xilinx.com>; linus.walleij@linaro.org;

> > > Michal Simek <michals@xilinx.com>; Shubhrajyoti Datta

> > > <shubhraj@xilinx.com>; Srinivas Goud <sgoud@xilinx.com>;

> > > linux-gpio@vger.kernel.org; linux-arm- kernel@lists.infradead.org;

> > > linux-kernel@vger.kernel.org; git <git@xilinx.com>

> > > Subject: Re: [PATCH 1/3] gpio: zynq: use module_platform_driver to

> > > simplify the code

> > >

> > > On Sat, Apr 10, 2021 at 12:08 AM Andy Shevchenko

> > > <andy.shevchenko@gmail.com> wrote:

> > > >

> > > >

> > > >

> > > > On Friday, April 9, 2021, Srinivas Neeli <srinivas.neeli@xilinx.com>

> wrote:

> > > >>

> > > >> module_platform_driver() makes the code simpler by eliminating

> > > >> boilerplate code.

> > > >>

> > > >> Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>

> > > >> ---

> > > >>  drivers/gpio/gpio-zynq.c | 17 +----------------

> > > >>  1 file changed, 1 insertion(+), 16 deletions(-)

> > > >>

> > > >> diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c

> > > >> index 3521c1dc3ac0..bb1ac0c5cf26 100644

> > > >> --- a/drivers/gpio/gpio-zynq.c

> > > >> +++ b/drivers/gpio/gpio-zynq.c

> > > >> @@ -1020,22 +1020,7 @@ static struct platform_driver

> > > >> zynq_gpio_driver

> > > = {

> > > >>         .remove = zynq_gpio_remove,  };

> > > >>

> > > >> -/**

> > > >> - * zynq_gpio_init - Initial driver registration call

> > > >> - *

> > > >> - * Return: value from platform_driver_register

> > > >> - */

> > > >> -static int __init zynq_gpio_init(void) -{

> > > >> -       return platform_driver_register(&zynq_gpio_driver);

> > > >> -}

> > > >> -postcore_initcall(zynq_gpio_init);

> > > >

> > > >

> > > >

> > > > It’s not an equivalent. Have you tested on actual hardware? If no,

> > > > there is

> > > no go for this change.

> > > >

> > >

> > > Yep, this has been like this since the initial introduction of this driver.

> > > Unfortunately there's no documented reason so unless we can test it,

> > > it has to stay this way.

> > >

> > I tested driver, functionality wise everything working fine.

> > Based on below conversation, I moved driver to module driver.

> > https://lore.kernel.org/patchwork/patch/818202/

> >

> 

> Andy: How about we give it a try then? If anyone yells, we'll just revert it.


Could you please apply this series to gpio for-next branch if there are no issues .

> 

> > Thanks

> > Srinivas Neeli

> >

> > > Bartosz

> 

> Bartosz


Thanks
Srinivas Neeli
Bartosz Golaszewski June 14, 2021, 6:22 p.m. UTC | #6
On Mon, Jun 14, 2021 at 12:39 PM Srinivas Neeli <sneeli@xilinx.com> wrote:
>

> >

> > Andy: How about we give it a try then? If anyone yells, we'll just revert it.

>

> Could you please apply this series to gpio for-next branch if there are no issues .

>


Applied, thanks!

Bart
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
index 3521c1dc3ac0..bb1ac0c5cf26 100644
--- a/drivers/gpio/gpio-zynq.c
+++ b/drivers/gpio/gpio-zynq.c
@@ -1020,22 +1020,7 @@  static struct platform_driver zynq_gpio_driver = {
 	.remove = zynq_gpio_remove,
 };
 
-/**
- * zynq_gpio_init - Initial driver registration call
- *
- * Return: value from platform_driver_register
- */
-static int __init zynq_gpio_init(void)
-{
-	return platform_driver_register(&zynq_gpio_driver);
-}
-postcore_initcall(zynq_gpio_init);
-
-static void __exit zynq_gpio_exit(void)
-{
-	platform_driver_unregister(&zynq_gpio_driver);
-}
-module_exit(zynq_gpio_exit);
+module_platform_driver(zynq_gpio_driver);
 
 MODULE_AUTHOR("Xilinx Inc.");
 MODULE_DESCRIPTION("Zynq GPIO driver");