Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3800
b: refs/heads/master
c: 3c29976
h: refs/heads/master
v: v3
  • Loading branch information
Dominik Brodowski authored and Linus Torvalds committed Jun 28, 2005
1 parent 4141927 commit 349801d
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 22916638b124e859b595099bd0c86a1e09e767fb
refs/heads/master: 3c29976a6469b81a7858812dc2d4b8430d74004a
2 changes: 1 addition & 1 deletion trunk/drivers/pcmcia/rsrc_mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int pcmcia_adjust_resource_info(adjust_t *adj)
/* you can't use the old interface if the new
* one was used before */
spin_lock_irqsave(&s->lock, flags);
if ((s->resource_setup_done) &&
if ((s->resource_setup_new) &&
!(s->resource_setup_old)) {
spin_unlock_irqrestore(&s->lock, flags);
continue;
Expand Down
58 changes: 58 additions & 0 deletions trunk/drivers/pcmcia/rsrc_nonstatic.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,58 @@ static int nonstatic_adjust_resource_info(struct pcmcia_socket *s, adjust_t *adj
return CS_UNSUPPORTED_FUNCTION;
}

#ifdef CONFIG_PCI
static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
{
struct resource *res;
int i, done = 0;

if (!s->cb_dev || !s->cb_dev->bus)
return -ENODEV;

for (i=0; i < PCI_BUS_NUM_RESOURCES; i++) {
res = s->cb_dev->bus->resource[i];
if (!res)
continue;

if (res->flags & IORESOURCE_IO) {
if (res == &ioport_resource)
continue;
printk(KERN_INFO "pcmcia: parent PCI bridge I/O window: 0x%lx - 0x%lx\n",
res->start, res->end);
if (!adjust_io(s, ADD_MANAGED_RESOURCE, res->start, res->end))
done |= IORESOURCE_IO;

}

if (res->flags & IORESOURCE_MEM) {
if (res == &iomem_resource)
continue;
printk(KERN_INFO "pcmcia: parent PCI bridge Memory window: 0x%lx - 0x%lx\n",
res->start, res->end);
if (!adjust_memory(s, ADD_MANAGED_RESOURCE, res->start, res->end))
done |= IORESOURCE_MEM;
}
}

/* if we got at least one of IO, and one of MEM, we can be glad and
* activate the PCMCIA subsystem */
if (done & (IORESOURCE_MEM | IORESOURCE_IO))
s->resource_setup_done = 1;

return 0;
}

#else

static inline int nonstatic_autoadd_resources(struct pcmcia_socket *s)
{
return -ENODEV;
}

#endif


static int nonstatic_init(struct pcmcia_socket *s)
{
struct socket_data *data;
Expand All @@ -782,6 +834,8 @@ static int nonstatic_init(struct pcmcia_socket *s)

s->resource_data = (void *) data;

nonstatic_autoadd_resources(s);

return 0;
}

Expand Down Expand Up @@ -862,6 +916,8 @@ static ssize_t store_io_db(struct class_device *class_dev, const char *buf, size
return -EINVAL;

ret = adjust_io(s, add, start_addr, end_addr);
if (!ret)
s->resource_setup_new = 1;

return ret ? ret : count;
}
Expand Down Expand Up @@ -912,6 +968,8 @@ static ssize_t store_mem_db(struct class_device *class_dev, const char *buf, siz
return -EINVAL;

ret = adjust_memory(s, add, start_addr, end_addr);
if (!ret)
s->resource_setup_new = 1;

return ret ? ret : count;
}
Expand Down
3 changes: 2 additions & 1 deletion trunk/include/pcmcia/ss.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,9 @@ struct pcmcia_socket {

/* is set to one if resource setup is done using adjust_resource_info() */
u8 resource_setup_old:1;
u8 resource_setup_new:1;

u8 reserved:6;
u8 reserved:5;

/* socket operations */
struct pccard_operations * ops;
Expand Down

0 comments on commit 349801d

Please sign in to comment.