Skip to content

Commit

Permalink
Pull events into release branch
Browse files Browse the repository at this point in the history
Conflicts:

	drivers/acpi/video.c

Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Len Brown committed Aug 25, 2007
2 parents a4fd494 + 3e069ee commit 25c87f7
Show file tree
Hide file tree
Showing 18 changed files with 123 additions and 50 deletions.
8 changes: 8 additions & 0 deletions Documentation/feature-removal-schedule.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ Who: Len Brown <len.brown@intel.com>

---------------------------

What: /proc/acpi/event
When: February 2008
Why: /proc/acpi/event has been replaced by events via the input layer
and netlink since 2.6.23.
Who: Len Brown <len.brown@intel.com>

---------------------------

What: Compaq touchscreen device emulation
When: Oct 2007
Files: drivers/input/tsdev.c
Expand Down
14 changes: 14 additions & 0 deletions drivers/acpi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ config ACPI_PROCFS

Say N to delete /proc/acpi/ files that have moved to /sys/

config ACPI_PROC_EVENT
bool "Deprecated /proc/acpi/event support"
depends on PROC_FS
---help---
A user-space daemon, acpi, typically read /proc/acpi/event
and handled all ACPI sub-system generated events.

These events are now delivered to user-space via
either the input layer, or as netlink events.

This build option enables the old code for for legacy
user-space implementation. After some time, this will
be moved under CONFIG_ACPI_PROCFS, and then deleted.

config ACPI_AC
tristate "AC Adapter"
depends on X86
Expand Down
5 changes: 4 additions & 1 deletion drivers/acpi/ac.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
case ACPI_NOTIFY_BUS_CHECK:
case ACPI_NOTIFY_DEVICE_CHECK:
acpi_ac_get_state(ac);
acpi_bus_generate_event(device, event, (u32) ac->state);
acpi_bus_generate_proc_event(device, event, (u32) ac->state);
acpi_bus_generate_netlink_event(device->pnp.device_class,
device->dev.bus_id, event,
(u32) ac->state);
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/asus_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
hotk->brightness = (event & ~((u32) BR_DOWN));
}

