Skip to content

Commit

Permalink
ACPI: Remove the old /proc/acpi/event interface
Browse files Browse the repository at this point in the history
It is quite some time that this one has been deprecated.
Get rid of it.

Should some really important user be overseen, it may be reverted and
the userspace program worked on first, but it is time to do something
to get rid of this old stuff...

Signed-off-by: Thomas Renninger <trenn@suse.de>
Acked-by: Matthew Garrett <matthew.garrett@nebula.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
watologo1 authored and rafaeljw committed Jul 15, 2013
1 parent ad81f05 commit 1696d9d
Show file tree
Hide file tree
Showing 22 changed files with 10 additions and 305 deletions.
8 changes: 4 additions & 4 deletions Documentation/laptops/asus-laptop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ http://acpi4asus.sf.net/

This driver provides support for extra features of ACPI-compatible ASUS laptops.
It may also support some MEDION, JVC or VICTOR laptops (such as MEDION 9675 or
VICTOR XP7210 for example). It makes all the extra buttons generate standard
ACPI events that go through /proc/acpi/events and input events (like keyboards).
VICTOR XP7210 for example). It makes all the extra buttons generate input
events (like keyboards).
On some models adds support for changing the display brightness and output,
switching the LCD backlight on and off, and most importantly, allows you to
blink those fancy LEDs intended for reporting mail and wireless status.
Expand Down Expand Up @@ -55,8 +55,8 @@ Usage
DSDT) to me.

That's all, now, all the events generated by the hotkeys of your laptop
should be reported in your /proc/acpi/event entry. You can check with
"acpi_listen".
should be reported via netlink events. You can check with
"acpi_genl monitor" (part of the acpica project).

Hotkeys are also reported as input keys (like keyboards) you can check
which key are supported using "xev" under X11.
Expand Down
8 changes: 4 additions & 4 deletions Documentation/laptops/sony-laptop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Fn keys (hotkeys):
------------------
Some models report hotkeys through the SNC or SPIC devices, such events are
reported both through the ACPI subsystem as acpi events and through the INPUT
subsystem. See the logs of acpid or /proc/acpi/event and
/proc/bus/input/devices to find out what those events are and which input
devices are created by the driver. Additionally, loading the driver with the
debug option will report all events in the kernel log.
subsystem. See the logs of /proc/bus/input/devices to find out what those
events are and which input devices are created by the driver.
Additionally, loading the driver with the debug option will report all events
in the kernel log.

The "scancodes" passed to the input system (that can be remapped with udev)
are indexes to the table "sony_laptop_input_keycode_map" in the sony-laptop.c
Expand Down
18 changes: 0 additions & 18 deletions drivers/acpi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,6 @@ config ACPI_EC_DEBUGFS
Thus this option is a debug option that helps to write ACPI drivers
and can be used to identify ACPI code or EC firmware bugs.

config ACPI_PROC_EVENT
bool "Deprecated /proc/acpi/event support"
depends on PROC_FS
default y
help
A user-space daemon, acpid, typically reads /proc/acpi/event
and handles all ACPI-generated events.

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

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

Say Y here to retain the old behaviour. Say N if your
user-space is newer than kernel 2.6.23 (September 2007).

config ACPI_AC
tristate "AC Adapter"
depends on X86
Expand Down
1 change: 0 additions & 1 deletion drivers/acpi/ac.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event)
msleep(ac_sleep_before_get_state_ms);

acpi_ac_get_state(ac);
acpi_bus_generate_proc_event(device, event, (u32) ac->state);
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event,
(u32) ac->state);
Expand Down
1 change: 0 additions & 1 deletion drivers/acpi/acpi_pad.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ static void acpi_pad_notify(acpi_handle handle, u32 event,
switch (event) {
case ACPI_PROCESSOR_AGGREGATOR_NOTIFY:
acpi_pad_handle_notify(handle);
acpi_bus_generate_proc_event(device, event, 0);
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event, 0);
break;
Expand Down
2 changes: 0 additions & 2 deletions drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,8 +1034,6 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event)
if (event == ACPI_BATTERY_NOTIFY_INFO)
acpi_battery_refresh(battery);
acpi_battery_update(battery);
acpi_bus_generate_proc_event(device, event,
acpi_battery_present(battery));
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event,
acpi_battery_present(battery));
Expand Down
98 changes: 0 additions & 98 deletions drivers/acpi/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,104 +345,6 @@ static void acpi_bus_osc_support(void)
/* do we need to check other returned cap? Sounds no */
}

