]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/event.c
drivers/net/via-velocity.c: mostly kmalloc + memset conversion to kcalloc
[linux-2.6-omap-h63xx.git] / drivers / acpi / event.c
index 98627b02f5475c1556d30dfd0b8ab4cf94f95d73..5c95863f8fa9f324c0b98d88cd40f96eb16f9ead 100644 (file)
@@ -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;
@@ -106,9 +107,10 @@ 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
-unsigned int acpi_event_seqnum;
+static unsigned int acpi_event_seqnum;
 struct acpi_genl_event {
        acpi_device_class device_class;
        char bus_id[15];
@@ -132,33 +134,23 @@ enum {
 };
 #define ACPI_GENL_CMD_MAX (__ACPI_GENL_CMD_MAX - 1)
 
-#define ACPI_GENL_NAME         "acpi_event"
-#define ACPI_GENL_VERSION      0x01
+#define ACPI_GENL_FAMILY_NAME          "acpi_event"
+#define ACPI_GENL_VERSION              0x01
+#define ACPI_GENL_MCAST_GROUP_NAME     "acpi_mc_group"
 
 static struct genl_family acpi_event_genl_family = {
        .id = GENL_ID_GENERATE,
-       .name = ACPI_GENL_NAME,
+       .name = ACPI_GENL_FAMILY_NAME,
        .version = ACPI_GENL_VERSION,
        .maxattr = ACPI_GENL_ATTR_MAX,
 };
 
-/* .doit: standard command callback */
-static int acpi_genl_cmd_event(struct sk_buff *skb, struct genl_info *info)
-{
-       struct acpi_genl_event *event = info->userhdr;
-
-       if (!event)
-               ACPI_DEBUG_PRINT((ACPI_DB_WARN, "ACPI event: NULL\n"));
-
-       return 0;
-}
-
-static struct genl_ops acpi_event_genl_ops = {
-       .cmd = ACPI_GENL_CMD_EVENT,
-       .doit = acpi_genl_cmd_event,
+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;
@@ -202,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;
 
@@ -215,13 +207,14 @@ int acpi_bus_generate_genetlink_event(struct acpi_device *device,
        }
 
        result =
-           genlmsg_multicast(skb, 0, acpi_event_genl_family.id, GFP_ATOMIC);
+           genlmsg_multicast(skb, 0, acpi_event_mcgrp.id, GFP_ATOMIC);
        if (result)
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                                  "Failed to send a Genetlink message!\n"));
        return 0;
 }
-EXPORT_SYMBOL(acpi_bus_generate_genetlink_event);
+
+EXPORT_SYMBOL(acpi_bus_generate_netlink_event);
 
 static int acpi_event_genetlink_init(void)
 {
@@ -231,8 +224,8 @@ static int acpi_event_genetlink_init(void)
        if (result)
                return result;
 
-       result =
-           genl_register_ops(&acpi_event_genl_family, &acpi_event_genl_ops);
+       result = genl_register_mc_group(&acpi_event_genl_family,
+                                       &acpi_event_mcgrp);
        if (result)
                genl_unregister_family(&acpi_event_genl_family);
 
@@ -240,12 +233,14 @@ 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_bus_generate_genetlink_event);
+
+EXPORT_SYMBOL(acpi_bus_generate_netlink_event);
 
 static int acpi_event_genetlink_init(void)
 {
@@ -255,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)
@@ -267,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;
 }