Skip to content

Commit

Permalink
pcmcia: deprecate CS_SUCCESS
Browse files Browse the repository at this point in the history
Instead of using own error or success codes, the PCMCIA code should rely on
the generic return values. Therefore, replace all occurrences of CS_SUCCESS
with 0.

CC: [email protected]
Signed-off-by: Dominik Brodowski <[email protected]>
  • Loading branch information
Dominik Brodowski committed Aug 23, 2008
1 parent 1a53088 commit 4c89e88
Show file tree
Hide file tree
Showing 35 changed files with 233 additions and 212 deletions.
8 changes: 4 additions & 4 deletions drivers/bluetooth/bluecard_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,23 +901,23 @@ static int bluecard_config(struct pcmcia_device *link)
for (n = 0; n < 0x400; n += 0x40) {
link->io.BasePort1 = n ^ 0x300;
i = pcmcia_request_io(link, &link->io);
if (i == CS_SUCCESS)
if (i == 0)
break;
}

if (i != CS_SUCCESS) {
if (i != 0) {
cs_error(link, RequestIO, i);
goto failed;
}

i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) {
if (i != 0) {
cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0;
}

i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) {
if (i != 0) {
cs_error(link, RequestConfiguration, i);
goto failed;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/bluetooth/bt3c_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,13 +743,13 @@ static int bt3c_config(struct pcmcia_device *link)

found_port:
i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) {
if (i != 0) {
cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0;
}

i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) {
if (i != 0) {
cs_error(link, RequestConfiguration, i);
goto failed;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/bluetooth/btuart_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,13 +672,13 @@ static int btuart_config(struct pcmcia_device *link)

found_port:
i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) {
if (i != 0) {
cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0;
}

i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) {
if (i != 0) {
cs_error(link, RequestConfiguration, i);
goto failed;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/bluetooth/dtl1_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,13 +617,13 @@ static int dtl1_config(struct pcmcia_device *link)
goto failed;

i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) {
if (i != 0) {
cs_error(link, RequestIRQ, i);
link->irq.AssignedIRQ = 0;
}

i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) {
if (i != 0) {
cs_error(link, RequestConfiguration, i);
goto failed;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/char/pcmcia/cm4040_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,8 @@ static int reader_config(struct pcmcia_device *link, int devno)

link->conf.IntType = 00000002;

if ((fail_rc = pcmcia_request_configuration(link,&link->conf))
!=CS_SUCCESS) {
fail_rc = pcmcia_request_configuration(link, &link->conf);
if (fail_rc != 0) {
dev_printk(KERN_INFO, &handle_to_dev(link),
"pcmcia_request_configuration failed 0x%x\n",
fail_rc);
Expand Down
36 changes: 18 additions & 18 deletions drivers/char/pcmcia/ipwireless/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static void signalled_reboot_work(struct work_struct *work_reboot)
struct pcmcia_device *link = ipw->link;
int ret = pccard_reset_card(link->socket);

if (ret != CS_SUCCESS)
if (ret != 0)
cs_error(link, ResetCard, ret);
}

Expand Down Expand Up @@ -104,7 +104,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
while (ret == 0) {
ret = pcmcia_get_tuple_data(link, &tuple);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, GetTupleData, ret);
goto exit0;
}
Expand All @@ -115,21 +115,21 @@ static int config_ipwireless(struct ipw_dev *ipw)

ret = pcmcia_get_first_tuple(link, &tuple);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, GetFirstTuple, ret);
goto exit0;
}

ret = pcmcia_get_tuple_data(link, &tuple);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, GetTupleData, ret);
goto exit0;
}

ret = pcmcia_parse_tuple(link, &tuple, &parse);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, ParseTuple, ret);
goto exit0;
}
Expand All @@ -151,21 +151,21 @@ static int config_ipwireless(struct ipw_dev *ipw)

ret = pcmcia_get_first_tuple(link, &tuple);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, GetFirstTuple, ret);
goto exit0;
}

ret = pcmcia_get_tuple_data(link, &tuple);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, GetTupleData, ret);
goto exit0;
}

ret = pcmcia_parse_tuple(link, &tuple, &parse);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, GetTupleData, ret);
goto exit0;
}
Expand All @@ -180,7 +180,7 @@ static int config_ipwireless(struct ipw_dev *ipw)

ret = pcmcia_request_io(link, &link->io);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, RequestIO, ret);
goto exit0;
}
Expand All @@ -194,21 +194,21 @@ static int config_ipwireless(struct ipw_dev *ipw)

ret = pcmcia_get_first_tuple(link, &tuple);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, GetFirstTuple, ret);
goto exit1;
}

ret = pcmcia_get_tuple_data(link, &tuple);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, GetTupleData, ret);
goto exit1;
}

ret = pcmcia_parse_tuple(link, &tuple, &parse);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, ParseTuple, ret);
goto exit1;
}
Expand All @@ -226,7 +226,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
ret = pcmcia_request_window(&link, &ipw->request_common_memory,
&ipw->handle_common_memory);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, RequestWindow, ret);
goto exit1;
}
Expand All @@ -238,7 +238,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
ret = pcmcia_map_mem_page(ipw->handle_common_memory,
&memreq_common_memory);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, MapMemPage, ret);
goto exit1;
}
Expand All @@ -260,7 +260,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
ret = pcmcia_request_window(&link, &ipw->request_attr_memory,
&ipw->handle_attr_memory);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, RequestWindow, ret);
goto exit2;
}
Expand All @@ -271,7 +271,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
ret = pcmcia_map_mem_page(ipw->handle_attr_memory,
&memreq_attr_memory);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, MapMemPage, ret);
goto exit2;
}
Expand All @@ -291,7 +291,7 @@ static int config_ipwireless(struct ipw_dev *ipw)