/* --------------------------------------------------------------------------
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_proc_event4(const char *device_class, const char *bus_id, u8 type, int data)
{
struct acpi_bus_event *event;
unsigned long flags;

/* drop event on the floor if no one's listening */
if (!event_is_open)
return 0;

event = kzalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC);
if (!event)
return -ENOMEM;

strcpy(event->device_class, device_class);
strcpy(event->bus_id, bus_id);
event->type = type;
event->data = data;

spin_lock_irqsave(&acpi_bus_event_lock, flags);
list_add_tail(&event->node, &acpi_bus_event_list);
spin_unlock_irqrestore(&acpi_bus_event_lock, flags);

wake_up_interruptible(&acpi_bus_event_queue);

return 0;

}

EXPORT_SYMBOL_GPL(acpi_bus_generate_proc_event4);

int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
{
if (!device)
return -EINVAL;
return acpi_bus_generate_proc_event4(device->pnp.device_class,
device->pnp.bus_id, type, data);
}

EXPORT_SYMBOL(acpi_bus_generate_proc_event);

int acpi_bus_receive_event(struct acpi_bus_event *event)
{
unsigned long flags;
struct acpi_bus_event *entry = NULL;

DECLARE_WAITQUEUE(wait, current);


if (!event)
return -EINVAL;

if (list_empty(&acpi_bus_event_list)) {

set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&acpi_bus_event_queue, &wait);

if (list_empty(&acpi_bus_event_list))
schedule();

remove_wait_queue(&acpi_bus_event_queue, &wait);
set_current_state(TASK_RUNNING);

if (signal_pending(current))
return -ERESTARTSYS;
}

spin_lock_irqsave(&acpi_bus_event_lock, flags);
if (!list_empty(&acpi_bus_event_list)) {
entry = list_entry(acpi_bus_event_list.next,
struct acpi_bus_event, node);
list_del(&entry->node);
}
spin_unlock_irqrestore(&acpi_bus_event_lock, flags);

if (!entry)
return -ENODEV;

memcpy(event, entry, sizeof(struct acpi_bus_event));

kfree(entry);

return 0;
}

#endif /* CONFIG_ACPI_PROC_EVENT */

/* --------------------------------------------------------------------------
Notification Handling
-------------------------------------------------------------------------- */
Expand Down
2 changes: 0 additions & 2 deletions drivers/acpi/button.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)

pm_wakeup_event(&device->dev, 0);
}

acpi_bus_generate_proc_event(device, event, ++button->pushed);
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
Expand Down
106 changes: 0 additions & 106 deletions drivers/acpi/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,100 +21,6 @@
#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;
extern struct list_head acpi_bus_event_list;
extern wait_queue_head_t acpi_bus_event_queue;

static int acpi_system_open_event(struct inode *inode, struct file *file)
{
spin_lock_irq(&acpi_system_event_lock);

if (event_is_open)
goto out_busy;

event_is_open = 1;

spin_unlock_irq(&acpi_system_event_lock);
return 0;

out_busy:
spin_unlock_irq(&acpi_system_event_lock);
return -EBUSY;
}

