Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 27044
b: refs/heads/master
c: d61a3ea
h: refs/heads/master
v: v3
  • Loading branch information
Corey Minyard authored and Linus Torvalds committed May 31, 2006
1 parent bf33502 commit c76bd32
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 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: 44d7aff035118e8c3993aa3fa05d358d1008e982
refs/heads/master: d61a3ead268084cc271d7b2aa2950fc822a37cf5
38 changes: 22 additions & 16 deletions trunk/drivers/char/ipmi/ipmi_si_intf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1184,20 +1184,20 @@ static void port_outl(struct si_sm_io *io, unsigned int offset,
static void port_cleanup(struct smi_info *info)
{
unsigned int addr = info->io.addr_data;
int mapsize;
int idx;

if (addr) {
mapsize = ((info->io_size * info->io.regspacing)
- (info->io.regspacing - info->io.regsize));

release_region (addr, mapsize);
for (idx = 0; idx < info->io_size; idx++) {
release_region(addr + idx * info->io.regspacing,
info->io.regsize);
}
}
}

static int port_setup(struct smi_info *info)
{
unsigned int addr = info->io.addr_data;
int mapsize;
int idx;

if (!addr)
return -ENODEV;
Expand Down Expand Up @@ -1225,16 +1225,22 @@ static int port_setup(struct smi_info *info)
return -EINVAL;
}

/* Calculate the total amount of memory to claim. This is an
* unusual looking calculation, but it avoids claiming any
* more memory than it has to. It will claim everything
* between the first address to the end of the last full
* register. */
mapsize = ((info->io_size * info->io.regspacing)
- (info->io.regspacing - info->io.regsize));

if (request_region(addr, mapsize, DEVICE_NAME) == NULL)
return -EIO;
/* Some BIOSes reserve disjoint I/O regions in their ACPI
* tables. This causes problems when trying to register the
* entire I/O region. Therefore we must register each I/O
* port separately.
*/
for (idx = 0; idx < info->io_size; idx++) {
if (request_region(addr + idx * info->io.regspacing,
info->io.regsize, DEVICE_NAME) == NULL) {
/* Undo allocations */
while (idx--) {
release_region(addr + idx * info->io.regspacing,
info->io.regsize);
}
return -EIO;
}
}
return 0;
}

Expand Down

0 comments on commit c76bd32

Please sign in to comment.