diff options
Diffstat (limited to 'drivers/staging/dgnc/dgnc_cls.c')
-rw-r--r-- | drivers/staging/dgnc/dgnc_cls.c | 73 |
1 files changed, 8 insertions, 65 deletions
diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index bedc522..e3564d2 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -11,22 +11,6 @@ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE! - * - * This is shared code between Digi's CVS archive and the - * Linux Kernel sources. - * Changing the source just for reformatting needlessly breaks - * our CVS diff history. - * - * Send any bug fixes/changes to: Eng.Linux at digi dot com. - * Thank you. - * */ #include <linux/kernel.h> @@ -92,14 +76,12 @@ struct board_ops dgnc_cls_ops = { .send_immediate_char = cls_send_immediate_char }; - static inline void cls_set_cts_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -136,14 +118,12 @@ static inline void cls_set_cts_flow_control(struct channel_t *ch) } - static inline void cls_set_ixon_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -184,14 +164,12 @@ static inline void cls_set_ixon_flow_control(struct channel_t *ch) } - static inline void cls_set_no_output_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -230,14 +208,12 @@ static inline void cls_set_no_output_flow_control(struct channel_t *ch) } - static inline void cls_set_rts_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -266,20 +242,17 @@ static inline void cls_set_rts_flow_control(struct channel_t *ch) UART_16654_FCR_TXTRIGGER_16 | UART_FCR_CLEAR_RCVR), &ch->ch_cls_uart->isr_fcr); - ch->ch_r_watermark = 4; ch->ch_r_tlevel = 8; } - static inline void cls_set_ixoff_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -316,14 +289,12 @@ static inline void cls_set_ixoff_flow_control(struct channel_t *ch) } - static inline void cls_set_no_input_flow_control(struct channel_t *ch) { unsigned char lcrb = readb(&ch->ch_cls_uart->lcr); unsigned char ier = readb(&ch->ch_cls_uart->ier); unsigned char isr_fcr = 0; - /* * The Enhanced Register Set may only be accessed when * the Line Control Register is set to 0xBFh. @@ -357,7 +328,6 @@ static inline void cls_set_no_input_flow_control(struct channel_t *ch) } - /* * cls_clear_break. * Determines whether its time to shut off break condition. @@ -393,7 +363,6 @@ static inline void cls_clear_break(struct channel_t *ch, int force) spin_unlock_irqrestore(&ch->ch_lock, flags); } - /* Parse the ISR register for the specific port */ static inline void cls_parse_isr(struct dgnc_board *brd, uint port) { @@ -406,7 +375,7 @@ static inline void cls_parse_isr(struct dgnc_board *brd, uint port) * verified in the interrupt routine. */ - if (port > brd->nasync) + if (port >= brd->nasync) return; ch = brd->channels[port]; @@ -457,7 +426,6 @@ static inline void cls_parse_isr(struct dgnc_board *brd, uint port) } } - /* * cls_param() * Send any/all changes to the line to the UART. @@ -711,7 +679,6 @@ static void cls_param(struct tty_struct *tty) cls_parse_modem(ch, readb(&ch->ch_cls_uart->msr)); } - /* * Our board poller function. */ @@ -784,7 +751,6 @@ static void cls_tasklet(unsigned long data) } - /* * cls_intr() * @@ -834,7 +800,6 @@ static irqreturn_t cls_intr(int irq, void *voidbrd) return IRQ_HANDLED; } - static void cls_disable_receiver(struct channel_t *ch) { unsigned char tmp = readb(&ch->ch_cls_uart->ier); @@ -843,7 +808,6 @@ static void cls_disable_receiver(struct channel_t *ch) writeb(tmp, &ch->ch_cls_uart->ier); } - static void cls_enable_receiver(struct channel_t *ch) { unsigned char tmp = readb(&ch->ch_cls_uart->ier); @@ -852,7 +816,6 @@ static void cls_enable_receiver(struct channel_t *ch) writeb(tmp, &ch->ch_cls_uart->ier); } - static void cls_copy_data_from_uart_to_queue(struct channel_t *ch) { int qleft = 0; @@ -942,7 +905,6 @@ static void cls_copy_data_from_uart_to_queue(struct channel_t *ch) spin_unlock_irqrestore(&ch->ch_lock, flags); } - /* * This function basically goes to sleep for secs, or until * it gets signalled that the port has fully drained. @@ -978,7 +940,6 @@ static int cls_drain(struct tty_struct *tty, uint seconds) ((un->un_flags & UN_EMPTY) == 0)); } - /* Channel lock MUST be held before calling this function! */ static void cls_flush_uart_write(struct channel_t *ch) { @@ -992,7 +953,6 @@ static void cls_flush_uart_write(struct channel_t *ch) ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); } - /* Channel lock MUST be held before calling this function! */ static void cls_flush_uart_read(struct channel_t *ch) { @@ -1013,7 +973,6 @@ static void cls_flush_uart_read(struct channel_t *ch) udelay(10); } - static void cls_copy_data_from_queue_to_uart(struct channel_t *ch) { ushort head; @@ -1029,22 +988,16 @@ static void cls_copy_data_from_queue_to_uart(struct channel_t *ch) spin_lock_irqsave(&ch->ch_lock, flags); /* No data to write to the UART */ - if (ch->ch_w_tail == ch->ch_w_head) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if (ch->ch_w_tail == ch->ch_w_head) + goto exit_unlock; /* If port is "stopped", don't send any data to the UART */ if ((ch->ch_flags & CH_FORCED_STOP) || - (ch->ch_flags & CH_BREAK_SENDING)) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + (ch->ch_flags & CH_BREAK_SENDING)) + goto exit_unlock; - if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM))) { - spin_unlock_irqrestore(&ch->ch_lock, flags); - return; - } + if (!(ch->ch_flags & (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM))) + goto exit_unlock; n = 32; @@ -1094,10 +1047,10 @@ static void cls_copy_data_from_queue_to_uart(struct channel_t *ch) if (len_written > 0) ch->ch_flags &= ~(CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM); +exit_unlock: spin_unlock_irqrestore(&ch->ch_lock, flags); } - static void cls_parse_modem(struct channel_t *ch, unsigned char signals) { unsigned char msignals = signals; @@ -1162,7 +1115,6 @@ static void cls_parse_modem(struct channel_t *ch, unsigned char signals) spin_unlock_irqrestore(&ch->ch_lock, flags); } - /* Make the UART raise any of the output signals we want up */ static void cls_assert_modem_signals(struct channel_t *ch) { @@ -1182,7 +1134,6 @@ static void cls_assert_modem_signals(struct channel_t *ch) udelay(10); } - static void cls_send_start_character(struct channel_t *ch) { if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) @@ -1194,7 +1145,6 @@ static void cls_send_start_character(struct channel_t *ch) } } - static void cls_send_stop_character(struct channel_t *ch) { if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) @@ -1206,7 +1156,6 @@ static void cls_send_stop_character(struct channel_t *ch) } } - /* Inits UART */ static void cls_uart_init(struct channel_t *ch) { @@ -1244,7 +1193,6 @@ static void cls_uart_init(struct channel_t *ch) readb(&ch->ch_cls_uart->msr); } - /* * Turns off UART. */ @@ -1253,7 +1201,6 @@ static void cls_uart_off(struct channel_t *ch) writeb(0, &ch->ch_cls_uart->ier); } - /* * cls_get_uarts_bytes_left. * Returns 0 is nothing left in the FIFO, returns 1 otherwise. @@ -1283,7 +1230,6 @@ static uint cls_get_uart_bytes_left(struct channel_t *ch) return left; } - /* * cls_send_break. * Starts sending a break thru the UART. @@ -1326,7 +1272,6 @@ static void cls_send_break(struct channel_t *ch, int msecs) } } - /* * cls_send_immediate_char. * Sends a specific character as soon as possible to the UART, @@ -1348,7 +1293,6 @@ static void cls_vpd(struct dgnc_board *brd) u8 __iomem *re_map_vpdbase;/* Remapped memory of the card */ int i = 0; - vpdbase = pci_resource_start(brd->pdev, 3); /* No VPD */ @@ -1370,4 +1314,3 @@ static void cls_vpd(struct dgnc_board *brd) if (re_map_vpdbase) iounmap(re_map_vpdbase); } - |