aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
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/usb/host
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/usb/host')
-rw-r--r--drivers/usb/host/sl811_cs.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c
index 5b55c72c710b..78cc32e7b014 100644
--- a/drivers/usb/host/sl811_cs.c
+++ b/drivers/usb/host/sl811_cs.c
@@ -156,19 +156,16 @@ static void sl811_cs_release(struct pcmcia_device * link)
156} 156}
157 157
158struct sl811_css_cfg { 158struct sl811_css_cfg {
159 cistpl_cftable_entry_t dflt;
160 config_info_t conf; 159 config_info_t conf;
161}; 160};
162 161
163static int sl811_cs_config_check(struct pcmcia_device *p_dev, 162static int sl811_cs_config_check(struct pcmcia_device *p_dev,
164 cistpl_cftable_entry_t *cfg, 163 cistpl_cftable_entry_t *cfg,
164 cistpl_cftable_entry_t *dflt,
165 void *priv_data) 165 void *priv_data)
166{ 166{
167 struct sl811_css_cfg *cfg_mem = priv_data; 167 struct sl811_css_cfg *cfg_mem = priv_data;
168 168
169 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
170 memcpy(&cfg_mem->dflt, cfg, sizeof(cistpl_cftable_entry_t));
171
172 if (cfg->index == 0) 169 if (cfg->index == 0)
173 return -ENODEV; 170 return -ENODEV;
174 171
@@ -178,8 +175,8 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev,
178 if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 != 175 if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 !=
179 cfg_mem->conf.Vcc) 176 cfg_mem->conf.Vcc)
180 return -ENODEV; 177 return -ENODEV;
181 } else if (cfg_mem->dflt.vcc.present & (1<<CISTPL_POWER_VNOM)) { 178 } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
182 if (cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM]/10000 179 if (dflt->vcc.param[CISTPL_POWER_VNOM]/10000
183 != cfg_mem->conf.Vcc) 180 != cfg_mem->conf.Vcc)
184 return -ENODEV; 181 return -ENODEV;
185 } 182 }
@@ -187,18 +184,18 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev,
187 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) 184 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
188 p_dev->conf.Vpp = 185 p_dev->conf.Vpp =
189 cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; 186 cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
190 else if (cfg_mem->dflt.vpp1.present & (1<<CISTPL_POWER_VNOM)) 187 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
191 p_dev->conf.Vpp = 188 p_dev->conf.Vpp =
192 cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM]/10000; 189 dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
193 190
194 /* we need an interrupt */ 191 /* we need an interrupt */
195 if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) 192 if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
196 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 193 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
197 194
198 /* IO window settings */ 195 /* IO window settings */
199 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 196 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
200 if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { 197 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
201 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; 198 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
202 199
203 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 200 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
204 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 201 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;