aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/ams
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/ams')
-rw-r--r--drivers/hwmon/ams/ams-core.c11
-rw-r--r--drivers/hwmon/ams/ams-i2c.c2
-rw-r--r--drivers/hwmon/ams/ams-pmu.c2
-rw-r--r--drivers/hwmon/ams/ams.h1
4 files changed, 12 insertions, 4 deletions
diff --git a/drivers/hwmon/ams/ams-core.c b/drivers/hwmon/ams/ams-core.c
index 6c9ace1b76f6..2ad62c339cd2 100644
--- a/drivers/hwmon/ams/ams-core.c
+++ b/drivers/hwmon/ams/ams-core.c
@@ -213,7 +213,7 @@ int __init ams_init(void)
213 return -ENODEV; 213 return -ENODEV;
214} 214}
215 215
216void ams_exit(void) 216void ams_sensor_detach(void)
217{ 217{
218 /* Remove input device */ 218 /* Remove input device */
219 ams_input_exit(); 219 ams_input_exit();
@@ -221,9 +221,6 @@ void ams_exit(void)
221 /* Remove attributes */ 221 /* Remove attributes */
222 device_remove_file(&ams_info.of_dev->dev, &dev_attr_current); 222 device_remove_file(&ams_info.of_dev->dev, &dev_attr_current);
223 223
224 /* Shut down implementation */
225 ams_info.exit();
226
227 /* Flush interrupt worker 224 /* Flush interrupt worker
228 * 225 *
229 * We do this after ams_info.exit(), because an interrupt might 226 * We do this after ams_info.exit(), because an interrupt might
@@ -239,6 +236,12 @@ void ams_exit(void)
239 pmf_unregister_irq_client(&ams_freefall_client); 236 pmf_unregister_irq_client(&ams_freefall_client);
240} 237}
241 238
239static void __exit ams_exit(void)
240{
241 /* Shut down implementation */
242 ams_info.exit();
243}
244
242MODULE_AUTHOR("Stelian Pop, Michael Hanselmann"); 245MODULE_AUTHOR("Stelian Pop, Michael Hanselmann");
243MODULE_DESCRIPTION("Apple Motion Sensor driver"); 246MODULE_DESCRIPTION("Apple Motion Sensor driver");
244MODULE_LICENSE("GPL"); 247MODULE_LICENSE("GPL");
diff --git a/drivers/hwmon/ams/ams-i2c.c b/drivers/hwmon/ams/ams-i2c.c
index 2cbf8a6506c7..abeecd27b484 100644
--- a/drivers/hwmon/ams/ams-i2c.c
+++ b/drivers/hwmon/ams/ams-i2c.c
@@ -238,6 +238,8 @@ static int ams_i2c_probe(struct i2c_client *client,
238static int ams_i2c_remove(struct i2c_client *client) 238static int ams_i2c_remove(struct i2c_client *client)
239{ 239{
240 if (ams_info.has_device) { 240 if (ams_info.has_device) {
241 ams_sensor_detach();
242
241 /* Disable interrupts */ 243 /* Disable interrupts */
242 ams_i2c_set_irq(AMS_IRQ_ALL, 0); 244 ams_i2c_set_irq(AMS_IRQ_ALL, 0);
243 245
diff --git a/drivers/hwmon/ams/ams-pmu.c b/drivers/hwmon/ams/ams-pmu.c
index fb18b3d3162b..4f61b3ee1b08 100644
--- a/drivers/hwmon/ams/ams-pmu.c
+++ b/drivers/hwmon/ams/ams-pmu.c
@@ -133,6 +133,8 @@ static void ams_pmu_get_xyz(s8 *x, s8 *y, s8 *z)
133 133
134static void ams_pmu_exit(void) 134static void ams_pmu_exit(void)
135{ 135{
136 ams_sensor_detach();
137
136 /* Disable interrupts */ 138 /* Disable interrupts */
137 ams_pmu_set_irq(AMS_IRQ_ALL, 0); 139 ams_pmu_set_irq(AMS_IRQ_ALL, 0);
138 140
diff --git a/drivers/hwmon/ams/ams.h b/drivers/hwmon/ams/ams.h
index 5ed387b0bd9a..b28d7e27a031 100644
--- a/drivers/hwmon/ams/ams.h
+++ b/drivers/hwmon/ams/ams.h
@@ -61,6 +61,7 @@ extern struct ams ams_info;
61 61
62extern void ams_sensors(s8 *x, s8 *y, s8 *z); 62extern void ams_sensors(s8 *x, s8 *y, s8 *z);
63extern int ams_sensor_attach(void); 63extern int ams_sensor_attach(void);
64extern void ams_sensor_detach(void);
64 65
65extern int ams_pmu_init(struct device_node *np); 66extern int ams_pmu_init(struct device_node *np);
66extern int ams_i2c_init(struct device_node *np); 67extern int ams_i2c_init(struct device_node *np);