Skip to contentSkip to conversation

Big problems in acpi/event.c (needs seq_printf?)

PATCH Pavel Machek 1 participant 1 message Apr 19, 2004 ACPI

lore
Share & tools
lore
#0 lore raw

Hi!

acpi/event.c needs some heavy facelifting.

This one is needed so that return value (ERESTARTSYS) is propagated from bus_receive_event(). If this is not done, suspend/resume causes cat /proc/acpi/event to fail with -EIO. Please apply.

However, there are more problems with event.c:

* it uses spinlock_irq to protect event_is_open(). That's huge overkill, atomic_t should be enough here, and it is never accessed from interrupt anyway.

* its racy w.r.t. concurent readers (and yes, you *can* have concurent readers, think threads). acpi_system_read_event() uses static variables, without any locking. Probably seq_printf() converstion is needed.
Pavel

drivers/acpi/event.c +2 -3
@@ -63,9 +58,8 @@
 			return_VALUE(-EAGAIN);
 
 		result = acpi_bus_receive_event(&event);
-		if (result) {
-			return_VALUE(-EIO);
-		}
+		if (result)
+			return_VALUE(result);
 
 		chars_remaining = sprintf(str, "%s %s %08x %08x\n", 
 			event.device_class?event.device_class:"<unknown>",
Signature · 9 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click