aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/divert/divert_procfs.c18
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c76
-rw-r--r--drivers/isdn/hisax/avma1_cs.c63
-rw-r--r--drivers/isdn/hisax/elsa_cs.c40
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c60
-rw-r--r--drivers/isdn/hisax/teles_cs.c50
6 files changed, 45 insertions, 262 deletions
diff --git a/drivers/isdn/divert/divert_procfs.c b/drivers/isdn/divert/divert_procfs.c
index 9f49d9065791..c53e2417e7d4 100644
--- a/drivers/isdn/divert/divert_procfs.c
+++ b/drivers/isdn/divert/divert_procfs.c
@@ -20,6 +20,7 @@
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/isdnif.h> 21#include <linux/isdnif.h>
22#include <net/net_namespace.h> 22#include <net/net_namespace.h>
23#include <linux/smp_lock.h>
23#include "isdn_divert.h" 24#include "isdn_divert.h"
24 25
25 26
@@ -177,9 +178,7 @@ isdn_divert_close(struct inode *ino, struct file *filep)
177/*********/ 178/*********/
178/* IOCTL */ 179/* IOCTL */
179/*********/ 180/*********/
180static int 181static int isdn_divert_ioctl_unlocked(struct file *file, uint cmd, ulong arg)
181isdn_divert_ioctl(struct inode *inode, struct file *file,
182 uint cmd, ulong arg)
183{ 182{
184 divert_ioctl dioctl; 183 divert_ioctl dioctl;
185 int i; 184 int i;
@@ -258,6 +257,17 @@ isdn_divert_ioctl(struct inode *inode, struct file *file,
258 return copy_to_user((void __user *)arg, &dioctl, sizeof(dioctl)) ? -EFAULT : 0; 257 return copy_to_user((void __user *)arg, &dioctl, sizeof(dioctl)) ? -EFAULT : 0;
259} /* isdn_divert_ioctl */ 258} /* isdn_divert_ioctl */
260 259
260static long isdn_divert_ioctl(struct file *file, uint cmd, ulong arg)
261{
262 long ret;
263
264 lock_kernel();
265 ret = isdn_divert_ioctl_unlocked(file, cmd, arg);
266 unlock_kernel();
267
268 return ret;
269}
270
261static const struct file_operations isdn_fops = 271static const struct file_operations isdn_fops =
262{ 272{
263 .owner = THIS_MODULE, 273 .owner = THIS_MODULE,
@@ -265,7 +275,7 @@ static const struct file_operations isdn_fops =
265 .read = isdn_divert_read, 275 .read = isdn_divert_read,
266 .write = isdn_divert_write, 276 .write = isdn_divert_write,
267 .poll = isdn_divert_poll, 277 .poll = isdn_divert_poll,
268 .ioctl = isdn_divert_ioctl, 278 .unlocked_ioctl = isdn_divert_ioctl,
269 .open = isdn_divert_open, 279 .open = isdn_divert_open,
270 .release = isdn_divert_close, 280 .release = isdn_divert_close,
271}; 281};
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 94b796d84053..f410d0eb2fef 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -13,7 +13,6 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/ptrace.h> 15#include <linux/ptrace.h>
16#include <linux/slab.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/tty.h> 17#include <linux/tty.h>
19#include <linux/serial.h> 18#include <linux/serial.h>
@@ -61,31 +60,6 @@ static void avmcs_release(struct pcmcia_device *link);
61 60
62static void avmcs_detach(struct pcmcia_device *p_dev); 61static void avmcs_detach(struct pcmcia_device *p_dev);
63 62
64/*
65 A linked list of "instances" of the skeleton device. Each actual
66 PCMCIA card corresponds to one device instance, and is described
67 by one struct pcmcia_device structure (defined in ds.h).
68
69 You may not want to use a linked list for this -- for example, the
70 memory card driver uses an array of struct pcmcia_device pointers, where minor
71 device numbers are used to derive the corresponding array index.
72*/
73
74/*
75 A driver needs to provide a dev_node_t structure for each device
76 on a card. In some cases, there is only one device per card (for
77 example, ethernet cards, modems). In other cases, there may be
78 many actual or logical devices (SCSI adapters, memory cards with
79 multiple partitions). The dev_node_t structures need to be kept
80 in a linked list starting at the 'dev' field of a struct pcmcia_device
81 structure. We allocate them in the card's private data structure,
82 because they generally can't be allocated dynamically.
83*/
84
85typedef struct local_info_t {
86 dev_node_t node;
87} local_info_t;
88
89/*====================================================================== 63/*======================================================================
90 64
91 avmcs_attach() creates an "instance" of the driver, allocating 65 avmcs_attach() creates an "instance" of the driver, allocating
@@ -100,32 +74,19 @@ typedef struct local_info_t {
100 74
101static int avmcs_probe(struct pcmcia_device *p_dev) 75static int avmcs_probe(struct pcmcia_device *p_dev)
102{ 76{
103 local_info_t *local;
104 77
105 /* The io structure describes IO port mapping */ 78 /* The io structure describes IO port mapping */
106 p_dev->io.NumPorts1 = 16; 79 p_dev->io.NumPorts1 = 16;
107 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 80 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
108 p_dev->io.NumPorts2 = 0; 81 p_dev->io.NumPorts2 = 0;
109 82
110 /* Interrupt setup */
111 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
112
113 /* General socket configuration */ 83 /* General socket configuration */
114 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 84 p_dev->conf.Attributes = CONF_ENABLE_IRQ;
115 p_dev->conf.IntType = INT_MEMORY_AND_IO; 85 p_dev->conf.IntType = INT_MEMORY_AND_IO;
116 p_dev->conf.ConfigIndex = 1; 86 p_dev->conf.ConfigIndex = 1;
117 p_dev->conf.Present = PRESENT_OPTION; 87 p_dev->conf.Present = PRESENT_OPTION;
118 88
119 /* Allocate space for private device-specific data */
120 local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
121 if (!local)
122 goto err;
123 p_dev->priv = local;
124
125 return avmcs_config(p_dev); 89 return avmcs_config(p_dev);
126
127 err:
128 return -ENOMEM;
129} /* avmcs_attach */ 90} /* avmcs_attach */
130 91
131/*====================================================================== 92/*======================================================================
@@ -140,7 +101,6 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
140static void avmcs_detach(struct pcmcia_device *link) 101static void avmcs_detach(struct pcmcia_device *link)
141{ 102{
142 avmcs_release(link); 103 avmcs_release(link);
143 kfree(link->priv);
144} /* avmcs_detach */ 104} /* avmcs_detach */
145 105
146/*====================================================================== 106/*======================================================================
@@ -171,14 +131,11 @@ static int avmcs_configcheck(struct pcmcia_device *p_dev,
171 131
172static int avmcs_config(struct pcmcia_device *link) 132static int avmcs_config(struct pcmcia_device *link)
173{ 133{
174 local_info_t *dev; 134 int i = -1;
175 int i;
176 char devname[128]; 135 char devname[128];
177 int cardtype; 136 int cardtype;
178 int (*addcard)(unsigned int port, unsigned irq); 137 int (*addcard)(unsigned int port, unsigned irq);
179 138
180 dev = link->priv;
181
182 devname[0] = 0; 139 devname[0] = 0;
183 if (link->prod_id[1]) 140 if (link->prod_id[1])
184 strlcpy(devname, link->prod_id[1], sizeof(devname)); 141 strlcpy(devname, link->prod_id[1], sizeof(devname));
@@ -190,11 +147,7 @@ static int avmcs_config(struct pcmcia_device *link)
190 return -ENODEV; 147 return -ENODEV;
191 148
192 do { 149 do {
193 /* 150 if (!link->irq) {
194 * allocate an interrupt line
195 */
196 i = pcmcia_request_irq(link, &link->irq);
197 if (i != 0) {
198 /* undo */ 151 /* undo */
199 pcmcia_disable_device(link); 152 pcmcia_disable_device(link);
200 break; 153 break;
@@ -211,15 +164,11 @@ static int avmcs_config(struct pcmcia_device *link)
211 164
212 } while (0); 165 } while (0);
213 166
214 /* At this point, the dev_node_t structure(s) should be
215 initialized and arranged in a linked list at link->dev. */
216
217 if (devname[0]) { 167 if (devname[0]) {
218 char *s = strrchr(devname, ' '); 168 char *s = strrchr(devname, ' ');
219 if (!s) 169 if (!s)
220 s = devname; 170 s = devname;
221 else s++; 171 else s++;
222 strcpy(dev->node.dev_name, s);
223 if (strcmp("M1", s) == 0) { 172 if (strcmp("M1", s) == 0) {
224 cardtype = AVM_CARDTYPE_M1; 173 cardtype = AVM_CARDTYPE_M1;
225 } else if (strcmp("M2", s) == 0) { 174 } else if (strcmp("M2", s) == 0) {
@@ -227,14 +176,8 @@ static int avmcs_config(struct pcmcia_device *link)
227 } else { 176 } else {
228 cardtype = AVM_CARDTYPE_B1; 177 cardtype = AVM_CARDTYPE_B1;
229 } 178 }
230 } else { 179 } else
231 strcpy(dev->node.dev_name, "b1");
232 cardtype = AVM_CARDTYPE_B1; 180 cardtype = AVM_CARDTYPE_B1;
233 }
234
235 dev->node.major = 64;
236 dev->node.minor = 0;
237 link->dev_node = &dev->node;
238 181
239 /* If any step failed, release any partially configured state */ 182 /* If any step failed, release any partially configured state */
240 if (i != 0) { 183 if (i != 0) {
@@ -249,13 +192,12 @@ static int avmcs_config(struct pcmcia_device *link)
249 default: 192 default:
250 case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break; 193 case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break;
251 } 194 }
252 if ((i = (*addcard)(link->io.BasePort1, link->irq.AssignedIRQ)) < 0) { 195 if ((i = (*addcard)(link->io.BasePort1, link->irq)) < 0) {
253 printk(KERN_ERR "avm_cs: failed to add AVM-%s-Controller at i/o %#x, irq %d\n", 196 dev_err(&link->dev, "avm_cs: failed to add AVM-Controller at i/o %#x, irq %d\n",
254 dev->node.dev_name, link->io.BasePort1, link->irq.AssignedIRQ); 197 link->io.BasePort1, link->irq);
255 avmcs_release(link); 198 avmcs_release(link);
256 return -ENODEV; 199 return -ENODEV;
257 } 200 }
258 dev->node.minor = i;
259 return 0; 201 return 0;
260 202
261} /* avmcs_config */ 203} /* avmcs_config */
@@ -270,7 +212,7 @@ static int avmcs_config(struct pcmcia_device *link)
270 212
271static void avmcs_release(struct pcmcia_device *link) 213static void avmcs_release(struct pcmcia_device *link)
272{ 214{
273 b1pcmcia_delcard(link->io.BasePort1, link->irq.AssignedIRQ); 215 b1pcmcia_delcard(link->io.BasePort1, link->irq);
274 pcmcia_disable_device(link); 216 pcmcia_disable_device(link);
275} /* avmcs_release */ 217} /* avmcs_release */
276 218
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index 8d1d63a02b34..a80a7617f16f 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -62,31 +62,6 @@ static void avma1cs_release(struct pcmcia_device *link);
62static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit ; 62static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit ;
63 63
64 64
65/*
66 A linked list of "instances" of the skeleton device. Each actual
67 PCMCIA card corresponds to one device instance, and is described
68 by one struct pcmcia_device structure (defined in ds.h).
69
70 You may not want to use a linked list for this -- for example, the
71 memory card driver uses an array of struct pcmcia_device pointers, where minor
72 device numbers are used to derive the corresponding array index.
73*/
74
75/*
76 A driver needs to provide a dev_node_t structure for each device
77 on a card. In some cases, there is only one device per card (for
78 example, ethernet cards, modems). In other cases, there may be
79 many actual or logical devices (SCSI adapters, memory cards with
80 multiple partitions). The dev_node_t structures need to be kept
81 in a linked list starting at the 'dev' field of a struct pcmcia_device
82 structure. We allocate them in the card's private data structure,
83 because they generally can't be allocated dynamically.
84*/
85
86typedef struct local_info_t {
87 dev_node_t node;
88} local_info_t;
89
90/*====================================================================== 65/*======================================================================
91 66
92 avma1cs_attach() creates an "instance" of the driver, allocating 67 avma1cs_attach() creates an "instance" of the driver, allocating
@@ -101,17 +76,8 @@ typedef struct local_info_t {
101 76
102static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) 77static int __devinit avma1cs_probe(struct pcmcia_device *p_dev)
103{ 78{
104 local_info_t *local;
105
106 dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); 79 dev_dbg(&p_dev->dev, "avma1cs_attach()\n");
107 80
108 /* Allocate space for private device-specific data */
109 local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
110 if (!local)
111 return -ENOMEM;
112
113 p_dev->priv = local;
114
115 /* The io structure describes IO port mapping */ 81 /* The io structure describes IO port mapping */
116 p_dev->io.NumPorts1 = 16; 82 p_dev->io.NumPorts1 = 16;
117 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 83 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
@@ -119,9 +85,6 @@ static int __devinit avma1cs_probe(struct pcmcia_device *p_dev)
119 p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_16; 85 p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_16;
120 p_dev->io.IOAddrLines = 5; 86 p_dev->io.IOAddrLines = 5;
121 87
122 /* Interrupt setup */
123 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
124
125 /* General socket configuration */ 88 /* General socket configuration */
126 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 89 p_dev->conf.Attributes = CONF_ENABLE_IRQ;
127 p_dev->conf.IntType = INT_MEMORY_AND_IO; 90 p_dev->conf.IntType = INT_MEMORY_AND_IO;
@@ -176,14 +139,11 @@ static int avma1cs_configcheck(struct pcmcia_device *p_dev,
176 139
177static int __devinit avma1cs_config(struct pcmcia_device *link) 140static int __devinit avma1cs_config(struct pcmcia_device *link)
178{ 141{
179 local_info_t *dev; 142 int i = -1;
180 int i;
181 char devname[128]; 143 char devname[128];
182 IsdnCard_t icard; 144 IsdnCard_t icard;
183 int busy = 0; 145 int busy = 0;
184 146
185 dev = link->priv;
186
187 dev_dbg(&link->dev, "avma1cs_config(0x%p)\n", link); 147 dev_dbg(&link->dev, "avma1cs_config(0x%p)\n", link);
188 148
189 devname[0] = 0; 149 devname[0] = 0;
@@ -197,8 +157,7 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
197 /* 157 /*
198 * allocate an interrupt line 158 * allocate an interrupt line
199 */ 159 */
200 i = pcmcia_request_irq(link, &link->irq); 160 if (!link->irq) {
201 if (i != 0) {
202 /* undo */ 161 /* undo */
203 pcmcia_disable_device(link); 162 pcmcia_disable_device(link);
204 break; 163 break;
@@ -215,14 +174,6 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
215 174
216 } while (0); 175 } while (0);
217 176
218 /* At this point, the dev_node_t structure(s) should be
219 initialized and arranged in a linked list at link->dev. */
220
221 strcpy(dev->node.dev_name, "A1");
222 dev->node.major = 45;
223 dev->node.minor = 0;
224 link->dev_node = &dev->node;
225
226 /* If any step failed, release any partially configured state */ 177 /* If any step failed, release any partially configured state */
227 if (i != 0) { 178 if (i != 0) {
228 avma1cs_release(link); 179 avma1cs_release(link);
@@ -230,9 +181,9 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
230 } 181 }
231 182
232 printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n", 183 printk(KERN_NOTICE "avma1_cs: checking at i/o %#x, irq %d\n",
233 link->io.BasePort1, link->irq.AssignedIRQ); 184 link->io.BasePort1, link->irq);
234 185
235 icard.para[0] = link->irq.AssignedIRQ; 186 icard.para[0] = link->irq;
236 icard.para[1] = link->io.BasePort1; 187 icard.para[1] = link->io.BasePort1;
237 icard.protocol = isdnprot; 188 icard.protocol = isdnprot;
238 icard.typ = ISDN_CTYPE_A1_PCMCIA; 189 icard.typ = ISDN_CTYPE_A1_PCMCIA;
@@ -243,7 +194,7 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
243 avma1cs_release(link); 194 avma1cs_release(link);
244 return -ENODEV; 195 return -ENODEV;
245 } 196 }
246 dev->node.minor = i; 197 link->priv = (void *) (unsigned long) i;
247 198
248 return 0; 199 return 0;
249} /* avma1cs_config */ 200} /* avma1cs_config */
@@ -258,12 +209,12 @@ static int __devinit avma1cs_config(struct pcmcia_device *link)
258 209
259static void avma1cs_release(struct pcmcia_device *link) 210static void avma1cs_release(struct pcmcia_device *link)
260{ 211{
261 local_info_t *local = link->priv; 212 unsigned long minor = (unsigned long) link->priv;
262 213
263 dev_dbg(&link->dev, "avma1cs_release(0x%p)\n", link); 214 dev_dbg(&link->dev, "avma1cs_release(0x%p)\n", link);
264 215
265 /* now unregister function with hisax */ 216 /* now unregister function with hisax */
266 HiSax_closecard(local->node.minor); 217 HiSax_closecard(minor);
267 218
268 pcmcia_disable_device(link); 219 pcmcia_disable_device(link);
269} /* avma1cs_release */ 220} /* avma1cs_release */
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index c9f2279e21f5..218927e3a4ea 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -87,24 +87,8 @@ static void elsa_cs_release(struct pcmcia_device *link);
87 87
88static void elsa_cs_detach(struct pcmcia_device *p_dev) __devexit; 88static void elsa_cs_detach(struct pcmcia_device *p_dev) __devexit;
89 89
90/*
91 A driver needs to provide a dev_node_t structure for each device
92 on a card. In some cases, there is only one device per card (for
93 example, ethernet cards, modems). In other cases, there may be
94 many actual or logical devices (SCSI adapters, memory cards with
95 multiple partitions). The dev_node_t structures need to be kept
96 in a linked list starting at the 'dev' field of a struct pcmcia_device
97 structure. We allocate them in the card's private data structure,
98 because they generally shouldn't be allocated dynamically.
99 In this case, we also provide a flag to indicate if a device is
100 "stopped" due to a power management event, or card ejection. The
101 device IO routines can use a flag like this to throttle IO to a
102 card that is not ready to accept it.
103*/
104
105typedef struct local_info_t { 90typedef struct local_info_t {
106 struct pcmcia_device *p_dev; 91 struct pcmcia_device *p_dev;
107 dev_node_t node;
108 int busy; 92 int busy;
109 int cardnr; 93 int cardnr;
110} local_info_t; 94} local_info_t;
@@ -136,10 +120,6 @@ static int __devinit elsa_cs_probe(struct pcmcia_device *link)
136 120
137 local->cardnr = -1; 121 local->cardnr = -1;
138 122
139 /* Interrupt setup */
140 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
141 link->irq.Handler = NULL;
142
143 /* 123 /*
144 General socket configuration defaults can go here. In this 124 General socket configuration defaults can go here. In this
145 client, we assume very little, and rely on the CIS for almost 125 client, we assume very little, and rely on the CIS for almost
@@ -223,28 +203,18 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link)
223 if (i != 0) 203 if (i != 0)
224 goto failed; 204 goto failed;
225 205
226 i = pcmcia_request_irq(link, &link->irq); 206 if (!link->irq)
227 if (i != 0) {
228 link->irq.AssignedIRQ = 0;
229 goto failed; 207 goto failed;
230 }
231 208
232 i = pcmcia_request_configuration(link, &link->conf); 209 i = pcmcia_request_configuration(link, &link->conf);
233 if (i != 0) 210 if (i != 0)
234 goto failed; 211 goto failed;
235 212
236 /* At this point, the dev_node_t structure(s) should be
237 initialized and arranged in a linked list at link->dev. *//* */
238 sprintf(dev->node.dev_name, "elsa");
239 dev->node.major = dev->node.minor = 0x0;
240
241 link->dev_node = &dev->node;
242
243 /* Finally, report what we've done */ 213 /* Finally, report what we've done */
244 printk(KERN_INFO "%s: index 0x%02x: ", 214 dev_info(&link->dev, "index 0x%02x: ",
245 dev->node.dev_name, link->conf.ConfigIndex); 215 link->conf.ConfigIndex);
246 if (link->conf.Attributes & CONF_ENABLE_IRQ) 216 if (link->conf.Attributes & CONF_ENABLE_IRQ)
247 printk(", irq %d", link->irq.AssignedIRQ); 217 printk(", irq %d", link->irq);
248 if (link->io.NumPorts1) 218 if (link->io.NumPorts1)
249 printk(", io 0x%04x-0x%04x", link->io.BasePort1, 219 printk(", io 0x%04x-0x%04x", link->io.BasePort1,
250 link->io.BasePort1+link->io.NumPorts1-1); 220 link->io.BasePort1+link->io.NumPorts1-1);
@@ -253,7 +223,7 @@ static int __devinit elsa_cs_config(struct pcmcia_device *link)
253 link->io.BasePort2+link->io.NumPorts2-1); 223 link->io.BasePort2+link->io.NumPorts2-1);
254 printk("\n"); 224 printk("\n");
255 225
256 icard.para[0] = link->irq.AssignedIRQ; 226 icard.para[0] = link->irq;
257 icard.para[1] = link->io.BasePort1; 227 icard.para[1] = link->io.BasePort1;
258 icard.protocol = protocol; 228 icard.protocol = protocol;
259 icard.typ = ISDN_CTYPE_ELSA_PCMCIA; 229 icard.typ = ISDN_CTYPE_ELSA_PCMCIA;
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index 71b3ddef03bb..1f4feaab21af 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -87,32 +87,8 @@ static void sedlbauer_release(struct pcmcia_device *link);
87 87
88static void sedlbauer_detach(struct pcmcia_device *p_dev) __devexit; 88static void sedlbauer_detach(struct pcmcia_device *p_dev) __devexit;
89 89
90/*
91 You'll also need to prototype all the functions that will actually
92 be used to talk to your device. See 'memory_cs' for a good example
93 of a fully self-sufficient driver; the other drivers rely more or
94 less on other parts of the kernel.
95*/
96
97/*
98 A driver needs to provide a dev_node_t structure for each device
99 on a card. In some cases, there is only one device per card (for
100 example, ethernet cards, modems). In other cases, there may be
101 many actual or logical devices (SCSI adapters, memory cards with
102 multiple partitions). The dev_node_t structures need to be kept
103 in a linked list starting at the 'dev' field of a struct pcmcia_device
104 structure. We allocate them in the card's private data structure,
105 because they generally shouldn't be allocated dynamically.
106
107 In this case, we also provide a flag to indicate if a device is
108 "stopped" due to a power management event, or card ejection. The
109 device IO routines can use a flag like this to throttle IO to a
110 card that is not ready to accept it.
111*/
112
113typedef struct local_info_t { 90typedef struct local_info_t {
114 struct pcmcia_device *p_dev; 91 struct pcmcia_device *p_dev;
115 dev_node_t node;
116 int stop; 92 int stop;
117 int cardnr; 93 int cardnr;
118} local_info_t; 94} local_info_t;
@@ -143,10 +119,6 @@ static int __devinit sedlbauer_probe(struct pcmcia_device *link)
143 local->p_dev = link; 119 local->p_dev = link;
144 link->priv = local; 120 link->priv = local;
145 121
146 /* Interrupt setup */
147 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
148 link->irq.Handler = NULL;
149
150 /* 122 /*
151 General socket configuration defaults can go here. In this 123 General socket configuration defaults can go here. In this
152 client, we assume very little, and rely on the CIS for almost 124 client, we assume very little, and rely on the CIS for almost
@@ -227,9 +199,7 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
227 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM)) 199 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
228 p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; 200 p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
229 201
230 /* Do we need to allocate an interrupt? */ 202 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
231 if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
232 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
233 203
234 /* IO window settings */ 204 /* IO window settings */
235 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 205 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
@@ -285,7 +255,6 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
285 255
286static int __devinit sedlbauer_config(struct pcmcia_device *link) 256static int __devinit sedlbauer_config(struct pcmcia_device *link)
287{ 257{
288 local_info_t *dev = link->priv;
289 win_req_t *req; 258 win_req_t *req;
290 int ret; 259 int ret;
291 IsdnCard_t icard; 260 IsdnCard_t icard;
@@ -313,17 +282,6 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link)
313 goto failed; 282 goto failed;
314 283
315 /* 284 /*
316 Allocate an interrupt line. Note that this does not assign a
317 handler to the interrupt, unless the 'Handler' member of the
318 irq structure is initialized.
319 */
320 if (link->conf.Attributes & CONF_ENABLE_IRQ) {
321 ret = pcmcia_request_irq(link, &link->irq);
322 if (ret)
323 goto failed;
324 }
325
326 /*
327 This actually configures the PCMCIA socket -- setting up 285 This actually configures the PCMCIA socket -- setting up
328 the I/O windows and the interrupt mapping, and putting the 286 the I/O windows and the interrupt mapping, and putting the
329 card and host interface into "Memory and IO" mode. 287 card and host interface into "Memory and IO" mode.
@@ -332,21 +290,13 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link)
332 if (ret) 290 if (ret)
333 goto failed; 291 goto failed;
334 292
335 /*
336 At this point, the dev_node_t structure(s) need to be
337 initialized and arranged in a linked list at link->dev.
338 */
339 sprintf(dev->node.dev_name, "sedlbauer");
340 dev->node.major = dev->node.minor = 0;
341 link->dev_node = &dev->node;
342
343 /* Finally, report what we've done */ 293 /* Finally, report what we've done */
344 printk(KERN_INFO "%s: index 0x%02x:", 294 dev_info(&link->dev, "index 0x%02x:",
345 dev->node.dev_name, link->conf.ConfigIndex); 295 link->conf.ConfigIndex);
346 if (link->conf.Vpp) 296 if (link->conf.Vpp)
347 printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); 297 printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10);
348 if (link->conf.Attributes & CONF_ENABLE_IRQ) 298 if (link->conf.Attributes & CONF_ENABLE_IRQ)
349 printk(", irq %d", link->irq.AssignedIRQ); 299 printk(", irq %d", link->irq);
350 if (link->io.NumPorts1) 300 if (link->io.NumPorts1)
351 printk(", io 0x%04x-0x%04x", link->io.BasePort1, 301 printk(", io 0x%04x-0x%04x", link->io.BasePort1,
352 link->io.BasePort1+link->io.NumPorts1-1); 302 link->io.BasePort1+link->io.NumPorts1-1);
@@ -358,7 +308,7 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link)
358 req->Base+req->Size-1); 308 req->Base+req->Size-1);
359 printk("\n"); 309 printk("\n");
360 310
361 icard.para[0] = link->irq.AssignedIRQ; 311 icard.para[0] = link->irq;
362 icard.para[1] = link->io.BasePort1; 312 icard.para[1] = link->io.BasePort1;
363 icard.protocol = protocol; 313 icard.protocol = protocol;
364 icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA; 314 icard.typ = ISDN_CTYPE_SEDLBAUER_PCMCIA;
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index d010a0da8e19..5771955cc532 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -68,34 +68,8 @@ static void teles_cs_release(struct pcmcia_device *link);
68 68
69static void teles_detach(struct pcmcia_device *p_dev) __devexit ; 69static void teles_detach(struct pcmcia_device *p_dev) __devexit ;
70 70
71/*
72 A linked list of "instances" of the teles_cs device. Each actual
73 PCMCIA card corresponds to one device instance, and is described
74 by one struct pcmcia_device structure (defined in ds.h).
75
76 You may not want to use a linked list for this -- for example, the
77 memory card driver uses an array of struct pcmcia_device pointers, where minor
78 device numbers are used to derive the corresponding array index.
79*/
80
81/*
82 A driver needs to provide a dev_node_t structure for each device
83 on a card. In some cases, there is only one device per card (for
84 example, ethernet cards, modems). In other cases, there may be
85 many actual or logical devices (SCSI adapters, memory cards with
86 multiple partitions). The dev_node_t structures need to be kept
87 in a linked list starting at the 'dev' field of a struct pcmcia_device
88 structure. We allocate them in the card's private data structure,
89 because they generally shouldn't be allocated dynamically.
90 In this case, we also provide a flag to indicate if a device is
91 "stopped" due to a power management event, or card ejection. The
92 device IO routines can use a flag like this to throttle IO to a
93 card that is not ready to accept it.
94*/
95
96typedef struct local_info_t { 71typedef struct local_info_t {
97 struct pcmcia_device *p_dev; 72 struct pcmcia_device *p_dev;
98 dev_node_t node;
99 int busy; 73 int busy;
100 int cardnr; 74 int cardnr;
101} local_info_t; 75} local_info_t;
@@ -126,10 +100,6 @@ static int __devinit teles_probe(struct pcmcia_device *link)
126 local->p_dev = link; 100 local->p_dev = link;
127 link->priv = local; 101 link->priv = local;
128 102
129 /* Interrupt setup */
130 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
131 link->irq.Handler = NULL;
132
133 /* 103 /*
134 General socket configuration defaults can go here. In this 104 General socket configuration defaults can go here. In this
135 client, we assume very little, and rely on the CIS for almost 105 client, we assume very little, and rely on the CIS for almost
@@ -213,28 +183,18 @@ static int __devinit teles_cs_config(struct pcmcia_device *link)
213 if (i != 0) 183 if (i != 0)
214 goto cs_failed; 184 goto cs_failed;
215 185
216 i = pcmcia_request_irq(link, &link->irq); 186 if (!link->irq)
217 if (i != 0) {
218 link->irq.AssignedIRQ = 0;
219 goto cs_failed; 187 goto cs_failed;
220 }
221 188
222 i = pcmcia_request_configuration(link, &link->conf); 189 i = pcmcia_request_configuration(link, &link->conf);
223 if (i != 0) 190 if (i != 0)
224 goto cs_failed; 191 goto cs_failed;
225 192
226 /* At this point, the dev_node_t structure(s) should be
227 initialized and arranged in a linked list at link->dev. *//* */
228 sprintf(dev->node.dev_name, "teles");
229 dev->node.major = dev->node.minor = 0x0;
230
231 link->dev_node = &dev->node;
232
233 /* Finally, report what we've done */ 193 /* Finally, report what we've done */
234 printk(KERN_INFO "%s: index 0x%02x:", 194 dev_info(&link->dev, "index 0x%02x:",
235 dev->node.dev_name, link->conf.ConfigIndex); 195 link->conf.ConfigIndex);
236 if (link->conf.Attributes & CONF_ENABLE_IRQ) 196 if (link->conf.Attributes & CONF_ENABLE_IRQ)
237 printk(", irq %d", link->irq.AssignedIRQ); 197 printk(", irq %d", link->irq);
238 if (link->io.NumPorts1) 198 if (link->io.NumPorts1)
239 printk(", io 0x%04x-0x%04x", link->io.BasePort1, 199 printk(", io 0x%04x-0x%04x", link->io.BasePort1,
240 link->io.BasePort1+link->io.NumPorts1-1); 200 link->io.BasePort1+link->io.NumPorts1-1);
@@ -243,7 +203,7 @@ static int __devinit teles_cs_config(struct pcmcia_device *link)
243 link->io.BasePort2+link->io.NumPorts2-1); 203 link->io.BasePort2+link->io.NumPorts2-1);
244 printk("\n"); 204 printk("\n");
245 205
246 icard.para[0] = link->irq.AssignedIRQ; 206 icard.para[0] = link->irq;
247 icard.para[1] = link->io.BasePort1; 207 icard.para[1] = link->io.BasePort1;
248 icard.protocol = protocol; 208 icard.protocol = protocol;
249 icard.typ = ISDN_CTYPE_TELESPCMCIA; 209 icard.typ = ISDN_CTYPE_TELESPCMCIA;