Skip to content

Commit 1e88100

Browse files
Konrad Zapalowiczgregkh
Konrad Zapalowicz
authored andcommitted
staging: dgnc: Fix externs should be avoided in the .c files
This commit fixes the following checkpatch warnings: WARNING: externs should be avoided in .c files torvalds#80: FILE: drivers/staging/dgnc/dgnc_driver.c:80: +int dgnc_init_module(void); torvalds#81: FILE: drivers/staging/dgnc/dgnc_driver.c:81: +void dgnc_cleanup_module(void); This was caused by putting the declarations for module init and module exit fucntions on the top of the file. The fix removes these declarations plus it also corrects the type of the init/exit functions. Due to the dependency between init and exit functions the dgnc_cleanup_module had to be put first. Signed-off-by: Konrad Zapalowicz <bergo.torino@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d14b712 commit 1e88100

File tree

1 file changed

+39
-45
lines changed

1 file changed

+39
-45
lines changed

drivers/staging/dgnc/dgnc_driver.c

+39-45
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,6 @@ static void dgnc_remove_one(struct pci_dev *dev);
7676
static int dgnc_probe1(struct pci_dev *pdev, int card_type);
7777
static void dgnc_do_remap(struct dgnc_board *brd);
7878

79-
/* Driver load/unload functions */
80-
int dgnc_init_module(void);
81-
void dgnc_cleanup_module(void);
82-
83-
module_init(dgnc_init_module);
84-
module_exit(dgnc_cleanup_module);
8579

8680

8781
/*
@@ -199,13 +193,49 @@ char *dgnc_driver_state_text[] = {
199193
*
200194
************************************************************************/
201195

196+
/*
197+
* dgnc_cleanup_module()
198+
*
199+
* Module unload. This is where it all ends.
200+
*/
201+
static void dgnc_cleanup_module(void)
202+
{
203+
int i;
204+
ulong lock_flags;
205+
206+
DGNC_LOCK(dgnc_poll_lock, lock_flags);
207+
dgnc_poll_stop = 1;
208+
DGNC_UNLOCK(dgnc_poll_lock, lock_flags);
209+
210+
/* Turn off poller right away. */
211+
del_timer_sync(&dgnc_poll_timer);
212+
213+
dgnc_remove_driver_sysfiles(&dgnc_driver);
214+
215+
if (dgnc_Major_Control_Registered) {
216+
device_destroy(dgnc_class, MKDEV(dgnc_Major, 0));
217+
class_destroy(dgnc_class);
218+
unregister_chrdev(dgnc_Major, "dgnc");
219+
}
220+
221+
for (i = 0; i < dgnc_NumBoards; ++i) {
222+
dgnc_remove_ports_sysfiles(dgnc_Board[i]);
223+
dgnc_tty_uninit(dgnc_Board[i]);
224+
dgnc_cleanup_board(dgnc_Board[i]);
225+
}
226+
227+
dgnc_tty_post_uninit();
228+
229+
if (dgnc_NumBoards)
230+
pci_unregister_driver(&dgnc_driver);
231+
}
202232

203233
/*
204234
* init_module()
205235
*
206236
* Module load. This is where it all starts.
207237
*/
208-
int dgnc_init_module(void)
238+
static int __init dgnc_init_module(void)
209239
{
210240
int rc = 0;
211241

@@ -243,6 +273,8 @@ int dgnc_init_module(void)
243273
return rc;
244274
}
245275

276+
module_init(dgnc_init_module);
277+
module_exit(dgnc_cleanup_module);
246278

247279
/*
248280
* Start of driver.
@@ -354,44 +386,6 @@ static void dgnc_remove_one(struct pci_dev *dev)
354386
/* Do Nothing */
355387
}
356388

357-
/*
358-
* dgnc_cleanup_module()
359-
*
360-
* Module unload. This is where it all ends.
361-
*/
362-
void dgnc_cleanup_module(void)
363-
{
364-
int i;
365-
ulong lock_flags;
366-
367-
DGNC_LOCK(dgnc_poll_lock, lock_flags);
368-
dgnc_poll_stop = 1;
369-
DGNC_UNLOCK(dgnc_poll_lock, lock_flags);
370-
371-
/* Turn off poller right away. */
372-
del_timer_sync(&dgnc_poll_timer);
373-
374-
dgnc_remove_driver_sysfiles(&dgnc_driver);
375-
376-
if (dgnc_Major_Control_Registered) {
377-
device_destroy(dgnc_class, MKDEV(dgnc_Major, 0));
378-
class_destroy(dgnc_class);
379-
unregister_chrdev(dgnc_Major, "dgnc");
380-
}
381-
382-
for (i = 0; i < dgnc_NumBoards; ++i) {
383-
dgnc_remove_ports_sysfiles(dgnc_Board[i]);
384-
dgnc_tty_uninit(dgnc_Board[i]);
385-
dgnc_cleanup_board(dgnc_Board[i]);
386-
}
387-
388-
dgnc_tty_post_uninit();
389-
390-
if (dgnc_NumBoards)
391-
pci_unregister_driver(&dgnc_driver);
392-
}
393-
394-
395389
/*
396390
* dgnc_cleanup_board()
397391
*

0 commit comments

Comments
 (0)