linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: gregkh@linuxfoundation.org
Cc: alan@linux.intel.com, linux-kernel@vger.kernel.org,
	jirislaby@gmail.com, Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-m68k@vger.kernel.org
Subject: [PATCH 51/69] TTY: 68328serial, remove serial_state and friends
Date: Mon,  2 Apr 2012 13:54:35 +0200	[thread overview]
Message-ID: <1333367693-3244-52-git-send-email-jslaby@suse.cz> (raw)
In-Reply-To: <1333367693-3244-1-git-send-email-jslaby@suse.cz>

serial_state in 68328serial.h is a duplicated structure. One is
defined in linux/serial.h. So let us use that instead. And since the
serial flags are identical, use ones from there too.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
---
 drivers/tty/serial/68328serial.c |   55 +++++++++++----------------
 drivers/tty/serial/68328serial.h |   76 --------------------------------------
 2 files changed, 22 insertions(+), 109 deletions(-)

diff --git a/drivers/tty/serial/68328serial.c b/drivers/tty/serial/68328serial.c
index 5ce7825..bf5f811 100644
--- a/drivers/tty/serial/68328serial.c
+++ b/drivers/tty/serial/68328serial.c
@@ -17,6 +17,7 @@
 #include <asm/dbg.h>
 #include <linux/module.h>
 #include <linux/errno.h>
+#include <linux/serial.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/timer.h>
@@ -79,18 +80,6 @@ struct m68k_serial *m68k_consinfo = 0;
 
 struct tty_driver *serial_driver;
 
-/* number of characters left in xmit buffer before we ask for more */
-#define WAKEUP_CHARS 256
-
-/* Debugging... DEBUG_INTR is bad to use when one of the zs
- * lines is your console ;(
- */
-#undef SERIAL_DEBUG_INTR
-#undef SERIAL_DEBUG_OPEN
-#undef SERIAL_DEBUG_FLOW
-
-#define RS_ISR_PASS_LIMIT 256
-
 static void change_speed(struct m68k_serial *info);
 
 /*
@@ -363,7 +352,7 @@ static int startup(struct m68k_serial * info)
 	m68328_uart *uart = &uart_addr[info->line];
 	unsigned long flags;
 	
-	if (info->flags & S_INITIALIZED)
+	if (info->flags & ASYNC_INITIALIZED)
 		return 0;
 
 	if (!info->xmit_buf) {
@@ -404,7 +393,7 @@ static int startup(struct m68k_serial * info)
 
 	change_speed(info);
 
-	info->flags |= S_INITIALIZED;
+	info->flags |= ASYNC_INITIALIZED;
 	local_irq_restore(flags);
 	return 0;
 }
@@ -419,7 +408,7 @@ static void shutdown(struct m68k_serial * info)
 	unsigned long	flags;
 
 	uart->ustcnt = 0; /* All off! */
-	if (!(info->flags & S_INITIALIZED))
+	if (!(info->flags & ASYNC_INITIALIZED))
 		return;
 
 	local_irq_save(flags);
@@ -432,7 +421,7 @@ static void shutdown(struct m68k_serial * info)
 	if (info->tty)
 		set_bit(TTY_IO_ERROR, &info->tty->flags);
 	
-	info->flags &= ~S_INITIALIZED;
+	info->flags &= ~ASYNC_INITIALIZED;
 	local_irq_restore(flags);
 }
 
@@ -835,11 +824,11 @@ static int set_serial_info(struct m68k_serial * info,
 		if ((new_serial.baud_base != info->baud_base) ||
 		    (new_serial.type != info->type) ||
 		    (new_serial.close_delay != info->close_delay) ||
-		    ((new_serial.flags & ~S_USR_MASK) !=
-		     (info->flags & ~S_USR_MASK)))
+		    ((new_serial.flags & ~ASYNC_USR_MASK) !=
+		     (info->flags & ~ASYNC_USR_MASK)))
 			return -EPERM;
