All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: recycle id when unloading a rtc driver
@ 2012-08-02 23:53 Vincent Palatin
  2012-12-19  0:46 ` [rtc-linux] " Andrew Morton
  0 siblings, 1 reply; 10+ messages in thread
From: Vincent Palatin @ 2012-08-02 23:53 UTC (permalink / raw)
  To: rtc-linux; +Cc: Alessandro Zummo, linux-kernel, Vincent Palatin

When calling rtc_device_unregister, we are not freeing the id used by the
driver.
So when doing a unload/load cycle for a RTC driver (e.g. rmmod rtc_cmos
&& modprobe rtc_cmos), its id is incremented by one. As a consequence,
we no longer have neither an rtc0 driver nor a /proc/driver/rtc (as it
only exists for the first driver).

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
---
 drivers/rtc/class.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index dc4c274..37b1d82 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -238,6 +238,7 @@ void rtc_device_unregister(struct rtc_device *rtc)
 		rtc_proc_del_device(rtc);
 		device_unregister(&rtc->dev);
 		rtc->ops = NULL;
+		ida_simple_remove(&rtc_ida, rtc->id);
 		mutex_unlock(&rtc->ops_lock);
 		put_device(&rtc->dev);
 	}
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-12-27 12:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-02 23:53 [PATCH] rtc: recycle id when unloading a rtc driver Vincent Palatin
2012-12-19  0:46 ` [rtc-linux] " Andrew Morton
2012-12-19  7:37   ` Alexander Holler
2012-12-19  7:45     ` Andrew Morton
2012-12-19  7:55       ` Alexander Holler
2012-12-19  8:27         ` Andrew Morton
2012-12-19  8:55           ` Alexander Holler
2012-12-19 22:37             ` Andrew Morton
2012-12-19 22:58               ` Alexander Holler
2012-12-27 12:42             ` Alexander Holler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.