aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83627ehf.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/w83627ehf.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/w83627ehf.c')
-rw-r--r--drivers/hwmon/w83627ehf.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index a3c642ef5c42..b14801cd615d 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -41,19 +41,13 @@
41#include <linux/slab.h> 41#include <linux/slab.h>
42#include <linux/i2c.h> 42#include <linux/i2c.h>
43#include <linux/i2c-isa.h> 43#include <linux/i2c-isa.h>
44#include <linux/i2c-sensor.h>
45#include <linux/hwmon.h> 44#include <linux/hwmon.h>
46#include <linux/err.h> 45#include <linux/err.h>
47#include <asm/io.h> 46#include <asm/io.h>
48#include "lm75.h" 47#include "lm75.h"
49 48
50/* Addresses to scan 49/* The actual ISA address is read from Super-I/O configuration space */
51 The actual ISA address is read from Super-I/O configuration space */ 50static unsigned short address;
52static unsigned short normal_i2c[] = { I2C_CLIENT_END };
53static unsigned int normal_isa[] = { 0, I2C_CLIENT_ISA_END };
54
55/* Insmod parameters */
56SENSORS_INSMOD_1(w83627ehf);
57 51
58/* 52/*
59 * Super-I/O constants and functions 53 * Super-I/O constants and functions
@@ -673,15 +667,12 @@ static void w83627ehf_init_client(struct i2c_client *client)
673 } 667 }
674} 668}
675 669
676static int w83627ehf_detect(struct i2c_adapter *adapter, int address, int kind) 670static int w83627ehf_detect(struct i2c_adapter *adapter)
677{ 671{
678 struct i2c_client *client; 672 struct i2c_client *client;
679 struct w83627ehf_data *data; 673 struct w83627ehf_data *data;
680 int i, err = 0; 674 int i, err = 0;
681 675
682 if (!i2c_is_isa_adapter(adapter))
683 return 0;
684
685 if (!request_region(address, REGION_LENGTH, w83627ehf_driver.name)) { 676 if (!request_region(address, REGION_LENGTH, w83627ehf_driver.name)) {
686 err = -EBUSY; 677 err = -EBUSY;
687 goto exit; 678 goto exit;
@@ -776,13 +767,6 @@ exit:
776 return err; 767 return err;
777} 768}
778 769
779static int w83627ehf_attach_adapter(struct i2c_adapter *adapter)
780{
781 if (!(adapter->class & I2C_CLASS_HWMON))
782 return 0;
783 return i2c_detect(adapter, &addr_data, w83627ehf_detect);
784}
785
786static int w83627ehf_detach_client(struct i2c_client *client) 770static int w83627ehf_detach_client(struct i2c_client *client)
787{ 771{
788 struct w83627ehf_data *data = i2c_get_clientdata(client); 772 struct w83627ehf_data *data = i2c_get_clientdata(client);
@@ -804,12 +788,11 @@ static int w83627ehf_detach_client(struct i2c_client *client)
804static struct i2c_driver w83627ehf_driver = { 788static struct i2c_driver w83627ehf_driver = {
805 .owner = THIS_MODULE, 789 .owner = THIS_MODULE,
806 .name = "w83627ehf", 790 .name = "w83627ehf",
807 .flags = I2C_DF_NOTIFY, 791 .attach_adapter = w83627ehf_detect,
808 .attach_adapter = w83627ehf_attach_adapter,
809 .detach_client = w83627ehf_detach_client, 792 .detach_client = w83627ehf_detach_client,
810}; 793};
811 794
812static int __init w83627ehf_find(int sioaddr, int *address) 795static int __init w83627ehf_find(int sioaddr, unsigned short *addr)
813{ 796{
814 u16 val; 797 u16 val;
815 798
@@ -827,8 +810,8 @@ static int __init w83627ehf_find(int sioaddr, int *address)
827 superio_select(W83627EHF_LD_HWM); 810 superio_select(W83627EHF_LD_HWM);
828 val = (superio_inb(SIO_REG_ADDR) << 8) 811 val = (superio_inb(SIO_REG_ADDR) << 8)
829 | superio_inb(SIO_REG_ADDR + 1); 812 | superio_inb(SIO_REG_ADDR + 1);
830 *address = val & ~(REGION_LENGTH - 1); 813 *addr = val & ~(REGION_LENGTH - 1);
831 if (*address == 0) { 814 if (*addr == 0) {
832 superio_exit(); 815 superio_exit();
833 return -ENODEV; 816 return -ENODEV;
834 } 817 }
@@ -844,8 +827,8 @@ static int __init w83627ehf_find(int sioaddr, int *address)
844 827
845static int __init sensors_w83627ehf_init(void) 828static int __init sensors_w83627ehf_init(void)
846{ 829{
847 if (w83627ehf_find(0x2e, &normal_isa[0]) 830 if (w83627ehf_find(0x2e, &address)
848 && w83627ehf_find(0x4e, &normal_isa[0])) 831 && w83627ehf_find(0x4e, &address))
849 return -ENODEV; 832 return -ENODEV;
850 833
851 return i2c_isa_add_driver(&w83627ehf_driver); 834 return i2c_isa_add_driver(&w83627ehf_driver);