ISA changes

* i2c-isa simplified, by using the addr field in the client structure,
  instead of a new field. This means we do not need `struct isa_*'
  anymore
* All clients changed to reflect the new isa code. Many are much
  simplified now.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@505 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Frodo Looijaard committed 1999-07-21 22:04:34 +00:00
1 parent abf15cf902
commit 2212822342
10 files changed
+75 -285

No files matched your search

-2
View File
@@ -271,8 +271,6 @@ static void adm9240_vid(struct i2c_client *client, int operation, int ctl_name,
#define MAX_ADM9240_NR 4
static struct i2c_client *adm9240_list[MAX_ADM9240_NR];
/* The driver. I choose to use type i2c_driver, as at is identical to both
smbus_driver and isa_driver, and clients could be of either kind */
static struct i2c_driver adm9240_driver = {
/* name */ "ADM9240 sensor driver",
/* id */ I2C_DRIVERID_ADM9240,
+9 -16
View File
@@ -231,8 +231,6 @@ static void lm78_fan_div(struct i2c_client *client, int operation, int ctl_name,
#define MAX_LM78_NR 8
static struct i2c_client *lm78_list[MAX_LM78_NR];
/* The driver. I choose to use type i2c_driver, as at is identical to both
smbus_driver and isa_driver, and clients could be of either kind */
static struct i2c_driver lm78_driver = {
/* name */ "LM78(-J) and LM79 sensor driver",
/* id */ I2C_DRIVERID_LM78,
@@ -344,7 +342,7 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
client structure, even though we cannot fill it completely yet.
But it allows us to access lm78_{read,write}_value. */
if (! (new_client = kmalloc((is_isa?sizeof(struct isa_client):
if (! (new_client = kmalloc((is_isa?sizeof(struct i2c_client):
sizeof(struct i2c_client)) +
sizeof(struct lm78_data),
GFP_KERNEL))) {
@@ -352,15 +350,10 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
goto ERROR0;
}
if (is_isa) {
data = (struct lm78_data *) (((struct isa_client *) new_client) + 1);
new_client->addr = 0;
((struct isa_client *) new_client)->isa_addr = address;
data = (struct lm78_data *) (((struct i2c_client *) new_client) + 1);
if (is_isa)
init_MUTEX(&data->lock);
} else {
data = (struct lm78_data *) (((struct i2c_client *) new_client) + 1);
new_client->addr = address;
}
new_client->addr = address;
new_client->data = data;
new_client->adapter = adapter;
new_client->driver = &lm78_driver;
@@ -485,7 +478,7 @@ int lm78_detach_client(struct i2c_client *client)
lm78_list[i] = NULL;
if i2c_is_isa_client(client)
release_region(((struct isa_client *)client)->isa_addr,LM78_EXTENT);
release_region(client->addr,LM78_EXTENT);
kfree(client);
return 0;
@@ -526,9 +519,9 @@ int lm78_read_value(struct i2c_client *client, u8 reg)
int res;
if (i2c_is_isa_client(client)) {
down(& (((struct lm78_data *) (client->data)) -> lock));
outb_p(reg,(((struct isa_client *) client)->isa_addr) +
outb_p(reg,client->addr +
LM78_ADDR_REG_OFFSET);
res = inb_p((((struct isa_client *) client)->isa_addr) +
res = inb_p(client->addr +
LM78_DATA_REG_OFFSET);
up( & (((struct lm78_data *) (client->data)) -> lock));
return res;
@@ -547,8 +540,8 @@ int lm78_write_value(struct i2c_client *client, u8 reg, u8 value)
{
if (i2c_is_isa_client(client)) {
down(&(((struct lm78_data *) (client->data)) -> lock));
outb_p(reg,((struct isa_client *) client)->isa_addr + LM78_ADDR_REG_OFFSET);
outb_p(value,((struct isa_client *) client)->isa_addr + LM78_DATA_REG_OFFSET);
outb_p(reg,client->addr + LM78_ADDR_REG_OFFSET);
outb_p(value,client->addr + LM78_DATA_REG_OFFSET);
up(&(((struct lm78_data *) (client->data)) -> lock));
return 0;
} else
-2
View File
@@ -224,8 +224,6 @@ static void lm80_fan_div(struct i2c_client *client, int operation, int ctl_name,
#define MAX_LM80_NR 4
static struct i2c_client *lm80_list[MAX_LM80_NR];
/* The driver. I choose to use type i2c_driver, as at is identical to both
smbus_driver and isa_driver, and clients could be of either kind */
static struct i2c_driver lm80_driver = {
/* name */ "LM80 sensor driver",
/* id */ I2C_DRIVERID_LM80,
+8 -11
View File
@@ -347,16 +347,15 @@ int sis5595_detect(struct i2c_adapter *adapter, int address, int kind)
client structure, even though we cannot fill it completely yet.
But it allows us to access sis5595_{read,write}_value. */
if (! (new_client = kmalloc(sizeof(struct isa_client) +
if (! (new_client = kmalloc(sizeof(struct i2c_client) +
sizeof(struct sis5595_data),
GFP_KERNEL))) {
err = -ENOMEM;
goto ERROR0;
}
data = (struct sis5595_data *) (((struct isa_client *) new_client) + 1);
new_client->addr = 0;
((struct isa_client *) new_client)->isa_addr = address;
data = (struct sis5595_data *) (new_client + 1);
new_client->addr = address;
init_MUTEX(&data->lock);
new_client->data = data;
new_client->adapter = adapter;
@@ -457,7 +456,7 @@ int sis5595_detach_client(struct i2c_client *client)
}
sis5595_list[i] = NULL;
release_region(((struct isa_client *)client)->isa_addr,SIS5595_EXTENT);
release_region(client->addr,SIS5595_EXTENT);
kfree(client);
return 0;
@@ -495,10 +494,8 @@ int sis5595_read_value(struct i2c_client *client, u8 reg)
down((struct semaphore *) (client->data));
down(& (((struct sis5595_data *) (client->data)) -> lock));
outb_p(reg,(((struct isa_client *) client)->isa_addr) +
SIS5595_ADDR_REG_OFFSET);
res = inb_p((((struct isa_client *) client)->isa_addr) +
SIS5595_DATA_REG_OFFSET);
outb_p(reg,client->addr + SIS5595_ADDR_REG_OFFSET);
res = inb_p(client->addr + SIS5595_DATA_REG_OFFSET);
up( & (((struct sis5595_data *) (client->data)) -> lock));
return res;
}
@@ -509,8 +506,8 @@ int sis5595_read_value(struct i2c_client *client, u8 reg)
int sis5595_write_value(struct i2c_client *client, u8 reg, u8 value)
{
down(& (((struct sis5595_data *) (client->data)) -> lock));
outb_p(reg,((struct isa_client *) client)->isa_addr + SIS5595_ADDR_REG_OFFSET);
outb_p(value,((struct isa_client *) client)->isa_addr + SIS5595_DATA_REG_OFFSET);
outb_p(reg,client->addr + SIS5595_ADDR_REG_OFFSET);
outb_p(value,client->addr + SIS5595_DATA_REG_OFFSET);
up( & (((struct sis5595_data *) (client->data)) -> lock));
return 0;
}
+20 -45
View File
@@ -397,8 +397,6 @@ static void w83781d_rt(struct i2c_client *client, int operation,
#define MAX_W83781D_NR 8
static struct i2c_client *w83781d_list[MAX_W83781D_NR];
/* The driver. I choose to use type i2c_driver, as at is identical to both
smbus_driver and isa_driver, and clients could be of either kind */
static struct i2c_driver w83781d_driver = {
/* name */ "W83781D sensor driver",
/* id */ I2C_DRIVERID_W83781D,
@@ -676,22 +674,15 @@ int w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
client structure, even though we cannot fill it completely yet.
But it allows us to access w83781d_{read,write}_value. */
if (! (new_client = kmalloc((is_isa?sizeof(struct isa_client):
sizeof(struct i2c_client)) +
if (! (new_client = kmalloc(sizeof(struct i2c_client) +
sizeof(struct w83781d_data),
GFP_KERNEL))) {
err = -ENOMEM;
goto ERROR0;
}
if (is_isa) {
data = (struct w83781d_data *) (((struct isa_client *) new_client) + 1);
new_client->addr = 0;
((struct isa_client *) new_client)->isa_addr = address;
} else {
data = (struct w83781d_data *) (((struct i2c_client *) new_client) + 1);
new_client->addr = address;
}
data = (struct w83781d_data *) (((struct i2c_client *) new_client) + 1);
new_client->addr = address;
init_MUTEX(&data->lock);
new_client->data = data;
new_client->adapter = adapter;
@@ -837,7 +828,7 @@ int w83781d_detach_client(struct i2c_client *client)
w83781d_list[i] = NULL;
if i2c_is_isa_client(client)
release_region(((struct isa_client *)client)->isa_addr,W83781D_EXTENT);
release_region(client->addr,W83781D_EXTENT);
kfree(client);
return 0;
@@ -880,26 +871,18 @@ int w83781d_read_value(struct i2c_client *client, u16 reg)
down(& (((struct w83781d_data *) (client->data)) -> lock));
if (i2c_is_isa_client(client)) {
if (reg & 0xff00) {
outb_p(W83781D_REG_BANK,(((struct isa_client *) client)->isa_addr) +
W83781D_ADDR_REG_OFFSET);
outb_p(reg >> 8,(((struct isa_client *) client)->isa_addr) +
W83781D_DATA_REG_OFFSET);
outb_p(W83781D_REG_BANK,client->addr + W83781D_ADDR_REG_OFFSET);
outb_p(reg >> 8,client->addr + W83781D_DATA_REG_OFFSET);
}
outb_p(reg & 0xff,(((struct isa_client *) client)->isa_addr) +
W83781D_ADDR_REG_OFFSET);
res = inb_p((((struct isa_client *) client)->isa_addr) +
W83781D_DATA_REG_OFFSET);
outb_p(reg & 0xff,client->addr + W83781D_ADDR_REG_OFFSET);
res = inb_p(client->addr + W83781D_DATA_REG_OFFSET);
if (word_sized) {
outb_p((reg & 0xff)+1,(((struct isa_client *) client)->isa_addr) +
W83781D_ADDR_REG_OFFSET);
res = (res << 8) + inb_p((((struct isa_client *) client)->isa_addr) +
W83781D_DATA_REG_OFFSET);
outb_p((reg & 0xff)+1,client->addr + W83781D_ADDR_REG_OFFSET);
res = (res << 8) + inb_p(client->addr + W83781D_DATA_REG_OFFSET);
}
if (reg & 0xff00) {
outb_p(W83781D_REG_BANK,(((struct isa_client *) client)->isa_addr) +
W83781D_ADDR_REG_OFFSET);
outb_p(0,(((struct isa_client *) client)->isa_addr) +
W83781D_DATA_REG_OFFSET);
outb_p(W83781D_REG_BANK,client->addr + W83781D_ADDR_REG_OFFSET);
outb_p(0,client->addr + W83781D_DATA_REG_OFFSET);
}
} else {
if (reg & 0xff00)
@@ -933,26 +916,18 @@ int w83781d_write_value(struct i2c_client *client, u16 reg, u16 value)
down( & (((struct w83781d_data *) (client->data)) -> lock));
if (i2c_is_isa_client(client)) {
if (reg & 0xff00) {
outb_p(W83781D_REG_BANK,(((struct isa_client *) client)->isa_addr) +
W83781D_ADDR_REG_OFFSET);
outb_p(reg >> 8,(((struct isa_client *) client)->isa_addr) +
W83781D_DATA_REG_OFFSET);
outb_p(W83781D_REG_BANK,client->addr + W83781D_ADDR_REG_OFFSET);
outb_p(reg >> 8,client->addr + W83781D_DATA_REG_OFFSET);
}
outb_p(reg & 0xff,(((struct isa_client *) client)->isa_addr) +
W83781D_ADDR_REG_OFFSET);
outb_p(reg & 0xff,client->addr + W83781D_ADDR_REG_OFFSET);
if (word_sized) {
outb_p(value >> 8,(((struct isa_client *) client)->isa_addr) +
W83781D_DATA_REG_OFFSET);
outb_p((reg & 0xff)+1,(((struct isa_client *) client)->isa_addr) +
W83781D_ADDR_REG_OFFSET);
outb_p(value >> 8,client->addr + W83781D_DATA_REG_OFFSET);
outb_p((reg & 0xff)+1,client->addr + W83781D_ADDR_REG_OFFSET);
}
outb_p(value &0xff,(((struct isa_client *) client)->isa_addr) +
W83781D_DATA_REG_OFFSET);
outb_p(value &0xff,client->addr + W83781D_DATA_REG_OFFSET);
if (reg & 0xff00) {
outb_p(W83781D_REG_BANK,(((struct isa_client *) client)->isa_addr) +
W83781D_ADDR_REG_OFFSET);
outb_p(0,(((struct isa_client *) client)->isa_addr) +
W83781D_DATA_REG_OFFSET);
outb_p(W83781D_REG_BANK,client->addr + W83781D_ADDR_REG_OFFSET);
outb_p(0,client->addr + W83781D_DATA_REG_OFFSET);
}
} else {
if (reg & 0xff00)