aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware
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/hardware
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/hardware')
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 0c504dc49ac..3b7461ece50 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 */