Commit b6c2f23b authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Linus Torvalds

[PATCH] pcmcia: use irq_mask to mark IRQs as (un)usable

Unset bits in the per-socket irq_mask to mark IRQs as unusable, if asked to do
so by the user in /etc/pcmcia/config.opts
Signed-off-by: default avatarDominik Brodowski <linux@brodo.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e3ead11d
...@@ -151,65 +151,51 @@ void undo_irq(u_int Attributes, int irq) ...@@ -151,65 +151,51 @@ void undo_irq(u_int Attributes, int irq)
/*====================================================================*/ /*====================================================================*/
static int adjust_irq(adjust_t *adj)
{
int ret = CS_SUCCESS;
#ifdef CONFIG_PCMCIA_PROBE #ifdef CONFIG_PCMCIA_PROBE
int irq;
irq_info_t *info;
irq = adj->resource.irq.IRQ;
if ((irq < 0) || (irq > 15))
return CS_BAD_IRQ;
info = &irq_table[irq];
down(&rsrc_sem); static int adjust_irq(struct pcmcia_socket *s, adjust_t *adj)
switch (adj->Action) { {
case ADD_MANAGED_RESOURCE: int irq;
if (info->Attributes & RES_REMOVED) u32 mask;
info->Attributes &= ~(RES_REMOVED|RES_ALLOCATED);
else irq = adj->resource.irq.IRQ;
if (adj->Attributes & RES_ALLOCATED) { if ((irq < 0) || (irq > 15))
ret = CS_IN_USE; return CS_BAD_IRQ;
break;
} if (adj->Action != REMOVE_MANAGED_RESOURCE)
if (adj->Attributes & RES_RESERVED) return 0;
info->Attributes |= RES_RESERVED;
else mask = 1 << irq;
info->Attributes &= ~RES_RESERVED;
break; if !(s->irq_mask & mask)
case REMOVE_MANAGED_RESOURCE: return 0;
if (info->Attributes & RES_REMOVED) {
ret = 0; s->irq_mask &= ~mask;
break;
} return 0;
if (info->Attributes & RES_ALLOCATED) {
ret = CS_IN_USE;
break;
}
info->Attributes |= RES_ALLOCATED|RES_REMOVED;
info->Attributes &= ~RES_RESERVED;
break;
default:
ret = CS_UNSUPPORTED_FUNCTION;
break;
}
up(&rsrc_sem);
#endif
return ret;
} }
#else
static inline int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) {
return CS_SUCCESS;
}
#endif
int pcmcia_adjust_resource_info(adjust_t *adj) int pcmcia_adjust_resource_info(adjust_t *adj)
{ {
struct pcmcia_socket *s; struct pcmcia_socket *s;
int ret = CS_UNSUPPORTED_FUNCTION; int ret = CS_UNSUPPORTED_FUNCTION;
if (adj->Resource == RES_IRQ)
return adjust_irq(adj);
down_read(&pcmcia_socket_list_rwsem); down_read(&pcmcia_socket_list_rwsem);
list_for_each_entry(s, &pcmcia_socket_list, socket_list) { list_for_each_entry(s, &pcmcia_socket_list, socket_list) {
if (s->resource_ops->adjust_resource)
if (adj->Resource == RES_IRQ)
ret = adjust_irq(s, adj);
else if (s->resource_ops->adjust_resource)
ret = s->resource_ops->adjust_resource(s, adj); ret = s->resource_ops->adjust_resource(s, adj);
} }
up_read(&pcmcia_socket_list_rwsem); up_read(&pcmcia_socket_list_rwsem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment