staging: dgap: remove useless variable
PATCH 1/7 staging: dgap: remove useless variable
dgap_major_serial_registered and dgap_major_transparent_print_registered could be checked whether a board is initialized.
But it doesn't need to check that variables becasue dgap module isn't calling the dgap_cleanup_tty() without initializing for a board completely.
--- drivers/staging/dgap/dgap.c | 48 +++++++++++++++++------------------------- drivers/staging/dgap/dgap.h | 3 -- 2 files changed, 20 insertions(+), 31 deletions(-)
drivers/staging/dgap/dgap.c +22 -30
@@ -1320,11 +1320,9 @@ static int dgap_tty_register(struct board_t *brd)if (rc <0 ) goto unregister_serial_drv; - brd->dgap_major_serial_registered = TRUE; dgap_boards_by_major[brd->serial_driver->major] = brd; brd->dgap_serial_major = brd->serial_driver->major; - brd->dgap_major_transparent_print_registered = TRUE; dgap_boards_by_major[brd->print_driver->major] = brd; brd->dgap_transparent_print_major = brd->print_driver->major;
@@ -1544,35 +1542,29 @@ static void dgap_cleanup_tty(struct board_t *brd)struct device *dev;int i; -if (brd->dgap_major_serial_registered) { - dgap_boards_by_major[brd->serial_driver->major] =NULL ; - brd->dgap_serial_major =0 ; -for (i =0 ; i < brd->nasync; i++) { -tty_port_destroy (&brd->serial_ports[i]); - dev = brd->channels[i]->ch_tun.un_sysfs; -dgap_remove_tty_sysfs (dev); -tty_unregister_device (brd->serial_driver, i); - } -tty_unregister_driver (brd->serial_driver); -put_tty_driver (brd->serial_driver); -kfree (brd->serial_ports); - brd->dgap_major_serial_registered = FALSE; - } - -if (brd->dgap_major_transparent_print_registered) { - dgap_boards_by_major[brd->print_driver->major] =NULL ; - brd->dgap_transparent_print_major =0 ; -for (i =0 ; i < brd->nasync; i++) { -tty_port_destroy (&brd->printer_ports[i]); - dev = brd->channels[i]->ch_pun.un_sysfs; -dgap_remove_tty_sysfs (dev); -tty_unregister_device (brd->print_driver, i); - } -tty_unregister_driver (brd->print_driver); -put_tty_driver (brd->print_driver); -kfree (brd->printer_ports); - brd->dgap_major_transparent_print_registered = FALSE; + dgap_boards_by_major[brd->serial_driver->major] =NULL ; + brd->dgap_serial_major =0 ; +for (i =0 ; i < brd->nasync; i++) { +tty_port_destroy (&brd->serial_ports[i]); + dev = brd->channels[i]->ch_tun.un_sysfs; +dgap_remove_tty_sysfs (dev); +tty_unregister_device (brd->serial_driver, i); + } +tty_unregister_driver (brd->serial_driver); +put_tty_driver (brd->serial_driver); +kfree (brd->serial_ports); + + dgap_boards_by_major[brd->print_driver->major] =NULL ; + brd->dgap_transparent_print_major =0 ; +for (i =0 ; i < brd->nasync; i++) { +tty_port_destroy (&brd->printer_ports[i]); + dev = brd->channels[i]->ch_pun.un_sysfs; +dgap_remove_tty_sysfs (dev); +tty_unregister_device (brd->print_driver, i); } +tty_unregister_driver (brd->print_driver); +put_tty_driver (brd->print_driver); +kfree (brd->printer_ports); }/*=======================================================================
drivers/staging/dgap/dgap.h +0 -3
@@ -586,9 +586,6 @@ struct board_t {struct tty_port *printer_ports;char print_name[200 ]; -u32 dgap_major_serial_registered; -u32 dgap_major_transparent_print_registered; -u32 dgap_serial_major;u32 dgap_transparent_print_major;
Signature · 1 line
1.7.1
Quoted 5 lines · Daeseok Youn
dgap_major_serial_registeredanddgap_major_transparent_print_registeredcould be checked whether a board is initialized.
But it doesn't need to check that variables becasue dgap module isn't calling thedgap_cleanup_tty()without initializing for a board completely.
I don't understand. What about the call to dgap_cleanup_module() in dgap_init_module()?
regards,
dan carpenter
Hi, Dan
2014-08-11 19:56 GMT+09:00 Dan Carpenter <[email protected]>:
Quoted 9 lines · Daeseok Youn
Quoted 5 lines
dgap_major_serial_registeredanddgap_major_transparent_print_registeredcould be checked whether a board is initialized.
But it doesn't need to check that variables becasue dgap module isn't calling thedgap_cleanup_tty()without initializing for a board completely.I don't understand. What about the call to
dgap_cleanup_module()indgap_init_module()?
I think the call of dgap_cleanup_tty()
in dgap_cleanup_module() from dgap_init_module() is not reached. Because dgap_init_module() is called when driver is loaded, at this point of time,
there are no boards that are initialized.(dgap_numboards is zero)
And the change log of this is needed to modify for clearing message.
Thanks.
regards,
Daeseok Youn.
Quoted 4 lines
regards,
dan carpenter
Dan Carpenter
Reviewed-byQuoted 12 lines · DaeSeok Youn
Hi, Dan
2014-08-11 19:56 GMT+09:00 Dan Carpenter <[email protected]>:
Quoted 9 lines · Daeseok Youn
Quoted 5 lines
dgap_major_serial_registeredanddgap_major_transparent_print_registeredcould be checked whether a board is initialized.
But it doesn't need to check that variables becasue dgap module isn't calling thedgap_cleanup_tty()without initializing for a board completely.I don't understand. What about the call to
dgap_cleanup_module()indgap_init_module()?
Quoted 7 lines
I think the call of
dgap_cleanup_tty()
indgap_cleanup_module()fromdgap_init_module()is not reached. Becausedgap_init_module()is called when driver is loaded, at this point of time,
there are no boards that are initialized.(dgap_numboards is zero)And the change log of this is needed to modify for clearing message.
Ah. Ok. Thanks for the explanation.
regards,
dan carpenter