aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/synclinkmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/synclinkmp.c')
-rw-r--r--drivers/char/synclinkmp.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index 66f3754fbbdf..53e8ccf94fe3 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -67,8 +67,10 @@
67#include <linux/workqueue.h> 67#include <linux/workqueue.h>
68#include <linux/hdlc.h> 68#include <linux/hdlc.h>
69 69
70#ifdef CONFIG_HDLC_MODULE 70#if defined(CONFIG_HDLC) || (defined(CONFIG_HDLC_MODULE) && defined(CONFIG_SYNCLINKMP_MODULE))
71#define CONFIG_HDLC 1 71#define SYNCLINK_GENERIC_HDLC 1
72#else
73#define SYNCLINK_GENERIC_HDLC 0
72#endif 74#endif
73 75
74#define GET_USER(error,value,addr) error = get_user(value,addr) 76#define GET_USER(error,value,addr) error = get_user(value,addr)
@@ -280,7 +282,7 @@ typedef struct _synclinkmp_info {
280 int dosyncppp; 282 int dosyncppp;
281 spinlock_t netlock; 283 spinlock_t netlock;
282 284
283#ifdef CONFIG_HDLC 285#if SYNCLINK_GENERIC_HDLC
284 struct net_device *netdev; 286 struct net_device *netdev;
285#endif 287#endif
286 288
@@ -517,7 +519,7 @@ static struct tty_driver *serial_driver;
517static int open(struct tty_struct *tty, struct file * filp); 519static int open(struct tty_struct *tty, struct file * filp);
518static void close(struct tty_struct *tty, struct file * filp); 520static void close(struct tty_struct *tty, struct file * filp);
519static void hangup(struct tty_struct *tty); 521static void hangup(struct tty_struct *tty);
520static void set_termios(struct tty_struct *tty, struct termios *old_termios); 522static void set_termios(struct tty_struct *tty, struct ktermios *old_termios);
521 523
522static int write(struct tty_struct *tty, const unsigned char *buf, int count); 524static int write(struct tty_struct *tty, const unsigned char *buf, int count);
523static void put_char(struct tty_struct *tty, unsigned char ch); 525static void put_char(struct tty_struct *tty, unsigned char ch);
@@ -536,7 +538,7 @@ static void throttle(struct tty_struct * tty);
536static void unthrottle(struct tty_struct * tty); 538static void unthrottle(struct tty_struct * tty);
537static void set_break(struct tty_struct *tty, int break_state); 539static void set_break(struct tty_struct *tty, int break_state);
538 540
539#ifdef CONFIG_HDLC 541#if SYNCLINK_GENERIC_HDLC
540#define dev_to_port(D) (dev_to_hdlc(D)->priv) 542#define dev_to_port(D) (dev_to_hdlc(D)->priv)
541static void hdlcdev_tx_done(SLMP_INFO *info); 543static void hdlcdev_tx_done(SLMP_INFO *info);
542static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size); 544static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size);
@@ -602,7 +604,7 @@ static void enable_loopback(SLMP_INFO *info, int enable);
602static void set_rate(SLMP_INFO *info, u32 data_rate); 604static void set_rate(SLMP_INFO *info, u32 data_rate);
603 605
604static int bh_action(SLMP_INFO *info); 606static int bh_action(SLMP_INFO *info);
605static void bh_handler(void* Context); 607static void bh_handler(struct work_struct *work);
606static void bh_receive(SLMP_INFO *info); 608static void bh_receive(SLMP_INFO *info);
607static void bh_transmit(SLMP_INFO *info); 609static void bh_transmit(SLMP_INFO *info);
608static void bh_status(SLMP_INFO *info); 610static void bh_status(SLMP_INFO *info);
@@ -916,7 +918,7 @@ static void hangup(struct tty_struct *tty)
916 918
917/* Set new termios settings 919/* Set new termios settings
918 */ 920 */
919static void set_termios(struct tty_struct *tty, struct termios *old_termios) 921static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
920{ 922{
921 SLMP_INFO *info = (SLMP_INFO *)tty->driver_data; 923 SLMP_INFO *info = (SLMP_INFO *)tty->driver_data;
922 unsigned long flags; 924 unsigned long flags;
@@ -1607,7 +1609,7 @@ static void set_break(struct tty_struct *tty, int break_state)
1607 spin_unlock_irqrestore(&info->lock,flags); 1609 spin_unlock_irqrestore(&info->lock,flags);
1608} 1610}
1609 1611
1610#ifdef CONFIG_HDLC 1612#if SYNCLINK_GENERIC_HDLC
1611 1613
1612/** 1614/**
1613 * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) 1615 * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.)
@@ -2063,9 +2065,9 @@ int bh_action(SLMP_INFO *info)
2063 2065
2064/* Perform bottom half processing of work items queued by ISR. 2066/* Perform bottom half processing of work items queued by ISR.
2065 */ 2067 */
2066void bh_handler(void* Context) 2068void bh_handler(struct work_struct *work)
2067{ 2069{
2068 SLMP_INFO *info = (SLMP_INFO*)Context; 2070 SLMP_INFO *info = container_of(work, SLMP_INFO, task);
2069 int action; 2071 int action;
2070 2072
2071 if (!info) 2073 if (!info)
@@ -2339,7 +2341,7 @@ static void isr_txeom(SLMP_INFO * info, unsigned char status)
2339 set_signals(info); 2341 set_signals(info);
2340 } 2342 }
2341 2343
2342#ifdef CONFIG_HDLC 2344#if SYNCLINK_GENERIC_HDLC
2343 if (info->netcount) 2345 if (info->netcount)
2344 hdlcdev_tx_done(info); 2346 hdlcdev_tx_done(info);
2345 else 2347 else
@@ -2523,7 +2525,7 @@ void isr_io_pin( SLMP_INFO *info, u16 status )
2523 info->input_signal_events.dcd_up++; 2525 info->input_signal_events.dcd_up++;
2524 } else 2526 } else
2525 info->input_signal_events.dcd_down++; 2527 info->input_signal_events.dcd_down++;
2526#ifdef CONFIG_HDLC 2528#if SYNCLINK_GENERIC_HDLC
2527 if (info->netcount) { 2529 if (info->netcount) {
2528 if (status & SerialSignal_DCD) 2530 if (status & SerialSignal_DCD)
2529 netif_carrier_on(info->netdev); 2531 netif_carrier_on(info->netdev);
@@ -2596,8 +2598,7 @@ void isr_io_pin( SLMP_INFO *info, u16 status )
2596 * dev_id device ID supplied during interrupt registration 2598 * dev_id device ID supplied during interrupt registration
2597 * regs interrupted processor context 2599 * regs interrupted processor context
2598 */ 2600 */
2599static irqreturn_t synclinkmp_interrupt(int irq, void *dev_id, 2601static irqreturn_t synclinkmp_interrupt(int irq, void *dev_id)
2600 struct pt_regs *regs)
2601{ 2602{
2602 SLMP_INFO * info; 2603 SLMP_INFO * info;
2603 unsigned char status, status0, status1=0; 2604 unsigned char status, status0, status1=0;
@@ -3784,7 +3785,7 @@ void add_device(SLMP_INFO *info)
3784 info->irq_level, 3785 info->irq_level,
3785 info->max_frame_size ); 3786 info->max_frame_size );
3786 3787
3787#ifdef CONFIG_HDLC 3788#if SYNCLINK_GENERIC_HDLC
3788 hdlcdev_init(info); 3789 hdlcdev_init(info);
3789#endif 3790#endif
3790} 3791}
@@ -3806,7 +3807,7 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev)
3806 } else { 3807 } else {
3807 memset(info, 0, sizeof(SLMP_INFO)); 3808 memset(info, 0, sizeof(SLMP_INFO));
3808 info->magic = MGSL_MAGIC; 3809 info->magic = MGSL_MAGIC;
3809 INIT_WORK(&info->task, bh_handler, info); 3810 INIT_WORK(&info->task, bh_handler);
3810 info->max_frame_size = 4096; 3811 info->max_frame_size = 4096;
3811 info->close_delay = 5*HZ/10; 3812 info->close_delay = 5*HZ/10;
3812 info->closing_wait = 30*HZ; 3813 info->closing_wait = 30*HZ;
@@ -3929,7 +3930,7 @@ void device_init(int adapter_num, struct pci_dev *pdev)
3929 } 3930 }
3930} 3931}
3931 3932
3932static struct tty_operations ops = { 3933static const struct tty_operations ops = {
3933 .open = open, 3934 .open = open,
3934 .close = close, 3935 .close = close,
3935 .write = write, 3936 .write = write,
@@ -3978,7 +3979,7 @@ static void synclinkmp_cleanup(void)
3978 /* release devices */ 3979 /* release devices */
3979 info = synclinkmp_device_list; 3980 info = synclinkmp_device_list;
3980 while(info) { 3981 while(info) {
3981#ifdef CONFIG_HDLC 3982#if SYNCLINK_GENERIC_HDLC
3982 hdlcdev_exit(info); 3983 hdlcdev_exit(info);
3983#endif 3984#endif
3984 free_dma_bufs(info); 3985 free_dma_bufs(info);
@@ -4033,6 +4034,8 @@ static int __init synclinkmp_init(void)
4033 serial_driver->init_termios = tty_std_termios; 4034 serial_driver->init_termios = tty_std_termios;
4034 serial_driver->init_termios.c_cflag = 4035 serial_driver->init_termios.c_cflag =
4035 B9600 | CS8 | CREAD | HUPCL | CLOCAL; 4036 B9600 | CS8 | CREAD | HUPCL | CLOCAL;
4037 serial_driver->init_termios.c_ispeed = 9600;
4038 serial_driver->init_termios.c_ospeed = 9600;
4036 serial_driver->flags = TTY_DRIVER_REAL_RAW; 4039 serial_driver->flags = TTY_DRIVER_REAL_RAW;
4037 tty_set_operations(serial_driver, &ops); 4040 tty_set_operations(serial_driver, &ops);
4038 if ((rc = tty_register_driver(serial_driver)) < 0) { 4041 if ((rc = tty_register_driver(serial_driver)) < 0) {
@@ -4980,7 +4983,7 @@ CheckAgain:
4980 info->icount.rxcrc++; 4983 info->icount.rxcrc++;
4981 4984
4982 framesize = 0; 4985 framesize = 0;
4983#ifdef CONFIG_HDLC 4986#if SYNCLINK_GENERIC_HDLC
4984 { 4987 {
4985 struct net_device_stats *stats = hdlc_stats(info->netdev); 4988 struct net_device_stats *stats = hdlc_stats(info->netdev);
4986 stats->rx_errors++; 4989 stats->rx_errors++;
@@ -5021,7 +5024,7 @@ CheckAgain:
5021 index = 0; 5024 index = 0;
5022 } 5025 }
5023 5026
5024#ifdef CONFIG_HDLC 5027#if SYNCLINK_GENERIC_HDLC
5025 if (info->netcount) 5028 if (info->netcount)
5026 hdlcdev_rx(info,info->tmp_rx_buf,framesize); 5029 hdlcdev_rx(info,info->tmp_rx_buf,framesize);
5027 else 5030 else
@@ -5532,7 +5535,7 @@ void tx_timeout(unsigned long context)
5532 5535
5533 spin_unlock_irqrestore(&info->lock,flags); 5536 spin_unlock_irqrestore(&info->lock,flags);
5534 5537
5535#ifdef CONFIG_HDLC 5538#if SYNCLINK_GENERIC_HDLC
5536 if (info->netcount) 5539 if (info->netcount)
5537 hdlcdev_tx_done(info); 5540 hdlcdev_tx_done(info);
5538 else 5541 else