pcmcia: deprecate CS_BAD_ATTRIBUTE, CS_BAD_TYPE and CS_BAD_PAGE
CS_BAD_TYPE was only used in cs.c and already properly annotated by error
messages. CS_BAD_ATTRIBUTE and CS_BAD_PAGE mean a badly written driver, so
ds_dbg() output and -EINVAL seems to be enough.
(includes bugfix from and
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
)
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 8f2c805..35a6157 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -251,9 +251,11 @@
struct pcmcia_socket *s;
if ((win == NULL) || (win->magic != WINDOW_MAGIC))
return -EINVAL;
- if (req->Page != 0)
- return CS_BAD_PAGE;
s = win->sock;
+ if (req->Page != 0) {
+ ds_dbg(s, 0, "failure: requested page is zero\n");
+ return -EINVAL;
+ }
win->ctl.card_start = req->CardOffset;
if (s->ops->set_mem_map(s, &win->ctl) != 0)
return CS_BAD_OFFSET;
@@ -420,8 +422,10 @@
if (c->state & CONFIG_LOCKED)
return -EACCES;
- if (c->irq.Attributes != req->Attributes)
- return CS_BAD_ATTRIBUTE;
+ if (c->irq.Attributes != req->Attributes) {
+ ds_dbg(s, 0, "IRQ attributes must match assigned ones\n");
+ return -EINVAL;
+ }
if (s->irq.AssignedIRQ != req->AssignedIRQ)
return CS_BAD_IRQ;
if (--s->irq.Config == 0) {
@@ -613,11 +617,15 @@
ds_dbg(s, 0, "IO already configured\n");
return -EBUSY;
}
- if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))
- return CS_BAD_ATTRIBUTE;
+ if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) {
+ ds_dbg(s, 0, "bad attribute setting for IO region 1\n");
+ return -EINVAL;
+ }
if ((req->NumPorts2 > 0) &&
- (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)))
- return CS_BAD_ATTRIBUTE;
+ (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) {
+ ds_dbg(s, 0, "bad attribute setting for IO region 2\n");
+ return -EINVAL;
+ }
ds_dbg(s, 1, "trying to allocate resource 1\n");
if (alloc_io_space(s, req->Attributes1, &req->BasePort1,
@@ -783,8 +791,10 @@
if (!(s->state & SOCKET_PRESENT))
return -ENODEV;
- if (req->Attributes & (WIN_PAGED | WIN_SHARED))
- return CS_BAD_ATTRIBUTE;
+ if (req->Attributes & (WIN_PAGED | WIN_SHARED)) {
+ ds_dbg(s, 0, "bad attribute setting for iomem region\n");
+ return -EINVAL;
+ }
/* Window size defaults to smallest available */
if (req->Size == 0)