Re: [PATCH 09/13] SPEAr: clk: Add Auxiliary Synthesizer clock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On Tuesday 17 April 2012, Sascha Hauer wrote:
> > +{
> > +     struct clk_aux *aux = to_clk_aux(hw);
> > +     unsigned int num = 1, den = 1, val, eqn;
> > +     unsigned long flags = 0;
> > +
> > +     if (aux->lock)
> > +             spin_lock_irqsave(aux->lock, flags);
> > +
> > +     val = readl_relaxed(aux->reg);
> > +
> > +     if (aux->lock)
> > +             spin_unlock_irqrestore(aux->lock, flags);
> > +
> 
> A single read is atomic and needs no lock.

That depends on whether the read has any side-effects. There
is another function that does a read-modify-write on the
same register, and you might need to prevent this one from
reading the register between the other read and the following
write.

The spinlock also has the benefit of enforcing the ordering
of the read with regard to your instruction stream, otherwise
it can be delayed on out-of-order CPUs until the value
is actually used.

	Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel


[Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [PDAs]     [Linux]     [Linux MIPS]     [Yosemite Campsites]     [Photos]

Add to Google Follow linuxarm on Twitter