diff options
author | Jean Delvare <khali@linux-fr.org> | 2009-10-04 16:53:41 -0400 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-10-04 16:53:41 -0400 |
commit | b835d7fbd54c42d7b9abb5e8a64f32690ebfad43 (patch) | |
tree | e5ce6f25bef922df78da1116baf50916f122ce19 | |
parent | f546c65cd59275c7b95eba4f9b3ab83b38a5e9cb (diff) |
max6875: Discard obsolete detect method
There is no point in implementing a detect callback for the MAX6875, as
this device can't be detected. It was there solely to handle "force"
module parameters to instantiate devices, but now we have a better sysfs
interface that can do the same.
So we can get rid of the ugly module parameters and the detect callback.
This basically divides the binary module size by 2.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Ben Gardner <gardner.ben@gmail.com>
-rw-r--r-- | Documentation/misc-devices/max6875 | 6 | ||||
-rw-r--r-- | drivers/misc/eeprom/max6875.c | 29 |
2 files changed, 9 insertions, 26 deletions
diff --git a/Documentation/misc-devices/max6875 b/Documentation/misc-devices/max6875 index 10ca43cd1a72..1e89ee3ccc1b 100644 --- a/Documentation/misc-devices/max6875 +++ b/Documentation/misc-devices/max6875 | |||
@@ -42,10 +42,12 @@ General Remarks | |||
42 | 42 | ||
43 | Valid addresses for the MAX6875 are 0x50 and 0x52. | 43 | Valid addresses for the MAX6875 are 0x50 and 0x52. |
44 | Valid addresses for the MAX6874 are 0x50, 0x52, 0x54 and 0x56. | 44 | Valid addresses for the MAX6874 are 0x50, 0x52, 0x54 and 0x56. |
45 | The driver does not probe any address, so you must force the address. | 45 | The driver does not probe any address, so you explicitly instantiate the |
46 | devices. | ||
46 | 47 | ||
47 | Example: | 48 | Example: |
48 | $ modprobe max6875 force=0,0x50 | 49 | $ modprobe max6875 |
50 | $ echo max6875 0x50 > /sys/bus/i2c/devices/i2c-0/new_device | ||
49 | 51 | ||
50 | The MAX6874/MAX6875 ignores address bit 0, so this driver attaches to multiple | 52 | The MAX6874/MAX6875 ignores address bit 0, so this driver attaches to multiple |
51 | addresses. For example, for address 0x50, it also reserves 0x51. | 53 | addresses. For example, for address 0x50, it also reserves 0x51. |
diff --git a/drivers/misc/eeprom/max6875.c b/drivers/misc/eeprom/max6875.c index 3c0c58eed347..5a6b2bce8ad5 100644 --- a/drivers/misc/eeprom/max6875.c +++ b/drivers/misc/eeprom/max6875.c | |||
@@ -33,12 +33,6 @@ | |||
33 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
35 | 35 | ||
36 | /* Do not scan - the MAX6875 access method will write to some EEPROM chips */ | ||
37 | static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; | ||
38 | |||
39 | /* Insmod parameters */ | ||
40 | I2C_CLIENT_INSMOD_1(max6875); | ||
41 | |||
42 | /* The MAX6875 can only read/write 16 bytes at a time */ | 36 | /* The MAX6875 can only read/write 16 bytes at a time */ |
43 | #define SLICE_SIZE 16 | 37 | #define SLICE_SIZE 16 |
44 | #define SLICE_BITS 4 | 38 | #define SLICE_BITS 4 |
@@ -146,31 +140,21 @@ static struct bin_attribute user_eeprom_attr = { | |||
146 | .read = max6875_read, | 140 | .read = max6875_read, |
147 | }; | 141 | }; |
148 | 142 | ||
149 | /* Return 0 if detection is successful, -ENODEV otherwise */ | 143 | static int max6875_probe(struct i2c_client *client, |
150 | static int max6875_detect(struct i2c_client *client, int kind, | 144 | const struct i2c_device_id *id) |
151 | struct i2c_board_info *info) | ||
152 | { | 145 | { |
153 | struct i2c_adapter *adapter = client->adapter; | 146 | struct i2c_adapter *adapter = client->adapter; |
147 | struct max6875_data *data; | ||
148 | int err; | ||
154 | 149 | ||
155 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA | 150 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
156 | | I2C_FUNC_SMBUS_READ_BYTE)) | 151 | | I2C_FUNC_SMBUS_READ_BYTE)) |
157 | return -ENODEV; | 152 | return -ENODEV; |
158 | 153 | ||
159 | /* Only check even addresses */ | 154 | /* Only bind to even addresses */ |
160 | if (client->addr & 1) | 155 | if (client->addr & 1) |
161 | return -ENODEV; | 156 | return -ENODEV; |
162 | 157 | ||
163 | strlcpy(info->type, "max6875", I2C_NAME_SIZE); | ||
164 | |||
165 | return 0; | ||
166 | } | ||
167 | |||
168 | static int max6875_probe(struct i2c_client *client, | ||
169 | const struct i2c_device_id *id) | ||
170 | { | ||
171 | struct max6875_data *data; | ||
172 | int err; | ||
173 | |||
174 | if (!(data = kzalloc(sizeof(struct max6875_data), GFP_KERNEL))) | 158 | if (!(data = kzalloc(sizeof(struct max6875_data), GFP_KERNEL))) |
175 | return -ENOMEM; | 159 | return -ENOMEM; |
176 | 160 | ||
@@ -222,9 +206,6 @@ static struct i2c_driver max6875_driver = { | |||
222 | .probe = max6875_probe, | 206 | .probe = max6875_probe, |
223 | .remove = max6875_remove, | 207 | .remove = max6875_remove, |
224 | .id_table = max6875_id, | 208 | .id_table = max6875_id, |
225 | |||
226 | .detect = max6875_detect, | ||
227 | .address_data = &addr_data, | ||
228 | }; | 209 | }; |
229 | 210 | ||
230 | static int __init max6875_init(void) | 211 | static int __init max6875_init(void) |