acpi_bus_generate_event(hotk->device, event,
acpi_bus_generate_proc_event(hotk->device, event,
hotk->event_count[event % 128]++);

return;
Expand Down
5 changes: 4 additions & 1 deletion drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,8 +872,11 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
case ACPI_NOTIFY_DEVICE_CHECK:
device = battery->device;
acpi_battery_notify_update(battery);
acpi_bus_generate_event(device, event,
acpi_bus_generate_proc_event(device, event,
acpi_battery_present(battery));
acpi_bus_generate_netlink_event(device->pnp.device_class,
device->dev.bus_id, event,
acpi_battery_present(battery));
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
Expand Down
10 changes: 4 additions & 6 deletions drivers/acpi/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,15 @@ EXPORT_SYMBOL(acpi_bus_set_power);
Event Management
-------------------------------------------------------------------------- */

#ifdef CONFIG_ACPI_PROC_EVENT
static DEFINE_SPINLOCK(acpi_bus_event_lock);

LIST_HEAD(acpi_bus_event_list);
DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);

extern int event_is_open;

int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
{
struct acpi_bus_event *event = NULL;
unsigned long flags = 0;
Expand All @@ -292,10 +293,6 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
if (!device)
return -EINVAL;

if (acpi_bus_generate_genetlink_event(device, type, data))
printk(KERN_WARNING PREFIX
"Failed to generate an ACPI event via genetlink!\n");

/* drop event on the floor if no one's listening */
if (!event_is_open)
return 0;
Expand All @@ -318,7 +315,7 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
return 0;
}

EXPORT_SYMBOL(acpi_bus_generate_event);
EXPORT_SYMBOL(acpi_bus_generate_proc_event);

int acpi_bus_receive_event(struct acpi_bus_event *event)
{
Expand Down Expand Up @@ -364,6 +361,7 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
}

EXPORT_SYMBOL(acpi_bus_receive_event);
#endif /* CONFIG_ACPI_PROC_EVENT */

/* --------------------------------------------------------------------------
Notification Handling
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/button.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
}
input_sync(input);

acpi_bus_generate_event(button->device, event,
acpi_bus_generate_proc_event(button->device, event,
++button->pushed);
break;
default:
Expand Down
22 changes: 17 additions & 5 deletions drivers/acpi/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define _COMPONENT ACPI_SYSTEM_COMPONENT
ACPI_MODULE_NAME("event");

#ifdef CONFIG_ACPI_PROC_EVENT
/* Global vars for handling event proc entry */
static DEFINE_SPINLOCK(acpi_system_event_lock);
int event_is_open = 0;
Expand Down Expand Up @@ -106,6 +107,7 @@ static const struct file_operations acpi_system_event_ops = {
.release = acpi_system_close_event,
.poll = acpi_system_poll_event,
};
#endif /* CONFIG_ACPI_PROC_EVENT */

#ifdef CONFIG_NET
static unsigned int acpi_event_seqnum;
Expand Down Expand Up @@ -147,7 +149,8 @@ static struct genl_multicast_group acpi_event_mcgrp = {
.name = ACPI_GENL_MCAST_GROUP_NAME,
};

int acpi_bus_generate_genetlink_event(struct acpi_device *device,
int acpi_bus_generate_netlink_event(const char *device_class,
const char *bus_id,
u8 type, int data)
{
struct sk_buff *skb;
Expand Down Expand Up @@ -191,8 +194,8 @@ int acpi_bus_generate_genetlink_event(struct acpi_device *device,

memset(event, 0, sizeof(struct acpi_genl_event));

strcpy(event->device_class, device->pnp.device_class);
strcpy(event->bus_id, device->dev.bus_id);
strcpy(event->device_class, device_class);
strcpy(event->bus_id, bus_id);
event->type = type;
event->data = data;

Expand All @@ -211,6 +214,8 @@ int acpi_bus_generate_genetlink_event(struct acpi_device *device,
return 0;
}

EXPORT_SYMBOL(acpi_bus_generate_netlink_event);

static int acpi_event_genetlink_init(void)
{
int result;
Expand All @@ -228,12 +233,15 @@ static int acpi_event_genetlink_init(void)
}

#else
int acpi_bus_generate_genetlink_event(struct acpi_device *device, u8 type,
int data)
int acpi_bus_generate_netlink_event(const char *device_class,
const char *bus_id,
u8 type, int data)
{
return 0;
}

EXPORT_SYMBOL(acpi_generate_netlink_event);

static int acpi_event_genetlink_init(void)
{
return -ENODEV;
Expand All @@ -242,7 +250,9 @@ static int acpi_event_genetlink_init(void)

static int __init acpi_event_init(void)
{
#ifdef CONFIG_ACPI_PROC_EVENT
struct proc_dir_entry *entry;
#endif
int error = 0;

if (acpi_disabled)
Expand All @@ -254,12 +264,14 @@ static int __init acpi_event_init(void)
printk(KERN_WARNING PREFIX
"Failed to create genetlink family for ACPI event\n");

#ifdef CONFIG_ACPI_PROC_EVENT
/* 'event' [R] */
entry = create_proc_entry("event", S_IRUSR, acpi_root_dir);
if (entry)
entry->proc_fops = &acpi_system_event_ops;
else
return -ENODEV;
#endif

return 0;
}
Expand Down
13 changes: 10 additions & 3 deletions drivers/acpi/processor_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,16 +698,23 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
switch (event) {
case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
acpi_processor_ppc_has_changed(pr);
acpi_bus_generate_event(device, event,
acpi_bus_generate_proc_event(device, event,
pr->performance_platform_limit);
acpi_bus_generate_netlink_event(device->pnp.device_class,
device->dev.bus_id, event,
pr->performance_platform_limit);
break;
case ACPI_PROCESSOR_NOTIFY_POWER:
acpi_processor_cst_has_changed(pr);
acpi_bus_generate_event(device, event, 0);
acpi_bus_generate_proc_event(device, event, 0);
acpi_bus_generate_netlink_event(device->pnp.device_class,
device->dev.bus_id, event, 0);
break;
case ACPI_PROCESSOR_NOTIFY_THROTTLING:
acpi_processor_tstate_has_changed(pr);
acpi_bus_generate_event(device, event, 0);
acpi_bus_generate_proc_event(device, event, 0);
acpi_bus_generate_netlink_event(device->pnp.device_class,
device->dev.bus_id, event, 0);
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Unsupported event [0x%x]\n", event));
Expand Down
3 changes: 2 additions & 1 deletion drivers/acpi/sbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,12 @@ static int acpi_sbs_generate_event(struct acpi_device *device,
strcpy(acpi_device_bid(device), bid);
strcpy(acpi_device_class(device), class);

result = acpi_bus_generate_event(device, event, state);
result = acpi_bus_generate_proc_event(device, event, state);

strcpy(acpi_device_bid(device), bid_saved);
strcpy(acpi_device_class(device), class_saved);

acpi_bus_generate_netlink_event(class, bid, event, state);
return result;
}

Expand Down
20 changes: 16 additions & 4 deletions drivers/acpi/thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,12 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
printk(KERN_EMERG
"Critical temperature reached (%ld C), shutting down.\n",
KELVIN_TO_CELSIUS(tz->temperature));
acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL,
acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL,
tz->trips.critical.flags.enabled);
acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
tz->device->dev.bus_id,
ACPI_THERMAL_NOTIFY_CRITICAL,
tz->trips.critical.flags.enabled);

orderly_poweroff(true);

Expand All @@ -522,8 +526,12 @@ static int acpi_thermal_hot(struct acpi_thermal *tz)
} else if (tz->trips.hot.flags.enabled)
tz->trips.hot.flags.enabled = 0;

acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_HOT,
acpi_bus_generate_proc_event(tz->device, ACPI_THERMAL_NOTIFY_HOT,
tz->trips.hot.flags.enabled);
acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
tz->device->dev.bus_id,
ACPI_THERMAL_NOTIFY_HOT,
tz->trips.hot.flags.enabled);

/* TBD: Call user-mode "sleep(S4)" function */

Expand Down Expand Up @@ -1167,12 +1175,16 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
case ACPI_THERMAL_NOTIFY_THRESHOLDS:
acpi_thermal_get_trip_points(tz);
acpi_thermal_check(tz);
acpi_bus_generate_event(device, event, 0);
acpi_bus_generate_proc_event(device, event, 0);
acpi_bus_generate_netlink_event(device->pnp.device_class,
device->dev.bus_id, event, 0);
break;
case ACPI_THERMAL_NOTIFY_DEVICES:
if (tz->flags.devices)
acpi_thermal_get_devices(tz);
acpi_bus_generate_event(device, event, 0);
acpi_bus_generate_proc_event(device, event, 0);
acpi_bus_generate_netlink_event(device->pnp.device_class,
device->dev.bus_id, event, 0);
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
Expand Down
20 changes: 10 additions & 10 deletions drivers/acpi/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
switch (event) {
case ACPI_VIDEO_NOTIFY_SWITCH: /* User requested a switch,
* most likely via hotkey. */
acpi_bus_generate_event(device, event, 0);
acpi_bus_generate_proc_event(device, event, 0);
keycode = KEY_SWITCHVIDEOMODE;
break;

Expand All @@ -1790,23 +1790,23 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
acpi_video_device_enumerate(video);
acpi_video_device_rebind(video);
acpi_video_switch_output(video, event);
acpi_bus_generate_event(device, event, 0);
acpi_bus_generate_proc_event(device, event, 0);
keycode = KEY_SWITCHVIDEOMODE;
break;

case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed. */
acpi_video_switch_output(video, event);
acpi_bus_generate_event(device, event, 0);
acpi_bus_generate_proc_event(device, event, 0);
keycode = KEY_SWITCHVIDEOMODE;
break;
case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */
acpi_video_switch_output(video, event);
acpi_bus_generate_event(device, event, 0);
acpi_bus_generate_proc_event(device, event, 0);
keycode = KEY_VIDEO_NEXT;
break;
case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */
acpi_video_switch_output(video, event);
acpi_bus_generate_event(device, event, 0);
acpi_bus_generate_proc_event(device, event, 0);
keycode = KEY_VIDEO_PREV;
break;

Expand Down Expand Up @@ -1843,27 +1843,27 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
switch (event) {
case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */
acpi_video_switch_brightness(video_device, event);
acpi_bus_generate_event(device, event, 0);
acpi_bus_generate_proc_event(device, event, 0);
keycode = KEY_BRIGHTNESS_CYCLE;
break;
case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */
acpi_video_switch_brightness(video_device, event);
acpi_bus_generate_event(device, event, 0);
acpi_bus_generate_proc_event(device, event, 0);
keycode = KEY_BRIGHTNESSUP;
break;
case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */
acpi_video_switch_brightness(video_device, event);
acpi_bus_generate_event(device, event, 0);
acpi_bus_generate_proc_event(device, event, 0);
keycode = KEY_BRIGHTNESSDOWN;
break;
case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */
acpi_video_switch_brightness(video_device, event);
acpi_bus_generate_event(device, event, 0);
acpi_bus_generate_proc_event(device, event, 0);
keycode = KEY_BRIGHTNESS_ZERO;
break;
case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */
acpi_video_switch_brightness(video_device, event);
acpi_bus_generate_event(device, event, 0);
acpi_bus_generate_proc_event(device, event, 0);
keycode = KEY_DISPLAY_OFF;
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/sonypi.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ static irqreturn_t sonypi_irq(int irq, void *dev_id)

#ifdef CONFIG_ACPI
if (sonypi_acpi_device)
acpi_bus_generate_event(sonypi_acpi_device, 1, event);
acpi_bus_generate_proc_event(sonypi_acpi_device, 1, event);
#endif

kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event));
Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/asus-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
lcd_blank(FB_BLANK_POWERDOWN);
}

acpi_bus_generate_event(hotk->device, event,
acpi_bus_generate_proc_event(hotk->device, event,
hotk->event_count[event % 128]++);

return;
Expand Down
Loading

0 comments on commit 25c87f7

Please sign in to comment.