Skip to content

Commit

Permalink
pcmcia: deprecate CS_BAD_HANDLE
Browse files Browse the repository at this point in the history
CS_BAD_HANDLE means that something went badly wrong: no parameter was passed,
or the paramater passed wasn't the correct one. Therefore, replace it with
-EINVAL.

Signed-off-by: Dominik Brodowski <[email protected]>
  • Loading branch information
Dominik Brodowski committed Aug 23, 2008
1 parent 8567142 commit ffb8da2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
8 changes: 4 additions & 4 deletions drivers/pcmcia/cistpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int func, tuple_t *t
int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple_t *tuple)
{
if (!s)
return CS_BAD_HANDLE;
return -EINVAL;
if (!(s->state & SOCKET_PRESENT))
return -ENODEV;
tuple->TupleLink = tuple->Flags = 0;
Expand Down Expand Up @@ -505,7 +505,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_
int ofs, i, attr;

if (!s)
return CS_BAD_HANDLE;
return -EINVAL;
if (!(s->state & SOCKET_PRESENT))
return -ENODEV;

Expand Down Expand Up @@ -603,7 +603,7 @@ int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple)
u_int len;

if (!s)
return CS_BAD_HANDLE;
return -EINVAL;

if (tuple->TupleLink < tuple->TupleOffset)
return CS_NO_MORE_ITEMS;
Expand Down Expand Up @@ -1457,7 +1457,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned
int ret, reserved, dev_ok = 0, ident_ok = 0;

if (!s)
return CS_BAD_HANDLE;
return -EINVAL;

tuple = kmalloc(sizeof(*tuple), GFP_KERNEL);
if (tuple == NULL) {
Expand Down
1 change: 0 additions & 1 deletion drivers/pcmcia/ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ static const lookup_t error_table[] = {
{ CS_IN_USE, "Resource in use" },
{ CS_NO_MORE_ITEMS, "No more items" },
{ CS_OUT_OF_RESOURCE, "Out of resource" },
{ CS_BAD_HANDLE, "Bad handle" },
{ CS_BAD_TUPLE, "Bad CIS tuple" }
};

Expand Down
12 changes: 6 additions & 6 deletions drivers/pcmcia/pcmcia_resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ EXPORT_SYMBOL(pcmcia_get_window);
int pcmcia_get_mem_page(window_handle_t win, memreq_t *req)
{
if ((win == NULL) || (win->magic != WINDOW_MAGIC))
return CS_BAD_HANDLE;
return -EINVAL;
req->Page = 0;
req->CardOffset = win->ctl.card_start;
return 0;
Expand All @@ -250,7 +250,7 @@ int pcmcia_map_mem_page(window_handle_t win, memreq_t *req)
{
struct pcmcia_socket *s;
if ((win == NULL) || (win->magic != WINDOW_MAGIC))
return CS_BAD_HANDLE;
return -EINVAL;
if (req->Page != 0)
return CS_BAD_PAGE;
s = win->sock;
Expand Down Expand Up @@ -389,7 +389,7 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
config_t *c = p_dev->function_config;

if (!p_dev->_io )
return CS_BAD_HANDLE;
return -EINVAL;

p_dev->_io = 0;

Expand All @@ -415,7 +415,7 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
config_t *c= p_dev->function_config;

if (!p_dev->_irq)
return CS_BAD_HANDLE;
return -EINVAL;
p_dev->_irq = 0;

if (c->state & CONFIG_LOCKED)
Expand Down Expand Up @@ -446,10 +446,10 @@ int pcmcia_release_window(window_handle_t win)
struct pcmcia_socket *s;

if ((win == NULL) || (win->magic != WINDOW_MAGIC))
return CS_BAD_HANDLE;
return -EINVAL;
s = win->sock;
if (!(win->handle->_win & CLIENT_WIN_REQ(win->index)))
return CS_BAD_HANDLE;
return -EINVAL;

/* Shut down memory window */
win->ctl.flags &= ~MAP_ACTIVE;
Expand Down
2 changes: 1 addition & 1 deletion include/pcmcia/cs.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ typedef struct error_info_t {
#define CS_IN_USE 0x1e
#define CS_NO_MORE_ITEMS 0x1f
#define CS_OUT_OF_RESOURCE -ENOMEM
#define CS_BAD_HANDLE 0x21
#define CS_BAD_HANDLE -EINVAL

#define CS_BAD_TUPLE 0x40

Expand Down

0 comments on commit ffb8da2

Please sign in to comment.