mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pankaj Bharadiya <pankaj.bharadiya@gmail.com>
To: gregkh@linuxfoundation.org, lidza.louina@gmail.com
Cc: markh@compro.net, driverdev-devel@linuxdriverproject.org,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/2] staging: dgnc: Remove some redundant functions
Date: Mon, 17 Oct 2016 16:17:07 +0530	[thread overview]
Message-ID: <1476701228-6761-2-git-send-email-pankaj.bharadiya@gmail.com> (raw)
In-Reply-To: <1476701228-6761-1-git-send-email-pankaj.bharadiya@gmail.com>

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.

Signed-off-by: Pankaj Bharadiya <pankaj.bharadiya@gmail.com>
---
 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(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
index fd372d3..0fe7e85 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -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:
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index ef9a45b..8d557fa 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -43,11 +43,6 @@
 #include "dgnc_utils.h"
 
 /*
- * internal variables
- */
-static unsigned char		*dgnc_TmpWriteBuf;
-
-/*
  * Default transparent print information.
  */
 static struct digi_t dgnc_digi_init = {
@@ -144,31 +139,6 @@ static void dgnc_tty_set_termios(struct tty_struct *tty,
  ************************************************************************/
 
 /*
- * dgnc_tty_preinit()
- *
- * Initialize any global tty related data before we download any boards.
- */
-int dgnc_tty_preinit(void)
-{
-	/*
-	 * Allocate a buffer for doing the copy from user space to
-	 * kernel space in dgnc_write().  We only use one buffer and
-	 * control access to it with a semaphore.  If we are paging, we
-	 * are already in trouble so one buffer won't hurt much anyway.
-	 *
-	 * We are okay to sleep in the malloc, as this routine
-	 * is only called during module load, (not in interrupt context),
-	 * and with no locks held.
-	 */
-	dgnc_TmpWriteBuf = kmalloc(WRITEBUFLEN, GFP_KERNEL);
-
-	if (!dgnc_TmpWriteBuf)
-		return -ENOMEM;
-
-	return 0;
-}
-
-/*
  * dgnc_tty_register()
  *
  * Init the tty subsystem for this board.
@@ -365,17 +335,6 @@ int dgnc_tty_init(struct dgnc_board *brd)
 }
 
 /*
- * dgnc_tty_post_uninit()
- *
- * UnInitialize any global tty related data.
- */
-void dgnc_tty_post_uninit(void)
-{
-	kfree(dgnc_TmpWriteBuf);
-	dgnc_TmpWriteBuf = NULL;
-}
-
-/*
  * dgnc_cleanup_tty()
  *
  * Uninitialize the TTY portion of this driver.  Free all memory and
@@ -1543,7 +1502,7 @@ static int dgnc_tty_write_room(struct tty_struct *tty)
 	int ret = 0;
 	unsigned long flags;
 
-	if (!tty || !dgnc_TmpWriteBuf)
+	if (!tty)
 		return 0;
 
 	un = tty->driver_data;
@@ -1623,7 +1582,7 @@ static int dgnc_tty_write(struct tty_struct *tty,
 	ushort tmask;
 	uint remain;
 
-	if (!tty || !dgnc_TmpWriteBuf)
+	if (!tty)
 		return 0;
 
 	un = tty->driver_data;
diff --git a/drivers/staging/dgnc/dgnc_tty.h b/drivers/staging/dgnc/dgnc_tty.h
index 24c9a41..85a1310 100644
--- a/drivers/staging/dgnc/dgnc_tty.h
+++ b/drivers/staging/dgnc/dgnc_tty.h
@@ -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);
-- 
1.9.1

  reply	other threads:[~2016-10-17 10:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 10:47 [PATCH v2 0/2] staging: dgnc: Code cleaup Pankaj Bharadiya
2016-10-17 10:47 ` Pankaj Bharadiya [this message]
2016-10-17 10:47 ` [PATCH v2 2/2] staging: dgnc: Replace CamelCase namings with underscores Pankaj Bharadiya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476701228-6761-2-git-send-email-pankaj.bharadiya@gmail.com \
    --to=pankaj.bharadiya@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lidza.louina@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markh@compro.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®