aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/pc87360.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2005-07-19 17:56:35 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-05 12:14:10 -0400
commit2d8672c5a6ba0d3f1d8d3ad61ef67868941364f0 (patch)
treef01f038198bad63fee4c7d23af806ad0ab4e5071 /drivers/hwmon/pc87360.c
parent5042c7d752fe72c6924037058367f63902e68c5c (diff)
[PATCH] I2C: Separate non-i2c hwmon drivers from i2c-core (5/9)
Call the ISA chip drivers detection function directly instead of relying on i2c_detect. The net effect is that address lists won't be handled anymore, but they were mostly useless in the ISA case anyway (pc87360, smsc47m1, smsc47b397 had already dropped them). We don't need to handle multiple devices, all we may need is a way to force a given address instead of the original one (some drivers already do: sis5595, via686a, w83627hf), and, for drivers supporting multiple chips, a way to force one given kind. All this may be added later on demand, but I actually don't think there will be much demand. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/pc87360.c')
-rw-r--r--drivers/hwmon/pc87360.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c
index 97ffe5b5cf83..4041488de6f1 100644
--- a/drivers/hwmon/pc87360.c
+++ b/drivers/hwmon/pc87360.c
@@ -39,25 +39,17 @@
39#include <linux/jiffies.h> 39#include <linux/jiffies.h>
40#include <linux/i2c.h> 40#include <linux/i2c.h>
41#include <linux/i2c-isa.h> 41#include <linux/i2c-isa.h>
42#include <linux/i2c-sensor.h>
43#include <linux/i2c-vid.h> 42#include <linux/i2c-vid.h>
44#include <linux/hwmon.h> 43#include <linux/hwmon.h>
45#include <linux/err.h> 44#include <linux/err.h>
46#include <asm/io.h> 45#include <asm/io.h>
47 46
48static unsigned short normal_i2c[] = { I2C_CLIENT_END };
49static unsigned int normal_isa[] = { 0, I2C_CLIENT_ISA_END };
50static struct i2c_force_data forces[] = {{ NULL }};
51static u8 devid; 47static u8 devid;
52static unsigned int extra_isa[3]; 48static unsigned short address;
49static unsigned short extra_isa[3];
53static u8 confreg[4]; 50static u8 confreg[4];
54 51
55enum chips { any_chip, pc87360, pc87363, pc87364, pc87365, pc87366 }; 52enum chips { any_chip, pc87360, pc87363, pc87364, pc87365, pc87366 };
56static struct i2c_address_data addr_data = {
57 .normal_i2c = normal_i2c,
58 .normal_isa = normal_isa,
59 .forces = forces,
60};
61 53
62static int init = 1; 54static int init = 1;
63module_param(init, int, 0); 55module_param(init, int, 0);
@@ -228,8 +220,7 @@ struct pc87360_data {
228 * Functions declaration 220 * Functions declaration
229 */ 221 */
230 222
231static int pc87360_attach_adapter(struct i2c_adapter *adapter); 223static int pc87360_detect(struct i2c_adapter *adapter);
232static int pc87360_detect(struct i2c_adapter *adapter, int address, int kind);
233static int pc87360_detach_client(struct i2c_client *client); 224static int pc87360_detach_client(struct i2c_client *client);
234 225
235static int pc87360_read_value(struct pc87360_data *data, u8 ldi, u8 bank, 226static int pc87360_read_value(struct pc87360_data *data, u8 ldi, u8 bank,
@@ -246,8 +237,7 @@ static struct pc87360_data *pc87360_update_device(struct device *dev);
246static struct i2c_driver pc87360_driver = { 237static struct i2c_driver pc87360_driver = {
247 .owner = THIS_MODULE, 238 .owner = THIS_MODULE,
248 .name = "pc87360", 239 .name = "pc87360",
249 .flags = I2C_DF_NOTIFY, 240 .attach_adapter = pc87360_detect,
250 .attach_adapter = pc87360_attach_adapter,
251 .detach_client = pc87360_detach_client, 241 .detach_client = pc87360_detach_client,
252}; 242};
253 243
@@ -636,12 +626,7 @@ static DEVICE_ATTR(alarms_temp, S_IRUGO, show_temp_alarms, NULL);
636 * Device detection, registration and update 626 * Device detection, registration and update
637 */ 627 */
638 628
639static int pc87360_attach_adapter(struct i2c_adapter *adapter) 629static int pc87360_find(int sioaddr, u8 *devid, unsigned short *addresses)
640{
641 return i2c_detect(adapter, &addr_data, pc87360_detect);
642}
643
644static int pc87360_find(int sioaddr, u8 *devid, int *address)
645{ 630{
646 u16 val; 631 u16 val;
647 int i; 632 int i;
@@ -687,7 +672,7 @@ static int pc87360_find(int sioaddr, u8 *devid, int *address)
687 continue; 672 continue;
688 } 673 }
689 674
690 address[i] = val; 675 addresses[i] = val;
691 676
692 if (i==0) { /* Fans */ 677 if (i==0) { /* Fans */
693 confreg[0] = superio_inb(sioaddr, 0xF0); 678 confreg[0] = superio_inb(sioaddr, 0xF0);
@@ -731,9 +716,7 @@ static int pc87360_find(int sioaddr, u8 *devid, int *address)
731 return 0; 716 return 0;
732} 717}
733 718
734/* We don't really care about the address. 719static int pc87360_detect(struct i2c_adapter *adapter)
735 Read from extra_isa instead. */
736int pc87360_detect(struct i2c_adapter *adapter, int address, int kind)
737{ 720{
738 int i; 721 int i;
739 struct i2c_client *new_client; 722 struct i2c_client *new_client;
@@ -742,9 +725,6 @@ int pc87360_detect(struct i2c_adapter *adapter, int address, int kind)
742 const char *name = "pc87360"; 725 const char *name = "pc87360";
743 int use_thermistors = 0; 726 int use_thermistors = 0;
744 727
745 if (!i2c_is_isa_adapter(adapter))
746 return -ENODEV;
747
748 if (!(data = kmalloc(sizeof(struct pc87360_data), GFP_KERNEL))) 728 if (!(data = kmalloc(sizeof(struct pc87360_data), GFP_KERNEL)))
749 return -ENOMEM; 729 return -ENOMEM;
750 memset(data, 0x00, sizeof(struct pc87360_data)); 730 memset(data, 0x00, sizeof(struct pc87360_data));
@@ -1334,12 +1314,12 @@ static int __init pc87360_init(void)
1334 /* Arbitrarily pick one of the addresses */ 1314 /* Arbitrarily pick one of the addresses */
1335 for (i = 0; i < 3; i++) { 1315 for (i = 0; i < 3; i++) {
1336 if (extra_isa[i] != 0x0000) { 1316 if (extra_isa[i] != 0x0000) {
1337 normal_isa[0] = extra_isa[i]; 1317 address = extra_isa[i];
1338 break; 1318 break;
1339 } 1319 }
1340 } 1320 }
1341 1321
1342 if (normal_isa[0] == 0x0000) { 1322 if (address == 0x0000) {
1343 printk(KERN_WARNING "pc87360: No active logical device, " 1323 printk(KERN_WARNING "pc87360: No active logical device, "
1344 "module not inserted.\n"); 1324 "module not inserted.\n");
1345 return -ENODEV; 1325 return -ENODEV;