aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-08-03 06:15:11 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-08-22 20:29:57 -0400
commit926c5402c287f6d911f7d00f936f09ea00880527 (patch)
tree82885b3dd11e486a47a1b84fe36ef214269f0f96
parent69ba44331e81e4a15b504175ec70b7b4b4e5a8b9 (diff)
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>
-rw-r--r--drivers/pcmcia/ds.c1
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c8
-rw-r--r--drivers/pcmcia/pcmcia_resource.c10
-rw-r--r--include/pcmcia/cs.h4
4 files changed, 12 insertions, 11 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 3ccf4091e877..5b24938ca154 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -78,7 +78,6 @@ static const lookup_t error_table[] = {
78 { -EIO, "Input/Output error" }, 78 { -EIO, "Input/Output error" },
79 { -ENODEV, "No card present" }, 79 { -ENODEV, "No card present" },
80 { -EINVAL, "Bad parameter" }, 80 { -EINVAL, "Bad parameter" },
81 { CS_BAD_ARGS, "Bad arguments" },
82 { -EACCES, "Configuration locked" }, 81 { -EACCES, "Configuration locked" },
83 { -EBUSY, "Resource in use" }, 82 { -EBUSY, "Resource in use" },
84 { -ENOSPC, "No more items" }, 83 { -ENOSPC, "No more items" },
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 99563134ac0f..f2352c227570 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -836,7 +836,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
836 case DS_GET_CONFIGURATION_INFO: 836 case DS_GET_CONFIGURATION_INFO:
837 if (buf->config.Function && 837 if (buf->config.Function &&
838 (buf->config.Function >= s->functions)) 838 (buf->config.Function >= s->functions))
839 ret = CS_BAD_ARGS; 839 ret = -EINVAL;
840 else { 840 else {
841 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); 841 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function);
842 ret = pccard_get_configuration_info(s, p_dev, &buf->config); 842 ret = pccard_get_configuration_info(s, p_dev, &buf->config);
@@ -867,7 +867,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
867 case DS_GET_STATUS: 867 case DS_GET_STATUS:
868 if (buf->status.Function && 868 if (buf->status.Function &&
869 (buf->status.Function >= s->functions)) 869 (buf->status.Function >= s->functions))
870 ret = CS_BAD_ARGS; 870 ret = -EINVAL;
871 else { 871 else {
872 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); 872 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function);
873 ret = pccard_get_status(s, p_dev, &buf->status); 873 ret = pccard_get_status(s, p_dev, &buf->status);
@@ -898,7 +898,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
898 goto free_out; 898 goto free_out;
899 } 899 }
900 900
901 ret = CS_BAD_ARGS; 901 ret = -EINVAL;
902 902
903 if (!(buf->conf_reg.Function && 903 if (!(buf->conf_reg.Function &&
904 (buf->conf_reg.Function >= s->functions))) { 904 (buf->conf_reg.Function >= s->functions))) {
@@ -970,7 +970,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
970 case -ENOSYS: 970 case -ENOSYS:
971 err = ret; 971 err = ret;
972 break; 972 break;
973 case CS_BAD_ARGS: case CS_BAD_TUPLE: 973 case CS_BAD_TUPLE:
974 err = -EINVAL; break; 974 err = -EINVAL; break;
975 case -ENOMEM: 975 case -ENOMEM:
976 err = -ENOSPC; break; 976 err = -ENOSPC; break;
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index fee57139a96f..de13c424101c 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -189,7 +189,7 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
189 pcmcia_write_cis_mem(s, 1, addr, 1, &val); 189 pcmcia_write_cis_mem(s, 1, addr, 1, &val);
190 break; 190 break;
191 default: 191 default:
192 return CS_BAD_ARGS; 192 return -EINVAL;
193 break; 193 break;
194 } 194 }
195 return 0; 195 return 0;
@@ -401,7 +401,7 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
401 (c->io.NumPorts1 != req->NumPorts1) || 401 (c->io.NumPorts1 != req->NumPorts1) ||
402 (c->io.BasePort2 != req->BasePort2) || 402 (c->io.BasePort2 != req->BasePort2) ||
403 (c->io.NumPorts2 != req->NumPorts2)) 403 (c->io.NumPorts2 != req->NumPorts2))
404 return CS_BAD_ARGS; 404 return -EINVAL;
405 405
406 c->state &= ~CONFIG_IO_REQ; 406 c->state &= ~CONFIG_IO_REQ;
407 407
@@ -855,8 +855,10 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h
855 if (req->Attributes & WIN_USE_WAIT) 855 if (req->Attributes & WIN_USE_WAIT)
856 win->ctl.flags |= MAP_USE_WAIT; 856 win->ctl.flags |= MAP_USE_WAIT;
857 win->ctl.card_start = 0; 857 win->ctl.card_start = 0;
858 if (s->ops->set_mem_map(s, &win->ctl) != 0) 858 if (s->ops->set_mem_map(s, &win->ctl) != 0) {
859 return CS_BAD_ARGS; 859 ds_dbg(s, 0, "failed to set memory mapping\n");
860 return -EIO;
861 }
860 s->state |= SOCKET_WIN_REQ(w); 862 s->state |= SOCKET_WIN_REQ(w);
861 863
862 /* Return window handle */ 864 /* Return window handle */
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
index 4951eb94493a..56f94e297500 100644
--- a/include/pcmcia/cs.h
+++ b/include/pcmcia/cs.h
@@ -294,7 +294,7 @@ typedef struct error_info_t {
294#define CS_BAD_BASE -EINVAL 294#define CS_BAD_BASE -EINVAL
295#define CS_BAD_EDC -ENODEV 295#define CS_BAD_EDC -ENODEV
296#define CS_BAD_IRQ -EINVAL 296#define CS_BAD_IRQ -EINVAL
297#define CS_BAD_OFFSET -EIO 297#define CS_BAD_OFFSET -EINVAL
298#define CS_BAD_PAGE -EINVAL 298#define CS_BAD_PAGE -EINVAL
299#define CS_READ_FAILURE -EIO 299#define CS_READ_FAILURE -EIO
300#define CS_BAD_SIZE -EINVAL 300#define CS_BAD_SIZE -EINVAL
@@ -312,7 +312,7 @@ typedef struct error_info_t {
312#define CS_GENERAL_FAILURE -ETIMEDOUT 312#define CS_GENERAL_FAILURE -ETIMEDOUT
313#define CS_WRITE_PROTECTED -EPERM 313#define CS_WRITE_PROTECTED -EPERM
314#define CS_BAD_ARG_LENGTH -ENODEV 314#define CS_BAD_ARG_LENGTH -ENODEV
315#define CS_BAD_ARGS 0x1c 315#define CS_BAD_ARGS -EINVAL
316#define CS_CONFIGURATION_LOCKED -EACCES 316#define CS_CONFIGURATION_LOCKED -EACCES
317#define CS_IN_USE -EBUSY 317#define CS_IN_USE -EBUSY
318#define CS_NO_MORE_ITEMS -ENOSPC 318#define CS_NO_MORE_ITEMS -ENOSPC