ret = pcmcia_request_irq(link, &link->irq);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, RequestIRQ, ret);
goto exit3;
}
Expand Down Expand Up @@ -331,7 +331,7 @@ static int config_ipwireless(struct ipw_dev *ipw)
*/
ret = pcmcia_request_configuration(link, &link->conf);

if (ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, RequestConfiguration, ret);
goto exit4;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/isdn/hardware/avm/avm_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static int avmcs_config(struct pcmcia_device *link)
* allocate an interrupt line
*/
i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) {
if (i != 0) {
cs_error(link, RequestIRQ, i);
/* undo */
pcmcia_disable_device(link);
Expand All @@ -208,7 +208,7 @@ static int avmcs_config(struct pcmcia_device *link)
* configure the PCMCIA socket
*/
i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) {
if (i != 0) {
cs_error(link, RequestConfiguration, i);
pcmcia_disable_device(link);
break;
Expand Down
4 changes: 2 additions & 2 deletions drivers/isdn/hisax/avma1_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ static int avma1cs_config(struct pcmcia_device *link)
* allocate an interrupt line
*/
i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) {
if (i != 0) {
cs_error(link, RequestIRQ, i);
/* undo */
pcmcia_disable_device(link);
Expand All @@ -228,7 +228,7 @@ static int avma1cs_config(struct pcmcia_device *link)
* configure the PCMCIA socket
*/
i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) {
if (i != 0) {
cs_error(link, RequestConfiguration, i);
pcmcia_disable_device(link);
break;
Expand Down
6 changes: 3 additions & 3 deletions drivers/isdn/hisax/elsa_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,20 +238,20 @@ static int elsa_cs_config(struct pcmcia_device *link)
dev = link->priv;

i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL);
if (i != CS_SUCCESS) {
if (i != 0) {
last_fn = RequestIO;
goto cs_failed;
}

i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) {
if (i != 0) {
link->irq.AssignedIRQ = 0;
last_fn = RequestIRQ;
goto cs_failed;
}

i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) {
if (i != 0) {
last_fn = RequestConfiguration;
goto cs_failed;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/isdn/hisax/teles_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,20 +228,20 @@ static int teles_cs_config(struct pcmcia_device *link)
dev = link->priv;

i = pcmcia_loop_config(link, teles_cs_configcheck, NULL);
if (i != CS_SUCCESS) {
if (i != 0) {
last_fn = RequestIO;
goto cs_failed;
}

i = pcmcia_request_irq(link, &link->irq);
if (i != CS_SUCCESS) {
if (i != 0) {
link->irq.AssignedIRQ = 0;
last_fn = RequestIRQ;
goto cs_failed;
}

i = pcmcia_request_configuration(link, &link->conf);
if (i != CS_SUCCESS) {
if (i != 0) {
last_fn = RequestConfiguration;
goto cs_failed;
}
Expand Down
17 changes: 8 additions & 9 deletions drivers/mtd/maps/pcmciamtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x",
dev->offset, mrq.CardOffset);
mrq.Page = 0;
if( (ret = pcmcia_map_mem_page(win, &mrq)) != CS_SUCCESS) {
ret = pcmcia_map_mem_page(win, &mrq);
if (ret != 0) {
cs_error(dev->p_dev, MapMemPage, ret);
return NULL;
}
Expand Down Expand Up @@ -326,9 +327,8 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on)

DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp);
ret = pcmcia_modify_configuration(link, &mod);
if(ret != CS_SUCCESS) {
if (ret != 0)
cs_error(link, ModifyConfiguration, ret);
}
}


Expand Down Expand Up @@ -368,14 +368,14 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link,
tuple.DesiredTuple = RETURN_FIRST_TUPLE;

rc = pcmcia_get_first_tuple(link, &tuple);
while(rc == CS_SUCCESS) {
while (rc == 0) {
rc = pcmcia_get_tuple_data(link, &tuple);
if(rc != CS_SUCCESS) {
if (rc != 0) {
cs_error(link, GetTupleData, rc);
break;
}
rc = pcmcia_parse_tuple(link, &tuple, &parse);
if(rc != CS_SUCCESS) {
if (rc != 0) {
cs_error(link, ParseTuple, rc);
break;
}
Expand Down Expand Up @@ -500,9 +500,8 @@ static int pcmciamtd_config(struct pcmcia_device *link)

DEBUG(2, "Validating CIS");
ret = pcmcia_validate_cis(link, NULL);
if(ret != CS_SUCCESS) {
if (ret != 0)
cs_error(link, GetTupleData, ret);
}

card_settings(dev, link, &new_name);

Expand Down Expand Up @@ -582,7 +581,7 @@ static int pcmciamtd_config(struct pcmcia_device *link)
link->conf.ConfigIndex = 0;
DEBUG(2, "Setting Configuration");
ret = pcmcia_request_configuration(link, &link->conf);
if(ret != CS_SUCCESS) {
if (ret != 0) {
cs_error(link, RequestConfiguration, ret);
if (dev->win_base) {
iounmap(dev->win_base);
Expand Down
Loading

0 comments on commit 4c89e88

Please sign in to comment.