linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] staging: dgap: remove useless variable
@ 2014-08-09  5:36 Daeseok Youn
  2014-08-11 10:56 ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Daeseok Youn @ 2014-08-09  5:36 UTC (permalink / raw)
  To: lidza.louina, markh
  Cc: markh, daeseok.youn, gregkh, driverdev-devel, devel, linux-kernel

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.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
---
 drivers/staging/dgap/dgap.c |   48 +++++++++++++++++-------------------------
 drivers/staging/dgap/dgap.h |    3 --
 2 files changed, 20 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index ac12e99..55c06c9 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -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);
 }
 
 /*=======================================================================
diff --git a/drivers/staging/dgap/dgap.h b/drivers/staging/dgap/dgap.h
index 9728d59..0482a4c 100644
--- a/drivers/staging/dgap/dgap.h
+++ b/drivers/staging/dgap/dgap.h
@@ -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;
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/7] staging: dgap: remove useless variable
  2014-08-09  5:36 [PATCH 1/7] staging: dgap: remove useless variable Daeseok Youn
@ 2014-08-11 10:56 ` Dan Carpenter
  2014-08-12  0:28   ` DaeSeok Youn
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2014-08-11 10:56 UTC (permalink / raw)
  To: Daeseok Youn
  Cc: lidza.louina, markh, devel, gregkh, driverdev-devel, linux-kernel

On Sat, Aug 09, 2014 at 02:36:44PM +0900, Daeseok Youn wrote:
> 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.

I don't understand.  What about the call to dgap_cleanup_module() in
dgap_init_module()?

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/7] staging: dgap: remove useless variable
  2014-08-11 10:56 ` Dan Carpenter
@ 2014-08-12  0:28   ` DaeSeok Youn
  2014-08-13  9:22     ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: DaeSeok Youn @ 2014-08-12  0:28 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Lidza Louina, Mark Hounschell, devel, Greg KH, driverdev-devel,
	linux-kernel

Hi, Dan

2014-08-11 19:56 GMT+09:00 Dan Carpenter <dan.carpenter@oracle.com>:
> On Sat, Aug 09, 2014 at 02:36:44PM +0900, Daeseok Youn wrote:
>> 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.
>
> I don't understand.  What about the call to dgap_cleanup_module() in
> dgap_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.
>
> regards,
> dan carpenter
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/7] staging: dgap: remove useless variable
  2014-08-12  0:28   ` DaeSeok Youn
@ 2014-08-13  9:22     ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2014-08-13  9:22 UTC (permalink / raw)
  To: DaeSeok Youn
  Cc: Lidza Louina, Mark Hounschell, devel, Greg KH, driverdev-devel,
	linux-kernel

On Tue, Aug 12, 2014 at 09:28:13AM +0900, DaeSeok Youn wrote:
> Hi, Dan
> 
> 2014-08-11 19:56 GMT+09:00 Dan Carpenter <dan.carpenter@oracle.com>:
> > On Sat, Aug 09, 2014 at 02:36:44PM +0900, Daeseok Youn wrote:
> >> 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.
> >
> > I don't understand.  What about the call to dgap_cleanup_module() in
> > dgap_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.

Ah.  Ok.  Thanks for the explanation.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-13  9:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-09  5:36 [PATCH 1/7] staging: dgap: remove useless variable Daeseok Youn
2014-08-11 10:56 ` Dan Carpenter
2014-08-12  0:28   ` DaeSeok Youn
2014-08-13  9:22     ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).