pcmcia: deprecate CS_BAD_ARGS

CS_BAD_ARGS mean a badly written driver or invalid userspace ioctl access,
so translate that to -EINVAL.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
Dominik Brodowski 2008-08-03 12:15:11 +02:00
parent 69ba44331e
commit 926c5402c2
4 changed files with 12 additions and 11 deletions

View File

@ -78,7 +78,6 @@ static const lookup_t error_table[] = {
{ -EIO, "Input/Output error" }, { -EIO, "Input/Output error" },
{ -ENODEV, "No card present" }, { -ENODEV, "No card present" },
{ -EINVAL, "Bad parameter" }, { -EINVAL, "Bad parameter" },
{ CS_BAD_ARGS, "Bad arguments" },
{ -EACCES, "Configuration locked" }, { -EACCES, "Configuration locked" },
{ -EBUSY, "Resource in use" }, { -EBUSY, "Resource in use" },
{ -ENOSPC, "No more items" }, { -ENOSPC, "No more items" },

View File

@ -836,7 +836,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
case DS_GET_CONFIGURATION_INFO: case DS_GET_CONFIGURATION_INFO:
if (buf->config.Function && if (buf->config.Function &&
(buf->config.Function >= s->functions)) (buf->config.Function >= s->functions))
ret = CS_BAD_ARGS; ret = -EINVAL;
else { else {
struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function);
ret = pccard_get_configuration_info(s, p_dev, &buf->config); ret = pccard_get_configuration_info(s, p_dev, &buf->config);
@ -867,7 +867,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
case DS_GET_STATUS: case DS_GET_STATUS:
if (buf->status.Function && if (buf->status.Function &&
(buf->status.Function >= s->functions)) (buf->status.Function >= s->functions))
ret = CS_BAD_ARGS; ret = -EINVAL;
else { else {
struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function);
ret = pccard_get_status(s, p_dev, &buf->status); ret = pccard_get_status(s, p_dev, &buf->status);
@ -898,7 +898,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
goto free_out; goto free_out;
} }
ret = CS_BAD_ARGS; ret = -EINVAL;
if (!(buf->conf_reg.Function && if (!(buf->conf_reg.Function &&
(buf->conf_reg.Function >= s->functions))) { (buf->conf_reg.Function >= s->functions))) {
@ -970,7 +970,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
case -ENOSYS: case -ENOSYS:
err = ret; err = ret;
break; break;
case CS_BAD_ARGS: case CS_BAD_TUPLE: case CS_BAD_TUPLE:
err = -EINVAL; break; err = -EINVAL; break;
case -ENOMEM: case -ENOMEM:
err = -ENOSPC; break; err = -ENOSPC; break;

View File

@ -189,7 +189,7 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
pcmcia_write_cis_mem(s, 1, addr, 1, &val); pcmcia_write_cis_mem(s, 1, addr, 1, &val);
break; break;
default: default:
return CS_BAD_ARGS; return -EINVAL;
break; break;
} }
return 0; return 0;
@ -401,7 +401,7 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
(c->io.NumPorts1 != req->NumPorts1) || (c->io.NumPorts1 != req->NumPorts1) ||
(c->io.BasePort2 != req->BasePort2) || (c->io.BasePort2 != req->BasePort2) ||
(c->io.NumPorts2 != req->NumPorts2)) (c->io.NumPorts2 != req->NumPorts2))
return CS_BAD_ARGS; return -EINVAL;
c->state &= ~CONFIG_IO_REQ; c->state &= ~CONFIG_IO_REQ;
@ -855,8 +855,10 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
if (req->Attributes & WIN_USE_WAIT) if (req->Attributes & WIN_USE_WAIT)
win->ctl.flags |= MAP_USE_WAIT; win->ctl.flags |= MAP_USE_WAIT;
win->ctl.card_start = 0; win->ctl.card_start = 0;
if (s->ops->set_mem_map(s, &win->ctl) != 0) if (s->ops->set_mem_map(s, &win->ctl) != 0) {
return CS_BAD_ARGS; ds_dbg(s, 0, "failed to set memory mapping\n");
return -EIO;
}
s->state |= SOCKET_WIN_REQ(w); s->state |= SOCKET_WIN_REQ(w);
/* Return window handle */ /* Return window handle */

View File

@ -294,7 +294,7 @@ typedef struct error_info_t {
#define CS_BAD_BASE -EINVAL #define CS_BAD_BASE -EINVAL
#define CS_BAD_EDC -ENODEV #define CS_BAD_EDC -ENODEV
#define CS_BAD_IRQ -EINVAL #define CS_BAD_IRQ -EINVAL
#define CS_BAD_OFFSET -EIO #define CS_BAD_OFFSET -EINVAL
#define CS_BAD_PAGE -EINVAL #define CS_BAD_PAGE -EINVAL
#define CS_READ_FAILURE -EIO #define CS_READ_FAILURE -EIO
#define CS_BAD_SIZE -EINVAL #define CS_BAD_SIZE -EINVAL
@ -312,7 +312,7 @@ typedef struct error_info_t {
#define CS_GENERAL_FAILURE -ETIMEDOUT #define CS_GENERAL_FAILURE -ETIMEDOUT
#define CS_WRITE_PROTECTED -EPERM #define CS_WRITE_PROTECTED -EPERM
#define CS_BAD_ARG_LENGTH -ENODEV #define CS_BAD_ARG_LENGTH -ENODEV
#define CS_BAD_ARGS 0x1c #define CS_BAD_ARGS -EINVAL
#define CS_CONFIGURATION_LOCKED -EACCES #define CS_CONFIGURATION_LOCKED -EACCES
#define CS_IN_USE -EBUSY #define CS_IN_USE -EBUSY
#define CS_NO_MORE_ITEMS -ENOSPC #define CS_NO_MORE_ITEMS -ENOSPC