static ssize_t
acpi_system_read_event(struct file *file, char __user * buffer, size_t count,
loff_t * ppos)
{
int result = 0;
struct acpi_bus_event event;
static char str[ACPI_MAX_STRING];
static int chars_remaining = 0;
static char *ptr;

if (!chars_remaining) {
memset(&event, 0, sizeof(struct acpi_bus_event));

if ((file->f_flags & O_NONBLOCK)
&& (list_empty(&acpi_bus_event_list)))
return -EAGAIN;

result = acpi_bus_receive_event(&event);
if (result)
return result;

chars_remaining = sprintf(str, "%s %s %08x %08x\n",
event.device_class ? event.
device_class : "<unknown>",
event.bus_id ? event.
bus_id : "<unknown>", event.type,
event.data);
ptr = str;
}

if (chars_remaining < count) {
count = chars_remaining;
}

if (copy_to_user(buffer, ptr, count))
return -EFAULT;

*ppos += count;
chars_remaining -= count;
ptr += count;

return count;
}

static int acpi_system_close_event(struct inode *inode, struct file *file)
{
spin_lock_irq(&acpi_system_event_lock);
event_is_open = 0;
spin_unlock_irq(&acpi_system_event_lock);
return 0;
}

static unsigned int acpi_system_poll_event(struct file *file, poll_table * wait)
{
poll_wait(file, &acpi_bus_event_queue, wait);
if (!list_empty(&acpi_bus_event_list))
return POLLIN | POLLRDNORM;
return 0;
}

static const struct file_operations acpi_system_event_ops = {
.owner = THIS_MODULE,
.open = acpi_system_open_event,
.read = acpi_system_read_event,
.release = acpi_system_close_event,
.poll = acpi_system_poll_event,
.llseek = default_llseek,
};
#endif /* CONFIG_ACPI_PROC_EVENT */

/* ACPI notifier chain */
static BLOCKING_NOTIFIER_HEAD(acpi_chain_head);

Expand Down Expand Up @@ -280,9 +186,6 @@ 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 @@ -293,15 +196,6 @@ static int __init acpi_event_init(void)
if (error)
printk(KERN_WARNING PREFIX
"Failed to create genetlink family for ACPI event\n");

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

return 0;
}

Expand Down
4 changes: 0 additions & 4 deletions drivers/acpi/processor_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,17 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
acpi_processor_ppc_has_changed(pr, 1);
if (saved == pr->performance_platform_limit)
break;
acpi_bus_generate_proc_event(device, event,
pr->performance_platform_limit);
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event,
pr->performance_platform_limit);
break;
case ACPI_PROCESSOR_NOTIFY_POWER:
acpi_processor_cst_has_changed(pr);
acpi_bus_generate_proc_event(device, event, 0);
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event, 0);
break;
case ACPI_PROCESSOR_NOTIFY_THROTTLING:
acpi_processor_tstate_has_changed(pr);
acpi_bus_generate_proc_event(device, event, 0);
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event, 0);
break;
Expand Down
15 changes: 2 additions & 13 deletions drivers/acpi/sbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -873,14 +873,9 @@ static void acpi_sbs_callback(void *context)
u8 saved_charger_state = sbs->charger_present;
u8 saved_battery_state;
acpi_ac_get_present(sbs);
if (sbs->charger_present != saved_charger_state) {
#ifdef CONFIG_ACPI_PROC_EVENT
acpi_bus_generate_proc_event4(ACPI_AC_CLASS, ACPI_AC_DIR_NAME,
ACPI_SBS_NOTIFY_STATUS,
sbs->charger_present);
#endif
if (sbs->charger_present != saved_charger_state)
kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE);
}

if (sbs->manager_present) {
for (id = 0; id < MAX_SBS_BAT; ++id) {
if (!(sbs->batteries_supported & (1 << id)))
Expand All @@ -890,12 +885,6 @@ static void acpi_sbs_callback(void *context)
acpi_battery_read(bat);
if (saved_battery_state == bat->present)
continue;
#ifdef CONFIG_ACPI_PROC_EVENT
acpi_bus_generate_proc_event4(ACPI_BATTERY_CLASS,
bat->name,
ACPI_SBS_NOTIFY_STATUS,
bat->present);
#endif
kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE);
}
}
Expand Down
Loading

0 comments on commit 1696d9d

Please sign in to comment.