-		info->flags = ((info->flags & ~S_USR_MASK) |
-			       (new_serial.flags & S_USR_MASK));
+		info->flags = ((info->flags & ~ASYNC_USR_MASK) |
+			       (new_serial.flags & ASYNC_USR_MASK));
 		info->custom_divisor = new_serial.custom_divisor;
 		goto check_and_exit;
 	}
@@ -853,8 +842,8 @@ static int set_serial_info(struct m68k_serial * info,
 	 */
 
 	info->baud_base = new_serial.baud_base;
-	info->flags = ((info->flags & ~S_FLAGS) |
-			(new_serial.flags & S_FLAGS));
+	info->flags = ((info->flags & ~ASYNC_FLAGS) |
+			(new_serial.flags & ASYNC_FLAGS));
 	info->type = new_serial.type;
 	info->close_delay = new_serial.close_delay;
 	info->closing_wait = new_serial.closing_wait;
@@ -1022,13 +1011,13 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
 		local_irq_restore(flags);
 		return;
 	}
-	info->flags |= S_CLOSING;
+	info->flags |= ASYNC_CLOSING;
 	/*
 	 * Now we wait for the transmit buffer to clear; and we notify 
 	 * the line discipline to only process XON/XOFF characters.
 	 */
 	tty->closing = 1;
-	if (info->closing_wait != S_CLOSING_WAIT_NONE)
+	if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE)
 		tty_wait_until_sent(tty, info->closing_wait);
 	/*
 	 * At this point we stop accepting input.  To do this, we
@@ -1064,7 +1053,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
 		}
 		wake_up_interruptible(&info->open_wait);
 	}
-	info->flags &= ~(S_NORMAL_ACTIVE|S_CLOSING);
+	info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
 	wake_up_interruptible(&info->close_wait);
 	local_irq_restore(flags);
 }
@@ -1083,7 +1072,7 @@ void rs_hangup(struct tty_struct *tty)
 	shutdown(info);
 	info->event = 0;
 	info->count = 0;
-	info->flags &= ~S_NORMAL_ACTIVE;
+	info->flags &= ~ASYNC_NORMAL_ACTIVE;
 	info->tty = NULL;
 	wake_up_interruptible(&info->open_wait);
 }
@@ -1104,10 +1093,10 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
 	 * If the device is in the middle of being closed, then block
 	 * until it's done, and then try again.
 	 */
