[PATCH] timed_output : disable the timed output device when thedevice is unregistered

From: Kim, Milo
Date: Fri Apr 27 2012 - 01:13:00 EST



(Life cycle of timed output device driver)

1) register the device as the timed output
2) enable() ops is called via the sysfs
timeout > 0 : timer is activated and device is turned on
timeout = 0 : timer is cancelled and device is off
3) unregister the timed output device if not used any more

So the registered device should be disabled explicitly when the module is removed.
('disabled' means the timer is stopped and the device is turned off)

Rather than implementing that code in each driver,
just call enable() with timeout = 0 to clean up the driver.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@xxxxxx>
---
drivers/staging/android/timed_output.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/android/timed_output.c b/drivers/staging/android/timed_output.c
index f373422..38d930c 100644
--- a/drivers/staging/android/timed_output.c
+++ b/drivers/staging/android/timed_output.c
@@ -99,6 +99,7 @@ EXPORT_SYMBOL_GPL(timed_output_dev_register);

void timed_output_dev_unregister(struct timed_output_dev *tdev)
{
+ tdev->enable(tdev, 0);
device_remove_file(tdev->dev, &dev_attr_enable);
device_destroy(timed_output_class, MKDEV(0, tdev->index));
dev_set_drvdata(tdev->dev, NULL);
--
1.7.4.1


Best Regards,
Milo (Woogyom) Kim


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/