Message ID | 1312364089-32380-8-git-send-email-bryan.wu@canonical.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hello. On 03-08-2011 13:34, Bryan Wu wrote: > Signed-off-by: Bryan Wu<bryan.wu@canonical.com> > --- > arch/arm/mach-integrator/core.c | 17 +++++++++++++++++ > arch/arm/mach-integrator/include/mach/cm.h | 1 + > 2 files changed, 18 insertions(+), 0 deletions(-) > diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c > index 77315b9..0ee6af6 100644 > --- a/arch/arm/mach-integrator/core.c > +++ b/arch/arm/mach-integrator/core.c > @@ -225,6 +225,23 @@ void cm_control(u32 mask, u32 set) > > EXPORT_SYMBOL(cm_control); > > +/** > + * cm_read - read the CM_CTRL register. > + */ > +u32 cm_read(void) > +{ > + unsigned long flags; > + u32 val = 0; > + > + spin_lock_irqsave(&cm_lock, flags); > + val = readl(CM_CTRL); > + spin_unlock_irqrestore(&cm_lock, flags); What's the point of locking around already atomic read? WBR, Sergei
Hello. On 03-08-2011 13:34, Bryan Wu wrote: > Signed-off-by: Bryan Wu<bryan.wu@canonical.com> > --- > arch/arm/mach-integrator/core.c | 17 +++++++++++++++++ > arch/arm/mach-integrator/include/mach/cm.h | 1 + > 2 files changed, 18 insertions(+), 0 deletions(-) > diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c > index 77315b9..0ee6af6 100644 > --- a/arch/arm/mach-integrator/core.c > +++ b/arch/arm/mach-integrator/core.c > @@ -225,6 +225,23 @@ void cm_control(u32 mask, u32 set) > > EXPORT_SYMBOL(cm_control); > > +/** > + * cm_read - read the CM_CTRL register. > + */ > +u32 cm_read(void) > +{ > + unsigned long flags; > + u32 val = 0; Intialization not needed. > + > + spin_lock_irqsave(&cm_lock, flags); > + val = readl(CM_CTRL); > + spin_unlock_irqrestore(&cm_lock, flags); > + > + return val; > +} > + > +EXPORT_SYMBOL(cm_read); > + > /* > * We need to stop things allocating the low memory; ideally we need a > * better implementation of GFP_DMA which does not assume that DMA-able WBR, Sergei
On Wed, Aug 3, 2011 at 7:29 PM, Sergei Shtylyov <sshtylyov@mvista.com> wrote: > Hello. > > On 03-08-2011 13:34, Bryan Wu wrote: > >> Signed-off-by: Bryan Wu<bryan.wu@canonical.com> >> --- >> arch/arm/mach-integrator/core.c | 17 +++++++++++++++++ >> arch/arm/mach-integrator/include/mach/cm.h | 1 + >> 2 files changed, 18 insertions(+), 0 deletions(-) > >> diff --git a/arch/arm/mach-integrator/core.c >> b/arch/arm/mach-integrator/core.c >> index 77315b9..0ee6af6 100644 >> --- a/arch/arm/mach-integrator/core.c >> +++ b/arch/arm/mach-integrator/core.c >> @@ -225,6 +225,23 @@ void cm_control(u32 mask, u32 set) >> >> EXPORT_SYMBOL(cm_control); >> >> +/** >> + * cm_read - read the CM_CTRL register. >> + */ >> +u32 cm_read(void) >> +{ >> + unsigned long flags; >> + u32 val = 0; >> + >> + spin_lock_irqsave(&cm_lock, flags); >> + val = readl(CM_CTRL); >> + spin_unlock_irqrestore(&cm_lock, flags); > > What's the point of locking around already atomic read? > Actually, I'm not sure about whether we need special operation on CM_CTRL register. So I followed the cm_control() function style. Yeah, if it is just a common register, it's quite convenient for me to read it in leds drivers. Thanks a lot,
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c index 77315b9..0ee6af6 100644 --- a/arch/arm/mach-integrator/core.c +++ b/arch/arm/mach-integrator/core.c @@ -225,6 +225,23 @@ void cm_control(u32 mask, u32 set) EXPORT_SYMBOL(cm_control); +/** + * cm_read - read the CM_CTRL register. + */ +u32 cm_read(void) +{ + unsigned long flags; + u32 val = 0; + + spin_lock_irqsave(&cm_lock, flags); + val = readl(CM_CTRL); + spin_unlock_irqrestore(&cm_lock, flags); + + return val; +} + +EXPORT_SYMBOL(cm_read); + /* * We need to stop things allocating the low memory; ideally we need a * better implementation of GFP_DMA which does not assume that DMA-able diff --git a/arch/arm/mach-integrator/include/mach/cm.h b/arch/arm/mach-integrator/include/mach/cm.h index 445d57a..3731508 100644 --- a/arch/arm/mach-integrator/include/mach/cm.h +++ b/arch/arm/mach-integrator/include/mach/cm.h @@ -2,6 +2,7 @@ * update the core module control register. */ void cm_control(u32, u32); +u32 cm_read(void); #define CM_CTRL_LED (1 << 0) #define CM_CTRL_nMBDET (1 << 1)
Signed-off-by: Bryan Wu <bryan.wu@canonical.com> --- arch/arm/mach-integrator/core.c | 17 +++++++++++++++++ arch/arm/mach-integrator/include/mach/cm.h | 1 + 2 files changed, 18 insertions(+), 0 deletions(-)