Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 10615
b: refs/heads/master
c: ada0c2f
h: refs/heads/master
i:
  10613: d4b9450
  10611: 1689c7b
  10607: 20ebbc7
v: v3
  • Loading branch information
Petr Vandrovec authored and Greg Kroah-Hartman committed Oct 28, 2005
1 parent df01736 commit da08eff
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 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: bf813b314a2271c3f3903eb3279ebf5e09b3d27a
refs/heads/master: ada0c2f8fa087dc1dbc34e096c318739b1d6381a
13 changes: 8 additions & 5 deletions trunk/drivers/hwmon/w83627ehf.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ superio_exit(void)
* ISA constants
*/

#define REGION_LENGTH 8
#define REGION_ALIGNMENT ~7
#define REGION_OFFSET 5
#define REGION_LENGTH 2
#define ADDR_REG_OFFSET 5
#define DATA_REG_OFFSET 6

Expand Down Expand Up @@ -673,7 +675,8 @@ static int w83627ehf_detect(struct i2c_adapter *adapter)
struct w83627ehf_data *data;
int i, err = 0;

if (!request_region(address, REGION_LENGTH, w83627ehf_driver.name)) {
if (!request_region(address + REGION_OFFSET, REGION_LENGTH,
w83627ehf_driver.name)) {
err = -EBUSY;
goto exit;
}
Expand Down Expand Up @@ -762,7 +765,7 @@ static int w83627ehf_detect(struct i2c_adapter *adapter)
exit_free:
kfree(data);
exit_release:
release_region(address, REGION_LENGTH);
release_region(address + REGION_OFFSET, REGION_LENGTH);
exit:
return err;
}
Expand All @@ -776,7 +779,7 @@ static int w83627ehf_detach_client(struct i2c_client *client)

if ((err = i2c_detach_client(client)))
return err;
release_region(client->addr, REGION_LENGTH);
release_region(client->addr + REGION_OFFSET, REGION_LENGTH);
kfree(data);

return 0;
Expand Down Expand Up @@ -807,7 +810,7 @@ static int __init w83627ehf_find(int sioaddr, unsigned short *addr)
superio_select(W83627EHF_LD_HWM);
val = (superio_inb(SIO_REG_ADDR) << 8)
| superio_inb(SIO_REG_ADDR + 1);
*addr = val & ~(REGION_LENGTH - 1);
*addr = val & REGION_ALIGNMENT;
if (*addr == 0) {
superio_exit();
return -ENODEV;
Expand Down
21 changes: 13 additions & 8 deletions trunk/drivers/hwmon/w83627hf.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,14 @@ superio_exit(void)
#define WINB_BASE_REG 0x60
/* Constants specified below */

/* Length of ISA address segment */
#define WINB_EXTENT 8
/* Alignment of the base address */
#define WINB_ALIGNMENT ~7

/* Where are the ISA address/data registers relative to the base address */
/* Offset & size of I/O region we are interested in */
#define WINB_REGION_OFFSET 5
#define WINB_REGION_SIZE 2

/* Where are the sensors address/data registers relative to the base address */
#define W83781D_ADDR_REG_OFFSET 5
#define W83781D_DATA_REG_OFFSET 6

Expand Down Expand Up @@ -981,7 +985,7 @@ static int __init w83627hf_find(int sioaddr, unsigned short *addr)
superio_select(W83627HF_LD_HWM);
val = (superio_inb(WINB_BASE_REG) << 8) |
superio_inb(WINB_BASE_REG + 1);
*addr = val & ~(WINB_EXTENT - 1);
*addr = val & WINB_ALIGNMENT;
if (*addr == 0 && force_addr == 0) {
superio_exit();
return -ENODEV;
Expand All @@ -1000,9 +1004,10 @@ static int w83627hf_detect(struct i2c_adapter *adapter)
const char *client_name = "";

if(force_addr)
address = force_addr & ~(WINB_EXTENT - 1);
address = force_addr & WINB_ALIGNMENT;

if (!request_region(address, WINB_EXTENT, w83627hf_driver.name)) {
if (!request_region(address + WINB_REGION_OFFSET, WINB_REGION_SIZE,
w83627hf_driver.name)) {
err = -EBUSY;
goto ERROR0;
}
Expand Down Expand Up @@ -1148,7 +1153,7 @@ static int w83627hf_detect(struct i2c_adapter *adapter)
ERROR2:
kfree(data);
ERROR1:
release_region(address, WINB_EXTENT);
release_region(address + WINB_REGION_OFFSET, WINB_REGION_SIZE);
ERROR0:
return err;
}
Expand All @@ -1163,7 +1168,7 @@ static int w83627hf_detach_client(struct i2c_client *client)
if ((err = i2c_detach_client(client)))
return err;

release_region(client->addr, WINB_EXTENT);
release_region(client->addr + WINB_REGION_OFFSET, WINB_REGION_SIZE);
kfree(data);

return 0;
Expand Down

0 comments on commit da08eff

Please sign in to comment.