Skip to contentSkip to conversation

staging: dgnc: Code cleaup

PATCH New Pankaj Bharadiya 1 participant 3 messages Oct 17, 2016 Staging

lore
Share & tools
lore
#0 lore raw

v2 cover staging: dgnc: Code cleaup

Hi,

This patchset does minor cleanup for dgnc driver.

v1->v2:
- Split into multiple patches
- remove redundant dgnc_tmp_write_buf variable and function calls
- rename dgnc_default_termios to default_termios

Pankaj Bharadiya (2):
staging: dgnc: Remove some redundant functions
staging: dgnc: Replace CamelCase namings with underscores

 drivers/staging/dgnc/dgnc_driver.c | 13 ----------
 drivers/staging/dgnc/dgnc_tty.c    | 51 ++++----------------------------------
 drivers/staging/dgnc/dgnc_tty.h    |  2 --
 3 files changed, 5 insertions(+), 61 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/2 staging: dgnc: Remove some redundant functions

dgnc_tty_preinit() and dgnc_tty_post_uninit() functions are used to allocate and free "dgnc_TmpWriteBuf" and this "dgnc_TmpWriteBuf" is not really getting used. Hence remove these redundant functions.

Also remove dgnc_TmpWriteBuf variable as it is not used anymore.

---
 drivers/staging/dgnc/dgnc_driver.c | 13 -----------
 drivers/staging/dgnc/dgnc_tty.c    | 45 ++------------------------------------
 drivers/staging/dgnc/dgnc_tty.h    |  2 --
 3 files changed, 2 insertions(+), 58 deletions(-)
drivers/staging/dgnc/dgnc_driver.c +0 -13
index fd372d3..0fe7e85 100644
@@ -151,7 +151,6 @@ static void cleanup(bool sysfiles)
 		dgnc_cleanup_board(dgnc_board[i]);
 	}
 
-	dgnc_tty_post_uninit();
 }
 
 /*
@@ -241,16 +240,6 @@ static int dgnc_start(void)
 		goto failed_device;
 	}
 
-	/*
-	 * Init any global tty stuff.
-	 */
-	rc = dgnc_tty_preinit();
-
-	if (rc < 0) {
-		pr_err(DRVSTR ": tty preinit - not enough memory (%d)\n", rc);
-		goto failed_tty;
-	}
-
 	/* Start the poller */
 	spin_lock_irqsave(&dgnc_poll_lock, flags);
 	setup_timer(&dgnc_poll_timer, dgnc_poll_handler, 0);
@@ -262,8 +251,6 @@ static int dgnc_start(void)
 
 	return 0;
 
-failed_tty:
-	device_destroy(dgnc_class, MKDEV(dgnc_major, 0));
 failed_device:
 	class_destroy(dgnc_class);
 failed_class:
drivers/staging/dgnc/dgnc_tty.c +2 -43

75 lines not on this page · raw message

drivers/staging/dgnc/dgnc_tty.h +0 -2
index 24c9a41..85a1310 100644
@@ -21,10 +21,8 @@
 int	dgnc_tty_register(struct dgnc_board *brd);
 void dgnc_tty_unregister(struct dgnc_board *brd);
 
-int	dgnc_tty_preinit(void);
 int     dgnc_tty_init(struct dgnc_board *);
 
-void	dgnc_tty_post_uninit(void);
 void	dgnc_cleanup_tty(struct dgnc_board *);
 
 void	dgnc_input(struct channel_t *ch);
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/2 staging: dgnc: Replace CamelCase namings with underscores

In reply to Pankaj Bharadiya

Replace CamelCase names with underscores to comply with the standard kernel coding style.

---
 drivers/staging/dgnc/dgnc_tty.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/dgnc/dgnc_tty.c +3 -3
index 8d557fa..52af3ef 100644
@@ -64,7 +64,7 @@
  * This defines a raw port at 9600 baud, 8 data bits, no parity,
  * 1 stop bit.
  */
-static struct ktermios DgncDefaultTermios = {
+static struct ktermios default_termios = {
 	.c_iflag =	(DEFAULT_IFLAGS),	/* iflags */
 	.c_oflag =	(DEFAULT_OFLAGS),	/* oflags */
 	.c_cflag =	(DEFAULT_CFLAGS),	/* cflags */
@@ -164,7 +164,7 @@ int dgnc_tty_register(struct dgnc_board *brd)
 	brd->serial_driver->minor_start = 0;
 	brd->serial_driver->type = TTY_DRIVER_TYPE_SERIAL;
 	brd->serial_driver->subtype = SERIAL_TYPE_NORMAL;
-	brd->serial_driver->init_termios = DgncDefaultTermios;
+	brd->serial_driver->init_termios = default_termios;
 	brd->serial_driver->driver_name = DRVSTR;
 
 	/*
@@ -203,7 +203,7 @@ int dgnc_tty_register(struct dgnc_board *brd)
 	brd->print_driver->minor_start = 0x80;
 	brd->print_driver->type = TTY_DRIVER_TYPE_SERIAL;
 	brd->print_driver->subtype = SERIAL_TYPE_NORMAL;
-	brd->print_driver->init_termios = DgncDefaultTermios;
+	brd->print_driver->init_termios = default_termios;
 	brd->print_driver->driver_name = DRVSTR;
 
 	/*
Signature · 1 line
1.9.1