All of lore.kernel.org
 help / color / mirror / Atom feed
* Locking in the (now generic) GPIO infrastructure?
@ 2008-06-04 11:00 Leon Woestenberg
  2008-06-06  8:52 ` Russell King - ARM Linux
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Leon Woestenberg @ 2008-06-04 11:00 UTC (permalink / raw)
  To: LAK, Linux Kernel list

Hello,

compare void gpio_line_set() in

arch/arm/plat-iop/gpio.c:
void gpio_line_set(int line, int value)
{
	unsigned long flags;

	local_irq_save(flags);
	if (value == GPIO_LOW) {
		*IOP3XX_GPOD &= ~(1 << line);
	} else if (value == GPIO_HIGH) {
		*IOP3XX_GPOD |= 1 << line;
	}
	local_irq_restore(flags);
}

with

include/asm-arm/arch-ixp4xx/platform.h:
static inline void gpio_line_set(u8 line, int value)
{
	if (value == IXP4XX_GPIO_HIGH)
	    *IXP4XX_GPIO_GPOUTR |= (1 << line);
	else if (value == IXP4XX_GPIO_LOW)
	    *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
}

Under a Linux kernel where multiple drivers are accessing GPIO, the
latter does not seem safe against preemption (assuming the memory
read-modify-write is not atomic).

Shouldn't GPIO access be protected against concurrent access here?

Documentation/gpio.txt does not really mention the locking mechanism
assumed to modify GPIO lines.

And I think I am running into an issue with this under -rt kernels,
but that needs more analysis from my side.

Regards,
-- 
Leon

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-06-07 11:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-04 11:00 Locking in the (now generic) GPIO infrastructure? Leon Woestenberg
2008-06-06  8:52 ` Russell King - ARM Linux
2008-06-06 10:28 ` Ben Dooks
2008-06-06 12:53 ` David Brownell
2008-06-06 19:23   ` Leon Woestenberg
2008-06-06 20:13     ` David Brownell
2008-06-07 11:52   ` Mikael Pettersson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.