Commit 98ceb75c7c14eada76b0aa9f03a635a735cee3cb
Committed by
Benjamin Herrenschmidt
1 parent
33a470f6d5
Exists in
master
and in
7 other branches
macintosh/hwmon/ams: Fix device removal sequence
Some code that is in ams_exit() (the module exit code) should instead be called when the device (not module) is removed. It probably doesn't make much of a difference in the PMU case, but in the I2C case it does matter. I make no guarantee that my fix isn't racy, I'm not familiar enough with the ams driver code to tell for sure. Signed-off-by: Jean Delvare <khali@linux-fr.org> Tested-by: Christian Kujau <lists@nerdbynature.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Stelian Pop <stelian@popies.net> Cc: Michael Hanselmann <linux-kernel@hansmi.ch> Cc: stable@kernel.org Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Showing 4 changed files with 12 additions and 4 deletions Side-by-side Diff
drivers/hwmon/ams/ams-core.c
... | ... | @@ -213,7 +213,7 @@ |
213 | 213 | return -ENODEV; |
214 | 214 | } |
215 | 215 | |
216 | -void ams_exit(void) | |
216 | +void ams_sensor_detach(void) | |
217 | 217 | { |
218 | 218 | /* Remove input device */ |
219 | 219 | ams_input_exit(); |
... | ... | @@ -221,9 +221,6 @@ |
221 | 221 | /* Remove attributes */ |
222 | 222 | device_remove_file(&ams_info.of_dev->dev, &dev_attr_current); |
223 | 223 | |
224 | - /* Shut down implementation */ | |
225 | - ams_info.exit(); | |
226 | - | |
227 | 224 | /* Flush interrupt worker |
228 | 225 | * |
229 | 226 | * We do this after ams_info.exit(), because an interrupt might |
... | ... | @@ -237,6 +234,12 @@ |
237 | 234 | /* Remove handler */ |
238 | 235 | pmf_unregister_irq_client(&ams_shock_client); |
239 | 236 | pmf_unregister_irq_client(&ams_freefall_client); |
237 | +} | |
238 | + | |
239 | +static void __exit ams_exit(void) | |
240 | +{ | |
241 | + /* Shut down implementation */ | |
242 | + ams_info.exit(); | |
240 | 243 | } |
241 | 244 | |
242 | 245 | MODULE_AUTHOR("Stelian Pop, Michael Hanselmann"); |
drivers/hwmon/ams/ams-i2c.c
drivers/hwmon/ams/ams-pmu.c
drivers/hwmon/ams/ams.h