aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/avma1_cs.c
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/hisax/avma1_cs.c
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/hisax/avma1_cs.c')
-rw-r--r--drivers/isdn/hisax/avma1_cs.c48
1 files changed, 18 insertions, 30 deletions
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 */