Patchwork [1/3] rtc: Allow including mc146818 rtc header from userspace

login
register
mail settings
Submitter Sasha Levin
Date Nov. 29, 2011, 8:35 a.m.
Message ID <1322555735-32163-1-git-send-email-levinsasha928@gmail.com>
Download mbox | patch
Permalink /patch/128233/
State New
Headers show

Comments

Sasha Levin - Nov. 29, 2011, 8:35 a.m.
This patch moves kernel specific header includes into the kernel #ifdef-ed
section, thus allowing userspace to include this header directly.

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: rtc-linux@googlegroups.com
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 include/linux/mc146818rtc.h |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
Sasha Levin - Dec. 14, 2011, 8:56 a.m.
Just a ping to RTC maintainers. Any comments on the patch? can it go in?

On Tue, 2011-11-29 at 10:35 +0200, Sasha Levin wrote:
> This patch moves kernel specific header includes into the kernel #ifdef-ed
> section, thus allowing userspace to include this header directly.
> 
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: rtc-linux@googlegroups.com
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
>  include/linux/mc146818rtc.h |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h
> index 2f4e957..49d93ff 100644
> --- a/include/linux/mc146818rtc.h
> +++ b/include/linux/mc146818rtc.h
> @@ -11,11 +11,10 @@
>  #ifndef _MC146818RTC_H
>  #define _MC146818RTC_H
>  
> +#ifdef __KERNEL__
>  #include <asm/io.h>
>  #include <linux/rtc.h>			/* get the user-level API */
>  #include <asm/mc146818rtc.h>		/* register access macros */
> -
> -#ifdef __KERNEL__
>  #include <linux/spinlock.h>		/* spinlock_t */
>  extern spinlock_t rtc_lock;		/* serialize CMOS RAM access */
>
Jean-Christophe PLAGNIOL-VILLARD - Dec. 14, 2011, 5:42 p.m.
On 10:56 Wed 14 Dec     , Sasha Levin wrote:
> Just a ping to RTC maintainers. Any comments on the patch? can it go in?

why do you need such ocde in the userspace?

Best Regards,
J.
Cyrill Gorcunov - Dec. 14, 2011, 5:55 p.m.
On Wed, Dec 14, 2011 at 06:42:51PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 10:56 Wed 14 Dec     , Sasha Levin wrote:
> > Just a ping to RTC maintainers. Any comments on the patch? can it go in?
> 
> why do you need such ocde in the userspace?
> 

See patch 2/3 in this series. We use this constants in kvmtool, so it's
preferred to not duplicate code if possible.

	Cyrill
Jean-Christophe PLAGNIOL-VILLARD - Dec. 18, 2011, 12:10 p.m.
On 21:55 Wed 14 Dec     , Cyrill Gorcunov wrote:
> On Wed, Dec 14, 2011 at 06:42:51PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 10:56 Wed 14 Dec     , Sasha Levin wrote:
> > > Just a ping to RTC maintainers. Any comments on the patch? can it go in?
> > 
> > why do you need such ocde in the userspace?
> > 
> 
> See patch 2/3 in this series. We use this constants in kvmtool, so it's
> preferred to not duplicate code if possible.
why do you need it?

Best Regards,
J.
Cyrill Gorcunov - Dec. 18, 2011, 12:42 p.m.
On Sun, Dec 18, 2011 at 01:10:08PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > Just a ping to RTC maintainers. Any comments on the patch? can it go in?
> > > 
> > > why do you need such ocde in the userspace?
> > 
> > See patch 2/3 in this series. We use this constants in kvmtool, so it's
> > preferred to not duplicate code if possible.
>
> why do you need it?
> 

Already replied in previous mail.

	Cyrill
Pekka Enberg - Dec. 19, 2011, 7:20 a.m.
> On 21:55 Wed 14 Dec     , Cyrill Gorcunov wrote:
>> On Wed, Dec 14, 2011 at 06:42:51PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
>>> On 10:56 Wed 14 Dec     , Sasha Levin wrote:
>>>> Just a ping to RTC maintainers. Any comments on the patch? can it go in?
>>>
>>> why do you need such ocde in the userspace?
>>
>> See patch 2/3 in this series. We use this constants in kvmtool, so it's
>> preferred to not duplicate code if possible.

On Sun, 18 Dec 2011, Jean-Christophe PLAGNIOL-VILLARD wrote:
> why do you need it?

It's for RTC emulation code in the KVM tool. For the patch:

Acked-by: Pekka Enberg <penberg@kernel.org>

Given that the RTC maintainers are extremely unresponsive, I'm CC'ing 
Andrew too.

 			Pekka
Jean-Christophe PLAGNIOL-VILLARD - Dec. 20, 2011, 2:27 p.m.
On 16:42 Sun 18 Dec     , Cyrill Gorcunov wrote:
> On Sun, Dec 18, 2011 at 01:10:08PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > > Just a ping to RTC maintainers. Any comments on the patch? can it go in?
> > > > 
> > > > why do you need such ocde in the userspace?
> > > 
> > > See patch 2/3 in this series. We use this constants in kvmtool, so it's
> > > preferred to not duplicate code if possible.
> >
> > why do you need it?
> > 
> 
> Already replied in previous mail.
still not clear why you do not use the RTC API

sorry this need to be more clear

Best Regards,
J.
Cyrill Gorcunov - Dec. 20, 2011, 2:36 p.m.
On Tue, Dec 20, 2011 at 03:27:39PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > 
> > Already replied in previous mail.
>
> still not clear why you do not use the RTC API
> sorry this need to be more clear
> 

Jean, I might be missing somethig, which API you mean?
Since we emulate RTC functions we need those constants
in user-space app so having them just in some common
header (in this case -- kernel header) would be pretty
convenient -- we would simply grab them and would not
duplicate code (by having our own header with the same
constants). Sounds good?

	Cyrill

Patch

diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h
index 2f4e957..49d93ff 100644
--- a/include/linux/mc146818rtc.h
+++ b/include/linux/mc146818rtc.h
@@ -11,11 +11,10 @@ 
 #ifndef _MC146818RTC_H
 #define _MC146818RTC_H
 
+#ifdef __KERNEL__
 #include <asm/io.h>
 #include <linux/rtc.h>			/* get the user-level API */
 #include <asm/mc146818rtc.h>		/* register access macros */
-
-#ifdef __KERNEL__
 #include <linux/spinlock.h>		/* spinlock_t */
 extern spinlock_t rtc_lock;		/* serialize CMOS RAM access */