Re: [PATCH 1/2] rtc: fix module reference count in rtc-proc
On 07/11/2015 at 12:00:21 +0800, Geliang Tang wrote : > rtc-proc.c is not built as a module. Thus, rather than dealing with > THIS_MODULE's reference count, we should deal with rtc->owner's > reference count. > > Signed-off-by: Geliang Tang > --- > drivers/rtc/rtc-proc.c | 8 +--- > 1 file changed, 5 insertions(+), 3 deletions(-) > Both patches are applied, thanks. -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] rtc: fix module reference count in rtc-proc
On 07/11/2015 at 12:00:21 +0800, Geliang Tang wrote : > rtc-proc.c is not built as a module. Thus, rather than dealing with > THIS_MODULE's reference count, we should deal with rtc->owner's > reference count. > > Signed-off-by: Geliang Tang> --- > drivers/rtc/rtc-proc.c | 8 +--- > 1 file changed, 5 insertions(+), 3 deletions(-) > Both patches are applied, thanks. -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] rtc: fix module reference count in rtc-proc
rtc-proc.c is not built as a module. Thus, rather than dealing with THIS_MODULE's reference count, we should deal with rtc->owner's reference count. Signed-off-by: Geliang Tang --- drivers/rtc/rtc-proc.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c index ffa69e1..31e7e23 100644 --- a/drivers/rtc/rtc-proc.c +++ b/drivers/rtc/rtc-proc.c @@ -112,19 +112,21 @@ static int rtc_proc_open(struct inode *inode, struct file *file) int ret; struct rtc_device *rtc = PDE_DATA(inode); - if (!try_module_get(THIS_MODULE)) + if (!try_module_get(rtc->owner)) return -ENODEV; ret = single_open(file, rtc_proc_show, rtc); if (ret) - module_put(THIS_MODULE); + module_put(rtc->owner); return ret; } static int rtc_proc_release(struct inode *inode, struct file *file) { int res = single_release(inode, file); - module_put(THIS_MODULE); + struct rtc_device *rtc = PDE_DATA(inode); + + module_put(rtc->owner); return res; } -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] rtc: fix module reference count in rtc-proc
rtc-proc.c is not built as a module. Thus, rather than dealing with THIS_MODULE's reference count, we should deal with rtc->owner's reference count. Signed-off-by: Geliang Tang--- drivers/rtc/rtc-proc.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c index ffa69e1..31e7e23 100644 --- a/drivers/rtc/rtc-proc.c +++ b/drivers/rtc/rtc-proc.c @@ -112,19 +112,21 @@ static int rtc_proc_open(struct inode *inode, struct file *file) int ret; struct rtc_device *rtc = PDE_DATA(inode); - if (!try_module_get(THIS_MODULE)) + if (!try_module_get(rtc->owner)) return -ENODEV; ret = single_open(file, rtc_proc_show, rtc); if (ret) - module_put(THIS_MODULE); + module_put(rtc->owner); return ret; } static int rtc_proc_release(struct inode *inode, struct file *file) { int res = single_release(inode, file); - module_put(THIS_MODULE); + struct rtc_device *rtc = PDE_DATA(inode); + + module_put(rtc->owner); return res; } -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/