* [PATCH] Staging: rts5208: Use module_pci_driver
@ 2015-03-09 5:17 Vaishali Thakkar
2015-03-09 6:01 ` Vaishali Thakkar
0 siblings, 1 reply; 4+ messages in thread
From: Vaishali Thakkar @ 2015-03-09 5:17 UTC (permalink / raw)
To: outreachy-kernel
Macro module_pci_driver is used for drivers whose init
and exit paths does only register and unregister to pci
API. So, here remove some boilerplate code by using
module_pci_driver.
Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
---
drivers/staging/rts5208/rtsx.c | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index c74f1b8..7f3f16a 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -1048,21 +1048,4 @@ static struct pci_driver driver = {
.shutdown = rtsx_shutdown,
};
-static int __init rtsx_init(void)
-{
- pr_info("Initializing Realtek PCIE storage driver...\n");
-
- return pci_register_driver(&driver);
-}
-
-static void __exit rtsx_exit(void)
-{
- pr_info("rtsx_exit() called\n");
-
- pci_unregister_driver(&driver);
-
- pr_info("%s module exit\n", CR_DRIVER_NAME);
-}
-
-module_init(rtsx_init)
-module_exit(rtsx_exit)
+module_pci_driver(driver);
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Staging: rts5208: Use module_pci_driver
2015-03-09 5:17 [PATCH] Staging: rts5208: Use module_pci_driver Vaishali Thakkar
@ 2015-03-09 6:01 ` Vaishali Thakkar
2015-03-09 12:34 ` [Outreachy kernel] " Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Vaishali Thakkar @ 2015-03-09 6:01 UTC (permalink / raw)
To: outreachy-kernel
On Mon, Mar 9, 2015 at 10:47 AM, Vaishali Thakkar
<vthakkar1994@gmail.com> wrote:
> Macro module_pci_driver is used for drivers whose init
> and exit paths does only register and unregister to pci
> API. So, here remove some boilerplate code by using
> module_pci_driver.
>
> Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
> ---
> drivers/staging/rts5208/rtsx.c | 19 +------------------
> 1 file changed, 1 insertion(+), 18 deletions(-)
>
> diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
> index c74f1b8..7f3f16a 100644
> --- a/drivers/staging/rts5208/rtsx.c
> +++ b/drivers/staging/rts5208/rtsx.c
> @@ -1048,21 +1048,4 @@ static struct pci_driver driver = {
> .shutdown = rtsx_shutdown,
> };
>
> -static int __init rtsx_init(void)
> -{
> - pr_info("Initializing Realtek PCIE storage driver...\n");
> -
> - return pci_register_driver(&driver);
> -}
> -
> -static void __exit rtsx_exit(void)
> -{
> - pr_info("rtsx_exit() called\n");
> -
> - pci_unregister_driver(&driver);
> -
> - pr_info("%s module exit\n", CR_DRIVER_NAME);
> -}
> -
> -module_init(rtsx_init)
> -module_exit(rtsx_exit)
> +module_pci_driver(driver);
> --
I am sorry for this patch. It has some issues.
So, please ignore this patch for sometime.
> 1.9.1
>
--
Vaishali
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] Re: [PATCH] Staging: rts5208: Use module_pci_driver
2015-03-09 6:01 ` Vaishali Thakkar
@ 2015-03-09 12:34 ` Greg KH
2015-03-09 14:37 ` Vaishali Thakkar
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2015-03-09 12:34 UTC (permalink / raw)
To: Vaishali Thakkar; +Cc: outreachy-kernel
On Mon, Mar 09, 2015 at 11:31:00AM +0530, Vaishali Thakkar wrote:
> On Mon, Mar 9, 2015 at 10:47 AM, Vaishali Thakkar
> <vthakkar1994@gmail.com> wrote:
> > Macro module_pci_driver is used for drivers whose init
> > and exit paths does only register and unregister to pci
> > API. So, here remove some boilerplate code by using
> > module_pci_driver.
> >
> > Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
> > ---
> > drivers/staging/rts5208/rtsx.c | 19 +------------------
> > 1 file changed, 1 insertion(+), 18 deletions(-)
> >
> > diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
> > index c74f1b8..7f3f16a 100644
> > --- a/drivers/staging/rts5208/rtsx.c
> > +++ b/drivers/staging/rts5208/rtsx.c
> > @@ -1048,21 +1048,4 @@ static struct pci_driver driver = {
> > .shutdown = rtsx_shutdown,
> > };
> >
> > -static int __init rtsx_init(void)
> > -{
> > - pr_info("Initializing Realtek PCIE storage driver...\n");
> > -
> > - return pci_register_driver(&driver);
> > -}
> > -
> > -static void __exit rtsx_exit(void)
> > -{
> > - pr_info("rtsx_exit() called\n");
> > -
> > - pci_unregister_driver(&driver);
> > -
> > - pr_info("%s module exit\n", CR_DRIVER_NAME);
> > -}
> > -
> > -module_init(rtsx_init)
> > -module_exit(rtsx_exit)
> > +module_pci_driver(driver);
> > --
>
> I am sorry for this patch. It has some issues.
What "issues"? It looks correct to me.
Yes, you delete the unneeded messages to the kernel log, which is a good
thing, and one reason why I want to see drivers move to these macros.
Am I missing something more obvious here?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] Re: [PATCH] Staging: rts5208: Use module_pci_driver
2015-03-09 12:34 ` [Outreachy kernel] " Greg KH
@ 2015-03-09 14:37 ` Vaishali Thakkar
0 siblings, 0 replies; 4+ messages in thread
From: Vaishali Thakkar @ 2015-03-09 14:37 UTC (permalink / raw)
To: Greg KH; +Cc: outreachy-kernel
On Mon, Mar 9, 2015 at 6:04 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Mon, Mar 09, 2015 at 11:31:00AM +0530, Vaishali Thakkar wrote:
>> On Mon, Mar 9, 2015 at 10:47 AM, Vaishali Thakkar
>> <vthakkar1994@gmail.com> wrote:
>> > Macro module_pci_driver is used for drivers whose init
>> > and exit paths does only register and unregister to pci
>> > API. So, here remove some boilerplate code by using
>> > module_pci_driver.
>> >
>> > Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
>> > ---
>> > drivers/staging/rts5208/rtsx.c | 19 +------------------
>> > 1 file changed, 1 insertion(+), 18 deletions(-)
>> >
>> > diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
>> > index c74f1b8..7f3f16a 100644
>> > --- a/drivers/staging/rts5208/rtsx.c
>> > +++ b/drivers/staging/rts5208/rtsx.c
>> > @@ -1048,21 +1048,4 @@ static struct pci_driver driver = {
>> > .shutdown = rtsx_shutdown,
>> > };
>> >
>> > -static int __init rtsx_init(void)
>> > -{
>> > - pr_info("Initializing Realtek PCIE storage driver...\n");
>> > -
>> > - return pci_register_driver(&driver);
>> > -}
>> > -
>> > -static void __exit rtsx_exit(void)
>> > -{
>> > - pr_info("rtsx_exit() called\n");
>> > -
>> > - pci_unregister_driver(&driver);
>> > -
>> > - pr_info("%s module exit\n", CR_DRIVER_NAME);
>> > -}
>> > -
>> > -module_init(rtsx_init)
>> > -module_exit(rtsx_exit)
>> > +module_pci_driver(driver);
>> > --
>>
>> I am sorry for this patch. It has some issues.
>
> What "issues"? It looks correct to me.
>
It has some build issues. These:
drivers/staging/rts5208/rtsx.c:1051:19: error: conflicting types for
‘driver_init’
module_pci_driver(driver);
^
include/linux/device.h:1258:19: note: in definition of macro ‘module_driver’
static int __init __driver##_init(void) \
^
drivers/staging/rts5208/rtsx.c:1051:1: note: in expansion of macro
‘module_pci_driver’
module_pci_driver(driver);
^
include/linux/device.h:919:6: note: previous declaration of
‘driver_init’ was here
void driver_init(void);
^
I already knew about them before sending this patch and I was trying
to figure out
the solution. I was supposed to send this patch to my ownself but by mistake
it was sent to mailing list. That's why I sent a message to ignore it.
I will be more careful next time before sending a patch.
> Yes, you delete the unneeded messages to the kernel log, which is a good
> thing, and one reason why I want to see drivers move to these macros.
>
> Am I missing something more obvious here?
>
> thanks,
>
> greg k-h
--
Vaishali
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-09 14:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-09 5:17 [PATCH] Staging: rts5208: Use module_pci_driver Vaishali Thakkar
2015-03-09 6:01 ` Vaishali Thakkar
2015-03-09 12:34 ` [Outreachy kernel] " Greg KH
2015-03-09 14:37 ` Vaishali Thakkar
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.