Re: Locking in the clk API

From: Russell King - ARM Linux
Date: Thu Jan 27 2011 - 16:12:29 EST

On Thu, Jan 27, 2011 at 09:07:29PM +0000, Alan Cox wrote:
> > > For internal tree purposes, does .set_termios need to be atomic? Can it
> > > grab mutexes instead of spinlock?
> >
> > I think I already answered that question above where I said "protect
> > against the interrupt handler accessing the port->* stuff".
> I'm not sure you answered it correctly however as the locking nowdays is
> a bit different.
> Architecturally the termios handling doesn't need a spin lock nor is it
> called under one. In fact it's vital this is the case because of USB.

It needs to protect against the read_status_mask and ignore_status_mask
being read half-way through an update by the interrupt handler, otherwise
you can end up with god-knows-what coming through from each termios

Eg, you could see an effective CREAD flip when the state of CREAD wasn't
actually changed.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at