aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-08-02 09:30:31 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-08-22 19:22:00 -0400
commit8e2fc39ddea7fe8c6798837da282db88a09af793 (patch)
tree7cba37b5b86f4ff25562012a14e29424e3872de0 /drivers/isdn
parent498ac1899b62626bf6879a251d75c22ec564c559 (diff)
pcmcia: pcmcia_config_loop() default CIS entry handling
Many drivers use the default CIS entry within their pcmcia_config_loop() callback function. Therefore, factor the default CIS entry handling out. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c1
-rw-r--r--drivers/isdn/hisax/avma1_cs.c5
-rw-r--r--drivers/isdn/hisax/elsa_cs.c1
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c26
-rw-r--r--drivers/isdn/hisax/teles_cs.c1
5 files changed, 19 insertions, 15 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 3569c68dc942..a8d6949338cd 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -156,6 +156,7 @@ static void avmcs_detach(struct pcmcia_device *link)
156 156
157static int avmcs_configcheck(struct pcmcia_device *p_dev, 157static int avmcs_configcheck(struct pcmcia_device *p_dev,
158 cistpl_cftable_entry_t *cf, 158 cistpl_cftable_entry_t *cf,
159 cistpl_cftable_entry_t *dflt,
159 void *priv_data) 160 void *priv_data)
160{ 161{
161 if (cf->io.nwin <= 0) 162 if (cf->io.nwin <= 0)
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index 76164d6a3c89..7ce1aabb0aeb 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -175,8 +175,9 @@ static void avma1cs_detach(struct pcmcia_device *link)
175======================================================================*/ 175======================================================================*/
176 176
177static int avma1cs_configcheck(struct pcmcia_device *p_dev, 177static int avma1cs_configcheck(struct pcmcia_device *p_dev,
178 cistpl_cftable_entry_t *cf, 178 cistpl_cftable_entry_t *cf,
179 void *priv_data) 179 cistpl_cftable_entry_t *dflt,
180 void *priv_data)
180{ 181{
181 if (cf->io.nwin <= 0) 182 if (cf->io.nwin <= 0)
182 return -ENODEV; 183 return -ENODEV;
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index c9899e51a262..29c55b0b86b4 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -206,6 +206,7 @@ static void elsa_cs_detach(struct pcmcia_device *link)
206 206
207static int elsa_cs_configcheck(struct pcmcia_device *p_dev, 207static int elsa_cs_configcheck(struct pcmcia_device *p_dev,
208 cistpl_cftable_entry_t *cf, 208 cistpl_cftable_entry_t *cf,
209 cistpl_cftable_entry_t *dflt,
209 void *priv_data) 210 void *priv_data)
210{ 211{
211 int j; 212 int j;
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index 2c611f91cfba..2746acbd8b70 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -218,19 +218,17 @@ static void sedlbauer_detach(struct pcmcia_device *link)
218do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 218do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
219 219
220struct sedlbauer_config_data { 220struct sedlbauer_config_data {
221 cistpl_cftable_entry_t dflt;
222 config_info_t conf; 221 config_info_t conf;
223 win_req_t req; 222 win_req_t req;
224}; 223};
225 224
226static int sedlbauer_config_check(struct pcmcia_device *p_dev, 225static int sedlbauer_config_check(struct pcmcia_device *p_dev,
227 cistpl_cftable_entry_t *cfg, 226 cistpl_cftable_entry_t *cfg,
227 cistpl_cftable_entry_t *dflt,
228 void *priv_data) 228 void *priv_data)
229{ 229{
230 struct sedlbauer_config_data *cfg_mem = priv_data; 230 struct sedlbauer_config_data *cfg_mem = priv_data;
231 231
232 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
233 cfg_mem->dflt = *cfg;
234 if (cfg->index == 0) 232 if (cfg->index == 0)
235 return -ENODEV; 233 return -ENODEV;
236 234
@@ -243,26 +241,28 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
243 /* Use power settings for Vcc and Vpp if present */ 241 /* Use power settings for Vcc and Vpp if present */
244 /* Note that the CIS values need to be rescaled */ 242 /* Note that the CIS values need to be rescaled */
245 if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { 243 if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
246 if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) 244 if (cfg_mem->conf.Vcc !=
245 cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
247 return -ENODEV; 246 return -ENODEV;
248 } else if (cfg_mem->dflt.vcc.present & (1<<CISTPL_POWER_VNOM)) { 247 } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
249 if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM]/10000) 248 if (cfg_mem->conf.Vcc !=
249 dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
250 return -ENODEV; 250 return -ENODEV;
251 } 251 }
252 252
253 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) 253 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
254 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; 254 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
255 else if (cfg_mem->dflt.vpp1.present & (1<<CISTPL_POWER_VNOM)) 255 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
256 p_dev->conf.Vpp = cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM]/10000; 256 p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
257 257
258 /* Do we need to allocate an interrupt? */ 258 /* Do we need to allocate an interrupt? */
259 if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) 259 if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
260 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 260 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
261 261
262 /* IO window settings */ 262 /* IO window settings */
263 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 263 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
264 if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { 264 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
265 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; 265 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
266 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 266 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
267 if (!(io->flags & CISTPL_IO_8BIT)) 267 if (!(io->flags & CISTPL_IO_8BIT))
268 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 268 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
@@ -291,8 +291,8 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
291 needs to be mapped to virtual space with ioremap() before it 291 needs to be mapped to virtual space with ioremap() before it
292 is used. 292 is used.
293 */ 293 */
294 if ((cfg->mem.nwin > 0) || (cfg_mem->dflt.mem.nwin > 0)) { 294 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
295 cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &cfg_mem->dflt.mem; 295 cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
296 memreq_t map; 296 memreq_t map;
297 cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; 297 cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
298 cfg_mem->req.Attributes |= WIN_ENABLE; 298 cfg_mem->req.Attributes |= WIN_ENABLE;
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index ecb75ae8a399..f4f2e2231a9b 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -196,6 +196,7 @@ static void teles_detach(struct pcmcia_device *link)
196 196
197static int teles_cs_configcheck(struct pcmcia_device *p_dev, 197static int teles_cs_configcheck(struct pcmcia_device *p_dev,
198 cistpl_cftable_entry_t *cf, 198 cistpl_cftable_entry_t *cf,
199 cistpl_cftable_entry_t *dflt,
199 void *priv_data) 200 void *priv_data)
200{ 201{
201 int j; 202 int j;