Skip to content

Commit

Permalink
pcmcia: pcmcia_config_loop() ConfigIndex unification
Browse files Browse the repository at this point in the history
Almost all drivers set p_dev->conf.ConfigIndex to cfg->index in
the pcmcia_config_loop() callback function. Therefore, factor it out.

Signed-off-by: Dominik Brodowski <[email protected]>
  • Loading branch information
Dominik Brodowski committed Aug 22, 2008
1 parent 84e2d34 commit 498ac18
Show file tree
Hide file tree
Showing 29 changed files with 6 additions and 46 deletions.
1 change: 0 additions & 1 deletion drivers/ata/pata_pcmcia.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,

if ((cfg->io.nwin > 0) || (stk->dflt.io.nwin > 0)) {
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &stk->dflt.io;
pdev->conf.ConfigIndex = cfg->index;
pdev->io.BasePort1 = io->win[0].base;
pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK;
if (!(io->flags & CISTPL_IO_16BIT))
Expand Down
2 changes: 0 additions & 2 deletions drivers/bluetooth/bt3c_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,6 @@ static int bt3c_check_config(struct pcmcia_device *p_dev,
p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
(cf->io.win[0].base != 0)) {
p_dev->conf.ConfigIndex = cf->index;
p_dev->io.BasePort1 = cf->io.win[0].base;
p_dev->io.IOAddrLines = (try == 0) ? 16 :
cf->io.flags & CISTPL_IO_LINES_MASK;
Expand All @@ -706,7 +705,6 @@ static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
int j;

if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
p_dev->conf.ConfigIndex = cf->index;
for (j = 0; j < 5; j++) {
p_dev->io.BasePort1 = base[j];
p_dev->io.IOAddrLines = base[j] ? 16 : 3;
Expand Down
2 changes: 0 additions & 2 deletions drivers/bluetooth/btuart_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,6 @@ static int btuart_check_config(struct pcmcia_device *p_dev,
p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
(cf->io.win[0].base != 0)) {
p_dev->conf.ConfigIndex = cf->index;
p_dev->io.BasePort1 = cf->io.win[0].base;
p_dev->io.IOAddrLines = (try == 0) ? 16 :
cf->io.flags & CISTPL_IO_LINES_MASK;
Expand All @@ -635,7 +634,6 @@ static int btuart_check_config_notpicky(struct pcmcia_device *p_dev,
int j;

if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
p_dev->conf.ConfigIndex = cf->index;
for (j = 0; j < 5; j++) {
p_dev->io.BasePort1 = base[j];
p_dev->io.IOAddrLines = base[j] ? 16 : 3;
Expand Down
1 change: 0 additions & 1 deletion drivers/bluetooth/dtl1_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,6 @@ static int dtl1_confcheck(struct pcmcia_device *p_dev,
void *priv_data)
{
if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) {
p_dev->conf.ConfigIndex = cf->index;
p_dev->io.BasePort1 = cf->io.win[0].base;
p_dev->io.NumPorts1 = cf->io.win[0].len; /*yo */
p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
Expand Down
2 changes: 0 additions & 2 deletions drivers/char/pcmcia/cm4000_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1763,8 +1763,6 @@ static int cm4000_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
void *priv_data)
{
p_dev->conf.ConfigIndex = cfg->index;

if (!cfg->io.nwin)
return -ENODEV;

Expand Down
2 changes: 0 additions & 2 deletions drivers/char/pcmcia/cm4040_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,6 @@ static int cm4040_config_check(struct pcmcia_device *p_dev,
void *priv_data)
{
int rc;
p_dev->conf.ConfigIndex = cfg->index;

if (!cfg->io.nwin)
return -ENODEV;

Expand Down
1 change: 0 additions & 1 deletion drivers/isdn/hardware/avm/avm_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ static int avmcs_configcheck(struct pcmcia_device *p_dev,
if (cf->io.nwin <= 0)
return -ENODEV;

p_dev->conf.ConfigIndex = cf->index;
p_dev->io.BasePort1 = cf->io.win[0].base;
p_dev->io.NumPorts1 = cf->io.win[0].len;
p_dev->io.NumPorts2 = 0;
Expand Down
1 change: 0 additions & 1 deletion drivers/isdn/hisax/avma1_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ static int avma1cs_configcheck(struct pcmcia_device *p_dev,
if (cf->io.nwin <= 0)
return -ENODEV;

p_dev->conf.ConfigIndex = cf->index;
p_dev->io.BasePort1 = cf->io.win[0].base;
p_dev->io.NumPorts1 = cf->io.win[0].len;
p_dev->io.NumPorts2 = 0;
Expand Down
2 changes: 0 additions & 2 deletions drivers/isdn/hisax/elsa_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,11 @@ static int elsa_cs_configcheck(struct pcmcia_device *p_dev,

if ((cf->io.nwin > 0) && cf->io.win[0].base) {
printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n");
p_dev->conf.ConfigIndex = cf->index;
p_dev->io.BasePort1 = cf->io.win[0].base;
if (!pcmcia_request_io(p_dev, &p_dev->io))
return 0;
} else {
printk(KERN_INFO "(elsa_cs: looks like the 97 model)\n");
p_dev->conf.ConfigIndex = cf->index;
for (j = 0x2f0; j > 0x100; j -= 0x10) {
p_dev->io.BasePort1 = j;
if (!pcmcia_request_io(p_dev, &p_dev->io))
Expand Down
1 change: 0 additions & 1 deletion drivers/isdn/hisax/sedlbauer_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
cfg_mem->dflt = *cfg;
if (cfg->index == 0)
return -ENODEV;
p_dev->conf.ConfigIndex = cfg->index;

/* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
Expand Down
2 changes: 0 additions & 2 deletions drivers/isdn/hisax/teles_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,11 @@ static int teles_cs_configcheck(struct pcmcia_device *p_dev,

if ((cf->io.nwin > 0) && cf->io.win[0].base) {
printk(KERN_INFO "(teles_cs: looks like the 96 model)\n");
p_dev->conf.ConfigIndex = cf->index;
p_dev->io.BasePort1 = cf->io.win[0].base;
if (!pcmcia_request_io(p_dev, &p_dev->io))
return 0;
} else {
printk(KERN_INFO "(teles_cs: looks like the 97 model)\n");
p_dev->conf.ConfigIndex = cf->index;
for (j = 0x2f0; j > 0x100; j -= 0x10) {
p_dev->io.BasePort1 = j;
if (!pcmcia_request_io(p_dev, &p_dev->io))
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/pcmcia/pcnet_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,6 @@ static int pcnet_confcheck(struct pcmcia_device *p_dev,
if (cfg->index == 0 || cfg->io.nwin == 0)
return -EINVAL;

p_dev->conf.ConfigIndex = cfg->index;

/* For multifunction cards, by convention, we configure the
network function with window 0, and serial with window 1 */
if (io->nwin > 1) {
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/pcmcia/smc91c92_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ static int mhz_mfc_config_check(struct pcmcia_device *p_dev,
void *priv_data)
{
int k;
p_dev->conf.ConfigIndex = cf->index;
p_dev->io.BasePort2 = cf->io.win[0].base;
for (k = 0; k < 0x400; k += 0x10) {
if (k & 0x80)
Expand Down Expand Up @@ -654,7 +653,6 @@ static int smc_configcheck(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cf,
void *priv_data)
{
p_dev->conf.ConfigIndex = cf->index;
p_dev->io.BasePort1 = cf->io.win[0].base;
p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
return pcmcia_request_io(p_dev, &p_dev->io);
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/pcmcia/xirc2ps_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,6 @@ xirc2ps_config_modem(struct pcmcia_device *p_dev,

if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) {
for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
p_dev->conf.ConfigIndex = cf->index ;
p_dev->io.BasePort2 = cf->io.win[0].base;
p_dev->io.BasePort1 = ioaddr;
if (!pcmcia_request_io(p_dev, &p_dev->io))
Expand All @@ -742,7 +741,6 @@ xirc2ps_config_check(struct pcmcia_device *p_dev,
int *pass = priv_data;

if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) {
p_dev->conf.ConfigIndex = cf->index ;
p_dev->io.BasePort2 = cf->io.win[0].base;
p_dev->io.BasePort1 = p_dev->io.BasePort2
+ (*pass ? (cf->index & 0x20 ? -24:8)
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/wireless/airo_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,6 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
if (cfg->index == 0)
return -ENODEV;

p_dev->conf.ConfigIndex = cfg->index;

/* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/wireless/atmel_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,6 @@ static int atmel_config_check(struct pcmcia_device *p_dev,
*dflt = *cfg;
if (cfg->index == 0)
return -ENODEV;
p_dev->conf.ConfigIndex = cfg->index;

/* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
Expand Down
1 change: 0 additions & 1 deletion drivers/net/wireless/hostap/hostap_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,6 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
if (cfg->index == 0)
return -ENODEV;

p_dev->conf.ConfigIndex = cfg->index;
PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X "
"(default 0x%02X)\n", cfg->index, cfg_mem->dflt.index);

Expand Down
1 change: 0 additions & 1 deletion drivers/net/wireless/orinoco_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
cfg_mem->dflt = *cfg;
if (cfg->index == 0)
goto next_entry;
p_dev->conf.ConfigIndex = cfg->index;

/* Use power settings for Vcc and Vpp if present */
/* Note that the CIS values need to be rescaled */
Expand Down
1 change: 0 additions & 1 deletion drivers/net/wireless/spectrum_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,6 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
cfg_mem->dflt = *cfg;
if (cfg->index == 0)
goto next_entry;
p_dev->conf.ConfigIndex = cfg->index;

/* Use power settings for Vcc and Vpp if present */
/* Note that the CIS values need to be rescaled */
Expand Down
1 change: 0 additions & 1 deletion drivers/parport/parport_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ static int parport_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *dflt = priv_data;
if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
p_dev->conf.ConfigIndex = cfg->index;
if (epp_mode)
p_dev->conf.ConfigIndex |= FORCE_EPP_MODE;
p_dev->io.BasePort1 = io->win[0].base;
Expand Down
8 changes: 6 additions & 2 deletions drivers/pcmcia/pcmcia_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,14 +953,18 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev,

ret = pcmcia_get_first_tuple(p_dev, tuple);
while (!ret) {
cistpl_cftable_entry_t *cfg = &cfg_mem->parse.cftable_entry;

if (pcmcia_get_tuple_data(p_dev, tuple))
goto next_entry;

if (pcmcia_parse_tuple(p_dev, tuple, &cfg_mem->parse))
goto next_entry;

ret = conf_check(p_dev, &cfg_mem->parse.cftable_entry,
priv_data);
/* default values */
p_dev->conf.ConfigIndex = cfg->index;

ret = conf_check(p_dev, cfg, priv_data);
if (!ret)
break;

Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/pcmcia/aha152x_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ static int aha152x_config_check(struct pcmcia_device *p_dev,
p_dev->io.BasePort1 = cfg->io.win[1].base;
if ((cfg->io.nwin > 0) &&
(p_dev->io.BasePort1 < 0xffff)) {
p_dev->conf.ConfigIndex = cfg->index;
if (!pcmcia_request_io(p_dev, &p_dev->io))
return 0;
}
Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/pcmcia/fdomain_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ static int fdomain_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
void *priv_data)
{
p_dev->conf.ConfigIndex = cfg->index;
p_dev->io.BasePort1 = cfg->io.win[0].base;
return pcmcia_request_io(p_dev, &p_dev->io);
}
Expand Down
2 changes: 0 additions & 2 deletions drivers/scsi/pcmcia/nsp_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1626,8 +1626,6 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev,
if (cfg->index == 0)
return -ENODEV;

p_dev->conf.ConfigIndex = cfg->index;

/* Does this card need audio output? */
if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/pcmcia/qlogic_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ static int qlogic_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
void *priv_data)
{
p_dev->conf.ConfigIndex = cfg->index;
p_dev->io.BasePort1 = cfg->io.win[0].base;
p_dev->io.NumPorts1 = cfg->io.win[0].len;

Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/pcmcia/sym53c500_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,6 @@ static int SYM53C500_config_check(struct pcmcia_device *p_dev,
cistpl_cftable_entry_t *cfg,
void *priv_data)
{
p_dev->conf.ConfigIndex = cfg->index;
p_dev->io.BasePort1 = cfg->io.win[0].base;
p_dev->io.NumPorts1 = cfg->io.win[0].len;

Expand Down
4 changes: 0 additions & 4 deletions drivers/serial/serial_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ static int simple_config_check(struct pcmcia_device *p_dev,

if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)])
&& (cf->io.win[0].base != 0)) {
p_dev->conf.ConfigIndex = cf->index;
p_dev->io.BasePort1 = cf->io.win[0].base;
p_dev->io.IOAddrLines = ((*try & 0x1) == 0) ?
16 : cf->io.flags & CISTPL_IO_LINES_MASK;
Expand All @@ -472,7 +471,6 @@ static int simple_config_check_notpicky(struct pcmcia_device *p_dev,
int j;

if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) {
p_dev->conf.ConfigIndex = cf->index;
for (j = 0; j < 5; j++) {
p_dev->io.BasePort1 = base[j];
p_dev->io.IOAddrLines = base[j] ? 16 : 3;
Expand Down Expand Up @@ -555,7 +553,6 @@ static int multi_config_check(struct pcmcia_device *p_dev,
/* The quad port cards have bad CIS's, so just look for a
window larger than 8 ports and assume it will be right */
if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) {
p_dev->conf.ConfigIndex = cf->index;
p_dev->io.BasePort1 = cf->io.win[0].base;
p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
if (!pcmcia_request_io(p_dev, &p_dev->io)) {
Expand All @@ -573,7 +570,6 @@ static int multi_config_check_notpicky(struct pcmcia_device *p_dev,
int *base2 = priv_data;

if (cf->io.nwin == 2) {
p_dev->conf.ConfigIndex = cf->index;
p_dev->io.BasePort1 = cf->io.win[0].base;
p_dev->io.BasePort2 = cf->io.win[1].base;
p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK;
Expand Down
1 change: 0 additions & 1 deletion drivers/telephony/ixj_pcmcia.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ static int ixj_config_check(struct pcmcia_device *p_dev,

if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
p_dev->conf.ConfigIndex = cfg->index;
p_dev->io.BasePort1 = io->win[0].base;
p_dev->io.NumPorts1 = io->win[0].len;
if (io->nwin == 2) {
Expand Down
2 changes: 0 additions & 2 deletions drivers/usb/host/sl811_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev,
if (cfg->index == 0)
return -ENODEV;

p_dev->conf.ConfigIndex = cfg->index;

/* Use power settings for Vcc and Vpp if present */
/* Note that the CIS values need to be rescaled */
if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
Expand Down

0 comments on commit 498ac18

Please sign in to comment.