aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/synclink.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/synclink.c')
-rw-r--r--drivers/char/synclink.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 06784adcc35c..645187b9141e 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -101,8 +101,10 @@
101#include <linux/hdlc.h> 101#include <linux/hdlc.h>
102#include <linux/dma-mapping.h> 102#include <linux/dma-mapping.h>
103 103
104#ifdef CONFIG_HDLC_MODULE 104#if defined(CONFIG_HDLC) || (defined(CONFIG_HDLC_MODULE) && defined(CONFIG_SYNCLINK_MODULE))
105#define CONFIG_HDLC 1 105#define SYNCLINK_GENERIC_HDLC 1
106#else
107#define SYNCLINK_GENERIC_HDLC 0
106#endif 108#endif
107 109
108#define GET_USER(error,value,addr) error = get_user(value,addr) 110#define GET_USER(error,value,addr) error = get_user(value,addr)
@@ -320,7 +322,7 @@ struct mgsl_struct {
320 int dosyncppp; 322 int dosyncppp;
321 spinlock_t netlock; 323 spinlock_t netlock;
322 324
323#ifdef CONFIG_HDLC 325#if SYNCLINK_GENERIC_HDLC
324 struct net_device *netdev; 326 struct net_device *netdev;
325#endif 327#endif
326}; 328};
@@ -728,7 +730,7 @@ static void usc_loopmode_send_done( struct mgsl_struct * info );
728 730
729static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg); 731static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg);
730 732
731#ifdef CONFIG_HDLC 733#if SYNCLINK_GENERIC_HDLC
732#define dev_to_port(D) (dev_to_hdlc(D)->priv) 734#define dev_to_port(D) (dev_to_hdlc(D)->priv)
733static void hdlcdev_tx_done(struct mgsl_struct *info); 735static void hdlcdev_tx_done(struct mgsl_struct *info);
734static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size); 736static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size);
@@ -802,7 +804,7 @@ static int save_tx_buffer_request(struct mgsl_struct *info,const char *Buffer, u
802/* 804/*
803 * Bottom half interrupt handlers 805 * Bottom half interrupt handlers
804 */ 806 */
805static void mgsl_bh_handler(void* Context); 807static void mgsl_bh_handler(struct work_struct *work);
806static void mgsl_bh_receive(struct mgsl_struct *info); 808static void mgsl_bh_receive(struct mgsl_struct *info);
807static void mgsl_bh_transmit(struct mgsl_struct *info); 809static void mgsl_bh_transmit(struct mgsl_struct *info);
808static void mgsl_bh_status(struct mgsl_struct *info); 810static void mgsl_bh_status(struct mgsl_struct *info);
@@ -1071,9 +1073,10 @@ static int mgsl_bh_action(struct mgsl_struct *info)
1071/* 1073/*
1072 * Perform bottom half processing of work items queued by ISR. 1074 * Perform bottom half processing of work items queued by ISR.
1073 */ 1075 */
1074static void mgsl_bh_handler(void* Context) 1076static void mgsl_bh_handler(struct work_struct *work)
1075{ 1077{
1076 struct mgsl_struct *info = (struct mgsl_struct*)Context; 1078 struct mgsl_struct *info =
1079 container_of(work, struct mgsl_struct, task);
1077 int action; 1080 int action;
1078 1081
1079 if (!info) 1082 if (!info)
@@ -1276,7 +1279,7 @@ static void mgsl_isr_transmit_status( struct mgsl_struct *info )
1276 info->drop_rts_on_tx_done = 0; 1279 info->drop_rts_on_tx_done = 0;
1277 } 1280 }
1278 1281
1279#ifdef CONFIG_HDLC 1282#if SYNCLINK_GENERIC_HDLC
1280 if (info->netcount) 1283 if (info->netcount)
1281 hdlcdev_tx_done(info); 1284 hdlcdev_tx_done(info);
1282 else 1285 else
@@ -1341,7 +1344,7 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info )
1341 info->input_signal_events.dcd_up++; 1344 info->input_signal_events.dcd_up++;
1342 } else 1345 } else
1343 info->input_signal_events.dcd_down++; 1346 info->input_signal_events.dcd_down++;
1344#ifdef CONFIG_HDLC 1347#if SYNCLINK_GENERIC_HDLC
1345 if (info->netcount) { 1348 if (info->netcount) {
1346 if (status & MISCSTATUS_DCD) 1349 if (status & MISCSTATUS_DCD)
1347 netif_carrier_on(info->netdev); 1350 netif_carrier_on(info->netdev);
@@ -4312,7 +4315,7 @@ static void mgsl_add_device( struct mgsl_struct *info )
4312 info->max_frame_size ); 4315 info->max_frame_size );
4313 } 4316 }
4314 4317
4315#ifdef CONFIG_HDLC 4318#if SYNCLINK_GENERIC_HDLC
4316 hdlcdev_init(info); 4319 hdlcdev_init(info);
4317#endif 4320#endif
4318 4321
@@ -4337,7 +4340,7 @@ static struct mgsl_struct* mgsl_allocate_device(void)
4337 } else { 4340 } else {
4338 memset(info, 0, sizeof(struct mgsl_struct)); 4341 memset(info, 0, sizeof(struct mgsl_struct));
4339 info->magic = MGSL_MAGIC; 4342 info->magic = MGSL_MAGIC;
4340 INIT_WORK(&info->task, mgsl_bh_handler, info); 4343 INIT_WORK(&info->task, mgsl_bh_handler);
4341 info->max_frame_size = 4096; 4344 info->max_frame_size = 4096;
4342 info->close_delay = 5*HZ/10; 4345 info->close_delay = 5*HZ/10;
4343 info->closing_wait = 30*HZ; 4346 info->closing_wait = 30*HZ;
@@ -4470,7 +4473,7 @@ static void synclink_cleanup(void)
4470 4473
4471 info = mgsl_device_list; 4474 info = mgsl_device_list;
4472 while(info) { 4475 while(info) {
4473#ifdef CONFIG_HDLC 4476#if SYNCLINK_GENERIC_HDLC
4474 hdlcdev_exit(info); 4477 hdlcdev_exit(info);
4475#endif 4478#endif
4476 mgsl_release_resources(info); 4479 mgsl_release_resources(info);
@@ -6644,7 +6647,7 @@ static int mgsl_get_rx_frame(struct mgsl_struct *info)
6644 return_frame = 1; 6647 return_frame = 1;
6645 } 6648 }
6646 framesize = 0; 6649 framesize = 0;
6647#ifdef CONFIG_HDLC 6650#if SYNCLINK_GENERIC_HDLC
6648 { 6651 {
6649 struct net_device_stats *stats = hdlc_stats(info->netdev); 6652 struct net_device_stats *stats = hdlc_stats(info->netdev);
6650 stats->rx_errors++; 6653 stats->rx_errors++;
@@ -6720,7 +6723,7 @@ static int mgsl_get_rx_frame(struct mgsl_struct *info)
6720 *ptmp); 6723 *ptmp);
6721 } 6724 }
6722 6725
6723#ifdef CONFIG_HDLC 6726#if SYNCLINK_GENERIC_HDLC
6724 if (info->netcount) 6727 if (info->netcount)
6725 hdlcdev_rx(info,info->intermediate_rxbuffer,framesize); 6728 hdlcdev_rx(info,info->intermediate_rxbuffer,framesize);
6726 else 6729 else
@@ -7624,7 +7627,7 @@ static void mgsl_tx_timeout(unsigned long context)
7624 7627
7625 spin_unlock_irqrestore(&info->irq_spinlock,flags); 7628 spin_unlock_irqrestore(&info->irq_spinlock,flags);
7626 7629
7627#ifdef CONFIG_HDLC 7630#if SYNCLINK_GENERIC_HDLC
7628 if (info->netcount) 7631 if (info->netcount)
7629 hdlcdev_tx_done(info); 7632 hdlcdev_tx_done(info);
7630 else 7633 else
@@ -7700,7 +7703,7 @@ static int usc_loopmode_active( struct mgsl_struct * info)
7700 return usc_InReg( info, CCSR ) & BIT7 ? 1 : 0 ; 7703 return usc_InReg( info, CCSR ) & BIT7 ? 1 : 0 ;
7701} 7704}
7702 7705
7703#ifdef CONFIG_HDLC 7706#if SYNCLINK_GENERIC_HDLC
7704 7707
7705/** 7708/**
7706 * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) 7709 * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.)