diff options
Diffstat (limited to 'drivers/telephony')
-rw-r--r-- | drivers/telephony/ixj_pcmcia.c | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index 0afd6c04f2f8..bad68187f215 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c | |||
@@ -35,8 +35,8 @@ typedef struct ixj_info_t { | |||
35 | } ixj_info_t; | 35 | } ixj_info_t; |
36 | 36 | ||
37 | static void ixj_detach(struct pcmcia_device *p_dev); | 37 | static void ixj_detach(struct pcmcia_device *p_dev); |
38 | static void ixj_config(dev_link_t * link); | 38 | static void ixj_config(struct pcmcia_device * link); |
39 | static void ixj_cs_release(dev_link_t * link); | 39 | static void ixj_cs_release(struct pcmcia_device * link); |
40 | 40 | ||
41 | static int ixj_attach(struct pcmcia_device *p_dev) | 41 | static int ixj_attach(struct pcmcia_device *p_dev) |
42 | { | 42 | { |
@@ -58,10 +58,8 @@ static int ixj_attach(struct pcmcia_device *p_dev) | |||
58 | return 0; | 58 | return 0; |
59 | } | 59 | } |
60 | 60 | ||
61 | static void ixj_detach(struct pcmcia_device *p_dev) | 61 | static void ixj_detach(struct pcmcia_device *link) |
62 | { | 62 | { |
63 | dev_link_t *link = dev_to_instance(p_dev); | ||
64 | |||
65 | DEBUG(0, "ixj_detach(0x%p)\n", link); | 63 | DEBUG(0, "ixj_detach(0x%p)\n", link); |
66 | 64 | ||
67 | link->state &= ~DEV_RELEASE_PENDING; | 65 | link->state &= ~DEV_RELEASE_PENDING; |
@@ -74,22 +72,20 @@ static void ixj_detach(struct pcmcia_device *p_dev) | |||
74 | #define CS_CHECK(fn, ret) \ | 72 | #define CS_CHECK(fn, ret) \ |
75 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 73 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
76 | 74 | ||
77 | static void ixj_get_serial(dev_link_t * link, IXJ * j) | 75 | static void ixj_get_serial(struct pcmcia_device * link, IXJ * j) |
78 | { | 76 | { |
79 | client_handle_t handle; | ||
80 | tuple_t tuple; | 77 | tuple_t tuple; |
81 | u_short buf[128]; | 78 | u_short buf[128]; |
82 | char *str; | 79 | char *str; |
83 | int last_ret, last_fn, i, place; | 80 | int last_ret, last_fn, i, place; |
84 | handle = link->handle; | ||
85 | DEBUG(0, "ixj_get_serial(0x%p)\n", link); | 81 | DEBUG(0, "ixj_get_serial(0x%p)\n", link); |
86 | tuple.TupleData = (cisdata_t *) buf; | 82 | tuple.TupleData = (cisdata_t *) buf; |
87 | tuple.TupleOffset = 0; | 83 | tuple.TupleOffset = 0; |
88 | tuple.TupleDataMax = 80; | 84 | tuple.TupleDataMax = 80; |
89 | tuple.Attributes = 0; | 85 | tuple.Attributes = 0; |
90 | tuple.DesiredTuple = CISTPL_VERS_1; | 86 | tuple.DesiredTuple = CISTPL_VERS_1; |
91 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 87 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
92 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 88 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
93 | str = (char *) buf; | 89 | str = (char *) buf; |
94 | printk("PCMCIA Version %d.%d\n", str[0], str[1]); | 90 | printk("PCMCIA Version %d.%d\n", str[0], str[1]); |
95 | str += 2; | 91 | str += 2; |
@@ -137,10 +133,9 @@ static void ixj_get_serial(dev_link_t * link, IXJ * j) | |||
137 | return; | 133 | return; |
138 | } | 134 | } |
139 | 135 | ||
140 | static void ixj_config(dev_link_t * link) | 136 | static void ixj_config(struct pcmcia_device * link) |
141 | { | 137 | { |
142 | IXJ *j; | 138 | IXJ *j; |
143 | client_handle_t handle; | ||
144 | ixj_info_t *info; | 139 | ixj_info_t *info; |
145 | tuple_t tuple; | 140 | tuple_t tuple; |
146 | u_short buf[128]; | 141 | u_short buf[128]; |
@@ -151,7 +146,6 @@ static void ixj_config(dev_link_t * link) | |||
151 | 0 | 146 | 0 |
152 | }; | 147 | }; |
153 | int last_ret, last_fn; | 148 | int last_ret, last_fn; |
154 | handle = link->handle; | ||
155 | info = link->priv; | 149 | info = link->priv; |
156 | DEBUG(0, "ixj_config(0x%p)\n", link); | 150 | DEBUG(0, "ixj_config(0x%p)\n", link); |
157 | tuple.TupleData = (cisdata_t *) buf; | 151 | tuple.TupleData = (cisdata_t *) buf; |
@@ -159,18 +153,18 @@ static void ixj_config(dev_link_t * link) | |||
159 | tuple.TupleDataMax = 255; | 153 | tuple.TupleDataMax = 255; |
160 | tuple.Attributes = 0; | 154 | tuple.Attributes = 0; |
161 | tuple.DesiredTuple = CISTPL_CONFIG; | 155 | tuple.DesiredTuple = CISTPL_CONFIG; |
162 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 156 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
163 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | 157 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); |
164 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | 158 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); |
165 | link->conf.ConfigBase = parse.config.base; | 159 | link->conf.ConfigBase = parse.config.base; |
166 | link->conf.Present = parse.config.rmask[0]; | 160 | link->conf.Present = parse.config.rmask[0]; |
167 | link->state |= DEV_CONFIG; | 161 | link->state |= DEV_CONFIG; |
168 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 162 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
169 | tuple.Attributes = 0; | 163 | tuple.Attributes = 0; |
170 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | 164 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
171 | while (1) { | 165 | while (1) { |
172 | if (pcmcia_get_tuple_data(handle, &tuple) != 0 || | 166 | if (pcmcia_get_tuple_data(link, &tuple) != 0 || |
173 | pcmcia_parse_tuple(handle, &tuple, &parse) != 0) | 167 | pcmcia_parse_tuple(link, &tuple, &parse) != 0) |
174 | goto next_entry; | 168 | goto next_entry; |
175 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | 169 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { |
176 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | 170 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; |
@@ -181,7 +175,7 @@ static void ixj_config(dev_link_t * link) | |||
181 | link->io.BasePort2 = io->win[1].base; | 175 | link->io.BasePort2 = io->win[1].base; |
182 | link->io.NumPorts2 = io->win[1].len; | 176 | link->io.NumPorts2 = io->win[1].len; |
183 | } | 177 | } |
184 | if (pcmcia_request_io(link->handle, &link->io) != 0) | 178 | if (pcmcia_request_io(link, &link->io) != 0) |
185 | goto next_entry; | 179 | goto next_entry; |
186 | /* If we've got this far, we're done */ | 180 | /* If we've got this far, we're done */ |
187 | break; | 181 | break; |
@@ -189,10 +183,10 @@ static void ixj_config(dev_link_t * link) | |||
189 | next_entry: | 183 | next_entry: |
190 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | 184 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) |
191 | dflt = *cfg; | 185 | dflt = *cfg; |
192 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(handle, &tuple)); | 186 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); |
193 | } | 187 | } |
194 | 188 | ||
195 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); | 189 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
196 | 190 | ||
197 | /* | 191 | /* |
198 | * Register the card with the core. | 192 | * Register the card with the core. |
@@ -206,16 +200,16 @@ static void ixj_config(dev_link_t * link) | |||
206 | link->state &= ~DEV_CONFIG_PENDING; | 200 | link->state &= ~DEV_CONFIG_PENDING; |
207 | return; | 201 | return; |
208 | cs_failed: | 202 | cs_failed: |
209 | cs_error(link->handle, last_fn, last_ret); | 203 | cs_error(link, last_fn, last_ret); |
210 | ixj_cs_release(link); | 204 | ixj_cs_release(link); |
211 | } | 205 | } |
212 | 206 | ||
213 | static void ixj_cs_release(dev_link_t *link) | 207 | static void ixj_cs_release(struct pcmcia_device *link) |
214 | { | 208 | { |
215 | ixj_info_t *info = link->priv; | 209 | ixj_info_t *info = link->priv; |
216 | DEBUG(0, "ixj_cs_release(0x%p)\n", link); | 210 | DEBUG(0, "ixj_cs_release(0x%p)\n", link); |
217 | info->ndev = 0; | 211 | info->ndev = 0; |
218 | pcmcia_disable_device(link->handle); | 212 | pcmcia_disable_device(link); |
219 | } | 213 | } |
220 | 214 | ||
221 | static struct pcmcia_device_id ixj_ids[] = { | 215 | static struct pcmcia_device_id ixj_ids[] = { |