aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia/synclink_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/pcmcia/synclink_cs.c')
-rw-r--r--drivers/char/pcmcia/synclink_cs.c52
1 files changed, 22 insertions, 30 deletions
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 00f574cbb0d4..5152cedd8878 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -35,7 +35,6 @@
35 35
36#define MAX_DEVICE_COUNT 4 36#define MAX_DEVICE_COUNT 4
37 37
38#include <linux/config.h>
39#include <linux/module.h> 38#include <linux/module.h>
40#include <linux/errno.h> 39#include <linux/errno.h>
41#include <linux/signal.h> 40#include <linux/signal.h>
@@ -57,7 +56,6 @@
57#include <linux/netdevice.h> 56#include <linux/netdevice.h>
58#include <linux/vmalloc.h> 57#include <linux/vmalloc.h>
59#include <linux/init.h> 58#include <linux/init.h>
60#include <asm/serial.h>
61#include <linux/delay.h> 59#include <linux/delay.h>
62#include <linux/ioctl.h> 60#include <linux/ioctl.h>
63 61
@@ -77,8 +75,10 @@
77#include <pcmcia/cisreg.h> 75#include <pcmcia/cisreg.h>
78#include <pcmcia/ds.h> 76#include <pcmcia/ds.h>
79 77
80#ifdef CONFIG_HDLC_MODULE 78#if defined(CONFIG_HDLC) || (defined(CONFIG_HDLC_MODULE) && defined(CONFIG_SYNCLINK_CS_MODULE))
81#define CONFIG_HDLC 1 79#define SYNCLINK_GENERIC_HDLC 1
80#else
81#define SYNCLINK_GENERIC_HDLC 0
82#endif 82#endif
83 83
84#define GET_USER(error,value,addr) error = get_user(value,addr) 84#define GET_USER(error,value,addr) error = get_user(value,addr)
@@ -237,7 +237,7 @@ typedef struct _mgslpc_info {
237 int dosyncppp; 237 int dosyncppp;
238 spinlock_t netlock; 238 spinlock_t netlock;
239 239
240#ifdef CONFIG_HDLC 240#if SYNCLINK_GENERIC_HDLC
241 struct net_device *netdev; 241 struct net_device *netdev;
242#endif 242#endif
243 243
@@ -394,7 +394,7 @@ static void tx_timeout(unsigned long context);
394 394
395static int ioctl_common(MGSLPC_INFO *info, unsigned int cmd, unsigned long arg); 395static int ioctl_common(MGSLPC_INFO *info, unsigned int cmd, unsigned long arg);
396 396
397#ifdef CONFIG_HDLC 397#if SYNCLINK_GENERIC_HDLC
398#define dev_to_port(D) (dev_to_hdlc(D)->priv) 398#define dev_to_port(D) (dev_to_hdlc(D)->priv)
399static void hdlcdev_tx_done(MGSLPC_INFO *info); 399static void hdlcdev_tx_done(MGSLPC_INFO *info);
400static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size); 400static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size);
@@ -418,12 +418,12 @@ static void rx_reset_buffers(MGSLPC_INFO *info);
418static int rx_alloc_buffers(MGSLPC_INFO *info); 418static int rx_alloc_buffers(MGSLPC_INFO *info);
419static void rx_free_buffers(MGSLPC_INFO *info); 419static void rx_free_buffers(MGSLPC_INFO *info);
420 420
421static irqreturn_t mgslpc_isr(int irq, void *dev_id, struct pt_regs * regs); 421static irqreturn_t mgslpc_isr(int irq, void *dev_id);
422 422
423/* 423/*
424 * Bottom half interrupt handlers 424 * Bottom half interrupt handlers
425 */ 425 */
426static void bh_handler(void* Context); 426static void bh_handler(struct work_struct *work);
427static void bh_transmit(MGSLPC_INFO *info); 427static void bh_transmit(MGSLPC_INFO *info);
428static void bh_status(MGSLPC_INFO *info); 428static void bh_status(MGSLPC_INFO *info);
429 429
@@ -549,7 +549,7 @@ static int mgslpc_probe(struct pcmcia_device *link)
549 549
550 memset(info, 0, sizeof(MGSLPC_INFO)); 550 memset(info, 0, sizeof(MGSLPC_INFO));
551 info->magic = MGSLPC_MAGIC; 551 info->magic = MGSLPC_MAGIC;
552 INIT_WORK(&info->task, bh_handler, info); 552 INIT_WORK(&info->task, bh_handler);
553 info->max_frame_size = 4096; 553 info->max_frame_size = 4096;
554 info->close_delay = 5*HZ/10; 554 info->close_delay = 5*HZ/10;
555 info->closing_wait = 30*HZ; 555 info->closing_wait = 30*HZ;
@@ -606,17 +606,10 @@ static int mgslpc_config(struct pcmcia_device *link)
606 if (debug_level >= DEBUG_LEVEL_INFO) 606 if (debug_level >= DEBUG_LEVEL_INFO)
607 printk("mgslpc_config(0x%p)\n", link); 607 printk("mgslpc_config(0x%p)\n", link);
608 608
609 /* read CONFIG tuple to find its configuration registers */
610 tuple.DesiredTuple = CISTPL_CONFIG;
611 tuple.Attributes = 0; 609 tuple.Attributes = 0;
612 tuple.TupleData = buf; 610 tuple.TupleData = buf;
613 tuple.TupleDataMax = sizeof(buf); 611 tuple.TupleDataMax = sizeof(buf);
614 tuple.TupleOffset = 0; 612 tuple.TupleOffset = 0;
615 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
616 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
617 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
618 link->conf.ConfigBase = parse.config.base;
619 link->conf.Present = parse.config.rmask[0];
620 613
621 /* get CIS configuration entry */ 614 /* get CIS configuration entry */
622 615
@@ -844,9 +837,9 @@ static int bh_action(MGSLPC_INFO *info)
844 return rc; 837 return rc;
845} 838}
846 839
847static void bh_handler(void* Context) 840static void bh_handler(struct work_struct *work)
848{ 841{
849 MGSLPC_INFO *info = (MGSLPC_INFO*)Context; 842 MGSLPC_INFO *info = container_of(work, MGSLPC_INFO, task);
850 int action; 843 int action;
851 844
852 if (!info) 845 if (!info)
@@ -1062,7 +1055,7 @@ static void tx_done(MGSLPC_INFO *info)
1062 info->drop_rts_on_tx_done = 0; 1055 info->drop_rts_on_tx_done = 0;
1063 } 1056 }
1064 1057
1065#ifdef CONFIG_HDLC 1058#if SYNCLINK_GENERIC_HDLC
1066 if (info->netcount) 1059 if (info->netcount)
1067 hdlcdev_tx_done(info); 1060 hdlcdev_tx_done(info);
1068 else 1061 else
@@ -1173,7 +1166,7 @@ static void dcd_change(MGSLPC_INFO *info)
1173 } 1166 }
1174 else 1167 else
1175 info->input_signal_events.dcd_down++; 1168 info->input_signal_events.dcd_down++;
1176#ifdef CONFIG_HDLC 1169#if SYNCLINK_GENERIC_HDLC
1177 if (info->netcount) { 1170 if (info->netcount) {
1178 if (info->serial_signals & SerialSignal_DCD) 1171 if (info->serial_signals & SerialSignal_DCD)
1179 netif_carrier_on(info->netdev); 1172 netif_carrier_on(info->netdev);
@@ -1236,9 +1229,8 @@ static void ri_change(MGSLPC_INFO *info)
1236 * 1229 *
1237 * irq interrupt number that caused interrupt 1230 * irq interrupt number that caused interrupt
1238 * dev_id device ID supplied during interrupt registration 1231 * dev_id device ID supplied during interrupt registration
1239 * regs interrupted processor context
1240 */ 1232 */
1241static irqreturn_t mgslpc_isr(int irq, void *dev_id, struct pt_regs * regs) 1233static irqreturn_t mgslpc_isr(int irq, void *dev_id)
1242{ 1234{
1243 MGSLPC_INFO * info = (MGSLPC_INFO *)dev_id; 1235 MGSLPC_INFO * info = (MGSLPC_INFO *)dev_id;
1244 unsigned short isr; 1236 unsigned short isr;
@@ -2383,7 +2375,7 @@ static int ioctl_common(MGSLPC_INFO *info, unsigned int cmd, unsigned long arg)
2383 * tty pointer to tty structure 2375 * tty pointer to tty structure
2384 * termios pointer to buffer to hold returned old termios 2376 * termios pointer to buffer to hold returned old termios
2385 */ 2377 */
2386static void mgslpc_set_termios(struct tty_struct *tty, struct termios *old_termios) 2378static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
2387{ 2379{
2388 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data; 2380 MGSLPC_INFO *info = (MGSLPC_INFO *)tty->driver_data;
2389 unsigned long flags; 2381 unsigned long flags;
@@ -2963,7 +2955,7 @@ static void mgslpc_add_device(MGSLPC_INFO *info)
2963 printk( "SyncLink PC Card %s:IO=%04X IRQ=%d\n", 2955 printk( "SyncLink PC Card %s:IO=%04X IRQ=%d\n",
2964 info->device_name, info->io_base, info->irq_level); 2956 info->device_name, info->io_base, info->irq_level);
2965 2957
2966#ifdef CONFIG_HDLC 2958#if SYNCLINK_GENERIC_HDLC
2967 hdlcdev_init(info); 2959 hdlcdev_init(info);
2968#endif 2960#endif
2969} 2961}
@@ -2979,7 +2971,7 @@ static void mgslpc_remove_device(MGSLPC_INFO *remove_info)
2979 last->next_device = info->next_device; 2971 last->next_device = info->next_device;
2980 else 2972 else
2981 mgslpc_device_list = info->next_device; 2973 mgslpc_device_list = info->next_device;
2982#ifdef CONFIG_HDLC 2974#if SYNCLINK_GENERIC_HDLC
2983 hdlcdev_exit(info); 2975 hdlcdev_exit(info);
2984#endif 2976#endif
2985 release_resources(info); 2977 release_resources(info);
@@ -3010,7 +3002,7 @@ static struct pcmcia_driver mgslpc_driver = {
3010 .resume = mgslpc_resume, 3002 .resume = mgslpc_resume,
3011}; 3003};
3012 3004
3013static struct tty_operations mgslpc_ops = { 3005static const struct tty_operations mgslpc_ops = {
3014 .open = mgslpc_open, 3006 .open = mgslpc_open,
3015 .close = mgslpc_close, 3007 .close = mgslpc_close,
3016 .write = mgslpc_write, 3008 .write = mgslpc_write,
@@ -3911,7 +3903,7 @@ static int rx_get_frame(MGSLPC_INFO *info)
3911 return_frame = 1; 3903 return_frame = 1;
3912 } 3904 }
3913 framesize = 0; 3905 framesize = 0;
3914#ifdef CONFIG_HDLC 3906#if SYNCLINK_GENERIC_HDLC
3915 { 3907 {
3916 struct net_device_stats *stats = hdlc_stats(info->netdev); 3908 struct net_device_stats *stats = hdlc_stats(info->netdev);
3917 stats->rx_errors++; 3909 stats->rx_errors++;
@@ -3945,7 +3937,7 @@ static int rx_get_frame(MGSLPC_INFO *info)
3945 ++framesize; 3937 ++framesize;
3946 } 3938 }
3947 3939
3948#ifdef CONFIG_HDLC 3940#if SYNCLINK_GENERIC_HDLC
3949 if (info->netcount) 3941 if (info->netcount)
3950 hdlcdev_rx(info, buf->data, framesize); 3942 hdlcdev_rx(info, buf->data, framesize);
3951 else 3943 else
@@ -4101,7 +4093,7 @@ static void tx_timeout(unsigned long context)
4101 4093
4102 spin_unlock_irqrestore(&info->lock,flags); 4094 spin_unlock_irqrestore(&info->lock,flags);
4103 4095
4104#ifdef CONFIG_HDLC 4096#if SYNCLINK_GENERIC_HDLC
4105 if (info->netcount) 4097 if (info->netcount)
4106 hdlcdev_tx_done(info); 4098 hdlcdev_tx_done(info);
4107 else 4099 else
@@ -4109,7 +4101,7 @@ static void tx_timeout(unsigned long context)
4109 bh_transmit(info); 4101 bh_transmit(info);
4110} 4102}
4111 4103
4112#ifdef CONFIG_HDLC 4104#if SYNCLINK_GENERIC_HDLC
4113 4105
4114/** 4106/**
4115 * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.) 4107 * called by generic HDLC layer when protocol selected (PPP, frame relay, etc.)