X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Facpi%2Fcontainer.c;h=fe0cdf83641a3b5a0ddcf022e520941c1be10d92;hb=6b1be1990d2f7d1a3b1f25bf3e6444600665764a;hp=7f7e41d40a3b77da042d6d414f3393ad13977968;hpb=d550d98d3317378d93a4869db204725d270ec812;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 7f7e41d..fe0cdf8 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c @@ -35,30 +35,34 @@ #include #include -#define ACPI_CONTAINER_DRIVER_NAME "ACPI container driver" #define ACPI_CONTAINER_DEVICE_NAME "ACPI container device" #define ACPI_CONTAINER_CLASS "container" #define INSTALL_NOTIFY_HANDLER 1 #define UNINSTALL_NOTIFY_HANDLER 2 -#define ACPI_CONTAINER_COMPONENT 0x01000000 #define _COMPONENT ACPI_CONTAINER_COMPONENT -ACPI_MODULE_NAME("acpi_container") +ACPI_MODULE_NAME("container"); - MODULE_AUTHOR("Anil S Keshavamurthy"); -MODULE_DESCRIPTION(ACPI_CONTAINER_DRIVER_NAME); +MODULE_AUTHOR("Anil S Keshavamurthy"); +MODULE_DESCRIPTION("ACPI container driver"); MODULE_LICENSE("GPL"); -#define ACPI_STA_PRESENT (0x00000001) - static int acpi_container_add(struct acpi_device *device); static int acpi_container_remove(struct acpi_device *device, int type); +static const struct acpi_device_id container_device_ids[] = { + {"ACPI0004", 0}, + {"PNP0A05", 0}, + {"PNP0A06", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, container_device_ids); + static struct acpi_driver acpi_container_driver = { - .name = ACPI_CONTAINER_DRIVER_NAME, + .name = "container", .class = ACPI_CONTAINER_CLASS, - .ids = "ACPI0004,PNP0A05,PNP0A06", + .ids = container_device_ids, .ops = { .add = acpi_container_add, .remove = acpi_container_remove, @@ -71,18 +75,18 @@ static int is_device_present(acpi_handle handle) { acpi_handle temp; acpi_status status; - unsigned long sta; + unsigned long long sta; status = acpi_get_handle(handle, "_STA", &temp); if (ACPI_FAILURE(status)) - return 1; /* _STA not found, assmue device present */ + return 1; /* _STA not found, assume device present */ status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); if (ACPI_FAILURE(status)) return 0; /* Firmware error */ - return ((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT); + return ((sta & ACPI_STA_DEVICE_PRESENT) == ACPI_STA_DEVICE_PRESENT); } /*******************************************************************/ @@ -96,15 +100,14 @@ static int acpi_container_add(struct acpi_device *device) return -EINVAL; } - container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL); + container = kzalloc(sizeof(struct acpi_container), GFP_KERNEL); if (!container) return -ENOMEM; - memset(container, 0, sizeof(struct acpi_container)); container->handle = device->handle; strcpy(acpi_device_name(device), ACPI_CONTAINER_DEVICE_NAME); strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS); - acpi_driver_data(device) = container; + device->driver_data = container; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", acpi_device_name(device), acpi_device_bid(device))); @@ -117,7 +120,7 @@ static int acpi_container_remove(struct acpi_device *device, int type) acpi_status status = AE_OK; struct acpi_container *pc = NULL; - pc = (struct acpi_container *)acpi_driver_data(device); + pc = acpi_driver_data(device); kfree(pc); return status; } @@ -160,7 +163,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) case ACPI_NOTIFY_BUS_CHECK: /* Fall through */ case ACPI_NOTIFY_DEVICE_CHECK: - printk("Container driver received %s event\n", + printk(KERN_WARNING "Container driver received %s event\n", (type == ACPI_NOTIFY_BUS_CHECK) ? "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); status = acpi_bus_get_device(handle, &device); @@ -168,21 +171,22 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) if (ACPI_FAILURE(status) || !device) { result = container_device_add(&device, handle); if (!result) - kobject_uevent(&device->kobj, + kobject_uevent(&device->dev.kobj, KOBJ_ONLINE); else - printk("Failed to add container\n"); + printk(KERN_WARNING + "Failed to add container\n"); } } else { if (ACPI_SUCCESS(status)) { /* device exist and this is a remove request */ - kobject_uevent(&device->kobj, KOBJ_OFFLINE); + kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); } } break; case ACPI_NOTIFY_EJECT_REQUEST: if (!acpi_bus_get_device(handle, &device) && device) { - kobject_uevent(&device->kobj, KOBJ_OFFLINE); + kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); } break; default: @@ -236,7 +240,7 @@ container_walk_namespace_cb(acpi_handle handle, } end: - acpi_os_free(buffer.pointer); + kfree(buffer.pointer); return AE_OK; }