aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-05 04:45:09 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:15:57 -0500
commitfd238232cd0ff4840ae6946bb338502154096d88 (patch)
treed20e8f5871f7cff9d0867a84f6ba088fbffcbe28 /drivers/isdn
parenta78f4dd331a4f6a396eb5849656a4a72a70a56d7 (diff)
[PATCH] pcmcia: embed dev_link_t into struct pcmcia_device
Embed dev_link_t into struct pcmcia_device(), as they basically address the same entity. The actual contents of dev_link_t will be cleaned up step by step. This patch includes a bugfix from and signed-off-by Andrew Morton. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c45
-rw-r--r--drivers/isdn/hisax/avma1_cs.c48
-rw-r--r--drivers/isdn/hisax/elsa_cs.c14
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c16
-rw-r--r--drivers/isdn/hisax/teles_cs.c13
5 files changed, 54 insertions, 82 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 0c504dc49acf..3b7461ece505 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -101,49 +101,37 @@ typedef struct local_info_t {
101 101
102static int avmcs_attach(struct pcmcia_device *p_dev) 102static int avmcs_attach(struct pcmcia_device *p_dev)
103{ 103{
104 dev_link_t *link;
105 local_info_t *local; 104 local_info_t *local;
106 105
107 /* Initialize the dev_link_t structure */
108 link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
109 if (!link)
110 goto err;
111 memset(link, 0, sizeof(struct dev_link_t));
112
113 /* The io structure describes IO port mapping */ 106 /* The io structure describes IO port mapping */
114 link->io.NumPorts1 = 16; 107 p_dev->io.NumPorts1 = 16;
115 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 108 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
116 link->io.NumPorts2 = 0; 109 p_dev->io.NumPorts2 = 0;
117 110
118 /* Interrupt setup */ 111 /* Interrupt setup */
119 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 112 p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
120 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 113 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
114
115 p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
121 116
122 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
123
124 /* General socket configuration */ 117 /* General socket configuration */
125 link->conf.Attributes = CONF_ENABLE_IRQ; 118 p_dev->conf.Attributes = CONF_ENABLE_IRQ;
126 link->conf.IntType = INT_MEMORY_AND_IO; 119 p_dev->conf.IntType = INT_MEMORY_AND_IO;
127 link->conf.ConfigIndex = 1; 120 p_dev->conf.ConfigIndex = 1;
128 link->conf.Present = PRESENT_OPTION; 121 p_dev->conf.Present = PRESENT_OPTION;
129 122
130 /* Allocate space for private device-specific data */ 123 /* Allocate space for private device-specific data */
131 local = kmalloc(sizeof(local_info_t), GFP_KERNEL); 124 local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
132 if (!local) 125 if (!local)
133 goto err_kfree; 126 goto err;
134 memset(local, 0, sizeof(local_info_t)); 127 memset(local, 0, sizeof(local_info_t));
135 link->priv = local; 128 p_dev->priv = local;
136
137 link->handle = p_dev;
138 p_dev->instance = link;
139 129
140 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 130 p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
141 avmcs_config(link); 131 avmcs_config(p_dev);
142 132
143 return 0; 133 return 0;
144 134
145 err_kfree:
146 kfree(link);
147 err: 135 err:
148 return -EINVAL; 136 return -EINVAL;
149} /* avmcs_attach */ 137} /* avmcs_attach */
@@ -165,7 +153,6 @@ static void avmcs_detach(struct pcmcia_device *p_dev)
165 avmcs_release(link); 153 avmcs_release(link);
166 154
167 kfree(link->priv); 155 kfree(link->priv);
168 kfree(link);
169} /* avmcs_detach */ 156} /* avmcs_detach */
170 157
171/*====================================================================== 158/*======================================================================
@@ -330,7 +317,7 @@ found_port:
330 317
331 dev->node.major = 64; 318 dev->node.major = 64;
332 dev->node.minor = 0; 319 dev->node.minor = 0;
333 link->dev = &dev->node; 320 link->dev_node = &dev->node;
334 321
335 link->state &= ~DEV_CONFIG_PENDING; 322 link->state &= ~DEV_CONFIG_PENDING;
336 /* If any step failed, release any partially configured state */ 323 /* If any step failed, release any partially configured state */
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index 8d23e5ab8d01..f7143fe1a2e7 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -118,50 +118,39 @@ typedef struct local_info_t {
118 118
119static int avma1cs_attach(struct pcmcia_device *p_dev) 119static int avma1cs_attach(struct pcmcia_device *p_dev)
120{ 120{
121 dev_link_t *link;
122 local_info_t *local; 121 local_info_t *local;
123 122
124 DEBUG(0, "avma1cs_attach()\n"); 123 DEBUG(0, "avma1cs_attach()\n");
125 124
126 /* Initialize the dev_link_t structure */
127 link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
128 if (!link)
129 return -ENOMEM;
130 memset(link, 0, sizeof(struct dev_link_t));
131
132 /* Allocate space for private device-specific data */ 125 /* Allocate space for private device-specific data */
133 local = kmalloc(sizeof(local_info_t), GFP_KERNEL); 126 local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
134 if (!local) { 127 if (!local)
135 kfree(link);
136 return -ENOMEM; 128 return -ENOMEM;
137 } 129
138 memset(local, 0, sizeof(local_info_t)); 130 memset(local, 0, sizeof(local_info_t));
139 link->priv = local; 131 p_dev->priv = local;
140 132
141 /* The io structure describes IO port mapping */ 133 /* The io structure describes IO port mapping */
142 link->io.NumPorts1 = 16; 134 p_dev->io.NumPorts1 = 16;
143 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 135 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
144 link->io.NumPorts2 = 16; 136 p_dev->io.NumPorts2 = 16;
145 link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; 137 p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_16;
146 link->io.IOAddrLines = 5; 138 p_dev->io.IOAddrLines = 5;
147 139
148 /* Interrupt setup */ 140 /* Interrupt setup */
149 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 141 p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
150 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 142 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
151 143
152 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 144 p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
153 145
154 /* General socket configuration */ 146 /* General socket configuration */
155 link->conf.Attributes = CONF_ENABLE_IRQ; 147 p_dev->conf.Attributes = CONF_ENABLE_IRQ;
156 link->conf.IntType = INT_MEMORY_AND_IO; 148 p_dev->conf.IntType = INT_MEMORY_AND_IO;
157 link->conf.ConfigIndex = 1; 149 p_dev->conf.ConfigIndex = 1;
158 link->conf.Present = PRESENT_OPTION; 150 p_dev->conf.Present = PRESENT_OPTION;
159
160 link->handle = p_dev;
161 p_dev->instance = link;
162 151
163 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 152 p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
164 avma1cs_config(link); 153 avma1cs_config(p_dev);
165 154
166 return 0; 155 return 0;
167} /* avma1cs_attach */ 156} /* avma1cs_attach */
@@ -185,7 +174,6 @@ static void avma1cs_detach(struct pcmcia_device *p_dev)
185 avma1cs_release(link); 174 avma1cs_release(link);
186 175
187 kfree(link->priv); 176 kfree(link->priv);
188 kfree(link);
189} /* avma1cs_detach */ 177} /* avma1cs_detach */
190 178
191/*====================================================================== 179/*======================================================================
@@ -335,7 +323,7 @@ found_port:
335 strcpy(dev->node.dev_name, "A1"); 323 strcpy(dev->node.dev_name, "A1");
336 dev->node.major = 45; 324 dev->node.major = 45;
337 dev->node.minor = 0; 325 dev->node.minor = 0;
338 link->dev = &dev->node; 326 link->dev_node = &dev->node;
339 327
340 link->state &= ~DEV_CONFIG_PENDING; 328 link->state &= ~DEV_CONFIG_PENDING;
341 /* If any step failed, release any partially configured state */ 329 /* If any step failed, release any partially configured state */
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index 00835d537c10..bcda675e9103 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -121,7 +121,7 @@ static void elsa_cs_detach(struct pcmcia_device *p_dev);
121*/ 121*/
122 122
123typedef struct local_info_t { 123typedef struct local_info_t {
124 dev_link_t link; 124 struct pcmcia_device *p_dev;
125 dev_node_t node; 125 dev_node_t node;
126 int busy; 126 int busy;
127 int cardnr; 127 int cardnr;
@@ -141,8 +141,8 @@ typedef struct local_info_t {
141 141
142static int elsa_cs_attach(struct pcmcia_device *p_dev) 142static int elsa_cs_attach(struct pcmcia_device *p_dev)
143{ 143{
144 dev_link_t *link;
145 local_info_t *local; 144 local_info_t *local;
145 dev_link_t *link = dev_to_instance(p_dev);
146 146
147 DEBUG(0, "elsa_cs_attach()\n"); 147 DEBUG(0, "elsa_cs_attach()\n");
148 148
@@ -150,8 +150,11 @@ static int elsa_cs_attach(struct pcmcia_device *p_dev)
150 local = kmalloc(sizeof(local_info_t), GFP_KERNEL); 150 local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
151 if (!local) return -ENOMEM; 151 if (!local) return -ENOMEM;
152 memset(local, 0, sizeof(local_info_t)); 152 memset(local, 0, sizeof(local_info_t));
153
154 local->p_dev = p_dev;
155 link->priv = local;
156
153 local->cardnr = -1; 157 local->cardnr = -1;
154 link = &local->link; link->priv = local;
155 158
156 /* Interrupt setup */ 159 /* Interrupt setup */
157 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 160 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
@@ -172,9 +175,6 @@ static int elsa_cs_attach(struct pcmcia_device *p_dev)
172 link->conf.Attributes = CONF_ENABLE_IRQ; 175 link->conf.Attributes = CONF_ENABLE_IRQ;
173 link->conf.IntType = INT_MEMORY_AND_IO; 176 link->conf.IntType = INT_MEMORY_AND_IO;
174 177
175 link->handle = p_dev;
176 p_dev->instance = link;
177
178 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 178 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
179 elsa_cs_config(link); 179 elsa_cs_config(link);
180 180
@@ -320,7 +320,7 @@ static void elsa_cs_config(dev_link_t *link)
320 sprintf(dev->node.dev_name, "elsa"); 320 sprintf(dev->node.dev_name, "elsa");
321 dev->node.major = dev->node.minor = 0x0; 321 dev->node.major = dev->node.minor = 0x0;
322 322
323 link->dev = &dev->node; 323 link->dev_node = &dev->node;
324 324
325 /* Finally, report what we've done */ 325 /* Finally, report what we've done */
326 printk(KERN_INFO "%s: index 0x%02x: ", 326 printk(KERN_INFO "%s: index 0x%02x: ",
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index a3cd1c556352..6025722001fa 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -130,7 +130,7 @@ static void sedlbauer_detach(struct pcmcia_device *p_dev);
130*/ 130*/
131 131
132typedef struct local_info_t { 132typedef struct local_info_t {
133 dev_link_t link; 133 struct pcmcia_device *p_dev;
134 dev_node_t node; 134 dev_node_t node;
135 int stop; 135 int stop;
136 int cardnr; 136 int cardnr;
@@ -151,7 +151,7 @@ typedef struct local_info_t {
151static int sedlbauer_attach(struct pcmcia_device *p_dev) 151static int sedlbauer_attach(struct pcmcia_device *p_dev)
152{ 152{
153 local_info_t *local; 153 local_info_t *local;
154 dev_link_t *link; 154 dev_link_t *link = dev_to_instance(p_dev);
155 155
156 DEBUG(0, "sedlbauer_attach()\n"); 156 DEBUG(0, "sedlbauer_attach()\n");
157 157
@@ -160,8 +160,10 @@ static int sedlbauer_attach(struct pcmcia_device *p_dev)
160 if (!local) return -ENOMEM; 160 if (!local) return -ENOMEM;
161 memset(local, 0, sizeof(local_info_t)); 161 memset(local, 0, sizeof(local_info_t));
162 local->cardnr = -1; 162 local->cardnr = -1;
163 link = &local->link; link->priv = local; 163
164 164 local->p_dev = p_dev;
165 link->priv = local;
166
165 /* Interrupt setup */ 167 /* Interrupt setup */
166 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 168 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
167 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 169 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
@@ -182,13 +184,9 @@ static int sedlbauer_attach(struct pcmcia_device *p_dev)
182 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 184 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
183 link->io.IOAddrLines = 3; 185 link->io.IOAddrLines = 3;
184 186
185
186 link->conf.Attributes = 0; 187 link->conf.Attributes = 0;
187 link->conf.IntType = INT_MEMORY_AND_IO; 188 link->conf.IntType = INT_MEMORY_AND_IO;
188 189
189 link->handle = p_dev;
190 p_dev->instance = link;
191
192 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 190 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
193 sedlbauer_config(link); 191 sedlbauer_config(link);
194 192
@@ -397,7 +395,7 @@ static void sedlbauer_config(dev_link_t *link)
397 */ 395 */
398 sprintf(dev->node.dev_name, "sedlbauer"); 396 sprintf(dev->node.dev_name, "sedlbauer");
399 dev->node.major = dev->node.minor = 0; 397 dev->node.major = dev->node.minor = 0;
400 link->dev = &dev->node; 398 link->dev_node = &dev->node;
401 399
402 /* Finally, report what we've done */ 400 /* Finally, report what we've done */
403 printk(KERN_INFO "%s: index 0x%02x:", 401 printk(KERN_INFO "%s: index 0x%02x:",
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index 040f098d4b26..ea16ebfc028a 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -112,7 +112,7 @@ static void teles_detach(struct pcmcia_device *p_dev);
112*/ 112*/
113 113
114typedef struct local_info_t { 114typedef struct local_info_t {
115 dev_link_t link; 115 struct pcmcia_device *p_dev;
116 dev_node_t node; 116 dev_node_t node;
117 int busy; 117 int busy;
118 int cardnr; 118 int cardnr;
@@ -132,8 +132,8 @@ typedef struct local_info_t {
132 132
133static int teles_attach(struct pcmcia_device *p_dev) 133static int teles_attach(struct pcmcia_device *p_dev)
134{ 134{
135 dev_link_t *link;
136 local_info_t *local; 135 local_info_t *local;
136 dev_link_t *link = dev_to_instance(p_dev);
137 137
138 DEBUG(0, "teles_attach()\n"); 138 DEBUG(0, "teles_attach()\n");
139 139
@@ -142,7 +142,9 @@ static int teles_attach(struct pcmcia_device *p_dev)
142 if (!local) return -ENOMEM; 142 if (!local) return -ENOMEM;
143 memset(local, 0, sizeof(local_info_t)); 143 memset(local, 0, sizeof(local_info_t));
144 local->cardnr = -1; 144 local->cardnr = -1;
145 link = &local->link; link->priv = local; 145
146 local->p_dev = p_dev;
147 link->priv = local;
146 148
147 /* Interrupt setup */ 149 /* Interrupt setup */
148 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 150 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
@@ -163,9 +165,6 @@ static int teles_attach(struct pcmcia_device *p_dev)
163 link->conf.Attributes = CONF_ENABLE_IRQ; 165 link->conf.Attributes = CONF_ENABLE_IRQ;
164 link->conf.IntType = INT_MEMORY_AND_IO; 166 link->conf.IntType = INT_MEMORY_AND_IO;
165 167
166 link->handle = p_dev;
167 p_dev->instance = link;
168
169 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 168 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
170 teles_cs_config(link); 169 teles_cs_config(link);
171 170
@@ -311,7 +310,7 @@ static void teles_cs_config(dev_link_t *link)
311 sprintf(dev->node.dev_name, "teles"); 310 sprintf(dev->node.dev_name, "teles");
312 dev->node.major = dev->node.minor = 0x0; 311 dev->node.major = dev->node.minor = 0x0;
313 312
314 link->dev = &dev->node; 313 link->dev_node = &dev->node;
315 314
316 /* Finally, report what we've done */ 315 /* Finally, report what we've done */
317 printk(KERN_INFO "%s: index 0x%02x:", 316 printk(KERN_INFO "%s: index 0x%02x:",