Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 2935
Collapse All | Expand All

(-)drivers/acpi/acpi_system.c.orig (-23 / +27 lines)
Lines 415-454 Link Here
415
	loff_t			*ppos)
415
	loff_t			*ppos)
416
{
416
{
417
	int			result = 0;
417
	int			result = 0;
418
	char			outbuf[ACPI_MAX_STRING];
419
	int			size = 0;
420
	struct acpi_bus_event	event;
418
	struct acpi_bus_event	event;
419
	static char		str[ACPI_MAX_STRING];
420
	static int		chars_remaining = 0;
421
	static char		*ptr;
421
422
422
	ACPI_FUNCTION_TRACE("acpi_system_read_event");
423
	ACPI_FUNCTION_TRACE("acpi_system_read_event");
423
424
424
	memset(&event, 0, sizeof(struct acpi_bus_event));
425
	if (!chars_remaining) {
426
		memset(&event, 0, sizeof(struct acpi_bus_event));
425
427
426
	if (count < ACPI_MAX_STRING)
428
		if ((file->f_flags & O_NONBLOCK)
427
		goto end;
429
		    && (list_empty(&acpi_bus_event_list)))
428
430
			return_VALUE(-EAGAIN);
429
	if ((file->f_flags & O_NONBLOCK)
431
430
	    && (list_empty(&acpi_bus_event_list)))
432
		result = acpi_bus_receive_event(&event);
431
		return_VALUE(-EAGAIN);
433
		if (0 != result) {
432
434
			return_VALUE(-EIO);
433
	result = acpi_bus_receive_event(&event);
435
		}
434
	if (0 != result) {
436
435
		size = sprintf(outbuf, "error\n");
437
		chars_remaining = sprintf(str, "%s %s %08x %08x\n", 
436
		goto end;
438
			event.device_class?event.device_class:"<unknown>",
439
			event.bus_id?event.bus_id:"<unknown>", 
440
			event.type, event.data);
441
		ptr = str;
437
	}
442
	}
438
443
439
	size = sprintf(outbuf, "%s %s %08x %08x\n", 
444
	if (chars_remaining < count) {
440
		event.device_class?event.device_class:"<unknown>",
445
		count = chars_remaining;
441
		event.bus_id?event.bus_id:"<unknown>", 
446
	}
442
		event.type, 
443
		event.data);
444
447
445
end:
448
	if (copy_to_user(buffer, ptr, count))
446
	if (copy_to_user(buffer, outbuf, size))
447
		return_VALUE(-EFAULT);
449
		return_VALUE(-EFAULT);
448
450
449
	*ppos += size;
451
	*ppos += count;
452
	chars_remaining -= count;
453
	ptr += count;
450
454
451
	return_VALUE(size);
455
	return_VALUE(count);
452
}
456
}
453
457
454
static int
458
static int

Return to bug 2935