diff options
author | Guenter Roeck <linux@roeck-us.net> | 2012-02-22 11:56:44 -0500 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2012-03-18 21:27:46 -0400 |
commit | dd285ad7373bf5d21cceacb3b7a5eb8b72d37085 (patch) | |
tree | f46fdda6b48ccb2b3721d7e807b1a41e2c99c8a1 | |
parent | 8b313ca7f1b98263ce22519b25a9c2a362eeb898 (diff) |
hwmon: (pmbus) Simplify remove functions
Since devm_kzalloc() is now used to allocate driver memory, the client
driver remove function has no purpose other than to call pmbus_do_remove().
This means we can get rid of it by redefining pmbus_do_remove() to use the
same prototype, and pointing to it directly.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/pmbus/adm1275.c | 8 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/lm25066.c | 8 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/ltc2978.c | 8 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/max16064.c | 8 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/max34440.c | 8 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/max8688.c | 8 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/pmbus.c | 8 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/pmbus.h | 2 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/pmbus_core.c | 3 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/ucd9000.c | 9 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/ucd9200.c | 9 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/zl6100.c | 8 |
12 files changed, 13 insertions, 74 deletions
diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c index f81cb4adaeba..5e4421e57eb0 100644 --- a/drivers/hwmon/pmbus/adm1275.c +++ b/drivers/hwmon/pmbus/adm1275.c | |||
@@ -301,18 +301,12 @@ static int adm1275_probe(struct i2c_client *client, | |||
301 | return pmbus_do_probe(client, id, info); | 301 | return pmbus_do_probe(client, id, info); |
302 | } | 302 | } |
303 | 303 | ||
304 | static int adm1275_remove(struct i2c_client *client) | ||
305 | { | ||
306 | pmbus_do_remove(client); | ||
307 | return 0; | ||
308 | } | ||
309 | |||
310 | static struct i2c_driver adm1275_driver = { | 304 | static struct i2c_driver adm1275_driver = { |
311 | .driver = { | 305 | .driver = { |
312 | .name = "adm1275", | 306 | .name = "adm1275", |
313 | }, | 307 | }, |
314 | .probe = adm1275_probe, | 308 | .probe = adm1275_probe, |
315 | .remove = adm1275_remove, | 309 | .remove = pmbus_do_remove, |
316 | .id_table = adm1275_id, | 310 | .id_table = adm1275_id, |
317 | }; | 311 | }; |
318 | 312 | ||
diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c index e70d4ca14fbe..c299392716af 100644 --- a/drivers/hwmon/pmbus/lm25066.c +++ b/drivers/hwmon/pmbus/lm25066.c | |||
@@ -295,12 +295,6 @@ static int lm25066_probe(struct i2c_client *client, | |||
295 | return pmbus_do_probe(client, id, info); | 295 | return pmbus_do_probe(client, id, info); |
296 | } | 296 | } |
297 | 297 | ||
298 | static int lm25066_remove(struct i2c_client *client) | ||
299 | { | ||
300 | pmbus_do_remove(client); | ||
301 | return 0; | ||
302 | } | ||
303 | |||
304 | static const struct i2c_device_id lm25066_id[] = { | 298 | static const struct i2c_device_id lm25066_id[] = { |
305 | {"lm25066", lm25066}, | 299 | {"lm25066", lm25066}, |
306 | {"lm5064", lm5064}, | 300 | {"lm5064", lm5064}, |
@@ -316,7 +310,7 @@ static struct i2c_driver lm25066_driver = { | |||
316 | .name = "lm25066", | 310 | .name = "lm25066", |
317 | }, | 311 | }, |
318 | .probe = lm25066_probe, | 312 | .probe = lm25066_probe, |
319 | .remove = lm25066_remove, | 313 | .remove = pmbus_do_remove, |
320 | .id_table = lm25066_id, | 314 | .id_table = lm25066_id, |
321 | }; | 315 | }; |
322 | 316 | ||
diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c index 5e07a363b3e9..9652a2c92a24 100644 --- a/drivers/hwmon/pmbus/ltc2978.c +++ b/drivers/hwmon/pmbus/ltc2978.c | |||
@@ -361,19 +361,13 @@ static int ltc2978_probe(struct i2c_client *client, | |||
361 | return pmbus_do_probe(client, id, info); | 361 | return pmbus_do_probe(client, id, info); |
362 | } | 362 | } |
363 | 363 | ||
364 | static int ltc2978_remove(struct i2c_client *client) | ||
365 | { | ||
366 | pmbus_do_remove(client); | ||
367 | return 0; | ||
368 | } | ||
369 | |||
370 | /* This is the driver that will be inserted */ | 364 | /* This is the driver that will be inserted */ |
371 | static struct i2c_driver ltc2978_driver = { | 365 | static struct i2c_driver ltc2978_driver = { |
372 | .driver = { | 366 | .driver = { |
373 | .name = "ltc2978", | 367 | .name = "ltc2978", |
374 | }, | 368 | }, |
375 | .probe = ltc2978_probe, | 369 | .probe = ltc2978_probe, |
376 | .remove = ltc2978_remove, | 370 | .remove = pmbus_do_remove, |
377 | .id_table = ltc2978_id, | 371 | .id_table = ltc2978_id, |
378 | }; | 372 | }; |
379 | 373 | ||
diff --git a/drivers/hwmon/pmbus/max16064.c b/drivers/hwmon/pmbus/max16064.c index 5cfe20f1e030..fa237a3c3291 100644 --- a/drivers/hwmon/pmbus/max16064.c +++ b/drivers/hwmon/pmbus/max16064.c | |||
@@ -103,12 +103,6 @@ static int max16064_probe(struct i2c_client *client, | |||
103 | return pmbus_do_probe(client, id, &max16064_info); | 103 | return pmbus_do_probe(client, id, &max16064_info); |
104 | } | 104 | } |
105 | 105 | ||
106 | static int max16064_remove(struct i2c_client *client) | ||
107 | { | ||
108 | pmbus_do_remove(client); | ||
109 | return 0; | ||
110 | } | ||
111 | |||
112 | static const struct i2c_device_id max16064_id[] = { | 106 | static const struct i2c_device_id max16064_id[] = { |
113 | {"max16064", 0}, | 107 | {"max16064", 0}, |
114 | {} | 108 | {} |
@@ -122,7 +116,7 @@ static struct i2c_driver max16064_driver = { | |||
122 | .name = "max16064", | 116 | .name = "max16064", |
123 | }, | 117 | }, |
124 | .probe = max16064_probe, | 118 | .probe = max16064_probe, |
125 | .remove = max16064_remove, | 119 | .remove = pmbus_do_remove, |
126 | .id_table = max16064_id, | 120 | .id_table = max16064_id, |
127 | }; | 121 | }; |
128 | 122 | ||
diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c index d9026f9ff13e..7d830c1e7032 100644 --- a/drivers/hwmon/pmbus/max34440.c +++ b/drivers/hwmon/pmbus/max34440.c | |||
@@ -224,12 +224,6 @@ static int max34440_probe(struct i2c_client *client, | |||
224 | return pmbus_do_probe(client, id, &max34440_info[id->driver_data]); | 224 | return pmbus_do_probe(client, id, &max34440_info[id->driver_data]); |
225 | } | 225 | } |
226 | 226 | ||
227 | static int max34440_remove(struct i2c_client *client) | ||
228 | { | ||
229 | pmbus_do_remove(client); | ||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | static const struct i2c_device_id max34440_id[] = { | 227 | static const struct i2c_device_id max34440_id[] = { |
234 | {"max34440", max34440}, | 228 | {"max34440", max34440}, |
235 | {"max34441", max34441}, | 229 | {"max34441", max34441}, |
@@ -244,7 +238,7 @@ static struct i2c_driver max34440_driver = { | |||
244 | .name = "max34440", | 238 | .name = "max34440", |
245 | }, | 239 | }, |
246 | .probe = max34440_probe, | 240 | .probe = max34440_probe, |
247 | .remove = max34440_remove, | 241 | .remove = pmbus_do_remove, |
248 | .id_table = max34440_id, | 242 | .id_table = max34440_id, |
249 | }; | 243 | }; |
250 | 244 | ||
diff --git a/drivers/hwmon/pmbus/max8688.c b/drivers/hwmon/pmbus/max8688.c index 82c598d7cfa3..f04454a42fdd 100644 --- a/drivers/hwmon/pmbus/max8688.c +++ b/drivers/hwmon/pmbus/max8688.c | |||
@@ -180,12 +180,6 @@ static int max8688_probe(struct i2c_client *client, | |||
180 | return pmbus_do_probe(client, id, &max8688_info); | 180 | return pmbus_do_probe(client, id, &max8688_info); |
181 | } | 181 | } |
182 | 182 | ||
183 | static int max8688_remove(struct i2c_client *client) | ||
184 | { | ||
185 | pmbus_do_remove(client); | ||
186 | return 0; | ||
187 | } | ||
188 | |||
189 | static const struct i2c_device_id max8688_id[] = { | 183 | static const struct i2c_device_id max8688_id[] = { |
190 | {"max8688", 0}, | 184 | {"max8688", 0}, |
191 | { } | 185 | { } |
@@ -199,7 +193,7 @@ static struct i2c_driver max8688_driver = { | |||
199 | .name = "max8688", | 193 | .name = "max8688", |
200 | }, | 194 | }, |
201 | .probe = max8688_probe, | 195 | .probe = max8688_probe, |
202 | .remove = max8688_remove, | 196 | .remove = pmbus_do_remove, |
203 | .id_table = max8688_id, | 197 | .id_table = max8688_id, |
204 | }; | 198 | }; |
205 | 199 | ||
diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c index b94bec23d95c..34887408505b 100644 --- a/drivers/hwmon/pmbus/pmbus.c +++ b/drivers/hwmon/pmbus/pmbus.c | |||
@@ -178,12 +178,6 @@ static int pmbus_probe(struct i2c_client *client, | |||
178 | return pmbus_do_probe(client, id, info); | 178 | return pmbus_do_probe(client, id, info); |
179 | } | 179 | } |
180 | 180 | ||
181 | static int pmbus_remove(struct i2c_client *client) | ||
182 | { | ||
183 | pmbus_do_remove(client); | ||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | /* | 181 | /* |
188 | * Use driver_data to set the number of pages supported by the chip. | 182 | * Use driver_data to set the number of pages supported by the chip. |
189 | */ | 183 | */ |
@@ -209,7 +203,7 @@ static struct i2c_driver pmbus_driver = { | |||
209 | .name = "pmbus", | 203 | .name = "pmbus", |
210 | }, | 204 | }, |
211 | .probe = pmbus_probe, | 205 | .probe = pmbus_probe, |
212 | .remove = pmbus_remove, | 206 | .remove = pmbus_do_remove, |
213 | .id_table = pmbus_id, | 207 | .id_table = pmbus_id, |
214 | }; | 208 | }; |
215 | 209 | ||
diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h index 5d31d1c2c0f5..0b17d4f20f81 100644 --- a/drivers/hwmon/pmbus/pmbus.h +++ b/drivers/hwmon/pmbus/pmbus.h | |||
@@ -364,7 +364,7 @@ bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg); | |||
364 | bool pmbus_check_word_register(struct i2c_client *client, int page, int reg); | 364 | bool pmbus_check_word_register(struct i2c_client *client, int page, int reg); |
365 | int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, | 365 | int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id, |
366 | struct pmbus_driver_info *info); | 366 | struct pmbus_driver_info *info); |
367 | void pmbus_do_remove(struct i2c_client *client); | 367 | int pmbus_do_remove(struct i2c_client *client); |
368 | const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client | 368 | const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client |
369 | *client); | 369 | *client); |
370 | 370 | ||
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 26b6542a90cd..aada0c67a911 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c | |||
@@ -1778,11 +1778,12 @@ out_hwmon_device_register: | |||
1778 | } | 1778 | } |
1779 | EXPORT_SYMBOL_GPL(pmbus_do_probe); | 1779 | EXPORT_SYMBOL_GPL(pmbus_do_probe); |
1780 | 1780 | ||
1781 | void pmbus_do_remove(struct i2c_client *client) | 1781 | int pmbus_do_remove(struct i2c_client *client) |
1782 | { | 1782 | { |
1783 | struct pmbus_data *data = i2c_get_clientdata(client); | 1783 | struct pmbus_data *data = i2c_get_clientdata(client); |
1784 | hwmon_device_unregister(data->hwmon_dev); | 1784 | hwmon_device_unregister(data->hwmon_dev); |
1785 | sysfs_remove_group(&client->dev.kobj, &data->group); | 1785 | sysfs_remove_group(&client->dev.kobj, &data->group); |
1786 | return 0; | ||
1786 | } | 1787 | } |
1787 | EXPORT_SYMBOL_GPL(pmbus_do_remove); | 1788 | EXPORT_SYMBOL_GPL(pmbus_do_remove); |
1788 | 1789 | ||
diff --git a/drivers/hwmon/pmbus/ucd9000.c b/drivers/hwmon/pmbus/ucd9000.c index e0573459447c..fbb1479d3ad4 100644 --- a/drivers/hwmon/pmbus/ucd9000.c +++ b/drivers/hwmon/pmbus/ucd9000.c | |||
@@ -229,20 +229,13 @@ static int ucd9000_probe(struct i2c_client *client, | |||
229 | return pmbus_do_probe(client, mid, info); | 229 | return pmbus_do_probe(client, mid, info); |
230 | } | 230 | } |
231 | 231 | ||
232 | static int ucd9000_remove(struct i2c_client *client) | ||
233 | { | ||
234 | pmbus_do_remove(client); | ||
235 | return 0; | ||
236 | } | ||
237 | |||
238 | |||
239 | /* This is the driver that will be inserted */ | 232 | /* This is the driver that will be inserted */ |
240 | static struct i2c_driver ucd9000_driver = { | 233 | static struct i2c_driver ucd9000_driver = { |
241 | .driver = { | 234 | .driver = { |
242 | .name = "ucd9000", | 235 | .name = "ucd9000", |
243 | }, | 236 | }, |
244 | .probe = ucd9000_probe, | 237 | .probe = ucd9000_probe, |
245 | .remove = ucd9000_remove, | 238 | .remove = pmbus_do_remove, |
246 | .id_table = ucd9000_id, | 239 | .id_table = ucd9000_id, |
247 | }; | 240 | }; |
248 | 241 | ||
diff --git a/drivers/hwmon/pmbus/ucd9200.c b/drivers/hwmon/pmbus/ucd9200.c index c0d41b993a53..033d6aca47d3 100644 --- a/drivers/hwmon/pmbus/ucd9200.c +++ b/drivers/hwmon/pmbus/ucd9200.c | |||
@@ -163,20 +163,13 @@ static int ucd9200_probe(struct i2c_client *client, | |||
163 | return pmbus_do_probe(client, mid, info); | 163 | return pmbus_do_probe(client, mid, info); |
164 | } | 164 | } |
165 | 165 | ||
166 | static int ucd9200_remove(struct i2c_client *client) | ||
167 | { | ||
168 | pmbus_do_remove(client); | ||
169 | return 0; | ||
170 | } | ||
171 | |||
172 | |||
173 | /* This is the driver that will be inserted */ | 166 | /* This is the driver that will be inserted */ |
174 | static struct i2c_driver ucd9200_driver = { | 167 | static struct i2c_driver ucd9200_driver = { |
175 | .driver = { | 168 | .driver = { |
176 | .name = "ucd9200", | 169 | .name = "ucd9200", |
177 | }, | 170 | }, |
178 | .probe = ucd9200_probe, | 171 | .probe = ucd9200_probe, |
179 | .remove = ucd9200_remove, | 172 | .remove = pmbus_do_remove, |
180 | .id_table = ucd9200_id, | 173 | .id_table = ucd9200_id, |
181 | }; | 174 | }; |
182 | 175 | ||
diff --git a/drivers/hwmon/pmbus/zl6100.c b/drivers/hwmon/pmbus/zl6100.c index 9d3b84535e73..e5bb7355d480 100644 --- a/drivers/hwmon/pmbus/zl6100.c +++ b/drivers/hwmon/pmbus/zl6100.c | |||
@@ -240,18 +240,12 @@ static int zl6100_probe(struct i2c_client *client, | |||
240 | return pmbus_do_probe(client, mid, info); | 240 | return pmbus_do_probe(client, mid, info); |
241 | } | 241 | } |
242 | 242 | ||
243 | static int zl6100_remove(struct i2c_client *client) | ||
244 | { | ||
245 | pmbus_do_remove(client); | ||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | static struct i2c_driver zl6100_driver = { | 243 | static struct i2c_driver zl6100_driver = { |
250 | .driver = { | 244 | .driver = { |
251 | .name = "zl6100", | 245 | .name = "zl6100", |
252 | }, | 246 | }, |
253 | .probe = zl6100_probe, | 247 | .probe = zl6100_probe, |
254 | .remove = zl6100_remove, | 248 | .remove = pmbus_do_remove, |
255 | .id_table = zl6100_id, | 249 | .id_table = zl6100_id, |
256 | }; | 250 | }; |
257 | 251 | ||