-	if (info->flags & S_CLOSING) {
+	if (info->flags & ASYNC_CLOSING) {
 		interruptible_sleep_on(&info->close_wait);
 #ifdef SERIAL_DO_RESTART
-		if (info->flags & S_HUP_NOTIFY)
+		if (info->flags & ASYNC_HUP_NOTIFY)
 			return -EAGAIN;
 		else
 			return -ERESTARTSYS;
@@ -1122,7 +1111,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
 	 */
 	if ((filp->f_flags & O_NONBLOCK) ||
 	    (tty->flags & (1 << TTY_IO_ERROR))) {
-		info->flags |= S_NORMAL_ACTIVE;
+		info->flags |= ASYNC_NORMAL_ACTIVE;
 		return 0;
 	}
 
@@ -1147,9 +1136,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
 		local_irq_enable();
 		current->state = TASK_INTERRUPTIBLE;
 		if (tty_hung_up_p(filp) ||
-		    !(info->flags & S_INITIALIZED)) {
+		    !(info->flags & ASYNC_INITIALIZED)) {
 #ifdef SERIAL_DO_RESTART
-			if (info->flags & S_HUP_NOTIFY)
+			if (info->flags & ASYNC_HUP_NOTIFY)
 				retval = -EAGAIN;
 			else
 				retval = -ERESTARTSYS;	
@@ -1158,7 +1147,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
 #endif
 			break;
 		}
-		if (!(info->flags & S_CLOSING) && do_clocal)
+		if (!(info->flags & ASYNC_CLOSING) && do_clocal)
 			break;
                 if (signal_pending(current)) {
 			retval = -ERESTARTSYS;
@@ -1176,7 +1165,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
 
 	if (retval)
 		return retval;
-	info->flags |= S_NORMAL_ACTIVE;
+	info->flags |= ASYNC_NORMAL_ACTIVE;
 	return 0;
 }	
 
diff --git a/drivers/tty/serial/68328serial.h b/drivers/tty/serial/68328serial.h
index 3d2faab..a804ea5 100644
--- a/drivers/tty/serial/68328serial.h
+++ b/drivers/tty/serial/68328serial.h
@@ -11,69 +11,6 @@
 #ifndef _MC683XX_SERIAL_H
 #define _MC683XX_SERIAL_H
 
-
-struct serial_struct {
-	int	type;
-	int	line;
-	int	port;
-	int	irq;
-	int	flags;
-	int	xmit_fifo_size;
-	int	custom_divisor;
-	int	baud_base;
-	unsigned short	close_delay;
-	char	reserved_char[2];
-	int	hub6;  /* FIXME: We don't have AT&T Hub6 boards! */
-	unsigned short	closing_wait; /* time to wait before closing */
-	unsigned short	closing_wait2; /* no longer used... */
-	int	reserved[4];
-};
-
-/*
- * For the close wait times, 0 means wait forever for serial port to
- * flush its output.  65535 means don't wait at all.
- */
-#define S_CLOSING_WAIT_INF	0
-#define S_CLOSING_WAIT_NONE	65535
-
-/*
- * Definitions for S_struct (and serial_struct) flags field
- */
-#define S_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes 
-				   on the callout port */
-#define S_FOURPORT  0x0002	/* Set OU1, OUT2 per AST Fourport settings */
-#define S_SAK	0x0004	/* Secure Attention Key (Orange book) */
-#define S_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
-
-#define S_SPD_MASK	0x0030
-#define S_SPD_HI	0x0010	/* Use 56000 instead of 38400 bps */
-
-#define S_SPD_VHI	0x0020  /* Use 115200 instead of 38400 bps */
-#define S_SPD_CUST	0x0030  /* Use user-specified divisor */
-
-#define S_SKIP_TEST	0x0040 /* Skip UART test during autoconfiguration */
-#define S_AUTO_IRQ  0x0080 /* Do automatic IRQ during autoconfiguration */
-#define S_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
-#define S_PGRP_LOCKOUT    0x0200 /* Lock out cua opens based on pgrp */
-#define S_CALLOUT_NOHUP   0x0400 /* Don't do hangups for cua device */
-
-#define S_FLAGS	0x0FFF	/* Possible legal S flags */
-#define S_USR_MASK 0x0430	/* Legal flags that non-privileged
-				 * users can set or reset */
-
-/* Internal flags used only by kernel/chr_drv/serial.c */
-#define S_INITIALIZED	0x80000000 /* Serial port was initialized */
-#define S_CALLOUT_ACTIVE	0x40000000 /* Call out device is active */
-#define S_NORMAL_ACTIVE	0x20000000 /* Normal device is active */
-#define S_BOOT_AUTOCONF	0x10000000 /* Autoconfigure port on bootup */
-#define S_CLOSING		0x08000000 /* Serial port is closing */
-#define S_CTS_FLOW		0x04000000 /* Do CTS flow control */
-#define S_CHECK_CD		0x02000000 /* i.e., CLOCAL */
-
-/* Software state per channel */
-
-#ifdef __KERNEL__
-
 /*
  * I believe this is the optimal setting that reduces the number of interrupts.
  * At high speeds the output might become a little "bursted" (use USTCNT_TXHE
@@ -162,25 +99,12 @@ struct m68k_serial {
 	wait_queue_head_t	close_wait;
 };
 
-
 #define SERIAL_MAGIC 0x5301
 
-/*
- * The size of the serial xmit buffer is 1 page, or 4096 bytes
- */
-#define SERIAL_XMIT_SIZE 4096
-
-/*
- * Events are used to schedule things to happen at timer-interrupt
- * time, instead of at rs interrupt time.
- */
-#define RS_EVENT_WRITE_WAKEUP	0
-
 /* 
  * Define the number of ports supported and their irqs.
  */
 #define NR_PORTS 1
 #define UART_IRQ_DEFNS {UART_IRQ_NUM}
 
-#endif /* __KERNEL__ */
 #endif /* !(_MC683XX_SERIAL_H) */
-- 
1.7.9.2



  parent reply	other threads:[~2012-04-02 11:56 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-02 11:53 [PATCH 00/69] TTY buffer in tty_port -- prep no. 2 Jiri Slaby
2012-04-02 11:53 ` [PATCH 01/69] TTY: crisv10, remove unused tmp_buf Jiri Slaby
2012-04-03 11:47   ` Jesper Nilsson
2012-04-02 11:53 ` [PATCH 02/69] TTY: crisv10, initialize tty_port Jiri Slaby
2012-04-03 11:47   ` Jesper Nilsson
2012-04-02 11:53 ` [PATCH 03/69] TTY: deprecate linux/generic_serial.h Jiri Slaby
2012-04-02 11:53 ` [PATCH 04/69] ISDN: i4l, remove cvs crap Jiri Slaby
2012-04-02 11:53 ` [PATCH 05/69] TTY: isdn, remove callout Jiri Slaby
2012-04-02 11:53 ` [PATCH 06/69] TTY: isdn, remove ISDN_ASYNC_* flags Jiri Slaby
2012-04-02 11:53 ` [PATCH 07/69] TTY: isdn, do not play with module refcounts Jiri Slaby
2012-04-02 11:53 ` [PATCH 08/69] TTY: isdn, make some functions readable Jiri Slaby
2012-04-02 11:53 ` [PATCH 09/69] TTY: isdn, remove unused members from modem_info Jiri Slaby
2012-04-02 11:53 ` [PATCH 10/69] TTY: isdn, add tty_port Jiri Slaby
2012-04-02 11:53 ` [PATCH 11/69] TTY: isdn, use open/close_wait from tty_port Jiri Slaby
2012-04-02 11:53 ` [PATCH 12/69] TTY: isdn, use counts " Jiri Slaby
2012-04-02 11:53 ` [PATCH 13/69] TTY: isdn, use tty " Jiri Slaby
2012-04-02 11:53 ` [PATCH 14/69] TTY: isdn, use xmit_buf " Jiri Slaby
2012-04-02 11:53 ` [PATCH 15/69] TTY: isdn, define local tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 16/69] TTY: isdn, use tty_port_close_end helper Jiri Slaby
2012-04-02 11:54 ` [PATCH 17/69] TTY: isdn, define tty_port_operations Jiri Slaby
2012-04-02 11:54 ` [PATCH 18/69] TTY: isdn, use tty_port_block_til_ready helper Jiri Slaby
2012-04-02 11:54 ` [PATCH 19/69] TTY: hso, do not set TTY MAGIC Jiri Slaby
2012-04-02 11:54 ` [PATCH 20/69] TTY: hso, free tty_driver Jiri Slaby
2012-04-02 11:54 ` [PATCH 21/69] TTY: hso, add tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 22/69] TTY: hso, remove tty NULL checks fro tty->ops Jiri Slaby
2012-04-02 11:54 ` [PATCH 23/69] TTY: hso, use tty from tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 24/69] TTY: con3215, centralize allocation Jiri Slaby
2012-04-03  5:56   ` Heiko Carstens
2012-04-02 11:54 ` [PATCH 25/69] TTY: con3215, remove tasklet for tty_wakeup Jiri Slaby
2012-04-03  5:42   ` Heiko Carstens
2012-04-03  7:59     ` Jiri Slaby
2012-04-09 18:27       ` Greg KH
2012-04-09 18:30         ` Jiri Slaby
2012-04-09 19:07           ` Greg KH
2012-04-02 11:54 ` [PATCH 26/69] TTY: con3215, add tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 27/69] TTY: con3215, use tty from tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 28/69] TTY: sclp_tty, add tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 29/69] TTY: sclp_vt220, " Jiri Slaby
2012-04-02 11:54 ` [PATCH 30/69] TTY: sclp_vt220, remove unused allocation Jiri Slaby
2012-04-02 11:54 ` [PATCH 31/69] TTY: tty3270, move initialization to allocation Jiri Slaby
2012-04-02 11:54 ` [PATCH 32/69] TTY: tty3270, get rid of ugly aliasing Jiri Slaby
2012-04-02 11:54 ` [PATCH 33/69] TTY: tty3270, push tty down to tty3270_do_write Jiri Slaby
2012-04-02 11:54 ` [PATCH 34/69] TTY: tty3270, add tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 35/69] TTY: bfin_jtag_comm, " Jiri Slaby
2012-04-02 11:54 ` [PATCH 36/69] TTY: bfin_jtag_comm, use tty from tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 37/69] TTY: HVC, add tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 38/69] TTY: HVC, use tty from tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 39/69] TTY: HVC, use count " Jiri Slaby
2012-04-02 11:54 ` [PATCH 40/69] TTY: hvcs, add tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 41/69] TTY: hvcs, use kref from tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 42/69] TTY: hvcs, use tty " Jiri Slaby
2012-04-02 11:54 ` [PATCH 43/69] TTY: hvsi, CLOCAL is not in tty->flags Jiri Slaby
2012-04-02 11:54 ` [PATCH 44/69] TTY: hvsi, add tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 45/69] TTY: hvsi, sanitize uses of tty Jiri Slaby
2012-04-02 11:54 ` [PATCH 46/69] TTY: hvsi, use tty from tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 47/69] TTY: ipwireless, use synchronous hangup Jiri Slaby
2012-04-02 12:42   ` David Sterba
2012-04-02 11:54 ` [PATCH 48/69] TTY: ipwireless, move prints to appropriate places Jiri Slaby
2012-04-02 11:54 ` [PATCH 49/69] TTY: ipwireless, add tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 50/69] TTY: ipwireless, use tty from tty_port Jiri Slaby
2012-04-02 11:54 ` Jiri Slaby [this message]
2012-04-03 12:48   ` [PATCH 51/69] TTY: 68328serial, remove serial_state and friends Geert Uytterhoeven
2012-04-02 11:54 ` [PATCH 52/69] TTY: 68328serial, remove unused stuff from m68k_serial Jiri Slaby
2012-04-02 11:54 ` [PATCH 53/69] TTY: 68328serial, remove garbage Jiri Slaby
2012-04-02 11:54 ` [PATCH 54/69] TTY: 68328serial, use ulong flags for interrupts status Jiri Slaby
2012-04-02 11:54 ` [PATCH 55/69] TTY: 68328serial, remove 68328serial.h Jiri Slaby
2012-04-02 11:54 ` [PATCH 56/69] TTY: 68328serial, add tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 57/69] TTY: 68328serial, use open/close_wait from tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 58/69] TTY: 68328serial, use close_delay/closing_wait " Jiri Slaby
2012-04-02 11:54 ` [PATCH 59/69] TTY: 68328serial, use flags " Jiri Slaby
2012-04-02 11:54 ` [PATCH 60/69] TTY: 68328serial, propagate tty Jiri Slaby
2012-04-02 11:54 ` [PATCH 61/69] TTY: 68328serial, use tty from tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 62/69] TTY: 68328serial, use tty_port_block_til_ready Jiri Slaby
2012-04-04 12:25   ` Greg Ungerer
2012-04-02 11:54 ` [PATCH 63/69] TTY: usb/u_serial, add tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 64/69] TTY: usb/u_serial, use tty from tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 65/69] TTY: usb/u_serial use close_wait " Jiri Slaby
2012-04-02 11:54 ` [PATCH 66/69] TTY: rfcomm/tty, add tty_port Jiri Slaby
2012-04-02 11:54 ` [PATCH 67/69] TTY: rfcomm/tty, use tty_port refcounting Jiri Slaby
2012-04-02 11:54 ` [PATCH 68/69] TTY: rfcomm/tty, remove work for tty_wakeup Jiri Slaby
2012-04-02 11:54 ` [PATCH 69/69] TTY: rfcomm/tty, use count from tty_port Jiri Slaby

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=1333367693-3244-52-git-send-email-jslaby@suse.cz \
    --to=jslaby@suse.cz \
    --cc=alan@linux.intel.com \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).