diff options
Diffstat (limited to 'drivers')
1539 files changed, 11703 insertions, 12084 deletions
diff --git a/drivers/acorn/block/Kconfig b/drivers/acorn/block/Kconfig index 073add35e66..a0ff25ea439 100644 --- a/drivers/acorn/block/Kconfig +++ b/drivers/acorn/block/Kconfig @@ -3,7 +3,7 @@ # menu "Acorn-specific block devices" - depends on ARCH_ACORN + depends on ARCH_ARC || ARCH_A5K config BLK_DEV_FD1772 tristate "Old Archimedes floppy (1772) support" diff --git a/drivers/acorn/block/mfmhd.c b/drivers/acorn/block/mfmhd.c index ce074f6f336..3dd6b7bb5d3 100644 --- a/drivers/acorn/block/mfmhd.c +++ b/drivers/acorn/block/mfmhd.c @@ -99,7 +99,6 @@ */ #include <linux/module.h> -#include <linux/config.h> #include <linux/sched.h> #include <linux/fs.h> #include <linux/interrupt.h> @@ -1279,7 +1278,7 @@ static int mfm_do_init(unsigned char irqmask) printk("mfm: detected %d hard drive%s\n", mfm_drives, mfm_drives == 1 ? "" : "s"); - ret = request_irq(mfm_irq, mfm_interrupt_handler, SA_INTERRUPT, "MFM harddisk", NULL); + ret = request_irq(mfm_irq, mfm_interrupt_handler, IRQF_DISABLED, "MFM harddisk", NULL); if (ret) { printk("mfm: unable to get IRQ%d\n", mfm_irq); goto out4; diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 610d2cc02cf..bc2652d72fd 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -133,6 +133,13 @@ config ACPI_FAN This driver adds support for ACPI fan devices, allowing user-mode applications to perform basic fan control (on, off, status). +config ACPI_DOCK + tristate "Dock" + depends on !ACPI_IBM_DOCK + default y + help + This driver adds support for ACPI controlled docking stations + config ACPI_PROCESSOR tristate "Processor" default y diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 5984b4f6715..f0a68ecf1e5 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -42,6 +42,7 @@ obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_BUTTON) += button.o obj-$(CONFIG_ACPI_EC) += ec.o obj-$(CONFIG_ACPI_FAN) += fan.o +obj-$(CONFIG_ACPI_DOCK) += dock.o obj-$(CONFIG_ACPI_VIDEO) += video.o obj-$(CONFIG_ACPI_HOTKEY) += hotkey.o obj-y += pci_root.o pci_link.o pci_irq.o pci_bind.o diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 7839b831df9..36ca365bcea 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c @@ -84,20 +84,18 @@ static int acpi_ac_get_state(struct acpi_ac *ac) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("acpi_ac_get_state"); if (!ac) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error reading AC Adapter state\n")); + ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state")); ac->state = ACPI_AC_STATUS_UNKNOWN; - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -110,14 +108,13 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset) { struct acpi_ac *ac = (struct acpi_ac *)seq->private; - ACPI_FUNCTION_TRACE("acpi_ac_seq_show"); if (!ac) - return_VALUE(0); + return 0; if (acpi_ac_get_state(ac)) { seq_puts(seq, "ERROR: Unable to read AC Adapter state\n"); - return_VALUE(0); + return 0; } seq_puts(seq, "state: "); @@ -133,7 +130,7 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset) break; } - return_VALUE(0); + return 0; } static int acpi_ac_open_fs(struct inode *inode, struct file *file) @@ -145,13 +142,12 @@ static int acpi_ac_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_ac_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_ac_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; acpi_device_dir(device)->owner = THIS_MODULE; } @@ -159,21 +155,18 @@ static int acpi_ac_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_AC_FILE_STATE, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_AC_FILE_STATE)); + return -ENODEV; else { entry->proc_fops = &acpi_ac_fops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_ac_remove_fs(struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_ac_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(device)); @@ -182,7 +175,7 @@ static int acpi_ac_remove_fs(struct acpi_device *device) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -194,13 +187,12 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) struct acpi_ac *ac = (struct acpi_ac *)data; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_ac_notify"); if (!ac) - return_VOID; + return; if (acpi_bus_get_device(ac->handle, &device)) - return_VOID; + return; switch (event) { case ACPI_AC_NOTIFY_STATUS: @@ -213,7 +205,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } static int acpi_ac_add(struct acpi_device *device) @@ -222,14 +214,13 @@ static int acpi_ac_add(struct acpi_device *device) acpi_status status = AE_OK; struct acpi_ac *ac = NULL; - ACPI_FUNCTION_TRACE("acpi_ac_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL); if (!ac) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(ac, 0, sizeof(struct acpi_ac)); ac->handle = device->handle; @@ -249,8 +240,6 @@ static int acpi_ac_add(struct acpi_device *device) ACPI_DEVICE_NOTIFY, acpi_ac_notify, ac); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -265,7 +254,7 @@ static int acpi_ac_add(struct acpi_device *device) kfree(ac); } - return_VALUE(result); + return result; } static int acpi_ac_remove(struct acpi_device *device, int type) @@ -273,55 +262,49 @@ static int acpi_ac_remove(struct acpi_device *device, int type) acpi_status status = AE_OK; struct acpi_ac *ac = NULL; - ACPI_FUNCTION_TRACE("acpi_ac_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; ac = (struct acpi_ac *)acpi_driver_data(device); status = acpi_remove_notify_handler(ac->handle, ACPI_DEVICE_NOTIFY, acpi_ac_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); acpi_ac_remove_fs(device); kfree(ac); - return_VALUE(0); + return 0; } static int __init acpi_ac_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_ac_init"); acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir); if (!acpi_ac_dir) - return_VALUE(-ENODEV); + return -ENODEV; acpi_ac_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_ac_driver); if (result < 0) { remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } static void __exit acpi_ac_exit(void) { - ACPI_FUNCTION_TRACE("acpi_ac_exit"); acpi_bus_unregister_driver(&acpi_ac_driver); remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); - return_VOID; + return; } module_init(acpi_ac_init); diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 1012284ff4f..cd57372a672 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -128,7 +128,6 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) acpi_status status; struct acpi_memory_info *info, *n; - ACPI_FUNCTION_TRACE("acpi_memory_get_device_resources"); status = acpi_walk_resources(mem_device->handle, METHOD_NAME__CRS, acpi_memory_get_resource, mem_device); @@ -150,23 +149,21 @@ acpi_memory_get_device(acpi_handle handle, struct acpi_device *device = NULL; struct acpi_device *pdevice = NULL; - ACPI_FUNCTION_TRACE("acpi_memory_get_device"); if (!acpi_bus_get_device(handle, &device) && device) goto end; status = acpi_get_parent(handle, &phandle); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n")); - return_VALUE(-EINVAL); + ACPI_EXCEPTION((AE_INFO, status, "Cannot find acpi parent")); + return -EINVAL; } /* Get the parent device */ status = acpi_bus_get_device(phandle, &pdevice); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in acpi_bus_get_device\n")); - return_VALUE(-EINVAL); + ACPI_EXCEPTION((AE_INFO, status, "Cannot get acpi bus device")); + return -EINVAL; } /* @@ -175,30 +172,29 @@ acpi_memory_get_device(acpi_handle handle, */ status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n")); - return_VALUE(-EINVAL); + ACPI_EXCEPTION((AE_INFO, status, "Cannot add acpi bus")); + return -EINVAL; } end: *mem_device = acpi_driver_data(device); if (!(*mem_device)) { printk(KERN_ERR "\n driver data not found"); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } static int acpi_memory_check_device(struct acpi_memory_device *mem_device) { unsigned long current_status; - ACPI_FUNCTION_TRACE("acpi_memory_check_device"); /* Get device present/absent information from the _STA */ if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA", NULL, ¤t_status))) - return_VALUE(-ENODEV); + return -ENODEV; /* * Check for device status. Device should be * present/enabled/functioning. @@ -206,9 +202,9 @@ static int acpi_memory_check_device(struct acpi_memory_device *mem_device) if (!((current_status & ACPI_MEMORY_STA_PRESENT) && (current_status & ACPI_MEMORY_STA_ENABLED) && (current_status & ACPI_MEMORY_STA_FUNCTIONAL))) - return_VALUE(-ENODEV); + return -ENODEV; - return_VALUE(0); + return 0; } static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) @@ -217,13 +213,11 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) struct acpi_memory_info *info; int node; - ACPI_FUNCTION_TRACE("acpi_memory_enable_device"); /* Get the range from the _CRS */ result = acpi_memory_get_device_resources(mem_device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "\nget_device_resources failed\n")); + printk(KERN_ERR PREFIX "get_device_resources failed\n"); mem_device->state = MEMORY_INVALID_STATE; return result; } @@ -254,7 +248,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) num_enabled++; } if (!num_enabled) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); + printk(KERN_ERR PREFIX "add_memory failed\n"); mem_device->state = MEMORY_INVALID_STATE; return -EINVAL; } @@ -269,7 +263,6 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) union acpi_object arg; unsigned long current_status; - ACPI_FUNCTION_TRACE("acpi_memory_powerdown_device"); /* Issue the _EJ0 command */ arg_list.count = 1; @@ -280,21 +273,21 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) "_EJ0", &arg_list, NULL); /* Return on _EJ0 failure */ if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_EJ0 failed.\n")); - return_VALUE(-ENODEV); + ACPI_EXCEPTION((AE_INFO, status, "_EJ0 failed")); + return -ENODEV; } /* Evalute _STA to check if the device is disabled */ status = acpi_evaluate_integer(mem_device->handle, "_STA", NULL, ¤t_status); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; /* Check for device status. Device should be disabled */ if (current_status & ACPI_MEMORY_STA_ENABLED) - return_VALUE(-EINVAL); + return -EINVAL; - return_VALUE(0); + return 0; } static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) @@ -302,7 +295,6 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) int result; struct acpi_memory_info *info, *n; - ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); /* * Ask the VM to offline this memory range. @@ -320,8 +312,6 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) /* Power-off and eject the device */ result = acpi_memory_powerdown_device(mem_device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device Power Down failed.\n")); /* Set the status of the device to invalid */ mem_device->state = MEMORY_INVALID_STATE; return result; @@ -336,7 +326,6 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) struct acpi_memory_device *mem_device; struct acpi_device *device; - ACPI_FUNCTION_TRACE("acpi_memory_device_notify"); switch (event) { case ACPI_NOTIFY_BUS_CHECK: @@ -348,15 +337,14 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "\nReceived DEVICE CHECK notification for device\n")); if (acpi_memory_get_device(handle, &mem_device)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in finding driver data\n")); - return_VOID; + printk(KERN_ERR PREFIX "Cannot find driver data\n"); + return; } if (!acpi_memory_check_device(mem_device)) { if (acpi_memory_enable_device(mem_device)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in acpi_memory_enable_device\n")); + printk(KERN_ERR PREFIX + "Cannot enable memory device\n"); } break; case ACPI_NOTIFY_EJECT_REQUEST: @@ -364,14 +352,12 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) "\nReceived EJECT REQUEST notification for device\n")); if (acpi_bus_get_device(handle, &device)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device doesn't exist\n")); + printk(KERN_ERR PREFIX "Device doesn't exist\n"); break; } mem_device = acpi_driver_data(device); if (!mem_device) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Driver Data is NULL\n")); + printk(KERN_ERR PREFIX "Driver Data is NULL\n"); break; } @@ -382,8 +368,8 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) * with generic sysfs driver */ if (acpi_memory_disable_device(mem_device)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error in acpi_memory_disable_device\n")); + printk(KERN_ERR PREFIX + "Disable memory device\n"); /* * TBD: Invoke acpi_bus_remove to cleanup data structures */ @@ -394,7 +380,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } static int acpi_memory_device_add(struct acpi_device *device) @@ -402,14 +388,13 @@ static int acpi_memory_device_add(struct acpi_device *device) int result; struct acpi_memory_device *mem_device = NULL; - ACPI_FUNCTION_TRACE("acpi_memory_device_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL); if (!mem_device) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(mem_device, 0, sizeof(struct acpi_memory_device)); INIT_LIST_HEAD(&mem_device->res_list); @@ -422,7 +407,7 @@ static int acpi_memory_device_add(struct acpi_device *device) result = acpi_memory_get_device_resources(mem_device); if (result) { kfree(mem_device); - return_VALUE(result); + return result; } /* Set the device state */ @@ -430,22 +415,21 @@ static int acpi_memory_device_add(struct acpi_device *device) printk(KERN_INFO "%s \n", acpi_device_name(device)); - return_VALUE(result); + return result; } static int acpi_memory_device_remove(struct acpi_device *device, int type) { struct acpi_memory_device *mem_device = NULL; - ACPI_FUNCTION_TRACE("acpi_memory_device_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; mem_device = (struct acpi_memory_device *)acpi_driver_data(device); kfree(mem_device); - return_VALUE(0); + return 0; } static int acpi_memory_device_start (struct acpi_device *device) @@ -453,8 +437,6 @@ static int acpi_memory_device_start (struct acpi_device *device) struct acpi_memory_device *mem_device; int result = 0; - ACPI_FUNCTION_TRACE("acpi_memory_device_start"); - mem_device = acpi_driver_data(device); if (!acpi_memory_check_device(mem_device)) { @@ -464,7 +446,7 @@ static int acpi_memory_device_start (struct acpi_device *device) ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_memory_enable_device\n")); } - return_VALUE(result); + return result; } /* @@ -477,16 +459,15 @@ static acpi_status is_memory_device(acpi_handle handle) struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_device_info *info; - ACPI_FUNCTION_TRACE("is_memory_device"); status = acpi_get_object_info(handle, &buffer); if (ACPI_FAILURE(status)) - return_ACPI_STATUS(AE_ERROR); + return status; info = buffer.pointer; if (!(info->valid & ACPI_VALID_HID)) { acpi_os_free(buffer.pointer); - return_ACPI_STATUS(AE_ERROR); + return AE_ERROR; } hardware_id = info->hardware_id.value; @@ -495,7 +476,7 @@ static acpi_status is_memory_device(acpi_handle handle) status = AE_ERROR; acpi_os_free(buffer.pointer); - return_ACPI_STATUS(status); + return status; } static acpi_status @@ -504,21 +485,17 @@ acpi_memory_register_notify_handler(acpi_handle handle, { acpi_status status; - ACPI_FUNCTION_TRACE("acpi_memory_register_notify_handler"); status = is_memory_device(handle); - if (ACPI_FAILURE(status)) - return_ACPI_STATUS(AE_OK); /* continue */ + if (ACPI_FAILURE(status)){ + ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device")); + return AE_OK; /* continue */ + } status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify, NULL); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); - return_ACPI_STATUS(AE_OK); /* continue */ - } - - return_ACPI_STATUS(status); + /* continue */ + return AE_OK; } static acpi_status @@ -527,22 +504,18 @@ acpi_memory_deregister_notify_handler(acpi_handle handle, { acpi_status status; - ACPI_FUNCTION_TRACE("acpi_memory_deregister_notify_handler"); status = is_memory_device(handle); - if (ACPI_FAILURE(status)) - return_ACPI_STATUS(AE_OK); /* continue */ + if (ACPI_FAILURE(status)){ + ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device")); + return AE_OK; /* continue */ + } status = acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); - return_ACPI_STATUS(AE_OK); /* continue */ - } - return_ACPI_STATUS(status); + return AE_OK; /* continue */ } static int __init acpi_memory_device_init(void) @@ -550,12 +523,11 @@ static int __init acpi_memory_device_init(void) int result; acpi_status status; - ACPI_FUNCTION_TRACE("acpi_memory_device_init"); result = acpi_bus_register_driver(&acpi_memory_device_driver); if (result < 0) - return_VALUE(-ENODEV); + return -ENODEV; status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, @@ -563,19 +535,18 @@ static int __init acpi_memory_device_init(void) NULL, NULL); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n")); + ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed")); acpi_bus_unregister_driver(&acpi_memory_device_driver); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } static void __exit acpi_memory_device_exit(void) { acpi_status status; - ACPI_FUNCTION_TRACE("acpi_memory_device_exit"); /* * Adding this to un-install notification handlers for all the device @@ -587,11 +558,11 @@ static void __exit acpi_memory_device_exit(void) NULL, NULL); if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n")); + ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed")); acpi_bus_unregister_driver(&acpi_memory_device_driver); - return_VOID; + return; } module_init(acpi_memory_device_init); diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index 839f423d738..055cfd5c876 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c @@ -1232,7 +1232,7 @@ static int __init asus_acpi_init(void) result = acpi_bus_register_driver(&asus_hotk_driver); if (result < 0) { remove_proc_entry(PROC_ASUS, acpi_root_dir); - return -ENODEV; + return result; } /* diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 702e857e98c..00b0728efe8 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -132,17 +132,16 @@ acpi_battery_get_info(struct acpi_battery *battery, struct acpi_buffer data = { 0, NULL }; union acpi_object *package = NULL; - ACPI_FUNCTION_TRACE("acpi_battery_get_info"); if (!battery || !bif) - return_VALUE(-EINVAL); + return -EINVAL; /* Evalute _BIF */ status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BIF\n")); - return_VALUE(-ENODEV); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); + return -ENODEV; } package = (union acpi_object *)buffer.pointer; @@ -151,7 +150,7 @@ acpi_battery_get_info(struct acpi_battery *battery, status = acpi_extract_package(package, &format, &data); if (status != AE_BUFFER_OVERFLOW) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BIF\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _BIF")); result = -ENODEV; goto end; } @@ -165,7 +164,7 @@ acpi_battery_get_info(struct acpi_battery *battery, status = acpi_extract_package(package, &format, &data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BIF\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _BIF")); kfree(data.pointer); result = -ENODEV; goto end; @@ -177,7 +176,7 @@ acpi_battery_get_info(struct acpi_battery *battery, if (!result) (*bif) = (struct acpi_battery_info *)data.pointer; - return_VALUE(result); + return result; } static int @@ -193,17 +192,16 @@ acpi_battery_get_status(struct acpi_battery *battery, struct acpi_buffer data = { 0, NULL }; union acpi_object *package = NULL; - ACPI_FUNCTION_TRACE("acpi_battery_get_status"); if (!battery || !bst) - return_VALUE(-EINVAL); + return -EINVAL; /* Evalute _BST */ status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BST\n")); - return_VALUE(-ENODEV); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); + return -ENODEV; } package = (union acpi_object *)buffer.pointer; @@ -212,7 +210,7 @@ acpi_battery_get_status(struct acpi_battery *battery, status = acpi_extract_package(package, &format, &data); if (status != AE_BUFFER_OVERFLOW) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BST\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _BST")); result = -ENODEV; goto end; } @@ -226,7 +224,7 @@ acpi_battery_get_status(struct acpi_battery *battery, status = acpi_extract_package(package, &format, &data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error extracting _BST\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _BST")); kfree(data.pointer); result = -ENODEV; goto end; @@ -238,7 +236,7 @@ acpi_battery_get_status(struct acpi_battery *battery, if (!result) (*bst) = (struct acpi_battery_status *)data.pointer; - return_VALUE(result); + return result; } static int @@ -248,25 +246,24 @@ acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm) union acpi_object arg0 = { ACPI_TYPE_INTEGER }; struct acpi_object_list arg_list = { 1, &arg0 }; - ACPI_FUNCTION_TRACE("acpi_battery_set_alarm"); if (!battery) - return_VALUE(-EINVAL); + return -EINVAL; if (!battery->flags.alarm) - return_VALUE(-ENODEV); + return -ENODEV; arg0.integer.value = alarm; status = acpi_evaluate_object(battery->handle, "_BTP", &arg_list, NULL); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Alarm set to %d\n", (u32) alarm)); battery->alarm = alarm; - return_VALUE(0); + return 0; } static int acpi_battery_check(struct acpi_battery *battery) @@ -277,18 +274,17 @@ static int acpi_battery_check(struct acpi_battery *battery) struct acpi_device *device = NULL; struct acpi_battery_info *bif = NULL; - ACPI_FUNCTION_TRACE("acpi_battery_check"); if (!battery) - return_VALUE(-EINVAL); + return -EINVAL; result = acpi_bus_get_device(battery->handle, &device); if (result) - return_VALUE(result); + return result; result = acpi_bus_get_status(device); if (result) - return_VALUE(result); + return result; /* Insertion? */ @@ -300,7 +296,7 @@ static int acpi_battery_check(struct acpi_battery *battery) result = acpi_battery_get_info(battery, &bif); if (result) - return_VALUE(result); + return result; battery->flags.power_unit = bif->power_unit; battery->trips.warning = bif->design_capacity_warning; @@ -324,7 +320,7 @@ static int acpi_battery_check(struct acpi_battery *battery) battery->flags.present = device->status.battery_present; - return_VALUE(result); + return result; } /* -------------------------------------------------------------------------- @@ -339,7 +335,6 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) struct acpi_battery_info *bif = NULL; char *units = "?"; - ACPI_FUNCTION_TRACE("acpi_battery_read_info"); if (!battery) goto end; @@ -409,7 +404,7 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) end: kfree(bif); - return_VALUE(0); + return 0; } static int acpi_battery_info_open_fs(struct inode *inode, struct file *file) @@ -424,7 +419,6 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) struct acpi_battery_status *bst = NULL; char *units = "?"; - ACPI_FUNCTION_TRACE("acpi_battery_read_state"); if (!battery) goto end; @@ -458,8 +452,6 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) if ((bst->state & 0x01) && (bst->state & 0x02)) { seq_printf(seq, "charging state: charging/discharging\n"); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Battery Charging and Discharging?\n")); } else if (bst->state & 0x01) seq_printf(seq, "charging state: discharging\n"); else if (bst->state & 0x02) @@ -489,7 +481,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) end: kfree(bst); - return_VALUE(0); + return 0; } static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) @@ -502,7 +494,6 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) struct acpi_battery *battery = (struct acpi_battery *)seq->private; char *units = "?"; - ACPI_FUNCTION_TRACE("acpi_battery_read_alarm"); if (!battery) goto end; @@ -527,7 +518,7 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) seq_printf(seq, "%d %sh\n", (u32) battery->alarm, units); end: - return_VALUE(0); + return 0; } static ssize_t @@ -540,25 +531,24 @@ acpi_battery_write_alarm(struct file *file, struct seq_file *m = (struct seq_file *)file->private_data; struct acpi_battery *battery = (struct acpi_battery *)m->private; - ACPI_FUNCTION_TRACE("acpi_battery_write_alarm"); if (!battery || (count > sizeof(alarm_string) - 1)) - return_VALUE(-EINVAL); + return -EINVAL; if (!battery->flags.present) - return_VALUE(-ENODEV); + return -ENODEV; if (copy_from_user(alarm_string, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; alarm_string[count] = '\0'; result = acpi_battery_set_alarm(battery, simple_strtoul(alarm_string, NULL, 0)); if (result) - return_VALUE(result); + return result; - return_VALUE(count); + return count; } static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file) @@ -595,13 +585,12 @@ static int acpi_battery_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_battery_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_battery_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; acpi_device_dir(device)->owner = THIS_MODULE; } @@ -609,9 +598,7 @@ static int acpi_battery_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_BATTERY_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BATTERY_FILE_INFO)); + return -ENODEV; else { entry->proc_fops = &acpi_battery_info_ops; entry->data = acpi_driver_data(device); @@ -622,9 +609,7 @@ static int acpi_battery_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BATTERY_FILE_STATUS)); + return -ENODEV; else { entry->proc_fops = &acpi_battery_state_ops; entry->data = acpi_driver_data(device); @@ -636,21 +621,18 @@ static int acpi_battery_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BATTERY_FILE_ALARM)); + return -ENODEV; else { entry->proc_fops = &acpi_battery_alarm_ops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_battery_remove_fs(struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_battery_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_BATTERY_FILE_ALARM, @@ -664,7 +646,7 @@ static int acpi_battery_remove_fs(struct acpi_device *device) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -676,13 +658,12 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) struct acpi_battery *battery = (struct acpi_battery *)data; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_battery_notify"); if (!battery) - return_VOID; + return; if (acpi_bus_get_device(handle, &device)) - return_VOID; + return; switch (event) { case ACPI_BATTERY_NOTIFY_STATUS: @@ -696,7 +677,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } static int acpi_battery_add(struct acpi_device *device) @@ -705,14 +686,13 @@ static int acpi_battery_add(struct acpi_device *device) acpi_status status = 0; struct acpi_battery *battery = NULL; - ACPI_FUNCTION_TRACE("acpi_battery_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; battery = kmalloc(sizeof(struct acpi_battery), GFP_KERNEL); if (!battery) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(battery, 0, sizeof(struct acpi_battery)); battery->handle = device->handle; @@ -732,8 +712,6 @@ static int acpi_battery_add(struct acpi_device *device) ACPI_DEVICE_NOTIFY, acpi_battery_notify, battery); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -748,7 +726,7 @@ static int acpi_battery_add(struct acpi_device *device) kfree(battery); } - return_VALUE(result); + return result; } static int acpi_battery_remove(struct acpi_device *device, int type) @@ -756,56 +734,50 @@ static int acpi_battery_remove(struct acpi_device *device, int type) acpi_status status = 0; struct acpi_battery *battery = NULL; - ACPI_FUNCTION_TRACE("acpi_battery_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; battery = (struct acpi_battery *)acpi_driver_data(device); status = acpi_remove_notify_handler(battery->handle, ACPI_DEVICE_NOTIFY, acpi_battery_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); acpi_battery_remove_fs(device); kfree(battery); - return_VALUE(0); + return 0; } static int __init acpi_battery_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_battery_init"); acpi_battery_dir = proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir); if (!acpi_battery_dir) - return_VALUE(-ENODEV); + return -ENODEV; acpi_battery_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_battery_driver); if (result < 0) { remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } static void __exit acpi_battery_exit(void) { - ACPI_FUNCTION_TRACE("acpi_battery_exit"); acpi_bus_unregister_driver(&acpi_battery_driver); remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); - return_VOID; + return; } module_init(acpi_battery_init); diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index dd3983cece9..ea5a0496a4f 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -60,21 +60,19 @@ int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("acpi_bus_get_device"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; /* TBD: Support fixed-feature devices */ status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device); if (ACPI_FAILURE(status) || !*device) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No context for object [%p]\n", - handle)); - return_VALUE(-ENODEV); + ACPI_EXCEPTION((AE_INFO, status, "No context for object [%p]", handle)); + return -ENODEV; } - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_bus_get_device); @@ -84,10 +82,9 @@ int acpi_bus_get_status(struct acpi_device *device) acpi_status status = AE_OK; unsigned long sta = 0; - ACPI_FUNCTION_TRACE("acpi_bus_get_status"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; /* * Evaluate _STA if present. @@ -96,7 +93,7 @@ int acpi_bus_get_status(struct acpi_device *device) status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; STRUCT_TO_INT(device->status) = (int)sta; } @@ -120,7 +117,7 @@ int acpi_bus_get_status(struct acpi_device *device) device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status))); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_bus_get_status); @@ -136,11 +133,10 @@ int acpi_bus_get_power(acpi_handle handle, int *state) struct acpi_device *device = NULL; unsigned long psc = 0; - ACPI_FUNCTION_TRACE("acpi_bus_get_power"); result = acpi_bus_get_device(handle, &device); if (result) - return_VALUE(result); + return result; *state = ACPI_STATE_UNKNOWN; @@ -159,12 +155,12 @@ int acpi_bus_get_power(acpi_handle handle, int *state) status = acpi_evaluate_integer(device->handle, "_PSC", NULL, &psc); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; device->power.state = (int)psc; } else if (device->power.flags.power_resources) { result = acpi_power_get_inferred_state(device); if (result) - return_VALUE(result); + return result; } *state = device->power.state; @@ -173,7 +169,7 @@ int acpi_bus_get_power(acpi_handle handle, int *state) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n", device->pnp.bus_id, device->power.state)); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_bus_get_power); @@ -185,21 +181,20 @@ int acpi_bus_set_power(acpi_handle handle, int state) struct acpi_device *device = NULL; char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' }; - ACPI_FUNCTION_TRACE("acpi_bus_set_power"); result = acpi_bus_get_device(handle, &device); if (result) - return_VALUE(result); + return result; if ((state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) - return_VALUE(-EINVAL); + return -EINVAL; /* Make sure this is a valid target state */ if (!device->flags.power_manageable) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Device is not power manageable\n")); - return_VALUE(-ENODEV); + printk(KERN_DEBUG "Device `[%s]' is not power manageable", + device->kobj.name); + return -ENODEV; } /* * Get device's current power state if it's unknown @@ -211,18 +206,18 @@ int acpi_bus_set_power(acpi_handle handle, int state) if (state == device->power.state) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state)); - return_VALUE(0); + return 0; } } if (!device->power.states[state].flags.valid) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", - state)); - return_VALUE(-ENODEV); + printk(KERN_WARNING PREFIX "Device does not support D%d\n", state); + return -ENODEV; } if (device->parent && (state < device->parent->power.state)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Cannot set device to a higher-powered state than parent\n")); - return_VALUE(-ENODEV); + printk(KERN_WARNING PREFIX + "Cannot set device to a higher-powered" + " state than parent\n"); + return -ENODEV; } /* @@ -264,15 +259,15 @@ int acpi_bus_set_power(acpi_handle handle, int state) end: if (result) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Error transitioning device [%s] to D%d\n", - device->pnp.bus_id, state)); + printk(KERN_WARNING PREFIX + "Transitioning device [%s] to D%d\n", + device->pnp.bus_id, state); else ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] transitioned to D%d\n", device->pnp.bus_id, state)); - return_VALUE(result); + return result; } EXPORT_SYMBOL(acpi_bus_set_power); @@ -293,18 +288,17 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data) struct acpi_bus_event *event = NULL; unsigned long flags = 0; - ACPI_FUNCTION_TRACE("acpi_bus_generate_event"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; /* drop event on the floor if no one's listening */ if (!event_is_open) - return_VALUE(0); + return 0; event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC); if (!event) - return_VALUE(-ENOMEM); + return -ENOMEM; strcpy(event->device_class, device->pnp.device_class); strcpy(event->bus_id, device->pnp.bus_id); @@ -317,7 +311,7 @@ int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data) wake_up_interruptible(&acpi_bus_event_queue); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_bus_generate_event); @@ -329,10 +323,9 @@ int acpi_bus_receive_event(struct acpi_bus_event *event) DECLARE_WAITQUEUE(wait, current); - ACPI_FUNCTION_TRACE("acpi_bus_receive_event"); if (!event) - return_VALUE(-EINVAL); + return -EINVAL; if (list_empty(&acpi_bus_event_list)) { @@ -346,7 +339,7 @@ int acpi_bus_receive_event(struct acpi_bus_event *event) set_current_state(TASK_RUNNING); if (signal_pending(current)) - return_VALUE(-ERESTARTSYS); + return -ERESTARTSYS; } spin_lock_irqsave(&acpi_bus_event_lock, flags); @@ -357,13 +350,13 @@ int acpi_bus_receive_event(struct acpi_bus_event *event) spin_unlock_irqrestore(&acpi_bus_event_lock, flags); if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; memcpy(event, entry, sizeof(struct acpi_bus_event)); kfree(entry); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_bus_receive_event); @@ -378,10 +371,9 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed) acpi_status status = 0; struct acpi_device_status old_status; - ACPI_FUNCTION_TRACE("acpi_bus_check_device"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; if (status_changed) *status_changed = 0; @@ -398,15 +390,15 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed) if (status_changed) *status_changed = 1; } - return_VALUE(0); + return 0; } status = acpi_bus_get_status(device); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status)) - return_VALUE(0); + return 0; if (status_changed) *status_changed = 1; @@ -422,7 +414,7 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed) /* TBD: Handle device removal */ } - return_VALUE(0); + return 0; } static int acpi_bus_check_scope(struct acpi_device *device) @@ -430,25 +422,24 @@ static int acpi_bus_check_scope(struct acpi_device *device) int result = 0; int status_changed = 0; - ACPI_FUNCTION_TRACE("acpi_bus_check_scope"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; /* Status Change? */ result = acpi_bus_check_device(device, &status_changed); if (result) - return_VALUE(result); + return result; if (!status_changed) - return_VALUE(0); + return 0; /* * TBD: Enumerate child devices within this device's scope and * run acpi_bus_check_device()'s on them. */ - return_VALUE(0); + return 0; } /** @@ -461,10 +452,9 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) int result = 0; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_bus_notify"); if (acpi_bus_get_device(handle, &device)) - return_VOID; + return; switch (type) { @@ -539,7 +529,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) break; } - return_VOID; + return; } /* -------------------------------------------------------------------------- @@ -553,7 +543,6 @@ static int __init acpi_bus_init_irq(void) struct acpi_object_list arg_list = { 1, &arg }; char *message = NULL; - ACPI_FUNCTION_TRACE("acpi_bus_init_irq"); /* * Let the system know what interrupt model we are using by @@ -572,7 +561,7 @@ static int __init acpi_bus_init_irq(void) break; default: printk(KERN_WARNING PREFIX "Unknown interrupt routing model\n"); - return_VALUE(-ENODEV); + return -ENODEV; } printk(KERN_INFO PREFIX "Using %s for interrupt routing\n", message); @@ -581,11 +570,11 @@ static int __init acpi_bus_init_irq(void) status = acpi_evaluate_object(NULL, "\\_PIC", &arg_list, NULL); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PIC\n")); - return_VALUE(-ENODEV); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PIC")); + return -ENODEV; } - return_VALUE(0); + return 0; } void __init acpi_early_init(void) @@ -593,10 +582,9 @@ void __init acpi_early_init(void) acpi_status status = AE_OK; struct acpi_buffer buffer = { sizeof(acpi_fadt), &acpi_fadt }; - ACPI_FUNCTION_TRACE("acpi_early_init"); if (acpi_disabled) - return_VOID; + return; printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); @@ -656,11 +644,11 @@ void __init acpi_early_init(void) goto error0; } - return_VOID; + return; error0: disable_acpi(); - return_VOID; + return; } static int __init acpi_bus_init(void) @@ -669,7 +657,6 @@ static int __init acpi_bus_init(void) acpi_status status = AE_OK; extern acpi_status acpi_os_initialize1(void); - ACPI_FUNCTION_TRACE("acpi_bus_init"); status = acpi_os_initialize1(); @@ -731,12 +718,12 @@ static int __init acpi_bus_init(void) */ acpi_root_dir = proc_mkdir(ACPI_BUS_FILE_ROOT, NULL); - return_VALUE(0); + return 0; /* Mimic structured exception handling */ error1: acpi_terminate(); - return_VALUE(-ENODEV); + return -ENODEV; } decl_subsys(acpi, NULL, NULL); @@ -745,11 +732,10 @@ static int __init acpi_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_init"); if (acpi_disabled) { printk(KERN_INFO PREFIX "Interpreter disabled.\n"); - return_VALUE(-ENODEV); + return -ENODEV; } firmware_register(&acpi_subsys); @@ -770,7 +756,7 @@ static int __init acpi_init(void) } else disable_acpi(); - return_VALUE(result); + return result; } subsys_initcall(acpi_init); diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 4b6d9f0096a..02594639c4d 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -112,15 +112,14 @@ static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) { struct acpi_button *button = (struct acpi_button *)seq->private; - ACPI_FUNCTION_TRACE("acpi_button_info_seq_show"); if (!button || !button->device) - return_VALUE(0); + return 0; seq_printf(seq, "type: %s\n", acpi_device_name(button->device)); - return_VALUE(0); + return 0; } static int acpi_button_info_open_fs(struct inode *inode, struct file *file) @@ -134,10 +133,9 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) acpi_status status; unsigned long state; - ACPI_FUNCTION_TRACE("acpi_button_state_seq_show"); if (!button || !button->device) - return_VALUE(0); + return 0; status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state); if (ACPI_FAILURE(status)) { @@ -147,7 +145,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) (state ? "open" : "closed")); } - return_VALUE(0); + return 0; } static int acpi_button_state_open_fs(struct inode *inode, struct file *file) @@ -164,10 +162,9 @@ static int acpi_button_add_fs(struct acpi_device *device) struct proc_dir_entry *entry = NULL; struct acpi_button *button = NULL; - ACPI_FUNCTION_TRACE("acpi_button_add_fs"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; button = acpi_driver_data(device); @@ -195,21 +192,19 @@ static int acpi_button_add_fs(struct acpi_device *device) } if (!entry) - return_VALUE(-ENODEV); + return -ENODEV; entry->owner = THIS_MODULE; acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; acpi_device_dir(device)->owner = THIS_MODULE; /* 'info' [R] */ entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BUTTON_FILE_INFO)); + return -ENODEV; else { entry->proc_fops = &acpi_button_info_fops; entry->data = acpi_driver_data(device); @@ -221,9 +216,7 @@ static int acpi_button_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_BUTTON_FILE_STATE, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_BUTTON_FILE_INFO)); + return -ENODEV; else { entry->proc_fops = &acpi_button_state_fops; entry->data = acpi_driver_data(device); @@ -231,14 +224,13 @@ static int acpi_button_add_fs(struct acpi_device *device) } } - return_VALUE(0); + return 0; } static int acpi_button_remove_fs(struct acpi_device *device) { struct acpi_button *button = NULL; - ACPI_FUNCTION_TRACE("acpi_button_remove_fs"); button = acpi_driver_data(device); if (acpi_device_dir(device)) { @@ -253,7 +245,7 @@ static int acpi_button_remove_fs(struct acpi_device *device) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -264,10 +256,9 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) { struct acpi_button *button = (struct acpi_button *)data; - ACPI_FUNCTION_TRACE("acpi_button_notify"); if (!button || !button->device) - return_VOID; + return; switch (event) { case ACPI_BUTTON_NOTIFY_STATUS: @@ -280,21 +271,20 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } static acpi_status acpi_button_notify_fixed(void *data) { struct acpi_button *button = (struct acpi_button *)data; - ACPI_FUNCTION_TRACE("acpi_button_notify_fixed"); if (!button) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); - return_ACPI_STATUS(AE_OK); + return AE_OK; } static int acpi_button_add(struct acpi_device *device) @@ -303,14 +293,13 @@ static int acpi_button_add(struct acpi_device *device) acpi_status status = AE_OK; struct acpi_button *button = NULL; - ACPI_FUNCTION_TRACE("acpi_button_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; button = kmalloc(sizeof(struct acpi_button), GFP_KERNEL); if (!button) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(button, 0, sizeof(struct acpi_button)); button->device = device; @@ -349,8 +338,8 @@ static int acpi_button_add(struct acpi_device *device) sprintf(acpi_device_class(device), "%s/%s", ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n", - acpi_device_hid(device))); + printk(KERN_ERR PREFIX "Unsupported hid [%s]\n", + acpi_device_hid(device)); result = -ENODEV; goto end; } @@ -381,8 +370,6 @@ static int acpi_button_add(struct acpi_device *device) } if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -406,7 +393,7 @@ static int acpi_button_add(struct acpi_device *device) kfree(button); } - return_VALUE(result); + return result; } static int acpi_button_remove(struct acpi_device *device, int type) @@ -414,10 +401,9 @@ static int acpi_button_remove(struct acpi_device *device, int type) acpi_status status = 0; struct acpi_button *button = NULL; - ACPI_FUNCTION_TRACE("acpi_button_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; button = acpi_driver_data(device); @@ -440,39 +426,33 @@ static int acpi_button_remove(struct acpi_device *device, int type) break; } - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); - acpi_button_remove_fs(device); kfree(button); - return_VALUE(0); + return 0; } static int __init acpi_button_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_button_init"); acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); if (!acpi_button_dir) - return_VALUE(-ENODEV); + return -ENODEV; acpi_button_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_button_driver); if (result < 0) { remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } static void __exit acpi_button_exit(void) { - ACPI_FUNCTION_TRACE("acpi_button_exit"); acpi_bus_unregister_driver(&acpi_button_driver); @@ -484,7 +464,7 @@ static void __exit acpi_button_exit(void) remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); - return_VOID; + return; } module_init(acpi_button_init); diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index b69a8cad82b..7f7e41d40a3 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c @@ -73,17 +73,16 @@ static int is_device_present(acpi_handle handle) acpi_status status; unsigned long sta; - ACPI_FUNCTION_TRACE("is_device_present"); status = acpi_get_handle(handle, "_STA", &temp); if (ACPI_FAILURE(status)) - return_VALUE(1); /* _STA not found, assmue device present */ + return 1; /* _STA not found, assmue device present */ status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); if (ACPI_FAILURE(status)) - return_VALUE(0); /* Firmware error */ + return 0; /* Firmware error */ - return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT); + return ((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT); } /*******************************************************************/ @@ -91,16 +90,15 @@ static int acpi_container_add(struct acpi_device *device) { struct acpi_container *container; - ACPI_FUNCTION_TRACE("acpi_container_add"); if (!device) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "device is NULL\n")); - return_VALUE(-EINVAL); + printk(KERN_ERR PREFIX "device is NULL\n"); + return -EINVAL; } container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL); if (!container) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(container, 0, sizeof(struct acpi_container)); container->handle = device->handle; @@ -111,7 +109,7 @@ static int acpi_container_add(struct acpi_device *device) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", acpi_device_name(device), acpi_device_bid(device))); - return_VALUE(0); + return 0; } static int acpi_container_remove(struct acpi_device *device, int type) @@ -130,23 +128,22 @@ static int container_device_add(struct acpi_device **device, acpi_handle handle) struct acpi_device *pdev; int result; - ACPI_FUNCTION_TRACE("container_device_add"); if (acpi_get_parent(handle, &phandle)) { - return_VALUE(-ENODEV); + return -ENODEV; } if (acpi_bus_get_device(phandle, &pdev)) { - return_VALUE(-ENODEV); + return -ENODEV; } if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_DEVICE)) { - return_VALUE(-ENODEV); + return -ENODEV; } result = acpi_bus_start(*device); - return_VALUE(result); + return result; } static void container_notify_cb(acpi_handle handle, u32 type, void *context) @@ -156,7 +153,6 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) int present; acpi_status status; - ACPI_FUNCTION_TRACE("container_notify_cb"); present = is_device_present(handle); @@ -192,7 +188,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) default: break; } - return_VOID; + return; } static acpi_status @@ -205,11 +201,10 @@ container_walk_namespace_cb(acpi_handle handle, acpi_status status; int *action = context; - ACPI_FUNCTION_TRACE("container_walk_namespace_cb"); status = acpi_get_object_info(handle, &buffer); if (ACPI_FAILURE(status) || !buffer.pointer) { - return_ACPI_STATUS(AE_OK); + return AE_OK; } info = buffer.pointer; @@ -243,7 +238,7 @@ container_walk_namespace_cb(acpi_handle handle, end: acpi_os_free(buffer.pointer); - return_ACPI_STATUS(AE_OK); + return AE_OK; } static int __init acpi_container_init(void) @@ -269,7 +264,6 @@ static void __exit acpi_container_exit(void) { int action = UNINSTALL_NOTIFY_HANDLER; - ACPI_FUNCTION_TRACE("acpi_container_exit"); acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, @@ -278,7 +272,7 @@ static void __exit acpi_container_exit(void) acpi_bus_unregister_driver(&acpi_container_driver); - return_VOID; + return; } module_init(acpi_container_init); diff --git a/drivers/acpi/debug.c b/drivers/acpi/debug.c index 263322b7d11..35c6af8a83c 100644 --- a/drivers/acpi/debug.c +++ b/drivers/acpi/debug.c @@ -155,13 +155,12 @@ acpi_system_write_debug(struct file *file, { char debug_string[12] = { '\0' }; - ACPI_FUNCTION_TRACE("acpi_system_write_debug"); if (count > sizeof(debug_string) - 1) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(debug_string, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; debug_string[count] = '\0'; @@ -173,10 +172,10 @@ acpi_system_write_debug(struct file *file, acpi_dbg_level = simple_strtoul(debug_string, NULL, 0); break; default: - return_VALUE(-EINVAL); + return -EINVAL; } - return_VALUE(count); + return count; } static int __init acpi_debug_init(void) @@ -185,10 +184,9 @@ static int __init acpi_debug_init(void) int error = 0; char *name; - ACPI_FUNCTION_TRACE("acpi_debug_init"); if (acpi_disabled) - return_VALUE(0); + return 0; /* 'debug_layer' [R/W] */ name = ACPI_SYSTEM_FILE_DEBUG_LAYER; @@ -213,15 +211,12 @@ static int __init acpi_debug_init(void) goto Error; Done: - return_VALUE(error); + return error; Error: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' proc fs entry\n", name)); - remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir); - error = -EFAULT; + error = -ENODEV; goto Done; } diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index bbdf990e9f6..daf51b5b587 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c @@ -125,37 +125,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, if (info->table_desc->pointer->revision == 1) { node->flags |= ANOBJ_DATA_WIDTH_32; } -#ifdef ACPI_INIT_PARSE_METHODS - /* - * Note 11/2005: Removed this code to parse all methods during table - * load because it causes problems if there are any errors during the - * parse. Also, it seems like overkill and we probably don't want to - * abort a table load because of an issue with a single method. - */ - - /* - * Print a dot for each method unless we are going to print - * the entire pathname - */ - if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { - ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); - } - /* - * Always parse methods to detect errors, we will delete - * the parse tree below - */ - status = acpi_ds_parse_method(obj_handle); - if (ACPI_FAILURE(status)) { - ACPI_ERROR((AE_INFO, - "Method %p [%4.4s] - parse failure, %s", - obj_handle, - acpi_ut_get_node_name(obj_handle), - acpi_format_exception(status))); - - /* This parse failed, but we will continue parsing more methods */ - } -#endif info->method_count++; break; diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index bc9aca4e740..a39a33f4847 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c @@ -52,6 +52,10 @@ #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dsmethod") +/* Local prototypes */ +static acpi_status +acpi_ds_create_method_mutex(union acpi_operand_object *method_desc); + /******************************************************************************* * * FUNCTION: acpi_ds_method_error @@ -67,6 +71,7 @@ ACPI_MODULE_NAME("dsmethod") * Note: Allows the exception handler to change the status code * ******************************************************************************/ + acpi_status acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) { @@ -113,11 +118,51 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) /******************************************************************************* * + * FUNCTION: acpi_ds_create_method_mutex + * + * PARAMETERS: obj_desc - The method object + * + * RETURN: Status + * + * DESCRIPTION: Create a mutex object for a serialized control method + * + ******************************************************************************/ + +static acpi_status +acpi_ds_create_method_mutex(union acpi_operand_object *method_desc) +{ + union acpi_operand_object *mutex_desc; + acpi_status status; + + ACPI_FUNCTION_NAME(ds_create_method_mutex); + + /* Create the new mutex object */ + + mutex_desc = acpi_ut_create_internal_object(ACPI_TYPE_MUTEX); + if (!mutex_desc) { + return_ACPI_STATUS(AE_NO_MEMORY); + } + + /* Create the actual OS Mutex */ + + status = acpi_os_create_mutex(&mutex_desc->mutex.os_mutex); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + mutex_desc->mutex.sync_level = method_desc->method.sync_level; + method_desc->method.mutex = mutex_desc; + return_ACPI_STATUS(AE_OK); +} + +/******************************************************************************* + * * FUNCTION: acpi_ds_begin_method_execution * * PARAMETERS: method_node - Node of the method * obj_desc - The method object - * calling_method_node - Caller of this method (if non-null) + * walk_state - current state, NULL if not yet executing + * a method. * * RETURN: Status * @@ -128,9 +173,9 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) ******************************************************************************/ acpi_status -acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, - union acpi_operand_object * obj_desc, - struct acpi_namespace_node * calling_method_node) +acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, + union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state) { acpi_status status = AE_OK; @@ -149,35 +194,80 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, } /* - * If there is a concurrency limit on this method, we need to - * obtain a unit from the method semaphore. + * If this method is serialized, we need to acquire the method mutex. */ - if (obj_desc->method.semaphore) { + if (obj_desc->method.method_flags & AML_METHOD_SERIALIZED) { /* - * Allow recursive method calls, up to the reentrancy/concurrency - * limit imposed by the SERIALIZED rule and the sync_level method - * parameter. - * - * The point of this code is to avoid permanently blocking a - * thread that is making recursive method calls. + * Create a mutex for the method if it is defined to be Serialized + * and a mutex has not already been created. We defer the mutex creation + * until a method is actually executed, to minimize the object count */ - if (method_node == calling_method_node) { - if (obj_desc->method.thread_count >= - obj_desc->method.concurrency) { - return_ACPI_STATUS(AE_AML_METHOD_LIMIT); + if (!obj_desc->method.mutex) { + status = acpi_ds_create_method_mutex(obj_desc); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } } /* - * Get a unit from the method semaphore. This releases the - * interpreter if we block (then reacquires it) + * The current_sync_level (per-thread) must be less than or equal to + * the sync level of the method. This mechanism provides some + * deadlock prevention + * + * Top-level method invocation has no walk state at this point */ - status = - acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, - ACPI_WAIT_FOREVER); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + if (walk_state && + (walk_state->thread->current_sync_level > + obj_desc->method.mutex->mutex.sync_level)) { + ACPI_ERROR((AE_INFO, + "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%d)", + acpi_ut_get_node_name(method_node), + walk_state->thread->current_sync_level)); + + return_ACPI_STATUS(AE_AML_MUTEX_ORDER); } + + /* + * Obtain the method mutex if necessary. Do not acquire mutex for a + * recursive call. + */ + if (!walk_state || + !obj_desc->method.mutex->mutex.owner_thread || + (walk_state->thread != + obj_desc->method.mutex->mutex.owner_thread)) { + /* + * Acquire the method mutex. This releases the interpreter if we + * block (and reacquires it before it returns) + */ + status = + acpi_ex_system_wait_mutex(obj_desc->method.mutex-> + mutex.os_mutex, + ACPI_WAIT_FOREVER); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + /* Update the mutex and walk info and save the original sync_level */ + + if (walk_state) { + obj_desc->method.mutex->mutex. + original_sync_level = + walk_state->thread->current_sync_level; + + obj_desc->method.mutex->mutex.owner_thread = + walk_state->thread; + walk_state->thread->current_sync_level = + obj_desc->method.sync_level; + } else { + obj_desc->method.mutex->mutex. + original_sync_level = + obj_desc->method.mutex->mutex.sync_level; + } + } + + /* Always increase acquisition depth */ + + obj_desc->method.mutex->mutex.acquisition_depth++; } /* @@ -200,10 +290,10 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, return_ACPI_STATUS(status); cleanup: - /* On error, must signal the method semaphore if present */ + /* On error, must release the method mutex (if present) */ - if (obj_desc->method.semaphore) { - (void)acpi_os_signal_semaphore(obj_desc->method.semaphore, 1); + if (obj_desc->method.mutex) { + acpi_os_release_mutex(obj_desc->method.mutex->mutex.os_mutex); } return_ACPI_STATUS(status); } @@ -253,10 +343,10 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, return_ACPI_STATUS(AE_NULL_OBJECT); } - /* Init for new method, possibly wait on concurrency semaphore */ + /* Init for new method, possibly wait on method mutex */ status = acpi_ds_begin_method_execution(method_node, obj_desc, - this_walk_state->method_node); + this_walk_state); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -478,6 +568,8 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, * created, delete all locals and arguments, and delete the parse * tree if requested. * + * MUTEX: Interpreter is locked + * ******************************************************************************/ void @@ -503,26 +595,21 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, } /* - * Lock the parser while we terminate this method. - * If this is the last thread executing the method, - * we have additional cleanup to perform + * If method is serialized, release the mutex and restore the + * current sync level for this thread */ - status = acpi_ut_acquire_mutex(ACPI_MTX_CONTROL_METHOD); - if (ACPI_FAILURE(status)) { - return_VOID; - } + if (method_desc->method.mutex) { - /* Signal completion of the execution of this method if necessary */ + /* Acquisition Depth handles recursive calls */ - if (method_desc->method.semaphore) { - status = - acpi_os_signal_semaphore(method_desc->method.semaphore, 1); - if (ACPI_FAILURE(status)) { - - /* Ignore error and continue */ + method_desc->method.mutex->mutex.acquisition_depth--; + if (!method_desc->method.mutex->mutex.acquisition_depth) { + walk_state->thread->current_sync_level = + method_desc->method.mutex->mutex. + original_sync_level; - ACPI_EXCEPTION((AE_INFO, status, - "Could not signal method semaphore")); + acpi_os_release_mutex(method_desc->method.mutex->mutex. + os_mutex); } } @@ -537,7 +624,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - goto exit; + return_VOID; } /* @@ -580,18 +667,16 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, /* * Support to dynamically change a method from not_serialized to * Serialized if it appears that the method is incorrectly written and - * does not support multiple thread execution. The best example of this - * is if such a method creates namespace objects and blocks. A second + * does not support multiple thread execution. The best example of this + * is if such a method creates namespace objects and blocks. A second * thread will fail with an AE_ALREADY_EXISTS exception * * This code is here because we must wait until the last thread exits * before creating the synchronization semaphore. */ - if ((method_desc->method.concurrency == 1) && - (!method_desc->method.semaphore)) { - status = acpi_os_create_semaphore(1, 1, - &method_desc->method. - semaphore); + if ((method_desc->method.method_flags & AML_METHOD_SERIALIZED) + && (!method_desc->method.mutex)) { + status = acpi_ds_create_method_mutex(method_desc); } /* No more threads, we can free the owner_id */ @@ -599,144 +684,5 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, acpi_ut_release_owner_id(&method_desc->method.owner_id); } - exit: - (void)acpi_ut_release_mutex(ACPI_MTX_CONTROL_METHOD); return_VOID; } - -#ifdef ACPI_INIT_PARSE_METHODS - /* - * Note 11/2005: Removed this code to parse all methods during table - * load because it causes problems if there are any errors during the - * parse. Also, it seems like overkill and we probably don't want to - * abort a table load because of an issue with a single method. - */ - -/******************************************************************************* - * - * FUNCTION: acpi_ds_parse_method - * - * PARAMETERS: Node - Method node - * - * RETURN: Status - * - * DESCRIPTION: Parse the AML that is associated with the method. - * - * MUTEX: Assumes parser is locked - * - ******************************************************************************/ - -acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) -{ - acpi_status status; - union acpi_operand_object *obj_desc; - union acpi_parse_object *op; - struct acpi_walk_state *walk_state; - - ACPI_FUNCTION_TRACE_PTR(ds_parse_method, node); - - /* Parameter Validation */ - - if (!node) { - return_ACPI_STATUS(AE_NULL_ENTRY); - } - - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "**** Parsing [%4.4s] **** NamedObj=%p\n", - acpi_ut_get_node_name(node), node)); - - /* Extract the method object from the method Node */ - - obj_desc = acpi_ns_get_attached_object(node); - if (!obj_desc) { - return_ACPI_STATUS(AE_NULL_OBJECT); - } - - /* Create a mutex for the method if there is a concurrency limit */ - - if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) && - (!obj_desc->method.semaphore)) { - status = acpi_os_create_semaphore(obj_desc->method.concurrency, - obj_desc->method.concurrency, - &obj_desc->method.semaphore); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - } - - /* - * Allocate a new parser op to be the root of the parsed - * method tree - */ - op = acpi_ps_alloc_op(AML_METHOD_OP); - if (!op) { - return_ACPI_STATUS(AE_NO_MEMORY); - } - - /* Init new op with the method name and pointer back to the Node */ - - acpi_ps_set_name(op, node->name.integer); - op->common.node = node; - - /* - * Get a new owner_id for objects created by this method. Namespace - * objects (such as Operation Regions) can be created during the - * first pass parse. - */ - status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); - if (ACPI_FAILURE(status)) { - goto cleanup; - } - - /* Create and initialize a new walk state */ - - walk_state = - acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL, - NULL); - if (!walk_state) { - status = AE_NO_MEMORY; - goto cleanup2; - } - - status = acpi_ds_init_aml_walk(walk_state, op, node, - obj_desc->method.aml_start, - obj_desc->method.aml_length, NULL, 1); - if (ACPI_FAILURE(status)) { - acpi_ds_delete_walk_state(walk_state); - goto cleanup2; - } - - /* - * Parse the method, first pass - * - * The first pass load is where newly declared named objects are added into - * the namespace. Actual evaluation of the named objects (what would be - * called a "second pass") happens during the actual execution of the - * method so that operands to the named objects can take on dynamic - * run-time values. - */ - status = acpi_ps_parse_aml(walk_state); - if (ACPI_FAILURE(status)) { - goto cleanup2; - } - - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, - "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", - acpi_ut_get_node_name(node), node, op)); - - /* - * Delete the parse tree. We simply re-parse the method for every - * execution since there isn't much overhead (compared to keeping lots - * of parse trees around) - */ - acpi_ns_delete_namespace_subtree(node); - acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id); - - cleanup2: - acpi_ut_release_owner_id(&obj_desc->method.owner_id); - - cleanup: - acpi_ps_delete_parse_tree(op); - return_ACPI_STATUS(status); -} -#endif diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index 3acbd9145d7..b1ded62d0df 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c @@ -472,7 +472,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) acpi_ds_result_push(walk_state->result_obj, walk_state); } - break; default: @@ -510,6 +509,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Method Reference in a Package, Op=%p\n", op)); + op->common.node = (struct acpi_namespace_node *)op->asl.value. arg->asl.node->object; @@ -670,7 +670,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) status = acpi_ds_result_stack_pop(walk_state); } - break; case AML_TYPE_UNDEFINED: @@ -708,7 +707,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) * Check if we just completed the evaluation of a * conditional predicate */ - if ((ACPI_SUCCESS(status)) && (walk_state->control_state) && (walk_state->control_state->common.state == diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 35074399c61..e3ca7f6539c 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c @@ -175,7 +175,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, if (status == AE_NOT_FOUND) { /* * Table disassembly: - * Target of Scope() not found. Generate an External for it, and + * Target of Scope() not found. Generate an External for it, and * insert the name into the namespace. */ acpi_dm_add_to_external_list(path, ACPI_TYPE_DEVICE, 0); @@ -210,16 +210,15 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, case ACPI_TYPE_BUFFER: /* - * These types we will allow, but we will change the type. This + * These types we will allow, but we will change the type. This * enables some existing code of the form: * * Name (DEB, 0) * Scope (DEB) { ... } * - * Note: silently change the type here. On the second pass, we will report + * Note: silently change the type here. On the second pass, we will report * a warning */ - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", path, @@ -242,7 +241,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, break; default: - /* * For all other named opcodes, we will enter the name into * the namespace. @@ -259,7 +257,6 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, * buffer_field, or Package), the name of the object is already * in the namespace. */ - if (walk_state->deferred_node) { /* This name is already in the namespace, get the node */ @@ -293,8 +290,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, } /* - * Enter the named type into the internal namespace. We enter the name - * as we go downward in the parse tree. Any necessary subobjects that + * Enter the named type into the internal namespace. We enter the name + * as we go downward in the parse tree. Any necessary subobjects that * involve arguments to the opcode must be created as we go back up the * parse tree later. */ @@ -327,12 +324,12 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, (status); } } + status = AE_OK; } } if (ACPI_FAILURE(status)) { - ACPI_ERROR_NAMESPACE(path, status); return_ACPI_STATUS(status); } @@ -434,9 +431,13 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) status = acpi_ex_create_region(op->named.data, op->named.length, - (acpi_adr_space_type) - ((op->common.value.arg)-> - common.value.integer), + (acpi_adr_space_type) ((op-> + common. + value. + arg)-> + common. + value. + integer), walk_state); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); @@ -474,7 +475,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) * method_op pkg_length name_string method_flags term_list * * Note: We must create the method node/object pair as soon as we - * see the method declaration. This allows later pass1 parsing + * see the method declaration. This allows later pass1 parsing * of invocations of the method (need to know the number of * arguments.) */ @@ -499,6 +500,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) length, walk_state); } + walk_state->operands[0] = NULL; walk_state->num_operands = 0; @@ -570,7 +572,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, #ifdef ACPI_ENABLE_MODULE_LEVEL_CODE if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || (walk_state->op_info->class == AML_CLASS_CONTROL)) { - ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Begin/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name, @@ -602,7 +603,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, } else { /* Get name from the op */ - buffer_ptr = (char *)&op->named.name; + buffer_ptr = ACPI_CAST_PTR(char, &op->named.name); } } else { /* Get the namestring from the raw AML */ @@ -629,7 +630,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, break; case AML_INT_NAMEPATH_OP: - /* * The name_path is an object reference to an existing object. * Don't enter the name into the namespace, but look it up @@ -642,7 +642,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, break; case AML_SCOPE_OP: - /* * The Path is an object reference to an existing object. * Don't enter the name into the namespace, but look it up @@ -664,6 +663,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, #endif return_ACPI_STATUS(status); } + /* * We must check to make sure that the target is * one of the opcodes that actually opens a scope @@ -683,13 +683,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, case ACPI_TYPE_BUFFER: /* - * These types we will allow, but we will change the type. This + * These types we will allow, but we will change the type. This * enables some existing code of the form: * * Name (DEB, 0) * Scope (DEB) { ... } */ - ACPI_WARNING((AE_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)", buffer_ptr, @@ -729,14 +728,14 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - } + return_ACPI_STATUS(AE_OK); } /* - * Enter the named type into the internal namespace. We enter the name - * as we go downward in the parse tree. Any necessary subobjects that + * Enter the named type into the internal namespace. We enter the name + * as we go downward in the parse tree. Any necessary subobjects that * involve arguments to the opcode must be created as we go back up the * parse tree later. * @@ -787,7 +786,6 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, * can get it again quickly when this scope is closed */ op->common.node = node; - return_ACPI_STATUS(status); } @@ -922,7 +920,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) #ifndef ACPI_NO_METHOD_EXECUTION case AML_TYPE_CREATE_FIELD: - /* * Create the field object, but the field buffer and index must * be evaluated later during the execution phase @@ -931,7 +928,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) break; case AML_TYPE_NAMED_FIELD: - /* * If we are executing a method, initialize the field */ @@ -1051,6 +1047,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) * argument is the space_id. (We must save the address of the * AML of the address and length operands) */ + /* * If we have a valid region, initialize it * Namespace is NOT locked at this point. @@ -1080,7 +1077,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) * method_op pkg_length name_string method_flags term_list * * Note: We must create the method node/object pair as soon as we - * see the method declaration. This allows later pass1 parsing + * see the method declaration. This allows later pass1 parsing * of invocations of the method (need to know the number of * arguments.) */ diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c new file mode 100644 index 00000000000..510a9452429 --- /dev/null +++ b/drivers/acpi/dock.c @@ -0,0 +1,739 @@ +/* + * dock.c - ACPI dock station driver + * + * Copyright (C) 2006 Kristen Carlson Accardi <kristen.c.accardi@intel.com> + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/types.h> +#include <linux/notifier.h> +#include <acpi/acpi_bus.h> +#include <acpi/acpi_drivers.h> + +#define ACPI_DOCK_DRIVER_NAME "ACPI Dock Station Driver" + +ACPI_MODULE_NAME("dock") +MODULE_AUTHOR("Kristen Carlson Accardi"); +MODULE_DESCRIPTION(ACPI_DOCK_DRIVER_NAME); +MODULE_LICENSE("GPL"); + +static struct atomic_notifier_head dock_notifier_list; + +struct dock_station { + acpi_handle handle; + unsigned long last_dock_time; + u32 flags; + spinlock_t dd_lock; + spinlock_t hp_lock; + struct list_head dependent_devices; + struct list_head hotplug_devices; +}; + +struct dock_dependent_device { + struct list_head list; + struct list_head hotplug_list; + acpi_handle handle; + acpi_notify_handler handler; + void *context; +}; + +#define DOCK_DOCKING 0x00000001 +#define DOCK_EVENT KOBJ_DOCK +#define UNDOCK_EVENT KOBJ_UNDOCK + +static struct dock_station *dock_station; + +/***************************************************************************** + * Dock Dependent device functions * + *****************************************************************************/ +/** + * alloc_dock_dependent_device - allocate and init a dependent device + * @handle: the acpi_handle of the dependent device + * + * Allocate memory for a dependent device structure for a device referenced + * by the acpi handle + */ +static struct dock_dependent_device * +alloc_dock_dependent_device(acpi_handle handle) +{ + struct dock_dependent_device *dd; + + dd = kzalloc(sizeof(*dd), GFP_KERNEL); + if (dd) { + dd->handle = handle; + INIT_LIST_HEAD(&dd->list); + INIT_LIST_HEAD(&dd->hotplug_list); + } + return dd; +} + +/** + * add_dock_dependent_device - associate a device with the dock station + * @ds: The dock station + * @dd: The dependent device + * + * Add the dependent device to the dock's dependent device list. + */ +static void +add_dock_dependent_device(struct dock_station *ds, + struct dock_dependent_device *dd) +{ + spin_lock(&ds->dd_lock); + list_add_tail(&dd->list, &ds->dependent_devices); + spin_unlock(&ds->dd_lock); +} + +/** + * dock_add_hotplug_device - associate a hotplug handler with the dock station + * @ds: The dock station + * @dd: The dependent device struct + * + * Add the dependent device to the dock's hotplug device list + */ +static void +dock_add_hotplug_device(struct dock_station *ds, + struct dock_dependent_device *dd) +{ + spin_lock(&ds->hp_lock); + list_add_tail(&dd->hotplug_list, &ds->hotplug_devices); + spin_unlock(&ds->hp_lock); +} + +/** + * dock_del_hotplug_device - remove a hotplug handler from the dock station + * @ds: The dock station + * @dd: the dependent device struct + * + * Delete the dependent device from the dock's hotplug device list + */ +static void +dock_del_hotplug_device(struct dock_station *ds, + struct dock_dependent_device *dd) +{ + spin_lock(&ds->hp_lock); + list_del(&dd->hotplug_list); + spin_unlock(&ds->hp_lock); +} + +/** + * find_dock_dependent_device - get a device dependent on this dock + * @ds: the dock station + * @handle: the acpi_handle of the device we want + * + * iterate over the dependent device list for this dock. If the + * dependent device matches the handle, return. + */ +static struct dock_dependent_device * +find_dock_dependent_device(struct dock_station *ds, acpi_handle handle) +{ + struct dock_dependent_device *dd; + + spin_lock(&ds->dd_lock); + list_for_each_entry(dd, &ds->dependent_devices, list) { + if (handle == dd->handle) { + spin_unlock(&ds->dd_lock); + return dd; + } + } + spin_unlock(&ds->dd_lock); + return NULL; +} + +/***************************************************************************** + * Dock functions * + *****************************************************************************/ +/** + * is_dock - see if a device is a dock station + * @handle: acpi handle of the device + * + * If an acpi object has a _DCK method, then it is by definition a dock + * station, so return true. + */ +static int is_dock(acpi_handle handle) +{ + acpi_status status; + acpi_handle tmp; + + status = acpi_get_handle(handle, "_DCK", &tmp); + if (ACPI_FAILURE(status)) + return 0; + return 1; +} + +/** + * is_dock_device - see if a device is on a dock station + * @handle: acpi handle of the device + * + * If this device is either the dock station itself, + * or is a device dependent on the dock station, then it + * is a dock device + */ +int is_dock_device(acpi_handle handle) +{ + if (!dock_station) + return 0; + + if (is_dock(handle) || find_dock_dependent_device(dock_station, handle)) + return 1; + + return 0; +} + +EXPORT_SYMBOL_GPL(is_dock_device); + +/** + * dock_present - see if the dock station is present. + * @ds: the dock station + * + * execute the _STA method. note that present does not + * imply that we are docked. + */ +static int dock_present(struct dock_station *ds) +{ + unsigned long sta; + acpi_status status; + + if (ds) { + status = acpi_evaluate_integer(ds->handle, "_STA", NULL, &sta); + if (ACPI_SUCCESS(status) && sta) + return 1; + } + return 0; +} + + + +/** + * dock_create_acpi_device - add new devices to acpi + * @handle - handle of the device to add + * + * This function will create a new acpi_device for the given + * handle if one does not exist already. This should cause + * acpi to scan for drivers for the given devices, and call + * matching driver's add routine. + * + * Returns a pointer to the acpi_device corresponding to the handle. + */ +static struct acpi_device * dock_create_acpi_device(acpi_handle handle) +{ + struct acpi_device *device = NULL; + struct acpi_device *parent_device; + acpi_handle parent; + int ret; + + if (acpi_bus_get_device(handle, &device)) { + /* + * no device created for this object, + * so we should create one. + */ + acpi_get_parent(handle, &parent); + if (acpi_bus_get_device(parent, &parent_device)) + parent_device = NULL; + + ret = acpi_bus_add(&device, parent_device, handle, + ACPI_BUS_TYPE_DEVICE); + if (ret) { + pr_debug("error adding bus, %x\n", + -ret); + return NULL; + } + } + return device; +} + +/** + * dock_remove_acpi_device - remove the acpi_device struct from acpi + * @handle - the handle of the device to remove + * + * Tell acpi to remove the acpi_device. This should cause any loaded + * driver to have it's remove routine called. + */ +static void dock_remove_acpi_device(acpi_handle handle) +{ + struct acpi_device *device; + int ret; + + if (!acpi_bus_get_device(handle, &device)) { + ret = acpi_bus_trim(device, 1); + if (ret) + pr_debug("error removing bus, %x\n", -ret); + } +} + + +/** + * hotplug_dock_devices - insert or remove devices on the dock station + * @ds: the dock station + * @event: either bus check or eject request + * + * Some devices on the dock station need to have drivers called + * to perform hotplug operations after a dock event has occurred. + * Traverse the list of dock devices that have registered a + * hotplug handler, and call the handler. + */ +static void hotplug_dock_devices(struct dock_station *ds, u32 event) +{ + struct dock_dependent_device *dd; + + spin_lock(&ds->hp_lock); + + /* + * First call driver specific hotplug functions + */ + list_for_each_entry(dd, &ds->hotplug_devices, hotplug_list) { + if (dd->handler) + dd->handler(dd->handle, event, dd->context); + } + + /* + * Now make sure that an acpi_device is created for each + * dependent device, or removed if this is an eject request. + * This will cause acpi_drivers to be stopped/started if they + * exist + */ + list_for_each_entry(dd, &ds->dependent_devices, list) { + if (event == ACPI_NOTIFY_EJECT_REQUEST) + dock_remove_acpi_device(dd->handle); + else + dock_create_acpi_device(dd->handle); + } + spin_unlock(&ds->hp_lock); +} + +static void dock_event(struct dock_station *ds, u32 event, int num) +{ + struct acpi_device *device; + + device = dock_create_acpi_device(ds->handle); + if (device) + kobject_uevent(&device->kobj, num); +} + +/** + * eject_dock - respond to a dock eject request + * @ds: the dock station + * + * This is called after _DCK is called, to execute the dock station's + * _EJ0 method. + */ +static void eject_dock(struct dock_station *ds) +{ + struct acpi_object_list arg_list; + union acpi_object arg; + acpi_status status; + acpi_handle tmp; + + /* all dock devices should have _EJ0, but check anyway */ + status = acpi_get_handle(ds->handle, "_EJ0", &tmp); + if (ACPI_FAILURE(status)) { + pr_debug("No _EJ0 support for dock device\n"); + return; + } + + arg_list.count = 1; + arg_list.pointer = &arg; + arg.type = ACPI_TYPE_INTEGER; + arg.integer.value = 1; + + if (ACPI_FAILURE(acpi_evaluate_object(ds->handle, "_EJ0", + &arg_list, NULL))) + pr_debug("Failed to evaluate _EJ0!\n"); +} + +/** + * handle_dock - handle a dock event + * @ds: the dock station + * @dock: to dock, or undock - that is the question + * + * Execute the _DCK method in response to an acpi event + */ +static void handle_dock(struct dock_station *ds, int dock) +{ + acpi_status status; + struct acpi_object_list arg_list; + union acpi_object arg; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + union acpi_object *obj; + + acpi_get_name(ds->handle, ACPI_FULL_PATHNAME, &name_buffer); + obj = name_buffer.pointer; + + printk(KERN_INFO PREFIX "%s\n", dock ? "docking" : "undocking"); + + /* _DCK method has one argument */ + arg_list.count = 1; + arg_list.pointer = &arg; + arg.type = ACPI_TYPE_INTEGER; + arg.integer.value = dock; + status = acpi_evaluate_object(ds->handle, "_DCK", &arg_list, &buffer); + if (ACPI_FAILURE(status)) + pr_debug("%s: failed to execute _DCK\n", obj->string.pointer); + kfree(buffer.pointer); + kfree(name_buffer.pointer); +} + +static inline void dock(struct dock_station *ds) +{ + handle_dock(ds, 1); +} + +static inline void undock(struct dock_station *ds) +{ + handle_dock(ds, 0); +} + +static inline void begin_dock(struct dock_station *ds) +{ + ds->flags |= DOCK_DOCKING; +} + +static inline void complete_dock(struct dock_station *ds) +{ + ds->flags &= ~(DOCK_DOCKING); + ds->last_dock_time = jiffies; +} + +/** + * dock_in_progress - see if we are in the middle of handling a dock event + * @ds: the dock station + * + * Sometimes while docking, false dock events can be sent to the driver + * because good connections aren't made or some other reason. Ignore these + * if we are in the middle of doing something. + */ +static int dock_in_progress(struct dock_station *ds) +{ + if ((ds->flags & DOCK_DOCKING) || + time_before(jiffies, (ds->last_dock_time + HZ))) + return 1; + return 0; +} + +/** + * register_dock_notifier - add yourself to the dock notifier list + * @nb: the callers notifier block + * + * If a driver wishes to be notified about dock events, they can + * use this function to put a notifier block on the dock notifier list. + * this notifier call chain will be called after a dock event, but + * before hotplugging any new devices. + */ +int register_dock_notifier(struct notifier_block *nb) +{ + return atomic_notifier_chain_register(&dock_notifier_list, nb); +} + +EXPORT_SYMBOL_GPL(register_dock_notifier); + +/** + * unregister_dock_notifier - remove yourself from the dock notifier list + * @nb: the callers notifier block + */ +void unregister_dock_notifier(struct notifier_block *nb) +{ + atomic_notifier_chain_unregister(&dock_notifier_list, nb); +} + +EXPORT_SYMBOL_GPL(unregister_dock_notifier); + +/** + * register_hotplug_dock_device - register a hotplug function + * @handle: the handle of the device + * @handler: the acpi_notifier_handler to call after docking + * @context: device specific data + * + * If a driver would like to perform a hotplug operation after a dock + * event, they can register an acpi_notifiy_handler to be called by + * the dock driver after _DCK is executed. + */ +int +register_hotplug_dock_device(acpi_handle handle, acpi_notify_handler handler, + void *context) +{ + struct dock_dependent_device *dd; + + if (!dock_station) + return -ENODEV; + + /* + * make sure this handle is for a device dependent on the dock, + * this would include the dock station itself + */ + dd = find_dock_dependent_device(dock_station, handle); + if (dd) { + dd->handler = handler; + dd->context = context; + dock_add_hotplug_device(dock_station, dd); + return 0; + } + + return -EINVAL; +} + +EXPORT_SYMBOL_GPL(register_hotplug_dock_device); + +/** + * unregister_hotplug_dock_device - remove yourself from the hotplug list + * @handle: the acpi handle of the device + */ +void unregister_hotplug_dock_device(acpi_handle handle) +{ + struct dock_dependent_device *dd; + + if (!dock_station) + return; + + dd = find_dock_dependent_device(dock_station, handle); + if (dd) + dock_del_hotplug_device(dock_station, dd); +} + +EXPORT_SYMBOL_GPL(unregister_hotplug_dock_device); + +/** + * dock_notify - act upon an acpi dock notification + * @handle: the dock station handle + * @event: the acpi event + * @data: our driver data struct + * + * If we are notified to dock, then check to see if the dock is + * present and then dock. Notify all drivers of the dock event, + * and then hotplug and devices that may need hotplugging. For undock + * check to make sure the dock device is still present, then undock + * and hotremove all the devices that may need removing. + */ +static void dock_notify(acpi_handle handle, u32 event, void *data) +{ + struct dock_station *ds = (struct dock_station *)data; + + switch (event) { + case ACPI_NOTIFY_BUS_CHECK: + if (!dock_in_progress(ds) && dock_present(ds)) { + begin_dock(ds); + dock(ds); + if (!dock_present(ds)) { + printk(KERN_ERR PREFIX "Unable to dock!\n"); + break; + } + atomic_notifier_call_chain(&dock_notifier_list, + event, NULL); + hotplug_dock_devices(ds, event); + complete_dock(ds); + dock_event(ds, event, DOCK_EVENT); + } + break; + case ACPI_NOTIFY_DEVICE_CHECK: + /* + * According to acpi spec 3.0a, if a DEVICE_CHECK notification + * is sent and _DCK is present, it is assumed to mean an + * undock request. This notify routine will only be called + * for objects defining _DCK, so we will fall through to eject + * request here. However, we will pass an eject request through + * to the driver who wish to hotplug. + */ + case ACPI_NOTIFY_EJECT_REQUEST: + if (!dock_in_progress(ds) && dock_present(ds)) { + /* + * here we need to generate the undock + * event prior to actually doing the undock + * so that the device struct still exists. + */ + dock_event(ds, event, UNDOCK_EVENT); + hotplug_dock_devices(ds, ACPI_NOTIFY_EJECT_REQUEST); + undock(ds); + eject_dock(ds); + if (dock_present(ds)) + printk(KERN_ERR PREFIX "Unable to undock!\n"); + } + break; + default: + printk(KERN_ERR PREFIX "Unknown dock event %d\n", event); + } +} + +/** + * find_dock_devices - find devices on the dock station + * @handle: the handle of the device we are examining + * @lvl: unused + * @context: the dock station private data + * @rv: unused + * + * This function is called by acpi_walk_namespace. It will + * check to see if an object has an _EJD method. If it does, then it + * will see if it is dependent on the dock station. + */ +static acpi_status +find_dock_devices(acpi_handle handle, u32 lvl, void *context, void **rv) +{ + acpi_status status; + acpi_handle tmp; + struct dock_station *ds = (struct dock_station *)context; + struct dock_dependent_device *dd; + + status = acpi_bus_get_ejd(handle, &tmp); + if (ACPI_FAILURE(status)) + return AE_OK; + + if (tmp == ds->handle) { + dd = alloc_dock_dependent_device(handle); + if (dd) + add_dock_dependent_device(ds, dd); + } + + return AE_OK; +} + +/** + * dock_add - add a new dock station + * @handle: the dock station handle + * + * allocated and initialize a new dock station device. Find all devices + * that are on the dock station, and register for dock event notifications. + */ +static int dock_add(acpi_handle handle) +{ + int ret; + acpi_status status; + struct dock_dependent_device *dd; + + /* allocate & initialize the dock_station private data */ + dock_station = kzalloc(sizeof(*dock_station), GFP_KERNEL); + if (!dock_station) + return -ENOMEM; + dock_station->handle = handle; + dock_station->last_dock_time = jiffies - HZ; + INIT_LIST_HEAD(&dock_station->dependent_devices); + INIT_LIST_HEAD(&dock_station->hotplug_devices); + spin_lock_init(&dock_station->dd_lock); + spin_lock_init(&dock_station->hp_lock); + + /* Find dependent devices */ + acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, find_dock_devices, dock_station, + NULL); + + /* add the dock station as a device dependent on itself */ + dd = alloc_dock_dependent_device(handle); + if (!dd) { + kfree(dock_station); + return -ENOMEM; + } + add_dock_dependent_device(dock_station, dd); + + /* register for dock events */ + status = acpi_install_notify_handler(dock_station->handle, + ACPI_SYSTEM_NOTIFY, + dock_notify, dock_station); + + if (ACPI_FAILURE(status)) { + printk(KERN_ERR PREFIX "Error installing notify handler\n"); + ret = -ENODEV; + goto dock_add_err; + } + + printk(KERN_INFO PREFIX "%s \n", ACPI_DOCK_DRIVER_NAME); + + return 0; + +dock_add_err: + kfree(dock_station); + kfree(dd); + return ret; +} + +/** + * dock_remove - free up resources related to the dock station + */ +static int dock_remove(void) +{ + struct dock_dependent_device *dd, *tmp; + acpi_status status; + + if (!dock_station) + return 0; + + /* remove dependent devices */ + list_for_each_entry_safe(dd, tmp, &dock_station->dependent_devices, + list) + kfree(dd); + + /* remove dock notify handler */ + status = acpi_remove_notify_handler(dock_station->handle, + ACPI_SYSTEM_NOTIFY, + dock_notify); + if (ACPI_FAILURE(status)) + printk(KERN_ERR "Error removing notify handler\n"); + + /* free dock station memory */ + kfree(dock_station); + return 0; +} + +/** + * find_dock - look for a dock station + * @handle: acpi handle of a device + * @lvl: unused + * @context: counter of dock stations found + * @rv: unused + * + * This is called by acpi_walk_namespace to look for dock stations. + */ +static acpi_status +find_dock(acpi_handle handle, u32 lvl, void *context, void **rv) +{ + int *count = (int *)context; + acpi_status status = AE_OK; + + if (is_dock(handle)) { + if (dock_add(handle) >= 0) { + (*count)++; + status = AE_CTRL_TERMINATE; + } + } + return status; +} + +static int __init dock_init(void) +{ + int num = 0; + + dock_station = NULL; + + /* look for a dock station */ + acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, find_dock, &num, NULL); + + if (!num) + return -ENODEV; + + return 0; +} + +static void __exit dock_exit(void) +{ + dock_remove(); +} + +postcore_initcall(dock_init); +module_exit(dock_exit); diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 18b3ea9dace..8c5d7df7d34 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -207,16 +207,15 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_ec_wait"); ec->intr.expect_event = event; smp_mb(); switch (event) { case ACPI_EC_EVENT_IBE: - if (~acpi_ec_read_status(ec) & event) { + if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) { ec->intr.expect_event = 0; - return_VALUE(0); + return 0; } break; default: @@ -238,16 +237,16 @@ static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) switch (event) { case ACPI_EC_EVENT_OBF: if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF) - return_VALUE(0); + return 0; break; case ACPI_EC_EVENT_IBE: if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) - return_VALUE(0); + return 0; break; } - return_VALUE(-ETIME); + return -ETIME; } #ifdef ACPI_FUTURE_USAGE @@ -260,7 +259,6 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec) u32 tmp = 0; int status = 0; - ACPI_FUNCTION_TRACE("acpi_ec_enter_burst_mode"); status = acpi_ec_read_status(ec); if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) { @@ -272,22 +270,21 @@ int acpi_ec_enter_burst_mode(union acpi_ec *ec) status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); if (tmp != 0x90) { /* Burst ACK byte */ - return_VALUE(-EINVAL); + return -EINVAL; } } atomic_set(&ec->intr.leaving_burst, 0); - return_VALUE(0); + return 0; end: - printk(KERN_WARNING PREFIX "Error in acpi_ec_wait\n"); - return_VALUE(-1); + ACPI_EXCEPTION ((AE_INFO, status, "EC wait, burst mode"); + return -1; } int acpi_ec_leave_burst_mode(union acpi_ec *ec) { int status = 0; - ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); status = acpi_ec_read_status(ec); if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){ @@ -298,10 +295,10 @@ int acpi_ec_leave_burst_mode(union acpi_ec *ec) acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); } atomic_set(&ec->intr.leaving_burst, 1); - return_VALUE(0); + return 0; end: - printk(KERN_WARNING PREFIX "leave burst_mode:error\n"); - return_VALUE(-1); + ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode"); + return -1; } #endif /* ACPI_FUTURE_USAGE */ @@ -325,17 +322,16 @@ static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) int result = 0; u32 glk = 0; - ACPI_FUNCTION_TRACE("acpi_ec_read"); if (!ec || !data) - return_VALUE(-EINVAL); + return -EINVAL; *data = 0; if (ec->common.global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; } if (down_interruptible(&ec->poll.sem)) { @@ -365,7 +361,7 @@ end_nosem: if (ec->common.global_lock) acpi_release_global_lock(glk); - return_VALUE(result); + return result; } static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) @@ -374,15 +370,14 @@ static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) acpi_status status = AE_OK; u32 glk = 0; - ACPI_FUNCTION_TRACE("acpi_ec_write"); if (!ec) - return_VALUE(-EINVAL); + return -EINVAL; if (ec->common.global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; } if (down_interruptible(&ec->poll.sem)) { @@ -415,7 +410,7 @@ end_nosem: if (ec->common.global_lock) acpi_release_global_lock(glk); - return_VALUE(result); + return result; } static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) @@ -423,17 +418,16 @@ static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) int status = 0; u32 glk; - ACPI_FUNCTION_TRACE("acpi_ec_read"); if (!ec || !data) - return_VALUE(-EINVAL); + return -EINVAL; *data = 0; if (ec->common.global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; } WARN_ON(in_interrupt()); @@ -467,7 +461,7 @@ static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) if (ec->common.global_lock) acpi_release_global_lock(glk); - return_VALUE(status); + return status; } static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) @@ -475,15 +469,14 @@ static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) int status = 0; u32 glk; - ACPI_FUNCTION_TRACE("acpi_ec_write"); if (!ec) - return_VALUE(-EINVAL); + return -EINVAL; if (ec->common.global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; } WARN_ON(in_interrupt()); @@ -516,7 +509,7 @@ static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) if (ec->common.global_lock) acpi_release_global_lock(glk); - return_VALUE(status); + return status; } /* @@ -574,17 +567,16 @@ static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data) acpi_status status = AE_OK; u32 glk = 0; - ACPI_FUNCTION_TRACE("acpi_ec_query"); if (!ec || !data) - return_VALUE(-EINVAL); + return -EINVAL; *data = 0; if (ec->common.global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; } /* @@ -613,23 +605,22 @@ end_nosem: if (ec->common.global_lock) acpi_release_global_lock(glk); - return_VALUE(result); + return result; } static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) { int status = 0; u32 glk; - ACPI_FUNCTION_TRACE("acpi_ec_query"); if (!ec || !data) - return_VALUE(-EINVAL); + return -EINVAL; *data = 0; if (ec->common.global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; } down(&ec->intr.sem); @@ -662,7 +653,7 @@ static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) if (ec->common.global_lock) acpi_release_global_lock(glk); - return_VALUE(status); + return status; } /* -------------------------------------------------------------------------- @@ -691,13 +682,12 @@ static void acpi_ec_gpe_poll_query(void *ec_cxt) '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); if (!ec_cxt) goto end; if (down_interruptible (&ec->poll.sem)) { - return_VOID; + return; } acpi_hw_low_level_read(8, &value, &ec->common.command_addr); up(&ec->poll.sem); @@ -734,7 +724,6 @@ static void acpi_ec_gpe_intr_query(void *ec_cxt) '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) result = acpi_ec_query(ec, &value); @@ -793,12 +782,15 @@ static u32 acpi_ec_gpe_intr_handler(void *data) case ACPI_EC_EVENT_OBF: if (!(value & ACPI_EC_FLAG_OBF)) break; + ec->intr.expect_event = 0; + wake_up(&ec->intr.wait); + break; case ACPI_EC_EVENT_IBE: if ((value & ACPI_EC_FLAG_IBF)) break; ec->intr.expect_event = 0; wake_up(&ec->intr.wait); - return ACPI_INTERRUPT_HANDLED; + break; default: break; } @@ -846,15 +838,14 @@ acpi_ec_space_handler(u32 function, acpi_integer f_v = 0; int i = 0; - ACPI_FUNCTION_TRACE("acpi_ec_space_handler"); if ((address > 0xFF) || !value || !handler_context) - return_VALUE(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; if (bit_width != 8 && acpi_strict) { printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n"); - return_VALUE(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; } ec = (union acpi_ec *)handler_context; @@ -893,16 +884,16 @@ acpi_ec_space_handler(u32 function, out: switch (result) { case -EINVAL: - return_VALUE(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; break; case -ENODEV: - return_VALUE(AE_NOT_FOUND); + return AE_NOT_FOUND; break; case -ETIME: - return_VALUE(AE_TIME); + return AE_TIME; break; default: - return_VALUE(AE_OK); + return AE_OK; } } @@ -916,7 +907,6 @@ static int acpi_ec_read_info(struct seq_file *seq, void *offset) { union acpi_ec *ec = (union acpi_ec *)seq->private; - ACPI_FUNCTION_TRACE("acpi_ec_read_info"); if (!ec) goto end; @@ -931,7 +921,7 @@ static int acpi_ec_read_info(struct seq_file *seq, void *offset) acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); end: - return_VALUE(0); + return 0; } static int acpi_ec_info_open_fs(struct inode *inode, struct file *file) @@ -951,33 +941,29 @@ static int acpi_ec_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_ec_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_ec_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; } entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to create '%s' fs entry\n", - ACPI_EC_FILE_INFO)); + return -ENODEV; else { entry->proc_fops = &acpi_ec_info_ops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_ec_remove_fs(struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_ec_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device)); @@ -985,7 +971,7 @@ static int acpi_ec_remove_fs(struct acpi_device *device) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -998,14 +984,13 @@ static int acpi_ec_poll_add(struct acpi_device *device) acpi_status status = AE_OK; union acpi_ec *ec = NULL; - ACPI_FUNCTION_TRACE("acpi_ec_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); if (!ec) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(ec, 0, sizeof(union acpi_ec)); ec->common.handle = device->handle; @@ -1038,8 +1023,7 @@ static int acpi_ec_poll_add(struct acpi_device *device) acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error obtaining GPE bit assignment\n")); + ACPI_EXCEPTION((AE_INFO, status, "Obtaining GPE bit")); result = -ENODEV; goto end; } @@ -1059,7 +1043,7 @@ static int acpi_ec_poll_add(struct acpi_device *device) if (result) kfree(ec); - return_VALUE(result); + return result; } static int acpi_ec_intr_add(struct acpi_device *device) { @@ -1067,14 +1051,13 @@ static int acpi_ec_intr_add(struct acpi_device *device) acpi_status status = AE_OK; union acpi_ec *ec = NULL; - ACPI_FUNCTION_TRACE("acpi_ec_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); if (!ec) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(ec, 0, sizeof(union acpi_ec)); ec->common.handle = device->handle; @@ -1110,8 +1093,7 @@ static int acpi_ec_intr_add(struct acpi_device *device) acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error obtaining GPE bit assignment\n")); + printk(KERN_ERR PREFIX "Obtaining GPE bit assignment\n"); result = -ENODEV; goto end; } @@ -1131,17 +1113,16 @@ static int acpi_ec_intr_add(struct acpi_device *device) if (result) kfree(ec); - return_VALUE(result); + return result; } static int acpi_ec_remove(struct acpi_device *device, int type) { union acpi_ec *ec = NULL; - ACPI_FUNCTION_TRACE("acpi_ec_remove"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; ec = acpi_driver_data(device); @@ -1149,7 +1130,7 @@ static int acpi_ec_remove(struct acpi_device *device, int type) kfree(ec); - return_VALUE(0); + return 0; } static acpi_status @@ -1188,15 +1169,14 @@ static int acpi_ec_start(struct acpi_device *device) acpi_status status = AE_OK; union acpi_ec *ec = NULL; - ACPI_FUNCTION_TRACE("acpi_ec_start"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; ec = acpi_driver_data(device); if (!ec) - return_VALUE(-EINVAL); + return -EINVAL; /* * Get I/O port addresses. Convert to GAS format. @@ -1205,9 +1185,8 @@ static int acpi_ec_start(struct acpi_device *device) acpi_ec_io_ports, ec); if (ACPI_FAILURE(status) || ec->common.command_addr.register_bit_width == 0) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error getting I/O port addresses")); - return_VALUE(-ENODEV); + printk(KERN_ERR PREFIX "Error getting I/O port addresses\n"); + return -ENODEV; } ec->common.status_addr = ec->common.command_addr; @@ -1224,7 +1203,7 @@ static int acpi_ec_start(struct acpi_device *device) ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec); if (ACPI_FAILURE(status)) { - return_VALUE(-ENODEV); + return -ENODEV; } acpi_set_gpe_type(NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); @@ -1236,10 +1215,10 @@ static int acpi_ec_start(struct acpi_device *device) if (ACPI_FAILURE(status)) { acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(AE_OK); + return AE_OK; } static int acpi_ec_stop(struct acpi_device *device, int type) @@ -1247,10 +1226,9 @@ static int acpi_ec_stop(struct acpi_device *device, int type) acpi_status status = AE_OK; union acpi_ec *ec = NULL; - ACPI_FUNCTION_TRACE("acpi_ec_stop"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; ec = acpi_driver_data(device); @@ -1258,15 +1236,15 @@ static int acpi_ec_stop(struct acpi_device *device, int type) ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; status = acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; - return_VALUE(0); + return 0; } static acpi_status __init @@ -1536,23 +1514,22 @@ static int __init acpi_ec_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_ec_init"); if (acpi_disabled) - return_VALUE(0); + return 0; acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir); if (!acpi_ec_dir) - return_VALUE(-ENODEV); + return -ENODEV; /* Now register the driver for the EC */ result = acpi_bus_register_driver(&acpi_ec_driver); if (result < 0) { remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(result); + return result; } subsys_initcall(acpi_ec_init); @@ -1561,13 +1538,12 @@ subsys_initcall(acpi_ec_init); #if 0 static void __exit acpi_ec_exit(void) { - ACPI_FUNCTION_TRACE("acpi_ec_exit"); acpi_bus_unregister_driver(&acpi_ec_driver); remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir); - return_VOID; + return; } #endif /* 0 */ diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index 2dbb1b0f11d..a901b23e95e 100644 --- a/drivers/acpi/event.c +++ b/drivers/acpi/event.c @@ -48,18 +48,17 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count, static int chars_remaining = 0; static char *ptr; - ACPI_FUNCTION_TRACE("acpi_system_read_event"); if (!chars_remaining) { memset(&event, 0, sizeof(struct acpi_bus_event)); if ((file->f_flags & O_NONBLOCK) && (list_empty(&acpi_bus_event_list))) - return_VALUE(-EAGAIN); + return -EAGAIN; result = acpi_bus_receive_event(&event); if (result) - return_VALUE(result); + return result; chars_remaining = sprintf(str, "%s %s %08x %08x\n", event.device_class ? event. @@ -75,13 +74,13 @@ acpi_system_read_event(struct file *file, char __user * buffer, size_t count, } if (copy_to_user(buffer, ptr, count)) - return_VALUE(-EFAULT); + return -EFAULT; *ppos += count; chars_remaining -= count; ptr += count; - return_VALUE(count); + return count; } static int acpi_system_close_event(struct inode *inode, struct file *file) @@ -112,22 +111,18 @@ static int __init acpi_event_init(void) struct proc_dir_entry *entry; int error = 0; - ACPI_FUNCTION_TRACE("acpi_event_init"); if (acpi_disabled) - return_VALUE(0); + return 0; /* 'event' [R] */ entry = create_proc_entry("event", S_IRUSR, acpi_root_dir); if (entry) entry->proc_fops = &acpi_system_event_ops; else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' proc fs entry\n", - "event")); - error = -EFAULT; + error = -ENODEV; } - return_VALUE(error); + return error; } subsys_initcall(acpi_event_init); diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index f01d339407f..c76c0583ca6 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c @@ -382,7 +382,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) u32 status_reg; u32 enable_reg; acpi_cpu_flags flags; - acpi_cpu_flags hw_flags; acpi_native_uint i; acpi_native_uint j; @@ -394,8 +393,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) return (int_status); } - /* We need to hold the GPE lock now, hardware lock in the loop */ - + /* + * We need to obtain the GPE lock for both the data structs and registers + * Note: Not necessary to obtain the hardware lock, since the GPE registers + * are owned by the gpe_lock. + */ flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); /* Examine all GPE blocks attached to this interrupt level */ @@ -413,8 +415,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) gpe_register_info = &gpe_block->register_info[i]; - hw_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); - /* Read the Status Register */ status = @@ -423,8 +423,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) &gpe_register_info-> status_address); if (ACPI_FAILURE(status)) { - acpi_os_release_lock(acpi_gbl_hardware_lock, - hw_flags); goto unlock_and_exit; } @@ -435,8 +433,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) &enable_reg, &gpe_register_info-> enable_address); - acpi_os_release_lock(acpi_gbl_hardware_lock, hw_flags); - if (ACPI_FAILURE(status)) { goto unlock_and_exit; } diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 76c34a66e0e..4f948df17ab 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c @@ -414,12 +414,13 @@ acpi_remove_notify_handler(acpi_handle device, if ((!device) || (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { - return_ACPI_STATUS(AE_BAD_PARAMETER); + status = AE_BAD_PARAMETER; + goto exit; } status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Convert and validate the device handle */ @@ -427,7 +428,7 @@ acpi_remove_notify_handler(acpi_handle device, node = acpi_ns_map_handle_to_node(device); if (!node) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Root Object */ @@ -441,7 +442,7 @@ acpi_remove_notify_handler(acpi_handle device, ((handler_type & ACPI_DEVICE_NOTIFY) && !acpi_gbl_device_notify.handler)) { status = AE_NOT_EXIST; - goto unlock_and_exit; + goto unlock; } /* Make sure all deferred tasks are completed */ @@ -450,7 +451,7 @@ acpi_remove_notify_handler(acpi_handle device, acpi_os_wait_events_complete(NULL); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } if (handler_type & ACPI_SYSTEM_NOTIFY) { @@ -473,7 +474,7 @@ acpi_remove_notify_handler(acpi_handle device, if (!acpi_ev_is_notify_object(node)) { status = AE_TYPE; - goto unlock_and_exit; + goto unlock; } /* Check for an existing internal object */ @@ -481,7 +482,7 @@ acpi_remove_notify_handler(acpi_handle device, obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { status = AE_NOT_EXIST; - goto unlock_and_exit; + goto unlock; } /* Object exists - make sure there's an existing handler */ @@ -491,7 +492,7 @@ acpi_remove_notify_handler(acpi_handle device, if ((!notify_obj) || (notify_obj->notify.handler != handler)) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Make sure all deferred tasks are completed */ @@ -499,7 +500,7 @@ acpi_remove_notify_handler(acpi_handle device, acpi_os_wait_events_complete(NULL); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Remove the handler */ @@ -512,7 +513,7 @@ acpi_remove_notify_handler(acpi_handle device, if ((!notify_obj) || (notify_obj->notify.handler != handler)) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Make sure all deferred tasks are completed */ @@ -520,7 +521,7 @@ acpi_remove_notify_handler(acpi_handle device, acpi_os_wait_events_complete(NULL); status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Remove the handler */ @@ -529,8 +530,11 @@ acpi_remove_notify_handler(acpi_handle device, } } - unlock_and_exit: +unlock: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); +exit: + if (ACPI_FAILURE(status)) + ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler")); return_ACPI_STATUS(status); } @@ -568,12 +572,13 @@ acpi_install_gpe_handler(acpi_handle gpe_device, /* Parameter validation */ if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) { - return_ACPI_STATUS(AE_BAD_PARAMETER); + status = AE_BAD_PARAMETER; + goto exit; } status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); + goto exit; } /* Ensure that we have a valid GPE number */ @@ -581,7 +586,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); if (!gpe_event_info) { status = AE_BAD_PARAMETER; - goto unlock_and_exit; + goto unlock; } /* Make sure that there isn't a handler there already */ @@ -589,7 +594,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) { status = AE_ALREADY_EXISTS; - goto unlock_and_exit; + goto unlock; } /* Allocate and init handler object */ @@ -597,7 +602,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); if (!handler) { status = AE_NO_MEMORY; - goto unlock_and_exit; + goto unlock; } handler->address = address; @@ -608,7 +613,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, status = acpi_ev_disable_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { - goto unlock_and_exit; + goto unlock; } /* Install the handler */ @@ -623,8 +628,12 @@ acpi_install_gpe_handler(acpi_handle gpe_device, acpi_os_release_lock(acpi_gbl_gpe_lock, flags); - unlock_and_exit: +unlock: (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); +exit: + if (ACPI_FAILURE(status)) + ACPI_EXCEPTION((AE_INFO, status, + "Installing notify handler failed")); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 823352435e0..83fed079a27 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c @@ -266,6 +266,10 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, } } + ACPI_INFO((AE_INFO, + "Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]", + table->signature, table->oem_id, table->oem_table_id)); + *return_desc = ddb_handle; return_ACPI_STATUS(status); } @@ -446,6 +450,10 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, return_ACPI_STATUS(status); } + ACPI_INFO((AE_INFO, + "Dynamic SSDT Load - OemId [%6.6s] OemTableId [%8.8s]", + table_ptr->oem_id, table_ptr->oem_table_id)); + cleanup: if (ACPI_FAILURE(status)) { ACPI_FREE(table_ptr); diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 106dc7219df..34eec82c1b1 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c @@ -177,7 +177,7 @@ acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state) * that the event is created in an unsignalled state */ status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, - &obj_desc->event.semaphore); + &obj_desc->event.os_semaphore); if (ACPI_FAILURE(status)) { goto cleanup; } @@ -226,12 +226,9 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) goto cleanup; } - /* - * Create the actual OS semaphore. - * One unit max to make it a mutex, with one initial unit to allow - * the mutex to be acquired. - */ - status = acpi_os_create_semaphore(1, 1, &obj_desc->mutex.semaphore); + /* Create the actual OS Mutex */ + + status = acpi_os_create_mutex(&obj_desc->mutex.os_mutex); if (ACPI_FAILURE(status)) { goto cleanup; } @@ -565,7 +562,7 @@ acpi_ex_create_method(u8 * aml_start, obj_desc->method.aml_length = aml_length; /* - * Disassemble the method flags. Split off the Arg Count + * Disassemble the method flags. Split off the Arg Count * for efficiency */ method_flags = (u8) operand[1]->integer.value; @@ -576,21 +573,19 @@ acpi_ex_create_method(u8 * aml_start, (u8) (method_flags & AML_METHOD_ARG_COUNT); /* - * Get the concurrency count. If required, a semaphore will be + * Get the sync_level. If method is serialized, a mutex will be * created for this method when it is parsed. */ if (acpi_gbl_all_methods_serialized) { - obj_desc->method.concurrency = 1; + obj_desc->method.sync_level = 0; obj_desc->method.method_flags |= AML_METHOD_SERIALIZED; } else if (method_flags & AML_METHOD_SERIALIZED) { /* - * ACPI 1.0: Concurrency = 1 - * ACPI 2.0: Concurrency = (sync_level (in method declaration) + 1) + * ACPI 1.0: sync_level = 0 + * ACPI 2.0: sync_level = sync_level in method declaration */ - obj_desc->method.concurrency = (u8) - (((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1); - } else { - obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY; + obj_desc->method.sync_level = (u8) + ((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4); } /* Attach the new object to the method Node */ diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 7b9718e976b..2450943add3 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c @@ -118,14 +118,14 @@ static struct acpi_exdump_info acpi_ex_dump_device[4] = { static struct acpi_exdump_info acpi_ex_dump_event[2] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_event), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.semaphore), "Semaphore"} + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.os_semaphore), "OsSemaphore"} }; static struct acpi_exdump_info acpi_ex_dump_method[8] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "ParamCount"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.sync_level), "Sync Level"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.mutex), "Mutex"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.thread_count), "Thread Count"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(method.aml_length), "Aml Length"}, @@ -138,7 +138,7 @@ static struct acpi_exdump_info acpi_ex_dump_mutex[5] = { {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread), "Owner Thread"}, {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth), "Acquire Depth"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.semaphore), "Semaphore"} + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.os_mutex), "OsMutex"} }; static struct acpi_exdump_info acpi_ex_dump_region[7] = { diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index 051053f7ccc..40f0bee6faa 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c @@ -727,11 +727,23 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, return_ACPI_STATUS(status); } - /* Merge with previous datum if necessary */ - - merged_datum |= raw_datum << - (obj_desc->common_field.access_bit_width - - obj_desc->common_field.start_field_bit_offset); + /* + * Merge with previous datum if necessary. + * + * Note: Before the shift, check if the shift value will be larger than + * the integer size. If so, there is no need to perform the operation. + * This avoids the differences in behavior between different compilers + * concerning shift values larger than the target data width. + */ + if ((obj_desc->common_field.access_bit_width - + obj_desc->common_field.start_field_bit_offset) < + ACPI_INTEGER_BIT_SIZE) { + merged_datum |= + raw_datum << (obj_desc->common_field. + access_bit_width - + obj_desc->common_field. + start_field_bit_offset); + } if (i == datum_count) { break; @@ -808,13 +820,23 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, return_ACPI_STATUS(AE_BUFFER_OVERFLOW); } - /* Compute the number of datums (access width data items) */ + /* + * Create the bitmasks used for bit insertion. + * Note: This if/else is used to bypass compiler differences with the + * shift operator + */ + if (obj_desc->common_field.access_bit_width == ACPI_INTEGER_BIT_SIZE) { + width_mask = ACPI_INTEGER_MAX; + } else { + width_mask = + ACPI_MASK_BITS_ABOVE(obj_desc->common_field. + access_bit_width); + } - width_mask = - ACPI_MASK_BITS_ABOVE(obj_desc->common_field.access_bit_width); - mask = - width_mask & ACPI_MASK_BITS_BELOW(obj_desc->common_field. - start_field_bit_offset); + mask = width_mask & + ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset); + + /* Compute the number of datums (access width data items) */ datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, obj_desc->common_field.access_bit_width); @@ -848,12 +870,29 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, return_ACPI_STATUS(status); } - /* Start new output datum by merging with previous input datum */ - field_offset += obj_desc->common_field.access_byte_width; - merged_datum = raw_datum >> - (obj_desc->common_field.access_bit_width - - obj_desc->common_field.start_field_bit_offset); + + /* + * Start new output datum by merging with previous input datum + * if necessary. + * + * Note: Before the shift, check if the shift value will be larger than + * the integer size. If so, there is no need to perform the operation. + * This avoids the differences in behavior between different compilers + * concerning shift values larger than the target data width. + */ + if ((obj_desc->common_field.access_bit_width - + obj_desc->common_field.start_field_bit_offset) < + ACPI_INTEGER_BIT_SIZE) { + merged_datum = + raw_datum >> (obj_desc->common_field. + access_bit_width - + obj_desc->common_field. + start_field_bit_offset); + } else { + merged_datum = 0; + } + mask = width_mask; if (i == datum_count) { diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index 93098d68cad..d8ac2877cf0 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c @@ -161,12 +161,13 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, /* * Current Sync must be less than or equal to the sync level of the - * mutex. This mechanism provides some deadlock prevention + * mutex. This mechanism provides some deadlock prevention */ if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { ACPI_ERROR((AE_INFO, - "Cannot acquire Mutex [%4.4s], incorrect SyncLevel", - acpi_ut_get_node_name(obj_desc->mutex.node))); + "Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%d)", + acpi_ut_get_node_name(obj_desc->mutex.node), + walk_state->thread->current_sync_level)); return_ACPI_STATUS(AE_AML_MUTEX_ORDER); } @@ -178,8 +179,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, if ((obj_desc->mutex.owner_thread->thread_id == walk_state->thread->thread_id) || - (obj_desc->mutex.semaphore == - acpi_gbl_global_lock_semaphore)) { + (obj_desc->mutex.os_mutex == ACPI_GLOBAL_LOCK)) { /* * The mutex is already owned by this thread, * just increment the acquisition depth @@ -264,7 +264,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, */ if ((obj_desc->mutex.owner_thread->thread_id != walk_state->thread->thread_id) - && (obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) { + && (obj_desc->mutex.os_mutex != ACPI_GLOBAL_LOCK)) { ACPI_ERROR((AE_INFO, "Thread %X cannot release Mutex [%4.4s] acquired by thread %X", walk_state->thread->thread_id, diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index 52beee3674a..6b5d1e6ce94 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c @@ -63,14 +63,14 @@ ACPI_MODULE_NAME("exsystem") * interpreter is released. * ******************************************************************************/ -acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) +acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) { acpi_status status; acpi_status status2; ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); - status = acpi_os_wait_semaphore(semaphore, 1, 0); + status = acpi_os_wait_semaphore(semaphore, 1, ACPI_DO_NOT_WAIT); if (ACPI_SUCCESS(status)) { return_ACPI_STATUS(status); } @@ -103,6 +103,59 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) /******************************************************************************* * + * FUNCTION: acpi_ex_system_wait_mutex + * + * PARAMETERS: Mutex - Mutex to wait on + * Timeout - Max time to wait + * + * RETURN: Status + * + * DESCRIPTION: Implements a semaphore wait with a check to see if the + * semaphore is available immediately. If it is not, the + * interpreter is released. + * + ******************************************************************************/ + +acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) +{ + acpi_status status; + acpi_status status2; + + ACPI_FUNCTION_TRACE(ex_system_wait_mutex); + + status = acpi_os_acquire_mutex(mutex, ACPI_DO_NOT_WAIT); + if (ACPI_SUCCESS(status)) { + return_ACPI_STATUS(status); + } + + if (status == AE_TIME) { + + /* We must wait, so unlock the interpreter */ + + acpi_ex_exit_interpreter(); + + status = acpi_os_acquire_mutex(mutex, timeout); + + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "*** Thread awake after blocking, %s\n", + acpi_format_exception(status))); + + /* Reacquire the interpreter */ + + status2 = acpi_ex_enter_interpreter(); + if (ACPI_FAILURE(status2)) { + + /* Report fatal error, could not acquire interpreter */ + + return_ACPI_STATUS(status2); + } + } + + return_ACPI_STATUS(status); +} + +/******************************************************************************* + * * FUNCTION: acpi_ex_system_do_stall * * PARAMETERS: how_long - The amount of time to stall, @@ -176,7 +229,7 @@ acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) * * FUNCTION: acpi_ex_system_acquire_mutex * - * PARAMETERS: time_desc - The 'time to delay' object descriptor + * PARAMETERS: time_desc - Maximum time to wait for the mutex * obj_desc - The object descriptor for this op * * RETURN: Status @@ -201,14 +254,14 @@ acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc, /* Support for the _GL_ Mutex object -- go get the global lock */ - if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { + if (obj_desc->mutex.os_mutex == ACPI_GLOBAL_LOCK) { status = acpi_ev_acquire_global_lock((u16) time_desc->integer.value); return_ACPI_STATUS(status); } - status = acpi_ex_system_wait_semaphore(obj_desc->mutex.semaphore, - (u16) time_desc->integer.value); + status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, + (u16) time_desc->integer.value); return_ACPI_STATUS(status); } @@ -239,13 +292,13 @@ acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc) /* Support for the _GL_ Mutex object -- release the global lock */ - if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { + if (obj_desc->mutex.os_mutex == ACPI_GLOBAL_LOCK) { status = acpi_ev_release_global_lock(); return_ACPI_STATUS(status); } - status = acpi_os_signal_semaphore(obj_desc->mutex.semaphore, 1); - return_ACPI_STATUS(status); + acpi_os_release_mutex(obj_desc->mutex.os_mutex); + return_ACPI_STATUS(AE_OK); } /******************************************************************************* @@ -268,7 +321,8 @@ acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc) ACPI_FUNCTION_TRACE(ex_system_signal_event); if (obj_desc) { - status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1); + status = + acpi_os_signal_semaphore(obj_desc->event.os_semaphore, 1); } return_ACPI_STATUS(status); @@ -299,7 +353,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc, if (obj_desc) { status = - acpi_ex_system_wait_semaphore(obj_desc->event.semaphore, + acpi_ex_system_wait_semaphore(obj_desc->event.os_semaphore, (u16) time_desc->integer. value); } @@ -322,7 +376,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc, acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc) { acpi_status status = AE_OK; - void *temp_semaphore; + acpi_semaphore temp_semaphore; ACPI_FUNCTION_ENTRY(); @@ -333,8 +387,8 @@ acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc) status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore); if (ACPI_SUCCESS(status)) { - (void)acpi_os_delete_semaphore(obj_desc->event.semaphore); - obj_desc->event.semaphore = temp_semaphore; + (void)acpi_os_delete_semaphore(obj_desc->event.os_semaphore); + obj_desc->event.os_semaphore = temp_semaphore; } return (status); diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 1cd25784b7a..38acc69b21b 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -78,7 +78,6 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset) struct acpi_fan *fan = seq->private; int state = 0; - ACPI_FUNCTION_TRACE("acpi_fan_read_state"); if (fan) { if (acpi_bus_get_power(fan->handle, &state)) @@ -87,7 +86,7 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset) seq_printf(seq, "status: %s\n", !state ? "on" : "off"); } - return_VALUE(0); + return 0; } static int acpi_fan_state_open_fs(struct inode *inode, struct file *file) @@ -104,22 +103,21 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, struct acpi_fan *fan = (struct acpi_fan *)m->private; char state_string[12] = { '\0' }; - ACPI_FUNCTION_TRACE("acpi_fan_write_state"); if (!fan || (count > sizeof(state_string) - 1)) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(state_string, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; state_string[count] = '\0'; result = acpi_bus_set_power(fan->handle, simple_strtoul(state_string, NULL, 0)); if (result) - return_VALUE(result); + return result; - return_VALUE(count); + return count; } static struct file_operations acpi_fan_state_ops = { @@ -135,16 +133,15 @@ static int acpi_fan_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_fan_add_fs"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_fan_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; acpi_device_dir(device)->owner = THIS_MODULE; } @@ -153,21 +150,18 @@ static int acpi_fan_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_FAN_FILE_STATE)); + return -ENODEV; else { entry->proc_fops = &acpi_fan_state_ops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_fan_remove_fs(struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_fan_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device)); @@ -175,7 +169,7 @@ static int acpi_fan_remove_fs(struct acpi_device *device) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -188,14 +182,13 @@ static int acpi_fan_add(struct acpi_device *device) struct acpi_fan *fan = NULL; int state = 0; - ACPI_FUNCTION_TRACE("acpi_fan_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; fan = kmalloc(sizeof(struct acpi_fan), GFP_KERNEL); if (!fan) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(fan, 0, sizeof(struct acpi_fan)); fan->handle = device->handle; @@ -205,8 +198,7 @@ static int acpi_fan_add(struct acpi_device *device) result = acpi_bus_get_power(fan->handle, &state); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error reading power state\n")); + printk(KERN_ERR PREFIX "Reading power state\n"); goto end; } @@ -226,17 +218,16 @@ static int acpi_fan_add(struct acpi_device *device) if (result) kfree(fan); - return_VALUE(result); + return result; } static int acpi_fan_remove(struct acpi_device *device, int type) { struct acpi_fan *fan = NULL; - ACPI_FUNCTION_TRACE("acpi_fan_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; fan = (struct acpi_fan *)acpi_driver_data(device); @@ -244,7 +235,7 @@ static int acpi_fan_remove(struct acpi_device *device, int type) kfree(fan); - return_VALUE(0); + return 0; } static int acpi_fan_suspend(struct acpi_device *device, int state) @@ -283,31 +274,29 @@ static int __init acpi_fan_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_fan_init"); acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); if (!acpi_fan_dir) - return_VALUE(-ENODEV); + return -ENODEV; acpi_fan_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_fan_driver); if (result < 0) { remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } static void __exit acpi_fan_exit(void) { - ACPI_FUNCTION_TRACE("acpi_fan_exit"); acpi_bus_unregister_driver(&acpi_fan_driver); remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); - return_VOID; + return; } module_init(acpi_fan_init); diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index ae142de1950..3143f36fcec 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c @@ -172,9 +172,9 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) } /* - * The package must have at least two elements. NOTE (March 2005): This + * The package must have at least two elements. NOTE (March 2005): This * goes against the current ACPI spec which defines this object as a - * package with one encoded DWORD element. However, existing practice + * package with one encoded DWORD element. However, existing practice * by BIOS vendors seems to be to have 2 or more elements, at least * one per sleep type (A/B). */ @@ -255,7 +255,7 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) * return_value - Value that was read from the register * Flags - Lock the hardware or not * - * RETURN: Status and the value read from specified Register. Value + * RETURN: Status and the value read from specified Register. Value * returned is normalized to bit0 (is shifted all the way right) * * DESCRIPTION: ACPI bit_register read function. @@ -361,8 +361,8 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) case ACPI_REGISTER_PM1_STATUS: /* - * Status Registers are different from the rest. Clear by - * writing 1, and writing 0 has no effect. So, the only relevant + * Status Registers are different from the rest. Clear by + * writing 1, and writing 0 has no effect. So, the only relevant * information is the single bit we're interested in, all others should * be written as 0 so they will be left unchanged. */ @@ -467,14 +467,13 @@ ACPI_EXPORT_SYMBOL(acpi_set_register) * * FUNCTION: acpi_hw_register_read * - * PARAMETERS: use_lock - Mutex hw access - * register_id - register_iD + Offset + * PARAMETERS: use_lock - Lock hardware? True/False + * register_id - ACPI Register ID * return_value - Where the register value is returned * * RETURN: Status and the value read. * - * DESCRIPTION: Acpi register read function. Registers are read at the - * given offset. + * DESCRIPTION: Read from the specified ACPI register * ******************************************************************************/ acpi_status @@ -580,14 +579,26 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) * * FUNCTION: acpi_hw_register_write * - * PARAMETERS: use_lock - Mutex hw access - * register_id - register_iD + Offset + * PARAMETERS: use_lock - Lock hardware? True/False + * register_id - ACPI Register ID * Value - The value to write * * RETURN: Status * - * DESCRIPTION: Acpi register Write function. Registers are written at the - * given offset. + * DESCRIPTION: Write to the specified ACPI register + * + * NOTE: In accordance with the ACPI specification, this function automatically + * preserves the value of the following bits, meaning that these bits cannot be + * changed via this interface: + * + * PM1_CONTROL[0] = SCI_EN + * PM1_CONTROL[9] + * PM1_STATUS[11] + * + * ACPI References: + * 1) Hardware Ignored Bits: When software writes to a register with ignored + * bit fields, it preserves the ignored bit fields + * 2) SCI_EN: OSPM always preserves this bit position * ******************************************************************************/ @@ -595,6 +606,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) { acpi_status status; acpi_cpu_flags lock_flags = 0; + u32 read_value; ACPI_FUNCTION_TRACE(hw_register_write); @@ -605,6 +617,22 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) switch (register_id) { case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ + /* Perform a read first to preserve certain bits (per ACPI spec) */ + + status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_STATUS, + &read_value); + if (ACPI_FAILURE(status)) { + goto unlock_and_exit; + } + + /* Insert the bits to be preserved */ + + ACPI_INSERT_BITS(value, ACPI_PM1_STATUS_PRESERVED_BITS, + read_value); + + /* Now we can write the data */ + status = acpi_hw_low_level_write(16, value, &acpi_gbl_FADT->xpm1a_evt_blk); @@ -635,6 +663,25 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ + /* + * Perform a read first to preserve certain bits (per ACPI spec) + * + * Note: This includes SCI_EN, we never want to change this bit + */ + status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_CONTROL, + &read_value); + if (ACPI_FAILURE(status)) { + goto unlock_and_exit; + } + + /* Insert the bits to be preserved */ + + ACPI_INSERT_BITS(value, ACPI_PM1_CONTROL_PRESERVED_BITS, + read_value); + + /* Now we can write the data */ + status = acpi_hw_low_level_write(16, value, &acpi_gbl_FADT->xpm1a_cnt_blk); @@ -726,7 +773,7 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) return (AE_OK); } - /* Get a local copy of the address. Handles possible alignment issues */ + /* Get a local copy of the address. Handles possible alignment issues */ ACPI_MOVE_64_TO_64(&address, ®->address); if (!address) { @@ -798,7 +845,7 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) return (AE_OK); } - /* Get a local copy of the address. Handles possible alignment issues */ + /* Get a local copy of the address. Handles possible alignment issues */ ACPI_MOVE_64_TO_64(&address, ®->address); if (!address) { diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c index c25b2b92edc..fd81a0f5222 100644 --- a/drivers/acpi/hotkey.c +++ b/drivers/acpi/hotkey.c @@ -231,11 +231,10 @@ struct list_head hotkey_entries; /* head of the list of hotkey_list */ static int hotkey_info_seq_show(struct seq_file *seq, void *offset) { - ACPI_FUNCTION_TRACE("hotkey_info_seq_show"); seq_printf(seq, "Hotkey generic driver ver: %s\n", HOTKEY_ACPI_VERSION); - return_VALUE(0); + return 0; } static int hotkey_info_open_fs(struct inode *inode, struct file *file) @@ -266,7 +265,6 @@ static int hotkey_polling_seq_show(struct seq_file *seq, void *offset) (struct acpi_polling_hotkey *)seq->private; char *buf; - ACPI_FUNCTION_TRACE("hotkey_polling_seq_show"); if (poll_hotkey->poll_result) { buf = format_result(poll_hotkey->poll_result); @@ -274,7 +272,7 @@ static int hotkey_polling_seq_show(struct seq_file *seq, void *offset) seq_printf(seq, "%s", buf); kfree(buf); } - return_VALUE(0); + return 0; } static int hotkey_polling_open_fs(struct inode *inode, struct file *file) @@ -293,7 +291,6 @@ static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list) struct list_head *entries; int val = -1; - ACPI_FUNCTION_TRACE("hotkey_get_internal_event"); list_for_each(entries, list->entries) { union acpi_hotkey *key = @@ -305,7 +302,7 @@ static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list) } } - return_VALUE(val); + return val; } static void @@ -314,15 +311,14 @@ acpi_hotkey_notify_handler(acpi_handle handle, u32 event, void *data) struct acpi_device *device = NULL; u32 internal_event; - ACPI_FUNCTION_TRACE("acpi_hotkey_notify_handler"); if (acpi_bus_get_device(handle, &device)) - return_VOID; + return; internal_event = hotkey_get_internal_event(event, &global_hotkey_list); acpi_bus_generate_event(device, internal_event, 0); - return_VOID; + return; } /* Need to invent automatically hotkey add method */ @@ -346,7 +342,6 @@ static int create_polling_proc(union acpi_hotkey *device) char proc_name[80]; mode_t mode; - ACPI_FUNCTION_TRACE("create_polling_proc"); mode = S_IFREG | S_IRUGO | S_IWUGO; sprintf(proc_name, "%d", device->link.hotkey_standard_num); @@ -356,10 +351,7 @@ static int create_polling_proc(union acpi_hotkey *device) proc = create_proc_entry(proc_name, mode, hotkey_proc_dir); if (!proc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - device->poll_hotkey.poll_method)); - return_VALUE(-ENODEV); + return -ENODEV; } else { proc->proc_fops = &hotkey_polling_fops; proc->owner = THIS_MODULE; @@ -368,7 +360,7 @@ static int create_polling_proc(union acpi_hotkey *device) proc->gid = 0; device->poll_hotkey.proc = proc; } - return_VALUE(0); + return 0; } static int hotkey_add(union acpi_hotkey *device) @@ -376,7 +368,6 @@ static int hotkey_add(union acpi_hotkey *device) int status = 0; struct acpi_device *dev = NULL; - ACPI_FUNCTION_TRACE("hotkey_add"); if (device->link.hotkey_type == ACPI_HOTKEY_EVENT) { acpi_bus_get_device(device->event_hotkey.bus_handle, &dev); @@ -391,14 +382,13 @@ static int hotkey_add(union acpi_hotkey *device) list_add_tail(&device->link.entries, global_hotkey_list.entries); - return_VALUE(status); + return status; } static int hotkey_remove(union acpi_hotkey *device) { struct list_head *entries, *next; - ACPI_FUNCTION_TRACE("hotkey_remove"); list_for_each_safe(entries, next, global_hotkey_list.entries) { union acpi_hotkey *key = @@ -412,14 +402,13 @@ static int hotkey_remove(union acpi_hotkey *device) } } kfree(device); - return_VALUE(0); + return 0; } static int hotkey_update(union acpi_hotkey *key) { struct list_head *entries; - ACPI_FUNCTION_TRACE("hotkey_update"); list_for_each(entries, global_hotkey_list.entries) { union acpi_hotkey *tmp = @@ -461,19 +450,18 @@ static int hotkey_update(union acpi_hotkey *key) */ kfree(key); } - return_VALUE(0); + return 0; break; } } - return_VALUE(-ENODEV); + return -ENODEV; } static void free_hotkey_device(union acpi_hotkey *key) { struct acpi_device *dev; - ACPI_FUNCTION_TRACE("free_hotkey_device"); if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { acpi_bus_get_device(key->event_hotkey.bus_handle, &dev); @@ -493,7 +481,7 @@ static void free_hotkey_device(union acpi_hotkey *key) free_poll_hotkey_buffer(key); } kfree(key); - return_VOID; + return; } static void free_hotkey_buffer(union acpi_hotkey *key) @@ -514,7 +502,6 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str, acpi_handle tmp_handle; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("init_hotkey_device"); if (std_num < 0 || IS_POLL(std_num) || !key) goto do_fail; @@ -541,9 +528,9 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str, method, &tmp_handle); if (ACPI_FAILURE(status)) goto do_fail; - return_VALUE(AE_OK); + return AE_OK; do_fail: - return_VALUE(-ENODEV); + return -ENODEV; } static int @@ -555,7 +542,6 @@ init_poll_hotkey_device(union acpi_hotkey *key, acpi_status status = AE_OK; acpi_handle tmp_handle; - ACPI_FUNCTION_TRACE("init_poll_hotkey_device"); if (std_num < 0 || IS_EVENT(std_num) || !key) goto do_fail; @@ -590,22 +576,20 @@ init_poll_hotkey_device(union acpi_hotkey *key, (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL); if (!key->poll_hotkey.poll_result) goto do_fail; - return_VALUE(AE_OK); + return AE_OK; do_fail: - return_VALUE(-ENODEV); + return -ENODEV; } static int hotkey_open_config(struct inode *inode, struct file *file) { - ACPI_FUNCTION_TRACE("hotkey_open_config"); - return_VALUE(single_open + return (single_open (file, hotkey_config_seq_show, PDE(inode)->data)); } static int hotkey_poll_open_config(struct inode *inode, struct file *file) { - ACPI_FUNCTION_TRACE("hotkey_poll_open_config"); - return_VALUE(single_open + return (single_open (file, hotkey_poll_config_seq_show, PDE(inode)->data)); } @@ -618,7 +602,6 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset) struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name }; struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name }; - ACPI_FUNCTION_TRACE(("hotkey_config_seq_show")); list_for_each(entries, hotkey_list->entries) { union acpi_hotkey *key = @@ -636,7 +619,7 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset) } } seq_puts(seq, "\n"); - return_VALUE(0); + return 0; } static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset) @@ -648,7 +631,6 @@ static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset) struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name }; struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name }; - ACPI_FUNCTION_TRACE(("hotkey_config_seq_show")); list_for_each(entries, hotkey_list->entries) { union acpi_hotkey *key = @@ -666,7 +648,7 @@ static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset) } } seq_puts(seq, "\n"); - return_VALUE(0); + return 0; } static int @@ -678,7 +660,6 @@ get_parms(char *config_record, char **method, int *internal_event_num, int *external_event_num) { char *tmp, *tmp1, count; - ACPI_FUNCTION_TRACE(("get_parms")); sscanf(config_record, "%d", cmd); @@ -744,9 +725,9 @@ get_parms(char *config_record, 0) goto do_fail; - return_VALUE(6); + return 6; do_fail: - return_VALUE(-1); + return -1; } /* count is length for one input record */ @@ -763,16 +744,15 @@ static ssize_t hotkey_write_config(struct file *file, int ret = 0; union acpi_hotkey *key = NULL; - ACPI_FUNCTION_TRACE(("hotkey_write_config")); config_record = (char *)kmalloc(count + 1, GFP_KERNEL); if (!config_record) - return_VALUE(-ENOMEM); + return -ENOMEM; if (copy_from_user(config_record, buffer, count)) { kfree(config_record); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data \n")); - return_VALUE(-EINVAL); + printk(KERN_ERR PREFIX "Invalid data\n"); + return -EINVAL; } config_record[count] = 0; @@ -792,9 +772,8 @@ static ssize_t hotkey_write_config(struct file *file, kfree(bus_method); kfree(action_handle); kfree(method); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid data format ret=%d\n", ret)); - return_VALUE(-EINVAL); + printk(KERN_ERR PREFIX "Invalid data format ret=%d\n", ret); + return -EINVAL; } key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL); @@ -806,7 +785,7 @@ static ssize_t hotkey_write_config(struct file *file, tmp = get_hotkey_by_event(&global_hotkey_list, internal_event_num); if (!tmp) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid key")); + printk(KERN_ERR PREFIX "Invalid key\n"); else memcpy(key, tmp, sizeof(union acpi_hotkey)); goto cont_cmd; @@ -828,8 +807,8 @@ static ssize_t hotkey_write_config(struct file *file, else free_poll_hotkey_buffer(key); kfree(key); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid hotkey \n")); - return_VALUE(-EINVAL); + printk(KERN_ERR PREFIX "Invalid hotkey\n"); + return -EINVAL; } cont_cmd: @@ -855,15 +834,15 @@ static ssize_t hotkey_write_config(struct file *file, goto fail_out; break; } - return_VALUE(count); + return count; fail_out: if (IS_EVENT(internal_event_num)) free_hotkey_buffer(key); else free_poll_hotkey_buffer(key); kfree(key); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "invalid key\n")); - return_VALUE(-EINVAL); + printk(KERN_ERR PREFIX "invalid key\n"); + return -EINVAL; } /* @@ -880,7 +859,6 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val, union acpi_object in_obj; /* the only param we use */ acpi_status status; - ACPI_FUNCTION_TRACE("write_acpi_int"); params.count = 1; params.pointer = &in_obj; in_obj.type = ACPI_TYPE_INTEGER; @@ -888,7 +866,7 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val, status = acpi_evaluate_object(handle, (char *)method, ¶ms, output); - return_VALUE(status == AE_OK); + return (status == AE_OK); } static int read_acpi_int(acpi_handle handle, const char *method, @@ -898,7 +876,6 @@ static int read_acpi_int(acpi_handle handle, const char *method, union acpi_object out_obj; acpi_status status; - ACPI_FUNCTION_TRACE("read_acpi_int"); output.length = sizeof(out_obj); output.pointer = &out_obj; @@ -907,8 +884,8 @@ static int read_acpi_int(acpi_handle handle, const char *method, val->integer.value = out_obj.integer.value; val->type = out_obj.type; } else - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "null val pointer")); - return_VALUE((status == AE_OK) + printk(KERN_ERR PREFIX "null val pointer\n"); + return ((status == AE_OK) && (out_obj.type == ACPI_TYPE_INTEGER)); } @@ -945,24 +922,23 @@ static ssize_t hotkey_execute_aml_method(struct file *file, int event, method_type, type, value; union acpi_hotkey *key; - ACPI_FUNCTION_TRACE("hotkey_execte_aml_method"); arg = (char *)kmalloc(count + 1, GFP_KERNEL); if (!arg) - return_VALUE(-ENOMEM); + return -ENOMEM; arg[count] = 0; if (copy_from_user(arg, buffer, count)) { kfree(arg); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 2")); - return_VALUE(-EINVAL); + printk(KERN_ERR PREFIX "Invalid argument 2\n"); + return -EINVAL; } if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != 4) { kfree(arg); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3")); - return_VALUE(-EINVAL); + printk(KERN_ERR PREFIX "Invalid argument 3\n"); + return -EINVAL; } kfree(arg); if (type == ACPI_TYPE_INTEGER) { @@ -987,12 +963,12 @@ static ssize_t hotkey_execute_aml_method(struct file *file, } } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Not supported")); - return_VALUE(-EINVAL); + printk(KERN_WARNING "Not supported\n"); + return -EINVAL; } - return_VALUE(count); + return count; do_fail: - return_VALUE(-EINVAL); + return -EINVAL; } @@ -1001,7 +977,6 @@ static int __init hotkey_init(void) int result; mode_t mode = S_IFREG | S_IRUGO | S_IWUGO; - ACPI_FUNCTION_TRACE("hotkey_init"); if (acpi_disabled) return -ENODEV; @@ -1013,9 +988,6 @@ static int __init hotkey_init(void) hotkey_proc_dir = proc_mkdir(HOTKEY_PROC, acpi_root_dir); if (!hotkey_proc_dir) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_PROC)); return (-ENODEV); } hotkey_proc_dir->owner = THIS_MODULE; @@ -1023,9 +995,6 @@ static int __init hotkey_init(void) hotkey_config = create_proc_entry(HOTKEY_EV_CONFIG, mode, hotkey_proc_dir); if (!hotkey_config) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_EV_CONFIG)); goto do_fail1; } else { hotkey_config->proc_fops = &hotkey_config_fops; @@ -1038,10 +1007,6 @@ static int __init hotkey_init(void) hotkey_poll_config = create_proc_entry(HOTKEY_PL_CONFIG, mode, hotkey_proc_dir); if (!hotkey_poll_config) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_EV_CONFIG)); - goto do_fail2; } else { hotkey_poll_config->proc_fops = &hotkey_poll_config_fops; @@ -1053,9 +1018,6 @@ static int __init hotkey_init(void) hotkey_action = create_proc_entry(HOTKEY_ACTION, mode, hotkey_proc_dir); if (!hotkey_action) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_ACTION)); goto do_fail3; } else { hotkey_action->proc_fops = &hotkey_action_fops; @@ -1066,9 +1028,6 @@ static int __init hotkey_init(void) hotkey_info = create_proc_entry(HOTKEY_INFO, mode, hotkey_proc_dir); if (!hotkey_info) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Hotkey: Unable to create %s entry\n", - HOTKEY_INFO)); goto do_fail4; } else { hotkey_info->proc_fops = &hotkey_info_fops; @@ -1104,7 +1063,6 @@ static void __exit hotkey_exit(void) { struct list_head *entries, *next; - ACPI_FUNCTION_TRACE("hotkey_exit"); list_for_each_safe(entries, next, global_hotkey_list.entries) { union acpi_hotkey *key = diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c index d51d68f5dd8..ec6b7f9ede3 100644 --- a/drivers/acpi/motherboard.c +++ b/drivers/acpi/motherboard.c @@ -52,13 +52,12 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) { struct resource *requested_res = NULL; - ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges"); if (res->type == ACPI_RESOURCE_TYPE_IO) { struct acpi_resource_io *io_res = &res->data.io; if (io_res->minimum != io_res->maximum) - return_VALUE(AE_OK); + return AE_OK; if (IS_RESERVED_ADDR (io_res->minimum, io_res->address_length)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, @@ -92,7 +91,7 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) if (requested_res) requested_res->flags &= ~IORESOURCE_BUSY; - return_VALUE(AE_OK); + return AE_OK; } static int acpi_motherboard_add(struct acpi_device *device) diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 48fadade52e..c1c6c236df9 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c @@ -196,33 +196,30 @@ acpi_status acpi_ns_root_initialize(void) (u8) (ACPI_TO_INTEGER(val) - 1); if (ACPI_STRCMP(init_val->name, "_GL_") == 0) { - /* - * Create a counting semaphore for the - * global lock - */ + + /* Create a counting semaphore for the global lock */ + status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 1, - &obj_desc->mutex.semaphore); + &acpi_gbl_global_lock_semaphore); if (ACPI_FAILURE(status)) { acpi_ut_remove_reference (obj_desc); goto unlock_and_exit; } - /* - * We just created the mutex for the - * global lock, save it - */ - acpi_gbl_global_lock_semaphore = - obj_desc->mutex.semaphore; + /* Mark this mutex as very special */ + + obj_desc->mutex.os_mutex = + ACPI_GLOBAL_LOCK; } else { /* Create a mutex */ - status = acpi_os_create_semaphore(1, 1, - &obj_desc-> - mutex. - semaphore); + status = + acpi_os_create_mutex(&obj_desc-> + mutex. + os_mutex); if (ACPI_FAILURE(status)) { acpi_ut_remove_reference (obj_desc); diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 13d6d5bdea2..4d622981f61 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -23,7 +23,6 @@ * */ #include <linux/module.h> -#include <linux/config.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/types.h> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 1bb558adee6..5a468e2779a 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -25,7 +25,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> @@ -137,6 +136,7 @@ void acpi_os_vprintf(const char *fmt, va_list args) #endif } + extern int acpi_in_resume; void *acpi_os_allocate(acpi_size size) { @@ -280,7 +280,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, acpi_irq_handler = handler; acpi_irq_context = context; - if (request_irq(irq, acpi_irq, SA_SHIRQ, "acpi", acpi_irq)) { + if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) { printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); return AE_NOT_ACQUIRED; } @@ -586,19 +586,18 @@ static void acpi_os_execute_deferred(void *context) { struct acpi_os_dpc *dpc = NULL; - ACPI_FUNCTION_TRACE("os_execute_deferred"); dpc = (struct acpi_os_dpc *)context; if (!dpc) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); - return_VOID; + printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); + return; } dpc->function(dpc->context); kfree(dpc); - return_VOID; + return; } static int acpi_os_execute_thread(void *context) @@ -688,35 +687,19 @@ EXPORT_SYMBOL(acpi_os_wait_events_complete); /* * Allocate the memory for a spinlock and initialize it. */ -acpi_status acpi_os_create_lock(acpi_handle * out_handle) +acpi_status acpi_os_create_lock(acpi_spinlock * handle) { - spinlock_t *lock_ptr; - - ACPI_FUNCTION_TRACE("os_create_lock"); - - lock_ptr = acpi_os_allocate(sizeof(spinlock_t)); - - spin_lock_init(lock_ptr); - - ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating spinlock[%p].\n", lock_ptr)); + spin_lock_init(*handle); - *out_handle = lock_ptr; - - return_ACPI_STATUS(AE_OK); + return AE_OK; } /* * Deallocate the memory for a spinlock. */ -void acpi_os_delete_lock(acpi_handle handle) +void acpi_os_delete_lock(acpi_spinlock handle) { - ACPI_FUNCTION_TRACE("os_create_lock"); - - ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting spinlock[%p].\n", handle)); - - acpi_os_free(handle); - - return_VOID; + return; } acpi_status @@ -724,11 +707,10 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle) { struct semaphore *sem = NULL; - ACPI_FUNCTION_TRACE("os_create_semaphore"); sem = acpi_os_allocate(sizeof(struct semaphore)); if (!sem) - return_ACPI_STATUS(AE_NO_MEMORY); + return AE_NO_MEMORY; memset(sem, 0, sizeof(struct semaphore)); sema_init(sem, initial_units); @@ -738,7 +720,7 @@ acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle) ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n", *handle, initial_units)); - return_ACPI_STATUS(AE_OK); + return AE_OK; } EXPORT_SYMBOL(acpi_os_create_semaphore); @@ -754,17 +736,16 @@ acpi_status acpi_os_delete_semaphore(acpi_handle handle) { struct semaphore *sem = (struct semaphore *)handle; - ACPI_FUNCTION_TRACE("os_delete_semaphore"); if (!sem) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle)); acpi_os_free(sem); sem = NULL; - return_ACPI_STATUS(AE_OK); + return AE_OK; } EXPORT_SYMBOL(acpi_os_delete_semaphore); @@ -784,13 +765,12 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) struct semaphore *sem = (struct semaphore *)handle; int ret = 0; - ACPI_FUNCTION_TRACE("os_wait_semaphore"); if (!sem || (units < 1)) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; if (units > 1) - return_ACPI_STATUS(AE_SUPPORT); + return AE_SUPPORT; ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", handle, units, timeout)); @@ -839,17 +819,17 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) } if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Failed to acquire semaphore[%p|%d|%d], %s\n", + ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, + "Failed to acquire semaphore[%p|%d|%d], %s", handle, units, timeout, acpi_format_exception(status))); } else { ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, - "Acquired semaphore[%p|%d|%d]\n", handle, + "Acquired semaphore[%p|%d|%d]", handle, units, timeout)); } - return_ACPI_STATUS(status); + return status; } EXPORT_SYMBOL(acpi_os_wait_semaphore); @@ -861,20 +841,19 @@ acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units) { struct semaphore *sem = (struct semaphore *)handle; - ACPI_FUNCTION_TRACE("os_signal_semaphore"); if (!sem || (units < 1)) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; if (units > 1) - return_ACPI_STATUS(AE_SUPPORT); + return AE_SUPPORT; ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle, units)); up(sem); - return_ACPI_STATUS(AE_OK); + return AE_OK; } EXPORT_SYMBOL(acpi_os_signal_semaphore); @@ -1043,10 +1022,10 @@ EXPORT_SYMBOL(max_cstate); * handle is a pointer to the spinlock_t. */ -acpi_cpu_flags acpi_os_acquire_lock(acpi_handle handle) +acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp) { acpi_cpu_flags flags; - spin_lock_irqsave((spinlock_t *) handle, flags); + spin_lock_irqsave(lockp, flags); return flags; } @@ -1054,9 +1033,9 @@ acpi_cpu_flags acpi_os_acquire_lock(acpi_handle handle) * Release a spinlock. See above. */ -void acpi_os_release_lock(acpi_handle handle, acpi_cpu_flags flags) +void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags) { - spin_unlock_irqrestore((spinlock_t *) handle, flags); + spin_unlock_irqrestore(lockp, flags); } #ifndef ACPI_USE_LOCAL_CACHE diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 7ee2f2e7752..a02aa62fe1e 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -469,6 +469,16 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) } walk_state->thread = thread; + + /* + * If executing a method, the starting sync_level is this method's + * sync_level + */ + if (walk_state->method_desc) { + walk_state->thread->current_sync_level = + walk_state->method_desc->method.sync_level; + } + acpi_ds_push_walk_state(walk_state, thread); /* @@ -505,6 +515,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) status = acpi_ds_call_control_method(thread, walk_state, NULL); + if (ACPI_FAILURE(status)) { + status = + acpi_ds_method_error(status, walk_state); + } /* * If the transfer to the new method method call worked, a new walk @@ -525,7 +539,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) /* Check for possible multi-thread reentrancy problem */ if ((status == AE_ALREADY_EXISTS) && - (!walk_state->method_desc->method.semaphore)) { + (!walk_state->method_desc->method.mutex)) { /* * Method tried to create an object twice. The probable cause is * that the method cannot handle reentrancy. @@ -537,7 +551,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) */ walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED; - walk_state->method_desc->method.concurrency = 1; + walk_state->method_desc->method.sync_level = 0; } } diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index 2a718df769b..1e2ae6e7a7e 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c @@ -47,11 +47,10 @@ struct acpi_pci_data { static void acpi_pci_data_handler(acpi_handle handle, u32 function, void *context) { - ACPI_FUNCTION_TRACE("acpi_pci_data_handler"); /* TBD: Anything we need to do here? */ - return_VOID; + return; } /** @@ -68,25 +67,24 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id) struct acpi_device *device = NULL; struct acpi_pci_data *data = NULL; - ACPI_FUNCTION_TRACE("acpi_get_pci_id"); if (!id) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid ACPI Bus context for device %s\n", - acpi_device_bid(device))); - return_ACPI_STATUS(AE_NOT_EXIST); + printk(KERN_ERR PREFIX + "Invalid ACPI Bus context for device %s\n", + acpi_device_bid(device)); + return AE_NOT_EXIST; } status = acpi_get_data(handle, acpi_pci_data_handler, (void **)&data); if (ACPI_FAILURE(status) || !data) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid ACPI-PCI context for device %s\n", - acpi_device_bid(device))); - return_ACPI_STATUS(status); + ACPI_EXCEPTION((AE_INFO, status, + "Invalid ACPI-PCI context for device %s", + acpi_device_bid(device))); + return status; } *id = data->id; @@ -103,7 +101,7 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id) acpi_device_bid(device), id->segment, id->bus, id->device, id->function)); - return_ACPI_STATUS(AE_OK); + return AE_OK; } EXPORT_SYMBOL(acpi_get_pci_id); @@ -120,14 +118,13 @@ int acpi_pci_bind(struct acpi_device *device) struct pci_dev *dev; struct pci_bus *bus; - ACPI_FUNCTION_TRACE("acpi_pci_bind"); if (!device || !device->parent) - return_VALUE(-EINVAL); + return -EINVAL; pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); if (!pathname) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(pathname, 0, ACPI_PATHNAME_MAX); buffer.length = ACPI_PATHNAME_MAX; buffer.pointer = pathname; @@ -135,7 +132,7 @@ int acpi_pci_bind(struct acpi_device *device) data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); if (!data) { kfree(pathname); - return_VALUE(-ENOMEM); + return -ENOMEM; } memset(data, 0, sizeof(struct acpi_pci_data)); @@ -151,9 +148,9 @@ int acpi_pci_bind(struct acpi_device *device) status = acpi_get_data(device->parent->handle, acpi_pci_data_handler, (void **)&pdata); if (ACPI_FAILURE(status) || !pdata || !pdata->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid ACPI-PCI context for parent device %s\n", - acpi_device_bid(device->parent))); + ACPI_EXCEPTION((AE_INFO, status, + "Invalid ACPI-PCI context for parent device %s", + acpi_device_bid(device->parent))); result = -ENODEV; goto end; } @@ -206,10 +203,10 @@ int acpi_pci_bind(struct acpi_device *device) goto end; } if (!data->dev->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device %02x:%02x:%02x.%02x has invalid 'bus' field\n", - data->id.segment, data->id.bus, - data->id.device, data->id.function)); + printk(KERN_ERR PREFIX + "Device %02x:%02x:%02x.%02x has invalid 'bus' field\n", + data->id.segment, data->id.bus, + data->id.device, data->id.function); result = -ENODEV; goto end; } @@ -237,9 +234,9 @@ int acpi_pci_bind(struct acpi_device *device) */ status = acpi_attach_data(device->handle, acpi_pci_data_handler, data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to attach ACPI-PCI context to device %s\n", - acpi_device_bid(device))); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to attach ACPI-PCI context to device %s", + acpi_device_bid(device))); result = -ENODEV; goto end; } @@ -269,7 +266,7 @@ int acpi_pci_bind(struct acpi_device *device) if (result) kfree(data); - return_VALUE(result); + return result; } int acpi_pci_unbind(struct acpi_device *device) @@ -280,14 +277,13 @@ int acpi_pci_unbind(struct acpi_device *device) char *pathname = NULL; struct acpi_buffer buffer = { 0, NULL }; - ACPI_FUNCTION_TRACE("acpi_pci_unbind"); if (!device || !device->parent) - return_VALUE(-EINVAL); + return -EINVAL; pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); if (!pathname) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(pathname, 0, ACPI_PATHNAME_MAX); buffer.length = ACPI_PATHNAME_MAX; @@ -301,18 +297,18 @@ int acpi_pci_unbind(struct acpi_device *device) acpi_get_data(device->handle, acpi_pci_data_handler, (void **)&data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to get data from device %s\n", - acpi_device_bid(device))); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to get data from device %s", + acpi_device_bid(device))); result = -ENODEV; goto end; } status = acpi_detach_data(device->handle, acpi_pci_data_handler); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to detach data from device %s\n", - acpi_device_bid(device))); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to detach data from device %s", + acpi_device_bid(device))); result = -ENODEV; goto end; } @@ -322,7 +318,7 @@ int acpi_pci_unbind(struct acpi_device *device) kfree(data); end: - return_VALUE(result); + return result; } int @@ -335,11 +331,10 @@ acpi_pci_bind_root(struct acpi_device *device, char *pathname = NULL; struct acpi_buffer buffer = { 0, NULL }; - ACPI_FUNCTION_TRACE("acpi_pci_bind_root"); pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); if (!pathname) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(pathname, 0, ACPI_PATHNAME_MAX); buffer.length = ACPI_PATHNAME_MAX; @@ -347,13 +342,13 @@ acpi_pci_bind_root(struct acpi_device *device, if (!device || !id || !bus) { kfree(pathname); - return_VALUE(-EINVAL); + return -EINVAL; } data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); if (!data) { kfree(pathname); - return_VALUE(-ENOMEM); + return -ENOMEM; } memset(data, 0, sizeof(struct acpi_pci_data)); @@ -369,9 +364,9 @@ acpi_pci_bind_root(struct acpi_device *device, status = acpi_attach_data(device->handle, acpi_pci_data_handler, data); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to attach ACPI-PCI context to device %s\n", - pathname)); + ACPI_EXCEPTION((AE_INFO, status, + "Unable to attach ACPI-PCI context to device %s", + pathname)); result = -ENODEV; goto end; } @@ -381,5 +376,5 @@ acpi_pci_bind_root(struct acpi_device *device, if (result != 0) kfree(data); - return_VALUE(result); + return result; } diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 65aee79b397..feda0341f5a 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -24,7 +24,6 @@ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> @@ -55,10 +54,9 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, struct list_head *node = NULL; struct acpi_prt_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_pci_irq_find_prt_entry"); if (!acpi_prt.count) - return_PTR(NULL); + return NULL; /* * Parse through all PRT entries looking for a match on the specified @@ -73,12 +71,12 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, && (device == entry->id.device) && (pin == entry->pin)) { spin_unlock(&acpi_prt_lock); - return_PTR(entry); + return entry; } } spin_unlock(&acpi_prt_lock); - return_PTR(NULL); + return NULL; } static int @@ -87,14 +85,13 @@ acpi_pci_irq_add_entry(acpi_handle handle, { struct acpi_prt_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_pci_irq_add_entry"); if (!prt) - return_VALUE(-EINVAL); + return -EINVAL; entry = kmalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL); if (!entry) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(entry, 0, sizeof(struct acpi_prt_entry)); entry->id.segment = segment; @@ -141,7 +138,7 @@ acpi_pci_irq_add_entry(acpi_handle handle, acpi_prt.count++; spin_unlock(&acpi_prt_lock); - return_VALUE(0); + return 0; } static void @@ -163,11 +160,10 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) struct acpi_pci_routing_table *entry = NULL; static int first_time = 1; - ACPI_FUNCTION_TRACE("acpi_pci_irq_add_prt"); pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); if (!pathname) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(pathname, 0, ACPI_PATHNAME_MAX); if (first_time) { @@ -197,24 +193,24 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) kfree(pathname); status = acpi_get_irq_routing_table(handle, &buffer); if (status != AE_BUFFER_OVERFLOW) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n", - acpi_format_exception(status))); - return_VALUE(-ENODEV); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", + acpi_format_exception(status))); + return -ENODEV; } prt = kmalloc(buffer.length, GFP_KERNEL); if (!prt) { - return_VALUE(-ENOMEM); + return -ENOMEM; } memset(prt, 0, buffer.length); buffer.pointer = prt; status = acpi_get_irq_routing_table(handle, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n", - acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]", + acpi_format_exception(status))); kfree(buffer.pointer); - return_VALUE(-ENODEV); + return -ENODEV; } entry = prt; @@ -227,7 +223,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) kfree(prt); - return_VALUE(0); + return 0; } void acpi_pci_irq_del_prt(int segment, int bus) @@ -262,16 +258,15 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, { int irq; - ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq"); if (entry->link.handle) { irq = acpi_pci_link_allocate_irq(entry->link.handle, entry->link.index, triggering, polarity, link); if (irq < 0) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid IRQ link routing entry\n")); - return_VALUE(-1); + printk(KERN_WARNING PREFIX + "Invalid IRQ link routing entry\n"); + return -1; } } else { irq = entry->link.index; @@ -280,7 +275,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry, } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); - return_VALUE(irq); + return irq; } static int @@ -289,13 +284,12 @@ acpi_pci_free_irq(struct acpi_prt_entry *entry, { int irq; - ACPI_FUNCTION_TRACE("acpi_pci_free_irq"); if (entry->link.handle) { irq = acpi_pci_link_free_irq(entry->link.handle); } else { irq = entry->link.index; } - return_VALUE(irq); + return irq; } /* @@ -315,7 +309,6 @@ acpi_pci_irq_lookup(struct pci_bus *bus, int bus_nr = bus->number; int ret; - ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup"); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Searching for PRT entry for %02x:%02x:%02x[%c]\n", @@ -324,11 +317,11 @@ acpi_pci_irq_lookup(struct pci_bus *bus, entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin); if (!entry) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "PRT entry not found\n")); - return_VALUE(-1); + return -1; } ret = func(entry, triggering, polarity, link); - return_VALUE(ret); + return ret; } /* @@ -346,10 +339,9 @@ acpi_pci_irq_derive(struct pci_dev *dev, int irq = -1; u8 bridge_pin = 0; - ACPI_FUNCTION_TRACE("acpi_pci_irq_derive"); if (!dev) - return_VALUE(-EINVAL); + return -EINVAL; /* * Attempt to derive an IRQ for this device from a parent bridge's @@ -366,7 +358,7 @@ acpi_pci_irq_derive(struct pci_dev *dev, ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No interrupt pin configured for device %s\n", pci_name(bridge))); - return_VALUE(-1); + return -1; } /* Pin is from 0 to 3 */ bridge_pin--; @@ -379,16 +371,15 @@ acpi_pci_irq_derive(struct pci_dev *dev, } if (irq < 0) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to derive IRQ for device %s\n", - pci_name(dev))); - return_VALUE(-1); + printk(KERN_WARNING PREFIX "Unable to derive IRQ for device %s\n", + pci_name(dev)); + return -1; } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n", irq, pci_name(dev), pci_name(bridge))); - return_VALUE(irq); + return irq; } /* @@ -406,24 +397,22 @@ int acpi_pci_irq_enable(struct pci_dev *dev) char *link = NULL; int rc; - ACPI_FUNCTION_TRACE("acpi_pci_irq_enable"); if (!dev) - return_VALUE(-EINVAL); + return -EINVAL; pin = dev->pin; if (!pin) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No interrupt pin configured for device %s\n", pci_name(dev))); - return_VALUE(0); + return 0; } pin--; if (!dev->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid (NULL) 'bus' field\n")); - return_VALUE(-ENODEV); + printk(KERN_ERR PREFIX "Invalid (NULL) 'bus' field\n"); + return -ENODEV; } /* @@ -455,10 +444,10 @@ int acpi_pci_irq_enable(struct pci_dev *dev) printk(" - using IRQ %d\n", dev->irq); acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW); - return_VALUE(0); + return 0; } else { printk("\n"); - return_VALUE(0); + return 0; } } @@ -466,7 +455,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) if (rc < 0) { printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: failed " "to register GSI\n", pci_name(dev), ('A' + pin)); - return_VALUE(rc); + return rc; } dev->irq = rc; @@ -480,7 +469,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge", (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_pci_irq_enable); @@ -497,14 +486,13 @@ void acpi_pci_irq_disable(struct pci_dev *dev) int triggering = ACPI_LEVEL_SENSITIVE; int polarity = ACPI_ACTIVE_LOW; - ACPI_FUNCTION_TRACE("acpi_pci_irq_disable"); if (!dev || !dev->bus) - return_VOID; + return; pin = dev->pin; if (!pin) - return_VOID; + return; pin--; /* @@ -522,7 +510,7 @@ void acpi_pci_irq_disable(struct pci_dev *dev) &triggering, &polarity, NULL, acpi_pci_free_irq); if (gsi < 0) - return_VOID; + return; /* * TBD: It might be worth clearing dev->irq by magic constant @@ -534,5 +522,5 @@ void acpi_pci_irq_disable(struct pci_dev *dev) acpi_unregister_gsi(gsi); - return_VOID; + return; } diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 228bdb62650..1badce27a83 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -107,26 +107,23 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) struct acpi_pci_link *link = (struct acpi_pci_link *)context; u32 i = 0; - ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); switch (resource->type) { case ACPI_RESOURCE_TYPE_START_DEPENDENT: - return_ACPI_STATUS(AE_OK); + return AE_OK; case ACPI_RESOURCE_TYPE_IRQ: { struct acpi_resource_irq *p = &resource->data.irq; if (!p || !p->interrupt_count) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Blank IRQ resource\n")); - return_ACPI_STATUS(AE_OK); + printk(KERN_WARNING PREFIX "Blank IRQ resource\n"); + return AE_OK; } for (i = 0; (i < p->interrupt_count && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { if (!p->interrupts[i]) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid IRQ %d\n", - p->interrupts[i])); + printk(KERN_WARNING PREFIX "Invalid IRQ %d\n", + p->interrupts[i]); continue; } link->irq.possible[i] = p->interrupts[i]; @@ -142,17 +139,16 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) struct acpi_resource_extended_irq *p = &resource->data.extended_irq; if (!p || !p->interrupt_count) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Blank EXT IRQ resource\n")); - return_ACPI_STATUS(AE_OK); + printk(KERN_WARNING PREFIX + "Blank EXT IRQ resource\n"); + return AE_OK; } for (i = 0; (i < p->interrupt_count && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { if (!p->interrupts[i]) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid IRQ %d\n", - p->interrupts[i])); + printk(KERN_WARNING PREFIX "Invalid IRQ %d\n", + p->interrupts[i]); continue; } link->irq.possible[i] = p->interrupts[i]; @@ -164,35 +160,33 @@ acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) break; } default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Resource is not an IRQ entry\n")); - return_ACPI_STATUS(AE_OK); + printk(KERN_ERR PREFIX "Resource is not an IRQ entry\n"); + return AE_OK; } - return_ACPI_STATUS(AE_CTRL_TERMINATE); + return AE_CTRL_TERMINATE; } static int acpi_pci_link_get_possible(struct acpi_pci_link *link) { acpi_status status; - ACPI_FUNCTION_TRACE("acpi_pci_link_get_possible"); if (!link) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_walk_resources(link->handle, METHOD_NAME__PRS, acpi_pci_link_check_possible, link); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRS\n")); - return_VALUE(-ENODEV); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRS")); + return -ENODEV; } ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d possible IRQs\n", link->irq.possible_count)); - return_VALUE(0); + return 0; } static acpi_status @@ -200,7 +194,6 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) { int *irq = (int *)context; - ACPI_FUNCTION_TRACE("acpi_pci_link_check_current"); switch (resource->type) { case ACPI_RESOURCE_TYPE_IRQ: @@ -213,7 +206,7 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Blank IRQ resource\n")); - return_ACPI_STATUS(AE_OK); + return AE_OK; } *irq = p->interrupts[0]; break; @@ -227,20 +220,20 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) * extended IRQ descriptors must * return at least 1 IRQ */ - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Blank EXT IRQ resource\n")); - return_ACPI_STATUS(AE_OK); + printk(KERN_WARNING PREFIX + "Blank EXT IRQ resource\n"); + return AE_OK; } *irq = p->interrupts[0]; break; } break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource %d isn't an IRQ\n", resource->type)); + printk(KERN_ERR PREFIX "Resource %d isn't an IRQ\n", resource->type); case ACPI_RESOURCE_TYPE_END_TAG: - return_ACPI_STATUS(AE_OK); + return AE_OK; } - return_ACPI_STATUS(AE_CTRL_TERMINATE); + return AE_CTRL_TERMINATE; } /* @@ -256,10 +249,9 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) acpi_status status = AE_OK; int irq = 0; - ACPI_FUNCTION_TRACE("acpi_pci_link_get_current"); if (!link || !link->handle) - return_VALUE(-EINVAL); + return -EINVAL; link->irq.active = 0; @@ -268,14 +260,13 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) /* Query _STA, set link->device->status */ result = acpi_bus_get_status(link->device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to read status\n")); + printk(KERN_ERR PREFIX "Unable to read status\n"); goto end; } if (!link->device->status.enabled) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link disabled\n")); - return_VALUE(0); + return 0; } } @@ -286,13 +277,13 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) status = acpi_walk_resources(link->handle, METHOD_NAME__CRS, acpi_pci_link_check_current, &irq); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _CRS\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _CRS")); result = -ENODEV; goto end; } if (acpi_strict && !irq) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_CRS returned 0\n")); + printk(KERN_ERR PREFIX "_CRS returned 0\n"); result = -ENODEV; } @@ -301,7 +292,7 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active)); end: - return_VALUE(result); + return result; } static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) @@ -314,14 +305,13 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) } *resource; struct acpi_buffer buffer = { 0, NULL }; - ACPI_FUNCTION_TRACE("acpi_pci_link_set"); if (!link || !irq) - return_VALUE(-EINVAL); + return -EINVAL; resource = kmalloc(sizeof(*resource) + 1, GFP_ATOMIC); if (!resource) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(resource, 0, sizeof(*resource) + 1); buffer.length = sizeof(*resource) + 1; @@ -362,7 +352,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) /* ignore resource_source, it's optional */ break; default: - printk("ACPI BUG: resource_type %d\n", link->irq.resource_type); + printk(KERN_ERR PREFIX "Invalid Resource_type %d\n", link->irq.resource_type); result = -EINVAL; goto end; @@ -374,7 +364,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) /* check for total failure */ if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _SRS\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SRS")); result = -ENODEV; goto end; } @@ -382,14 +372,14 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) /* Query _STA, set device->status */ result = acpi_bus_get_status(link->device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to read status\n")); + printk(KERN_ERR PREFIX "Unable to read status\n"); goto end; } if (!link->device->status.enabled) { printk(KERN_WARNING PREFIX - "%s [%s] disabled and referenced, BIOS bug.\n", - acpi_device_name(link->device), - acpi_device_bid(link->device)); + "%s [%s] disabled and referenced, BIOS bug\n", + acpi_device_name(link->device), + acpi_device_bid(link->device)); } /* Query _CRS, set link->irq.active */ @@ -408,9 +398,9 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) * assume _SRS worked and override _CRS value. */ printk(KERN_WARNING PREFIX - "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", - acpi_device_name(link->device), - acpi_device_bid(link->device), link->irq.active, irq); + "%s [%s] BIOS reported IRQ %d, using IRQ %d\n", + acpi_device_name(link->device), + acpi_device_bid(link->device), link->irq.active, irq); link->irq.active = irq; } @@ -418,7 +408,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) end: kfree(resource); - return_VALUE(result); + return result; } /* -------------------------------------------------------------------------- @@ -492,7 +482,6 @@ int __init acpi_irq_penalty_init(void) struct acpi_pci_link *link = NULL; int i = 0; - ACPI_FUNCTION_TRACE("acpi_irq_penalty_init"); /* * Update penalties to facilitate IRQ balancing. @@ -501,8 +490,7 @@ int __init acpi_irq_penalty_init(void) link = list_entry(node, struct acpi_pci_link, node); if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid link context\n")); + printk(KERN_ERR PREFIX "Invalid link context\n"); continue; } @@ -530,7 +518,7 @@ int __init acpi_irq_penalty_init(void) /* Add a penalty for the SCI */ acpi_irq_penalty[acpi_fadt.sci_int] += PIRQ_PENALTY_PCI_USING; - return_VALUE(0); + return 0; } static int acpi_irq_balance; /* 0: static, 1: balance */ @@ -540,13 +528,12 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) int irq; int i; - ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); if (link->irq.initialized) { if (link->refcnt == 0) /* This means the link is disabled but initialized */ acpi_pci_link_set(link, link->irq.active); - return_VALUE(0); + return 0; } /* @@ -562,7 +549,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) if (i == link->irq.possible_count) { if (acpi_strict) printk(KERN_WARNING PREFIX "_CRS %d not found" - " in _PRS\n", link->irq.active); + " in _PRS\n", link->irq.active); link->irq.active = 0; } @@ -589,12 +576,11 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) /* Attempt to enable the link device at this IRQ. */ if (acpi_pci_link_set(link, irq)) { - printk(PREFIX - "Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS).\n" - "Try pci=noacpi or acpi=off\n", - acpi_device_name(link->device), - acpi_device_bid(link->device)); - return_VALUE(-ENODEV); + printk(KERN_ERR PREFIX "Unable to set IRQ for %s [%s]. " + "Try pci=noacpi or acpi=off\n", + acpi_device_name(link->device), + acpi_device_bid(link->device)); + return -ENODEV; } else { acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; printk(PREFIX "%s [%s] enabled at IRQ %d\n", @@ -604,7 +590,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) link->irq.initialized = 1; - return_VALUE(0); + return 0; } /* @@ -622,36 +608,35 @@ acpi_pci_link_allocate_irq(acpi_handle handle, struct acpi_device *device = NULL; struct acpi_pci_link *link = NULL; - ACPI_FUNCTION_TRACE("acpi_pci_link_allocate_irq"); result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n")); - return_VALUE(-1); + printk(KERN_ERR PREFIX "Invalid link device\n"); + return -1; } link = (struct acpi_pci_link *)acpi_driver_data(device); if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); - return_VALUE(-1); + printk(KERN_ERR PREFIX "Invalid link context\n"); + return -1; } /* TBD: Support multiple index (IRQ) entries per Link Device */ if (index) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid index %d\n", index)); - return_VALUE(-1); + printk(KERN_ERR PREFIX "Invalid index %d\n", index); + return -1; } mutex_lock(&acpi_link_lock); if (acpi_pci_link_allocate(link)) { mutex_unlock(&acpi_link_lock); - return_VALUE(-1); + return -1; } if (!link->irq.active) { mutex_unlock(&acpi_link_lock); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); - return_VALUE(-1); + printk(KERN_ERR PREFIX "Link active IRQ is 0!\n"); + return -1; } link->refcnt++; mutex_unlock(&acpi_link_lock); @@ -665,7 +650,7 @@ acpi_pci_link_allocate_irq(acpi_handle handle, ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link %s is referenced\n", acpi_device_bid(link->device))); - return_VALUE(link->irq.active); + return (link->irq.active); } /* @@ -678,25 +663,24 @@ int acpi_pci_link_free_irq(acpi_handle handle) struct acpi_pci_link *link = NULL; acpi_status result; - ACPI_FUNCTION_TRACE("acpi_pci_link_free_irq"); result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n")); - return_VALUE(-1); + printk(KERN_ERR PREFIX "Invalid link device\n"); + return -1; } link = (struct acpi_pci_link *)acpi_driver_data(device); if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); - return_VALUE(-1); + printk(KERN_ERR PREFIX "Invalid link context\n"); + return -1; } mutex_lock(&acpi_link_lock); if (!link->irq.initialized) { mutex_unlock(&acpi_link_lock); - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); - return_VALUE(-1); + printk(KERN_ERR PREFIX "Link isn't initialized\n"); + return -1; } #ifdef FUTURE_USE /* @@ -718,7 +702,7 @@ int acpi_pci_link_free_irq(acpi_handle handle) acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); } mutex_unlock(&acpi_link_lock); - return_VALUE(link->irq.active); + return (link->irq.active); } /* -------------------------------------------------------------------------- @@ -732,14 +716,13 @@ static int acpi_pci_link_add(struct acpi_device *device) int i = 0; int found = 0; - ACPI_FUNCTION_TRACE("acpi_pci_link_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; link = kmalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); if (!link) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(link, 0, sizeof(struct acpi_pci_link)); link->device = device; @@ -788,17 +771,16 @@ static int acpi_pci_link_add(struct acpi_device *device) if (result) kfree(link); - return_VALUE(result); + return result; } static int acpi_pci_link_resume(struct acpi_pci_link *link) { - ACPI_FUNCTION_TRACE("acpi_pci_link_resume"); if (link->refcnt && link->irq.active && link->irq.initialized) - return_VALUE(acpi_pci_link_set(link, link->irq.active)); + return (acpi_pci_link_set(link, link->irq.active)); else - return_VALUE(0); + return 0; } /* @@ -811,7 +793,6 @@ static int irqrouter_resume(struct sys_device *dev) struct list_head *node = NULL; struct acpi_pci_link *link = NULL; - ACPI_FUNCTION_TRACE("irqrouter_resume"); /* Make sure SCI is enabled again (Apple firmware bug?) */ acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK); @@ -820,24 +801,22 @@ static int irqrouter_resume(struct sys_device *dev) list_for_each(node, &acpi_link.entries) { link = list_entry(node, struct acpi_pci_link, node); if (!link) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid link context\n")); + printk(KERN_ERR PREFIX "Invalid link context\n"); continue; } acpi_pci_link_resume(link); } acpi_in_resume = 0; - return_VALUE(0); + return 0; } static int acpi_pci_link_remove(struct acpi_device *device, int type) { struct acpi_pci_link *link = NULL; - ACPI_FUNCTION_TRACE("acpi_pci_link_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; link = (struct acpi_pci_link *)acpi_driver_data(device); @@ -847,7 +826,7 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) kfree(link); - return_VALUE(0); + return 0; } /* @@ -953,34 +932,32 @@ static int __init irqrouter_init_sysfs(void) { int error; - ACPI_FUNCTION_TRACE("irqrouter_init_sysfs"); if (acpi_disabled || acpi_noirq) - return_VALUE(0); + return 0; error = sysdev_class_register(&irqrouter_sysdev_class); if (!error) error = sysdev_register(&device_irqrouter); - return_VALUE(error); + return error; } device_initcall(irqrouter_init_sysfs); static int __init acpi_pci_link_init(void) { - ACPI_FUNCTION_TRACE("acpi_pci_link_init"); if (acpi_noirq) - return_VALUE(0); + return 0; acpi_link.count = 0; INIT_LIST_HEAD(&acpi_link.entries); if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0) - return_VALUE(-ENODEV); + return -ENODEV; - return_VALUE(0); + return 0; } subsys_initcall(acpi_pci_link_init); diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 4c313eab631..8f10442119f 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -160,14 +160,13 @@ static int acpi_pci_root_add(struct acpi_device *device) unsigned long value = 0; acpi_handle handle = NULL; - ACPI_FUNCTION_TRACE("acpi_pci_root_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; root = kmalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); if (!root) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(root, 0, sizeof(struct acpi_pci_root)); INIT_LIST_HEAD(&root->node); @@ -198,7 +197,7 @@ static int acpi_pci_root_add(struct acpi_device *device) root->id.segment = 0; break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _SEG\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SEG")); result = -ENODEV; goto end; } @@ -219,7 +218,7 @@ static int acpi_pci_root_add(struct acpi_device *device) root->id.bus = 0; break; default: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BBN\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BBN")); result = -ENODEV; goto end; } @@ -231,8 +230,9 @@ static int acpi_pci_root_add(struct acpi_device *device) int bus = 0; acpi_status status; - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Wrong _BBN value, please reboot and using option 'pci=noacpi'\n")); + printk(KERN_ERR PREFIX + "Wrong _BBN value, reboot" + " and use option 'pci=noacpi'\n"); status = try_get_root_bridge_busnr(root->handle, &bus); if (ACPI_FAILURE(status)) @@ -273,9 +273,9 @@ static int acpi_pci_root_add(struct acpi_device *device) */ root->bus = pci_acpi_scan_root(device, root->id.segment, root->id.bus); if (!root->bus) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Bus %04x:%02x not present in PCI namespace\n", - root->id.segment, root->id.bus)); + printk(KERN_ERR PREFIX + "Bus %04x:%02x not present in PCI namespace\n", + root->id.segment, root->id.bus); result = -ENODEV; goto end; } @@ -306,46 +306,43 @@ static int acpi_pci_root_add(struct acpi_device *device) kfree(root); } - return_VALUE(result); + return result; } static int acpi_pci_root_start(struct acpi_device *device) { struct acpi_pci_root *root; - ACPI_FUNCTION_TRACE("acpi_pci_root_start"); list_for_each_entry(root, &acpi_pci_roots, node) { if (root->handle == device->handle) { pci_bus_add_devices(root->bus); - return_VALUE(0); + return 0; } } - return_VALUE(-ENODEV); + return -ENODEV; } static int acpi_pci_root_remove(struct acpi_device *device, int type) { struct acpi_pci_root *root = NULL; - ACPI_FUNCTION_TRACE("acpi_pci_root_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; root = (struct acpi_pci_root *)acpi_driver_data(device); kfree(root); - return_VALUE(0); + return 0; } static int __init acpi_pci_root_init(void) { - ACPI_FUNCTION_TRACE("acpi_pci_root_init"); if (acpi_pci_disabled) - return_VALUE(0); + return 0; /* DEBUG: acpi_dbg_layer = ACPI_PCI_COMPONENT; @@ -353,9 +350,9 @@ static int __init acpi_pci_root_init(void) */ if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) - return_VALUE(-ENODEV); + return -ENODEV; - return_VALUE(0); + return 0; } subsys_initcall(acpi_pci_root_init); diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 62a5595ed8b..224f729f700 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c @@ -98,23 +98,21 @@ acpi_power_get_context(acpi_handle handle, int result = 0; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_power_get_context"); if (!resource) - return_VALUE(-ENODEV); + return -ENODEV; result = acpi_bus_get_device(handle, &device); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error getting context [%p]\n", - handle)); - return_VALUE(result); + printk(KERN_WARNING PREFIX "Getting context [%p]\n", handle); + return result; } *resource = (struct acpi_power_resource *)acpi_driver_data(device); if (!resource) - return_VALUE(-ENODEV); + return -ENODEV; - return_VALUE(0); + return 0; } static int acpi_power_get_state(struct acpi_power_resource *resource) @@ -122,14 +120,13 @@ static int acpi_power_get_state(struct acpi_power_resource *resource) acpi_status status = AE_OK; unsigned long sta = 0; - ACPI_FUNCTION_TRACE("acpi_power_get_state"); if (!resource) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_evaluate_integer(resource->handle, "_STA", NULL, &sta); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; if (sta & 0x01) resource->state = ACPI_POWER_RESOURCE_STATE_ON; @@ -139,7 +136,7 @@ static int acpi_power_get_state(struct acpi_power_resource *resource) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", resource->name, resource->state ? "on" : "off")); - return_VALUE(0); + return 0; } static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) @@ -148,20 +145,19 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) struct acpi_power_resource *resource = NULL; u32 i = 0; - ACPI_FUNCTION_TRACE("acpi_power_get_list_state"); if (!list || !state) - return_VALUE(-EINVAL); + return -EINVAL; /* The state of the list is 'on' IFF all resources are 'on'. */ for (i = 0; i < list->count; i++) { result = acpi_power_get_context(list->handles[i], &resource); if (result) - return_VALUE(result); + return result; result = acpi_power_get_state(resource); if (result) - return_VALUE(result); + return result; *state = resource->state; @@ -172,7 +168,7 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource list is %s\n", *state ? "on" : "off")); - return_VALUE(result); + return result; } static int acpi_power_on(acpi_handle handle) @@ -182,11 +178,10 @@ static int acpi_power_on(acpi_handle handle) struct acpi_device *device = NULL; struct acpi_power_resource *resource = NULL; - ACPI_FUNCTION_TRACE("acpi_power_on"); result = acpi_power_get_context(handle, &resource); if (result) - return_VALUE(result); + return result; resource->references++; @@ -194,29 +189,29 @@ static int acpi_power_on(acpi_handle handle) || (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n", resource->name)); - return_VALUE(0); + return 0; } status = acpi_evaluate_object(resource->handle, "_ON", NULL, NULL); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; result = acpi_power_get_state(resource); if (result) - return_VALUE(result); + return result; if (resource->state != ACPI_POWER_RESOURCE_STATE_ON) - return_VALUE(-ENOEXEC); + return -ENOEXEC; /* Update the power resource's _device_ power state */ result = acpi_bus_get_device(resource->handle, &device); if (result) - return_VALUE(result); + return result; device->power.state = ACPI_STATE_D0; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n", resource->name)); - return_VALUE(0); + return 0; } static int acpi_power_off_device(acpi_handle handle) @@ -226,11 +221,10 @@ static int acpi_power_off_device(acpi_handle handle) struct acpi_device *device = NULL; struct acpi_power_resource *resource = NULL; - ACPI_FUNCTION_TRACE("acpi_power_off_device"); result = acpi_power_get_context(handle, &resource); if (result) - return_VALUE(result); + return result; if (resource->references) resource->references--; @@ -239,35 +233,35 @@ static int acpi_power_off_device(acpi_handle handle) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is still in use, dereferencing\n", device->pnp.bus_id)); - return_VALUE(0); + return 0; } if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n", device->pnp.bus_id)); - return_VALUE(0); + return 0; } status = acpi_evaluate_object(resource->handle, "_OFF", NULL, NULL); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; result = acpi_power_get_state(resource); if (result) - return_VALUE(result); + return result; if (resource->state != ACPI_POWER_RESOURCE_STATE_OFF) - return_VALUE(-ENOEXEC); + return -ENOEXEC; /* Update the power resource's _device_ power state */ result = acpi_bus_get_device(resource->handle, &device); if (result) - return_VALUE(result); + return result; device->power.state = ACPI_STATE_D3; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n", resource->name)); - return_VALUE(0); + return 0; } /* @@ -283,31 +277,29 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev) int i; int ret = 0; - ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device_power"); if (!dev || !dev->wakeup.flags.valid) - return_VALUE(-1); + return -1; arg.integer.value = 1; /* Open power resource */ for (i = 0; i < dev->wakeup.resources.count; i++) { ret = acpi_power_on(dev->wakeup.resources.handles[i]); if (ret) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error transition power state\n")); + printk(KERN_ERR PREFIX "Transition power state\n"); dev->wakeup.flags.valid = 0; - return_VALUE(-1); + return -1; } } /* Execute PSW */ status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluate _PSW\n")); + printk(KERN_ERR PREFIX "Evaluate _PSW\n"); dev->wakeup.flags.valid = 0; ret = -1; } - return_VALUE(ret); + return ret; } /* @@ -323,32 +315,30 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) int i; int ret = 0; - ACPI_FUNCTION_TRACE("acpi_disable_wakeup_device_power"); if (!dev || !dev->wakeup.flags.valid) - return_VALUE(-1); + return -1; arg.integer.value = 0; /* Execute PSW */ status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluate _PSW\n")); + printk(KERN_ERR PREFIX "Evaluate _PSW\n"); dev->wakeup.flags.valid = 0; - return_VALUE(-1); + return -1; } /* Close power resource */ for (i = 0; i < dev->wakeup.resources.count; i++) { ret = acpi_power_off_device(dev->wakeup.resources.handles[i]); if (ret) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error transition power state\n")); + printk(KERN_ERR PREFIX "Transition power state\n"); dev->wakeup.flags.valid = 0; - return_VALUE(-1); + return -1; } } - return_VALUE(ret); + return ret; } /* -------------------------------------------------------------------------- @@ -362,10 +352,9 @@ int acpi_power_get_inferred_state(struct acpi_device *device) int list_state = 0; int i = 0; - ACPI_FUNCTION_TRACE("acpi_power_get_inferred_state"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; device->power.state = ACPI_STATE_UNKNOWN; @@ -380,17 +369,17 @@ int acpi_power_get_inferred_state(struct acpi_device *device) result = acpi_power_get_list_state(list, &list_state); if (result) - return_VALUE(result); + return result; if (list_state == ACPI_POWER_RESOURCE_STATE_ON) { device->power.state = i; - return_VALUE(0); + return 0; } } device->power.state = ACPI_STATE_D3; - return_VALUE(0); + return 0; } int acpi_power_transition(struct acpi_device *device, int state) @@ -400,14 +389,13 @@ int acpi_power_transition(struct acpi_device *device, int state) struct acpi_handle_list *tl = NULL; /* Target Resources */ int i = 0; - ACPI_FUNCTION_TRACE("acpi_power_transition"); if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) - return_VALUE(-EINVAL); + return -EINVAL; if ((device->power.state < ACPI_STATE_D0) || (device->power.state > ACPI_STATE_D3)) - return_VALUE(-ENODEV); + return -ENODEV; cl = &device->power.states[device->power.state].resources; tl = &device->power.states[state].resources; @@ -444,11 +432,10 @@ int acpi_power_transition(struct acpi_device *device, int state) device->power.state = state; end: if (result) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Error transitioning device [%s] to D%d\n", - device->pnp.bus_id, state)); + printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n", + device->pnp.bus_id, state); - return_VALUE(result); + return result; } /* -------------------------------------------------------------------------- @@ -461,7 +448,6 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset) { struct acpi_power_resource *resource = NULL; - ACPI_FUNCTION_TRACE("acpi_power_seq_show"); resource = (struct acpi_power_resource *)seq->private; @@ -488,7 +474,7 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset) resource->order, resource->references); end: - return_VALUE(0); + return 0; } static int acpi_power_open_fs(struct inode *inode, struct file *file) @@ -500,36 +486,32 @@ static int acpi_power_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_power_add_fs"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_power_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; } /* 'status' [R] */ entry = create_proc_entry(ACPI_POWER_FILE_STATUS, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_POWER_FILE_STATUS)); + return -EIO; else { entry->proc_fops = &acpi_power_fops; entry->data = acpi_driver_data(device); } - return_VALUE(0); + return 0; } static int acpi_power_remove_fs(struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_power_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_POWER_FILE_STATUS, @@ -538,7 +520,7 @@ static int acpi_power_remove_fs(struct acpi_device *device) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -553,14 +535,13 @@ static int acpi_power_add(struct acpi_device *device) union acpi_object acpi_object; struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object }; - ACPI_FUNCTION_TRACE("acpi_power_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; resource = kmalloc(sizeof(struct acpi_power_resource), GFP_KERNEL); if (!resource) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(resource, 0, sizeof(struct acpi_power_resource)); resource->handle = device->handle; @@ -605,17 +586,16 @@ static int acpi_power_add(struct acpi_device *device) if (result) kfree(resource); - return_VALUE(result); + return result; } static int acpi_power_remove(struct acpi_device *device, int type) { struct acpi_power_resource *resource = NULL; - ACPI_FUNCTION_TRACE("acpi_power_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; resource = (struct acpi_power_resource *)acpi_driver_data(device); @@ -623,31 +603,30 @@ static int acpi_power_remove(struct acpi_device *device, int type) kfree(resource); - return_VALUE(0); + return 0; } static int __init acpi_power_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_power_init"); if (acpi_disabled) - return_VALUE(0); + return 0; INIT_LIST_HEAD(&acpi_power_resource_list); acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir); if (!acpi_power_dir) - return_VALUE(-ENODEV); + return -ENODEV; result = acpi_bus_register_driver(&acpi_power_driver); if (result < 0) { remove_proc_entry(ACPI_POWER_CLASS, acpi_root_dir); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } subsys_initcall(acpi_power_init); diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index decaebb4cbe..52674323b14 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -122,10 +122,9 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev) u8 value1 = 0; u8 value2 = 0; - ACPI_FUNCTION_TRACE("acpi_processor_errata_piix4"); if (!dev) - return_VALUE(-EINVAL); + return -EINVAL; /* * Note that 'dev' references the PIIX4 ACPI Controller. @@ -218,7 +217,7 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Type-F DMA livelock erratum (C3 disabled)\n")); - return_VALUE(0); + return 0; } static int acpi_processor_errata(struct acpi_processor *pr) @@ -226,10 +225,9 @@ static int acpi_processor_errata(struct acpi_processor *pr) int result = 0; struct pci_dev *dev = NULL; - ACPI_FUNCTION_TRACE("acpi_processor_errata"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; /* * PIIX4 @@ -242,7 +240,7 @@ static int acpi_processor_errata(struct acpi_processor *pr) pci_dev_put(dev); } - return_VALUE(result); + return result; } /* -------------------------------------------------------------------------- @@ -258,10 +256,9 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr) struct acpi_object_list *pdc_in = pr->pdc; acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("acpi_processor_set_pdc"); if (!pdc_in) - return_VALUE(status); + return status; status = acpi_evaluate_object(pr->handle, "_PDC", pdc_in, NULL); @@ -269,7 +266,7 @@ static int acpi_processor_set_pdc(struct acpi_processor *pr) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not evaluate _PDC, using legacy perf. control...\n")); - return_VALUE(status); + return status; } /* -------------------------------------------------------------------------- @@ -282,7 +279,6 @@ static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) { struct acpi_processor *pr = (struct acpi_processor *)seq->private; - ACPI_FUNCTION_TRACE("acpi_processor_info_seq_show"); if (!pr) goto end; @@ -301,7 +297,7 @@ static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset) pr->flags.limit ? "yes" : "no"); end: - return_VALUE(0); + return 0; } static int acpi_processor_info_open_fs(struct inode *inode, struct file *file) @@ -314,13 +310,12 @@ static int acpi_processor_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_processor_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_processor_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; } acpi_device_dir(device)->owner = THIS_MODULE; @@ -328,9 +323,7 @@ static int acpi_processor_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_PROCESSOR_FILE_INFO, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_INFO)); + return -EIO; else { entry->proc_fops = &acpi_processor_info_fops; entry->data = acpi_driver_data(device); @@ -342,9 +335,7 @@ static int acpi_processor_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_THROTTLING)); + return -EIO; else { entry->proc_fops = &acpi_processor_throttling_fops; entry->data = acpi_driver_data(device); @@ -356,21 +347,18 @@ static int acpi_processor_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_LIMIT)); + return -EIO; else { entry->proc_fops = &acpi_processor_limit_fops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_processor_remove_fs(struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_processor_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_PROCESSOR_FILE_INFO, @@ -383,7 +371,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* Use the acpiid in MADT to map cpus in case of SMP */ @@ -430,10 +418,9 @@ static int acpi_processor_get_info(struct acpi_processor *pr) int cpu_index; static int cpu0_initialized; - ACPI_FUNCTION_TRACE("acpi_processor_get_info"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if (num_online_cpus() > 1) errata.smp = TRUE; @@ -459,9 +446,8 @@ static int acpi_processor_get_info(struct acpi_processor *pr) */ status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error evaluating processor object\n")); - return_VALUE(-ENODEV); + printk(KERN_ERR PREFIX "Evaluating processor object\n"); + return -ENODEV; } /* @@ -490,10 +476,10 @@ static int acpi_processor_get_info(struct acpi_processor *pr) if (cpu_index == -1) { if (ACPI_FAILURE (acpi_processor_hotadd_init(pr->handle, &pr->id))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error getting cpuindex for acpiid 0x%x\n", - pr->acpi_id)); - return_VALUE(-ENODEV); + printk(KERN_ERR PREFIX + "Getting cpuindex for acpiid 0x%x\n", + pr->acpi_id); + return -ENODEV; } } @@ -503,8 +489,8 @@ static int acpi_processor_get_info(struct acpi_processor *pr) if (!object.processor.pblk_address) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No PBLK (NULL address)\n")); else if (object.processor.pblk_length != 6) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid PBLK length [%d]\n", - object.processor.pblk_length)); + printk(KERN_ERR PREFIX "Invalid PBLK length [%d]\n", + object.processor.pblk_length); else { pr->throttling.address = object.processor.pblk_address; pr->throttling.duty_offset = acpi_fadt.duty_offset; @@ -528,7 +514,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) acpi_processor_get_throttling_info(pr); acpi_processor_get_limit_info(pr); - return_VALUE(0); + return 0; } static void *processor_device_array[NR_CPUS]; @@ -539,14 +525,13 @@ static int acpi_processor_start(struct acpi_device *device) acpi_status status = AE_OK; struct acpi_processor *pr; - ACPI_FUNCTION_TRACE("acpi_processor_start"); pr = acpi_driver_data(device); result = acpi_processor_get_info(pr); if (result) { /* Processor is physically not present */ - return_VALUE(0); + return 0; } BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0)); @@ -560,7 +545,7 @@ static int acpi_processor_start(struct acpi_device *device) processor_device_array[pr->id] != (void *)device) { printk(KERN_WARNING "BIOS reported wrong ACPI id" "for the processor\n"); - return_VALUE(-ENODEV); + return -ENODEV; } processor_device_array[pr->id] = (void *)device; @@ -572,10 +557,6 @@ static int acpi_processor_start(struct acpi_device *device) status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, acpi_processor_notify, pr); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing device notify handler\n")); - } /* _PDC call should be done before doing anything else (if reqd.). */ arch_acpi_processor_init_pdc(pr); @@ -592,7 +573,7 @@ static int acpi_processor_start(struct acpi_device *device) end: - return_VALUE(result); + return result; } static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) @@ -600,13 +581,12 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) struct acpi_processor *pr = (struct acpi_processor *)data; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_processor_notify"); if (!pr) - return_VOID; + return; if (acpi_bus_get_device(pr->handle, &device)) - return_VOID; + return; switch (event) { case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: @@ -624,21 +604,20 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } static int acpi_processor_add(struct acpi_device *device) { struct acpi_processor *pr = NULL; - ACPI_FUNCTION_TRACE("acpi_processor_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; pr = kmalloc(sizeof(struct acpi_processor), GFP_KERNEL); if (!pr) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(pr, 0, sizeof(struct acpi_processor)); pr->handle = device->handle; @@ -646,7 +625,7 @@ static int acpi_processor_add(struct acpi_device *device) strcpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS); acpi_driver_data(device) = pr; - return_VALUE(0); + return 0; } static int acpi_processor_remove(struct acpi_device *device, int type) @@ -654,31 +633,26 @@ static int acpi_processor_remove(struct acpi_device *device, int type) acpi_status status = AE_OK; struct acpi_processor *pr = NULL; - ACPI_FUNCTION_TRACE("acpi_processor_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; pr = (struct acpi_processor *)acpi_driver_data(device); if (pr->id >= NR_CPUS) { kfree(pr); - return_VALUE(0); + return 0; } if (type == ACPI_BUS_REMOVAL_EJECT) { if (acpi_processor_handle_eject(pr)) - return_VALUE(-EINVAL); + return -EINVAL; } acpi_processor_power_exit(pr, device); status = acpi_remove_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY, acpi_processor_notify); - if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); - } acpi_processor_remove_fs(device); @@ -686,7 +660,7 @@ static int acpi_processor_remove(struct acpi_device *device, int type) kfree(pr); - return_VALUE(0); + return 0; } #ifdef CONFIG_ACPI_HOTPLUG_CPU @@ -701,15 +675,13 @@ static int is_processor_present(acpi_handle handle) acpi_status status; unsigned long sta = 0; - ACPI_FUNCTION_TRACE("is_processor_present"); status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); if (ACPI_FAILURE(status) || !(sta & ACPI_STA_PRESENT)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Processor Device is not present\n")); - return_VALUE(0); + ACPI_EXCEPTION((AE_INFO, status, "Processor Device is not present")); + return 0; } - return_VALUE(1); + return 1; } static @@ -719,30 +691,29 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) struct acpi_device *pdev; struct acpi_processor *pr; - ACPI_FUNCTION_TRACE("acpi_processor_device_add"); if (acpi_get_parent(handle, &phandle)) { - return_VALUE(-ENODEV); + return -ENODEV; } if (acpi_bus_get_device(phandle, &pdev)) { - return_VALUE(-ENODEV); + return -ENODEV; } if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_PROCESSOR)) { - return_VALUE(-ENODEV); + return -ENODEV; } acpi_bus_start(*device); pr = acpi_driver_data(*device); if (!pr) - return_VALUE(-ENODEV); + return -ENODEV; if ((pr->id >= 0) && (pr->id < NR_CPUS)) { kobject_uevent(&(*device)->kobj, KOBJ_ONLINE); } - return_VALUE(0); + return 0; } static void @@ -752,7 +723,6 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) struct acpi_device *device = NULL; int result; - ACPI_FUNCTION_TRACE("acpi_processor_hotplug_notify"); switch (event) { case ACPI_NOTIFY_BUS_CHECK: @@ -767,15 +737,14 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) if (acpi_bus_get_device(handle, &device)) { result = acpi_processor_device_add(handle, &device); if (result) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to add the device\n")); + printk(KERN_ERR PREFIX + "Unable to add the device\n"); break; } pr = acpi_driver_data(device); if (!pr) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Driver data is NULL\n")); + printk(KERN_ERR PREFIX "Driver data is NULL\n"); break; } @@ -788,9 +757,8 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) { kobject_uevent(&device->kobj, KOBJ_ONLINE); } else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device [%s] failed to start\n", - acpi_device_bid(device))); + printk(KERN_ERR PREFIX "Device [%s] failed to start\n", + acpi_device_bid(device)); } break; case ACPI_NOTIFY_EJECT_REQUEST: @@ -798,15 +766,15 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) "received ACPI_NOTIFY_EJECT_REQUEST\n")); if (acpi_bus_get_device(handle, &device)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Device don't exist, dropping EJECT\n")); + printk(KERN_ERR PREFIX + "Device don't exist, dropping EJECT\n"); break; } pr = acpi_driver_data(device); if (!pr) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Driver data is NULL, dropping EJECT\n")); - return_VOID; + printk(KERN_ERR PREFIX + "Driver data is NULL, dropping EJECT\n"); + return; } if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) @@ -818,7 +786,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } static acpi_status @@ -857,21 +825,20 @@ processor_walk_namespace_cb(acpi_handle handle, static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu) { - ACPI_FUNCTION_TRACE("acpi_processor_hotadd_init"); if (!is_processor_present(handle)) { - return_VALUE(AE_ERROR); + return AE_ERROR; } if (acpi_map_lsapic(handle, p_cpu)) - return_VALUE(AE_ERROR); + return AE_ERROR; if (arch_register_cpu(*p_cpu)) { acpi_unmap_lsapic(*p_cpu); - return_VALUE(AE_ERROR); + return AE_ERROR; } - return_VALUE(AE_OK); + return AE_OK; } static int acpi_processor_handle_eject(struct acpi_processor *pr) @@ -928,20 +895,19 @@ static int __init acpi_processor_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_processor_init"); memset(&processors, 0, sizeof(processors)); memset(&errata, 0, sizeof(errata)); acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); if (!acpi_processor_dir) - return_VALUE(0); + return 0; acpi_processor_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_processor_driver); if (result < 0) { remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); - return_VALUE(0); + return 0; } acpi_processor_install_hotplug_notify(); @@ -950,12 +916,11 @@ static int __init acpi_processor_init(void) acpi_processor_ppc_init(); - return_VALUE(0); + return 0; } static void __exit acpi_processor_exit(void) { - ACPI_FUNCTION_TRACE("acpi_processor_exit"); acpi_processor_ppc_exit(); @@ -967,7 +932,7 @@ static void __exit acpi_processor_exit(void) remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); - return_VOID; + return; } module_init(acpi_processor_init); diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 8a74bf3efd8..e439eb77d28 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -3,7 +3,7 @@ * * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> - * Copyright (C) 2004 Dominik Brodowski <linux@brodo.de> + * Copyright (C) 2004, 2005 Dominik Brodowski <linux@brodo.de> * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> * - Added processor hotplug support * Copyright (C) 2005 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> @@ -99,6 +99,9 @@ static int set_max_cstate(struct dmi_system_id *id) static struct dmi_system_id __cpuinitdata processor_power_dmi_table[] = { { set_max_cstate, "IBM ThinkPad R40e", { DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), + DMI_MATCH(DMI_BIOS_VERSION,"1SET70WW")}, (void *)1}, + { set_max_cstate, "IBM ThinkPad R40e", { + DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW")}, (void *)1}, { set_max_cstate, "IBM ThinkPad R40e", { DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), @@ -261,21 +264,15 @@ static void acpi_processor_idle(void) u32 bm_status = 0; unsigned long diff = jiffies - pr->power.bm_check_timestamp; - if (diff > 32) - diff = 32; + if (diff > 31) + diff = 31; - while (diff) { - /* if we didn't get called, assume there was busmaster activity */ - diff--; - if (diff) - pr->power.bm_activity |= 0x1; - pr->power.bm_activity <<= 1; - } + pr->power.bm_activity <<= diff; acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status, ACPI_MTX_DO_NOT_LOCK); if (bm_status) { - pr->power.bm_activity++; + pr->power.bm_activity |= 0x1; acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); } @@ -287,16 +284,16 @@ static void acpi_processor_idle(void) else if (errata.piix4.bmisx) { if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01) || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01)) - pr->power.bm_activity++; + pr->power.bm_activity |= 0x1; } pr->power.bm_check_timestamp = jiffies; /* - * Apply bus mastering demotion policy. Automatically demote + * If bus mastering is or was active this jiffy, demote * to avoid a faulty transition. Note that the processor * won't enter a low-power state during this call (to this - * funciton) but should upon the next. + * function) but should upon the next. * * TBD: A better policy might be to fallback to the demotion * state (use it for this quantum only) istead of @@ -304,7 +301,8 @@ static void acpi_processor_idle(void) * qualification. This may, however, introduce DMA * issues (e.g. floppy DMA transfer overrun/underrun). */ - if (pr->power.bm_activity & cx->demotion.threshold.bm) { + if ((pr->power.bm_activity & 0x1) && + cx->demotion.threshold.bm) { local_irq_enable(); next_state = cx->demotion.state; goto end; @@ -322,8 +320,6 @@ static void acpi_processor_idle(void) cx = &pr->power.states[ACPI_STATE_C1]; #endif - cx->usage++; - /* * Sleep: * ------ @@ -365,7 +361,9 @@ static void acpi_processor_idle(void) t1 = inl(acpi_fadt.xpm_tmr_blk.address); /* Invoke C2 */ inb(cx->address); - /* Dummy op - must do something useless after P_LVL2 read */ + /* Dummy wait op - must do something useless after P_LVL2 read + because chipsets cannot guarantee that STPCLK# signal + gets asserted in time to freeze execution properly. */ t2 = inl(acpi_fadt.xpm_tmr_blk.address); /* Get end time (ticks) */ t2 = inl(acpi_fadt.xpm_tmr_blk.address); @@ -403,7 +401,7 @@ static void acpi_processor_idle(void) t1 = inl(acpi_fadt.xpm_tmr_blk.address); /* Invoke C3 */ inb(cx->address); - /* Dummy op - must do something useless after P_LVL3 read */ + /* Dummy wait op (see above) */ t2 = inl(acpi_fadt.xpm_tmr_blk.address); /* Get end time (ticks) */ t2 = inl(acpi_fadt.xpm_tmr_blk.address); @@ -430,6 +428,9 @@ static void acpi_processor_idle(void) local_irq_enable(); return; } + cx->usage++; + if ((cx->type != ACPI_STATE_C1) && (sleep_ticks > 0)) + cx->time += sleep_ticks; next_state = pr->power.state; @@ -517,10 +518,9 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr) struct acpi_processor_cx *higher = NULL; struct acpi_processor_cx *cx; - ACPI_FUNCTION_TRACE("acpi_processor_set_power_policy"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; /* * This function sets the default Cx state policy (OS idle handler). @@ -544,7 +544,7 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr) } if (!state_is_set) - return_VALUE(-ENODEV); + return -ENODEV; /* demotion */ for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { @@ -583,18 +583,17 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr) higher = cx; } - return_VALUE(0); + return 0; } static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) { - ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_fadt"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if (!pr->pblk) - return_VALUE(-ENODEV); + return -ENODEV; /* if info is obtained from pblk/fadt, type equals state */ pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2; @@ -606,7 +605,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) * an SMP system. */ if ((num_online_cpus() > 1) && !acpi_fadt.plvl2_up) - return_VALUE(-ENODEV); + return -ENODEV; #endif /* determine C2 and C3 address from pblk */ @@ -622,12 +621,11 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) pr->power.states[ACPI_STATE_C2].address, pr->power.states[ACPI_STATE_C3].address)); - return_VALUE(0); + return 0; } static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) { - ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); /* Zero initialize all the C-states info. */ memset(pr->power.states, 0, sizeof(pr->power.states)); @@ -640,7 +638,7 @@ static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) pr->power.states[ACPI_STATE_C0].valid = 1; pr->power.states[ACPI_STATE_C1].valid = 1; - return_VALUE(0); + return 0; } static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) @@ -652,10 +650,9 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *cst; - ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst"); if (nocst) - return_VALUE(-ENODEV); + return -ENODEV; current_count = 1; @@ -667,15 +664,14 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _CST, giving up\n")); - return_VALUE(-ENODEV); + return -ENODEV; } cst = (union acpi_object *)buffer.pointer; /* There must be at least 2 elements */ if (!cst || (cst->type != ACPI_TYPE_PACKAGE) || cst->package.count < 2) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "not enough elements in _CST\n")); + printk(KERN_ERR PREFIX "not enough elements in _CST\n"); status = -EFAULT; goto end; } @@ -684,8 +680,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) /* Validate number of power states. */ if (count < 1 || count != cst->package.count - 1) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "count given by _CST is not valid\n")); + printk(KERN_ERR PREFIX "count given by _CST is not valid\n"); status = -EFAULT; goto end; } @@ -775,15 +770,14 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) end: acpi_os_free(buffer.pointer); - return_VALUE(status); + return status; } static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) { - ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c2"); if (!cx->address) - return_VOID; + return; /* * C2 latency must be less than or equal to 100 @@ -792,7 +786,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "latency too large [%d]\n", cx->latency)); - return_VOID; + return; } /* @@ -802,7 +796,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) cx->valid = 1; cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); - return_VOID; + return; } static void acpi_processor_power_verify_c3(struct acpi_processor *pr, @@ -810,10 +804,9 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, { static int bm_check_flag; - ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c3"); if (!cx->address) - return_VOID; + return; /* * C3 latency must be less than or equal to 1000 @@ -822,7 +815,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "latency too large [%d]\n", cx->latency)); - return_VOID; + return; } /* @@ -835,7 +828,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, else if (errata.piix4.fdma) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "C3 not supported on PIIX4 with Type-F DMA\n")); - return_VOID; + return; } /* All the logic here assumes flags.bm_check is same across all CPUs */ @@ -852,7 +845,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, if (!pr->flags.bm_control) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "C3 support requires bus mastering control\n")); - return_VOID; + return; } } else { /* @@ -863,7 +856,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cache invalidation should work properly" " for C3 to be enabled on SMP systems\n")); - return_VOID; + return; } acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK); @@ -878,7 +871,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, cx->valid = 1; cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); - return_VOID; + return; } static int acpi_processor_power_verify(struct acpi_processor *pr) @@ -937,7 +930,6 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) unsigned int i; int result; - ACPI_FUNCTION_TRACE("acpi_processor_get_power_info"); /* NOTE: the idle thread may not be running while calling * this function */ @@ -960,7 +952,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) */ result = acpi_processor_set_power_policy(pr); if (result) - return_VALUE(result); + return result; /* * if one state of type C2 or C3 is available, mark this @@ -974,24 +966,23 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) } } - return_VALUE(0); + return 0; } int acpi_processor_cst_has_changed(struct acpi_processor *pr) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_processor_cst_has_changed"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if (nocst) { - return_VALUE(-ENODEV); + return -ENODEV; } if (!pr->flags.power_setup_done) - return_VALUE(-ENODEV); + return -ENODEV; /* Fall back to the default idle loop */ pm_idle = pm_idle_save; @@ -1002,7 +993,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) pm_idle = acpi_processor_idle; - return_VALUE(result); + return result; } /* proc interface */ @@ -1012,7 +1003,6 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) struct acpi_processor *pr = (struct acpi_processor *)seq->private; unsigned int i; - ACPI_FUNCTION_TRACE("acpi_processor_power_seq_show"); if (!pr) goto end; @@ -1064,13 +1054,14 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) else seq_puts(seq, "demotion[--] "); - seq_printf(seq, "latency[%03d] usage[%08d]\n", + seq_printf(seq, "latency[%03d] usage[%08d] duration[%020llu]\n", pr->power.states[i].latency, - pr->power.states[i].usage); + pr->power.states[i].usage, + pr->power.states[i].time); } end: - return_VALUE(0); + return 0; } static int acpi_processor_power_open_fs(struct inode *inode, struct file *file) @@ -1094,7 +1085,6 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct proc_dir_entry *entry = NULL; unsigned int i; - ACPI_FUNCTION_TRACE("acpi_processor_power_init"); if (!first_run) { dmi_check_system(processor_power_dmi_table); @@ -1106,14 +1096,14 @@ int acpi_processor_power_init(struct acpi_processor *pr, } if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if (acpi_fadt.cst_cnt && !nocst) { status = acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Notifying BIOS of _CST ability failed\n")); + ACPI_EXCEPTION((AE_INFO, status, + "Notifying BIOS of _CST ability failed")); } } @@ -1142,9 +1132,7 @@ int acpi_processor_power_init(struct acpi_processor *pr, entry = create_proc_entry(ACPI_PROCESSOR_FILE_POWER, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_POWER)); + return -EIO; else { entry->proc_fops = &acpi_processor_power_fops; entry->data = acpi_driver_data(device); @@ -1153,13 +1141,12 @@ int acpi_processor_power_init(struct acpi_processor *pr, pr->flags.power_setup_done = 1; - return_VALUE(0); + return 0; } int acpi_processor_power_exit(struct acpi_processor *pr, struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_processor_power_exit"); pr->flags.power_setup_done = 0; @@ -1179,5 +1166,5 @@ int acpi_processor_power_exit(struct acpi_processor *pr, cpu_idle_wait(); } - return_VALUE(0); + return 0; } diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 41aaaba74b1..14a00e5a8f6 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c @@ -108,10 +108,9 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) acpi_status status = 0; unsigned long ppc = 0; - ACPI_FUNCTION_TRACE("acpi_processor_get_platform_limit"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; /* * _PPC indicates the maximum state currently supported by the platform @@ -123,13 +122,13 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) acpi_processor_ppc_status |= PPC_IN_USE; if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PPC\n")); - return_VALUE(-ENODEV); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PPC")); + return -ENODEV; } pr->performance_platform_limit = (int)ppc; - return_VALUE(0); + return 0; } int acpi_processor_ppc_has_changed(struct acpi_processor *pr) @@ -168,18 +167,17 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) union acpi_object *pct = NULL; union acpi_object obj = { 0 }; - ACPI_FUNCTION_TRACE("acpi_processor_get_performance_control"); status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PCT\n")); - return_VALUE(-ENODEV); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PCT")); + return -ENODEV; } pct = (union acpi_object *)buffer.pointer; if (!pct || (pct->type != ACPI_TYPE_PACKAGE) || (pct->package.count != 2)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PCT data\n")); + printk(KERN_ERR PREFIX "Invalid _PCT data\n"); result = -EFAULT; goto end; } @@ -193,8 +191,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) if ((obj.type != ACPI_TYPE_BUFFER) || (obj.buffer.length < sizeof(struct acpi_pct_register)) || (obj.buffer.pointer == NULL)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PCT data (control_register)\n")); + printk(KERN_ERR PREFIX "Invalid _PCT data (control_register)\n"); result = -EFAULT; goto end; } @@ -210,8 +207,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) if ((obj.type != ACPI_TYPE_BUFFER) || (obj.buffer.length < sizeof(struct acpi_pct_register)) || (obj.buffer.pointer == NULL)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PCT data (status_register)\n")); + printk(KERN_ERR PREFIX "Invalid _PCT data (status_register)\n"); result = -EFAULT; goto end; } @@ -222,7 +218,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr) end: acpi_os_free(buffer.pointer); - return_VALUE(result); + return result; } static int acpi_processor_get_performance_states(struct acpi_processor *pr) @@ -235,17 +231,16 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) union acpi_object *pss = NULL; int i; - ACPI_FUNCTION_TRACE("acpi_processor_get_performance_states"); status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PSS\n")); - return_VALUE(-ENODEV); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PSS")); + return -ENODEV; } pss = (union acpi_object *)buffer.pointer; if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data\n")); + printk(KERN_ERR PREFIX "Invalid _PSS data\n"); result = -EFAULT; goto end; } @@ -274,8 +269,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) status = acpi_extract_package(&(pss->package.elements[i]), &format, &state); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PSS data\n")); + ACPI_EXCEPTION((AE_INFO, status, "Invalid _PSS data")); result = -EFAULT; kfree(pr->performance->states); goto end; @@ -291,8 +285,8 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) (u32) px->control, (u32) px->status)); if (!px->core_frequency) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _PSS data: freq is zero\n")); + printk(KERN_ERR PREFIX + "Invalid _PSS data: freq is zero\n"); result = -EFAULT; kfree(pr->performance->states); goto end; @@ -302,7 +296,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) end: acpi_os_free(buffer.pointer); - return_VALUE(result); + return result; } static int acpi_processor_get_performance_info(struct acpi_processor *pr) @@ -311,31 +305,30 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr) acpi_status status = AE_OK; acpi_handle handle = NULL; - ACPI_FUNCTION_TRACE("acpi_processor_get_performance_info"); if (!pr || !pr->performance || !pr->handle) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_get_handle(pr->handle, "_PCT", &handle); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI-based processor performance control unavailable\n")); - return_VALUE(-ENODEV); + return -ENODEV; } result = acpi_processor_get_performance_control(pr); if (result) - return_VALUE(result); + return result; result = acpi_processor_get_performance_states(pr); if (result) - return_VALUE(result); + return result; result = acpi_processor_get_platform_limit(pr); if (result) - return_VALUE(result); + return result; - return_VALUE(0); + return 0; } int acpi_processor_notify_smm(struct module *calling_module) @@ -343,13 +336,12 @@ int acpi_processor_notify_smm(struct module *calling_module) acpi_status status; static int is_done = 0; - ACPI_FUNCTION_TRACE("acpi_processor_notify_smm"); if (!(acpi_processor_ppc_status & PPC_REGISTERED)) - return_VALUE(-EBUSY); + return -EBUSY; if (!try_module_get(calling_module)) - return_VALUE(-EINVAL); + return -EINVAL; /* is_done is set to negative if an error occured, * and to postitive if _no_ error occured, but SMM @@ -358,10 +350,10 @@ int acpi_processor_notify_smm(struct module *calling_module) */ if (is_done > 0) { module_put(calling_module); - return_VALUE(0); + return 0; } else if (is_done < 0) { module_put(calling_module); - return_VALUE(is_done); + return is_done; } is_done = -EIO; @@ -370,7 +362,7 @@ int acpi_processor_notify_smm(struct module *calling_module) if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No SMI port or pstate_cnt\n")); module_put(calling_module); - return_VALUE(0); + return 0; } ACPI_DEBUG_PRINT((ACPI_DB_INFO, @@ -387,12 +379,12 @@ int acpi_processor_notify_smm(struct module *calling_module) status = acpi_os_write_port(acpi_fadt.smi_cmd, (u32) acpi_fadt.pstate_cnt, 8); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Failed to write pstate_cnt [0x%x] to " - "smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, - acpi_fadt.smi_cmd)); + ACPI_EXCEPTION((AE_INFO, status, + "Failed to write pstate_cnt [0x%x] to " + "smi_cmd [0x%x]", acpi_fadt.pstate_cnt, + acpi_fadt.smi_cmd)); module_put(calling_module); - return_VALUE(status); + return status; } /* Success. If there's no _PPC, we need to fear nothing, so @@ -402,7 +394,7 @@ int acpi_processor_notify_smm(struct module *calling_module) if (!(acpi_processor_ppc_status & PPC_IN_USE)) module_put(calling_module); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_processor_notify_smm); @@ -423,7 +415,6 @@ static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset) struct acpi_processor *pr = (struct acpi_processor *)seq->private; int i; - ACPI_FUNCTION_TRACE("acpi_processor_perf_seq_show"); if (!pr) goto end; @@ -447,7 +438,7 @@ static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset) (u32) pr->performance->states[i].transition_latency); end: - return_VALUE(0); + return 0; } static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) @@ -469,23 +460,22 @@ acpi_processor_write_performance(struct file *file, unsigned int new_state = 0; struct cpufreq_policy policy; - ACPI_FUNCTION_TRACE("acpi_processor_write_performance"); if (!pr || (count > sizeof(state_string) - 1)) - return_VALUE(-EINVAL); + return -EINVAL; perf = pr->performance; if (!perf) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(state_string, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; state_string[count] = '\0'; new_state = simple_strtoul(state_string, NULL, 0); if (new_state >= perf->state_count) - return_VALUE(-EINVAL); + return -EINVAL; cpufreq_get_policy(&policy, pr->id); @@ -495,9 +485,9 @@ acpi_processor_write_performance(struct file *file, result = cpufreq_set_policy(&policy); if (result) - return_VALUE(result); + return result; - return_VALUE(count); + return count; } static void acpi_cpufreq_add_file(struct acpi_processor *pr) @@ -505,42 +495,36 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr) struct proc_dir_entry *entry = NULL; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); if (acpi_bus_get_device(pr->handle, &device)) - return_VOID; + return; /* add file 'performance' [R/W] */ entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); - if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_PROCESSOR_FILE_PERFORMANCE)); - else { + if (entry){ acpi_processor_perf_fops.write = acpi_processor_write_performance; entry->proc_fops = &acpi_processor_perf_fops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VOID; + return; } static void acpi_cpufreq_remove_file(struct acpi_processor *pr) { struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); if (acpi_bus_get_device(pr->handle, &device)) - return_VOID; + return; /* remove file 'performance' */ remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, acpi_device_dir(device)); - return_VOID; + return; } #else @@ -698,12 +682,12 @@ int acpi_processor_preregister_performance( /* Validate the Domain info */ count_target = pdomain->num_processors; count = 1; - if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL || - pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL) { + if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL) pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ALL; - } else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY) { + else if (pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL) + pr->performance->shared_type = CPUFREQ_SHARED_TYPE_HW; + else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY) pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ANY; - } for_each_possible_cpu(j) { if (i == j) @@ -784,22 +768,21 @@ acpi_processor_register_performance(struct acpi_processor_performance { struct acpi_processor *pr; - ACPI_FUNCTION_TRACE("acpi_processor_register_performance"); if (!(acpi_processor_ppc_status & PPC_REGISTERED)) - return_VALUE(-EINVAL); + return -EINVAL; mutex_lock(&performance_mutex); pr = processors[cpu]; if (!pr) { mutex_unlock(&performance_mutex); - return_VALUE(-ENODEV); + return -ENODEV; } if (pr->performance) { mutex_unlock(&performance_mutex); - return_VALUE(-EBUSY); + return -EBUSY; } WARN_ON(!performance); @@ -809,13 +792,13 @@ acpi_processor_register_performance(struct acpi_processor_performance if (acpi_processor_get_performance_info(pr)) { pr->performance = NULL; mutex_unlock(&performance_mutex); - return_VALUE(-EIO); + return -EIO; } acpi_cpufreq_add_file(pr); mutex_unlock(&performance_mutex); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_processor_register_performance); @@ -826,14 +809,13 @@ acpi_processor_unregister_performance(struct acpi_processor_performance { struct acpi_processor *pr; - ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance"); mutex_lock(&performance_mutex); pr = processors[cpu]; if (!pr) { mutex_unlock(&performance_mutex); - return_VOID; + return; } if (pr->performance) @@ -844,7 +826,7 @@ acpi_processor_unregister_performance(struct acpi_processor_performance mutex_unlock(&performance_mutex); - return_VOID; + return; } EXPORT_SYMBOL(acpi_processor_unregister_performance); diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index f99ad05cd6a..ef5e0f6efdb 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -54,13 +54,12 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr) u16 px = 0; u16 tx = 0; - ACPI_FUNCTION_TRACE("acpi_processor_apply_limit"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if (!pr->flags.limit) - return_VALUE(-ENODEV); + return -ENODEV; if (pr->flags.throttling) { if (pr->limit.user.tx > tx) @@ -82,9 +81,9 @@ static int acpi_processor_apply_limit(struct acpi_processor *pr) end: if (result) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to set limit\n")); + printk(KERN_ERR PREFIX "Unable to set limit\n"); - return_VALUE(result); + return result; } #ifdef CONFIG_CPU_FREQ @@ -200,19 +199,18 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) struct acpi_device *device = NULL; int tx = 0, max_tx_px = 0; - ACPI_FUNCTION_TRACE("acpi_processor_set_thermal_limit"); if ((type < ACPI_PROCESSOR_LIMIT_NONE) || (type > ACPI_PROCESSOR_LIMIT_DECREMENT)) - return_VALUE(-EINVAL); + return -EINVAL; result = acpi_bus_get_device(handle, &device); if (result) - return_VALUE(result); + return result; pr = (struct acpi_processor *)acpi_driver_data(device); if (!pr) - return_VALUE(-ENODEV); + return -ENODEV; /* Thermal limits are always relative to the current Px/Tx state. */ if (pr->flags.throttling) @@ -289,30 +287,28 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type) result = acpi_processor_apply_limit(pr); if (result) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to set thermal limit\n")); + printk(KERN_ERR PREFIX "Unable to set thermal limit\n"); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Thermal limit now (P%d:T%d)\n", pr->limit.thermal.px, pr->limit.thermal.tx)); } else result = 0; if (max_tx_px) - return_VALUE(1); + return 1; else - return_VALUE(result); + return result; } int acpi_processor_get_limit_info(struct acpi_processor *pr) { - ACPI_FUNCTION_TRACE("acpi_processor_get_limit_info"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if (pr->flags.throttling) pr->flags.limit = 1; - return_VALUE(0); + return 0; } /* /proc interface */ @@ -321,7 +317,6 @@ static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) { struct acpi_processor *pr = (struct acpi_processor *)seq->private; - ACPI_FUNCTION_TRACE("acpi_processor_limit_seq_show"); if (!pr) goto end; @@ -339,7 +334,7 @@ static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) pr->limit.thermal.px, pr->limit.thermal.tx); end: - return_VALUE(0); + return 0; } static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file) @@ -359,36 +354,33 @@ static ssize_t acpi_processor_write_limit(struct file * file, int px = 0; int tx = 0; - ACPI_FUNCTION_TRACE("acpi_processor_write_limit"); if (!pr || (count > sizeof(limit_string) - 1)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); - return_VALUE(-EINVAL); + return -EINVAL; } if (copy_from_user(limit_string, buffer, count)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n")); - return_VALUE(-EFAULT); + return -EFAULT; } limit_string[count] = '\0'; if (sscanf(limit_string, "%d:%d", &px, &tx) != 2) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n")); - return_VALUE(-EINVAL); + printk(KERN_ERR PREFIX "Invalid data format\n"); + return -EINVAL; } if (pr->flags.throttling) { if ((tx < 0) || (tx > (pr->throttling.state_count - 1))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid tx\n")); - return_VALUE(-EINVAL); + printk(KERN_ERR PREFIX "Invalid tx\n"); + return -EINVAL; } pr->limit.user.tx = tx; } result = acpi_processor_apply_limit(pr); - return_VALUE(count); + return count; } struct file_operations acpi_processor_limit_fops = { diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index b966549ec00..d044ec519db 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c @@ -55,13 +55,12 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr) u32 duty_mask = 0; u32 duty_value = 0; - ACPI_FUNCTION_TRACE("acpi_processor_get_throttling"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if (!pr->flags.throttling) - return_VALUE(-ENODEV); + return -ENODEV; pr->throttling.state = 0; @@ -93,7 +92,7 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr) "Throttling state is T%d (%d%% throttling applied)\n", state, pr->throttling.states[state].performance)); - return_VALUE(0); + return 0; } int acpi_processor_set_throttling(struct acpi_processor *pr, int state) @@ -102,19 +101,18 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) u32 duty_mask = 0; u32 duty_value = 0; - ACPI_FUNCTION_TRACE("acpi_processor_set_throttling"); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; if ((state < 0) || (state > (pr->throttling.state_count - 1))) - return_VALUE(-EINVAL); + return -EINVAL; if (!pr->flags.throttling) - return_VALUE(-ENODEV); + return -ENODEV; if (state == pr->throttling.state) - return_VALUE(0); + return 0; /* * Calculate the duty_value and duty_mask. @@ -165,7 +163,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) (pr->throttling.states[state].performance ? pr-> throttling.states[state].performance / 10 : 0))); - return_VALUE(0); + return 0; } int acpi_processor_get_throttling_info(struct acpi_processor *pr) @@ -174,7 +172,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) int step = 0; int i = 0; - ACPI_FUNCTION_TRACE("acpi_processor_get_throttling_info"); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", @@ -183,21 +180,21 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) pr->throttling.duty_width)); if (!pr) - return_VALUE(-EINVAL); + return -EINVAL; /* TBD: Support ACPI 2.0 objects */ if (!pr->throttling.address) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); - return_VALUE(0); + return 0; } else if (!pr->throttling.duty_width) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n")); - return_VALUE(0); + return 0; } /* TBD: Support duty_cycle values that span bit 4. */ else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "duty_cycle spans bit 4\n")); - return_VALUE(0); + printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n"); + return 0; } /* @@ -208,7 +205,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) if (errata.piix4.throttle) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Throttling not supported on PIIX4 A- or B-step\n")); - return_VALUE(0); + return 0; } pr->throttling.state_count = 1 << acpi_fadt.duty_width; @@ -254,7 +251,7 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) if (result) pr->flags.throttling = 0; - return_VALUE(result); + return result; } /* proc interface */ @@ -266,7 +263,6 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq, int i = 0; int result = 0; - ACPI_FUNCTION_TRACE("acpi_processor_throttling_seq_show"); if (!pr) goto end; @@ -296,7 +292,7 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq, throttling.states[i].performance / 10 : 0)); end: - return_VALUE(0); + return 0; } static int acpi_processor_throttling_open_fs(struct inode *inode, @@ -315,13 +311,12 @@ static ssize_t acpi_processor_write_throttling(struct file * file, struct acpi_processor *pr = (struct acpi_processor *)m->private; char state_string[12] = { '\0' }; - ACPI_FUNCTION_TRACE("acpi_processor_write_throttling"); if (!pr || (count > sizeof(state_string) - 1)) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(state_string, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; state_string[count] = '\0'; @@ -329,9 +324,9 @@ static ssize_t acpi_processor_write_throttling(struct file * file, simple_strtoul(state_string, NULL, 0)); if (result) - return_VALUE(result); + return result; - return_VALUE(count); + return count; } struct file_operations acpi_processor_throttling_fops = { diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index f8316a05ede..861ac378ce4 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -162,11 +162,10 @@ static void acpi_device_unregister(struct acpi_device *device, int type) void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) { - ACPI_FUNCTION_TRACE("acpi_bus_data_handler"); /* TBD */ - return_VOID; + return; } static int acpi_bus_get_power_flags(struct acpi_device *device) @@ -175,7 +174,6 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) acpi_handle handle = NULL; u32 i = 0; - ACPI_FUNCTION_TRACE("acpi_bus_get_power_flags"); /* * Power Management Flags @@ -228,7 +226,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) device->power.state = ACPI_STATE_UNKNOWN; - return_VALUE(0); + return 0; } int acpi_match_ids(struct acpi_device *device, char *ids) @@ -306,20 +304,18 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *package = NULL; - ACPI_FUNCTION_TRACE("acpi_bus_get_wakeup_flags"); /* _PRW */ status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRW\n")); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRW")); goto end; } package = (union acpi_object *)buffer.pointer; status = acpi_bus_extract_wakeup_device_power_package(device, package); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error extracting _PRW package\n")); + ACPI_EXCEPTION((AE_INFO, status, "Extracting _PRW package")); goto end; } @@ -333,7 +329,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) end: if (ACPI_FAILURE(status)) device->flags.wake_capable = 0; - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -489,19 +485,18 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_bus_driver_init"); if (!device || !driver) - return_VALUE(-EINVAL); + return -EINVAL; if (!driver->ops.add) - return_VALUE(-ENOSYS); + return -ENOSYS; result = driver->ops.add(device); if (result) { device->driver = NULL; acpi_driver_data(device) = NULL; - return_VALUE(result); + return result; } device->driver = driver; @@ -513,7 +508,7 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Driver successfully bound to device\n")); - return_VALUE(0); + return 0; } static int acpi_start_single_object(struct acpi_device *device) @@ -521,10 +516,9 @@ static int acpi_start_single_object(struct acpi_device *device) int result = 0; struct acpi_driver *driver; - ACPI_FUNCTION_TRACE("acpi_start_single_object"); if (!(driver = device->driver)) - return_VALUE(0); + return 0; if (driver->ops.start) { result = driver->ops.start(device); @@ -532,14 +526,13 @@ static int acpi_start_single_object(struct acpi_device *device) driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL); } - return_VALUE(result); + return result; } static void acpi_driver_attach(struct acpi_driver *drv) { struct list_head *node, *next; - ACPI_FUNCTION_TRACE("acpi_driver_attach"); spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_device_list) { @@ -568,7 +561,6 @@ static void acpi_driver_detach(struct acpi_driver *drv) { struct list_head *node, *next; - ACPI_FUNCTION_TRACE("acpi_driver_detach"); spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_device_list) { @@ -598,17 +590,16 @@ static void acpi_driver_detach(struct acpi_driver *drv) */ int acpi_bus_register_driver(struct acpi_driver *driver) { - ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); if (acpi_disabled) - return_VALUE(-ENODEV); + return -ENODEV; spin_lock(&acpi_device_lock); list_add_tail(&driver->node, &acpi_bus_drivers); spin_unlock(&acpi_device_lock); acpi_driver_attach(driver); - return_VALUE(0); + return 0; } EXPORT_SYMBOL(acpi_bus_register_driver); @@ -646,7 +637,6 @@ static int acpi_bus_find_driver(struct acpi_device *device) int result = 0; struct list_head *node, *next; - ACPI_FUNCTION_TRACE("acpi_bus_find_driver"); spin_lock(&acpi_device_lock); list_for_each_safe(node, next, &acpi_bus_drivers) { @@ -666,19 +656,41 @@ static int acpi_bus_find_driver(struct acpi_device *device) spin_unlock(&acpi_device_lock); Done: - return_VALUE(result); + return result; } /* -------------------------------------------------------------------------- Device Enumeration -------------------------------------------------------------------------- */ +acpi_status +acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd) +{ + acpi_status status; + acpi_handle tmp; + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; + union acpi_object *obj; + + status = acpi_get_handle(handle, "_EJD", &tmp); + if (ACPI_FAILURE(status)) + return status; + + status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer); + if (ACPI_SUCCESS(status)) { + obj = buffer.pointer; + status = acpi_get_handle(NULL, obj->string.pointer, ejd); + kfree(buffer.pointer); + } + return status; +} +EXPORT_SYMBOL_GPL(acpi_bus_get_ejd); + + static int acpi_bus_get_flags(struct acpi_device *device) { acpi_status status = AE_OK; acpi_handle temp = NULL; - ACPI_FUNCTION_TRACE("acpi_bus_get_flags"); /* Presence of _STA indicates 'dynamic_status' */ status = acpi_get_handle(device->handle, "_STA", &temp); @@ -724,7 +736,7 @@ static int acpi_bus_get_flags(struct acpi_device *device) /* TBD: Peformance management */ - return_VALUE(0); + return 0; } static void acpi_device_get_busid(struct acpi_device *device, @@ -918,10 +930,9 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) int result = 0; struct acpi_driver *driver; - ACPI_FUNCTION_TRACE("acpi_bus_remove"); if (!dev) - return_VALUE(-EINVAL); + return -EINVAL; driver = dev->driver; @@ -930,12 +941,12 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) if (driver->ops.stop) { result = driver->ops.stop(dev, ACPI_BUS_REMOVAL_EJECT); if (result) - return_VALUE(result); + return result; } result = dev->driver->ops.remove(dev, ACPI_BUS_REMOVAL_EJECT); if (result) { - return_VALUE(result); + return result; } atomic_dec(&dev->driver->references); @@ -944,7 +955,7 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) } if (!rmdevice) - return_VALUE(0); + return 0; if (dev->flags.bus_address) { if ((dev->parent) && (dev->parent->ops.unbind)) @@ -953,7 +964,7 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice) acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT); - return_VALUE(0); + return 0; } static int @@ -963,15 +974,14 @@ acpi_add_single_object(struct acpi_device **child, int result = 0; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_add_single_object"); if (!child) - return_VALUE(-EINVAL); + return -EINVAL; device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL); if (!device) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Memory allocation error\n")); - return_VALUE(-ENOMEM); + printk(KERN_ERR PREFIX "Memory allocation error\n"); + return -ENOMEM; } memset(device, 0, sizeof(struct acpi_device)); @@ -1096,7 +1106,7 @@ acpi_add_single_object(struct acpi_device **child, kfree(device); } - return_VALUE(result); + return result; } static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops) @@ -1109,10 +1119,9 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops) acpi_object_type type = 0; u32 level = 1; - ACPI_FUNCTION_TRACE("acpi_bus_scan"); if (!start) - return_VALUE(-EINVAL); + return -EINVAL; parent = start; phandle = start->handle; @@ -1209,7 +1218,7 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops) } } - return_VALUE(0); + return 0; } int @@ -1219,7 +1228,6 @@ acpi_bus_add(struct acpi_device **child, int result; struct acpi_bus_ops ops; - ACPI_FUNCTION_TRACE("acpi_bus_add"); result = acpi_add_single_object(child, parent, handle, type); if (!result) { @@ -1227,7 +1235,7 @@ acpi_bus_add(struct acpi_device **child, ops.acpi_op_add = 1; result = acpi_bus_scan(*child, &ops); } - return_VALUE(result); + return result; } EXPORT_SYMBOL(acpi_bus_add); @@ -1237,10 +1245,9 @@ int acpi_bus_start(struct acpi_device *device) int result; struct acpi_bus_ops ops; - ACPI_FUNCTION_TRACE("acpi_bus_start"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; result = acpi_start_single_object(device); if (!result) { @@ -1248,7 +1255,7 @@ int acpi_bus_start(struct acpi_device *device) ops.acpi_op_start = 1; result = acpi_bus_scan(device, &ops); } - return_VALUE(result); + return result; } EXPORT_SYMBOL(acpi_bus_start); @@ -1314,10 +1321,9 @@ static int acpi_bus_scan_fixed(struct acpi_device *root) int result = 0; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_bus_scan_fixed"); if (!root) - return_VALUE(-ENODEV); + return -ENODEV; /* * Enumerate all fixed-feature devices. @@ -1338,7 +1344,7 @@ static int acpi_bus_scan_fixed(struct acpi_device *root) result = acpi_start_single_object(device); } - return_VALUE(result); + return result; } @@ -1427,7 +1433,7 @@ static int acpi_device_resume(struct device * dev) } -struct bus_type acpi_bus_type = { +static struct bus_type acpi_bus_type = { .name = "acpi", .suspend = acpi_device_suspend, .resume = acpi_device_resume, @@ -1440,10 +1446,9 @@ static int __init acpi_scan_init(void) int result; struct acpi_bus_ops ops; - ACPI_FUNCTION_TRACE("acpi_scan_init"); if (acpi_disabled) - return_VALUE(0); + return 0; kset_register(&acpi_namespace_kset); @@ -1488,7 +1493,7 @@ static int __init acpi_scan_init(void) acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); Done: - return_VALUE(result); + return result; } subsys_initcall(acpi_scan_init); diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index a934ac42178..c90bd2f70b3 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c @@ -47,10 +47,9 @@ extern struct fadt_descriptor acpi_fadt; static int acpi_system_read_info(struct seq_file *seq, void *offset) { - ACPI_FUNCTION_TRACE("acpi_system_read_info"); seq_printf(seq, "version: %x\n", ACPI_CA_VERSION); - return_VALUE(0); + return 0; } static int acpi_system_info_open_fs(struct inode *inode, struct file *file) @@ -80,17 +79,16 @@ acpi_system_read_dsdt(struct file *file, struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; ssize_t res; - ACPI_FUNCTION_TRACE("acpi_system_read_dsdt"); status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; res = simple_read_from_buffer(buffer, count, ppos, dsdt.pointer, dsdt.length); acpi_os_free(dsdt.pointer); - return_VALUE(res); + return res; } static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t, @@ -108,17 +106,16 @@ acpi_system_read_fadt(struct file *file, struct acpi_buffer fadt = { ACPI_ALLOCATE_BUFFER, NULL }; ssize_t res; - ACPI_FUNCTION_TRACE("acpi_system_read_fadt"); status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &fadt); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; res = simple_read_from_buffer(buffer, count, ppos, fadt.pointer, fadt.length); acpi_os_free(fadt.pointer); - return_VALUE(res); + return res; } static int __init acpi_system_init(void) @@ -127,10 +124,9 @@ static int __init acpi_system_init(void) int error = 0; char *name; - ACPI_FUNCTION_TRACE("acpi_system_init"); if (acpi_disabled) - return_VALUE(0); + return 0; /* 'info' [R] */ name = ACPI_SYSTEM_FILE_INFO; @@ -158,12 +154,9 @@ static int __init acpi_system_init(void) goto Error; Done: - return_VALUE(error); + return error; Error: - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' proc fs entry\n", name)); - remove_proc_entry(ACPI_SYSTEM_FILE_FADT, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_DSDT, acpi_root_dir); remove_proc_entry(ACPI_SYSTEM_FILE_INFO, acpi_root_dir); diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index ed5e8816d83..bfb3bfcf9e9 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c @@ -23,7 +23,6 @@ * */ -#include <linux/config.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index e7fe3a14fda..c855f4446b5 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -222,51 +222,48 @@ static int acpi_thermal_get_temperature(struct acpi_thermal *tz) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("acpi_thermal_get_temperature"); if (!tz) - return_VALUE(-EINVAL); + return -EINVAL; tz->last_temperature = tz->temperature; status = acpi_evaluate_integer(tz->handle, "_TMP", NULL, &tz->temperature); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", tz->temperature)); - return_VALUE(0); + return 0; } static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("acpi_thermal_get_polling_frequency"); if (!tz) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_evaluate_integer(tz->handle, "_TZP", NULL, &tz->polling_frequency); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", tz->polling_frequency)); - return_VALUE(0); + return 0; } static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) { - ACPI_FUNCTION_TRACE("acpi_thermal_set_polling"); if (!tz) - return_VALUE(-EINVAL); + return -EINVAL; tz->polling_frequency = seconds * 10; /* Convert value to deci-seconds */ @@ -274,7 +271,7 @@ static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) "Polling frequency set to %lu seconds\n", tz->polling_frequency)); - return_VALUE(0); + return 0; } static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) @@ -284,29 +281,28 @@ static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) struct acpi_object_list arg_list = { 1, &arg0 }; acpi_handle handle = NULL; - ACPI_FUNCTION_TRACE("acpi_thermal_set_cooling_mode"); if (!tz) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_get_handle(tz->handle, "_SCP", &handle); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n")); - return_VALUE(-ENODEV); + return -ENODEV; } arg0.integer.value = mode; status = acpi_evaluate_object(handle, NULL, &arg_list, NULL); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; tz->cooling_mode = mode; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n", mode ? "passive" : "active")); - return_VALUE(0); + return 0; } static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) @@ -314,10 +310,9 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) acpi_status status = AE_OK; int i = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_get_trip_points"); if (!tz) - return_VALUE(-EINVAL); + return -EINVAL; /* Critical Shutdown (required) */ @@ -325,8 +320,8 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) &tz->trips.critical.temperature); if (ACPI_FAILURE(status)) { tz->trips.critical.flags.valid = 0; - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No critical threshold\n")); - return_VALUE(-ENODEV); + ACPI_EXCEPTION((AE_INFO, status, "No critical threshold")); + return -ENODEV; } else { tz->trips.critical.flags.valid = 1; ACPI_DEBUG_PRINT((ACPI_DB_INFO, @@ -384,8 +379,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) tz->trips.passive.flags.valid = 0; if (!tz->trips.passive.flags.valid) - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid passive threshold\n")); + printk(KERN_WARNING PREFIX "Invalid passive threshold\n"); else ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found passive threshold [%lu]\n", @@ -414,29 +408,27 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) "Found active threshold [%d]:[%lu]\n", i, tz->trips.active[i].temperature)); } else - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid active threshold [%d]\n", - i)); + ACPI_EXCEPTION((AE_INFO, status, + "Invalid active threshold [%d]", i)); } - return_VALUE(0); + return 0; } static int acpi_thermal_get_devices(struct acpi_thermal *tz) { acpi_status status = AE_OK; - ACPI_FUNCTION_TRACE("acpi_thermal_get_devices"); if (!tz) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_evaluate_reference(tz->handle, "_TZD", NULL, &tz->devices); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; - return_VALUE(0); + return 0; } static int acpi_thermal_call_usermode(char *path) @@ -444,10 +436,9 @@ static int acpi_thermal_call_usermode(char *path) char *argv[2] = { NULL, NULL }; char *envp[3] = { NULL, NULL, NULL }; - ACPI_FUNCTION_TRACE("acpi_thermal_call_usermode"); if (!path) - return_VALUE(-EINVAL); + return -EINVAL; argv[0] = path; @@ -457,7 +448,7 @@ static int acpi_thermal_call_usermode(char *path) call_usermodehelper(argv[0], argv, envp, 0); - return_VALUE(0); + return 0; } static int acpi_thermal_critical(struct acpi_thermal *tz) @@ -465,20 +456,19 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) int result = 0; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_thermal_critical"); if (!tz || !tz->trips.critical.flags.valid) - return_VALUE(-EINVAL); + return -EINVAL; if (tz->temperature >= tz->trips.critical.temperature) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Critical trip point\n")); + printk(KERN_WARNING PREFIX "Critical trip point\n"); tz->trips.critical.flags.enabled = 1; } else if (tz->trips.critical.flags.enabled) tz->trips.critical.flags.enabled = 0; result = acpi_bus_get_device(tz->handle, &device); if (result) - return_VALUE(result); + return result; printk(KERN_EMERG "Critical temperature reached (%ld C), shutting down.\n", @@ -488,7 +478,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz) acpi_thermal_call_usermode(ACPI_THERMAL_PATH_POWEROFF); - return_VALUE(0); + return 0; } static int acpi_thermal_hot(struct acpi_thermal *tz) @@ -496,27 +486,26 @@ static int acpi_thermal_hot(struct acpi_thermal *tz) int result = 0; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_thermal_hot"); if (!tz || !tz->trips.hot.flags.valid) - return_VALUE(-EINVAL); + return -EINVAL; if (tz->temperature >= tz->trips.hot.temperature) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Hot trip point\n")); + printk(KERN_WARNING PREFIX "Hot trip point\n"); tz->trips.hot.flags.enabled = 1; } else if (tz->trips.hot.flags.enabled) tz->trips.hot.flags.enabled = 0; result = acpi_bus_get_device(tz->handle, &device); if (result) - return_VALUE(result); + return result; acpi_bus_generate_event(device, ACPI_THERMAL_NOTIFY_HOT, tz->trips.hot.flags.enabled); /* TBD: Call user-mode "sleep(S4)" function */ - return_VALUE(0); + return 0; } static void acpi_thermal_passive(struct acpi_thermal *tz) @@ -526,7 +515,6 @@ static void acpi_thermal_passive(struct acpi_thermal *tz) int trend = 0; int i = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_passive"); if (!tz || !tz->trips.passive.flags.valid) return; @@ -615,7 +603,6 @@ static void acpi_thermal_active(struct acpi_thermal *tz) int j = 0; unsigned long maxtemp = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_active"); if (!tz) return; @@ -642,10 +629,10 @@ static void acpi_thermal_active(struct acpi_thermal *tz) handles[j], ACPI_STATE_D0); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to turn cooling device [%p] 'on'\n", - active->devices. - handles[j])); + printk(KERN_WARNING PREFIX + "Unable to turn cooling device [%p] 'on'\n", + active->devices. + handles[j]); continue; } active->flags.enabled = 1; @@ -667,9 +654,9 @@ static void acpi_thermal_active(struct acpi_thermal *tz) result = acpi_bus_set_power(active->devices.handles[j], ACPI_STATE_D3); if (result) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Unable to turn cooling device [%p] 'off'\n", - active->devices.handles[j])); + printk(KERN_WARNING PREFIX + "Unable to turn cooling device [%p] 'off'\n", + active->devices.handles[j]); continue; } active->flags.enabled = 0; @@ -697,18 +684,17 @@ static void acpi_thermal_check(void *data) int i = 0; struct acpi_thermal_state state; - ACPI_FUNCTION_TRACE("acpi_thermal_check"); if (!tz) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); - return_VOID; + printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); + return; } state = tz->state; result = acpi_thermal_get_temperature(tz); if (result) - return_VOID; + return; memset(&tz->state, 0, sizeof(tz->state)); @@ -797,7 +783,7 @@ static void acpi_thermal_check(void *data) } } - return_VOID; + return; } /* -------------------------------------------------------------------------- @@ -810,7 +796,6 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) { struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; - ACPI_FUNCTION_TRACE("acpi_thermal_state_seq_show"); if (!tz) goto end; @@ -833,7 +818,7 @@ static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) } end: - return_VALUE(0); + return 0; } static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file) @@ -846,7 +831,6 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) int result = 0; struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; - ACPI_FUNCTION_TRACE("acpi_thermal_temp_seq_show"); if (!tz) goto end; @@ -859,7 +843,7 @@ static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) KELVIN_TO_CELSIUS(tz->temperature)); end: - return_VALUE(0); + return 0; } static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file) @@ -873,7 +857,6 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) int i = 0; int j = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_trip_seq_show"); if (!tz) goto end; @@ -913,7 +896,7 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) } end: - return_VALUE(0); + return 0; } static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file) @@ -934,28 +917,25 @@ acpi_thermal_write_trip_points(struct file *file, int *active; int i = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_write_trip_points"); limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); if (!limit_string) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); if (!active) { kfree(limit_string); - return_VALUE(-ENOMEM); + return -ENOMEM; } if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); count = -EINVAL; goto end; } if (copy_from_user(limit_string, buffer, count)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n")); count = -EFAULT; goto end; } @@ -968,7 +948,6 @@ acpi_thermal_write_trip_points(struct file *file, &active[5], &active[6], &active[7], &active[8], &active[9]); if (!(num >= 5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n")); count = -EINVAL; goto end; } @@ -985,14 +964,13 @@ acpi_thermal_write_trip_points(struct file *file, end: kfree(active); kfree(limit_string); - return_VALUE(count); + return count; } static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) { struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; - ACPI_FUNCTION_TRACE("acpi_thermal_cooling_seq_show"); if (!tz) goto end; @@ -1008,7 +986,7 @@ static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) tz->cooling_mode ? "passive" : "active"); end: - return_VALUE(0); + return 0; } static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file) @@ -1027,16 +1005,15 @@ acpi_thermal_write_cooling_mode(struct file *file, int result = 0; char mode_string[12] = { '\0' }; - ACPI_FUNCTION_TRACE("acpi_thermal_write_cooling_mode"); if (!tz || (count > sizeof(mode_string) - 1)) - return_VALUE(-EINVAL); + return -EINVAL; if (!tz->flags.cooling_mode) - return_VALUE(-ENODEV); + return -ENODEV; if (copy_from_user(mode_string, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; mode_string[count] = '\0'; @@ -1044,18 +1021,17 @@ acpi_thermal_write_cooling_mode(struct file *file, simple_strtoul(mode_string, NULL, 0)); if (result) - return_VALUE(result); + return result; acpi_thermal_check(tz); - return_VALUE(count); + return count; } static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) { struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; - ACPI_FUNCTION_TRACE("acpi_thermal_polling_seq_show"); if (!tz) goto end; @@ -1069,7 +1045,7 @@ static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) (tz->polling_frequency / 10)); end: - return_VALUE(0); + return 0; } static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file) @@ -1089,13 +1065,12 @@ acpi_thermal_write_polling(struct file *file, char polling_string[12] = { '\0' }; int seconds = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_write_polling"); if (!tz || (count > sizeof(polling_string) - 1)) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(polling_string, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; polling_string[count] = '\0'; @@ -1103,24 +1078,23 @@ acpi_thermal_write_polling(struct file *file, result = acpi_thermal_set_polling(tz, seconds); if (result) - return_VALUE(result); + return result; acpi_thermal_check(tz); - return_VALUE(count); + return count; } static int acpi_thermal_add_fs(struct acpi_device *device) { struct proc_dir_entry *entry = NULL; - ACPI_FUNCTION_TRACE("acpi_thermal_add_fs"); if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_thermal_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; acpi_device_dir(device)->owner = THIS_MODULE; } @@ -1128,9 +1102,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_STATE)); + return -ENODEV; else { entry->proc_fops = &acpi_thermal_state_fops; entry->data = acpi_driver_data(device); @@ -1141,9 +1113,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_TEMPERATURE)); + return -ENODEV; else { entry->proc_fops = &acpi_thermal_temp_fops; entry->data = acpi_driver_data(device); @@ -1155,9 +1125,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_TRIP_POINTS)); + return -ENODEV; else { entry->proc_fops = &acpi_thermal_trip_fops; entry->data = acpi_driver_data(device); @@ -1169,9 +1137,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_COOLING_MODE)); + return -ENODEV; else { entry->proc_fops = &acpi_thermal_cooling_fops; entry->data = acpi_driver_data(device); @@ -1183,21 +1149,18 @@ static int acpi_thermal_add_fs(struct acpi_device *device) S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create '%s' fs entry\n", - ACPI_THERMAL_FILE_POLLING_FREQ)); + return -ENODEV; else { entry->proc_fops = &acpi_thermal_polling_fops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_thermal_remove_fs(struct acpi_device *device) { - ACPI_FUNCTION_TRACE("acpi_thermal_remove_fs"); if (acpi_device_dir(device)) { remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, @@ -1214,7 +1177,7 @@ static int acpi_thermal_remove_fs(struct acpi_device *device) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -1226,13 +1189,12 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) struct acpi_thermal *tz = (struct acpi_thermal *)data; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_thermal_notify"); if (!tz) - return_VOID; + return; if (acpi_bus_get_device(tz->handle, &device)) - return_VOID; + return; switch (event) { case ACPI_THERMAL_NOTIFY_TEMPERATURE: @@ -1254,27 +1216,26 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } static int acpi_thermal_get_info(struct acpi_thermal *tz) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_get_info"); if (!tz) - return_VALUE(-EINVAL); + return -EINVAL; /* Get temperature [_TMP] (required) */ result = acpi_thermal_get_temperature(tz); if (result) - return_VALUE(result); + return result; /* Get trip points [_CRT, _PSV, etc.] (required) */ result = acpi_thermal_get_trip_points(tz); if (result) - return_VALUE(result); + return result; /* Set the cooling mode [_SCP] to active cooling (default) */ result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE); @@ -1314,7 +1275,7 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz) if (!result) tz->flags.devices = 1; - return_VALUE(0); + return 0; } static int acpi_thermal_add(struct acpi_device *device) @@ -1323,14 +1284,13 @@ static int acpi_thermal_add(struct acpi_device *device) acpi_status status = AE_OK; struct acpi_thermal *tz = NULL; - ACPI_FUNCTION_TRACE("acpi_thermal_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; tz = kmalloc(sizeof(struct acpi_thermal), GFP_KERNEL); if (!tz) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(tz, 0, sizeof(struct acpi_thermal)); tz->handle = device->handle; @@ -1355,8 +1315,6 @@ static int acpi_thermal_add(struct acpi_device *device) ACPI_DEVICE_NOTIFY, acpi_thermal_notify, tz); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error installing notify handler\n")); result = -ENODEV; goto end; } @@ -1371,7 +1329,7 @@ static int acpi_thermal_add(struct acpi_device *device) kfree(tz); } - return_VALUE(result); + return result; } static int acpi_thermal_remove(struct acpi_device *device, int type) @@ -1379,10 +1337,9 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) acpi_status status = AE_OK; struct acpi_thermal *tz = NULL; - ACPI_FUNCTION_TRACE("acpi_thermal_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; tz = (struct acpi_thermal *)acpi_driver_data(device); @@ -1398,9 +1355,6 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) status = acpi_remove_notify_handler(tz->handle, ACPI_DEVICE_NOTIFY, acpi_thermal_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); /* Terminate policy */ if (tz->trips.passive.flags.valid && tz->trips.passive.flags.enabled) { @@ -1416,7 +1370,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) acpi_thermal_remove_fs(device); kfree(tz); - return_VALUE(0); + return 0; } static int acpi_thermal_resume(struct acpi_device *device, int state) @@ -1424,7 +1378,7 @@ static int acpi_thermal_resume(struct acpi_device *device, int state) struct acpi_thermal *tz = NULL; if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; tz = (struct acpi_thermal *)acpi_driver_data(device); @@ -1437,31 +1391,29 @@ static int __init acpi_thermal_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_thermal_init"); acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); if (!acpi_thermal_dir) - return_VALUE(-ENODEV); + return -ENODEV; acpi_thermal_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_thermal_driver); if (result < 0) { remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } static void __exit acpi_thermal_exit(void) { - ACPI_FUNCTION_TRACE("acpi_thermal_exit"); acpi_bus_unregister_driver(&acpi_thermal_driver); remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); - return_VOID; + return; } module_init(acpi_thermal_init); diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 67b9f325c6f..38ebe1c5433 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c @@ -155,21 +155,30 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) case ACPI_TYPE_MUTEX: ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, - "***** Mutex %p, Semaphore %p\n", - object, object->mutex.semaphore)); + "***** Mutex %p, OS Mutex %p\n", + object, object->mutex.os_mutex)); - acpi_ex_unlink_mutex(object); - (void)acpi_os_delete_semaphore(object->mutex.semaphore); + if (object->mutex.os_mutex != ACPI_GLOBAL_LOCK) { + acpi_ex_unlink_mutex(object); + acpi_os_delete_mutex(object->mutex.os_mutex); + } else { + /* Global Lock "mutex" is actually a counting semaphore */ + + (void) + acpi_os_delete_semaphore + (acpi_gbl_global_lock_semaphore); + acpi_gbl_global_lock_semaphore = NULL; + } break; case ACPI_TYPE_EVENT: ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, - "***** Event %p, Semaphore %p\n", - object, object->event.semaphore)); + "***** Event %p, OS Semaphore %p\n", + object, object->event.os_semaphore)); - (void)acpi_os_delete_semaphore(object->event.semaphore); - object->event.semaphore = NULL; + (void)acpi_os_delete_semaphore(object->event.os_semaphore); + object->event.os_semaphore = NULL; break; case ACPI_TYPE_METHOD: @@ -177,12 +186,13 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "***** Method %p\n", object)); - /* Delete the method semaphore if it exists */ + /* Delete the method mutex if it exists */ - if (object->method.semaphore) { - (void)acpi_os_delete_semaphore(object->method. - semaphore); - object->method.semaphore = NULL; + if (object->method.mutex) { + acpi_os_delete_mutex(object->method.mutex->mutex. + os_mutex); + acpi_ut_delete_object_desc(object->method.mutex); + object->method.mutex = NULL; } break; diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index e5999c65c0b..014030af8b5 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c @@ -794,6 +794,7 @@ void acpi_ut_init_globals(void) /* Global Lock support */ + acpi_gbl_global_lock_semaphore = NULL; acpi_gbl_global_lock_acquired = FALSE; acpi_gbl_global_lock_thread_count = 0; acpi_gbl_global_lock_handle = 0; diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 5c75d35ad1c..33268310c73 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c @@ -41,6 +41,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include <linux/module.h> + #include <acpi/acpi.h> #include <acpi/acnamesp.h> @@ -962,6 +964,7 @@ acpi_ut_exception(char *module_name, acpi_os_vprintf(format, args); acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); } +EXPORT_SYMBOL(acpi_ut_exception); void ACPI_INTERNAL_VAR_XFACE acpi_ut_warning(char *module_name, u32 line_number, char *format, ...) diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index 25eb34369af..dfc8f30ca89 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c @@ -82,12 +82,9 @@ acpi_status acpi_ut_mutex_initialize(void) /* Create the spinlocks for use at interrupt level */ - status = acpi_os_create_lock(&acpi_gbl_gpe_lock); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } + spin_lock_init(acpi_gbl_gpe_lock); + spin_lock_init(acpi_gbl_hardware_lock); - status = acpi_os_create_lock(&acpi_gbl_hardware_lock); return_ACPI_STATUS(status); } @@ -146,9 +143,8 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) } if (!acpi_gbl_mutex_info[mutex_id].mutex) { - status = acpi_os_create_semaphore(1, 1, - &acpi_gbl_mutex_info - [mutex_id].mutex); + status = + acpi_os_create_mutex(&acpi_gbl_mutex_info[mutex_id].mutex); acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; acpi_gbl_mutex_info[mutex_id].use_count = 0; @@ -171,7 +167,6 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) { - acpi_status status; ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); @@ -179,12 +174,12 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) return_ACPI_STATUS(AE_BAD_PARAMETER); } - status = acpi_os_delete_semaphore(acpi_gbl_mutex_info[mutex_id].mutex); + acpi_os_delete_mutex(acpi_gbl_mutex_info[mutex_id].mutex); acpi_gbl_mutex_info[mutex_id].mutex = NULL; acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; - return_ACPI_STATUS(status); + return_ACPI_STATUS(AE_OK); } /******************************************************************************* @@ -251,8 +246,8 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) "Thread %X attempting to acquire Mutex [%s]\n", this_thread_id, acpi_ut_get_mutex_name(mutex_id))); - status = acpi_os_wait_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, - 1, ACPI_WAIT_FOREVER); + status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, + ACPI_WAIT_FOREVER); if (ACPI_SUCCESS(status)) { ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n", @@ -284,7 +279,6 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) { - acpi_status status; acpi_thread_id this_thread_id; ACPI_FUNCTION_NAME(ut_release_mutex); @@ -340,19 +334,6 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; - status = - acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1); - - if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, - "Thread %X could not release Mutex [%X]", - this_thread_id, mutex_id)); - } else { - ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, - "Thread %X released Mutex [%s]\n", - this_thread_id, - acpi_ut_get_mutex_name(mutex_id))); - } - - return (status); + acpi_os_release_mutex(acpi_gbl_mutex_info[mutex_id].mutex); + return (AE_OK); } diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 6b516852ac1..1930e1a75b2 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -58,31 +58,29 @@ acpi_extract_package(union acpi_object *package, u8 *head = NULL; u8 *tail = NULL; - ACPI_FUNCTION_TRACE("acpi_extract_package"); if (!package || (package->type != ACPI_TYPE_PACKAGE) || (package->package.count < 1)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid 'package' argument\n")); - return_ACPI_STATUS(AE_BAD_PARAMETER); + printk(KERN_WARNING PREFIX "Invalid package argument\n"); + return AE_BAD_PARAMETER; } if (!format || !format->pointer || (format->length < 1)) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'format' argument\n")); - return_ACPI_STATUS(AE_BAD_PARAMETER); + printk(KERN_WARNING PREFIX "Invalid format argument\n"); + return AE_BAD_PARAMETER; } if (!buffer) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'buffer' argument\n")); - return_ACPI_STATUS(AE_BAD_PARAMETER); + printk(KERN_WARNING PREFIX "Invalid buffer argument\n"); + return AE_BAD_PARAMETER; } format_count = (format->length / sizeof(char)) - 1; if (format_count > package->package.count) { - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Format specifies more objects [%d] than exist in package [%d].", - format_count, package->package.count)); - return_ACPI_STATUS(AE_BAD_DATA); + printk(KERN_WARNING PREFIX "Format specifies more objects [%d]" + " than exist in package [%d].\n", + format_count, package->package.count); + return AE_BAD_DATA; } format_string = (char *)format->pointer; @@ -95,7 +93,7 @@ acpi_extract_package(union acpi_object *package, union acpi_object *element = &(package->package.elements[i]); if (!element) { - return_ACPI_STATUS(AE_BAD_DATA); + return AE_BAD_DATA; } switch (element->type) { @@ -113,10 +111,11 @@ acpi_extract_package(union acpi_object *package, tail_offset += sizeof(char *); break; default: - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid package element [%d]: got number, expecing [%c].\n", - i, format_string[i])); - return_ACPI_STATUS(AE_BAD_DATA); + printk(KERN_WARNING PREFIX "Invalid package element" + " [%d]: got number, expecing" + " [%c]\n", + i, format_string[i]); + return AE_BAD_DATA; break; } break; @@ -138,10 +137,11 @@ acpi_extract_package(union acpi_object *package, tail_offset += sizeof(u8 *); break; default: - ACPI_DEBUG_PRINT((ACPI_DB_WARN, - "Invalid package element [%d] got string/buffer, expecing [%c].\n", - i, format_string[i])); - return_ACPI_STATUS(AE_BAD_DATA); + printk(KERN_WARNING PREFIX "Invalid package element" + " [%d] got string/buffer," + " expecing [%c]\n", + i, format_string[i]); + return AE_BAD_DATA; break; } break; @@ -152,7 +152,7 @@ acpi_extract_package(union acpi_object *package, "Found unsupported element at index=%d\n", i)); /* TBD: handle nested packages... */ - return_ACPI_STATUS(AE_SUPPORT); + return AE_SUPPORT; break; } } @@ -162,9 +162,9 @@ acpi_extract_package(union acpi_object *package, */ if (buffer->length < size_required) { buffer->length = size_required; - return_ACPI_STATUS(AE_BUFFER_OVERFLOW); + return AE_BUFFER_OVERFLOW; } else if (buffer->length != size_required || !buffer->pointer) { - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; } head = buffer->pointer; @@ -179,7 +179,7 @@ acpi_extract_package(union acpi_object *package, union acpi_object *element = &(package->package.elements[i]); if (!element) { - return_ACPI_STATUS(AE_BAD_DATA); + return AE_BAD_DATA; } switch (element->type) { @@ -244,7 +244,7 @@ acpi_extract_package(union acpi_object *package, } } - return_ACPI_STATUS(AE_OK); + return AE_OK; } EXPORT_SYMBOL(acpi_extract_package); @@ -258,14 +258,13 @@ acpi_evaluate_integer(acpi_handle handle, union acpi_object *element; struct acpi_buffer buffer = { 0, NULL }; - ACPI_FUNCTION_TRACE("acpi_evaluate_integer"); if (!data) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; element = kmalloc(sizeof(union acpi_object), GFP_KERNEL); if (!element) - return_ACPI_STATUS(AE_NO_MEMORY); + return AE_NO_MEMORY; memset(element, 0, sizeof(union acpi_object)); buffer.length = sizeof(union acpi_object); @@ -274,13 +273,13 @@ acpi_evaluate_integer(acpi_handle handle, if (ACPI_FAILURE(status)) { acpi_util_eval_error(handle, pathname, status); kfree(element); - return_ACPI_STATUS(status); + return status; } if (element->type != ACPI_TYPE_INTEGER) { acpi_util_eval_error(handle, pathname, AE_BAD_DATA); kfree(element); - return_ACPI_STATUS(AE_BAD_DATA); + return AE_BAD_DATA; } *data = element->integer.value; @@ -288,7 +287,7 @@ acpi_evaluate_integer(acpi_handle handle, ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%lu]\n", *data)); - return_ACPI_STATUS(AE_OK); + return AE_OK; } EXPORT_SYMBOL(acpi_evaluate_integer); @@ -303,15 +302,14 @@ acpi_evaluate_string(acpi_handle handle, acpi_object *element = NULL; acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; - ACPI_FUNCTION_TRACE("acpi_evaluate_string"); if (!data) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; status = acpi_evaluate_object(handle, pathname, arguments, &buffer); if (ACPI_FAILURE(status)) { acpi_util_eval_error(handle, pathname, status); - return_ACPI_STATUS(status); + return status; } element = (acpi_object *) buffer.pointer; @@ -320,13 +318,13 @@ acpi_evaluate_string(acpi_handle handle, || (element->type != ACPI_TYPE_BUFFER) || !element->string.length) { acpi_util_eval_error(handle, pathname, AE_BAD_DATA); - return_ACPI_STATUS(AE_BAD_DATA); + return AE_BAD_DATA; } *data = kmalloc(element->string.length + 1, GFP_KERNEL); if (!data) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Memory allocation error\n")); - return_VALUE(-ENOMEM); + printk(KERN_ERR PREFIX "Memory allocation\n"); + return -ENOMEM; } memset(*data, 0, element->string.length + 1); @@ -336,7 +334,7 @@ acpi_evaluate_string(acpi_handle handle, acpi_os_free(buffer.pointer); - return_ACPI_STATUS(AE_OK); + return AE_OK; } #endif @@ -352,10 +350,9 @@ acpi_evaluate_reference(acpi_handle handle, struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; u32 i = 0; - ACPI_FUNCTION_TRACE("acpi_evaluate_reference"); if (!list) { - return_ACPI_STATUS(AE_BAD_PARAMETER); + return AE_BAD_PARAMETER; } /* Evaluate object. */ @@ -367,32 +364,29 @@ acpi_evaluate_reference(acpi_handle handle, package = (union acpi_object *)buffer.pointer; if ((buffer.length == 0) || !package) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "No return object (len %X ptr %p)\n", - (unsigned)buffer.length, package)); + printk(KERN_ERR PREFIX "No return object (len %X ptr %p)\n", + (unsigned)buffer.length, package); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (package->type != ACPI_TYPE_PACKAGE) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Expecting a [Package], found type %X\n", - package->type)); + printk(KERN_ERR PREFIX "Expecting a [Package], found type %X\n", + package->type); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (!package->package.count) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "[Package] has zero elements (%p)\n", - package)); + printk(KERN_ERR PREFIX "[Package] has zero elements (%p)\n", + package); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (package->package.count > ACPI_MAX_HANDLES) { - return_ACPI_STATUS(AE_NO_MEMORY); + return AE_NO_MEMORY; } list->count = package->package.count; @@ -404,9 +398,9 @@ acpi_evaluate_reference(acpi_handle handle, if (element->type != ACPI_TYPE_ANY) { status = AE_BAD_DATA; - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Expecting a [Reference] package element, found type %X\n", - element->type)); + printk(KERN_ERR PREFIX + "Expecting a [Reference] package element, found type %X\n", + element->type); acpi_util_eval_error(handle, pathname, status); break; } @@ -426,7 +420,7 @@ acpi_evaluate_reference(acpi_handle handle, acpi_os_free(buffer.pointer); - return_ACPI_STATUS(status); + return status; } EXPORT_SYMBOL(acpi_evaluate_reference); diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index e7e9a693953..9feb633087a 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -272,10 +272,9 @@ static int acpi_video_device_query(struct acpi_video_device *device, unsigned long *state) { int status; - ACPI_FUNCTION_TRACE("acpi_video_device_query"); status = acpi_evaluate_integer(device->handle, "_DGS", NULL, state); - return_VALUE(status); + return status; } static int @@ -284,11 +283,10 @@ acpi_video_device_get_state(struct acpi_video_device *device, { int status; - ACPI_FUNCTION_TRACE("acpi_video_device_get_state"); status = acpi_evaluate_integer(device->handle, "_DCS", NULL, state); - return_VALUE(status); + return status; } static int @@ -299,12 +297,11 @@ acpi_video_device_set_state(struct acpi_video_device *device, int state) struct acpi_object_list args = { 1, &arg0 }; unsigned long ret; - ACPI_FUNCTION_TRACE("acpi_video_device_set_state"); arg0.integer.value = state; status = acpi_evaluate_integer(device->handle, "_DSS", &args, &ret); - return_VALUE(status); + return status; } static int @@ -315,28 +312,27 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *obj; - ACPI_FUNCTION_TRACE("acpi_video_device_lcd_query_levels"); *levels = NULL; status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer); if (!ACPI_SUCCESS(status)) - return_VALUE(status); + return status; obj = (union acpi_object *)buffer.pointer; if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); + printk(KERN_ERR PREFIX "Invalid _BCL data\n"); status = -EFAULT; goto err; } *levels = obj; - return_VALUE(0); + return 0; err: kfree(buffer.pointer); - return_VALUE(status); + return status; } static int @@ -346,13 +342,12 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) union acpi_object arg0 = { ACPI_TYPE_INTEGER }; struct acpi_object_list args = { 1, &arg0 }; - ACPI_FUNCTION_TRACE("acpi_video_device_lcd_set_level"); arg0.integer.value = level; status = acpi_evaluate_object(device->handle, "_BCM", &args, NULL); printk(KERN_DEBUG "set_level status: %x\n", status); - return_VALUE(status); + return status; } static int @@ -360,11 +355,10 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, unsigned long *level) { int status; - ACPI_FUNCTION_TRACE("acpi_video_device_lcd_get_level_current"); status = acpi_evaluate_integer(device->handle, "_BQC", NULL, level); - return_VALUE(status); + return status; } static int @@ -377,34 +371,33 @@ acpi_video_device_EDID(struct acpi_video_device *device, union acpi_object arg0 = { ACPI_TYPE_INTEGER }; struct acpi_object_list args = { 1, &arg0 }; - ACPI_FUNCTION_TRACE("acpi_video_device_get_EDID"); *edid = NULL; if (!device) - return_VALUE(-ENODEV); + return -ENODEV; if (length == 128) arg0.integer.value = 1; else if (length == 256) arg0.integer.value = 2; else - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_evaluate_object(device->handle, "_DDC", &args, &buffer); if (ACPI_FAILURE(status)) - return_VALUE(-ENODEV); + return -ENODEV; obj = (union acpi_object *)buffer.pointer; if (obj && obj->type == ACPI_TYPE_BUFFER) *edid = obj; else { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DDC data\n")); + printk(KERN_ERR PREFIX "Invalid _DDC data\n"); status = -EFAULT; kfree(obj); } - return_VALUE(status); + return status; } /* bus */ @@ -417,7 +410,6 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) union acpi_object arg0 = { ACPI_TYPE_INTEGER }; struct acpi_object_list args = { 1, &arg0 }; - ACPI_FUNCTION_TRACE("acpi_video_bus_set_POST"); arg0.integer.value = option; @@ -425,7 +417,7 @@ acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) if (ACPI_SUCCESS(status)) status = tmp ? (-EINVAL) : (AE_OK); - return_VALUE(status); + return status; } static int @@ -433,11 +425,10 @@ acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id) { int status; - ACPI_FUNCTION_TRACE("acpi_video_bus_get_POST"); status = acpi_evaluate_integer(video->handle, "_GPD", NULL, id); - return_VALUE(status); + return status; } static int @@ -445,12 +436,11 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video, unsigned long *options) { int status; - ACPI_FUNCTION_TRACE("acpi_video_bus_POST_options"); status = acpi_evaluate_integer(video->handle, "_VPO", NULL, options); *options &= 3; - return_VALUE(status); + return status; } /* @@ -481,7 +471,6 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) union acpi_object arg0 = { ACPI_TYPE_INTEGER }; struct acpi_object_list args = { 1, &arg0 }; - ACPI_FUNCTION_TRACE("acpi_video_bus_DOS"); if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) { status = -1; @@ -492,7 +481,7 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) acpi_evaluate_object(video->handle, "_DOS", &args, NULL); Failed: - return_VALUE(status); + return status; } /* @@ -514,7 +503,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) union acpi_object *obj = NULL; struct acpi_video_device_brightness *br = NULL; - ACPI_FUNCTION_TRACE("acpi_video_device_find_cap"); memset(&device->cap, 0, 4); @@ -560,8 +548,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) o = (union acpi_object *)&obj->package. elements[i]; if (o->type != ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid data\n")); + printk(KERN_ERR PREFIX "Invalid data\n"); continue; } br->levels[count] = (u32) o->integer.value; @@ -583,7 +570,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) kfree(obj); - return_VOID; + return; } /* @@ -630,10 +617,9 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) { acpi_status status = -ENOENT; - ACPI_FUNCTION_TRACE("acpi_video_bus_check"); if (!video) - return_VALUE(-EINVAL); + return -EINVAL; /* Since there is no HID, CID and so on for VGA driver, we have * to check well known required nodes. @@ -657,7 +643,7 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) status = 0; } - return_VALUE(status); + return status; } /* -------------------------------------------------------------------------- @@ -673,7 +659,6 @@ static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset) struct acpi_video_device *dev = (struct acpi_video_device *)seq->private; - ACPI_FUNCTION_TRACE("acpi_video_device_info_seq_show"); if (!dev) goto end; @@ -692,7 +677,7 @@ static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset) seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no"); end: - return_VALUE(0); + return 0; } static int @@ -709,7 +694,6 @@ static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) (struct acpi_video_device *)seq->private; unsigned long state; - ACPI_FUNCTION_TRACE("acpi_video_device_state_seq_show"); if (!dev) goto end; @@ -729,7 +713,7 @@ static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) seq_printf(seq, "<not supported>\n"); end: - return_VALUE(0); + return 0; } static int @@ -750,13 +734,12 @@ acpi_video_device_write_state(struct file *file, char str[12] = { 0 }; u32 state = 0; - ACPI_FUNCTION_TRACE("acpi_video_device_write_state"); if (!dev || count + 1 > sizeof str) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(str, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; str[count] = 0; state = simple_strtoul(str, NULL, 0); @@ -765,9 +748,9 @@ acpi_video_device_write_state(struct file *file, status = acpi_video_device_set_state(dev, state); if (status) - return_VALUE(-EFAULT); + return -EFAULT; - return_VALUE(count); + return count; } static int @@ -777,11 +760,10 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset) (struct acpi_video_device *)seq->private; int i; - ACPI_FUNCTION_TRACE("acpi_video_device_brightness_seq_show"); if (!dev || !dev->brightness) { seq_printf(seq, "<not supported>\n"); - return_VALUE(0); + return 0; } seq_printf(seq, "levels: "); @@ -789,7 +771,7 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset) seq_printf(seq, " %d", dev->brightness->levels[i]); seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr); - return_VALUE(0); + return 0; } static int @@ -810,19 +792,18 @@ acpi_video_device_write_brightness(struct file *file, unsigned int level = 0; int i; - ACPI_FUNCTION_TRACE("acpi_video_device_write_brightness"); if (!dev || !dev->brightness || count + 1 > sizeof str) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(str, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; str[count] = 0; level = simple_strtoul(str, NULL, 0); if (level > 100) - return_VALUE(-EFAULT); + return -EFAULT; /* validate though the list of available levels */ for (i = 0; i < dev->brightness->count; i++) @@ -833,7 +814,7 @@ acpi_video_device_write_brightness(struct file *file, break; } - return_VALUE(count); + return count; } static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset) @@ -844,7 +825,6 @@ static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset) int i; union acpi_object *edid = NULL; - ACPI_FUNCTION_TRACE("acpi_video_device_EDID_seq_show"); if (!dev) goto out; @@ -869,7 +849,7 @@ static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset) else kfree(edid); - return_VALUE(0); + return 0; } static int @@ -884,28 +864,26 @@ static int acpi_video_device_add_fs(struct acpi_device *device) struct proc_dir_entry *entry = NULL; struct acpi_video_device *vid_dev; - ACPI_FUNCTION_TRACE("acpi_video_device_add_fs"); if (!device) - return_VALUE(-ENODEV); + return -ENODEV; vid_dev = (struct acpi_video_device *)acpi_driver_data(device); if (!vid_dev) - return_VALUE(-ENODEV); + return -ENODEV; if (!acpi_device_dir(device)) { acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), vid_dev->video->dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; acpi_device_dir(device)->owner = THIS_MODULE; } /* 'info' [R] */ entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'info' fs entry\n")); + return -ENODEV; else { entry->proc_fops = &acpi_video_device_info_fops; entry->data = acpi_driver_data(device); @@ -917,8 +895,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device) create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'state' fs entry\n")); + return -ENODEV; else { acpi_video_device_state_fops.write = acpi_video_device_write_state; entry->proc_fops = &acpi_video_device_state_fops; @@ -931,8 +908,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device) create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'brightness' fs entry\n")); + return -ENODEV; else { acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness; entry->proc_fops = &acpi_video_device_brightness_fops; @@ -943,25 +919,23 @@ static int acpi_video_device_add_fs(struct acpi_device *device) /* 'EDID' [R] */ entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'brightness' fs entry\n")); + return -ENODEV; else { entry->proc_fops = &acpi_video_device_EDID_fops; entry->data = acpi_driver_data(device); entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_video_device_remove_fs(struct acpi_device *device) { struct acpi_video_device *vid_dev; - ACPI_FUNCTION_TRACE("acpi_video_device_remove_fs"); vid_dev = (struct acpi_video_device *)acpi_driver_data(device); if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) - return_VALUE(-ENODEV); + return -ENODEV; if (acpi_device_dir(device)) { remove_proc_entry("info", acpi_device_dir(device)); @@ -972,7 +946,7 @@ static int acpi_video_device_remove_fs(struct acpi_device *device) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* video bus */ @@ -980,7 +954,6 @@ static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset) { struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; - ACPI_FUNCTION_TRACE("acpi_video_bus_info_seq_show"); if (!video) goto end; @@ -993,7 +966,7 @@ static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset) video->flags.post ? "yes" : "no"); end: - return_VALUE(0); + return 0; } static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file) @@ -1006,7 +979,6 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset) { struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; - ACPI_FUNCTION_TRACE("acpi_video_bus_ROM_seq_show"); if (!video) goto end; @@ -1015,7 +987,7 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset) seq_printf(seq, "<TODO>\n"); end: - return_VALUE(0); + return 0; } static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file) @@ -1029,7 +1001,6 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) unsigned long options; int status; - ACPI_FUNCTION_TRACE("acpi_video_bus_POST_info_seq_show"); if (!video) goto end; @@ -1052,7 +1023,7 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) } else seq_printf(seq, "<not supported>\n"); end: - return_VALUE(0); + return 0; } static int @@ -1068,7 +1039,6 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) int status; unsigned long id; - ACPI_FUNCTION_TRACE("acpi_video_bus_POST_seq_show"); if (!video) goto end; @@ -1081,18 +1051,17 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]); end: - return_VALUE(0); + return 0; } static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset) { struct acpi_video_bus *video = (struct acpi_video_bus *)seq->private; - ACPI_FUNCTION_TRACE("acpi_video_bus_DOS_seq_show"); seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting); - return_VALUE(0); + return 0; } static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file) @@ -1117,22 +1086,21 @@ acpi_video_bus_write_POST(struct file *file, char str[12] = { 0 }; unsigned long opt, options; - ACPI_FUNCTION_TRACE("acpi_video_bus_write_POST"); if (!video || count + 1 > sizeof str) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_video_bus_POST_options(video, &options); if (!ACPI_SUCCESS(status)) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(str, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; str[count] = 0; opt = strtoul(str, NULL, 0); if (opt > 3) - return_VALUE(-EFAULT); + return -EFAULT; /* just in case an OEM 'forget' the motherboard... */ options |= 1; @@ -1140,11 +1108,11 @@ acpi_video_bus_write_POST(struct file *file, if (options & (1ul << opt)) { status = acpi_video_bus_set_POST(video, opt); if (!ACPI_SUCCESS(status)) - return_VALUE(-EFAULT); + return -EFAULT; } - return_VALUE(count); + return count; } static ssize_t @@ -1158,25 +1126,24 @@ acpi_video_bus_write_DOS(struct file *file, char str[12] = { 0 }; unsigned long opt; - ACPI_FUNCTION_TRACE("acpi_video_bus_write_DOS"); if (!video || count + 1 > sizeof str) - return_VALUE(-EINVAL); + return -EINVAL; if (copy_from_user(str, buffer, count)) - return_VALUE(-EFAULT); + return -EFAULT; str[count] = 0; opt = strtoul(str, NULL, 0); if (opt > 7) - return_VALUE(-EFAULT); + return -EFAULT; status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2); if (!ACPI_SUCCESS(status)) - return_VALUE(-EFAULT); + return -EFAULT; - return_VALUE(count); + return count; } static int acpi_video_bus_add_fs(struct acpi_device *device) @@ -1184,7 +1151,6 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) struct proc_dir_entry *entry = NULL; struct acpi_video_bus *video; - ACPI_FUNCTION_TRACE("acpi_video_bus_add_fs"); video = (struct acpi_video_bus *)acpi_driver_data(device); @@ -1192,7 +1158,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_video_dir); if (!acpi_device_dir(device)) - return_VALUE(-ENODEV); + return -ENODEV; video->dir = acpi_device_dir(device); acpi_device_dir(device)->owner = THIS_MODULE; } @@ -1200,8 +1166,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) /* 'info' [R] */ entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'info' fs entry\n")); + return -ENODEV; else { entry->proc_fops = &acpi_video_bus_info_fops; entry->data = acpi_driver_data(device); @@ -1211,8 +1176,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) /* 'ROM' [R] */ entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'ROM' fs entry\n")); + return -ENODEV; else { entry->proc_fops = &acpi_video_bus_ROM_fops; entry->data = acpi_driver_data(device); @@ -1223,8 +1187,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) entry = create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'POST_info' fs entry\n")); + return -ENODEV; else { entry->proc_fops = &acpi_video_bus_POST_info_fops; entry->data = acpi_driver_data(device); @@ -1236,8 +1199,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'POST' fs entry\n")); + return -ENODEV; else { acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; entry->proc_fops = &acpi_video_bus_POST_fops; @@ -1250,8 +1212,7 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR, acpi_device_dir(device)); if (!entry) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Unable to create 'DOS' fs entry\n")); + return -ENODEV; else { acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; entry->proc_fops = &acpi_video_bus_DOS_fops; @@ -1259,14 +1220,13 @@ static int acpi_video_bus_add_fs(struct acpi_device *device) entry->owner = THIS_MODULE; } - return_VALUE(0); + return 0; } static int acpi_video_bus_remove_fs(struct acpi_device *device) { struct acpi_video_bus *video; - ACPI_FUNCTION_TRACE("acpi_video_bus_remove_fs"); video = (struct acpi_video_bus *)acpi_driver_data(device); @@ -1280,7 +1240,7 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device) acpi_device_dir(device) = NULL; } - return_VALUE(0); + return 0; } /* -------------------------------------------------------------------------- @@ -1297,10 +1257,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device, int status; struct acpi_video_device *data; - ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device"); if (!device || !video) - return_VALUE(-EINVAL); + return -EINVAL; status = acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); @@ -1308,7 +1267,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device, data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL); if (!data) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(data, 0, sizeof(struct acpi_video_device)); @@ -1359,10 +1318,10 @@ acpi_video_bus_get_one_device(struct acpi_device *device, acpi_video_device_add_fs(device); - return_VALUE(0); + return 0; } - return_VALUE(-ENOENT); + return -ENOENT; } /* @@ -1405,7 +1364,6 @@ acpi_video_device_bind(struct acpi_video_bus *video, struct acpi_video_device *device) { int i; - ACPI_FUNCTION_TRACE("acpi_video_device_bind"); #define IDS_VAL(i) video->attached_array[i].value.int_val #define IDS_BIND(i) video->attached_array[i].bind_info @@ -1442,17 +1400,16 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) union acpi_object *dod = NULL; union acpi_object *obj; - ACPI_FUNCTION_TRACE("acpi_video_device_enumerate"); status = acpi_evaluate_object(video->handle, "_DOD", NULL, &buffer); if (!ACPI_SUCCESS(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _DOD\n")); - return_VALUE(status); + ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD")); + return status; } dod = (union acpi_object *)buffer.pointer; if (!dod || (dod->type != ACPI_TYPE_PACKAGE)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _DOD data\n")); + ACPI_EXCEPTION((AE_INFO, status, "Invalid _DOD data")); status = -EFAULT; goto out; } @@ -1476,8 +1433,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) obj = (union acpi_object *)&dod->package.elements[i]; if (obj->type != ACPI_TYPE_INTEGER) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Invalid _DOD data\n")); + printk(KERN_ERR PREFIX "Invalid _DOD data\n"); active_device_list[i].value.int_val = ACPI_VIDEO_HEAD_INVALID; } @@ -1495,7 +1451,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) video->attached_count = count; out: acpi_os_free(buffer.pointer); - return_VALUE(status); + return status; } /* @@ -1520,7 +1476,6 @@ static int acpi_video_switch_output(struct acpi_video_bus *video, int event) unsigned long state; int status = 0; - ACPI_FUNCTION_TRACE("acpi_video_switch_output"); list_for_each_safe(node, next, &video->video_device_list) { dev = container_of(node, struct acpi_video_device, entry); @@ -1551,7 +1506,7 @@ static int acpi_video_switch_output(struct acpi_video_bus *video, int event) break; } - return_VALUE(status); + return status; } static int @@ -1578,7 +1533,6 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, int status = 0; struct list_head *node, *next; - ACPI_FUNCTION_TRACE("acpi_video_get_devices"); acpi_video_device_enumerate(video); @@ -1591,13 +1545,12 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, status = acpi_video_bus_get_one_device(dev, video); if (ACPI_FAILURE(status)) { - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Cant attach device\n")); + ACPI_EXCEPTION((AE_INFO, status, "Cant attach device")); continue; } } - return_VALUE(status); + return status; } static int acpi_video_bus_put_one_device(struct acpi_video_device *device) @@ -1605,10 +1558,9 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) acpi_status status; struct acpi_video_bus *video; - ACPI_FUNCTION_TRACE("acpi_video_bus_put_one_device"); if (!device || !device->video) - return_VALUE(-ENOENT); + return -ENOENT; video = device->video; @@ -1620,11 +1572,8 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) status = acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, acpi_video_device_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); - return_VALUE(0); + return 0; } static int acpi_video_bus_put_devices(struct acpi_video_bus *video) @@ -1632,7 +1581,6 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video) int status; struct list_head *node, *next; - ACPI_FUNCTION_TRACE("acpi_video_bus_put_devices"); list_for_each_safe(node, next, &video->video_device_list) { struct acpi_video_device *data = @@ -1651,7 +1599,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video) kfree(data); } - return_VALUE(0); + return 0; } /* acpi_video interface */ @@ -1671,14 +1619,13 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) struct acpi_video_bus *video = (struct acpi_video_bus *)data; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_video_bus_notify"); printk("video bus notify\n"); if (!video) - return_VOID; + return; if (acpi_bus_get_device(handle, &device)) - return_VOID; + return; switch (event) { case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur, @@ -1707,7 +1654,7 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) break; } - return_VOID; + return; } static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) @@ -1716,14 +1663,13 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) (struct acpi_video_device *)data; struct acpi_device *device = NULL; - ACPI_FUNCTION_TRACE("acpi_video_device_notify"); printk("video device notify\n"); if (!video_device) - return_VOID; + return; if (acpi_bus_get_device(handle, &device)) - return_VOID; + return; switch (event) { case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ @@ -1743,7 +1689,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) "Unsupported event [0x%x]\n", event)); break; } - return_VOID; + return; } static int acpi_video_bus_add(struct acpi_device *device) @@ -1752,14 +1698,13 @@ static int acpi_video_bus_add(struct acpi_device *device) acpi_status status = 0; struct acpi_video_bus *video = NULL; - ACPI_FUNCTION_TRACE("acpi_video_bus_add"); if (!device) - return_VALUE(-EINVAL); + return -EINVAL; video = kmalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); if (!video) - return_VALUE(-ENOMEM); + return -ENOMEM; memset(video, 0, sizeof(struct acpi_video_bus)); video->handle = device->handle; @@ -1806,7 +1751,7 @@ static int acpi_video_bus_add(struct acpi_device *device) if (result) kfree(video); - return_VALUE(result); + return result; } static int acpi_video_bus_remove(struct acpi_device *device, int type) @@ -1814,10 +1759,9 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) acpi_status status = 0; struct acpi_video_bus *video = NULL; - ACPI_FUNCTION_TRACE("acpi_video_bus_remove"); if (!device || !acpi_driver_data(device)) - return_VALUE(-EINVAL); + return -EINVAL; video = (struct acpi_video_bus *)acpi_driver_data(device); @@ -1826,9 +1770,6 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) status = acpi_remove_notify_handler(video->handle, ACPI_DEVICE_NOTIFY, acpi_video_bus_notify); - if (ACPI_FAILURE(status)) - ACPI_DEBUG_PRINT((ACPI_DB_ERROR, - "Error removing notify handler\n")); acpi_video_bus_put_devices(video); acpi_video_bus_remove_fs(device); @@ -1836,7 +1777,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) kfree(video->attached_array); kfree(video); - return_VALUE(0); + return 0; } static int @@ -1846,10 +1787,9 @@ acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver) acpi_handle h_dummy2; acpi_handle h_dummy3; - ACPI_FUNCTION_TRACE("acpi_video_bus_match"); if (!device || !driver) - return_VALUE(-EINVAL); + return -EINVAL; /* Since there is no HID, CID for ACPI Video drivers, we have * to check well known required nodes for each feature we support. @@ -1858,26 +1798,25 @@ acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver) /* Does this device able to support video switching ? */ if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) && ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2))) - return_VALUE(0); + return 0; /* Does this device able to retrieve a video ROM ? */ if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1))) - return_VALUE(0); + return 0; /* Does this device able to configure which video head to be POSTed ? */ if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) && ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) && ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3))) - return_VALUE(0); + return 0; - return_VALUE(-ENODEV); + return -ENODEV; } static int __init acpi_video_init(void) { int result = 0; - ACPI_FUNCTION_TRACE("acpi_video_init"); /* acpi_dbg_level = 0xFFFFFFFF; @@ -1886,27 +1825,26 @@ static int __init acpi_video_init(void) acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); if (!acpi_video_dir) - return_VALUE(-ENODEV); + return -ENODEV; acpi_video_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_video_bus); if (result < 0) { remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); - return_VALUE(-ENODEV); + return -ENODEV; } - return_VALUE(0); + return 0; } static void __exit acpi_video_exit(void) { - ACPI_FUNCTION_TRACE("acpi_video_exit"); acpi_bus_unregister_driver(&acpi_video_bus); remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); - return_VOID; + return; } module_init(acpi_video_init); diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 889855d8d9f..9e3e2a69c03 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -180,8 +180,9 @@ static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) amba_attr(id, "%08x\n", dev->periphid); amba_attr(irq0, "%u\n", dev->irq[0]); amba_attr(irq1, "%u\n", dev->irq[1]); -amba_attr(resource, "\t%08lx\t%08lx\t%08lx\n", - dev->res.start, dev->res.end, dev->res.flags); +amba_attr(resource, "\t%016llx\t%016llx\t%016lx\n", + (unsigned long long)dev->res.start, (unsigned long long)dev->res.end, + dev->res.flags); /** * amba_device_register - register an AMBA device diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c index d1387cfe2d3..6cc93de0b71 100644 --- a/drivers/atm/adummy.c +++ b/drivers/atm/adummy.c @@ -2,7 +2,6 @@ * adummy.c: a dummy ATM driver */ -#include <linux/config.h> #include <linux/module.h> #include <linux/version.h> #include <linux/kernel.h> diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c index 4b6bf19c39c..d3b426313a4 100644 --- a/drivers/atm/ambassador.c +++ b/drivers/atm/ambassador.c @@ -2257,7 +2257,8 @@ static int __devinit amb_probe(struct pci_dev *pci_dev, const struct pci_device_ } PRINTD (DBG_INFO, "found Madge ATM adapter (amb) at" - " IO %lx, IRQ %u, MEM %p", pci_resource_start(pci_dev, 1), + " IO %llx, IRQ %u, MEM %p", + (unsigned long long)pci_resource_start(pci_dev, 1), irq, bus_to_virt(pci_resource_start(pci_dev, 0))); // check IO region @@ -2285,7 +2286,7 @@ static int __devinit amb_probe(struct pci_dev *pci_dev, const struct pci_device_ setup_pci_dev(pci_dev); // grab (but share) IRQ and install handler - err = request_irq(irq, interrupt_handler, SA_SHIRQ, DEV_LABEL, dev); + err = request_irq(irq, interrupt_handler, IRQF_SHARED, DEV_LABEL, dev); if (err < 0) { PRINTK (KERN_ERR, "request IRQ failed!"); goto out_reset; diff --git a/drivers/atm/ambassador.h b/drivers/atm/ambassador.h index 84a93063cfe..8296420ceae 100644 --- a/drivers/atm/ambassador.h +++ b/drivers/atm/ambassador.h @@ -23,7 +23,6 @@ #ifndef AMBASSADOR_H #define AMBASSADOR_H -#include <linux/config.h> #ifdef CONFIG_ATM_AMBASSADOR_DEBUG #define DEBUG_AMBASSADOR diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c index c13c4d736ef..df359a6c14f 100644 --- a/drivers/atm/eni.c +++ b/drivers/atm/eni.c @@ -4,7 +4,6 @@ #include <linux/module.h> -#include <linux/config.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/pci.h> @@ -1798,7 +1797,7 @@ static int __devinit eni_start(struct atm_dev *dev) DPRINTK(">eni_start\n"); eni_dev = ENI_DEV(dev); - if (request_irq(eni_dev->irq,&eni_int,SA_SHIRQ,DEV_LABEL,dev)) { + if (request_irq(eni_dev->irq,&eni_int,IRQF_SHARED,DEV_LABEL,dev)) { printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n", dev->number,eni_dev->irq); error = -EAGAIN; diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c index 1bca86edf57..38fc054bd67 100644 --- a/drivers/atm/firestream.c +++ b/drivers/atm/firestream.c @@ -1658,9 +1658,10 @@ static int __devinit fs_init (struct fs_dev *dev) func_enter (); pci_dev = dev->pci_dev; - printk (KERN_INFO "found a FireStream %d card, base %08lx, irq%d.\n", + printk (KERN_INFO "found a FireStream %d card, base %16llx, irq%d.\n", IS_FS50(dev)?50:155, - pci_resource_start(pci_dev, 0), dev->pci_dev->irq); + (unsigned long long)pci_resource_start(pci_dev, 0), + dev->pci_dev->irq); if (fs_debug & FS_DEBUG_INIT) my_hd ((unsigned char *) dev, sizeof (*dev)); @@ -1828,7 +1829,7 @@ static int __devinit fs_init (struct fs_dev *dev) init_q (dev, &dev->rx_rq[i], RXB_RQ(i), RXRQ_NENTRIES, 1); dev->irq = pci_dev->irq; - if (request_irq (dev->irq, fs_irq, SA_SHIRQ, "firestream", dev)) { + if (request_irq (dev->irq, fs_irq, IRQF_SHARED, "firestream", dev)) { printk (KERN_WARNING "couldn't get irq %d for firestream.\n", pci_dev->irq); /* XXX undo all previous stuff... */ return 1; diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index 92923bf2723..98622130de5 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c @@ -25,7 +25,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/init.h> @@ -2124,7 +2123,7 @@ fore200e_change_qos(struct atm_vcc* vcc,struct atm_qos* qos, int flags) static int __devinit fore200e_irq_request(struct fore200e* fore200e) { - if (request_irq(fore200e->irq, fore200e_interrupt, SA_SHIRQ, fore200e->name, fore200e->atm_dev) < 0) { + if (request_irq(fore200e->irq, fore200e_interrupt, IRQF_SHARED, fore200e->name, fore200e->atm_dev) < 0) { printk(FORE200E "unable to reserve IRQ %s for device %s\n", fore200e_irq_itoa(fore200e->irq), fore200e->name); diff --git a/drivers/atm/fore200e.h b/drivers/atm/fore200e.h index 2558eb85323..f9abfdac33e 100644 --- a/drivers/atm/fore200e.h +++ b/drivers/atm/fore200e.h @@ -3,7 +3,6 @@ #define _FORE200E_H #ifdef __KERNEL__ -#include <linux/config.h> /* rx buffer sizes */ diff --git a/drivers/atm/he.c b/drivers/atm/he.c index fde9334059a..d369130f423 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c @@ -55,7 +55,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/skbuff.h> @@ -1008,7 +1007,7 @@ he_init_irq(struct he_dev *he_dev) he_writel(he_dev, 0x0, GRP_54_MAP); he_writel(he_dev, 0x0, GRP_76_MAP); - if (request_irq(he_dev->pci_dev->irq, he_irq_handler, SA_INTERRUPT|SA_SHIRQ, DEV_LABEL, he_dev)) { + if (request_irq(he_dev->pci_dev->irq, he_irq_handler, IRQF_DISABLED|IRQF_SHARED, DEV_LABEL, he_dev)) { hprintk("irq %d already in use\n", he_dev->pci_dev->irq); return -EINVAL; } @@ -1018,7 +1017,7 @@ he_init_irq(struct he_dev *he_dev) return 0; } -static int __init +static int __devinit he_start(struct atm_dev *dev) { struct he_dev *he_dev; diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c index 821c81e8cd3..d1113e845f9 100644 --- a/drivers/atm/horizon.c +++ b/drivers/atm/horizon.c @@ -2735,7 +2735,7 @@ static int __devinit hrz_probe(struct pci_dev *pci_dev, const struct pci_device_ irq = pci_dev->irq; if (request_irq(irq, interrupt_handler, - SA_SHIRQ, /* irqflags guess */ + IRQF_SHARED, /* irqflags guess */ DEV_LABEL, /* name guess */ dev)) { PRINTD(DBG_WARN, "request IRQ failed!"); diff --git a/drivers/atm/horizon.h b/drivers/atm/horizon.h index e2cc7020fa3..4461229f56a 100644 --- a/drivers/atm/horizon.h +++ b/drivers/atm/horizon.h @@ -30,7 +30,6 @@ #ifndef DRIVER_ATM_HORIZON_H #define DRIVER_ATM_HORIZON_H -#include <linux/config.h> #ifdef CONFIG_ATM_HORIZON_DEBUG #define DEBUG_HORIZON diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c index 0aabfc2a59d..325325afabe 100644 --- a/drivers/atm/idt77105.c +++ b/drivers/atm/idt77105.c @@ -358,7 +358,7 @@ static const struct atmphy_ops idt77105_ops = { }; -int idt77105_init(struct atm_dev *dev) +int __devinit idt77105_init(struct atm_dev *dev) { dev->phy = &idt77105_ops; return 0; diff --git a/drivers/atm/idt77105.h b/drivers/atm/idt77105.h index 8ba8218aaef..3fd2bc89976 100644 --- a/drivers/atm/idt77105.h +++ b/drivers/atm/idt77105.h @@ -76,7 +76,7 @@ #define IDT77105_CTRSEL_RHEC 0x01 /* W, Rx HEC Error Counter */ #ifdef __KERNEL__ -int idt77105_init(struct atm_dev *dev) __init; +int idt77105_init(struct atm_dev *dev); #endif /* diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index b4a76cade64..5d1c6c95262 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c @@ -34,7 +34,6 @@ static char const rcsid[] = #include <linux/module.h> -#include <linux/config.h> #include <linux/pci.h> #include <linux/skbuff.h> #include <linux/kernel.h> @@ -3387,7 +3386,7 @@ init_card(struct atm_dev *dev) writel(SAR_STAT_TMROF, SAR_REG_STAT); } IPRINTK("%s: Request IRQ ... ", card->name); - if (request_irq(pcidev->irq, idt77252_interrupt, SA_INTERRUPT|SA_SHIRQ, + if (request_irq(pcidev->irq, idt77252_interrupt, IRQF_DISABLED|IRQF_SHARED, card->name, card) != 0) { printk("%s: can't allocate IRQ.\n", card->name); deinit_card(card); diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c index 2e2e50e1167..f20b0b2c06c 100644 --- a/drivers/atm/iphase.c +++ b/drivers/atm/iphase.c @@ -2284,7 +2284,7 @@ static int reset_sar(struct atm_dev *dev) } -static int __init ia_init(struct atm_dev *dev) +static int __devinit ia_init(struct atm_dev *dev) { IADEV *iadev; unsigned long real_base; @@ -2480,7 +2480,7 @@ static void ia_free_rx(IADEV *iadev) iadev->rx_dle_dma); } -static int __init ia_start(struct atm_dev *dev) +static int __devinit ia_start(struct atm_dev *dev) { IADEV *iadev; int error; @@ -2488,7 +2488,7 @@ static int __init ia_start(struct atm_dev *dev) u32 ctrl_reg; IF_EVENT(printk(">ia_start\n");) iadev = INPH_IA_DEV(dev); - if (request_irq(iadev->irq, &ia_int, SA_SHIRQ, DEV_LABEL, dev)) { + if (request_irq(iadev->irq, &ia_int, IRQF_SHARED, DEV_LABEL, dev)) { printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n", dev->number, iadev->irq); error = -EAGAIN; diff --git a/drivers/atm/iphase.h b/drivers/atm/iphase.h index b8d0bd4d6c3..133eefcc047 100644 --- a/drivers/atm/iphase.h +++ b/drivers/atm/iphase.h @@ -43,7 +43,6 @@ #ifndef IPHASE_H #define IPHASE_H -#include <linux/config.h> /************************ IADBG DEFINE *********************************/ /* IADebugFlag Bit Map */ diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c index cac09e353be..fe60a59b7fc 100644 --- a/drivers/atm/lanai.c +++ b/drivers/atm/lanai.c @@ -2240,7 +2240,7 @@ static int __devinit lanai_dev_open(struct atm_dev *atmdev) conf2_write(lanai); reg_write(lanai, TX_FIFO_DEPTH, TxDepth_Reg); reg_write(lanai, 0, CBR_ICG_Reg); /* CBR defaults to no limit */ - if ((result = request_irq(lanai->pci->irq, lanai_int, SA_SHIRQ, + if ((result = request_irq(lanai->pci->irq, lanai_int, IRQF_SHARED, DEV_LABEL, lanai)) != 0) { printk(KERN_ERR DEV_LABEL ": can't allocate interrupt\n"); goto error_vcctable; diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c index 074abc81ec3..b8036899e56 100644 --- a/drivers/atm/nicstar.c +++ b/drivers/atm/nicstar.c @@ -36,7 +36,6 @@ /* Header files ***************************************************************/ #include <linux/module.h> -#include <linux/config.h> #include <linux/kernel.h> #include <linux/skbuff.h> #include <linux/atmdev.h> @@ -626,7 +625,7 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev) if (mac[i] == NULL) nicstar_init_eprom(card->membase); - if (request_irq(pcidev->irq, &ns_irq_handler, SA_INTERRUPT | SA_SHIRQ, "nicstar", card) != 0) + if (request_irq(pcidev->irq, &ns_irq_handler, IRQF_DISABLED | IRQF_SHARED, "nicstar", card) != 0) { printk("nicstar%d: can't allocate IRQ %d.\n", i, pcidev->irq); error = 9; diff --git a/drivers/atm/suni.c b/drivers/atm/suni.c index b1d063cc4fb..f04f39c0083 100644 --- a/drivers/atm/suni.c +++ b/drivers/atm/suni.c @@ -289,7 +289,7 @@ static const struct atmphy_ops suni_ops = { }; -int suni_init(struct atm_dev *dev) +int __devinit suni_init(struct atm_dev *dev) { unsigned char mri; diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c index f484747f255..2c65e82f0d6 100644 --- a/drivers/atm/zatm.c +++ b/drivers/atm/zatm.c @@ -3,7 +3,6 @@ /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/kernel.h> @@ -1271,7 +1270,7 @@ static int __init zatm_start(struct atm_dev *dev) zatm_dev->rx_map = zatm_dev->tx_map = NULL; for (i = 0; i < NR_MBX; i++) zatm_dev->mbx_start[i] = 0; - error = request_irq(zatm_dev->irq, zatm_int, SA_SHIRQ, DEV_LABEL, dev); + error = request_irq(zatm_dev->irq, zatm_int, IRQF_SHARED, DEV_LABEL, dev); if (error < 0) { printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n", dev->number,zatm_dev->irq); diff --git a/drivers/atm/zatm.h b/drivers/atm/zatm.h index 416fe0fda60..ae9165ce15a 100644 --- a/drivers/atm/zatm.h +++ b/drivers/atm/zatm.h @@ -6,7 +6,6 @@ #ifndef DRIVER_ATM_ZATM_H #define DRIVER_ATM_ZATM_H -#include <linux/config.h> #include <linux/skbuff.h> #include <linux/atm.h> #include <linux/atmdev.h> diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 050d86d0b87..83fa8b291a5 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -8,7 +8,6 @@ * */ -#include <linux/config.h> #include <linux/device.h> #include <linux/module.h> #include <linux/errno.h> diff --git a/drivers/base/class.c b/drivers/base/class.c index 9aa12746026..de8908320f2 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -10,7 +10,6 @@ * */ -#include <linux/config.h> #include <linux/device.h> #include <linux/module.h> #include <linux/init.h> diff --git a/drivers/base/core.c b/drivers/base/core.c index 27c2176895d..b21f864c9ce 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -8,7 +8,6 @@ * */ -#include <linux/config.h> #include <linux/device.h> #include <linux/err.h> #include <linux/init.h> diff --git a/drivers/base/driver.c b/drivers/base/driver.c index b400314e1c6..562600dd540 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c @@ -8,7 +8,6 @@ * */ -#include <linux/config.h> #include <linux/device.h> #include <linux/module.h> #include <linux/errno.h> diff --git a/drivers/base/node.c b/drivers/base/node.c index eae2bdc183b..d7de1753e09 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -40,24 +40,13 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) int n; int nid = dev->id; struct sysinfo i; - struct page_state ps; unsigned long inactive; unsigned long active; unsigned long free; si_meminfo_node(&i, nid); - get_page_state_node(&ps, nid); __get_zone_counts(&active, &inactive, &free, NODE_DATA(nid)); - /* Check for negative values in these approximate counters */ - if ((long)ps.nr_dirty < 0) - ps.nr_dirty = 0; - if ((long)ps.nr_writeback < 0) - ps.nr_writeback = 0; - if ((long)ps.nr_mapped < 0) - ps.nr_mapped = 0; - if ((long)ps.nr_slab < 0) - ps.nr_slab = 0; n = sprintf(buf, "\n" "Node %d MemTotal: %8lu kB\n" @@ -71,7 +60,12 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) "Node %d LowFree: %8lu kB\n" "Node %d Dirty: %8lu kB\n" "Node %d Writeback: %8lu kB\n" + "Node %d FilePages: %8lu kB\n" "Node %d Mapped: %8lu kB\n" + "Node %d AnonPages: %8lu kB\n" + "Node %d PageTables: %8lu kB\n" + "Node %d NFS Unstable: %8lu kB\n" + "Node %d Bounce: %8lu kB\n" "Node %d Slab: %8lu kB\n", nid, K(i.totalram), nid, K(i.freeram), @@ -82,10 +76,15 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf) nid, K(i.freehigh), nid, K(i.totalram - i.totalhigh), nid, K(i.freeram - i.freehigh), - nid, K(ps.nr_dirty), - nid, K(ps.nr_writeback), - nid, K(ps.nr_mapped), - nid, K(ps.nr_slab)); + nid, K(node_page_state(nid, NR_FILE_DIRTY)), + nid, K(node_page_state(nid, NR_WRITEBACK)), + nid, K(node_page_state(nid, NR_FILE_PAGES)), + nid, K(node_page_state(nid, NR_FILE_MAPPED)), + nid, K(node_page_state(nid, NR_ANON_PAGES)), + nid, K(node_page_state(nid, NR_PAGETABLE)), + nid, K(node_page_state(nid, NR_UNSTABLE_NFS)), + nid, K(node_page_state(nid, NR_BOUNCE)), + nid, K(node_page_state(nid, NR_SLAB))); n += hugetlb_report_node_meminfo(nid, buf + n); return n; } @@ -95,28 +94,6 @@ static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL); static ssize_t node_read_numastat(struct sys_device * dev, char * buf) { - unsigned long numa_hit, numa_miss, interleave_hit, numa_foreign; - unsigned long local_node, other_node; - int i, cpu; - pg_data_t *pg = NODE_DATA(dev->id); - numa_hit = 0; - numa_miss = 0; - interleave_hit = 0; - numa_foreign = 0; - local_node = 0; - other_node = 0; - for (i = 0; i < MAX_NR_ZONES; i++) { - struct zone *z = &pg->node_zones[i]; - for_each_online_cpu(cpu) { - struct per_cpu_pageset *ps = zone_pcp(z,cpu); - numa_hit += ps->numa_hit; - numa_miss += ps->numa_miss; - numa_foreign += ps->numa_foreign; - interleave_hit += ps->interleave_hit; - local_node += ps->local_node; - other_node += ps->other_node; - } - } return sprintf(buf, "numa_hit %lu\n" "numa_miss %lu\n" @@ -124,12 +101,12 @@ static ssize_t node_read_numastat(struct sys_device * dev, char * buf) "interleave_hit %lu\n" "local_node %lu\n" "other_node %lu\n", - numa_hit, - numa_miss, - numa_foreign, - interleave_hit, - local_node, - other_node); + node_page_state(dev->id, NUMA_HIT), + node_page_state(dev->id, NUMA_MISS), + node_page_state(dev->id, NUMA_FOREIGN), + node_page_state(dev->id, NUMA_INTERLEAVE_HIT), + node_page_state(dev->id, NUMA_LOCAL), + node_page_state(dev->id, NUMA_OTHER)); } static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 0d2e101e4f1..fdfa3d0cf6a 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -19,7 +19,6 @@ * ancestral dependencies that the subsystem list maintains. */ -#include <linux/config.h> #include <linux/device.h> #include "power.h" diff --git a/drivers/base/power/shutdown.c b/drivers/base/power/shutdown.c index 8826a5b6673..3483ae4d57f 100644 --- a/drivers/base/power/shutdown.c +++ b/drivers/base/power/shutdown.c @@ -8,7 +8,6 @@ * */ -#include <linux/config.h> #include <linux/device.h> #include <asm/semaphore.h> diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 6858178b3af..04e5db445c7 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c @@ -12,7 +12,6 @@ * add themselves as children of the system bus. */ -#include <linux/config.h> #include <linux/sysdev.h> #include <linux/err.h> #include <linux/module.h> diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index dd8a1501142..4cd23c3eab4 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c @@ -2530,7 +2530,6 @@ static boolean DAC960_RegisterBlockDevice(DAC960_Controller_T *Controller) blk_queue_max_sectors(RequestQueue, Controller->MaxBlocksPerCommand); disk->queue = RequestQueue; sprintf(disk->disk_name, "rd/c%dd%d", Controller->ControllerNumber, n); - sprintf(disk->devfs_name, "rd/host%d/target%d", Controller->ControllerNumber, n); disk->major = MajorNumber; disk->first_minor = n << DAC960_MaxPartitionsBits; disk->fops = &DAC960_BlockDeviceOperations; @@ -3015,7 +3014,7 @@ DAC960_DetectController(struct pci_dev *PCI_Device, Acquire shared access to the IRQ Channel. */ IRQ_Channel = PCI_Device->irq; - if (request_irq(IRQ_Channel, InterruptHandler, SA_SHIRQ, + if (request_irq(IRQ_Channel, InterruptHandler, IRQF_SHARED, Controller->FullModelName, Controller) < 0) { DAC960_Error("Unable to acquire IRQ Channel %d for Controller at\n", diff --git a/drivers/block/acsi.c b/drivers/block/acsi.c index 196c0ec9cd5..0b80fbb8dbf 100644 --- a/drivers/block/acsi.c +++ b/drivers/block/acsi.c @@ -43,7 +43,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/signal.h> @@ -1732,13 +1731,10 @@ int acsi_init( void ) struct gendisk *disk = acsi_gendisk[i]; sprintf(disk->disk_name, "ad%c", 'a'+i); aip = &acsi_info[NDevices]; - sprintf(disk->devfs_name, "ad/target%d/lun%d", aip->target, aip->lun); disk->major = ACSI_MAJOR; disk->first_minor = i << 4; - if (acsi_info[i].type != HARDDISK) { + if (acsi_info[i].type != HARDDISK) disk->minors = 1; - strcat(disk->devfs_name, "/disc"); - } disk->fops = &acsi_fops; disk->private_data = &acsi_info[i]; set_capacity(disk, acsi_info[i].size); diff --git a/drivers/block/acsi_slm.c b/drivers/block/acsi_slm.c index 4cb9c133628..4030a8fd118 100644 --- a/drivers/block/acsi_slm.c +++ b/drivers/block/acsi_slm.c @@ -65,7 +65,6 @@ not be guaranteed. There are several ways to assure this: #include <linux/time.h> #include <linux/mm.h> #include <linux/slab.h> -#include <linux/devfs_fs_kernel.h> #include <linux/smp_lock.h> #include <asm/pgtable.h> @@ -1005,11 +1004,6 @@ int slm_init( void ) BufferP = SLMBuffer; SLMState = IDLE; - devfs_mk_dir("slm"); - for (i = 0; i < MAX_SLM; i++) { - devfs_mk_cdev(MKDEV(ACSI_MAJOR, i), - S_IFCHR|S_IRUSR|S_IWUSR, "slm/%d", i); - } return 0; } @@ -1032,10 +1026,6 @@ int init_module(void) void cleanup_module(void) { - int i; - for (i = 0; i < MAX_SLM; i++) - devfs_remove("slm/%d", i); - devfs_remove("slm"); if (unregister_chrdev( ACSI_MAJOR, "slm" ) != 0) printk( KERN_ERR "acsi_slm: cleanup_module failed\n"); atari_stram_free( SLMBuffer ); diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 39b0f53186e..1c4df22dfd2 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -3159,7 +3159,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, /* make sure the board interrupts are off */ hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_OFF); if (request_irq(hba[i]->intr[SIMPLE_MODE_INT], do_cciss_intr, - SA_INTERRUPT | SA_SHIRQ, hba[i]->devname, hba[i])) { + IRQF_DISABLED | IRQF_SHARED, hba[i]->devname, hba[i])) { printk(KERN_ERR "cciss: Unable to get irq %d for %s\n", hba[i]->intr[SIMPLE_MODE_INT], hba[i]->devname); goto clean2; @@ -3248,7 +3248,6 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, q->queuedata = hba[i]; sprintf(disk->disk_name, "cciss/c%dd%d", i, j); - sprintf(disk->devfs_name, "cciss/host%d/target%d", i, j); disk->major = hba[i]->major; disk->first_minor = j << NWD_SHIFT; disk->fops = &cciss_fops; diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index 5eb6fb7b5cf..757f42dd8e8 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c @@ -33,7 +33,6 @@ #include <linux/blkpg.h> #include <linux/timer.h> #include <linux/proc_fs.h> -#include <linux/devfs_fs_kernel.h> #include <linux/init.h> #include <linux/hdreg.h> #include <linux/spinlock.h> @@ -348,7 +347,6 @@ static void __devexit cpqarray_remove_one(int i) for(j = 0; j < NWD; j++) { if (ida_gendisk[i][j]->flags & GENHD_FL_UP) del_gendisk(ida_gendisk[i][j]); - devfs_remove("ida/c%dd%d",i,j); put_disk(ida_gendisk[i][j]); } blk_cleanup_queue(hba[i]->queue); @@ -410,7 +408,7 @@ static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev) } hba[i]->access.set_intr_mask(hba[i], 0); if (request_irq(hba[i]->intr, do_ida_intr, - SA_INTERRUPT|SA_SHIRQ, hba[i]->devname, hba[i])) + IRQF_DISABLED|IRQF_SHARED, hba[i]->devname, hba[i])) { printk(KERN_ERR "cpqarray: Unable to get irq %d for %s\n", hba[i]->intr, hba[i]->devname); @@ -1807,8 +1805,6 @@ static void getgeometry(int ctlr) } - sprintf(disk->devfs_name, "ida/c%dd%d", ctlr, log_unit); - info_p->phys_drives = sense_config_buf->ctlr_phys_drv; info_p->drv_assign_map @@ -1844,7 +1840,6 @@ static void __exit cpqarray_exit(void) } } - devfs_remove("ida"); remove_proc_entry("cpqarray", proc_root_driver); } diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index dff1e67b1dd..0242cbb86a8 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -177,7 +177,6 @@ static int print_unex = 1; #include <linux/ioport.h> #include <linux/interrupt.h> #include <linux/init.h> -#include <linux/devfs_fs_kernel.h> #include <linux/platform_device.h> #include <linux/buffer_head.h> /* for invalidate_buffers() */ #include <linux/mutex.h> @@ -224,7 +223,6 @@ static struct completion device_release; static unsigned short virtual_dma_port = 0x3f0; irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs); static int set_dor(int fdc, char mask, char data); -static void register_devfs_entries(int drive) __init; #define K_64 0x10000 /* 64KB */ @@ -3676,7 +3674,6 @@ static void __init config_types(void) first = 0; } printk("%s fd%d is %s", prepend, drive, name); - register_devfs_entries(drive); } *UDP = *params; } @@ -3954,37 +3951,6 @@ static struct block_device_operations floppy_fops = { .media_changed = check_floppy_change, .revalidate_disk = floppy_revalidate, }; -static char *table[] = { - "", "d360", "h1200", "u360", "u720", "h360", "h720", - "u1440", "u2880", "CompaQ", "h1440", "u1680", "h410", - "u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743", - "h880", "u1040", "u1120", "h1600", "u1760", "u1920", - "u3200", "u3520", "u3840", "u1840", "u800", "u1600", - NULL -}; -static int t360[] = { 1, 0 }, - t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23, 0 }, - t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13, - 17, 21, 22, 30, 0 }; -static int *table_sup[] = - { NULL, t360, t1200, t3in + 5 + 8, t3in + 5, t3in, t3in }; - -static void __init register_devfs_entries(int drive) -{ - int base_minor = (drive < 4) ? drive : (124 + drive); - - if (UDP->cmos < ARRAY_SIZE(default_drive_params)) { - int i = 0; - do { - int minor = base_minor + (table_sup[UDP->cmos][i] << 2); - - devfs_mk_bdev(MKDEV(FLOPPY_MAJOR, minor), - S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP | - S_IWGRP, "floppy/%d%s", drive, - table[table_sup[UDP->cmos][i]]); - } while (table_sup[UDP->cmos][i++]); - } -} /* * Floppy Driver initialization @@ -4261,11 +4227,9 @@ static int __init floppy_init(void) motor_off_timer[dr].function = motor_off_callback; } - devfs_mk_dir("floppy"); - err = register_blkdev(FLOPPY_MAJOR, "fd"); if (err) - goto out_devfs_remove; + goto out_put_disk; floppy_queue = blk_init_queue(do_fd_request, &floppy_lock); if (!floppy_queue) { @@ -4424,8 +4388,6 @@ out_unreg_region: blk_cleanup_queue(floppy_queue); out_unreg_blkdev: unregister_blkdev(FLOPPY_MAJOR, "fd"); -out_devfs_remove: - devfs_remove("floppy"); out_put_disk: while (dr--) { del_timer(&motor_off_timer[dr]); @@ -4586,19 +4548,6 @@ static void floppy_release_irq_and_dma(void) static char *floppy; -static void unregister_devfs_entries(int drive) -{ - int i; - - if (UDP->cmos < ARRAY_SIZE(default_drive_params)) { - i = 0; - do { - devfs_remove("floppy/%d%s", drive, - table[table_sup[UDP->cmos][i]]); - } while (table_sup[UDP->cmos][i++]); - } -} - static void __init parse_floppy_cfg_string(char *cfg) { char *ptr; @@ -4635,13 +4584,11 @@ void cleanup_module(void) if ((allowed_drive_mask & (1 << drive)) && fdc_state[FDC(drive)].version != FDC_NONE) { del_gendisk(disks[drive]); - unregister_devfs_entries(drive); device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos); platform_device_unregister(&floppy_device[drive]); } put_disk(disks[drive]); } - devfs_remove("floppy"); del_timer_sync(&fd_timeout); del_timer_sync(&fd_timer); diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 18dd026f470..7b3b94ddddc 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -50,7 +50,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/sched.h> @@ -63,7 +62,6 @@ #include <linux/blkdev.h> #include <linux/blkpg.h> #include <linux/init.h> -#include <linux/devfs_fs_kernel.h> #include <linux/smp_lock.h> #include <linux/swap.h> #include <linux/slab.h> @@ -1277,8 +1275,6 @@ static int __init loop_init(void) goto out_mem3; } - devfs_mk_dir("loop"); - for (i = 0; i < max_loop; i++) { struct loop_device *lo = &loop_dev[i]; struct gendisk *disk = disks[i]; @@ -1296,7 +1292,6 @@ static int __init loop_init(void) disk->first_minor = i; disk->fops = &lo_fops; sprintf(disk->disk_name, "loop%d", i); - sprintf(disk->devfs_name, "loop/%d", i); disk->private_data = lo; disk->queue = lo->lo_queue; } @@ -1310,7 +1305,6 @@ static int __init loop_init(void) out_mem4: while (i--) blk_cleanup_queue(loop_dev[i].lo_queue); - devfs_remove("loop"); i = max_loop; out_mem3: while (i--) @@ -1333,7 +1327,6 @@ static void loop_exit(void) blk_cleanup_queue(loop_dev[i].lo_queue); put_disk(disks[i]); } - devfs_remove("loop"); if (unregister_blkdev(LOOP_MAJOR, "loop")) printk(KERN_WARNING "loop: cannot unregister blkdev\n"); diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 7f554f2ed07..0a1b1ea36dd 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -29,8 +29,6 @@ #include <linux/kernel.h> #include <net/sock.h> -#include <linux/devfs_fs_kernel.h> - #include <asm/uaccess.h> #include <asm/system.h> #include <asm/types.h> @@ -52,9 +50,9 @@ #define DBG_RX 0x0200 #define DBG_TX 0x0400 static unsigned int debugflags; -static unsigned int nbds_max = 16; #endif /* NDEBUG */ +static unsigned int nbds_max = 16; static struct nbd_device nbd_dev[MAX_NBD]; /* @@ -642,7 +640,6 @@ static int __init nbd_init(void) printk(KERN_INFO "nbd: registered device at major %d\n", NBD_MAJOR); dprintk(DBG_INIT, "nbd: debugflags=0x%x\n", debugflags); - devfs_mk_dir("nbd"); for (i = 0; i < nbds_max; i++) { struct gendisk *disk = nbd_dev[i].disk; nbd_dev[i].file = NULL; @@ -660,7 +657,6 @@ static int __init nbd_init(void) disk->private_data = &nbd_dev[i]; disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; sprintf(disk->disk_name, "nbd%d", i); - sprintf(disk->devfs_name, "nbd/%d", i); set_capacity(disk, 0x7ffffc00ULL << 1); /* 2 TB */ add_disk(disk); } @@ -686,7 +682,6 @@ static void __exit nbd_cleanup(void) put_disk(disk); } } - devfs_remove("nbd"); unregister_blkdev(NBD_MAJOR, "nbd"); printk(KERN_INFO "nbd: unregistered device at major %d\n", NBD_MAJOR); } diff --git a/drivers/block/paride/paride.c b/drivers/block/paride/paride.c index ce94aa11f6a..4b258f7836f 100644 --- a/drivers/block/paride/paride.c +++ b/drivers/block/paride/paride.c @@ -21,7 +21,6 @@ #define PI_VERSION "1.06" #include <linux/module.h> -#include <linux/config.h> #include <linux/kmod.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index 852b564e903..1a9dee19efc 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c @@ -707,7 +707,7 @@ static int pf_detect(void) if (pi_init(pf->pi, 0, conf[D_PRT], conf[D_MOD], conf[D_UNI], conf[D_PRO], conf[D_DLY], pf_scratch, PI_PF, verbose, pf->name)) { - if (!pf_probe(pf) && pf->disk) { + if (pf->disk && !pf_probe(pf)) { pf->present = 1; k++; } else diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index 79b86825403..13f998aa1cd 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c @@ -156,7 +156,6 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY}; #include <linux/module.h> #include <linux/init.h> #include <linux/fs.h> -#include <linux/devfs_fs_kernel.h> #include <linux/delay.h> #include <linux/slab.h> #include <linux/mtio.h> @@ -674,25 +673,15 @@ static int __init pg_init(void) err = PTR_ERR(pg_class); goto out_chrdev; } - devfs_mk_dir("pg"); for (unit = 0; unit < PG_UNITS; unit++) { struct pg *dev = &devices[unit]; - if (dev->present) { + if (dev->present) class_device_create(pg_class, NULL, MKDEV(major, unit), NULL, "pg%u", unit); - err = devfs_mk_cdev(MKDEV(major, unit), - S_IFCHR | S_IRUSR | S_IWUSR, "pg/%u", - unit); - if (err) - goto out_class; - } } err = 0; goto out; -out_class: - class_device_destroy(pg_class, MKDEV(major, unit)); - class_destroy(pg_class); out_chrdev: unregister_chrdev(major, "pg"); out: @@ -705,13 +694,10 @@ static void __exit pg_exit(void) for (unit = 0; unit < PG_UNITS; unit++) { struct pg *dev = &devices[unit]; - if (dev->present) { + if (dev->present) class_device_destroy(pg_class, MKDEV(major, unit)); - devfs_remove("pg/%u", unit); - } } class_destroy(pg_class); - devfs_remove("pg"); unregister_chrdev(major, name); for (unit = 0; unit < PG_UNITS; unit++) { diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index d2013d36240..35fb2663672 100644 --- a/drivers/block/paride/pt.c +++ b/drivers/block/paride/pt.c @@ -141,7 +141,6 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3}; #include <linux/module.h> #include <linux/init.h> #include <linux/fs.h> -#include <linux/devfs_fs_kernel.h> #include <linux/delay.h> #include <linux/slab.h> #include <linux/mtio.h> @@ -971,32 +970,15 @@ static int __init pt_init(void) goto out_chrdev; } - devfs_mk_dir("pt"); for (unit = 0; unit < PT_UNITS; unit++) if (pt[unit].present) { class_device_create(pt_class, NULL, MKDEV(major, unit), NULL, "pt%d", unit); - err = devfs_mk_cdev(MKDEV(major, unit), - S_IFCHR | S_IRUSR | S_IWUSR, - "pt/%d", unit); - if (err) { - class_device_destroy(pt_class, MKDEV(major, unit)); - goto out_class; - } class_device_create(pt_class, NULL, MKDEV(major, unit + 128), NULL, "pt%dn", unit); - err = devfs_mk_cdev(MKDEV(major, unit + 128), - S_IFCHR | S_IRUSR | S_IWUSR, - "pt/%dn", unit); - if (err) { - class_device_destroy(pt_class, MKDEV(major, unit + 128)); - goto out_class; - } } goto out; -out_class: - class_destroy(pt_class); out_chrdev: unregister_chrdev(major, "pt"); out: @@ -1009,12 +991,9 @@ static void __exit pt_exit(void) for (unit = 0; unit < PT_UNITS; unit++) if (pt[unit].present) { class_device_destroy(pt_class, MKDEV(major, unit)); - devfs_remove("pt/%d", unit); class_device_destroy(pt_class, MKDEV(major, unit + 128)); - devfs_remove("pt/%dn", unit); } class_destroy(pt_class); - devfs_remove("pt"); unregister_chrdev(major, name); for (unit = 0; unit < PT_UNITS; unit++) if (pt[unit].present) diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index a04f60693c3..bde2c64b634 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -44,7 +44,6 @@ *************************************************************************/ #include <linux/pktcdvd.h> -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> @@ -2612,7 +2611,6 @@ static struct file_operations pkt_ctl_fops = { static struct miscdevice pkt_misc = { .minor = MISC_DYNAMIC_MINOR, .name = "pktcdvd", - .devfs_name = "pktcdvd/control", .fops = &pkt_ctl_fops }; diff --git a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c index bea75f2cb21..5537974fb24 100644 --- a/drivers/block/ps2esdi.c +++ b/drivers/block/ps2esdi.c @@ -29,7 +29,6 @@ #define DEVICE_NAME "PS/2 ESDI" -#include <linux/config.h> #include <linux/major.h> #include <linux/errno.h> #include <linux/wait.h> @@ -341,9 +340,9 @@ static int __init ps2esdi_geninit(void) /* try to grab IRQ, and try to grab a slow IRQ if it fails, so we can share with the SCSI driver */ if (request_irq(PS2ESDI_IRQ, ps2esdi_interrupt_handler, - SA_INTERRUPT | SA_SHIRQ, "PS/2 ESDI", &ps2esdi_gendisk) + IRQF_DISABLED | IRQF_SHARED, "PS/2 ESDI", &ps2esdi_gendisk) && request_irq(PS2ESDI_IRQ, ps2esdi_interrupt_handler, - SA_SHIRQ, "PS/2 ESDI", &ps2esdi_gendisk) + IRQF_SHARED, "PS/2 ESDI", &ps2esdi_gendisk) ) { printk("%s: Unable to get IRQ %d\n", DEVICE_NAME, PS2ESDI_IRQ); error = -EBUSY; @@ -421,7 +420,6 @@ static int __init ps2esdi_geninit(void) disk->major = PS2ESDI_MAJOR; disk->first_minor = i<<6; sprintf(disk->disk_name, "ed%c", 'a'+i); - sprintf(disk->devfs_name, "ed/target%d", i); disk->fops = &ps2esdi_fops; ps2esdi_gendisk[i] = disk; } diff --git a/drivers/block/rd.c b/drivers/block/rd.c index 0378da04cfa..3cf246abb5e 100644 --- a/drivers/block/rd.c +++ b/drivers/block/rd.c @@ -42,7 +42,6 @@ * and set blk_size for -ENOSPC, Werner Fink <werner@suse.de>, Apr '99 */ -#include <linux/config.h> #include <linux/string.h> #include <linux/slab.h> #include <asm/atomic.h> @@ -50,7 +49,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> -#include <linux/devfs_fs_kernel.h> #include <linux/pagemap.h> #include <linux/blkdev.h> #include <linux/genhd.h> @@ -412,7 +410,6 @@ static void __exit rd_cleanup(void) put_disk(rd_disks[i]); blk_cleanup_queue(rd_queue[i]); } - devfs_remove("rd"); unregister_blkdev(RAMDISK_MAJOR, "ramdisk"); } @@ -442,8 +439,6 @@ static int __init rd_init(void) goto out; } - devfs_mk_dir("rd"); - for (i = 0; i < CONFIG_BLK_DEV_RAM_COUNT; i++) { struct gendisk *disk = rd_disks[i]; @@ -461,7 +456,6 @@ static int __init rd_init(void) disk->queue = rd_queue[i]; disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; sprintf(disk->disk_name, "ram%d", i); - sprintf(disk->devfs_name, "rd/%d", i); set_capacity(disk, rd_size * 2); add_disk(rd_disks[i]); } diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index 01f042f6f1c..3721e12135d 100644 --- a/drivers/block/swim3.c +++ b/drivers/block/swim3.c @@ -16,7 +16,6 @@ * handle GCR disks */ -#include <linux/config.h> #include <linux/stddef.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -25,7 +24,6 @@ #include <linux/fd.h> #include <linux/ioctl.h> #include <linux/blkdev.h> -#include <linux/devfs_fs_kernel.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/spinlock.h> @@ -1019,8 +1017,6 @@ int swim3_init(void) int err = -ENOMEM; int i; - devfs_mk_dir("floppy"); - swim = find_devices("floppy"); while (swim && (floppy_count < MAX_FLOPPIES)) { @@ -1064,7 +1060,6 @@ int swim3_init(void) disk->queue = swim3_queue; disk->flags |= GENHD_FL_REMOVABLE; sprintf(disk->disk_name, "fd%d", i); - sprintf(disk->devfs_name, "floppy/%d", i); set_capacity(disk, 2880); add_disk(disk); } diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c index 2ae08b343b9..c6beee18a07 100644 --- a/drivers/block/sx8.c +++ b/drivers/block/sx8.c @@ -18,7 +18,6 @@ #include <linux/spinlock.h> #include <linux/blkdev.h> #include <linux/sched.h> -#include <linux/devfs_fs_kernel.h> #include <linux/interrupt.h> #include <linux/compiler.h> #include <linux/workqueue.h> @@ -1510,7 +1509,6 @@ static int carm_init_disks(struct carm_host *host) port->disk = disk; sprintf(disk->disk_name, DRV_NAME "/%u", (unsigned int) (host->id * CARM_MAX_PORTS) + i); - sprintf(disk->devfs_name, DRV_NAME "/%u_%u", host->id, i); disk->major = host->major; disk->first_minor = i * CARM_MINORS_PER_MAJOR; disk->fops = &carm_bd_ops; @@ -1672,15 +1670,13 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) if (host->flags & FL_DYN_MAJOR) host->major = rc; - devfs_mk_dir(DRV_NAME); - rc = carm_init_disks(host); if (rc) goto err_out_blkdev_disks; pci_set_master(pdev); - rc = request_irq(pdev->irq, carm_interrupt, SA_SHIRQ, DRV_NAME, host); + rc = request_irq(pdev->irq, carm_interrupt, IRQF_SHARED, DRV_NAME, host); if (rc) { printk(KERN_ERR DRV_NAME "(%s): irq alloc failure\n", pci_name(pdev)); @@ -1694,9 +1690,10 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) DPRINTK("waiting for probe_comp\n"); wait_for_completion(&host->probe_comp); - printk(KERN_INFO "%s: pci %s, ports %d, io %lx, irq %u, major %d\n", + printk(KERN_INFO "%s: pci %s, ports %d, io %llx, irq %u, major %d\n", host->name, pci_name(pdev), (int) CARM_MAX_PORTS, - pci_resource_start(pdev, 0), pdev->irq, host->major); + (unsigned long long)pci_resource_start(pdev, 0), + pdev->irq, host->major); carm_host_id++; pci_set_drvdata(pdev, host); @@ -1738,7 +1735,6 @@ static void carm_remove_one (struct pci_dev *pdev) free_irq(pdev->irq, host); carm_free_disks(host); - devfs_remove(DRV_NAME); unregister_blkdev(host->major, host->name); if (host->major == 160) clear_bit(0, &carm_major_alloc); diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 60e9a9457c6..d62b49fbf10 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c @@ -24,12 +24,10 @@ #include <linux/usb.h> #include <linux/usb_usual.h> #include <linux/blkdev.h> -#include <linux/devfs_fs_kernel.h> #include <linux/timer.h> #include <scsi/scsi.h> #define DRV_NAME "ub" -#define DEVFS_NAME DRV_NAME #define UB_MAJOR 180 @@ -2291,7 +2289,6 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum) goto err_diskalloc; sprintf(disk->disk_name, DRV_NAME "%c", lun->id + 'a'); - sprintf(disk->devfs_name, DEVFS_NAME "/%c", lun->id + 'a'); disk->major = UB_MAJOR; disk->first_minor = lun->id * UB_PARTS_PER_LUN; disk->fops = &ub_bd_fops; @@ -2445,7 +2442,6 @@ static int __init ub_init(void) if ((rc = register_blkdev(UB_MAJOR, DRV_NAME)) != 0) goto err_regblkdev; - devfs_mk_dir(DEVFS_NAME); if ((rc = usb_register(&ub_driver)) != 0) goto err_register; @@ -2454,7 +2450,6 @@ static int __init ub_init(void) return 0; err_register: - devfs_remove(DEVFS_NAME); unregister_blkdev(UB_MAJOR, DRV_NAME); err_regblkdev: return rc; @@ -2464,7 +2459,6 @@ static void __exit ub_exit(void) { usb_deregister(&ub_driver); - devfs_remove(DEVFS_NAME); unregister_blkdev(UB_MAJOR, DRV_NAME); usb_usual_clear_present(USB_US_TYPE_UB); } diff --git a/drivers/block/umem.c b/drivers/block/umem.c index f7d4c65a7b8..5d8925bd904 100644 --- a/drivers/block/umem.c +++ b/drivers/block/umem.c @@ -35,7 +35,6 @@ */ //#define DEBUG /* uncomment if you want debugging info (pr_debug) */ -#include <linux/config.h> #include <linux/sched.h> #include <linux/fs.h> #include <linux/bio.h> @@ -1041,7 +1040,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i card->win_size = data; - if (request_irq(dev->irq, mm_interrupt, SA_SHIRQ, "pci-umem", card)) { + if (request_irq(dev->irq, mm_interrupt, IRQF_SHARED, "pci-umem", card)) { printk(KERN_ERR "MM%d: Unable to allocate IRQ\n", card->card_number); ret = -ENODEV; @@ -1192,7 +1191,6 @@ static int __init mm_init(void) for (i = 0; i < num_cards; i++) { struct gendisk *disk = mm_gendisk[i]; sprintf(disk->disk_name, "umem%c", 'a'+i); - sprintf(disk->devfs_name, "umem/card%d", i); spin_lock_init(&cards[i].lock); disk->major = major_nr; disk->first_minor = i << MM_SHIFT; diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index b0df4f5ab97..ec5a1b90a0a 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c @@ -59,7 +59,6 @@ MODULE_LICENSE("GPL"); * numbers 0-255 we get a maximum of 32 disks. */ #define VIOD_GENHD_NAME "iseries/vd" -#define VIOD_GENHD_DEVFS_NAME "iseries/disc" #define VIOD_VERS "1.64" @@ -523,8 +522,6 @@ retry: else snprintf(g->disk_name, sizeof(g->disk_name), VIOD_GENHD_NAME "%c", 'a' + (dev_no % 26)); - snprintf(g->devfs_name, sizeof(g->devfs_name), - "%s%d", VIOD_GENHD_DEVFS_NAME, dev_no); g->fops = &viodasd_fops; g->queue = q; g->private_data = d; diff --git a/drivers/block/xd.c b/drivers/block/xd.c index cbce7c5e944..e828e4cbd3e 100644 --- a/drivers/block/xd.c +++ b/drivers/block/xd.c @@ -215,7 +215,6 @@ static int __init xd_init(void) disk->major = XT_DISK_MAJOR; disk->first_minor = i<<6; sprintf(disk->disk_name, "xd%c", i+'a'); - sprintf(disk->devfs_name, "xd/target%d", i); disk->fops = &xd_fops; disk->private_data = p; disk->queue = xd_queue; diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c index bb5e8d665a2..82ddbdd7bd4 100644 --- a/drivers/block/z2ram.c +++ b/drivers/block/z2ram.c @@ -354,7 +354,6 @@ z2_init(void) z2ram_gendisk->first_minor = 0; z2ram_gendisk->fops = &z2_fops; sprintf(z2ram_gendisk->disk_name, "z2ram"); - strcpy(z2ram_gendisk->devfs_name, z2ram_gendisk->disk_name); z2ram_gendisk->queue = z2_queue; add_disk(z2ram_gendisk); diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c index 3e7a067cc08..6f67141f4de 100644 --- a/drivers/bluetooth/bcm203x.c +++ b/drivers/bluetooth/bcm203x.c @@ -22,7 +22,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index 8947c8837da..23f96213f4a 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c @@ -21,7 +21,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index 473a13b22b2..2830f58d6f7 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c @@ -20,7 +20,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index 9446960ac74..e0231dc2cb1 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c @@ -21,7 +21,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index b94ac2f9f7b..c9dba5565ca 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -21,7 +21,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 9ce4c93467e..c889bf8109a 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c @@ -20,7 +20,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index ed8dca84ff6..be6eed175aa 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c @@ -20,7 +20,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c index 7bd4ef90411..d0cface535f 100644 --- a/drivers/bluetooth/hci_bcsp.c +++ b/drivers/bluetooth/hci_bcsp.c @@ -22,7 +22,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c index 4804d474dc8..ad62abbbb73 100644 --- a/drivers/bluetooth/hci_h4.c +++ b/drivers/bluetooth/hci_h4.c @@ -23,7 +23,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 613673b12fa..1994270c16e 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -23,7 +23,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c index 92382e82328..a7d9d7e99e7 100644 --- a/drivers/bluetooth/hci_usb.c +++ b/drivers/bluetooth/hci_usb.c @@ -31,7 +31,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index 85738223ff0..ea589007fa2 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c @@ -23,7 +23,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/cdrom/aztcd.c b/drivers/cdrom/aztcd.c index ec004897b63..ec469497c10 100644 --- a/drivers/cdrom/aztcd.c +++ b/drivers/cdrom/aztcd.c @@ -1918,7 +1918,6 @@ static int __init aztcd_init(void) azt_disk->first_minor = 0; azt_disk->fops = &azt_fops; sprintf(azt_disk->disk_name, "aztcd"); - sprintf(azt_disk->devfs_name, "aztcd"); azt_disk->queue = azt_queue; add_disk(azt_disk); azt_invalidate_buffers(); diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 3170eaa2508..ca27ee89240 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -263,7 +263,6 @@ /* #define ERRLOGMASK (CD_WARNING|CD_OPEN|CD_COUNT_TRACKS|CD_CLOSE) */ /* #define ERRLOGMASK (CD_WARNING|CD_REG_UNREG|CD_DO_IOCTL|CD_OPEN|CD_CLOSE|CD_COUNT_TRACKS) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/buffer_head.h> diff --git a/drivers/cdrom/cdu31a.c b/drivers/cdrom/cdu31a.c index 72ffd64e8b1..37bdb0163f0 100644 --- a/drivers/cdrom/cdu31a.c +++ b/drivers/cdrom/cdu31a.c @@ -161,7 +161,6 @@ #include <linux/hdreg.h> #include <linux/genhd.h> #include <linux/ioport.h> -#include <linux/devfs_fs_kernel.h> #include <linux/string.h> #include <linux/slab.h> #include <linux/init.h> @@ -3142,7 +3141,7 @@ int __init cdu31a_init(void) if (cdu31a_irq > 0) { if (request_irq - (cdu31a_irq, cdu31a_interrupt, SA_INTERRUPT, + (cdu31a_irq, cdu31a_interrupt, IRQF_DISABLED, "cdu31a", NULL)) { printk(KERN_WARNING PFX "Unable to grab IRQ%d for " "the CDU31A driver\n", cdu31a_irq); diff --git a/drivers/cdrom/cm206.c b/drivers/cdrom/cm206.c index f43a988dd41..9b05ddd2314 100644 --- a/drivers/cdrom/cm206.c +++ b/drivers/cdrom/cm206.c @@ -187,7 +187,6 @@ History: #include <linux/interrupt.h> #include <linux/timer.h> #include <linux/cdrom.h> -#include <linux/devfs_fs_kernel.h> #include <linux/ioport.h> #include <linux/mm.h> #include <linux/slab.h> @@ -915,7 +914,7 @@ static void seek(int lba) cd->dsb = wait_dsb(); } -uch bcdbin(unsigned char bcd) +static uch bcdbin(unsigned char bcd) { /* stolen from mcd.c! */ return (bcd >> 4) * 10 + (bcd & 0xf); } @@ -1533,7 +1532,7 @@ static void __init parse_options(void) } } -static int __cm206_init(void) +static int __init __cm206_init(void) { parse_options(); #if !defined(AUTO_PROBE_MODULE) @@ -1594,8 +1593,3 @@ __setup("cm206=", cm206_setup); #endif /* !MODULE */ MODULE_ALIAS_BLOCKDEV_MAJOR(CM206_CDROM_MAJOR); -/* - * Local variables: - * compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -fno-strength-reduce -m486 -DMODULE -DMODVERSIONS -include /usr/src/linux/include/linux/modversions.h -c -o cm206.o cm206.c" - * End: - */ diff --git a/drivers/cdrom/gscd.c b/drivers/cdrom/gscd.c index ad5464ab99b..b6ee50a2916 100644 --- a/drivers/cdrom/gscd.c +++ b/drivers/cdrom/gscd.c @@ -955,7 +955,6 @@ static int __init gscd_init(void) gscd_disk->first_minor = 0; gscd_disk->fops = &gscd_fops; sprintf(gscd_disk->disk_name, "gscd"); - sprintf(gscd_disk->devfs_name, "gscd"); if (register_blkdev(MAJOR_NR, "gscd")) { ret = -EIO; diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c index 0f6e7aab8d2..dcd1ab684f3 100644 --- a/drivers/cdrom/mcdx.c +++ b/drivers/cdrom/mcdx.c @@ -74,7 +74,6 @@ static const char *mcdx_c_version #include <linux/major.h> #define MAJOR_NR MITSUMI_X_CDROM_MAJOR #include <linux/blkdev.h> -#include <linux/devfs_fs_kernel.h> #include "mcdx.h" @@ -1194,7 +1193,7 @@ static int __init mcdx_init_drive(int drive) } xtrace(INIT, "init() subscribe irq and i/o\n"); - if (request_irq(stuffp->irq, mcdx_intr, SA_INTERRUPT, "mcdx", stuffp)) { + if (request_irq(stuffp->irq, mcdx_intr, IRQF_DISABLED, "mcdx", stuffp)) { release_region(stuffp->wreg_data, MCDX_IO_SIZE); xwarn("%s=0x%03x,%d: Init failed. Can't get irq (%d).\n", MCDX, stuffp->wreg_data, stuffp->irq, stuffp->irq); diff --git a/drivers/cdrom/optcd.c b/drivers/cdrom/optcd.c index 0b0eab4f40f..25032d7edc5 100644 --- a/drivers/cdrom/optcd.c +++ b/drivers/cdrom/optcd.c @@ -2033,7 +2033,6 @@ static int __init optcd_init(void) optcd_disk->first_minor = 0; optcd_disk->fops = &opt_fops; sprintf(optcd_disk->disk_name, "optcd"); - sprintf(optcd_disk->devfs_name, "optcd"); if (!request_region(optcd_port, 4, "optcd")) { printk(KERN_ERR "optcd: conflict, I/O port 0x%x already used\n", diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c index 05c9e865eca..ba50e5a712f 100644 --- a/drivers/cdrom/sbpcd.c +++ b/drivers/cdrom/sbpcd.c @@ -371,7 +371,6 @@ #include <linux/kernel.h> #include <linux/cdrom.h> #include <linux/ioport.h> -#include <linux/devfs_fs_kernel.h> #include <linux/major.h> #include <linux/string.h> #include <linux/vmalloc.h> @@ -382,7 +381,6 @@ #include <asm/io.h> #include <asm/uaccess.h> #include <stdarg.h> -#include <linux/config.h> #include "sbpcd.h" #define MAJOR_NR MATSUSHITA_CDROM_MAJOR @@ -5808,8 +5806,6 @@ int __init sbpcd_init(void) return -ENOMEM; } - devfs_mk_dir("sbp"); - for (j=0;j<NR_SBPCD;j++) { struct cdrom_device_info * sbpcd_infop; @@ -5871,7 +5867,6 @@ int __init sbpcd_init(void) disk->fops = &sbpcd_bdops; strcpy(disk->disk_name, sbpcd_infop->name); disk->flags = GENHD_FL_CD; - sprintf(disk->devfs_name, "sbp/c0t%d", p->drv_id); p->disk = disk; if (register_cdrom(sbpcd_infop)) { @@ -5906,7 +5901,6 @@ static void sbpcd_exit(void) if (D_S[j].drv_id==-1) continue; del_gendisk(D_S[j].disk); put_disk(D_S[j].disk); - devfs_remove("sbp/c0t%d", j); vfree(D_S[j].sbp_buf); if (D_S[j].sbp_audsiz>0) vfree(D_S[j].aud_buf); @@ -5917,7 +5911,6 @@ static void sbpcd_exit(void) } vfree(D_S[j].sbpcd_infop); } - devfs_remove("sbp"); msg(DBG_INF, "%s module released.\n", major_name); } diff --git a/drivers/cdrom/sjcd.c b/drivers/cdrom/sjcd.c index 74b1cadbf16..bf5aef4e555 100644 --- a/drivers/cdrom/sjcd.c +++ b/drivers/cdrom/sjcd.c @@ -1695,7 +1695,6 @@ static int __init sjcd_init(void) sjcd_disk->first_minor = 0, sjcd_disk->fops = &sjcd_fops, sprintf(sjcd_disk->disk_name, "sjcd"); - sprintf(sjcd_disk->devfs_name, "sjcd"); if (!request_region(sjcd_base, 4,"sjcd")) { printk diff --git a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c index e6565992643..30ab56258a9 100644 --- a/drivers/cdrom/sonycd535.c +++ b/drivers/cdrom/sonycd535.c @@ -1527,7 +1527,7 @@ static int __init sony535_init(void) } if (sony535_irq_used > 0) { if (request_irq(sony535_irq_used, cdu535_interrupt, - SA_INTERRUPT, CDU535_HANDLE, NULL)) { + IRQF_DISABLED, CDU535_HANDLE, NULL)) { printk("Unable to grab IRQ%d for the " CDU535_MESSAGE_NAME " driver; polling instead.\n", sony535_irq_used); sony535_irq_used = 0; @@ -1589,7 +1589,6 @@ static int __init sony535_init(void) cdu_disk->first_minor = 0; cdu_disk->fops = &cdu_fops; sprintf(cdu_disk->disk_name, "cdu"); - sprintf(cdu_disk->devfs_name, "cdu535"); if (!request_region(sony535_cd_base_io, 4, CDU535_HANDLE)) { printk(KERN_WARNING"sonycd535: Unable to request region 0x%x\n", diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index af6b3bfd169..54ca931e19e 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c @@ -49,7 +49,6 @@ #include <asm/iseries/vio.h> #define VIOCD_DEVICE "iseries/vcd" -#define VIOCD_DEVICE_DEVFS "iseries/vcd" #define VIOCD_VERS "1.06" @@ -688,8 +687,6 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id) gendisk->first_minor = deviceno; strncpy(gendisk->disk_name, c->name, sizeof(gendisk->disk_name)); - snprintf(gendisk->devfs_name, sizeof(gendisk->devfs_name), - VIOCD_DEVICE_DEVFS "%d", deviceno); blk_queue_max_hw_segments(q, 1); blk_queue_max_phys_segments(q, 1); blk_queue_max_sectors(q, 4096 / 512); diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 410d70cb76f..c40e487d9f5 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -961,6 +961,7 @@ config PC8736x_GPIO config NSC_GPIO tristate "NatSemi Base GPIO Support" + depends on X86_32 # selected by SCx200_GPIO and PC8736x_GPIO # what about 2 selectors differing: m != y help diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig index 9826a399fa0..22f8cf218cc 100644 --- a/drivers/char/agp/Kconfig +++ b/drivers/char/agp/Kconfig @@ -1,6 +1,7 @@ config AGP tristate "/dev/agpgart (AGP Support)" depends on ALPHA || IA64 || PPC || X86 + depends on PCI ---help--- AGP (Accelerated Graphics Port) is a bus system mainly used to connect graphics cards to the rest of the system. diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index f690ee8cb73..8cd52984cda 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c @@ -8,7 +8,6 @@ * work is done in the northbridge(s). */ -#include <linux/config.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/init.h> @@ -734,7 +733,7 @@ int __init agp_amd64_init(void) if (agp_off) return -EINVAL; - if (pci_register_driver(&agp_amd64_pci_driver) > 0) { + if (pci_register_driver(&agp_amd64_pci_driver) < 0) { struct pci_dev *dev; if (!agp_try_unsupported && !agp_try_unsupported_boot) { printk(KERN_INFO PFX "No supported AGP bridge found.\n"); diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c index 16056434599..f244c668273 100644 --- a/drivers/char/agp/ati-agp.c +++ b/drivers/char/agp/ati-agp.c @@ -41,7 +41,6 @@ static struct gatt_mask ati_generic_masks[] = }; - typedef struct _ati_page_map { unsigned long *real; unsigned long __iomem *remapped; @@ -141,7 +140,8 @@ static int ati_create_gatt_pages(int nr_tables) ati_generic_private.num_tables = nr_tables; ati_generic_private.gatt_pages = tables; - if (retval != 0) ati_free_gatt_pages(); + if (retval != 0) + ati_free_gatt_pages(); return retval; } @@ -219,16 +219,16 @@ static int ati_configure(void) ati_generic_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); if (is_r200()) - pci_write_config_dword(agp_bridge->dev, ATI_RS100_IG_AGPMODE, 0x20000); + pci_write_config_dword(agp_bridge->dev, ATI_RS100_IG_AGPMODE, 0x20000); else pci_write_config_dword(agp_bridge->dev, ATI_RS300_IG_AGPMODE, 0x20000); /* address to map too */ - /* + /* pci_read_config_dword(agp_bridge.dev, AGP_APBASE, &temp); agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); printk(KERN_INFO PFX "IGP320 gart_bus_addr: %x\n", agp_bridge.gart_bus_addr); - */ + */ writel(0x60000, ati_generic_private.registers+ATI_GART_FEATURE_ID); readl(ati_generic_private.registers+ATI_GART_FEATURE_ID); /* PCI Posting.*/ @@ -245,18 +245,20 @@ static int ati_configure(void) #ifdef CONFIG_PM -static int agp_ati_resume(struct pci_dev *dev) +static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state) { - pci_restore_state(dev); + pci_save_state(dev); + pci_set_power_state(dev, 3); - return ati_configure(); + return 0; } -static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state) +static int agp_ati_resume(struct pci_dev *dev) { - pci_save_state(dev); + pci_set_power_state(dev, 0); + pci_restore_state(dev); - return 0; + return ati_configure(); } #endif @@ -321,9 +323,9 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start, unsigned long __iomem *cur_gatt; unsigned long addr; - if (type != 0 || mem->type != 0) { + if (type != 0 || mem->type != 0) return -EINVAL; - } + for (i = pg_start; i < (mem->page_count + pg_start); i++) { addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr; cur_gatt = GET_GATT(addr); @@ -502,9 +504,8 @@ found: bridge->dev = pdev; bridge->capndx = cap_ptr; - - bridge->driver = &ati_generic_bridge; + bridge->driver = &ati_generic_bridge; printk(KERN_INFO PFX "Detected Ati %s chipset\n", devs[j].chipset_name); @@ -546,8 +547,8 @@ static struct pci_driver agp_ati_pci_driver = { .probe = agp_ati_probe, .remove = agp_ati_remove, #ifdef CONFIG_PM - .resume = agp_ati_resume, .suspend = agp_ati_suspend, + .resume = agp_ati_resume, #endif }; diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index a92ab53a137..cc5ea347a8a 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c @@ -27,7 +27,6 @@ * TODO: * - Allocate more than order 0 pages to avoid too much linear map splitting. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/init.h> diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c index 4c67135c12d..df7f37b2739 100644 --- a/drivers/char/agp/nvidia-agp.c +++ b/drivers/char/agp/nvidia-agp.c @@ -376,6 +376,29 @@ static void __devexit agp_nvidia_remove(struct pci_dev *pdev) agp_put_bridge(bridge); } +#ifdef CONFIG_PM +static int agp_nvidia_suspend(struct pci_dev *pdev, pm_message_t state) +{ + pci_save_state (pdev); + pci_set_power_state (pdev, 3); + + return 0; +} + +static int agp_nvidia_resume(struct pci_dev *pdev) +{ + /* set power state 0 and restore PCI space */ + pci_set_power_state (pdev, 0); + pci_restore_state(pdev); + + /* reconfigure AGP hardware again */ + nvidia_configure(); + + return 0; +} +#endif + + static struct pci_device_id agp_nvidia_pci_table[] = { { .class = (PCI_CLASS_BRIDGE_HOST << 8), @@ -403,6 +426,10 @@ static struct pci_driver agp_nvidia_pci_driver = { .id_table = agp_nvidia_pci_table, .probe = agp_nvidia_probe, .remove = agp_nvidia_remove, +#ifdef CONFIG_PM + .suspend = agp_nvidia_suspend, + .resume = agp_nvidia_resume, +#endif }; static int __init agp_nvidia_init(void) diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index 6602b3156df..9d6713a93ed 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c @@ -31,7 +31,6 @@ * ever possible. */ -#include <linux/config.h> #include <linux/delay.h> #undef SERIAL_PARANOIA_CHECK @@ -2052,7 +2051,7 @@ static int __init rs_init(void) /* set ISRs, and then disable the rx interrupts */ request_irq(IRQ_AMIGA_TBE, ser_tx_int, 0, "serial TX", state); - request_irq(IRQ_AMIGA_RBF, ser_rx_int, SA_INTERRUPT, "serial RX", state); + request_irq(IRQ_AMIGA_RBF, ser_rx_int, IRQF_DISABLED, "serial RX", state); /* turn off Rx and Tx interrupts */ custom.intena = IF_RBF | IF_TBE; diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c index 9275d5e52e6..bcc4668835b 100644 --- a/drivers/char/applicom.c +++ b/drivers/char/applicom.c @@ -209,13 +209,16 @@ static int __init applicom_init(void) RamIO = ioremap(dev->resource[0].start, LEN_RAM_IO); if (!RamIO) { - printk(KERN_INFO "ac.o: Failed to ioremap PCI memory space at 0x%lx\n", dev->resource[0].start); + printk(KERN_INFO "ac.o: Failed to ioremap PCI memory " + "space at 0x%llx\n", + (unsigned long long)dev->resource[0].start); pci_disable_device(dev); return -EIO; } - printk(KERN_INFO "Applicom %s found at mem 0x%lx, irq %d\n", - applicom_pci_devnames[dev->device-1], dev->resource[0].start, + printk(KERN_INFO "Applicom %s found at mem 0x%llx, irq %d\n", + applicom_pci_devnames[dev->device-1], + (unsigned long long)dev->resource[0].start, dev->irq); boardno = ac_register_board(dev->resource[0].start, RamIO,0); @@ -226,7 +229,7 @@ static int __init applicom_init(void) continue; } - if (request_irq(dev->irq, &ac_interrupt, SA_SHIRQ, "Applicom PCI", &dummy)) { + if (request_irq(dev->irq, &ac_interrupt, IRQF_SHARED, "Applicom PCI", &dummy)) { printk(KERN_INFO "Could not allocate IRQ %d for PCI Applicom device.\n", dev->irq); iounmap(RamIO); pci_disable_device(dev); @@ -273,7 +276,7 @@ static int __init applicom_init(void) printk(KERN_NOTICE "Applicom ISA card found at mem 0x%lx, irq %d\n", mem + (LEN_RAM_IO*i), irq); if (!numisa) { - if (request_irq(irq, &ac_interrupt, SA_SHIRQ, "Applicom ISA", &dummy)) { + if (request_irq(irq, &ac_interrupt, IRQF_SHARED, "Applicom ISA", &dummy)) { printk(KERN_WARNING "Could not allocate IRQ %d for ISA Applicom device.\n", irq); iounmap(RamIO); apbs[boardno - 1].RamIO = NULL; diff --git a/drivers/char/consolemap.c b/drivers/char/consolemap.c index c85a4fa60da..04a12027a74 100644 --- a/drivers/char/consolemap.c +++ b/drivers/char/consolemap.c @@ -11,7 +11,6 @@ * Fix bug in inverse translation. Stanislav Voronyi <stas@cnti.uanet.kharkov.ua>, Dec 1998 */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kd.h> #include <linux/errno.h> diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 122e7a72a4e..c1c67281750 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c @@ -633,7 +633,6 @@ static char rcsid[] = /* * Include section */ -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/signal.h> @@ -4613,7 +4612,7 @@ cy_detect_isa(void) /* allocate IRQ */ if(request_irq(cy_isa_irq, cyy_interrupt, - SA_INTERRUPT, "Cyclom-Y", &cy_card[j])) + IRQF_DISABLED, "Cyclom-Y", &cy_card[j])) { printk("Cyclom-Y/ISA found at 0x%lx ", (unsigned long) cy_isa_address); @@ -4786,7 +4785,7 @@ cy_detect_pci(void) /* allocate IRQ */ if(request_irq(cy_pci_irq, cyy_interrupt, - SA_SHIRQ, "Cyclom-Y", &cy_card[j])) + IRQF_SHARED, "Cyclom-Y", &cy_card[j])) { printk("Cyclom-Y/PCI found at 0x%lx ", (ulong) cy_pci_phys2); @@ -4966,7 +4965,7 @@ cy_detect_pci(void) /* allocate IRQ only if board has an IRQ */ if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) { if(request_irq(cy_pci_irq, cyz_interrupt, - SA_SHIRQ, "Cyclades-Z", &cy_card[j])) + IRQF_SHARED, "Cyclades-Z", &cy_card[j])) { printk("Cyclom-8Zo/PCI found at 0x%lx ", (ulong) cy_pci_phys2); @@ -5060,7 +5059,7 @@ cy_detect_pci(void) /* allocate IRQ only if board has an IRQ */ if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) { if(request_irq(cy_pci_irq, cyz_interrupt, - SA_SHIRQ, "Cyclades-Z", &cy_card[j])) + IRQF_SHARED, "Cyclades-Z", &cy_card[j])) { printk("Cyclom-Ze/PCI found at 0x%lx ", (ulong) cy_pci_phys2); @@ -5250,7 +5249,6 @@ cy_init(void) cy_serial_driver->owner = THIS_MODULE; cy_serial_driver->driver_name = "cyclades"; cy_serial_driver->name = "ttyC"; - cy_serial_driver->devfs_name = "tts/C"; cy_serial_driver->major = CYCLADES_MAJOR; cy_serial_driver->minor_start = 0; cy_serial_driver->type = TTY_DRIVER_TYPE_SERIAL; diff --git a/drivers/char/decserial.c b/drivers/char/decserial.c index aa1440934e9..85f404e25c7 100644 --- a/drivers/char/decserial.c +++ b/drivers/char/decserial.c @@ -16,7 +16,6 @@ * console device I strongly recommend to use only one. */ -#include <linux/config.h> #include <linux/init.h> #include <asm/dec/machtype.h> diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h index 9da0ddb892b..5642ac43e0f 100644 --- a/drivers/char/drm/drm.h +++ b/drivers/char/drm/drm.h @@ -38,7 +38,6 @@ #if defined(__linux__) #if defined(__KERNEL__) -#include <linux/config.h> #endif #include <asm/ioctl.h> /* For _IO* macros */ #define DRM_IOCTL_NR(n) _IOC_NR(n) diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index cb76e5ca9a2..d2a56182bc3 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h @@ -44,7 +44,6 @@ * can build the DRM (part of PI DRI). 4/21/2000 S + B */ #include <asm/current.h> #endif /* __alpha__ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/miscdevice.h> diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c index 611a1173091..ebdb7182c4f 100644 --- a/drivers/char/drm/drm_irq.c +++ b/drivers/char/drm/drm_irq.c @@ -130,7 +130,7 @@ static int drm_irq_install(drm_device_t * dev) /* Install handler */ if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED)) - sh_flags = SA_SHIRQ; + sh_flags = IRQF_SHARED; ret = request_irq(dev->irq, dev->driver->irq_handler, sh_flags, dev->devname, dev); diff --git a/drivers/char/drm/drm_memory.c b/drivers/char/drm/drm_memory.c index 7e3318e1d1c..5681cae1d40 100644 --- a/drivers/char/drm/drm_memory.c +++ b/drivers/char/drm/drm_memory.c @@ -33,7 +33,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include <linux/config.h> #include <linux/highmem.h> #include "drmP.h" diff --git a/drivers/char/drm/drm_memory.h b/drivers/char/drm/drm_memory.h index 714d9aedcff..f1b97aff10c 100644 --- a/drivers/char/drm/drm_memory.h +++ b/drivers/char/drm/drm_memory.h @@ -33,7 +33,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include <linux/config.h> #include <linux/highmem.h> #include <linux/vmalloc.h> #include "drmP.h" diff --git a/drivers/char/drm/drm_memory_debug.h b/drivers/char/drm/drm_memory_debug.h index d117cc99719..74581af806e 100644 --- a/drivers/char/drm/drm_memory_debug.h +++ b/drivers/char/drm/drm_memory_debug.h @@ -31,7 +31,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include <linux/config.h> #include "drmP.h" typedef struct drm_mem_stats { diff --git a/drivers/char/drm/drm_scatter.c b/drivers/char/drm/drm_scatter.c index ce81bf24820..06ef7ddbe67 100644 --- a/drivers/char/drm/drm_scatter.c +++ b/drivers/char/drm/drm_scatter.c @@ -31,7 +31,6 @@ * DEALINGS IN THE SOFTWARE. */ -#include <linux/config.h> #include <linux/vmalloc.h> #include "drmP.h" diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c index 0b9f98a7eb1..51ad98c685c 100644 --- a/drivers/char/drm/drm_sysfs.c +++ b/drivers/char/drm/drm_sysfs.c @@ -12,7 +12,6 @@ * */ -#include <linux/config.h> #include <linux/device.h> #include <linux/kdev_t.h> #include <linux/err.h> diff --git a/drivers/char/drm/ffb_drv.c b/drivers/char/drm/ffb_drv.c index c13f9abb41e..dd45111a485 100644 --- a/drivers/char/drm/ffb_drv.c +++ b/drivers/char/drm/ffb_drv.c @@ -4,7 +4,6 @@ * Copyright (C) 2000 David S. Miller (davem@redhat.com) */ -#include <linux/config.h> #include "ffb.h" #include "drmP.h" diff --git a/drivers/char/drm/i810_drv.c b/drivers/char/drm/i810_drv.c index dfe6ad2b6a6..fabb9a81796 100644 --- a/drivers/char/drm/i810_drv.c +++ b/drivers/char/drm/i810_drv.c @@ -30,7 +30,6 @@ * Gareth Hughes <gareth@valinux.com> */ -#include <linux/config.h> #include "drmP.h" #include "drm.h" #include "i810_drm.h" diff --git a/drivers/char/drm/i830_drv.c b/drivers/char/drm/i830_drv.c index 722658188f5..389597e4a62 100644 --- a/drivers/char/drm/i830_drv.c +++ b/drivers/char/drm/i830_drv.c @@ -32,7 +32,6 @@ * Keith Whitwell <keith@tungstengraphics.com> */ -#include <linux/config.h> #include "drmP.h" #include "drm.h" #include "i830_drm.h" diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c index 9f7ed0e0351..e30f556b79f 100644 --- a/drivers/char/drm/mga_drv.c +++ b/drivers/char/drm/mga_drv.c @@ -29,7 +29,6 @@ * Gareth Hughes <gareth@valinux.com> */ -#include <linux/config.h> #include "drmP.h" #include "drm.h" #include "mga_drm.h" diff --git a/drivers/char/drm/r128_drv.c b/drivers/char/drm/r128_drv.c index e20450ae220..6108e7587e1 100644 --- a/drivers/char/drm/r128_drv.c +++ b/drivers/char/drm/r128_drv.c @@ -29,7 +29,6 @@ * Gareth Hughes <gareth@valinux.com> */ -#include <linux/config.h> #include "drmP.h" #include "drm.h" #include "r128_drm.h" diff --git a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c index b04ed1b562b..eb985c2a31e 100644 --- a/drivers/char/drm/radeon_drv.c +++ b/drivers/char/drm/radeon_drv.c @@ -29,7 +29,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include <linux/config.h> #include "drmP.h" #include "drm.h" #include "radeon_drm.h" diff --git a/drivers/char/drm/savage_drv.c b/drivers/char/drm/savage_drv.c index aa6c0d1a82f..eee52aa92a7 100644 --- a/drivers/char/drm/savage_drv.c +++ b/drivers/char/drm/savage_drv.c @@ -23,7 +23,6 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include <linux/config.h> #include "drmP.h" #include "savage_drm.h" #include "savage_drv.h" diff --git a/drivers/char/drm/sis_drv.c b/drivers/char/drm/sis_drv.c index 6f6d7d613ed..5e9dc86f295 100644 --- a/drivers/char/drm/sis_drv.c +++ b/drivers/char/drm/sis_drv.c @@ -25,7 +25,6 @@ * */ -#include <linux/config.h> #include "drmP.h" #include "sis_drm.h" #include "sis_drv.h" diff --git a/drivers/char/drm/tdfx_drv.c b/drivers/char/drm/tdfx_drv.c index baa4416032a..012ff2e356b 100644 --- a/drivers/char/drm/tdfx_drv.c +++ b/drivers/char/drm/tdfx_drv.c @@ -30,7 +30,6 @@ * Gareth Hughes <gareth@valinux.com> */ -#include <linux/config.h> #include "drmP.h" #include "tdfx_drv.h" diff --git a/drivers/char/drm/via_drv.c b/drivers/char/drm/via_drv.c index 3f012255d31..b3d364d793d 100644 --- a/drivers/char/drm/via_drv.c +++ b/drivers/char/drm/via_drv.c @@ -22,7 +22,6 @@ * DEALINGS IN THE SOFTWARE. */ -#include <linux/config.h> #include "drmP.h" #include "via_drm.h" #include "via_drv.h" diff --git a/drivers/char/ds1302.c b/drivers/char/ds1302.c index a75e8609be0..625e8b51700 100644 --- a/drivers/char/ds1302.c +++ b/drivers/char/ds1302.c @@ -12,7 +12,6 @@ *! *!***************************************************************************/ -#include <linux/config.h> #include <linux/fs.h> #include <linux/init.h> diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c index 62cda25724e..953e670dcd0 100644 --- a/drivers/char/ds1620.c +++ b/drivers/char/ds1620.c @@ -2,7 +2,6 @@ * linux/drivers/char/ds1620.c: Dallas Semiconductors DS1620 * thermometer driver (as used in the Rebel.com NetWinder) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/miscdevice.h> diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c index e233cf280bc..09b413618b5 100644 --- a/drivers/char/dsp56k.c +++ b/drivers/char/dsp56k.c @@ -33,7 +33,6 @@ #include <linux/fs.h> #include <linux/mm.h> #include <linux/init.h> -#include <linux/devfs_fs_kernel.h> #include <linux/smp_lock.h> #include <linux/device.h> @@ -518,17 +517,9 @@ static int __init dsp56k_init_driver(void) } class_device_create(dsp56k_class, NULL, MKDEV(DSP56K_MAJOR, 0), NULL, "dsp56k"); - err = devfs_mk_cdev(MKDEV(DSP56K_MAJOR, 0), - S_IFCHR | S_IRUSR | S_IWUSR, "dsp56k"); - if(err) - goto out_class; - printk(banner); goto out; -out_class: - class_device_destroy(dsp56k_class, MKDEV(DSP56K_MAJOR, 0)); - class_destroy(dsp56k_class); out_chrdev: unregister_chrdev(DSP56K_MAJOR, "dsp56k"); out: @@ -541,7 +532,6 @@ static void __exit dsp56k_cleanup_driver(void) class_device_destroy(dsp56k_class, MKDEV(DSP56K_MAJOR, 0)); class_destroy(dsp56k_class); unregister_chrdev(DSP56K_MAJOR, "dsp56k"); - devfs_remove("dsp56k"); } module_exit(dsp56k_cleanup_driver); diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c index 87dcaa237f0..da2c89f1b8b 100644 --- a/drivers/char/dtlk.c +++ b/drivers/char/dtlk.c @@ -62,7 +62,6 @@ #include <linux/init.h> /* for __init, module_{init,exit} */ #include <linux/poll.h> /* for POLLIN, etc. */ #include <linux/dtlk.h> /* local header file for DoubleTalk values */ -#include <linux/devfs_fs_kernel.h> #include <linux/smp_lock.h> #ifdef TRACING @@ -337,9 +336,6 @@ static int __init dtlk_init(void) if (dtlk_dev_probe() == 0) printk(", MAJOR %d\n", dtlk_major); - devfs_mk_cdev(MKDEV(dtlk_major, DTLK_MINOR), - S_IFCHR | S_IRUSR | S_IWUSR, "dtlk"); - init_timer(&dtlk_timer); dtlk_timer.function = dtlk_timer_tick; init_waitqueue_head(&dtlk_process_list); @@ -357,7 +353,6 @@ static void __exit dtlk_cleanup (void) dtlk_write_tts(DTLK_CLEAR); unregister_chrdev(dtlk_major, "dtlk"); - devfs_remove("dtlk"); release_region(dtlk_port_lpc, DTLK_IO_EXTENT); } diff --git a/drivers/char/ec3104_keyb.c b/drivers/char/ec3104_keyb.c index 4aed6696882..abac18b1871 100644 --- a/drivers/char/ec3104_keyb.c +++ b/drivers/char/ec3104_keyb.c @@ -26,7 +26,6 @@ * (prumpf@tux.org). */ -#include <linux/config.h> #include <linux/spinlock.h> #include <linux/sched.h> diff --git a/drivers/char/epca.c b/drivers/char/epca.c index dc0602ae850..86d290e9f30 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c @@ -30,7 +30,6 @@ /* See README.epca for change history --DAT*/ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> @@ -1232,7 +1231,6 @@ static int __init pc_init(void) pc_driver->owner = THIS_MODULE; pc_driver->name = "ttyD"; - pc_driver->devfs_name = "tts/D"; pc_driver->major = DIGI_MAJOR; pc_driver->minor_start = 0; pc_driver->type = TTY_DRIVER_TYPE_SERIAL; diff --git a/drivers/char/esp.c b/drivers/char/esp.c index 922174d527a..afcd83d9984 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c @@ -883,7 +883,7 @@ static int startup(struct esp_struct * info) * Allocate the IRQ */ - retval = request_irq(info->irq, rs_interrupt_single, SA_SHIRQ, + retval = request_irq(info->irq, rs_interrupt_single, IRQF_SHARED, "esp serial", info); if (retval) { @@ -2449,7 +2449,6 @@ static int __init espserial_init(void) esp_driver->owner = THIS_MODULE; esp_driver->name = "ttyP"; - esp_driver->devfs_name = "tts/P"; esp_driver->major = ESP_IN_MAJOR; esp_driver->minor_start = 0; esp_driver->type = TTY_DRIVER_TYPE_SERIAL; diff --git a/drivers/char/ftape/lowlevel/fdc-io.c b/drivers/char/ftape/lowlevel/fdc-io.c index 093fdf98b19..65c9d2ec60b 100644 --- a/drivers/char/ftape/lowlevel/fdc-io.c +++ b/drivers/char/ftape/lowlevel/fdc-io.c @@ -1268,7 +1268,7 @@ static int fdc_grab_irq_and_dma(void) /* Get fast interrupt handler. */ if (request_irq(fdc.irq, ftape_interrupt, - SA_INTERRUPT, "ft", ftape_id)) { + IRQF_DISABLED, "ft", ftape_id)) { TRACE_ABORT(-EIO, ft_t_bug, "Unable to grab IRQ%d for ftape driver", fdc.irq); diff --git a/drivers/char/ftape/lowlevel/ftape-calibr.c b/drivers/char/ftape/lowlevel/ftape-calibr.c index 956b2586e13..8e50bfd35a5 100644 --- a/drivers/char/ftape/lowlevel/ftape-calibr.c +++ b/drivers/char/ftape/lowlevel/ftape-calibr.c @@ -24,7 +24,6 @@ * functions. */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/jiffies.h> #include <asm/system.h> diff --git a/drivers/char/ftape/lowlevel/ftape-ctl.c b/drivers/char/ftape/lowlevel/ftape-ctl.c index 32e04391179..5d7c1ce92d5 100644 --- a/drivers/char/ftape/lowlevel/ftape-ctl.c +++ b/drivers/char/ftape/lowlevel/ftape-ctl.c @@ -25,7 +25,6 @@ * QIC-40/80/3010/3020 floppy-tape driver "ftape" for Linux. */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/mm.h> #include <linux/mman.h> diff --git a/drivers/char/ftape/lowlevel/ftape-init.c b/drivers/char/ftape/lowlevel/ftape-init.c index b54260d457c..4998132a81d 100644 --- a/drivers/char/ftape/lowlevel/ftape-init.c +++ b/drivers/char/ftape/lowlevel/ftape-init.c @@ -21,7 +21,6 @@ * for the QIC-40/80/3010/3020 floppy-tape driver for Linux. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/fs.h> diff --git a/drivers/char/ftape/lowlevel/ftape-proc.c b/drivers/char/ftape/lowlevel/ftape-proc.c index c66251e997e..e805b15e0a1 100644 --- a/drivers/char/ftape/lowlevel/ftape-proc.c +++ b/drivers/char/ftape/lowlevel/ftape-proc.c @@ -26,7 +26,6 @@ * Old code removed, switched to dynamic proc entry. */ -#include <linux/config.h> #if defined(CONFIG_PROC_FS) && defined(CONFIG_FT_PROC_FS) diff --git a/drivers/char/ftape/lowlevel/ftape-setup.c b/drivers/char/ftape/lowlevel/ftape-setup.c index 280a1a55d87..678340acd0b 100644 --- a/drivers/char/ftape/lowlevel/ftape-setup.c +++ b/drivers/char/ftape/lowlevel/ftape-setup.c @@ -25,7 +25,6 @@ * "ftape" for Linux. */ -#include <linux/config.h> #include <linux/string.h> #include <linux/errno.h> #include <linux/mm.h> diff --git a/drivers/char/ftape/lowlevel/ftape-tracing.h b/drivers/char/ftape/lowlevel/ftape-tracing.h index fa7cd20ee66..2950810c708 100644 --- a/drivers/char/ftape/lowlevel/ftape-tracing.h +++ b/drivers/char/ftape/lowlevel/ftape-tracing.h @@ -28,7 +28,6 @@ * QIC-40/80/3010/3020 floppy-tape driver "ftape" for Linux. */ -#include <linux/config.h> #include <linux/kernel.h> /* diff --git a/drivers/char/ftape/lowlevel/ftape_syms.c b/drivers/char/ftape/lowlevel/ftape_syms.c index 5dc3a380c9b..8e0dc4a07ca 100644 --- a/drivers/char/ftape/lowlevel/ftape_syms.c +++ b/drivers/char/ftape/lowlevel/ftape_syms.c @@ -25,7 +25,6 @@ * exports to its high level clients */ -#include <linux/config.h> #include <linux/module.h> #include <linux/ftape.h> diff --git a/drivers/char/ftape/zftape/zftape-ctl.c b/drivers/char/ftape/zftape/zftape-ctl.c index 6c7874e5c19..22ba0f5d00c 100644 --- a/drivers/char/ftape/zftape/zftape-ctl.c +++ b/drivers/char/ftape/zftape/zftape-ctl.c @@ -24,7 +24,6 @@ * for the QIC-40/80/3010/3020 floppy-tape driver for Linux. */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/mm.h> #include <linux/module.h> diff --git a/drivers/char/ftape/zftape/zftape-ctl.h b/drivers/char/ftape/zftape/zftape-ctl.h index 41415989199..8e6f2d7ac74 100644 --- a/drivers/char/ftape/zftape/zftape-ctl.h +++ b/drivers/char/ftape/zftape/zftape-ctl.h @@ -27,7 +27,6 @@ * for the QIC-40/80 floppy-tape driver for Linux. */ -#include <linux/config.h> #include <linux/ioctl.h> #include <linux/mtio.h> diff --git a/drivers/char/ftape/zftape/zftape-init.c b/drivers/char/ftape/zftape/zftape-init.c index 821357ce7e0..55272566b74 100644 --- a/drivers/char/ftape/zftape/zftape-init.c +++ b/drivers/char/ftape/zftape/zftape-init.c @@ -20,7 +20,6 @@ * to the ftape floppy tape driver for Linux */ -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/fs.h> @@ -33,7 +32,6 @@ #endif #include <linux/fcntl.h> #include <linux/smp_lock.h> -#include <linux/devfs_fs_kernel.h> #include <linux/zftape.h> #include <linux/init.h> @@ -332,29 +330,11 @@ KERN_INFO zft_class = class_create(THIS_MODULE, "zft"); for (i = 0; i < 4; i++) { class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i), NULL, "qft%i", i); - devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i), - S_IFCHR | S_IRUSR | S_IWUSR, - "qft%i", i); class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 4), NULL, "nqft%i", i); - devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 4), - S_IFCHR | S_IRUSR | S_IWUSR, - "nqft%i", i); class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 16), NULL, "zqft%i", i); - devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 16), - S_IFCHR | S_IRUSR | S_IWUSR, - "zqft%i", i); class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 20), NULL, "nzqft%i", i); - devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 20), - S_IFCHR | S_IRUSR | S_IWUSR, - "nzqft%i", i); class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 32), NULL, "rawqft%i", i); - devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 32), - S_IFCHR | S_IRUSR | S_IWUSR, - "rawqft%i", i); class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 36), NULL, "nrawrawqft%i", i); - devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 36), - S_IFCHR | S_IRUSR | S_IWUSR, - "nrawqft%i", i); } #ifdef CONFIG_ZFT_COMPRESSOR @@ -380,17 +360,11 @@ static void zft_exit(void) TRACE(ft_t_info, "successful"); } for (i = 0; i < 4; i++) { - devfs_remove("qft%i", i); class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i)); - devfs_remove("nqft%i", i); class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 4)); - devfs_remove("zqft%i", i); class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 16)); - devfs_remove("nzqft%i", i); class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 20)); - devfs_remove("rawqft%i", i); class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 32)); - devfs_remove("nrawqft%i", i); class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 36)); } class_destroy(zft_class); diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c index 588fca542a9..bebd7e34f79 100644 --- a/drivers/char/genrtc.c +++ b/drivers/char/genrtc.c @@ -43,7 +43,6 @@ #define RTC_VERSION "1.07" #include <linux/module.h> -#include <linux/config.h> #include <linux/errno.h> #include <linux/miscdevice.h> #include <linux/fcntl.h> diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 07473cd8412..e5643f3aa73 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -11,7 +11,6 @@ * published by the Free Software Foundation. */ -#include <linux/config.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/kernel.h> @@ -396,7 +395,7 @@ static int hpet_ioctl_ieon(struct hpet_dev *devp) sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev)); irq_flags = devp->hd_flags & HPET_SHARED_IRQ - ? SA_SHIRQ : SA_INTERRUPT; + ? IRQF_SHARED : IRQF_DISABLED; if (request_irq(irq, hpet_interrupt, irq_flags, devp->hd_name, (void *)devp)) { printk(KERN_ERR "hpet: IRQ %d is not free\n", irq); diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index a5c6a9d7ff0..ca2f538e549 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c @@ -22,7 +22,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <linux/config.h> #include <linux/console.h> #include <linux/cpumask.h> #include <linux/init.h> @@ -347,7 +346,7 @@ static int hvc_open(struct tty_struct *tty, struct file * filp) spin_unlock_irqrestore(&hp->lock, flags); /* check error, fallback to non-irq */ if (irq != NO_IRQ) - rc = request_irq(irq, hvc_handle_interrupt, SA_INTERRUPT, "hvc_console", hp); + rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED, "hvc_console", hp); /* * If the request_irq() fails and we return an error. The tty layer @@ -820,7 +819,6 @@ int __init hvc_init(void) return -ENOMEM; drv->owner = THIS_MODULE; - drv->devfs_name = "hvc/"; drv->driver_name = "hvc"; drv->name = "hvc"; drv->major = HVC_MAJOR; diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index afa26b65dac..4589ff302b0 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c @@ -899,7 +899,7 @@ static int hvcs_enable_device(struct hvcs_struct *hvcsd, uint32_t unit_address, * the conn was registered and now. */ if (!(rc = request_irq(irq, &hvcs_handle_interrupt, - SA_INTERRUPT, "ibmhvcs", hvcsd))) { + IRQF_DISABLED, "ibmhvcs", hvcsd))) { /* * It is possible the vty-server was removed after the irq was * requested but before we have time to enable interrupts. @@ -1363,7 +1363,6 @@ static int __init hvcs_module_init(void) hvcs_tty_driver->driver_name = hvcs_driver_name; hvcs_tty_driver->name = hvcs_device_node; - hvcs_tty_driver->devfs_name = hvcs_device_node; /* * We'll let the system assign us a major number, indicated by leaving diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c index a0370ed752c..8dc205b275e 100644 --- a/drivers/char/hvsi.c +++ b/drivers/char/hvsi.c @@ -1154,7 +1154,6 @@ static int __init hvsi_init(void) return -ENOMEM; hvsi_driver->owner = THIS_MODULE; - hvsi_driver->devfs_name = "hvsi/"; hvsi_driver->driver_name = "hvsi"; hvsi_driver->name = "hvsi"; hvsi_driver->major = HVSI_MAJOR; @@ -1169,7 +1168,7 @@ static int __init hvsi_init(void) struct hvsi_struct *hp = &hvsi_ports[i]; int ret = 1; - ret = request_irq(hp->virq, hvsi_interrupt, SA_INTERRUPT, "hvsi", hp); + ret = request_irq(hp->virq, hvsi_interrupt, IRQF_DISABLED, "hvsi", hp); if (ret) printk(KERN_ERR "HVSI: couldn't reserve irq 0x%x (error %i)\n", hp->virq, ret); diff --git a/drivers/char/ip2/i2ellis.h b/drivers/char/ip2/i2ellis.h index 510b026d7d2..5eabe47b0bc 100644 --- a/drivers/char/ip2/i2ellis.h +++ b/drivers/char/ip2/i2ellis.h @@ -47,7 +47,6 @@ //---------------------- // Mandatory Includes: //---------------------- -#include <linux/config.h> #include "ip2types.h" #include "i2hw.h" // The hardware definitions diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index 9ab33c3d359..a4200a2b081 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c @@ -82,7 +82,6 @@ /************/ /* Includes */ /************/ -#include <linux/config.h> #include <linux/ctype.h> #include <linux/string.h> @@ -91,7 +90,6 @@ #include <linux/module.h> #include <linux/signal.h> #include <linux/sched.h> -#include <linux/devfs_fs_kernel.h> #include <linux/timer.h> #include <linux/interrupt.h> #include <linux/pci.h> @@ -414,9 +412,7 @@ cleanup_module(void) /* free io addresses and Tibet */ release_region( ip2config.addr[i], 8 ); class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i)); - devfs_remove("ip2/ipl%d", i); class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i + 1)); - devfs_remove("ip2/stat%d", i); } /* Disable and remove interrupt handler. */ if ( (ip2config.irq[i] > 0) && have_requested_irq(ip2config.irq[i]) ) { @@ -425,7 +421,6 @@ cleanup_module(void) } } class_destroy(ip2_class); - devfs_remove("ip2"); if ( ( err = tty_unregister_driver ( ip2_tty_driver ) ) ) { printk(KERN_ERR "IP2: failed to unregister tty driver (%d)\n", err); } @@ -496,8 +491,8 @@ static struct tty_operations ip2_ops = { /* initialisation of the devices and driver structures, and registers itself */ /* with the relevant kernel modules. */ /******************************************************************************/ -/* SA_INTERRUPT- if set blocks all interrupts else only this line */ -/* SA_SHIRQ - for shared irq PCI or maybe EISA only */ +/* IRQF_DISABLED - if set blocks all interrupts else only this line */ +/* IRQF_SHARED - for shared irq PCI or maybe EISA only */ /* SA_RANDOM - can be source for cert. random number generators */ #define IP2_SA_FLAGS 0 @@ -675,7 +670,6 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) ip2_tty_driver->owner = THIS_MODULE; ip2_tty_driver->name = "ttyF"; - ip2_tty_driver->devfs_name = "tts/F"; ip2_tty_driver->driver_name = pcDriver_name; ip2_tty_driver->major = IP2_TTY_MAJOR; ip2_tty_driver->minor_start = 0; @@ -683,7 +677,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) ip2_tty_driver->subtype = SERIAL_TYPE_NORMAL; ip2_tty_driver->init_termios = tty_std_termios; ip2_tty_driver->init_termios.c_cflag = B9600|CS8|CREAD|HUPCL|CLOCAL; - ip2_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; + ip2_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; tty_set_operations(ip2_tty_driver, &ip2_ops); ip2trace (ITRC_NO_PORT, ITRC_INIT, 3, 0 ); @@ -724,26 +718,9 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) class_device_create(ip2_class, NULL, MKDEV(IP2_IPL_MAJOR, 4 * i), NULL, "ipl%d", i); - err = devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i), - S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR, - "ip2/ipl%d", i); - if (err) { - class_device_destroy(ip2_class, - MKDEV(IP2_IPL_MAJOR, 4 * i)); - goto out_class; - } - class_device_create(ip2_class, NULL, MKDEV(IP2_IPL_MAJOR, 4 * i + 1), NULL, "stat%d", i); - err = devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i + 1), - S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR, - "ip2/stat%d", i); - if (err) { - class_device_destroy(ip2_class, - MKDEV(IP2_IPL_MAJOR, 4 * i + 1)); - goto out_class; - } for ( box = 0; box < ABS_MAX_BOXES; ++box ) { @@ -776,7 +753,7 @@ retry: if (have_requested_irq(ip2config.irq[i])) continue; rc = request_irq( ip2config.irq[i], ip2_interrupt, - IP2_SA_FLAGS | (ip2config.type[i] == PCI ? SA_SHIRQ : 0), + IP2_SA_FLAGS | (ip2config.type[i] == PCI ? IRQF_SHARED : 0), pcName, (void *)&pcName); if (rc) { printk(KERN_ERR "IP2: an request_irq failed: error %d\n",rc); diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c index e1c95374984..2fc894fef1c 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c @@ -31,7 +31,6 @@ * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/errno.h> @@ -40,7 +39,6 @@ #include <linux/poll.h> #include <linux/spinlock.h> #include <linux/slab.h> -#include <linux/devfs_fs_kernel.h> #include <linux/ipmi.h> #include <linux/mutex.h> #include <linux/init.h> @@ -804,9 +802,6 @@ static void ipmi_new_smi(int if_num, struct device *device) dev_t dev = MKDEV(ipmi_major, if_num); struct ipmi_reg_list *entry; - devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR, - "ipmidev/%d", if_num); - entry = kmalloc(sizeof(*entry), GFP_KERNEL); if (!entry) { printk(KERN_ERR "ipmi_devintf: Unable to create the" @@ -836,7 +831,6 @@ static void ipmi_smi_gone(int if_num) } class_device_destroy(ipmi_class, dev); mutex_unlock(®_list_mutex); - devfs_remove("ipmidev/%d", if_num); } static struct ipmi_smi_watcher smi_watcher = @@ -872,8 +866,6 @@ static __init int init_ipmi_devintf(void) ipmi_major = rv; } - devfs_mk_dir(DEVICE_NAME); - rv = ipmi_smi_watcher_register(&smi_watcher); if (rv) { unregister_chrdev(ipmi_major, DEVICE_NAME); @@ -898,7 +890,6 @@ static __exit void cleanup_ipmi(void) mutex_unlock(®_list_mutex); class_destroy(ipmi_class); ipmi_smi_watcher_unregister(&smi_watcher); - devfs_remove(DEVICE_NAME); unregister_chrdev(ipmi_major, DEVICE_NAME); } module_exit(cleanup_ipmi); diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index ad26f4b997c..0aa5d608fe6 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -31,7 +31,6 @@ * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <asm/system.h> diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c index d0b5c08e7b4..8d941db8345 100644 --- a/drivers/char/ipmi/ipmi_poweroff.c +++ b/drivers/char/ipmi/ipmi_poweroff.c @@ -31,7 +31,6 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/proc_fs.h> diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index bd4f2248b75..f57eba0bf25 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -38,7 +38,6 @@ * and drives the real SMI state machine. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <asm/system.h> @@ -1042,7 +1041,7 @@ static int std_irq_setup(struct smi_info *info) if (info->si_type == SI_BT) { rv = request_irq(info->irq, si_bt_irq_handler, - SA_INTERRUPT, + IRQF_DISABLED, DEVICE_NAME, info); if (!rv) @@ -1052,7 +1051,7 @@ static int std_irq_setup(struct smi_info *info) } else rv = request_irq(info->irq, si_irq_handler, - SA_INTERRUPT, + IRQF_DISABLED, DEVICE_NAME, info); if (rv) { diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 1a0a19c5360..74a889c5833 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c @@ -31,7 +31,6 @@ * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/ipmi.h> diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index efaaa1937ab..913be23e0a2 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c @@ -245,7 +245,7 @@ static int lock_card(struct isi_board *card) printk(KERN_WARNING "ISICOM: Failed to lock Card (0x%lx)\n", card->base); - return 0; /* Failed to aquire the card! */ + return 0; /* Failed to acquire the card! */ } static int lock_card_at_interrupt(struct isi_board *card) @@ -262,7 +262,7 @@ static int lock_card_at_interrupt(struct isi_board *card) spin_unlock_irqrestore(&card->card_lock, card->flags); } /* Failing in interrupt is an acceptable event */ - return 0; /* Failed to aquire the card! */ + return 0; /* Failed to acquire the card! */ } static void unlock_card(struct isi_board *card) @@ -1581,7 +1581,6 @@ static int __devinit isicom_register_tty_driver(void) isicom_normal->owner = THIS_MODULE; isicom_normal->name = "ttyM"; - isicom_normal->devfs_name = "isicom/"; isicom_normal->major = ISICOM_NMAJOR; isicom_normal->minor_start = 0; isicom_normal->type = TTY_DRIVER_TYPE_SERIAL; @@ -1615,14 +1614,14 @@ static int __devinit isicom_register_isr(struct pci_dev *pdev, const unsigned int index) { struct isi_board *board = pci_get_drvdata(pdev); - unsigned long irqflags = SA_INTERRUPT; + unsigned long irqflags = IRQF_DISABLED; int retval = -EINVAL; if (!board->base) goto end; if (board->isa == NO) - irqflags |= SA_SHIRQ; + irqflags |= IRQF_SHARED; retval = request_irq(board->irq, isicom_interrupt, irqflags, ISICOM_NAME, board); diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 216c79256de..fbce2f0669d 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c @@ -26,7 +26,6 @@ /*****************************************************************************/ -#include <linux/config.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/interrupt.h> @@ -39,7 +38,6 @@ #include <linux/ioport.h> #include <linux/delay.h> #include <linux/init.h> -#include <linux/devfs_fs_kernel.h> #include <linux/device.h> #include <linux/wait.h> #include <linux/eisa.h> @@ -283,7 +281,6 @@ static char *stli_brdnames[] = { /*****************************************************************************/ -#ifdef MODULE /* * Define some string labels for arguments passed from the module * load line. These allow for easy board definitions, and easy @@ -382,8 +379,6 @@ MODULE_PARM_DESC(board2, "Board 2 config -> name[,ioaddr[,memaddr]"); module_param_array(board3, charp, NULL, 0); MODULE_PARM_DESC(board3, "Board 3 config -> name[,ioaddr[,memaddr]"); -#endif - /* * Set up a default memory address table for EISA board probing. * The default addresses are all bellow 1Mbyte, which has to be the @@ -644,14 +639,8 @@ static unsigned int stli_baudrates[] = { * Prototype all functions in this driver! */ -#ifdef MODULE -static void stli_argbrds(void); static int stli_parsebrd(stlconf_t *confp, char **argp); - -static unsigned long stli_atol(char *str); -#endif - -int stli_init(void); +static int stli_init(void); static int stli_open(struct tty_struct *tty, struct file *filp); static void stli_close(struct tty_struct *tty, struct file *filp); static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count); @@ -787,8 +776,6 @@ static int stli_timeron; static struct class *istallion_class; -#ifdef MODULE - /* * Loadable module initialization stuff. */ @@ -826,11 +813,8 @@ static void __exit istallion_module_exit(void) return; } put_tty_driver(stli_serial); - for (i = 0; i < 4; i++) { - devfs_remove("staliomem/%d", i); + for (i = 0; i < 4; i++) class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, i)); - } - devfs_remove("staliomem"); class_destroy(istallion_class); if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) printk("STALLION: failed to un-register serial memory device, " @@ -958,8 +942,6 @@ static int stli_parsebrd(stlconf_t *confp, char **argp) return(1); } -#endif - /*****************************************************************************/ static int stli_open(struct tty_struct *tty, struct file *filp) @@ -4698,7 +4680,7 @@ static struct tty_operations stli_ops = { /*****************************************************************************/ -int __init stli_init(void) +static int __init stli_init(void) { int i; printk(KERN_INFO "%s: version %s\n", stli_drvtitle, stli_drvversion); @@ -4728,16 +4710,11 @@ int __init stli_init(void) printk(KERN_ERR "STALLION: failed to register serial memory " "device\n"); - devfs_mk_dir("staliomem"); istallion_class = class_create(THIS_MODULE, "staliomem"); - for (i = 0; i < 4; i++) { - devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i), - S_IFCHR | S_IRUSR | S_IWUSR, - "staliomem/%d", i); + for (i = 0; i < 4; i++) class_device_create(istallion_class, NULL, MKDEV(STL_SIOMEMMAJOR, i), NULL, "staliomem%d", i); - } /* * Set up the tty driver structure and register us as a driver. diff --git a/drivers/char/ite_gpio.c b/drivers/char/ite_gpio.c index d1ed6ac950d..747ba45e50e 100644 --- a/drivers/char/ite_gpio.c +++ b/drivers/char/ite_gpio.c @@ -397,7 +397,7 @@ int __init ite_gpio_init(void) init_waitqueue_head(&ite_gpio_wait[i]); } - if (request_irq(ite_gpio_irq, ite_gpio_irq_handler, SA_SHIRQ, "gpio", 0) < 0) { + if (request_irq(ite_gpio_irq, ite_gpio_irq_handler, IRQF_SHARED, "gpio", 0) < 0) { misc_deregister(&ite_gpio_miscdev); release_region(ite_gpio_base, 0x1c); return 0; diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 4bb3d227260..056ebe84b81 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c @@ -24,7 +24,6 @@ * 21-08-02: Converted to input API, major cleanup. (Vojtech Pavlik) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/tty.h> diff --git a/drivers/char/lcd.c b/drivers/char/lcd.c index 29963d8be66..7d49b241de5 100644 --- a/drivers/char/lcd.c +++ b/drivers/char/lcd.c @@ -14,7 +14,6 @@ #define RTC_IO_EXTENT 0x10 /*Only really two ports, but... */ -#include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/miscdevice.h> diff --git a/drivers/char/lp.c b/drivers/char/lp.c index e5726052529..582cdbdb0c4 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c @@ -114,13 +114,11 @@ #include <linux/module.h> #include <linux/init.h> -#include <linux/config.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/major.h> #include <linux/sched.h> #include <linux/smp_lock.h> -#include <linux/devfs_fs_kernel.h> #include <linux/slab.h> #include <linux/fcntl.h> #include <linux/delay.h> @@ -807,8 +805,6 @@ static int lp_register(int nr, struct parport *port) class_device_create(lp_class, NULL, MKDEV(LP_MAJOR, nr), NULL, "lp%d", nr); - devfs_mk_cdev(MKDEV(LP_MAJOR, nr), S_IFCHR | S_IRUGO | S_IWUGO, - "printers/%d", nr); printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name, (port->irq == PARPORT_IRQ_NONE)?"polling":"interrupt-driven"); @@ -907,7 +903,6 @@ static int __init lp_init (void) return -EIO; } - devfs_mk_dir("printers"); lp_class = class_create(THIS_MODULE, "printer"); if (IS_ERR(lp_class)) { err = PTR_ERR(lp_class); @@ -933,7 +928,6 @@ static int __init lp_init (void) out_class: class_destroy(lp_class); out_devfs: - devfs_remove("printers"); unregister_chrdev(LP_MAJOR, "lp"); return err; } @@ -981,10 +975,8 @@ static void lp_cleanup_module (void) if (lp_table[offset].dev == NULL) continue; parport_unregister_device(lp_table[offset].dev); - devfs_remove("printers/%d", offset); class_device_destroy(lp_class, MKDEV(LP_MAJOR, offset)); } - devfs_remove("printers"); class_destroy(lp_class); } diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c index c268ee04b2a..0385650f607 100644 --- a/drivers/char/mbcs.c +++ b/drivers/char/mbcs.c @@ -10,7 +10,6 @@ * MOATB Core Services driver. */ -#include <linux/config.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/moduleparam.h> @@ -593,7 +592,7 @@ static int mbcs_intr_alloc(struct cx_dev *dev) getdma->intrHostDest = sn_irq->irq_xtalkaddr; getdma->intrVector = sn_irq->irq_irq; if (request_irq(sn_irq->irq_irq, - (void *)mbcs_completion_intr_handler, SA_SHIRQ, + (void *)mbcs_completion_intr_handler, IRQF_SHARED, "MBCS get intr", (void *)soft)) { tiocx_irq_free(soft->get_sn_irq); return -EAGAIN; @@ -609,7 +608,7 @@ static int mbcs_intr_alloc(struct cx_dev *dev) putdma->intrHostDest = sn_irq->irq_xtalkaddr; putdma->intrVector = sn_irq->irq_irq; if (request_irq(sn_irq->irq_irq, - (void *)mbcs_completion_intr_handler, SA_SHIRQ, + (void *)mbcs_completion_intr_handler, IRQF_SHARED, "MBCS put intr", (void *)soft)) { tiocx_irq_free(soft->put_sn_irq); free_irq(soft->get_sn_irq->irq_irq, soft); @@ -629,7 +628,7 @@ static int mbcs_intr_alloc(struct cx_dev *dev) algo->intrHostDest = sn_irq->irq_xtalkaddr; algo->intrVector = sn_irq->irq_irq; if (request_irq(sn_irq->irq_irq, - (void *)mbcs_completion_intr_handler, SA_SHIRQ, + (void *)mbcs_completion_intr_handler, IRQF_SHARED, "MBCS algo intr", (void *)soft)) { tiocx_irq_free(soft->algo_sn_irq); free_irq(soft->put_sn_irq->irq_irq, soft); diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 1fa9fa157c1..70f3954d6df 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -8,7 +8,6 @@ * Shared /dev/zero mmaping support, Feb 2000, Kanoj Sarcar <kanoj@sgi.com> */ -#include <linux/config.h> #include <linux/mm.h> #include <linux/miscdevice.h> #include <linux/slab.h> @@ -20,7 +19,6 @@ #include <linux/tty.h> #include <linux/capability.h> #include <linux/smp_lock.h> -#include <linux/devfs_fs_kernel.h> #include <linux/ptrace.h> #include <linux/device.h> #include <linux/highmem.h> @@ -941,13 +939,10 @@ static int __init chr_dev_init(void) printk("unable to get major %d for memory devs\n", MEM_MAJOR); mem_class = class_create(THIS_MODULE, "mem"); - for (i = 0; i < ARRAY_SIZE(devlist); i++) { + for (i = 0; i < ARRAY_SIZE(devlist); i++) class_device_create(mem_class, NULL, MKDEV(MEM_MAJOR, devlist[i].minor), NULL, devlist[i].name); - devfs_mk_cdev(MKDEV(MEM_MAJOR, devlist[i].minor), - S_IFCHR | devlist[i].mode, devlist[i].name); - } return 0; } diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 96eb2a709e2..d5fa19da330 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c @@ -34,7 +34,6 @@ */ #include <linux/module.h> -#include <linux/config.h> #include <linux/fs.h> #include <linux/errno.h> @@ -44,7 +43,6 @@ #include <linux/slab.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> -#include <linux/devfs_fs_kernel.h> #include <linux/stat.h> #include <linux/init.h> #include <linux/device.h> @@ -204,7 +202,7 @@ int misc_register(struct miscdevice * misc) { struct miscdevice *c; dev_t dev; - int err; + int err = 0; down(&misc_sem); list_for_each_entry(c, &misc_list, list) { @@ -228,10 +226,6 @@ int misc_register(struct miscdevice * misc) if (misc->minor < DYNAMIC_MINORS) misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); - if (misc->devfs_name[0] == '\0') { - snprintf(misc->devfs_name, sizeof(misc->devfs_name), - "misc/%s", misc->name); - } dev = MKDEV(MISC_MAJOR, misc->minor); misc->class = class_device_create(misc_class, NULL, dev, misc->dev, @@ -241,13 +235,6 @@ int misc_register(struct miscdevice * misc) goto out; } - err = devfs_mk_cdev(dev, S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP, - misc->devfs_name); - if (err) { - class_device_destroy(misc_class, dev); - goto out; - } - /* * Add it to the front, so that later devices can "override" * earlier defaults @@ -278,7 +265,6 @@ int misc_deregister(struct miscdevice * misc) down(&misc_sem); list_del(&misc->list); class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); - devfs_remove(misc->devfs_name); if (i < DYNAMIC_MINORS && i>0) { misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); } diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c index d65b3109318..70b774ff5aa 100644 --- a/drivers/char/mmtimer.c +++ b/drivers/char/mmtimer.c @@ -25,7 +25,6 @@ #include <linux/init.h> #include <linux/errno.h> #include <linux/mm.h> -#include <linux/devfs_fs_kernel.h> #include <linux/mmtimer.h> #include <linux/miscdevice.h> #include <linux/posix-timers.h> @@ -688,13 +687,12 @@ static int __init mmtimer_init(void) mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second / 2) / sn_rtc_cycles_per_second; - if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, SA_PERCPU_IRQ, MMTIMER_NAME, NULL)) { + if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, IRQF_PERCPU, MMTIMER_NAME, NULL)) { printk(KERN_WARNING "%s: unable to allocate interrupt.", MMTIMER_NAME); return -1; } - strcpy(mmtimer_miscdev.devfs_name, MMTIMER_NAME); if (misc_register(&mmtimer_miscdev)) { printk(KERN_ERR "%s: failed to register device\n", MMTIMER_NAME); diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 01247cccb89..4ea7bd5f4f5 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c @@ -29,7 +29,6 @@ * version : 5.1 */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/mm.h> @@ -342,7 +341,6 @@ static int __init moxa_init(void) init_MUTEX(&moxaBuffSem); moxaDriver->owner = THIS_MODULE; moxaDriver->name = "ttyMX"; - moxaDriver->devfs_name = "tts/a"; moxaDriver->major = ttymajor; moxaDriver->minor_start = 0; moxaDriver->type = TTY_DRIVER_TYPE_SERIAL; diff --git a/drivers/char/mwave/3780i.c b/drivers/char/mwave/3780i.c index d1fe05e8388..4e4865e90e5 100644 --- a/drivers/char/mwave/3780i.c +++ b/drivers/char/mwave/3780i.c @@ -46,7 +46,6 @@ * First release to the public */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/unistd.h> #include <linux/delay.h> diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 72cfd09091e..556abd3e0d0 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c @@ -36,7 +36,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/autoconf.h> #include <linux/errno.h> @@ -95,7 +94,7 @@ #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|\ IXON|IXOFF)) -#define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT) +#define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? IRQF_SHARED : IRQF_DISABLED) #define C168_ASIC_ID 1 #define C104_ASIC_ID 2 diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c index 9f54733f162..337a87f86a3 100644 --- a/drivers/char/n_hdlc.c +++ b/drivers/char/n_hdlc.c @@ -81,7 +81,6 @@ #define HDLC_MAGIC 0x239e #define HDLC_VERSION "$Revision: 4.8 $" -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 3556ccd7757..8c5f102622b 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c @@ -37,7 +37,6 @@ #define NVRAM_VERSION "1.2" #include <linux/module.h> -#include <linux/config.h> #include <linux/sched.h> #include <linux/smp_lock.h> #include <linux/nvram.h> diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c index 4083b781adb..f240a104d25 100644 --- a/drivers/char/nwbutton.c +++ b/drivers/char/nwbutton.c @@ -4,7 +4,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -224,7 +223,7 @@ static int __init nwbutton_init(void) return -EBUSY; } - if (request_irq (IRQ_NETWINDER_BUTTON, button_handler, SA_INTERRUPT, + if (request_irq (IRQ_NETWINDER_BUTTON, button_handler, IRQF_DISABLED, "nwbutton", NULL)) { printk (KERN_WARNING "nwbutton: IRQ %d is not free.\n", IRQ_NETWINDER_BUTTON); diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c index 1c706ccfdbb..c860de6a6fd 100644 --- a/drivers/char/pc8736x_gpio.c +++ b/drivers/char/pc8736x_gpio.c @@ -319,9 +319,10 @@ static int __init pc8736x_gpio_init(void) return 0; undo_platform_dev_add: - platform_device_put(pdev); + platform_device_del(pdev); undo_platform_dev_alloc: - kfree(pdev); + platform_device_put(pdev); + return rc; } diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index eab5394da66..31c8a21f9d8 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -149,12 +149,7 @@ struct cm4000_dev { #define ZERO_DEV(dev) \ memset(&dev->atr_csum,0, \ sizeof(struct cm4000_dev) - \ - /*link*/ sizeof(struct pcmcia_device *) - \ - /*node*/ sizeof(dev_node_t) - \ - /*atr*/ MAX_ATR*sizeof(char) - \ - /*rbuf*/ 512*sizeof(char) - \ - /*sbuf*/ 512*sizeof(char) - \ - /*queue*/ 4*sizeof(wait_queue_head_t)) + offsetof(struct cm4000_dev, atr_csum)) static struct pcmcia_device *dev_table[CM4000_MAX_DEV]; static struct class *cmm_class; diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index bee6c47b45b..24231d9743d 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c @@ -60,7 +60,6 @@ #include <linux/init.h> #include <linux/sched.h> #include <linux/device.h> -#include <linux/devfs_fs_kernel.h> #include <linux/ioctl.h> #include <linux/parport.h> #include <linux/ctype.h> @@ -770,7 +769,7 @@ static struct parport_driver pp_driver = { static int __init ppdev_init (void) { - int i, err = 0; + int err = 0; if (register_chrdev (PP_MAJOR, CHRDEV, &pp_fops)) { printk (KERN_WARNING CHRDEV ": unable to get major %d\n", @@ -782,11 +781,6 @@ static int __init ppdev_init (void) err = PTR_ERR(ppdev_class); goto out_chrdev; } - devfs_mk_dir("parports"); - for (i = 0; i < PARPORT_MAX; i++) { - devfs_mk_cdev(MKDEV(PP_MAJOR, i), - S_IFCHR | S_IRUGO | S_IWUGO, "parports/%d", i); - } if (parport_register_driver(&pp_driver)) { printk (KERN_WARNING CHRDEV ": unable to register with parport\n"); goto out_class; @@ -796,9 +790,6 @@ static int __init ppdev_init (void) goto out; out_class: - for (i = 0; i < PARPORT_MAX; i++) - devfs_remove("parports/%d", i); - devfs_remove("parports"); class_destroy(ppdev_class); out_chrdev: unregister_chrdev(PP_MAJOR, CHRDEV); @@ -808,12 +799,8 @@ out: static void __exit ppdev_cleanup (void) { - int i; /* Clean up all parport stuff */ - for (i = 0; i < PARPORT_MAX; i++) - devfs_remove("parports/%d", i); parport_unregister_driver(&pp_driver); - devfs_remove("parports"); class_destroy(ppdev_class); unregister_chrdev (PP_MAJOR, CHRDEV); } diff --git a/drivers/char/pty.c b/drivers/char/pty.c index 0c17f61549b..34dd4c38110 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c @@ -11,7 +11,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> /* For EXPORT_SYMBOL */ #include <linux/errno.h> @@ -24,7 +23,6 @@ #include <linux/major.h> #include <linux/mm.h> #include <linux/init.h> -#include <linux/devfs_fs_kernel.h> #include <linux/sysctl.h> #include <asm/uaccess.h> @@ -265,7 +263,6 @@ static void __init legacy_pty_init(void) pty_driver->owner = THIS_MODULE; pty_driver->driver_name = "pty_master"; pty_driver->name = "pty"; - pty_driver->devfs_name = "pty/m"; pty_driver->major = PTY_MASTER_MAJOR; pty_driver->minor_start = 0; pty_driver->type = TTY_DRIVER_TYPE_PTY; @@ -283,7 +280,6 @@ static void __init legacy_pty_init(void) pty_slave_driver->owner = THIS_MODULE; pty_slave_driver->driver_name = "pty_slave"; pty_slave_driver->name = "ttyp"; - pty_slave_driver->devfs_name = "pty/s"; pty_slave_driver->major = PTY_SLAVE_MAJOR; pty_slave_driver->minor_start = 0; pty_slave_driver->type = TTY_DRIVER_TYPE_PTY; @@ -351,7 +347,6 @@ static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file, static void __init unix98_pty_init(void) { - devfs_mk_dir("pts"); ptm_driver = alloc_tty_driver(NR_UNIX98_PTY_MAX); if (!ptm_driver) panic("Couldn't allocate Unix98 ptm driver"); @@ -372,7 +367,7 @@ static void __init unix98_pty_init(void) ptm_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; ptm_driver->init_termios.c_lflag = 0; ptm_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | - TTY_DRIVER_NO_DEVFS | TTY_DRIVER_DEVPTS_MEM; + TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_DEVPTS_MEM; ptm_driver->other = pts_driver; tty_set_operations(ptm_driver, &pty_ops); ptm_driver->ioctl = pty_unix98_ioctl; @@ -387,7 +382,7 @@ static void __init unix98_pty_init(void) pts_driver->init_termios = tty_std_termios; pts_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; pts_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | - TTY_DRIVER_NO_DEVFS | TTY_DRIVER_DEVPTS_MEM; + TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_DEVPTS_MEM; pts_driver->other = ptm_driver; tty_set_operations(pts_driver, &pty_ops); diff --git a/drivers/char/qtronix.c b/drivers/char/qtronix.c index 601d09baf9d..9d134e98d2a 100644 --- a/drivers/char/qtronix.c +++ b/drivers/char/qtronix.c @@ -33,7 +33,6 @@ * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> /* * NOTE: @@ -145,7 +144,7 @@ void __init init_qtronix_990P_kbd(void) cir_port_init(cir); retval = request_irq(IT8172_CIR0_IRQ, kbd_int_handler, - (unsigned long )(SA_INTERRUPT|SA_SHIRQ), + (unsigned long )(IRQF_DISABLED|IRQF_SHARED), (const char *)"Qtronix IR Keyboard", (void *)cir); if (retval) { diff --git a/drivers/char/random.c b/drivers/char/random.c index 58f3512c52e..164bddae047 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -224,7 +224,6 @@ */ #include <linux/utsname.h> -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/major.h> diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 15a7b408652..9bf97c5e38c 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c @@ -10,7 +10,6 @@ #include <linux/init.h> #include <linux/fs.h> -#include <linux/devfs_fs_kernel.h> #include <linux/major.h> #include <linux/blkdev.h> #include <linux/module.h> @@ -288,7 +287,6 @@ static struct cdev raw_cdev = { static int __init raw_init(void) { - int i; dev_t dev = MKDEV(RAW_MAJOR, 0); if (register_chrdev_region(dev, MAX_RAW_MINORS, "raw")) @@ -310,13 +308,6 @@ static int __init raw_init(void) } class_device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl"); - devfs_mk_cdev(MKDEV(RAW_MAJOR, 0), - S_IFCHR | S_IRUGO | S_IWUGO, - "raw/rawctl"); - for (i = 1; i < MAX_RAW_MINORS; i++) - devfs_mk_cdev(MKDEV(RAW_MAJOR, i), - S_IFCHR | S_IRUGO | S_IWUGO, - "raw/raw%d", i); return 0; error: @@ -326,12 +317,6 @@ error: static void __exit raw_exit(void) { - int i; - - for (i = 1; i < MAX_RAW_MINORS; i++) - devfs_remove("raw/raw%d", i); - devfs_remove("raw/rawctl"); - devfs_remove("raw"); class_device_destroy(raw_class, MKDEV(RAW_MAJOR, 0)); class_destroy(raw_class); cdev_del(&raw_cdev); diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index aa43436d5d1..3afc6a47ebb 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c @@ -33,7 +33,6 @@ * */ #include <linux/module.h> -#include <linux/config.h> #include <linux/kdev_t.h> #include <asm/io.h> #include <linux/kernel.h> @@ -1120,7 +1119,7 @@ static int __init rio_init(void) for (i = 0; i < p->RIONumHosts; i++) { hp = &p->RIOHosts[i]; if (hp->Ivec) { - int mode = SA_SHIRQ; + int mode = IRQF_SHARED; if (hp->Ivec & 0x8000) { mode = 0; hp->Ivec &= 0x7fff; diff --git a/drivers/char/rio/rio_linux.h b/drivers/char/rio/rio_linux.h index 55b9c97e847..dc3f005614a 100644 --- a/drivers/char/rio/rio_linux.h +++ b/drivers/char/rio/rio_linux.h @@ -23,7 +23,6 @@ * Version 1.0 -- July, 1999. * */ -#include <linux/config.h> #define RIO_NBOARDS 4 #define RIO_PORTSPERBOARD 128 diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c index 12e34bc3f7c..99f3df02b61 100644 --- a/drivers/char/rio/rioinit.c +++ b/drivers/char/rio/rioinit.c @@ -33,7 +33,6 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; #endif -#include <linux/config.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/errno.h> diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 657c0d88f48..f1c94f771af 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c @@ -625,7 +625,7 @@ static inline int rc_setup_board(struct riscom_board * bp) if (bp->flags & RC_BOARD_ACTIVE) return 0; - error = request_irq(bp->irq, rc_interrupt, SA_INTERRUPT, + error = request_irq(bp->irq, rc_interrupt, IRQF_DISABLED, "RISCom/8", NULL); if (error) return error; @@ -1634,7 +1634,6 @@ static inline int rc_init_drivers(void) memset(IRQ_to_board, 0, sizeof(IRQ_to_board)); riscom_driver->owner = THIS_MODULE; riscom_driver->name = "ttyL"; - riscom_driver->devfs_name = "tts/L"; riscom_driver->major = RISCOM8_NORMAL_MAJOR; riscom_driver->type = TTY_DRIVER_TYPE_SERIAL; riscom_driver->subtype = SERIAL_TYPE_NORMAL; diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 0708c5164c8..0ac13188132 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c @@ -2426,8 +2426,7 @@ static int __init rp_init(void) */ rocket_driver->owner = THIS_MODULE; - rocket_driver->flags = TTY_DRIVER_NO_DEVFS; - rocket_driver->devfs_name = "tts/R"; + rocket_driver->flags = TTY_DRIVER_DYNAMIC_DEV; rocket_driver->name = "ttyR"; rocket_driver->driver_name = "Comtrol RocketPort"; rocket_driver->major = TTY_ROCKET_MAJOR; @@ -2438,7 +2437,7 @@ static int __init rp_init(void) rocket_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; #ifdef ROCKET_SOFT_FLOW - rocket_driver->flags |= TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; + rocket_driver->flags |= TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; #endif tty_set_operations(rocket_driver, &rocket_ops); diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 0897b0c8d52..aefac4ac0bf 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c @@ -61,7 +61,6 @@ * this driver.) */ -#include <linux/config.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/kernel.h> @@ -221,7 +220,7 @@ static inline unsigned char rtc_is_updating(void) #ifdef RTC_IRQ /* - * A very tiny interrupt handler. It runs with SA_INTERRUPT set, + * A very tiny interrupt handler. It runs with IRQF_DISABLED set, * but there is possibility of conflicting with the set_rtc_mmss() * call (the rtc irq and the timer irq can easily run at the same * time in two different CPUs). So we need to serialize @@ -959,7 +958,7 @@ found: * XXX Interrupt pin #7 in Espresso is shared between RTC and * PCI Slot 2 INTA# (and some INTx# in Slot 1). */ - if (request_irq(rtc_irq, rtc_interrupt, SA_SHIRQ, "rtc", (void *)&rtc_port)) { + if (request_irq(rtc_irq, rtc_interrupt, IRQF_SHARED, "rtc", (void *)&rtc_port)) { printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq); return -EIO; } @@ -977,7 +976,7 @@ no_irq: rtc_int_handler_ptr = rtc_interrupt; } - if(request_irq(RTC_IRQ, rtc_int_handler_ptr, SA_INTERRUPT, "rtc", NULL)) { + if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) { /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); release_region(RTC_PORT(0), RTC_IO_EXTENT); diff --git a/drivers/char/s3c2410-rtc.c b/drivers/char/s3c2410-rtc.c index b0038b19b50..5458ef1634e 100644 --- a/drivers/char/s3c2410-rtc.c +++ b/drivers/char/s3c2410-rtc.c @@ -341,13 +341,13 @@ static int s3c2410_rtc_open(void) int ret; ret = request_irq(s3c2410_rtc_alarmno, s3c2410_rtc_alarmirq, - SA_INTERRUPT, "s3c2410-rtc alarm", NULL); + IRQF_DISABLED, "s3c2410-rtc alarm", NULL); if (ret) printk(KERN_ERR "IRQ%d already in use\n", s3c2410_rtc_alarmno); ret = request_irq(s3c2410_rtc_tickno, s3c2410_rtc_tickirq, - SA_INTERRUPT, "s3c2410-rtc tick", NULL); + IRQF_DISABLED, "s3c2410-rtc tick", NULL); if (ret) { printk(KERN_ERR "IRQ%d already in use\n", s3c2410_rtc_tickno); diff --git a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c index 5a280a33040..45083e5dd23 100644 --- a/drivers/char/scx200_gpio.c +++ b/drivers/char/scx200_gpio.c @@ -126,9 +126,10 @@ static int __init scx200_gpio_init(void) undo_chrdev_region: unregister_chrdev_region(dev, num_pins); undo_platform_device_add: - platform_device_put(pdev); + platform_device_del(pdev); undo_malloc: - kfree(pdev); + platform_device_put(pdev); + return rc; } @@ -136,7 +137,6 @@ static void __exit scx200_gpio_cleanup(void) { kfree(scx200_devices); unregister_chrdev_region(MKDEV(major, 0), num_pins); - platform_device_put(pdev); platform_device_unregister(pdev); /* kfree(pdev); */ } diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index 037c940ac71..21a710cb4bb 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c @@ -44,7 +44,6 @@ * - replace bottom half handler with task queue handler */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/signal.h> #include <linux/sched.h> @@ -2235,7 +2234,6 @@ scrn[1] = '\0'; /* Initialize the tty_driver structure */ cy_serial_driver->owner = THIS_MODULE; - cy_serial_driver->devfs_name = "tts/"; cy_serial_driver->name = "ttyS"; cy_serial_driver->major = TTY_MAJOR; cy_serial_driver->minor_start = 64; diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c index 56c8243cdb7..203240b6c08 100644 --- a/drivers/char/snsc.c +++ b/drivers/char/snsc.c @@ -105,7 +105,7 @@ scdrv_open(struct inode *inode, struct file *file) /* hook this subchannel up to the system controller interrupt */ rv = request_irq(SGI_UART_VECTOR, scdrv_interrupt, - SA_SHIRQ | SA_INTERRUPT, + IRQF_SHARED | IRQF_DISABLED, SYSCTL_BASENAME, sd); if (rv) { ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch); diff --git a/drivers/char/snsc_event.c b/drivers/char/snsc_event.c index e234d50e142..8b2210b633d 100644 --- a/drivers/char/snsc_event.c +++ b/drivers/char/snsc_event.c @@ -310,7 +310,7 @@ scdrv_event_init(struct sysctl_data_s *scd) /* hook event subchannel up to the system controller interrupt */ rv = request_irq(SGI_UART_VECTOR, scdrv_event_interrupt, - SA_SHIRQ | SA_INTERRUPT, + IRQF_SHARED | IRQF_DISABLED, "system controller events", event_sd); if (rv) { printk(KERN_WARNING "%s: irq request failed (%d)\n", diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 43dfd8689dc..45508a03950 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c @@ -33,7 +33,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/input.h> #include <linux/pci.h> @@ -1283,7 +1282,7 @@ static int __devinit sonypi_setup_irq(struct sonypi_device *dev, while (irq_list->irq) { if (!request_irq(irq_list->irq, sonypi_irq, - SA_SHIRQ, "sonypi", sonypi_irq)) { + IRQF_SHARED, "sonypi", sonypi_irq)) { dev->irq = irq_list->irq; dev->bits = irq_list->bits; return 0; diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index d2d6b01dcd0..cb2859249d4 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -75,7 +75,6 @@ * Documentation/specialix.txt */ -#include <linux/config.h> #include <linux/module.h> #include <asm/io.h> @@ -1016,9 +1015,9 @@ static inline int sx_setup_board(struct specialix_board * bp) return 0; if (bp->flags & SX_BOARD_IS_PCI) - error = request_irq(bp->irq, sx_interrupt, SA_INTERRUPT | SA_SHIRQ, "specialix IO8+", bp); + error = request_irq(bp->irq, sx_interrupt, IRQF_DISABLED | IRQF_SHARED, "specialix IO8+", bp); else - error = request_irq(bp->irq, sx_interrupt, SA_INTERRUPT, "specialix IO8+", bp); + error = request_irq(bp->irq, sx_interrupt, IRQF_DISABLED, "specialix IO8+", bp); if (error) return error; diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 00b4a218716..ed7b8eaf036 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c @@ -26,7 +26,6 @@ /*****************************************************************************/ -#include <linux/config.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/interrupt.h> @@ -40,7 +39,6 @@ #include <linux/ioport.h> #include <linux/init.h> #include <linux/smp_lock.h> -#include <linux/devfs_fs_kernel.h> #include <linux/device.h> #include <linux/delay.h> @@ -757,11 +755,8 @@ static void __exit stallion_module_exit(void) "errno=%d\n", -i); return; } - for (i = 0; i < 4; i++) { - devfs_remove("staliomem/%d", i); + for (i = 0; i < 4; i++) class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i)); - } - devfs_remove("staliomem"); if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) printk("STALLION: failed to un-register serial memory device, " "errno=%d\n", -i); @@ -2307,7 +2302,7 @@ static inline int stl_initeio(stlbrd_t *brdp) brdp->nrpanels = 1; brdp->state |= BRD_FOUND; brdp->hwid = status; - if (request_irq(brdp->irq, stl_intr, SA_SHIRQ, name, brdp) != 0) { + if (request_irq(brdp->irq, stl_intr, IRQF_SHARED, name, brdp) != 0) { printk("STALLION: failed to register interrupt " "routine for %s irq=%d\n", name, brdp->irq); rc = -ENODEV; @@ -2517,7 +2512,7 @@ static inline int stl_initech(stlbrd_t *brdp) outb((brdp->ioctrlval | ECH_BRDDISABLE), brdp->ioctrl); brdp->state |= BRD_FOUND; - if (request_irq(brdp->irq, stl_intr, SA_SHIRQ, name, brdp) != 0) { + if (request_irq(brdp->irq, stl_intr, IRQF_SHARED, name, brdp) != 0) { printk("STALLION: failed to register interrupt " "routine for %s irq=%d\n", name, brdp->irq); i = -ENODEV; @@ -3044,22 +3039,16 @@ static int __init stl_init(void) */ if (register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stl_fsiomem)) printk("STALLION: failed to register serial board device\n"); - devfs_mk_dir("staliomem"); stallion_class = class_create(THIS_MODULE, "staliomem"); - for (i = 0; i < 4; i++) { - devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i), - S_IFCHR|S_IRUSR|S_IWUSR, - "staliomem/%d", i); + for (i = 0; i < 4; i++) class_device_create(stallion_class, NULL, MKDEV(STL_SIOMEMMAJOR, i), NULL, "staliomem%d", i); - } stl_serial->owner = THIS_MODULE; stl_serial->driver_name = stl_drvname; stl_serial->name = "ttyE"; - stl_serial->devfs_name = "tts/E"; stl_serial->major = STL_SERIALMAJOR; stl_serial->minor_start = 0; stl_serial->type = TTY_DRIVER_TYPE_SERIAL; diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 76b9107f7f8..45c193aa11d 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c @@ -1993,7 +1993,7 @@ static int sx_init_board (struct sx_board *board) if(board->irq > 0) { /* fixed irq, probably PCI */ if(sx_irqmask & (1 << board->irq)) { /* may we use this irq? */ - if(request_irq(board->irq, sx_interrupt, SA_SHIRQ | SA_INTERRUPT, "sx", board)) { + if(request_irq(board->irq, sx_interrupt, IRQF_SHARED | IRQF_DISABLED, "sx", board)) { printk(KERN_ERR "sx: Cannot allocate irq %d.\n", board->irq); board->irq = 0; } @@ -2005,7 +2005,7 @@ static int sx_init_board (struct sx_board *board) int irqmask = sx_irqmask & (IS_SX_BOARD(board) ? SX_ISA_IRQ_MASK : SI2_ISA_IRQ_MASK); for(irqnr = 15; irqnr > 0; irqnr--) if(irqmask & (1 << irqnr)) - if(! request_irq(irqnr, sx_interrupt, SA_SHIRQ | SA_INTERRUPT, "sx", board)) + if(! request_irq(irqnr, sx_interrupt, IRQF_SHARED | IRQF_DISABLED, "sx", board)) break; if(! irqnr) printk(KERN_ERR "sx: Cannot allocate IRQ.\n"); diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index fee2aca3f6a..df782dd1098 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c @@ -8150,7 +8150,7 @@ static int __devinit synclink_init_one (struct pci_dev *dev, info->bus_type = MGSL_BUS_TYPE_PCI; info->io_addr_size = 8; - info->irq_flags = SA_SHIRQ; + info->irq_flags = IRQF_SHARED; if (dev->device == 0x0210) { /* Version 1 PCI9030 based universal PCI adapter */ diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 4e35d418122..e829594195c 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c @@ -46,7 +46,6 @@ //#define DBGRBUF(info) dump_rbufs(info) -#include <linux/config.h> #include <linux/module.h> #include <linux/version.h> #include <linux/errno.h> @@ -3344,7 +3343,7 @@ static struct slgt_info *alloc_dev(int adapter_num, int port_num, struct pci_dev info->phys_reg_addr = pci_resource_start(pdev,0); info->bus_type = MGSL_BUS_TYPE_PCI; - info->irq_flags = SA_SHIRQ; + info->irq_flags = IRQF_SHARED; info->init_error = -1; /* assume error, set to 0 on successful init */ } diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 21bf15ad998..1e443a233f5 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c @@ -34,7 +34,6 @@ #define MAX_DEVICES 12 -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/signal.h> @@ -3836,7 +3835,7 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev) info->phys_statctrl_base &= ~(PAGE_SIZE-1); info->bus_type = MGSL_BUS_TYPE_PCI; - info->irq_flags = SA_SHIRQ; + info->irq_flags = IRQF_SHARED; init_timer(&info->tx_timer); info->tx_timer.data = (unsigned long)info; diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 35082dc12ea..a064ee9181c 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c @@ -12,7 +12,6 @@ * based upon discusions in irc://irc.openprojects.net/#kernelnewbies */ -#include <linux/config.h> #include <linux/sched.h> #include <linux/interrupt.h> #include <linux/mm.h> diff --git a/drivers/char/tipar.c b/drivers/char/tipar.c index 079db5a935a..e0633a119d2 100644 --- a/drivers/char/tipar.c +++ b/drivers/char/tipar.c @@ -42,7 +42,6 @@ */ #undef DEBUG /* change to #define to get debugging * output - for pr_debug() */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/errno.h> @@ -56,7 +55,6 @@ #include <linux/ioport.h> #include <asm/io.h> #include <linux/bitops.h> -#include <linux/devfs_fs_kernel.h> /* DevFs support */ #include <linux/parport.h> /* Our code depend on parport */ #include <linux/device.h> @@ -443,12 +441,6 @@ tipar_register(int nr, struct parport *port) class_device_create(tipar_class, NULL, MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr), NULL, "par%d", nr); - /* Use devfs, tree: /dev/ticables/par/[0..2] */ - err = devfs_mk_cdev(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr), - S_IFCHR | S_IRUGO | S_IWUGO, - "ticables/par/%d", nr); - if (err) - goto out_class; /* Display informations */ pr_info("tipar%d: using %s (%s)\n", nr, port->name, (port->irq == @@ -460,11 +452,7 @@ tipar_register(int nr, struct parport *port) pr_info("tipar%d: link cable not found\n", nr); err = 0; - goto out; -out_class: - class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr)); - class_destroy(tipar_class); out: return err; } @@ -507,9 +495,6 @@ tipar_init_module(void) goto out; } - /* Use devfs with tree: /dev/ticables/par/[0..2] */ - devfs_mk_dir("ticables/par"); - tipar_class = class_create(THIS_MODULE, "ticables"); if (IS_ERR(tipar_class)) { err = PTR_ERR(tipar_class); @@ -528,7 +513,6 @@ out_class: class_destroy(tipar_class); out_chrdev: - devfs_remove("ticables/par"); unregister_chrdev(TIPAR_MAJOR, "tipar"); out: return err; @@ -549,10 +533,8 @@ tipar_cleanup_module(void) continue; parport_unregister_device(table[i].dev); class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, i)); - devfs_remove("ticables/par/%d", i); } class_destroy(tipar_class); - devfs_remove("ticables/par"); pr_info("tipar: module unloaded\n"); } diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index ef68d152d3e..952b829e2cb 100644 --- a/drivers/char/tlclk.c +++ b/drivers/char/tlclk.c @@ -27,7 +27,6 @@ * MPCBL0010 ATCA computer. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/sched.h> @@ -209,7 +208,7 @@ static int tlclk_open(struct inode *inode, struct file *filp) /* This device is wired through the FPGA IO space of the ATCA blade * we can't share this IRQ */ result = request_irq(telclk_interrupt, &tlclk_interrupt, - SA_INTERRUPT, "telco_clock", tlclk_interrupt); + IRQF_DISABLED, "telco_clock", tlclk_interrupt); if (result == -EBUSY) { printk(KERN_ERR "tlclk: Interrupt can't be reserved.\n"); return -EBUSY; diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 8ea70625f7e..abb0f2aeae6 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c @@ -522,7 +522,7 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, iowrite8(i, chip->vendor.iobase + TPM_INT_VECTOR(chip->vendor.locality)); if (request_irq - (i, tis_int_probe, SA_SHIRQ, + (i, tis_int_probe, IRQF_SHARED, chip->vendor.miscdev.name, chip) != 0) { dev_info(chip->dev, "Unable to request irq: %d for probe\n", @@ -557,7 +557,7 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, chip->vendor.iobase + TPM_INT_VECTOR(chip->vendor.locality)); if (request_irq - (chip->vendor.irq, tis_int_handler, SA_SHIRQ, + (chip->vendor.irq, tis_int_handler, IRQF_SHARED, chip->vendor.miscdev.name, chip) != 0) { dev_info(chip->dev, "Unable to request irq: %d for use\n", diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 8d19f7281f0..615e934da05 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -65,7 +65,6 @@ * alloc_tty_struct() always uses kmalloc() -- Andrew Morton <andrewm@uow.edu.eu> 17Mar01 */ -#include <linux/config.h> #include <linux/types.h> #include <linux/major.h> #include <linux/errno.h> @@ -102,7 +101,6 @@ #include <linux/kbd_kern.h> #include <linux/vt_kern.h> #include <linux/selection.h> -#include <linux/devfs_fs_kernel.h> #include <linux/kmod.h> @@ -2955,8 +2953,8 @@ static struct class *tty_class; * Returns a pointer to the class device (or ERR_PTR(-EFOO) on error). * * This call is required to be made to register an individual tty device if - * the tty driver's flags have the TTY_DRIVER_NO_DEVFS bit set. If that - * bit is not set, this function should not be called. + * the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If that + * bit is not set, this function should not be called by a tty driver. */ struct class_device *tty_register_device(struct tty_driver *driver, unsigned index, struct device *device) @@ -2970,9 +2968,6 @@ struct class_device *tty_register_device(struct tty_driver *driver, return ERR_PTR(-EINVAL); } - devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR, - "%s%d", driver->devfs_name, index + driver->name_base); - if (driver->type == TTY_DRIVER_TYPE_PTY) pty_line_name(driver, index, name); else @@ -2991,7 +2986,6 @@ struct class_device *tty_register_device(struct tty_driver *driver, */ void tty_unregister_device(struct tty_driver *driver, unsigned index) { - devfs_remove("%s%d", driver->devfs_name, index + driver->name_base); class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); } @@ -3113,7 +3107,7 @@ int tty_register_driver(struct tty_driver *driver) list_add(&driver->tty_drivers, &tty_drivers); - if ( !(driver->flags & TTY_DRIVER_NO_DEVFS) ) { + if ( !(driver->flags & TTY_DRIVER_DYNAMIC_DEV) ) { for(i = 0; i < driver->num; i++) tty_register_device(driver, i, NULL); } @@ -3156,7 +3150,7 @@ int tty_unregister_driver(struct tty_driver *driver) driver->termios_locked[i] = NULL; kfree(tp); } - if (!(driver->flags & TTY_DRIVER_NO_DEVFS)) + if (!(driver->flags & TTY_DRIVER_DYNAMIC_DEV)) tty_unregister_device(driver, i); } p = driver->ttys; @@ -3232,14 +3226,12 @@ static int __init tty_init(void) if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) panic("Couldn't register /dev/tty driver\n"); - devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 0), S_IFCHR|S_IRUGO|S_IWUGO, "tty"); class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty"); cdev_init(&console_cdev, &console_fops); if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) panic("Couldn't register /dev/console driver\n"); - devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 1), S_IFCHR|S_IRUSR|S_IWUSR, "console"); class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL, "console"); #ifdef CONFIG_UNIX98_PTYS @@ -3247,7 +3239,6 @@ static int __init tty_init(void) if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) panic("Couldn't register /dev/ptmx driver\n"); - devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 2), S_IFCHR|S_IRUGO|S_IWUGO, "ptmx"); class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); #endif @@ -3256,7 +3247,6 @@ static int __init tty_init(void) if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) panic("Couldn't register /dev/tty0 driver\n"); - devfs_mk_cdev(MKDEV(TTY_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vc/0"); class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); vty_init(); diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c index 3c1dafaa344..45e9bd81bc0 100644 --- a/drivers/char/vc_screen.c +++ b/drivers/char/vc_screen.c @@ -21,12 +21,10 @@ * - making it shorter - scr_readw are macros which expand in PRETTY long code */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/major.h> #include <linux/errno.h> #include <linux/tty.h> -#include <linux/devfs_fs_kernel.h> #include <linux/sched.h> #include <linux/interrupt.h> #include <linux/mm.h> @@ -478,12 +476,6 @@ static struct class *vc_class; void vcs_make_devfs(struct tty_struct *tty) { - devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 1), - S_IFCHR|S_IRUSR|S_IWUSR, - "vcc/%u", tty->index + 1); - devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 129), - S_IFCHR|S_IRUSR|S_IWUSR, - "vcc/a%u", tty->index + 1); class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), NULL, "vcs%u", tty->index + 1); class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), @@ -491,8 +483,6 @@ void vcs_make_devfs(struct tty_struct *tty) } void vcs_remove_devfs(struct tty_struct *tty) { - devfs_remove("vcc/%u", tty->index + 1); - devfs_remove("vcc/a%u", tty->index + 1); class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1)); class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129)); } @@ -503,8 +493,6 @@ int __init vcs_init(void) panic("unable to get major %d for vcs device", VCS_MAJOR); vc_class = class_create(THIS_MODULE, "vc"); - devfs_mk_cdev(MKDEV(VCS_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/0"); - devfs_mk_cdev(MKDEV(VCS_MAJOR, 128), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/a0"); class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); return 0; diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c index 4e536038874..766f7864c6c 100644 --- a/drivers/char/viocons.c +++ b/drivers/char/viocons.c @@ -25,7 +25,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/proc_fs.h> #include <linux/errno.h> @@ -1152,7 +1151,6 @@ static int __init viocons_init2(void) viotty_driver = alloc_tty_driver(VTTY_PORTS); viotty_driver->owner = THIS_MODULE; viotty_driver->driver_name = "vioconsole"; - viotty_driver->devfs_name = "vcs/"; viotty_driver->name = "tty"; viotty_driver->name_base = 1; viotty_driver->major = TTY_MAJOR; diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index 11c7e9de595..7d42c8ec8db 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c @@ -31,7 +31,6 @@ * the OS/400 partition. The format of the messages is defined in * iseries/vio.h */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> @@ -43,7 +42,6 @@ #include <linux/dma-mapping.h> #include <linux/fs.h> #include <linux/cdev.h> -#include <linux/devfs_fs_kernel.h> #include <linux/major.h> #include <linux/completion.h> #include <linux/proc_fs.h> @@ -246,7 +244,6 @@ static struct device *tape_device[VIOTAPE_MAX_TAPE]; */ static struct { unsigned char cur_part; - int dev_handle; unsigned char part_stat_rwi[MAX_PARTITIONS]; } state[VIOTAPE_MAX_TAPE]; @@ -959,12 +956,7 @@ static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id) "iseries!vt%d", i); class_device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), NULL, "iseries!nvt%d", i); - devfs_mk_cdev(MKDEV(VIOTAPE_MAJOR, i), S_IFCHR | S_IRUSR | S_IWUSR, - "iseries/vt%d", i); - devfs_mk_cdev(MKDEV(VIOTAPE_MAJOR, i | 0x80), - S_IFCHR | S_IRUSR | S_IWUSR, "iseries/nvt%d", i); sprintf(tapename, "iseries/vt%d", i); - state[i].dev_handle = devfs_register_tape(tapename); printk(VIOTAPE_KERN_INFO "tape %s is iSeries " "resource %10.10s type %4.4s, model %3.3s\n", tapename, viotape_unitinfo[i].rsrcname, @@ -976,9 +968,6 @@ static int viotape_remove(struct vio_dev *vdev) { int i = vdev->unit_address; - devfs_remove("iseries/nvt%d", i); - devfs_remove("iseries/vt%d", i); - devfs_unregister_tape(state[i].dev_handle); class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i | 0x80)); class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i)); return 0; diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c index fd00822ac14..bfe5ea948f6 100644 --- a/drivers/char/vme_scc.c +++ b/drivers/char/vme_scc.c @@ -14,7 +14,6 @@ */ #include <linux/module.h> -#include <linux/config.h> #include <linux/kdev_t.h> #include <asm/io.h> #include <linux/kernel.h> @@ -147,7 +146,6 @@ static int scc_init_drivers(void) scc_driver->owner = THIS_MODULE; scc_driver->driver_name = "scc"; scc_driver->name = "ttyS"; - scc_driver->devfs_name = "tts/"; scc_driver->major = TTY_MAJOR; scc_driver->minor_start = SCC_MINOR_BASE; scc_driver->type = TTY_DRIVER_TYPE_SERIAL; @@ -205,13 +203,13 @@ static int mvme147_scc_init(void) port->datap = port->ctrlp + 1; port->port_a = &scc_ports[0]; port->port_b = &scc_ports[1]; - request_irq(MVME147_IRQ_SCCA_TX, scc_tx_int, SA_INTERRUPT, + request_irq(MVME147_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, "SCC-A TX", port); - request_irq(MVME147_IRQ_SCCA_STAT, scc_stat_int, SA_INTERRUPT, + request_irq(MVME147_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, "SCC-A status", port); - request_irq(MVME147_IRQ_SCCA_RX, scc_rx_int, SA_INTERRUPT, + request_irq(MVME147_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, "SCC-A RX", port); - request_irq(MVME147_IRQ_SCCA_SPCOND, scc_spcond_int, SA_INTERRUPT, + request_irq(MVME147_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED, "SCC-A special cond", port); { SCC_ACCESS_INIT(port); @@ -232,13 +230,13 @@ static int mvme147_scc_init(void) port->datap = port->ctrlp + 1; port->port_a = &scc_ports[0]; port->port_b = &scc_ports[1]; - request_irq(MVME147_IRQ_SCCB_TX, scc_tx_int, SA_INTERRUPT, + request_irq(MVME147_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, "SCC-B TX", port); - request_irq(MVME147_IRQ_SCCB_STAT, scc_stat_int, SA_INTERRUPT, + request_irq(MVME147_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, "SCC-B status", port); - request_irq(MVME147_IRQ_SCCB_RX, scc_rx_int, SA_INTERRUPT, + request_irq(MVME147_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, "SCC-B RX", port); - request_irq(MVME147_IRQ_SCCB_SPCOND, scc_spcond_int, SA_INTERRUPT, + request_irq(MVME147_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED, "SCC-B special cond", port); { SCC_ACCESS_INIT(port); @@ -275,13 +273,13 @@ static int mvme162_scc_init(void) port->datap = port->ctrlp + 2; port->port_a = &scc_ports[0]; port->port_b = &scc_ports[1]; - request_irq(MVME162_IRQ_SCCA_TX, scc_tx_int, SA_INTERRUPT, + request_irq(MVME162_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, "SCC-A TX", port); - request_irq(MVME162_IRQ_SCCA_STAT, scc_stat_int, SA_INTERRUPT, + request_irq(MVME162_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, "SCC-A status", port); - request_irq(MVME162_IRQ_SCCA_RX, scc_rx_int, SA_INTERRUPT, + request_irq(MVME162_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, "SCC-A RX", port); - request_irq(MVME162_IRQ_SCCA_SPCOND, scc_spcond_int, SA_INTERRUPT, + request_irq(MVME162_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED, "SCC-A special cond", port); { SCC_ACCESS_INIT(port); @@ -302,13 +300,13 @@ static int mvme162_scc_init(void) port->datap = port->ctrlp + 2; port->port_a = &scc_ports[0]; port->port_b = &scc_ports[1]; - request_irq(MVME162_IRQ_SCCB_TX, scc_tx_int, SA_INTERRUPT, + request_irq(MVME162_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, "SCC-B TX", port); - request_irq(MVME162_IRQ_SCCB_STAT, scc_stat_int, SA_INTERRUPT, + request_irq(MVME162_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, "SCC-B status", port); - request_irq(MVME162_IRQ_SCCB_RX, scc_rx_int, SA_INTERRUPT, + request_irq(MVME162_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, "SCC-B RX", port); - request_irq(MVME162_IRQ_SCCB_SPCOND, scc_spcond_int, SA_INTERRUPT, + request_irq(MVME162_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED, "SCC-B special cond", port); { @@ -343,13 +341,13 @@ static int bvme6000_scc_init(void) port->datap = port->ctrlp + 4; port->port_a = &scc_ports[0]; port->port_b = &scc_ports[1]; - request_irq(BVME_IRQ_SCCA_TX, scc_tx_int, SA_INTERRUPT, + request_irq(BVME_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, "SCC-A TX", port); - request_irq(BVME_IRQ_SCCA_STAT, scc_stat_int, SA_INTERRUPT, + request_irq(BVME_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, "SCC-A status", port); - request_irq(BVME_IRQ_SCCA_RX, scc_rx_int, SA_INTERRUPT, + request_irq(BVME_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, "SCC-A RX", port); - request_irq(BVME_IRQ_SCCA_SPCOND, scc_spcond_int, SA_INTERRUPT, + request_irq(BVME_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED, "SCC-A special cond", port); { SCC_ACCESS_INIT(port); @@ -370,13 +368,13 @@ static int bvme6000_scc_init(void) port->datap = port->ctrlp + 4; port->port_a = &scc_ports[0]; port->port_b = &scc_ports[1]; - request_irq(BVME_IRQ_SCCB_TX, scc_tx_int, SA_INTERRUPT, + request_irq(BVME_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, "SCC-B TX", port); - request_irq(BVME_IRQ_SCCB_STAT, scc_stat_int, SA_INTERRUPT, + request_irq(BVME_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, "SCC-B status", port); - request_irq(BVME_IRQ_SCCB_RX, scc_rx_int, SA_INTERRUPT, + request_irq(BVME_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, "SCC-B RX", port); - request_irq(BVME_IRQ_SCCB_SPCOND, scc_spcond_int, SA_INTERRUPT, + request_irq(BVME_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED, "SCC-B special cond", port); { diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c index 05e6e814d86..073da48c092 100644 --- a/drivers/char/vr41xx_giu.c +++ b/drivers/char/vr41xx_giu.c @@ -689,9 +689,9 @@ static int __devinit giu_probe(struct platform_device *dev) for (i = GIU_IRQ_BASE; i <= GIU_IRQ_LAST; i++) { if (i < GIU_IRQ(GIUINT_HIGH_OFFSET)) - irq_desc[i].handler = &giuint_low_irq_type; + irq_desc[i].chip = &giuint_low_irq_type; else - irq_desc[i].handler = &giuint_high_irq_type; + irq_desc[i].chip = &giuint_high_irq_type; } return cascade_irq(GIUINT_IRQ, giu_get_irq); diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 714d95ff2f1..3ef823d7d25 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c @@ -79,7 +79,6 @@ #include <linux/mm.h> #include <linux/console.h> #include <linux/init.h> -#include <linux/devfs_fs_kernel.h> #include <linux/vt_kern.h> #include <linux/selection.h> #include <linux/tiocl.h> @@ -87,7 +86,6 @@ #include <linux/consolemap.h> #include <linux/timer.h> #include <linux/interrupt.h> -#include <linux/config.h> #include <linux/workqueue.h> #include <linux/bootmem.h> #include <linux/pm.h> @@ -2663,7 +2661,6 @@ int __init vty_init(void) if (!console_driver) panic("Couldn't allocate console driver\n"); console_driver->owner = THIS_MODULE; - console_driver->devfs_name = "vc/"; console_driver->name = "tty"; console_driver->name_base = 1; console_driver->major = TTY_MAJOR; diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 24011e7c81f..eccffaf26fa 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c @@ -10,7 +10,6 @@ * Check put/get_user, cleanups - acme@conectiva.com.br - Jun 2001 */ -#include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/sched.h> diff --git a/drivers/char/watchdog/at91_wdt.c b/drivers/char/watchdog/at91_wdt.c index 00080655533..f61dedc3c96 100644 --- a/drivers/char/watchdog/at91_wdt.c +++ b/drivers/char/watchdog/at91_wdt.c @@ -9,7 +9,6 @@ * 2 of the License, or (at your option) any later version. */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/fs.h> #include <linux/init.h> diff --git a/drivers/char/watchdog/booke_wdt.c b/drivers/char/watchdog/booke_wdt.c index b6640606b44..537f5c6729b 100644 --- a/drivers/char/watchdog/booke_wdt.c +++ b/drivers/char/watchdog/booke_wdt.c @@ -14,7 +14,6 @@ * option) any later version. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/miscdevice.h> diff --git a/drivers/char/watchdog/eurotechwdt.c b/drivers/char/watchdog/eurotechwdt.c index 25c2f257561..ea670de4fab 100644 --- a/drivers/char/watchdog/eurotechwdt.c +++ b/drivers/char/watchdog/eurotechwdt.c @@ -40,7 +40,6 @@ * Added Matt Domsch's nowayout module option. */ -#include <linux/config.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/moduleparam.h> @@ -421,7 +420,7 @@ static int __init eurwdt_init(void) goto out; } - ret = request_irq(irq, eurwdt_interrupt, SA_INTERRUPT, "eurwdt", NULL); + ret = request_irq(irq, eurwdt_interrupt, IRQF_DISABLED, "eurwdt", NULL); if(ret) { printk(KERN_ERR "eurwdt: IRQ %d is not free.\n", irq); goto outmisc; diff --git a/drivers/char/watchdog/ib700wdt.c b/drivers/char/watchdog/ib700wdt.c index cf60329eec8..a2e53c715b3 100644 --- a/drivers/char/watchdog/ib700wdt.c +++ b/drivers/char/watchdog/ib700wdt.c @@ -31,7 +31,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/miscdevice.h> diff --git a/drivers/char/watchdog/ibmasr.c b/drivers/char/watchdog/ibmasr.c index 294c474ae48..b0741cbdc13 100644 --- a/drivers/char/watchdog/ibmasr.c +++ b/drivers/char/watchdog/ibmasr.c @@ -10,7 +10,6 @@ * of the GNU Public License, incorporated herein by reference. */ -#include <linux/config.h> #include <linux/fs.h> #include <linux/kernel.h> #include <linux/slab.h> diff --git a/drivers/char/watchdog/indydog.c b/drivers/char/watchdog/indydog.c index b4b94daba67..d387979b243 100644 --- a/drivers/char/watchdog/indydog.c +++ b/drivers/char/watchdog/indydog.c @@ -13,7 +13,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/fs.h> diff --git a/drivers/char/watchdog/ixp2000_wdt.c b/drivers/char/watchdog/ixp2000_wdt.c index 0cfb9b9c4a4..aa29a7d6875 100644 --- a/drivers/char/watchdog/ixp2000_wdt.c +++ b/drivers/char/watchdog/ixp2000_wdt.c @@ -16,7 +16,6 @@ * warranty of any kind, whether express or implied. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/types.h> diff --git a/drivers/char/watchdog/ixp4xx_wdt.c b/drivers/char/watchdog/ixp4xx_wdt.c index 3800835ca8f..e6a3fe83fa0 100644 --- a/drivers/char/watchdog/ixp4xx_wdt.c +++ b/drivers/char/watchdog/ixp4xx_wdt.c @@ -13,7 +13,6 @@ * warranty of any kind, whether express or implied. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/types.h> diff --git a/drivers/char/watchdog/machzwd.c b/drivers/char/watchdog/machzwd.c index a9a20aad61e..b67b4878ae0 100644 --- a/drivers/char/watchdog/machzwd.c +++ b/drivers/char/watchdog/machzwd.c @@ -28,7 +28,6 @@ * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/types.h> diff --git a/drivers/char/watchdog/mixcomwd.c b/drivers/char/watchdog/mixcomwd.c index d8dede57540..433c27f9815 100644 --- a/drivers/char/watchdog/mixcomwd.c +++ b/drivers/char/watchdog/mixcomwd.c @@ -37,7 +37,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/miscdevice.h> #include <linux/ioport.h> diff --git a/drivers/char/watchdog/mpc83xx_wdt.c b/drivers/char/watchdog/mpc83xx_wdt.c index 5d6f5061603..dac1381af36 100644 --- a/drivers/char/watchdog/mpc83xx_wdt.c +++ b/drivers/char/watchdog/mpc83xx_wdt.c @@ -15,7 +15,6 @@ * option) any later version. */ -#include <linux/config.h> #include <linux/fs.h> #include <linux/init.h> #include <linux/kernel.h> diff --git a/drivers/char/watchdog/mpc8xx_wdt.c b/drivers/char/watchdog/mpc8xx_wdt.c index b2fc71e2085..11f0ccd4c4d 100644 --- a/drivers/char/watchdog/mpc8xx_wdt.c +++ b/drivers/char/watchdog/mpc8xx_wdt.c @@ -9,7 +9,6 @@ * or implied. */ -#include <linux/config.h> #include <linux/fs.h> #include <linux/init.h> #include <linux/kernel.h> diff --git a/drivers/char/watchdog/mpcore_wdt.c b/drivers/char/watchdog/mpcore_wdt.c index 2c2c5177320..c2d492c852f 100644 --- a/drivers/char/watchdog/mpcore_wdt.c +++ b/drivers/char/watchdog/mpcore_wdt.c @@ -21,7 +21,6 @@ */ #include <linux/module.h> #include <linux/moduleparam.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/miscdevice.h> #include <linux/watchdog.h> @@ -356,7 +355,7 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev) goto err_misc; } - ret = request_irq(wdt->irq, mpcore_wdt_fire, SA_INTERRUPT, "mpcore_wdt", wdt); + ret = request_irq(wdt->irq, mpcore_wdt_fire, IRQF_DISABLED, "mpcore_wdt", wdt); if (ret) { dev_printk(KERN_ERR, _dev, "cannot register IRQ%d for watchdog\n", wdt->irq); goto err_irq; diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c index f1b9cf89f15..20a6cbb0fbb 100644 --- a/drivers/char/watchdog/mv64x60_wdt.c +++ b/drivers/char/watchdog/mv64x60_wdt.c @@ -15,7 +15,6 @@ * or implied. */ -#include <linux/config.h> #include <linux/fs.h> #include <linux/init.h> #include <linux/kernel.h> diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c index 0d072bed501..92bf8c1a0f0 100644 --- a/drivers/char/watchdog/pcwd_usb.c +++ b/drivers/char/watchdog/pcwd_usb.c @@ -24,7 +24,6 @@ * http://www.berkprod.com/ or http://www.pcwatchdog.com/ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c index 1ea04e9b2b0..f267dad2607 100644 --- a/drivers/char/watchdog/s3c2410_wdt.c +++ b/drivers/char/watchdog/s3c2410_wdt.c @@ -37,7 +37,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/timer.h> #include <linux/miscdevice.h> diff --git a/drivers/char/watchdog/sa1100_wdt.c b/drivers/char/watchdog/sa1100_wdt.c index 522a9370db9..b22e95c5470 100644 --- a/drivers/char/watchdog/sa1100_wdt.c +++ b/drivers/char/watchdog/sa1100_wdt.c @@ -17,7 +17,6 @@ * * 27/11/2000 Initial release */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/types.h> diff --git a/drivers/char/watchdog/sbc8360.c b/drivers/char/watchdog/sbc8360.c index c6cbf808d8c..6562aa910ac 100644 --- a/drivers/char/watchdog/sbc8360.c +++ b/drivers/char/watchdog/sbc8360.c @@ -36,7 +36,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/miscdevice.h> diff --git a/drivers/char/watchdog/sbc_epx_c3.c b/drivers/char/watchdog/sbc_epx_c3.c index 837b1ec3ffe..09867fadc72 100644 --- a/drivers/char/watchdog/sbc_epx_c3.c +++ b/drivers/char/watchdog/sbc_epx_c3.c @@ -15,7 +15,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/fs.h> diff --git a/drivers/char/watchdog/sc1200wdt.c b/drivers/char/watchdog/sc1200wdt.c index 20b88f9b7be..78ef6333c18 100644 --- a/drivers/char/watchdog/sc1200wdt.c +++ b/drivers/char/watchdog/sc1200wdt.c @@ -27,7 +27,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/miscdevice.h> diff --git a/drivers/char/watchdog/scx200_wdt.c b/drivers/char/watchdog/scx200_wdt.c index b4a102a2d7e..c0b4754e8de 100644 --- a/drivers/char/watchdog/scx200_wdt.c +++ b/drivers/char/watchdog/scx200_wdt.c @@ -17,7 +17,6 @@ of any nature resulting due to the use of this software. This software is provided AS-IS with no warranties. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> diff --git a/drivers/char/watchdog/shwdt.c b/drivers/char/watchdog/shwdt.c index 1f4cab55b2e..803701b675c 100644 --- a/drivers/char/watchdog/shwdt.c +++ b/drivers/char/watchdog/shwdt.c @@ -17,7 +17,6 @@ * Added expect close support, made emulated timeout runtime changeable * general cleanups, add some ioctls */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> diff --git a/drivers/char/watchdog/softdog.c b/drivers/char/watchdog/softdog.c index a91edaf3a35..79ce5c65542 100644 --- a/drivers/char/watchdog/softdog.c +++ b/drivers/char/watchdog/softdog.c @@ -38,7 +38,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/timer.h> #include <linux/miscdevice.h> diff --git a/drivers/char/watchdog/w83977f_wdt.c b/drivers/char/watchdog/w83977f_wdt.c index a7ff64c8921..c31849e4c5c 100644 --- a/drivers/char/watchdog/w83977f_wdt.c +++ b/drivers/char/watchdog/w83977f_wdt.c @@ -17,7 +17,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/fs.h> diff --git a/drivers/char/watchdog/wd501p.h b/drivers/char/watchdog/wd501p.h index 84e60eb7433..a4504f40394 100644 --- a/drivers/char/watchdog/wd501p.h +++ b/drivers/char/watchdog/wd501p.h @@ -19,7 +19,6 @@ * */ -#include <linux/config.h> #define WDT_COUNT0 (io+0) #define WDT_COUNT1 (io+1) diff --git a/drivers/char/watchdog/wdrtas.c b/drivers/char/watchdog/wdrtas.c index dacfe31cacc..3a462c34b92 100644 --- a/drivers/char/watchdog/wdrtas.c +++ b/drivers/char/watchdog/wdrtas.c @@ -26,7 +26,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/fs.h> #include <linux/init.h> #include <linux/kernel.h> diff --git a/drivers/char/watchdog/wdt.c b/drivers/char/watchdog/wdt.c index ec7e401228e..a1d972c8f44 100644 --- a/drivers/char/watchdog/wdt.c +++ b/drivers/char/watchdog/wdt.c @@ -31,7 +31,6 @@ * Matt Domsch : Added nowayout module option */ -#include <linux/config.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/moduleparam.h> @@ -581,7 +580,7 @@ static int __init wdt_init(void) goto out; } - ret = request_irq(irq, wdt_interrupt, SA_INTERRUPT, "wdt501p", NULL); + ret = request_irq(irq, wdt_interrupt, IRQF_DISABLED, "wdt501p", NULL); if(ret) { printk(KERN_ERR "wdt: IRQ %d is not free.\n", irq); goto outreg; diff --git a/drivers/char/watchdog/wdt977.c b/drivers/char/watchdog/wdt977.c index 3843900e94c..3cde2b9bb76 100644 --- a/drivers/char/watchdog/wdt977.c +++ b/drivers/char/watchdog/wdt977.c @@ -24,7 +24,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/fs.h> diff --git a/drivers/char/watchdog/wdt_pci.c b/drivers/char/watchdog/wdt_pci.c index 4b3311993d4..7529ecdbaba 100644 --- a/drivers/char/watchdog/wdt_pci.c +++ b/drivers/char/watchdog/wdt_pci.c @@ -35,7 +35,6 @@ * Matt Domsch : nowayout module option */ -#include <linux/config.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/moduleparam.h> @@ -618,7 +617,7 @@ static int __devinit wdtpci_init_one (struct pci_dev *dev, goto out_pci; } - if (request_irq (irq, wdtpci_interrupt, SA_INTERRUPT | SA_SHIRQ, + if (request_irq (irq, wdtpci_interrupt, IRQF_DISABLED | IRQF_SHARED, "wdt_pci", &wdtpci_miscdev)) { printk (KERN_ERR PFX "IRQ %d is not free\n", irq); goto out_reg; diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 35e0b9ceecf..1ba4039777e 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -15,7 +15,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 145061b8472..25eee539420 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -9,7 +9,6 @@ * published by the Free Software Foundation. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sysdev.h> #include <linux/cpu.h> diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c index 071ee4f1bbf..44ae5e5b94c 100644 --- a/drivers/cpufreq/cpufreq_userspace.c +++ b/drivers/cpufreq/cpufreq_userspace.c @@ -11,7 +11,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/smp.h> diff --git a/drivers/dma/ioatdma.c b/drivers/dma/ioatdma.c index 2801d14a5e4..ecad8f65d2d 100644 --- a/drivers/dma/ioatdma.c +++ b/drivers/dma/ioatdma.c @@ -739,7 +739,7 @@ static int __devinit ioat_probe(struct pci_dev *pdev, device->msi = 0; } #endif - err = request_irq(pdev->irq, &ioat_do_interrupt, SA_SHIRQ, "ioat", + err = request_irq(pdev->irq, &ioat_do_interrupt, IRQF_SHARED, "ioat", device); if (err) goto err_irq; diff --git a/drivers/edac/amd76x_edac.c b/drivers/edac/amd76x_edac.c index 53423ad6d4a..f79f6b587bf 100644 --- a/drivers/edac/amd76x_edac.c +++ b/drivers/edac/amd76x_edac.c @@ -12,7 +12,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/pci.h> @@ -20,6 +19,9 @@ #include <linux/slab.h> #include "edac_mc.h" +#define AMD76X_REVISION " Ver: 2.0.1 " __DATE__ +#define EDAC_MOD_STR "amd76x_edac" + #define amd76x_printk(level, fmt, arg...) \ edac_printk(level, "amd76x", fmt, ##arg) @@ -102,15 +104,18 @@ static const struct amd76x_dev_info amd76x_devs[] = { static void amd76x_get_error_info(struct mem_ctl_info *mci, struct amd76x_error_info *info) { - pci_read_config_dword(mci->pdev, AMD76X_ECC_MODE_STATUS, + struct pci_dev *pdev; + + pdev = to_pci_dev(mci->dev); + pci_read_config_dword(pdev, AMD76X_ECC_MODE_STATUS, &info->ecc_mode_status); if (info->ecc_mode_status & BIT(8)) - pci_write_bits32(mci->pdev, AMD76X_ECC_MODE_STATUS, + pci_write_bits32(pdev, AMD76X_ECC_MODE_STATUS, (u32) BIT(8), (u32) BIT(8)); if (info->ecc_mode_status & BIT(9)) - pci_write_bits32(mci->pdev, AMD76X_ECC_MODE_STATUS, + pci_write_bits32(pdev, AMD76X_ECC_MODE_STATUS, (u32) BIT(9), (u32) BIT(9)); } @@ -176,6 +181,38 @@ static void amd76x_check(struct mem_ctl_info *mci) amd76x_process_error_info(mci, &info, 1); } +static void amd76x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, + enum edac_type edac_mode) +{ + struct csrow_info *csrow; + u32 mba, mba_base, mba_mask, dms; + int index; + + for (index = 0; index < mci->nr_csrows; index++) { + csrow = &mci->csrows[index]; + + /* find the DRAM Chip Select Base address and mask */ + pci_read_config_dword(pdev, + AMD76X_MEM_BASE_ADDR + (index * 4), + &mba); + + if (!(mba & BIT(0))) + continue; + + mba_base = mba & 0xff800000UL; + mba_mask = ((mba & 0xff80) << 16) | 0x7fffffUL; + pci_read_config_dword(pdev, AMD76X_DRAM_MODE_STATUS, &dms); + csrow->first_page = mba_base >> PAGE_SHIFT; + csrow->nr_pages = (mba_mask + 1) >> PAGE_SHIFT; + csrow->last_page = csrow->first_page + csrow->nr_pages - 1; + csrow->page_mask = mba_mask >> PAGE_SHIFT; + csrow->grain = csrow->nr_pages << PAGE_SHIFT; + csrow->mtype = MEM_RDDR; + csrow->dtype = ((dms >> index) & 0x1) ? DEV_X4 : DEV_UNKNOWN; + csrow->edac_mode = edac_mode; + } +} + /** * amd76x_probe1 - Perform set up for detected device * @pdev; PCI device detected @@ -187,15 +224,13 @@ static void amd76x_check(struct mem_ctl_info *mci) */ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx) { - int rc = -ENODEV; - int index; - struct mem_ctl_info *mci = NULL; - enum edac_type ems_modes[] = { + static const enum edac_type ems_modes[] = { EDAC_NONE, EDAC_EC, EDAC_SECDED, EDAC_SECDED }; + struct mem_ctl_info *mci = NULL; u32 ems; u32 ems_mode; struct amd76x_error_info discard; @@ -206,53 +241,28 @@ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx) mci = edac_mc_alloc(0, AMD76X_NR_CSROWS, AMD76X_NR_CHANS); if (mci == NULL) { - rc = -ENOMEM; - goto fail; + return -ENOMEM; } debugf0("%s(): mci = %p\n", __func__, mci); - mci->pdev = pdev; + mci->dev = &pdev->dev; mci->mtype_cap = MEM_FLAG_RDDR; mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_EC | EDAC_FLAG_SECDED; mci->edac_cap = ems_mode ? (EDAC_FLAG_EC | EDAC_FLAG_SECDED) : EDAC_FLAG_NONE; mci->mod_name = EDAC_MOD_STR; - mci->mod_ver = "$Revision: 1.4.2.5 $"; + mci->mod_ver = AMD76X_REVISION; mci->ctl_name = amd76x_devs[dev_idx].ctl_name; mci->edac_check = amd76x_check; mci->ctl_page_to_phys = NULL; - for (index = 0; index < mci->nr_csrows; index++) { - struct csrow_info *csrow = &mci->csrows[index]; - u32 mba; - u32 mba_base; - u32 mba_mask; - u32 dms; - - /* find the DRAM Chip Select Base address and mask */ - pci_read_config_dword(mci->pdev, - AMD76X_MEM_BASE_ADDR + (index * 4), &mba); - - if (!(mba & BIT(0))) - continue; - - mba_base = mba & 0xff800000UL; - mba_mask = ((mba & 0xff80) << 16) | 0x7fffffUL; - pci_read_config_dword(mci->pdev, AMD76X_DRAM_MODE_STATUS, - &dms); - csrow->first_page = mba_base >> PAGE_SHIFT; - csrow->nr_pages = (mba_mask + 1) >> PAGE_SHIFT; - csrow->last_page = csrow->first_page + csrow->nr_pages - 1; - csrow->page_mask = mba_mask >> PAGE_SHIFT; - csrow->grain = csrow->nr_pages << PAGE_SHIFT; - csrow->mtype = MEM_RDDR; - csrow->dtype = ((dms >> index) & 0x1) ? DEV_X4 : DEV_UNKNOWN; - csrow->edac_mode = ems_modes[ems_mode]; - } - + amd76x_init_csrows(mci, pdev, ems_modes[ems_mode]); amd76x_get_error_info(mci, &discard); /* clear counters */ - if (edac_mc_add_mc(mci)) { + /* Here we assume that we will never see multiple instances of this + * type of memory controller. The ID is therefore hardcoded to 0. + */ + if (edac_mc_add_mc(mci,0)) { debugf3("%s(): failed edac_mc_add_mc()\n", __func__); goto fail; } @@ -262,9 +272,8 @@ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx) return 0; fail: - if (mci != NULL) - edac_mc_free(mci); - return rc; + edac_mc_free(mci); + return -ENODEV; } /* returns count (>= 0), or negative on error */ @@ -291,7 +300,7 @@ static void __devexit amd76x_remove_one(struct pci_dev *pdev) debugf0("%s()\n", __func__); - if ((mci = edac_mc_del_mc(pdev)) == NULL) + if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL) return; edac_mc_free(mci); diff --git a/drivers/edac/e752x_edac.c b/drivers/edac/e752x_edac.c index fce31936e6d..c82bc0ed7f1 100644 --- a/drivers/edac/e752x_edac.c +++ b/drivers/edac/e752x_edac.c @@ -17,7 +17,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/pci.h> @@ -25,6 +24,9 @@ #include <linux/slab.h> #include "edac_mc.h" +#define E752X_REVISION " Ver: 2.0.1 " __DATE__ +#define EDAC_MOD_STR "e752x_edac" + static int force_function_unhide; #define e752x_printk(level, fmt, arg...) \ @@ -763,22 +765,174 @@ static void e752x_check(struct mem_ctl_info *mci) e752x_process_error_info(mci, &info, 1); } -static int e752x_probe1(struct pci_dev *pdev, int dev_idx) +/* Return 1 if dual channel mode is active. Else return 0. */ +static inline int dual_channel_active(u16 ddrcsr) +{ + return (((ddrcsr >> 12) & 3) == 3); +} + +static void e752x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, + u16 ddrcsr) +{ + struct csrow_info *csrow; + unsigned long last_cumul_size; + int index, mem_dev, drc_chan; + int drc_drbg; /* DRB granularity 0=64mb, 1=128mb */ + int drc_ddim; /* DRAM Data Integrity Mode 0=none, 2=edac */ + u8 value; + u32 dra, drc, cumul_size; + + pci_read_config_dword(pdev, E752X_DRA, &dra); + pci_read_config_dword(pdev, E752X_DRC, &drc); + drc_chan = dual_channel_active(ddrcsr); + drc_drbg = drc_chan + 1; /* 128 in dual mode, 64 in single */ + drc_ddim = (drc >> 20) & 0x3; + + /* The dram row boundary (DRB) reg values are boundary address for + * each DRAM row with a granularity of 64 or 128MB (single/dual + * channel operation). DRB regs are cumulative; therefore DRB7 will + * contain the total memory contained in all eight rows. + */ + for (last_cumul_size = index = 0; index < mci->nr_csrows; index++) { + /* mem_dev 0=x8, 1=x4 */ + mem_dev = (dra >> (index * 4 + 2)) & 0x3; + csrow = &mci->csrows[index]; + + mem_dev = (mem_dev == 2); + pci_read_config_byte(pdev, E752X_DRB + index, &value); + /* convert a 128 or 64 MiB DRB to a page size. */ + cumul_size = value << (25 + drc_drbg - PAGE_SHIFT); + debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index, + cumul_size); + if (cumul_size == last_cumul_size) + continue; /* not populated */ + + csrow->first_page = last_cumul_size; + csrow->last_page = cumul_size - 1; + csrow->nr_pages = cumul_size - last_cumul_size; + last_cumul_size = cumul_size; + csrow->grain = 1 << 12; /* 4KiB - resolution of CELOG */ + csrow->mtype = MEM_RDDR; /* only one type supported */ + csrow->dtype = mem_dev ? DEV_X4 : DEV_X8; + + /* + * if single channel or x8 devices then SECDED + * if dual channel and x4 then S4ECD4ED + */ + if (drc_ddim) { + if (drc_chan && mem_dev) { + csrow->edac_mode = EDAC_S4ECD4ED; + mci->edac_cap |= EDAC_FLAG_S4ECD4ED; + } else { + csrow->edac_mode = EDAC_SECDED; + mci->edac_cap |= EDAC_FLAG_SECDED; + } + } else + csrow->edac_mode = EDAC_NONE; + } +} + +static void e752x_init_mem_map_table(struct pci_dev *pdev, + struct e752x_pvt *pvt) { - int rc = -ENODEV; int index; + u8 value, last, row, stat8; + + last = 0; + row = 0; + + for (index = 0; index < 8; index += 2) { + pci_read_config_byte(pdev, E752X_DRB + index, &value); + /* test if there is a dimm in this slot */ + if (value == last) { + /* no dimm in the slot, so flag it as empty */ + pvt->map[index] = 0xff; + pvt->map[index + 1] = 0xff; + } else { /* there is a dimm in the slot */ + pvt->map[index] = row; + row++; + last = value; + /* test the next value to see if the dimm is double + * sided + */ + pci_read_config_byte(pdev, E752X_DRB + index + 1, + &value); + pvt->map[index + 1] = (value == last) ? + 0xff : /* the dimm is single sided, + so flag as empty */ + row; /* this is a double sided dimm + to save the next row # */ + row++; + last = value; + } + } + + /* set the map type. 1 = normal, 0 = reversed */ + pci_read_config_byte(pdev, E752X_DRM, &stat8); + pvt->map_type = ((stat8 & 0x0f) > ((stat8 >> 4) & 0x0f)); +} + +/* Return 0 on success or 1 on failure. */ +static int e752x_get_devs(struct pci_dev *pdev, int dev_idx, + struct e752x_pvt *pvt) +{ + struct pci_dev *dev; + + pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL, + pvt->dev_info->err_dev, + pvt->bridge_ck); + + if (pvt->bridge_ck == NULL) + pvt->bridge_ck = pci_scan_single_device(pdev->bus, + PCI_DEVFN(0, 1)); + + if (pvt->bridge_ck == NULL) { + e752x_printk(KERN_ERR, "error reporting device not found:" + "vendor %x device 0x%x (broken BIOS?)\n", + PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].err_dev); + return 1; + } + + dev = pci_get_device(PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].ctl_dev, + NULL); + + if (dev == NULL) + goto fail; + + pvt->dev_d0f0 = dev; + pvt->dev_d0f1 = pci_dev_get(pvt->bridge_ck); + + return 0; + +fail: + pci_dev_put(pvt->bridge_ck); + return 1; +} + +static void e752x_init_error_reporting_regs(struct e752x_pvt *pvt) +{ + struct pci_dev *dev; + + dev = pvt->dev_d0f1; + /* Turn off error disable & SMI in case the BIOS turned it on */ + pci_write_config_byte(dev, E752X_HI_ERRMASK, 0x00); + pci_write_config_byte(dev, E752X_HI_SMICMD, 0x00); + pci_write_config_word(dev, E752X_SYSBUS_ERRMASK, 0x00); + pci_write_config_word(dev, E752X_SYSBUS_SMICMD, 0x00); + pci_write_config_byte(dev, E752X_BUF_ERRMASK, 0x00); + pci_write_config_byte(dev, E752X_BUF_SMICMD, 0x00); + pci_write_config_byte(dev, E752X_DRAM_ERRMASK, 0x00); + pci_write_config_byte(dev, E752X_DRAM_SMICMD, 0x00); +} + +static int e752x_probe1(struct pci_dev *pdev, int dev_idx) +{ u16 pci_data; u8 stat8; - struct mem_ctl_info *mci = NULL; - struct e752x_pvt *pvt = NULL; + struct mem_ctl_info *mci; + struct e752x_pvt *pvt; u16 ddrcsr; - u32 drc; int drc_chan; /* Number of channels 0=1chan,1=2chan */ - int drc_drbg; /* DRB granularity 0=64mb, 1=128mb */ - int drc_ddim; /* DRAM Data Integrity Mode 0=none,2=edac */ - u32 dra; - unsigned long last_cumul_size; - struct pci_dev *dev = NULL; struct e752x_error_info discard; debugf0("%s(): mci\n", __func__); @@ -792,25 +946,20 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) if (!force_function_unhide && !(stat8 & (1 << 5))) { printk(KERN_INFO "Contact your BIOS vendor to see if the " "E752x error registers can be safely un-hidden\n"); - goto fail; + return -ENOMEM; } stat8 |= (1 << 5); pci_write_config_byte(pdev, E752X_DEVPRES1, stat8); - /* need to find out the number of channels */ - pci_read_config_dword(pdev, E752X_DRC, &drc); pci_read_config_word(pdev, E752X_DDRCSR, &ddrcsr); /* FIXME: should check >>12 or 0xf, true for all? */ /* Dual channel = 1, Single channel = 0 */ - drc_chan = (((ddrcsr >> 12) & 3) == 3); - drc_drbg = drc_chan + 1; /* 128 in dual mode, 64 in single */ - drc_ddim = (drc >> 20) & 0x3; + drc_chan = dual_channel_active(ddrcsr); mci = edac_mc_alloc(sizeof(*pvt), E752X_NR_CSROWS, drc_chan + 1); if (mci == NULL) { - rc = -ENOMEM; - goto fail; + return -ENOMEM; } debugf3("%s(): init mci\n", __func__); @@ -819,159 +968,54 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) EDAC_FLAG_S4ECD4ED; /* FIXME - what if different memory types are in different csrows? */ mci->mod_name = EDAC_MOD_STR; - mci->mod_ver = "$Revision: 1.5.2.11 $"; - mci->pdev = pdev; + mci->mod_ver = E752X_REVISION; + mci->dev = &pdev->dev; debugf3("%s(): init pvt\n", __func__); pvt = (struct e752x_pvt *) mci->pvt_info; pvt->dev_info = &e752x_devs[dev_idx]; - pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL, - pvt->dev_info->err_dev, - pvt->bridge_ck); - - if (pvt->bridge_ck == NULL) - pvt->bridge_ck = pci_scan_single_device(pdev->bus, - PCI_DEVFN(0, 1)); + pvt->mc_symmetric = ((ddrcsr & 0x10) != 0); - if (pvt->bridge_ck == NULL) { - e752x_printk(KERN_ERR, "error reporting device not found:" - "vendor %x device 0x%x (broken BIOS?)\n", - PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].err_dev); - goto fail; + if (e752x_get_devs(pdev, dev_idx, pvt)) { + edac_mc_free(mci); + return -ENODEV; } - pvt->mc_symmetric = ((ddrcsr & 0x10) != 0); debugf3("%s(): more mci init\n", __func__); mci->ctl_name = pvt->dev_info->ctl_name; mci->edac_check = e752x_check; mci->ctl_page_to_phys = ctl_page_to_phys; - /* find out the device types */ - pci_read_config_dword(pdev, E752X_DRA, &dra); - - /* - * The dram row boundary (DRB) reg values are boundary address for - * each DRAM row with a granularity of 64 or 128MB (single/dual - * channel operation). DRB regs are cumulative; therefore DRB7 will - * contain the total memory contained in all eight rows. - */ - for (last_cumul_size = index = 0; index < mci->nr_csrows; index++) { - u8 value; - u32 cumul_size; - - /* mem_dev 0=x8, 1=x4 */ - int mem_dev = (dra >> (index * 4 + 2)) & 0x3; - struct csrow_info *csrow = &mci->csrows[index]; - - mem_dev = (mem_dev == 2); - pci_read_config_byte(mci->pdev, E752X_DRB + index, &value); - /* convert a 128 or 64 MiB DRB to a page size. */ - cumul_size = value << (25 + drc_drbg - PAGE_SHIFT); - debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index, - cumul_size); - - if (cumul_size == last_cumul_size) - continue; /* not populated */ - - csrow->first_page = last_cumul_size; - csrow->last_page = cumul_size - 1; - csrow->nr_pages = cumul_size - last_cumul_size; - last_cumul_size = cumul_size; - csrow->grain = 1 << 12; /* 4KiB - resolution of CELOG */ - csrow->mtype = MEM_RDDR; /* only one type supported */ - csrow->dtype = mem_dev ? DEV_X4 : DEV_X8; - - /* - * if single channel or x8 devices then SECDED - * if dual channel and x4 then S4ECD4ED - */ - if (drc_ddim) { - if (drc_chan && mem_dev) { - csrow->edac_mode = EDAC_S4ECD4ED; - mci->edac_cap |= EDAC_FLAG_S4ECD4ED; - } else { - csrow->edac_mode = EDAC_SECDED; - mci->edac_cap |= EDAC_FLAG_SECDED; - } - } else - csrow->edac_mode = EDAC_NONE; - } - - /* Fill in the memory map table */ - { - u8 value; - u8 last = 0; - u8 row = 0; - - for (index = 0; index < 8; index += 2) { - pci_read_config_byte(mci->pdev, E752X_DRB + index, - &value); - - /* test if there is a dimm in this slot */ - if (value == last) { - /* no dimm in the slot, so flag it as empty */ - pvt->map[index] = 0xff; - pvt->map[index + 1] = 0xff; - } else { /* there is a dimm in the slot */ - pvt->map[index] = row; - row++; - last = value; - /* test the next value to see if the dimm is - double sided */ - pci_read_config_byte(mci->pdev, - E752X_DRB + index + 1, - &value); - pvt->map[index + 1] = (value == last) ? - 0xff : /* the dimm is single sided, - * so flag as empty - */ - row; /* this is a double sided dimm - * to save the next row # - */ - row++; - last = value; - } - } - } + e752x_init_csrows(mci, pdev, ddrcsr); + e752x_init_mem_map_table(pdev, pvt); /* set the map type. 1 = normal, 0 = reversed */ - pci_read_config_byte(mci->pdev, E752X_DRM, &stat8); + pci_read_config_byte(pdev, E752X_DRM, &stat8); pvt->map_type = ((stat8 & 0x0f) > ((stat8 >> 4) & 0x0f)); mci->edac_cap |= EDAC_FLAG_NONE; debugf3("%s(): tolm, remapbase, remaplimit\n", __func__); /* load the top of low memory, remap base, and remap limit vars */ - pci_read_config_word(mci->pdev, E752X_TOLM, &pci_data); + pci_read_config_word(pdev, E752X_TOLM, &pci_data); pvt->tolm = ((u32) pci_data) << 4; - pci_read_config_word(mci->pdev, E752X_REMAPBASE, &pci_data); + pci_read_config_word(pdev, E752X_REMAPBASE, &pci_data); pvt->remapbase = ((u32) pci_data) << 14; - pci_read_config_word(mci->pdev, E752X_REMAPLIMIT, &pci_data); + pci_read_config_word(pdev, E752X_REMAPLIMIT, &pci_data); pvt->remaplimit = ((u32) pci_data) << 14; e752x_printk(KERN_INFO, "tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm, pvt->remapbase, pvt->remaplimit); - if (edac_mc_add_mc(mci)) { + /* Here we assume that we will never see multiple instances of this + * type of memory controller. The ID is therefore hardcoded to 0. + */ + if (edac_mc_add_mc(mci,0)) { debugf3("%s(): failed edac_mc_add_mc()\n", __func__); goto fail; } - dev = pci_get_device(PCI_VENDOR_ID_INTEL, e752x_devs[dev_idx].ctl_dev, - NULL); - pvt->dev_d0f0 = dev; - /* find the error reporting device and clear errors */ - dev = pvt->dev_d0f1 = pci_dev_get(pvt->bridge_ck); - /* Turn off error disable & SMI in case the BIOS turned it on */ - pci_write_config_byte(dev, E752X_HI_ERRMASK, 0x00); - pci_write_config_byte(dev, E752X_HI_SMICMD, 0x00); - pci_write_config_word(dev, E752X_SYSBUS_ERRMASK, 0x00); - pci_write_config_word(dev, E752X_SYSBUS_SMICMD, 0x00); - pci_write_config_byte(dev, E752X_BUF_ERRMASK, 0x00); - pci_write_config_byte(dev, E752X_BUF_SMICMD, 0x00); - pci_write_config_byte(dev, E752X_DRAM_ERRMASK, 0x00); - pci_write_config_byte(dev, E752X_DRAM_SMICMD, 0x00); - + e752x_init_error_reporting_regs(pvt); e752x_get_error_info(mci, &discard); /* clear other MCH errors */ /* get this far and it's successful */ @@ -979,20 +1023,12 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) return 0; fail: - if (mci) { - if (pvt->dev_d0f0) - pci_dev_put(pvt->dev_d0f0); - - if (pvt->dev_d0f1) - pci_dev_put(pvt->dev_d0f1); - - if (pvt->bridge_ck) - pci_dev_put(pvt->bridge_ck); - - edac_mc_free(mci); - } + pci_dev_put(pvt->dev_d0f0); + pci_dev_put(pvt->dev_d0f1); + pci_dev_put(pvt->bridge_ck); + edac_mc_free(mci); - return rc; + return -ENODEV; } /* returns count (>= 0), or negative on error */ @@ -1015,7 +1051,7 @@ static void __devexit e752x_remove_one(struct pci_dev *pdev) debugf0("%s()\n", __func__); - if ((mci = edac_mc_del_mc(pdev)) == NULL) + if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL) return; pvt = (struct e752x_pvt *) mci->pvt_info; diff --git a/drivers/edac/e7xxx_edac.c b/drivers/edac/e7xxx_edac.c index a9518d3e4be..310d91b41c9 100644 --- a/drivers/edac/e7xxx_edac.c +++ b/drivers/edac/e7xxx_edac.c @@ -22,7 +22,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/pci.h> @@ -30,6 +29,9 @@ #include <linux/slab.h> #include "edac_mc.h" +#define E7XXX_REVISION " Ver: 2.0.1 " __DATE__ +#define EDAC_MOD_STR "e7xxx_edac" + #define e7xxx_printk(level, fmt, arg...) \ edac_printk(level, "e7xxx", fmt, ##arg) @@ -333,99 +335,61 @@ static void e7xxx_check(struct mem_ctl_info *mci) e7xxx_process_error_info(mci, &info, 1); } -static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx) +/* Return 1 if dual channel mode is active. Else return 0. */ +static inline int dual_channel_active(u32 drc, int dev_idx) { - int rc = -ENODEV; - int index; - u16 pci_data; - struct mem_ctl_info *mci = NULL; - struct e7xxx_pvt *pvt = NULL; - u32 drc; - int drc_chan = 1; /* Number of channels 0=1chan,1=2chan */ - int drc_drbg = 1; /* DRB granularity 0=32mb,1=64mb */ - int drc_ddim; /* DRAM Data Integrity Mode 0=none,2=edac */ - u32 dra; - unsigned long last_cumul_size; - struct e7xxx_error_info discard; - - debugf0("%s(): mci\n", __func__); + return (dev_idx == E7501) ? ((drc >> 22) & 0x1) : 1; +} - /* need to find out the number of channels */ - pci_read_config_dword(pdev, E7XXX_DRC, &drc); +/* Return DRB granularity (0=32mb, 1=64mb). */ +static inline int drb_granularity(u32 drc, int dev_idx) +{ /* only e7501 can be single channel */ - if (dev_idx == E7501) { - drc_chan = ((drc >> 22) & 0x1); - drc_drbg = (drc >> 18) & 0x3; - } - - drc_ddim = (drc >> 20) & 0x3; - mci = edac_mc_alloc(sizeof(*pvt), E7XXX_NR_CSROWS, drc_chan + 1); - - if (mci == NULL) { - rc = -ENOMEM; - goto fail; - } - - debugf3("%s(): init mci\n", __func__); - mci->mtype_cap = MEM_FLAG_RDDR; - mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED | - EDAC_FLAG_S4ECD4ED; - /* FIXME - what if different memory types are in different csrows? */ - mci->mod_name = EDAC_MOD_STR; - mci->mod_ver = "$Revision: 1.5.2.9 $"; - mci->pdev = pdev; + return (dev_idx == E7501) ? ((drc >> 18) & 0x3) : 1; +} - debugf3("%s(): init pvt\n", __func__); - pvt = (struct e7xxx_pvt *) mci->pvt_info; - pvt->dev_info = &e7xxx_devs[dev_idx]; - pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL, - pvt->dev_info->err_dev, - pvt->bridge_ck); - if (!pvt->bridge_ck) { - e7xxx_printk(KERN_ERR, "error reporting device not found:" - "vendor %x device 0x%x (broken BIOS?)\n", - PCI_VENDOR_ID_INTEL, e7xxx_devs[dev_idx].err_dev); - goto fail; - } - - debugf3("%s(): more mci init\n", __func__); - mci->ctl_name = pvt->dev_info->ctl_name; - mci->edac_check = e7xxx_check; - mci->ctl_page_to_phys = ctl_page_to_phys; +static void e7xxx_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, + int dev_idx, u32 drc) +{ + unsigned long last_cumul_size; + int index; + u8 value; + u32 dra, cumul_size; + int drc_chan, drc_drbg, drc_ddim, mem_dev; + struct csrow_info *csrow; - /* find out the device types */ pci_read_config_dword(pdev, E7XXX_DRA, &dra); + drc_chan = dual_channel_active(drc, dev_idx); + drc_drbg = drb_granularity(drc, dev_idx); + drc_ddim = (drc >> 20) & 0x3; + last_cumul_size = 0; - /* - * The dram row boundary (DRB) reg values are boundary address + /* The dram row boundary (DRB) reg values are boundary address * for each DRAM row with a granularity of 32 or 64MB (single/dual * channel operation). DRB regs are cumulative; therefore DRB7 will * contain the total memory contained in all eight rows. */ - for (last_cumul_size = index = 0; index < mci->nr_csrows; index++) { - u8 value; - u32 cumul_size; + for (index = 0; index < mci->nr_csrows; index++) { /* mem_dev 0=x8, 1=x4 */ - int mem_dev = (dra >> (index * 4 + 3)) & 0x1; - struct csrow_info *csrow = &mci->csrows[index]; + mem_dev = (dra >> (index * 4 + 3)) & 0x1; + csrow = &mci->csrows[index]; - pci_read_config_byte(mci->pdev, E7XXX_DRB + index, &value); + pci_read_config_byte(pdev, E7XXX_DRB + index, &value); /* convert a 64 or 32 MiB DRB to a page size. */ cumul_size = value << (25 + drc_drbg - PAGE_SHIFT); debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index, cumul_size); - if (cumul_size == last_cumul_size) - continue; /* not populated */ + continue; /* not populated */ csrow->first_page = last_cumul_size; csrow->last_page = cumul_size - 1; csrow->nr_pages = cumul_size - last_cumul_size; last_cumul_size = cumul_size; - csrow->grain = 1 << 12; /* 4KiB - resolution of CELOG */ - csrow->mtype = MEM_RDDR; /* only one type supported */ + csrow->grain = 1 << 12; /* 4KiB - resolution of CELOG */ + csrow->mtype = MEM_RDDR; /* only one type supported */ csrow->dtype = mem_dev ? DEV_X4 : DEV_X8; /* @@ -443,16 +407,61 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx) } else csrow->edac_mode = EDAC_NONE; } +} - mci->edac_cap |= EDAC_FLAG_NONE; +static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx) +{ + u16 pci_data; + struct mem_ctl_info *mci = NULL; + struct e7xxx_pvt *pvt = NULL; + u32 drc; + int drc_chan; + struct e7xxx_error_info discard; + + debugf0("%s(): mci\n", __func__); + pci_read_config_dword(pdev, E7XXX_DRC, &drc); + + drc_chan = dual_channel_active(drc, dev_idx); + mci = edac_mc_alloc(sizeof(*pvt), E7XXX_NR_CSROWS, drc_chan + 1); + + if (mci == NULL) + return -ENOMEM; + + debugf3("%s(): init mci\n", __func__); + mci->mtype_cap = MEM_FLAG_RDDR; + mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED | + EDAC_FLAG_S4ECD4ED; + /* FIXME - what if different memory types are in different csrows? */ + mci->mod_name = EDAC_MOD_STR; + mci->mod_ver = E7XXX_REVISION; + mci->dev = &pdev->dev; + debugf3("%s(): init pvt\n", __func__); + pvt = (struct e7xxx_pvt *) mci->pvt_info; + pvt->dev_info = &e7xxx_devs[dev_idx]; + pvt->bridge_ck = pci_get_device(PCI_VENDOR_ID_INTEL, + pvt->dev_info->err_dev, + pvt->bridge_ck); + if (!pvt->bridge_ck) { + e7xxx_printk(KERN_ERR, "error reporting device not found:" + "vendor %x device 0x%x (broken BIOS?)\n", + PCI_VENDOR_ID_INTEL, e7xxx_devs[dev_idx].err_dev); + goto fail0; + } + + debugf3("%s(): more mci init\n", __func__); + mci->ctl_name = pvt->dev_info->ctl_name; + mci->edac_check = e7xxx_check; + mci->ctl_page_to_phys = ctl_page_to_phys; + e7xxx_init_csrows(mci, pdev, dev_idx, drc); + mci->edac_cap |= EDAC_FLAG_NONE; debugf3("%s(): tolm, remapbase, remaplimit\n", __func__); /* load the top of low memory, remap base, and remap limit vars */ - pci_read_config_word(mci->pdev, E7XXX_TOLM, &pci_data); + pci_read_config_word(pdev, E7XXX_TOLM, &pci_data); pvt->tolm = ((u32) pci_data) << 4; - pci_read_config_word(mci->pdev, E7XXX_REMAPBASE, &pci_data); + pci_read_config_word(pdev, E7XXX_REMAPBASE, &pci_data); pvt->remapbase = ((u32) pci_data) << 14; - pci_read_config_word(mci->pdev, E7XXX_REMAPLIMIT, &pci_data); + pci_read_config_word(pdev, E7XXX_REMAPLIMIT, &pci_data); pvt->remaplimit = ((u32) pci_data) << 14; e7xxx_printk(KERN_INFO, "tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm, @@ -461,23 +470,25 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx) /* clear any pending errors, or initial state bits */ e7xxx_get_error_info(mci, &discard); - if (edac_mc_add_mc(mci) != 0) { + /* Here we assume that we will never see multiple instances of this + * type of memory controller. The ID is therefore hardcoded to 0. + */ + if (edac_mc_add_mc(mci,0)) { debugf3("%s(): failed edac_mc_add_mc()\n", __func__); - goto fail; + goto fail1; } /* get this far and it's successful */ debugf3("%s(): success\n", __func__); return 0; -fail: - if (mci != NULL) { - if(pvt != NULL && pvt->bridge_ck) - pci_dev_put(pvt->bridge_ck); - edac_mc_free(mci); - } +fail1: + pci_dev_put(pvt->bridge_ck); + +fail0: + edac_mc_free(mci); - return rc; + return -ENODEV; } /* returns count (>= 0), or negative on error */ @@ -498,7 +509,7 @@ static void __devexit e7xxx_remove_one(struct pci_dev *pdev) debugf0("%s()\n", __func__); - if ((mci = edac_mc_del_mc(pdev)) == NULL) + if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL) return; pvt = (struct e7xxx_pvt *) mci->pvt_info; diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index ea06e3a4dc3..3a7cfe88b16 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -12,7 +12,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/proc_fs.h> #include <linux/kernel.h> @@ -54,16 +53,17 @@ static int log_ce = 1; static int panic_on_ue; static int poll_msec = 1000; -static int check_pci_parity = 0; /* default YES check PCI parity */ -static int panic_on_pci_parity; /* default no panic on PCI Parity */ -static atomic_t pci_parity_count = ATOMIC_INIT(0); - /* lock to memory controller's control array */ static DECLARE_MUTEX(mem_ctls_mutex); static struct list_head mc_devices = LIST_HEAD_INIT(mc_devices); static struct task_struct *edac_thread; +#ifdef CONFIG_PCI +static int check_pci_parity = 0; /* default YES check PCI parity */ +static int panic_on_pci_parity; /* default no panic on PCI Parity */ +static atomic_t pci_parity_count = ATOMIC_INIT(0); + /* Structure of the whitelist and blacklist arrays */ struct edac_pci_device_list { unsigned int vendor; /* Vendor ID */ @@ -80,6 +80,12 @@ static int pci_blacklist_count; static struct edac_pci_device_list pci_whitelist[MAX_LISTED_PCI_DEVICES]; static int pci_whitelist_count ; +#ifndef DISABLE_EDAC_SYSFS +static struct kobject edac_pci_kobj; /* /sys/devices/system/edac/pci */ +static struct completion edac_pci_kobj_complete; +#endif /* DISABLE_EDAC_SYSFS */ +#endif /* CONFIG_PCI */ + /* START sysfs data and methods */ #ifndef DISABLE_EDAC_SYSFS @@ -127,18 +133,15 @@ static struct sysdev_class edac_class = { set_kset_name("edac"), }; -/* sysfs objects: +/* sysfs object: * /sys/devices/system/edac/mc - * /sys/devices/system/edac/pci */ static struct kobject edac_memctrl_kobj; -static struct kobject edac_pci_kobj; /* We use these to wait for the reference counts on edac_memctrl_kobj and * edac_pci_kobj to reach 0. */ static struct completion edac_memctrl_kobj_complete; -static struct completion edac_pci_kobj_complete; /* * /sys/devices/system/edac/mc; @@ -324,6 +327,8 @@ static void edac_sysfs_memctrl_teardown(void) #endif /* DISABLE_EDAC_SYSFS */ } +#ifdef CONFIG_PCI + #ifndef DISABLE_EDAC_SYSFS /* @@ -624,6 +629,252 @@ static void edac_sysfs_pci_teardown(void) #endif } + +static u16 get_pci_parity_status(struct pci_dev *dev, int secondary) +{ + int where; + u16 status; + + where = secondary ? PCI_SEC_STATUS : PCI_STATUS; + pci_read_config_word(dev, where, &status); + + /* If we get back 0xFFFF then we must suspect that the card has been + * pulled but the Linux PCI layer has not yet finished cleaning up. + * We don't want to report on such devices + */ + + if (status == 0xFFFF) { + u32 sanity; + + pci_read_config_dword(dev, 0, &sanity); + + if (sanity == 0xFFFFFFFF) + return 0; + } + + status &= PCI_STATUS_DETECTED_PARITY | PCI_STATUS_SIG_SYSTEM_ERROR | + PCI_STATUS_PARITY; + + if (status) + /* reset only the bits we are interested in */ + pci_write_config_word(dev, where, status); + + return status; +} + +typedef void (*pci_parity_check_fn_t) (struct pci_dev *dev); + +/* Clear any PCI parity errors logged by this device. */ +static void edac_pci_dev_parity_clear(struct pci_dev *dev) +{ + u8 header_type; + + get_pci_parity_status(dev, 0); + + /* read the device TYPE, looking for bridges */ + pci_read_config_byte(dev, PCI_HEADER_TYPE, &header_type); + + if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) + get_pci_parity_status(dev, 1); +} + +/* + * PCI Parity polling + * + */ +static void edac_pci_dev_parity_test(struct pci_dev *dev) +{ + u16 status; + u8 header_type; + + /* read the STATUS register on this device + */ + status = get_pci_parity_status(dev, 0); + + debugf2("PCI STATUS= 0x%04x %s\n", status, dev->dev.bus_id ); + + /* check the status reg for errors */ + if (status) { + if (status & (PCI_STATUS_SIG_SYSTEM_ERROR)) + edac_printk(KERN_CRIT, EDAC_PCI, + "Signaled System Error on %s\n", + pci_name(dev)); + + if (status & (PCI_STATUS_PARITY)) { + edac_printk(KERN_CRIT, EDAC_PCI, + "Master Data Parity Error on %s\n", + pci_name(dev)); + + atomic_inc(&pci_parity_count); + } + + if (status & (PCI_STATUS_DETECTED_PARITY)) { + edac_printk(KERN_CRIT, EDAC_PCI, + "Detected Parity Error on %s\n", + pci_name(dev)); + + atomic_inc(&pci_parity_count); + } + } + + /* read the device TYPE, looking for bridges */ + pci_read_config_byte(dev, PCI_HEADER_TYPE, &header_type); + + debugf2("PCI HEADER TYPE= 0x%02x %s\n", header_type, dev->dev.bus_id ); + + if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { + /* On bridges, need to examine secondary status register */ + status = get_pci_parity_status(dev, 1); + + debugf2("PCI SEC_STATUS= 0x%04x %s\n", + status, dev->dev.bus_id ); + + /* check the secondary status reg for errors */ + if (status) { + if (status & (PCI_STATUS_SIG_SYSTEM_ERROR)) + edac_printk(KERN_CRIT, EDAC_PCI, "Bridge " + "Signaled System Error on %s\n", + pci_name(dev)); + + if (status & (PCI_STATUS_PARITY)) { + edac_printk(KERN_CRIT, EDAC_PCI, "Bridge " + "Master Data Parity Error on " + "%s\n", pci_name(dev)); + + atomic_inc(&pci_parity_count); + } + + if (status & (PCI_STATUS_DETECTED_PARITY)) { + edac_printk(KERN_CRIT, EDAC_PCI, "Bridge " + "Detected Parity Error on %s\n", + pci_name(dev)); + + atomic_inc(&pci_parity_count); + } + } + } +} + +/* + * check_dev_on_list: Scan for a PCI device on a white/black list + * @list: an EDAC &edac_pci_device_list white/black list pointer + * @free_index: index of next free entry on the list + * @pci_dev: PCI Device pointer + * + * see if list contains the device. + * + * Returns: 0 not found + * 1 found on list + */ +static int check_dev_on_list(struct edac_pci_device_list *list, + int free_index, struct pci_dev *dev) +{ + int i; + int rc = 0; /* Assume not found */ + unsigned short vendor=dev->vendor; + unsigned short device=dev->device; + + /* Scan the list, looking for a vendor/device match */ + for (i = 0; i < free_index; i++, list++ ) { + if ((list->vendor == vendor ) && (list->device == device )) { + rc = 1; + break; + } + } + + return rc; +} + +/* + * pci_dev parity list iterator + * Scan the PCI device list for one iteration, looking for SERRORs + * Master Parity ERRORS or Parity ERRORs on primary or secondary devices + */ +static inline void edac_pci_dev_parity_iterator(pci_parity_check_fn_t fn) +{ + struct pci_dev *dev = NULL; + + /* request for kernel access to the next PCI device, if any, + * and while we are looking at it have its reference count + * bumped until we are done with it + */ + while((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { + /* if whitelist exists then it has priority, so only scan + * those devices on the whitelist + */ + if (pci_whitelist_count > 0 ) { + if (check_dev_on_list(pci_whitelist, + pci_whitelist_count, dev)) + fn(dev); + } else { + /* + * if no whitelist, then check if this devices is + * blacklisted + */ + if (!check_dev_on_list(pci_blacklist, + pci_blacklist_count, dev)) + fn(dev); + } + } +} + +static void do_pci_parity_check(void) +{ + unsigned long flags; + int before_count; + + debugf3("%s()\n", __func__); + + if (!check_pci_parity) + return; + + before_count = atomic_read(&pci_parity_count); + + /* scan all PCI devices looking for a Parity Error on devices and + * bridges + */ + local_irq_save(flags); + edac_pci_dev_parity_iterator(edac_pci_dev_parity_test); + local_irq_restore(flags); + + /* Only if operator has selected panic on PCI Error */ + if (panic_on_pci_parity) { + /* If the count is different 'after' from 'before' */ + if (before_count != atomic_read(&pci_parity_count)) + panic("EDAC: PCI Parity Error"); + } +} + +static inline void clear_pci_parity_errors(void) +{ + /* Clear any PCI bus parity errors that devices initially have logged + * in their registers. + */ + edac_pci_dev_parity_iterator(edac_pci_dev_parity_clear); +} + +#else /* CONFIG_PCI */ + +static inline void do_pci_parity_check(void) +{ + /* no-op */ +} + +static inline void clear_pci_parity_errors(void) +{ + /* no-op */ +} + +static void edac_sysfs_pci_teardown(void) +{ +} + +static int edac_sysfs_pci_setup(void) +{ + return 0; +} +#endif /* CONFIG_PCI */ + #ifndef DISABLE_EDAC_SYSFS /* EDAC sysfs CSROW data structures and methods */ @@ -1132,7 +1383,7 @@ static int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) return err; /* create a symlink for the device */ - err = sysfs_create_link(edac_mci_kobj, &mci->pdev->dev.kobj, + err = sysfs_create_link(edac_mci_kobj, &mci->dev->kobj, EDAC_DEVICE_SYMLINK); if (err) @@ -1238,7 +1489,7 @@ void edac_mc_dump_mci(struct mem_ctl_info *mci) debugf4("\tmci->edac_check = %p\n", mci->edac_check); debugf3("\tmci->nr_csrows = %d, csrows = %p\n", mci->nr_csrows, mci->csrows); - debugf3("\tpdev = %p\n", mci->pdev); + debugf3("\tdev = %p\n", mci->dev); debugf3("\tmod_name:ctl_name = %s:%s\n", mci->mod_name, mci->ctl_name); debugf3("\tpvt_info = %p\n\n", mci->pvt_info); @@ -1363,7 +1614,7 @@ void edac_mc_free(struct mem_ctl_info *mci) } EXPORT_SYMBOL_GPL(edac_mc_free); -static struct mem_ctl_info *find_mci_by_pdev(struct pci_dev *pdev) +static struct mem_ctl_info *find_mci_by_dev(struct device *dev) { struct mem_ctl_info *mci; struct list_head *item; @@ -1373,54 +1624,53 @@ static struct mem_ctl_info *find_mci_by_pdev(struct pci_dev *pdev) list_for_each(item, &mc_devices) { mci = list_entry(item, struct mem_ctl_info, link); - if (mci->pdev == pdev) + if (mci->dev == dev) return mci; } return NULL; } -static int add_mc_to_global_list(struct mem_ctl_info *mci) +/* Return 0 on success, 1 on failure. + * Before calling this function, caller must + * assign a unique value to mci->mc_idx. + */ +static int add_mc_to_global_list (struct mem_ctl_info *mci) { struct list_head *item, *insert_before; struct mem_ctl_info *p; - int i; - if (list_empty(&mc_devices)) { - mci->mc_idx = 0; - insert_before = &mc_devices; - } else { - if (find_mci_by_pdev(mci->pdev)) { - edac_printk(KERN_WARNING, EDAC_MC, - "%s (%s) %s %s already assigned %d\n", - mci->pdev->dev.bus_id, - pci_name(mci->pdev), mci->mod_name, - mci->ctl_name, mci->mc_idx); - return 1; - } + insert_before = &mc_devices; - insert_before = NULL; - i = 0; + if (unlikely((p = find_mci_by_dev(mci->dev)) != NULL)) + goto fail0; - list_for_each(item, &mc_devices) { - p = list_entry(item, struct mem_ctl_info, link); + list_for_each(item, &mc_devices) { + p = list_entry(item, struct mem_ctl_info, link); - if (p->mc_idx != i) { - insert_before = item; - break; - } + if (p->mc_idx >= mci->mc_idx) { + if (unlikely(p->mc_idx == mci->mc_idx)) + goto fail1; - i++; + insert_before = item; + break; } - - mci->mc_idx = i; - - if (insert_before == NULL) - insert_before = &mc_devices; } list_add_tail_rcu(&mci->link, insert_before); return 0; + +fail0: + edac_printk(KERN_WARNING, EDAC_MC, + "%s (%s) %s %s already assigned %d\n", p->dev->bus_id, + dev_name(p->dev), p->mod_name, p->ctl_name, p->mc_idx); + return 1; + +fail1: + edac_printk(KERN_WARNING, EDAC_MC, + "bug in low-level driver: attempt to assign\n" + " duplicate mc_idx %d in %s()\n", p->mc_idx, __func__); + return 1; } static void complete_mc_list_del(struct rcu_head *head) @@ -1444,6 +1694,7 @@ static void del_mc_from_global_list(struct mem_ctl_info *mci) * edac_mc_add_mc: Insert the 'mci' structure into the mci global list and * create sysfs entries associated with mci structure * @mci: pointer to the mci structure to be added to the list + * @mc_idx: A unique numeric identifier to be assigned to the 'mci' structure. * * Return: * 0 Success @@ -1451,9 +1702,10 @@ static void del_mc_from_global_list(struct mem_ctl_info *mci) */ /* FIXME - should a warning be printed if no error detection? correction? */ -int edac_mc_add_mc(struct mem_ctl_info *mci) +int edac_mc_add_mc(struct mem_ctl_info *mci, int mc_idx) { debugf0("%s()\n", __func__); + mci->mc_idx = mc_idx; #ifdef CONFIG_EDAC_DEBUG if (edac_debug_level >= 3) edac_mc_dump_mci(mci); @@ -1486,8 +1738,8 @@ int edac_mc_add_mc(struct mem_ctl_info *mci) } /* Report action taken */ - edac_mc_printk(mci, KERN_INFO, "Giving out device to %s %s: PCI %s\n", - mci->mod_name, mci->ctl_name, pci_name(mci->pdev)); + edac_mc_printk(mci, KERN_INFO, "Giving out device to %s %s: DEV %s\n", + mci->mod_name, mci->ctl_name, dev_name(mci->dev)); up(&mem_ctls_mutex); return 0; @@ -1504,18 +1756,18 @@ EXPORT_SYMBOL_GPL(edac_mc_add_mc); /** * edac_mc_del_mc: Remove sysfs entries for specified mci structure and * remove mci structure from global list - * @pdev: Pointer to 'struct pci_dev' representing mci structure to remove. + * @pdev: Pointer to 'struct device' representing mci structure to remove. * * Return pointer to removed mci structure, or NULL if device not found. */ -struct mem_ctl_info * edac_mc_del_mc(struct pci_dev *pdev) +struct mem_ctl_info * edac_mc_del_mc(struct device *dev) { struct mem_ctl_info *mci; debugf0("MC: %s()\n", __func__); down(&mem_ctls_mutex); - if ((mci = find_mci_by_pdev(pdev)) == NULL) { + if ((mci = find_mci_by_dev(dev)) == NULL) { up(&mem_ctls_mutex); return NULL; } @@ -1524,8 +1776,8 @@ struct mem_ctl_info * edac_mc_del_mc(struct pci_dev *pdev) del_mc_from_global_list(mci); up(&mem_ctls_mutex); edac_printk(KERN_INFO, EDAC_MC, - "Removed device %d for %s %s: PCI %s\n", mci->mc_idx, - mci->mod_name, mci->ctl_name, pci_name(mci->pdev)); + "Removed device %d for %s %s: DEV %s\n", mci->mc_idx, + mci->mod_name, mci->ctl_name, dev_name(mci->dev)); return mci; } EXPORT_SYMBOL_GPL(edac_mc_del_mc); @@ -1739,244 +1991,6 @@ void edac_mc_handle_ue_no_info(struct mem_ctl_info *mci, const char *msg) } EXPORT_SYMBOL_GPL(edac_mc_handle_ue_no_info); -#ifdef CONFIG_PCI - -static u16 get_pci_parity_status(struct pci_dev *dev, int secondary) -{ - int where; - u16 status; - - where = secondary ? PCI_SEC_STATUS : PCI_STATUS; - pci_read_config_word(dev, where, &status); - - /* If we get back 0xFFFF then we must suspect that the card has been - * pulled but the Linux PCI layer has not yet finished cleaning up. - * We don't want to report on such devices - */ - - if (status == 0xFFFF) { - u32 sanity; - - pci_read_config_dword(dev, 0, &sanity); - - if (sanity == 0xFFFFFFFF) - return 0; - } - - status &= PCI_STATUS_DETECTED_PARITY | PCI_STATUS_SIG_SYSTEM_ERROR | - PCI_STATUS_PARITY; - - if (status) - /* reset only the bits we are interested in */ - pci_write_config_word(dev, where, status); - - return status; -} - -typedef void (*pci_parity_check_fn_t) (struct pci_dev *dev); - -/* Clear any PCI parity errors logged by this device. */ -static void edac_pci_dev_parity_clear(struct pci_dev *dev) -{ - u8 header_type; - - get_pci_parity_status(dev, 0); - - /* read the device TYPE, looking for bridges */ - pci_read_config_byte(dev, PCI_HEADER_TYPE, &header_type); - - if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) - get_pci_parity_status(dev, 1); -} - -/* - * PCI Parity polling - * - */ -static void edac_pci_dev_parity_test(struct pci_dev *dev) -{ - u16 status; - u8 header_type; - - /* read the STATUS register on this device - */ - status = get_pci_parity_status(dev, 0); - - debugf2("PCI STATUS= 0x%04x %s\n", status, dev->dev.bus_id ); - - /* check the status reg for errors */ - if (status) { - if (status & (PCI_STATUS_SIG_SYSTEM_ERROR)) - edac_printk(KERN_CRIT, EDAC_PCI, - "Signaled System Error on %s\n", - pci_name(dev)); - - if (status & (PCI_STATUS_PARITY)) { - edac_printk(KERN_CRIT, EDAC_PCI, - "Master Data Parity Error on %s\n", - pci_name(dev)); - - atomic_inc(&pci_parity_count); - } - - if (status & (PCI_STATUS_DETECTED_PARITY)) { - edac_printk(KERN_CRIT, EDAC_PCI, - "Detected Parity Error on %s\n", - pci_name(dev)); - - atomic_inc(&pci_parity_count); - } - } - - /* read the device TYPE, looking for bridges */ - pci_read_config_byte(dev, PCI_HEADER_TYPE, &header_type); - - debugf2("PCI HEADER TYPE= 0x%02x %s\n", header_type, dev->dev.bus_id ); - - if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) { - /* On bridges, need to examine secondary status register */ - status = get_pci_parity_status(dev, 1); - - debugf2("PCI SEC_STATUS= 0x%04x %s\n", - status, dev->dev.bus_id ); - - /* check the secondary status reg for errors */ - if (status) { - if (status & (PCI_STATUS_SIG_SYSTEM_ERROR)) - edac_printk(KERN_CRIT, EDAC_PCI, "Bridge " - "Signaled System Error on %s\n", - pci_name(dev)); - - if (status & (PCI_STATUS_PARITY)) { - edac_printk(KERN_CRIT, EDAC_PCI, "Bridge " - "Master Data Parity Error on " - "%s\n", pci_name(dev)); - - atomic_inc(&pci_parity_count); - } - - if (status & (PCI_STATUS_DETECTED_PARITY)) { - edac_printk(KERN_CRIT, EDAC_PCI, "Bridge " - "Detected Parity Error on %s\n", - pci_name(dev)); - - atomic_inc(&pci_parity_count); - } - } - } -} - -/* - * check_dev_on_list: Scan for a PCI device on a white/black list - * @list: an EDAC &edac_pci_device_list white/black list pointer - * @free_index: index of next free entry on the list - * @pci_dev: PCI Device pointer - * - * see if list contains the device. - * - * Returns: 0 not found - * 1 found on list - */ -static int check_dev_on_list(struct edac_pci_device_list *list, - int free_index, struct pci_dev *dev) -{ - int i; - int rc = 0; /* Assume not found */ - unsigned short vendor=dev->vendor; - unsigned short device=dev->device; - - /* Scan the list, looking for a vendor/device match */ - for (i = 0; i < free_index; i++, list++ ) { - if ((list->vendor == vendor ) && (list->device == device )) { - rc = 1; - break; - } - } - - return rc; -} - -/* - * pci_dev parity list iterator - * Scan the PCI device list for one iteration, looking for SERRORs - * Master Parity ERRORS or Parity ERRORs on primary or secondary devices - */ -static inline void edac_pci_dev_parity_iterator(pci_parity_check_fn_t fn) -{ - struct pci_dev *dev = NULL; - - /* request for kernel access to the next PCI device, if any, - * and while we are looking at it have its reference count - * bumped until we are done with it - */ - while((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { - /* if whitelist exists then it has priority, so only scan - * those devices on the whitelist - */ - if (pci_whitelist_count > 0 ) { - if (check_dev_on_list(pci_whitelist, - pci_whitelist_count, dev)) - fn(dev); - } else { - /* - * if no whitelist, then check if this devices is - * blacklisted - */ - if (!check_dev_on_list(pci_blacklist, - pci_blacklist_count, dev)) - fn(dev); - } - } -} - -static void do_pci_parity_check(void) -{ - unsigned long flags; - int before_count; - - debugf3("%s()\n", __func__); - - if (!check_pci_parity) - return; - - before_count = atomic_read(&pci_parity_count); - - /* scan all PCI devices looking for a Parity Error on devices and - * bridges - */ - local_irq_save(flags); - edac_pci_dev_parity_iterator(edac_pci_dev_parity_test); - local_irq_restore(flags); - - /* Only if operator has selected panic on PCI Error */ - if (panic_on_pci_parity) { - /* If the count is different 'after' from 'before' */ - if (before_count != atomic_read(&pci_parity_count)) - panic("EDAC: PCI Parity Error"); - } -} - -static inline void clear_pci_parity_errors(void) -{ - /* Clear any PCI bus parity errors that devices initially have logged - * in their registers. - */ - edac_pci_dev_parity_iterator(edac_pci_dev_parity_clear); -} - -#else /* CONFIG_PCI */ - -static inline void do_pci_parity_check(void) -{ - /* no-op */ -} - -static inline void clear_pci_parity_errors(void) -{ - /* no-op */ -} - -#endif /* CONFIG_PCI */ /* * Iterate over all MC instances and check for ECC, et al, errors @@ -2096,10 +2110,12 @@ MODULE_DESCRIPTION("Core library routines for MC reporting"); module_param(panic_on_ue, int, 0644); MODULE_PARM_DESC(panic_on_ue, "Panic on uncorrected error: 0=off 1=on"); +#ifdef CONFIG_PCI module_param(check_pci_parity, int, 0644); MODULE_PARM_DESC(check_pci_parity, "Check for PCI bus parity errors: 0=off 1=on"); module_param(panic_on_pci_parity, int, 0644); MODULE_PARM_DESC(panic_on_pci_parity, "Panic on PCI Bus Parity error: 0=off 1=on"); +#endif module_param(log_ue, int, 0644); MODULE_PARM_DESC(log_ue, "Log uncorrectable error to console: 0=off 1=on"); module_param(log_ce, int, 0644); diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h index 8d9e83909b9..bf6ab8a8d5e 100644 --- a/drivers/edac/edac_mc.h +++ b/drivers/edac/edac_mc.h @@ -18,7 +18,6 @@ #ifndef _EDAC_MC_H_ #define _EDAC_MC_H_ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/module.h> @@ -79,15 +78,17 @@ extern int edac_debug_level; #endif /* !CONFIG_EDAC_DEBUG */ -#define edac_xstr(s) edac_str(s) -#define edac_str(s) #s -#define EDAC_MOD_STR edac_xstr(KBUILD_BASENAME) - #define BIT(x) (1 << (x)) #define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \ PCI_DEVICE_ID_ ## vend ## _ ## dev +#if defined(CONFIG_X86) && defined(CONFIG_PCI) +#define dev_name(dev) pci_name(to_pci_dev(dev)) +#else +#define dev_name(dev) to_platform_device(dev)->name +#endif + /* memory devices */ enum dev_type { DEV_UNKNOWN = 0, @@ -327,10 +328,10 @@ struct mem_ctl_info { struct csrow_info *csrows; /* * FIXME - what about controllers on other busses? - IDs must be - * unique. pdev pointer should be sufficiently unique, but + * unique. dev pointer should be sufficiently unique, but * BUS:SLOT.FUNC numbers may not be unique. */ - struct pci_dev *pdev; + struct device *dev; const char *mod_name; const char *mod_ver; const char *ctl_name; @@ -353,6 +354,8 @@ struct mem_ctl_info { struct completion kobj_complete; }; +#ifdef CONFIG_PCI + /* write all or some bits in a byte-register*/ static inline void pci_write_bits8(struct pci_dev *pdev, int offset, u8 value, u8 mask) @@ -401,14 +404,16 @@ static inline void pci_write_bits32(struct pci_dev *pdev, int offset, pci_write_config_dword(pdev, offset, value); } +#endif /* CONFIG_PCI */ + #ifdef CONFIG_EDAC_DEBUG void edac_mc_dump_channel(struct channel_info *chan); void edac_mc_dump_mci(struct mem_ctl_info *mci); void edac_mc_dump_csrow(struct csrow_info *csrow); #endif /* CONFIG_EDAC_DEBUG */ -extern int edac_mc_add_mc(struct mem_ctl_info *mci); -extern struct mem_ctl_info * edac_mc_del_mc(struct pci_dev *pdev); +extern int edac_mc_add_mc(struct mem_ctl_info *mci,int mc_idx); +extern struct mem_ctl_info * edac_mc_del_mc(struct device *dev); extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, unsigned long page); extern void edac_mc_scrub_block(unsigned long page, unsigned long offset, diff --git a/drivers/edac/i82860_edac.c b/drivers/edac/i82860_edac.c index fd342163cf9..e4bb298e613 100644 --- a/drivers/edac/i82860_edac.c +++ b/drivers/edac/i82860_edac.c @@ -9,7 +9,6 @@ * by Thayne Harbaugh of Linux Networx. (http://lnxi.com) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/pci.h> @@ -17,6 +16,9 @@ #include <linux/slab.h> #include "edac_mc.h" +#define I82860_REVISION " Ver: 2.0.1 " __DATE__ +#define EDAC_MOD_STR "i82860_edac" + #define i82860_printk(level, fmt, arg...) \ edac_printk(level, "i82860", fmt, ##arg) @@ -63,17 +65,21 @@ static struct pci_dev *mci_pdev = NULL; /* init dev: in case that AGP code static void i82860_get_error_info(struct mem_ctl_info *mci, struct i82860_error_info *info) { + struct pci_dev *pdev; + + pdev = to_pci_dev(mci->dev); + /* * This is a mess because there is no atomic way to read all the * registers at once and the registers can transition from CE being * overwritten by UE. */ - pci_read_config_word(mci->pdev, I82860_ERRSTS, &info->errsts); - pci_read_config_dword(mci->pdev, I82860_EAP, &info->eap); - pci_read_config_word(mci->pdev, I82860_DERRCTL_STS, &info->derrsyn); - pci_read_config_word(mci->pdev, I82860_ERRSTS, &info->errsts2); + pci_read_config_word(pdev, I82860_ERRSTS, &info->errsts); + pci_read_config_dword(pdev, I82860_EAP, &info->eap); + pci_read_config_word(pdev, I82860_DERRCTL_STS, &info->derrsyn); + pci_read_config_word(pdev, I82860_ERRSTS, &info->errsts2); - pci_write_bits16(mci->pdev, I82860_ERRSTS, 0x0003, 0x0003); + pci_write_bits16(pdev, I82860_ERRSTS, 0x0003, 0x0003); /* * If the error is the same for both reads then the first set of reads @@ -84,8 +90,8 @@ static void i82860_get_error_info(struct mem_ctl_info *mci, return; if ((info->errsts ^ info->errsts2) & 0x0003) { - pci_read_config_dword(mci->pdev, I82860_EAP, &info->eap); - pci_read_config_word(mci->pdev, I82860_DERRCTL_STS, + pci_read_config_dword(pdev, I82860_EAP, &info->eap); + pci_read_config_word(pdev, I82860_DERRCTL_STS, &info->derrsyn); } } @@ -127,15 +133,50 @@ static void i82860_check(struct mem_ctl_info *mci) i82860_process_error_info(mci, &info, 1); } -static int i82860_probe1(struct pci_dev *pdev, int dev_idx) +static void i82860_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev) { - int rc = -ENODEV; - int index; - struct mem_ctl_info *mci = NULL; unsigned long last_cumul_size; - struct i82860_error_info discard; + u16 mchcfg_ddim; /* DRAM Data Integrity Mode 0=none, 2=edac */ + u16 value; + u32 cumul_size; + struct csrow_info *csrow; + int index; + + pci_read_config_word(pdev, I82860_MCHCFG, &mchcfg_ddim); + mchcfg_ddim = mchcfg_ddim & 0x180; + last_cumul_size = 0; + + /* The group row boundary (GRA) reg values are boundary address + * for each DRAM row with a granularity of 16MB. GRA regs are + * cumulative; therefore GRA15 will contain the total memory contained + * in all eight rows. + */ + for (index = 0; index < mci->nr_csrows; index++) { + csrow = &mci->csrows[index]; + pci_read_config_word(pdev, I82860_GBA + index * 2, &value); + cumul_size = (value & I82860_GBA_MASK) << + (I82860_GBA_SHIFT - PAGE_SHIFT); + debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index, + cumul_size); - u16 mchcfg_ddim; /* DRAM Data Integrity Mode 0=none,2=edac */ + if (cumul_size == last_cumul_size) + continue; /* not populated */ + + csrow->first_page = last_cumul_size; + csrow->last_page = cumul_size - 1; + csrow->nr_pages = cumul_size - last_cumul_size; + last_cumul_size = cumul_size; + csrow->grain = 1 << 12; /* I82860_EAP has 4KiB reolution */ + csrow->mtype = MEM_RMBS; + csrow->dtype = DEV_UNKNOWN; + csrow->edac_mode = mchcfg_ddim ? EDAC_SECDED : EDAC_NONE; + } +} + +static int i82860_probe1(struct pci_dev *pdev, int dev_idx) +{ + struct mem_ctl_info *mci; + struct i82860_error_info discard; /* RDRAM has channels but these don't map onto the abstractions that edac uses. @@ -151,67 +192,35 @@ static int i82860_probe1(struct pci_dev *pdev, int dev_idx) return -ENOMEM; debugf3("%s(): init mci\n", __func__); - mci->pdev = pdev; + mci->dev = &pdev->dev; mci->mtype_cap = MEM_FLAG_DDR; - mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED; /* I"m not sure about this but I think that all RDRAM is SECDED */ mci->edac_cap = EDAC_FLAG_SECDED; - /* adjust FLAGS */ - mci->mod_name = EDAC_MOD_STR; - mci->mod_ver = "$Revision: 1.1.2.6 $"; + mci->mod_ver = I82860_REVISION; mci->ctl_name = i82860_devs[dev_idx].ctl_name; mci->edac_check = i82860_check; mci->ctl_page_to_phys = NULL; + i82860_init_csrows(mci, pdev); + i82860_get_error_info(mci, &discard); /* clear counters */ - pci_read_config_word(mci->pdev, I82860_MCHCFG, &mchcfg_ddim); - mchcfg_ddim = mchcfg_ddim & 0x180; - - /* - * The group row boundary (GRA) reg values are boundary address - * for each DRAM row with a granularity of 16MB. GRA regs are - * cumulative; therefore GRA15 will contain the total memory contained - * in all eight rows. + /* Here we assume that we will never see multiple instances of this + * type of memory controller. The ID is therefore hardcoded to 0. */ - for (last_cumul_size = index = 0; index < mci->nr_csrows; index++) { - u16 value; - u32 cumul_size; - struct csrow_info *csrow = &mci->csrows[index]; - - pci_read_config_word(mci->pdev, I82860_GBA + index * 2, - &value); - - cumul_size = (value & I82860_GBA_MASK) << - (I82860_GBA_SHIFT - PAGE_SHIFT); - debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index, - cumul_size); - - if (cumul_size == last_cumul_size) - continue; /* not populated */ - - csrow->first_page = last_cumul_size; - csrow->last_page = cumul_size - 1; - csrow->nr_pages = cumul_size - last_cumul_size; - last_cumul_size = cumul_size; - csrow->grain = 1 << 12; /* I82860_EAP has 4KiB reolution */ - csrow->mtype = MEM_RMBS; - csrow->dtype = DEV_UNKNOWN; - csrow->edac_mode = mchcfg_ddim ? EDAC_SECDED : EDAC_NONE; + if (edac_mc_add_mc(mci,0)) { + debugf3("%s(): failed edac_mc_add_mc()\n", __func__); + goto fail; } - i82860_get_error_info(mci, &discard); /* clear counters */ + /* get this far and it's successful */ + debugf3("%s(): success\n", __func__); - if (edac_mc_add_mc(mci)) { - debugf3("%s(): failed edac_mc_add_mc()\n", __func__); - edac_mc_free(mci); - } else { - /* get this far and it's successful */ - debugf3("%s(): success\n", __func__); - rc = 0; - } + return 0; - return rc; +fail: + edac_mc_free(mci); + return -ENODEV; } /* returns count (>= 0), or negative on error */ @@ -240,7 +249,7 @@ static void __devexit i82860_remove_one(struct pci_dev *pdev) debugf0("%s()\n", __func__); - if ((mci = edac_mc_del_mc(pdev)) == NULL) + if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL) return; edac_mc_free(mci); diff --git a/drivers/edac/i82875p_edac.c b/drivers/edac/i82875p_edac.c index 0aec92698f1..161fe09a6d3 100644 --- a/drivers/edac/i82875p_edac.c +++ b/drivers/edac/i82875p_edac.c @@ -13,7 +13,6 @@ * Note: E7210 appears same as D82875P - zhenyu.z.wang at intel.com */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/pci.h> @@ -21,6 +20,9 @@ #include <linux/slab.h> #include "edac_mc.h" +#define I82875P_REVISION " Ver: 2.0.1 " __DATE__ +#define EDAC_MOD_STR "i82875p_edac" + #define i82875p_printk(level, fmt, arg...) \ edac_printk(level, "i82875p", fmt, ##arg) @@ -185,18 +187,22 @@ static int i82875p_registered = 1; static void i82875p_get_error_info(struct mem_ctl_info *mci, struct i82875p_error_info *info) { + struct pci_dev *pdev; + + pdev = to_pci_dev(mci->dev); + /* * This is a mess because there is no atomic way to read all the * registers at once and the registers can transition from CE being * overwritten by UE. */ - pci_read_config_word(mci->pdev, I82875P_ERRSTS, &info->errsts); - pci_read_config_dword(mci->pdev, I82875P_EAP, &info->eap); - pci_read_config_byte(mci->pdev, I82875P_DES, &info->des); - pci_read_config_byte(mci->pdev, I82875P_DERRSYN, &info->derrsyn); - pci_read_config_word(mci->pdev, I82875P_ERRSTS, &info->errsts2); + pci_read_config_word(pdev, I82875P_ERRSTS, &info->errsts); + pci_read_config_dword(pdev, I82875P_EAP, &info->eap); + pci_read_config_byte(pdev, I82875P_DES, &info->des); + pci_read_config_byte(pdev, I82875P_DERRSYN, &info->derrsyn); + pci_read_config_word(pdev, I82875P_ERRSTS, &info->errsts2); - pci_write_bits16(mci->pdev, I82875P_ERRSTS, 0x0081, 0x0081); + pci_write_bits16(pdev, I82875P_ERRSTS, 0x0081, 0x0081); /* * If the error is the same then we can for both reads then @@ -208,9 +214,9 @@ static void i82875p_get_error_info(struct mem_ctl_info *mci, return; if ((info->errsts ^ info->errsts2) & 0x0081) { - pci_read_config_dword(mci->pdev, I82875P_EAP, &info->eap); - pci_read_config_byte(mci->pdev, I82875P_DES, &info->des); - pci_read_config_byte(mci->pdev, I82875P_DERRSYN, + pci_read_config_dword(pdev, I82875P_EAP, &info->eap); + pci_read_config_byte(pdev, I82875P_DES, &info->des); + pci_read_config_byte(pdev, I82875P_DERRSYN, &info->derrsyn); } } @@ -259,116 +265,109 @@ static void i82875p_check(struct mem_ctl_info *mci) extern int pci_proc_attach_device(struct pci_dev *); #endif -static int i82875p_probe1(struct pci_dev *pdev, int dev_idx) +/* Return 0 on success or 1 on failure. */ +static int i82875p_setup_overfl_dev(struct pci_dev *pdev, + struct pci_dev **ovrfl_pdev, void __iomem **ovrfl_window) { - int rc = -ENODEV; - int index; - struct mem_ctl_info *mci = NULL; - struct i82875p_pvt *pvt = NULL; - unsigned long last_cumul_size; - struct pci_dev *ovrfl_pdev; - void __iomem *ovrfl_window = NULL; - u32 drc; - u32 drc_chan; /* Number of channels 0=1chan,1=2chan */ - u32 nr_chans; - u32 drc_ddim; /* DRAM Data Integrity Mode 0=none,2=edac */ - struct i82875p_error_info discard; + struct pci_dev *dev; + void __iomem *window; - debugf0("%s()\n", __func__); - ovrfl_pdev = pci_get_device(PCI_VEND_DEV(INTEL, 82875_6), NULL); + *ovrfl_pdev = NULL; + *ovrfl_window = NULL; + dev = pci_get_device(PCI_VEND_DEV(INTEL, 82875_6), NULL); - if (!ovrfl_pdev) { - /* - * Intel tells BIOS developers to hide device 6 which + if (dev == NULL) { + /* Intel tells BIOS developers to hide device 6 which * configures the overflow device access containing * the DRBs - this is where we expose device 6. * http://www.x86-secret.com/articles/tweak/pat/patsecrets-2.htm */ pci_write_bits8(pdev, 0xf4, 0x2, 0x2); - ovrfl_pdev = - pci_scan_single_device(pdev->bus, PCI_DEVFN(6, 0)); + dev = pci_scan_single_device(pdev->bus, PCI_DEVFN(6, 0)); - if (!ovrfl_pdev) - return -ENODEV; + if (dev == NULL) + return 1; } + *ovrfl_pdev = dev; + #ifdef CONFIG_PROC_FS - if (!ovrfl_pdev->procent && pci_proc_attach_device(ovrfl_pdev)) { - i82875p_printk(KERN_ERR, - "%s(): Failed to attach overflow device\n", __func__); - return -ENODEV; + if ((dev->procent == NULL) && pci_proc_attach_device(dev)) { + i82875p_printk(KERN_ERR, "%s(): Failed to attach overflow " + "device\n", __func__); + return 1; } -#endif - /* CONFIG_PROC_FS */ - if (pci_enable_device(ovrfl_pdev)) { - i82875p_printk(KERN_ERR, - "%s(): Failed to enable overflow device\n", __func__); - return -ENODEV; +#endif /* CONFIG_PROC_FS */ + if (pci_enable_device(dev)) { + i82875p_printk(KERN_ERR, "%s(): Failed to enable overflow " + "device\n", __func__); + return 1; } - if (pci_request_regions(ovrfl_pdev, pci_name(ovrfl_pdev))) { + if (pci_request_regions(dev, pci_name(dev))) { #ifdef CORRECT_BIOS goto fail0; #endif } /* cache is irrelevant for PCI bus reads/writes */ - ovrfl_window = ioremap_nocache(pci_resource_start(ovrfl_pdev, 0), - pci_resource_len(ovrfl_pdev, 0)); + window = ioremap_nocache(pci_resource_start(dev, 0), + pci_resource_len(dev, 0)); - if (!ovrfl_window) { + if (window == NULL) { i82875p_printk(KERN_ERR, "%s(): Failed to ioremap bar6\n", - __func__); + __func__); goto fail1; } - /* need to find out the number of channels */ - drc = readl(ovrfl_window + I82875P_DRC); - drc_chan = ((drc >> 21) & 0x1); - nr_chans = drc_chan + 1; + *ovrfl_window = window; + return 0; - drc_ddim = (drc >> 18) & 0x1; - mci = edac_mc_alloc(sizeof(*pvt), I82875P_NR_CSROWS(nr_chans), - nr_chans); +fail1: + pci_release_regions(dev); - if (!mci) { - rc = -ENOMEM; - goto fail2; - } +#ifdef CORRECT_BIOS +fail0: + pci_disable_device(dev); +#endif + /* NOTE: the ovrfl proc entry and pci_dev are intentionally left */ + return 1; +} - debugf3("%s(): init mci\n", __func__); - mci->pdev = pdev; - mci->mtype_cap = MEM_FLAG_DDR; - mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED; - mci->edac_cap = EDAC_FLAG_UNKNOWN; - /* adjust FLAGS */ - mci->mod_name = EDAC_MOD_STR; - mci->mod_ver = "$Revision: 1.5.2.11 $"; - mci->ctl_name = i82875p_devs[dev_idx].ctl_name; - mci->edac_check = i82875p_check; - mci->ctl_page_to_phys = NULL; - debugf3("%s(): init pvt\n", __func__); - pvt = (struct i82875p_pvt *) mci->pvt_info; - pvt->ovrfl_pdev = ovrfl_pdev; - pvt->ovrfl_window = ovrfl_window; +/* Return 1 if dual channel mode is active. Else return 0. */ +static inline int dual_channel_active(u32 drc) +{ + return (drc >> 21) & 0x1; +} - /* - * The dram row boundary (DRB) reg values are boundary address + +static void i82875p_init_csrows(struct mem_ctl_info *mci, + struct pci_dev *pdev, void __iomem *ovrfl_window, u32 drc) +{ + struct csrow_info *csrow; + unsigned long last_cumul_size; + u8 value; + u32 drc_ddim; /* DRAM Data Integrity Mode 0=none,2=edac */ + u32 cumul_size; + int index; + + drc_ddim = (drc >> 18) & 0x1; + last_cumul_size = 0; + + /* The dram row boundary (DRB) reg values are boundary address * for each DRAM row with a granularity of 32 or 64MB (single/dual * channel operation). DRB regs are cumulative; therefore DRB7 will * contain the total memory contained in all eight rows. */ - for (last_cumul_size = index = 0; index < mci->nr_csrows; index++) { - u8 value; - u32 cumul_size; - struct csrow_info *csrow = &mci->csrows[index]; + + for (index = 0; index < mci->nr_csrows; index++) { + csrow = &mci->csrows[index]; value = readb(ovrfl_window + I82875P_DRB + index); cumul_size = value << (I82875P_DRB_SHIFT - PAGE_SHIFT); debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index, cumul_size); - if (cumul_size == last_cumul_size) continue; /* not populated */ @@ -376,35 +375,75 @@ static int i82875p_probe1(struct pci_dev *pdev, int dev_idx) csrow->last_page = cumul_size - 1; csrow->nr_pages = cumul_size - last_cumul_size; last_cumul_size = cumul_size; - csrow->grain = 1 << 12; /* I82875P_EAP has 4KiB reolution */ + csrow->grain = 1 << 12; /* I82875P_EAP has 4KiB reolution */ csrow->mtype = MEM_DDR; csrow->dtype = DEV_UNKNOWN; csrow->edac_mode = drc_ddim ? EDAC_SECDED : EDAC_NONE; } +} + +static int i82875p_probe1(struct pci_dev *pdev, int dev_idx) +{ + int rc = -ENODEV; + struct mem_ctl_info *mci; + struct i82875p_pvt *pvt; + struct pci_dev *ovrfl_pdev; + void __iomem *ovrfl_window; + u32 drc; + u32 nr_chans; + struct i82875p_error_info discard; + + debugf0("%s()\n", __func__); + ovrfl_pdev = pci_get_device(PCI_VEND_DEV(INTEL, 82875_6), NULL); + + if (i82875p_setup_overfl_dev(pdev, &ovrfl_pdev, &ovrfl_window)) + return -ENODEV; + drc = readl(ovrfl_window + I82875P_DRC); + nr_chans = dual_channel_active(drc) + 1; + mci = edac_mc_alloc(sizeof(*pvt), I82875P_NR_CSROWS(nr_chans), + nr_chans); + + if (!mci) { + rc = -ENOMEM; + goto fail0; + } + debugf3("%s(): init mci\n", __func__); + mci->dev = &pdev->dev; + mci->mtype_cap = MEM_FLAG_DDR; + mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_SECDED; + mci->edac_cap = EDAC_FLAG_UNKNOWN; + mci->mod_name = EDAC_MOD_STR; + mci->mod_ver = I82875P_REVISION; + mci->ctl_name = i82875p_devs[dev_idx].ctl_name; + mci->edac_check = i82875p_check; + mci->ctl_page_to_phys = NULL; + debugf3("%s(): init pvt\n", __func__); + pvt = (struct i82875p_pvt *) mci->pvt_info; + pvt->ovrfl_pdev = ovrfl_pdev; + pvt->ovrfl_window = ovrfl_window; + i82875p_init_csrows(mci, pdev, ovrfl_window, drc); i82875p_get_error_info(mci, &discard); /* clear counters */ - if (edac_mc_add_mc(mci)) { + /* Here we assume that we will never see multiple instances of this + * type of memory controller. The ID is therefore hardcoded to 0. + */ + if (edac_mc_add_mc(mci,0)) { debugf3("%s(): failed edac_mc_add_mc()\n", __func__); - goto fail3; + goto fail1; } /* get this far and it's successful */ debugf3("%s(): success\n", __func__); return 0; -fail3: +fail1: edac_mc_free(mci); -fail2: +fail0: iounmap(ovrfl_window); - -fail1: pci_release_regions(ovrfl_pdev); -#ifdef CORRECT_BIOS -fail0: -#endif pci_disable_device(ovrfl_pdev); /* NOTE: the ovrfl proc entry and pci_dev are intentionally left */ return rc; @@ -437,7 +476,7 @@ static void __devexit i82875p_remove_one(struct pci_dev *pdev) debugf0("%s()\n", __func__); - if ((mci = edac_mc_del_mc(pdev)) == NULL) + if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL) return; pvt = (struct i82875p_pvt *) mci->pvt_info; diff --git a/drivers/edac/r82600_edac.c b/drivers/edac/r82600_edac.c index 2c29fafe67c..a49cf0a3939 100644 --- a/drivers/edac/r82600_edac.c +++ b/drivers/edac/r82600_edac.c @@ -15,7 +15,6 @@ * references to this document given in [] */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/pci.h> @@ -23,6 +22,9 @@ #include <linux/slab.h> #include "edac_mc.h" +#define R82600_REVISION " Ver: 2.0.1 " __DATE__ +#define EDAC_MOD_STR "r82600_edac" + #define r82600_printk(level, fmt, arg...) \ edac_printk(level, "r82600", fmt, ##arg) @@ -134,17 +136,20 @@ static unsigned int disable_hardware_scrub = 0; static void r82600_get_error_info (struct mem_ctl_info *mci, struct r82600_error_info *info) { - pci_read_config_dword(mci->pdev, R82600_EAP, &info->eapr); + struct pci_dev *pdev; + + pdev = to_pci_dev(mci->dev); + pci_read_config_dword(pdev, R82600_EAP, &info->eapr); if (info->eapr & BIT(0)) /* Clear error to allow next error to be reported [p.62] */ - pci_write_bits32(mci->pdev, R82600_EAP, + pci_write_bits32(pdev, R82600_EAP, ((u32) BIT(0) & (u32) BIT(1)), ((u32) BIT(0) & (u32) BIT(1))); if (info->eapr & BIT(1)) /* Clear error to allow next error to be reported [p.62] */ - pci_write_bits32(mci->pdev, R82600_EAP, + pci_write_bits32(pdev, R82600_EAP, ((u32) BIT(0) & (u32) BIT(1)), ((u32) BIT(0) & (u32) BIT(1))); } @@ -200,25 +205,72 @@ static void r82600_check(struct mem_ctl_info *mci) r82600_process_error_info(mci, &info, 1); } -static int r82600_probe1(struct pci_dev *pdev, int dev_idx) +static inline int ecc_enabled(u8 dramcr) +{ + return dramcr & BIT(5); +} + +static void r82600_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, + u8 dramcr) { - int rc = -ENODEV; + struct csrow_info *csrow; int index; - struct mem_ctl_info *mci = NULL; + u8 drbar; /* SDRAM Row Boundry Address Register */ + u32 row_high_limit, row_high_limit_last; + u32 reg_sdram, ecc_on, row_base; + + ecc_on = ecc_enabled(dramcr); + reg_sdram = dramcr & BIT(4); + row_high_limit_last = 0; + + for (index = 0; index < mci->nr_csrows; index++) { + csrow = &mci->csrows[index]; + + /* find the DRAM Chip Select Base address and mask */ + pci_read_config_byte(pdev, R82600_DRBA + index, &drbar); + + debugf1("%s() Row=%d DRBA = %#0x\n", __func__, index, drbar); + + row_high_limit = ((u32) drbar << 24); +/* row_high_limit = ((u32)drbar << 24) | 0xffffffUL; */ + + debugf1("%s() Row=%d, Boundry Address=%#0x, Last = %#0x\n", + __func__, index, row_high_limit, row_high_limit_last); + + /* Empty row [p.57] */ + if (row_high_limit == row_high_limit_last) + continue; + + row_base = row_high_limit_last; + + csrow->first_page = row_base >> PAGE_SHIFT; + csrow->last_page = (row_high_limit >> PAGE_SHIFT) - 1; + csrow->nr_pages = csrow->last_page - csrow->first_page + 1; + /* Error address is top 19 bits - so granularity is * + * 14 bits */ + csrow->grain = 1 << 14; + csrow->mtype = reg_sdram ? MEM_RDDR : MEM_DDR; + /* FIXME - check that this is unknowable with this chipset */ + csrow->dtype = DEV_UNKNOWN; + + /* Mode is global on 82600 */ + csrow->edac_mode = ecc_on ? EDAC_SECDED : EDAC_NONE; + row_high_limit_last = row_high_limit; + } +} + +static int r82600_probe1(struct pci_dev *pdev, int dev_idx) +{ + struct mem_ctl_info *mci; u8 dramcr; - u32 ecc_on; - u32 reg_sdram; u32 eapr; u32 scrub_disabled; u32 sdram_refresh_rate; - u32 row_high_limit_last = 0; struct r82600_error_info discard; debugf0("%s()\n", __func__); pci_read_config_byte(pdev, R82600_DRAMC, &dramcr); pci_read_config_dword(pdev, R82600_EAP, &eapr); - ecc_on = dramcr & BIT(5); - reg_sdram = dramcr & BIT(4); scrub_disabled = eapr & BIT(31); sdram_refresh_rate = dramcr & (BIT(0) | BIT(1)); debugf2("%s(): sdram refresh rate = %#0x\n", __func__, @@ -226,13 +278,11 @@ static int r82600_probe1(struct pci_dev *pdev, int dev_idx) debugf2("%s(): DRAMC register = %#0x\n", __func__, dramcr); mci = edac_mc_alloc(0, R82600_NR_CSROWS, R82600_NR_CHANS); - if (mci == NULL) { - rc = -ENOMEM; - goto fail; - } + if (mci == NULL) + return -ENOMEM; debugf0("%s(): mci = %p\n", __func__, mci); - mci->pdev = pdev; + mci->dev = &pdev->dev; mci->mtype_cap = MEM_FLAG_RDDR | MEM_FLAG_DDR; mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_EC | EDAC_FLAG_SECDED; /* FIXME try to work out if the chip leads have been used for COM2 @@ -245,7 +295,7 @@ static int r82600_probe1(struct pci_dev *pdev, int dev_idx) * is possible. */ mci->edac_cap = EDAC_FLAG_NONE | EDAC_FLAG_EC | EDAC_FLAG_SECDED; - if (ecc_on) { + if (ecc_enabled(dramcr)) { if (scrub_disabled) debugf3("%s(): mci = %p - Scrubbing disabled! EAP: " "%#0x\n", __func__, mci, eapr); @@ -253,53 +303,17 @@ static int r82600_probe1(struct pci_dev *pdev, int dev_idx) mci->edac_cap = EDAC_FLAG_NONE; mci->mod_name = EDAC_MOD_STR; - mci->mod_ver = "$Revision: 1.1.2.6 $"; + mci->mod_ver = R82600_REVISION; mci->ctl_name = "R82600"; mci->edac_check = r82600_check; mci->ctl_page_to_phys = NULL; - - for (index = 0; index < mci->nr_csrows; index++) { - struct csrow_info *csrow = &mci->csrows[index]; - u8 drbar; /* sDram Row Boundry Address Register */ - u32 row_high_limit; - u32 row_base; - - /* find the DRAM Chip Select Base address and mask */ - pci_read_config_byte(mci->pdev, R82600_DRBA + index, &drbar); - - debugf1("MC%d: %s() Row=%d DRBA = %#0x\n", mci->mc_idx, - __func__, index, drbar); - - row_high_limit = ((u32) drbar << 24); -/* row_high_limit = ((u32)drbar << 24) | 0xffffffUL; */ - - debugf1("MC%d: %s() Row=%d, Boundry Address=%#0x, Last = " - "%#0x \n", mci->mc_idx, __func__, index, - row_high_limit, row_high_limit_last); - - /* Empty row [p.57] */ - if (row_high_limit == row_high_limit_last) - continue; - - row_base = row_high_limit_last; - csrow->first_page = row_base >> PAGE_SHIFT; - csrow->last_page = (row_high_limit >> PAGE_SHIFT) - 1; - csrow->nr_pages = csrow->last_page - csrow->first_page + 1; - /* Error address is top 19 bits - so granularity is * - * 14 bits */ - csrow->grain = 1 << 14; - csrow->mtype = reg_sdram ? MEM_RDDR : MEM_DDR; - /* FIXME - check that this is unknowable with this chipset */ - csrow->dtype = DEV_UNKNOWN; - - /* Mode is global on 82600 */ - csrow->edac_mode = ecc_on ? EDAC_SECDED : EDAC_NONE; - row_high_limit_last = row_high_limit; - } - + r82600_init_csrows(mci, pdev, dramcr); r82600_get_error_info(mci, &discard); /* clear counters */ - if (edac_mc_add_mc(mci)) { + /* Here we assume that we will never see multiple instances of this + * type of memory controller. The ID is therefore hardcoded to 0. + */ + if (edac_mc_add_mc(mci,0)) { debugf3("%s(): failed edac_mc_add_mc()\n", __func__); goto fail; } @@ -309,17 +323,15 @@ static int r82600_probe1(struct pci_dev *pdev, int dev_idx) if (disable_hardware_scrub) { debugf3("%s(): Disabling Hardware Scrub (scrub on error)\n", __func__); - pci_write_bits32(mci->pdev, R82600_EAP, BIT(31), BIT(31)); + pci_write_bits32(pdev, R82600_EAP, BIT(31), BIT(31)); } debugf3("%s(): success\n", __func__); return 0; fail: - if (mci) - edac_mc_free(mci); - - return rc; + edac_mc_free(mci); + return -ENODEV; } /* returns count (>= 0), or negative on error */ @@ -338,7 +350,7 @@ static void __devexit r82600_remove_one(struct pci_dev *pdev) debugf0("%s()\n", __func__); - if ((mci = edac_mc_del_mc(pdev)) == NULL) + if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL) return; edac_mc_free(mci); diff --git a/drivers/eisa/virtual_root.c b/drivers/eisa/virtual_root.c index 0f97a0cb0ff..9b4fcac03ad 100644 --- a/drivers/eisa/virtual_root.c +++ b/drivers/eisa/virtual_root.c @@ -7,7 +7,6 @@ * This code is released under the GPL version 2. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/platform_device.h> #include <linux/eisa.h> diff --git a/drivers/fc4/fc_syms.c b/drivers/fc4/fc_syms.c index ed85dfcef69..8700a8076d0 100644 --- a/drivers/fc4/fc_syms.c +++ b/drivers/fc4/fc_syms.c @@ -2,7 +2,6 @@ * We should not even be trying to compile this if we are not doing * a module. */ -#include <linux/config.h> #include <linux/module.h> #ifdef CONFIG_MODULES diff --git a/drivers/fc4/soc.c b/drivers/fc4/soc.c index cf8768b8d1f..3b07e0ca81c 100644 --- a/drivers/fc4/soc.c +++ b/drivers/fc4/soc.c @@ -637,7 +637,7 @@ static inline void soc_init(struct sbus_dev *sdev, int no) irq = sdev->irqs[0]; - if (request_irq (irq, soc_intr, SA_SHIRQ, "SOC", (void *)s)) { + if (request_irq (irq, soc_intr, IRQF_SHARED, "SOC", (void *)s)) { soc_printk ("Cannot order irq %d to go\n", irq); socs = s->next; return; diff --git a/drivers/fc4/socal.c b/drivers/fc4/socal.c index f52d1e5bd5a..2b75edc5859 100644 --- a/drivers/fc4/socal.c +++ b/drivers/fc4/socal.c @@ -761,7 +761,7 @@ static inline void socal_init(struct sbus_dev *sdev, int no) irq = sdev->irqs[0]; - if (request_irq (irq, socal_intr, SA_SHIRQ, "SOCAL", (void *)s)) { + if (request_irq (irq, socal_intr, IRQF_SHARED, "SOCAL", (void *)s)) { socal_printk ("Cannot order irq %d to go\n", irq); socals = s->next; return; diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c index fdb8b042e64..23b08668545 100644 --- a/drivers/firmware/dell_rbu.c +++ b/drivers/firmware/dell_rbu.c @@ -34,7 +34,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ -#include <linux/config.h> #include <linux/init.h> #include <linux/module.h> #include <linux/string.h> diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index 9b7e4d52ffd..8ebce1c03ad 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c @@ -66,7 +66,6 @@ */ #include <linux/capability.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/firmware/pcdp.c b/drivers/firmware/pcdp.c index c37baf9448b..c2ad72fefd9 100644 --- a/drivers/firmware/pcdp.c +++ b/drivers/firmware/pcdp.c @@ -11,7 +11,6 @@ * published by the Free Software Foundation. */ -#include <linux/config.h> #include <linux/acpi.h> #include <linux/console.h> #include <linux/efi.h> diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c index a6764ff0080..9d67320e684 100644 --- a/drivers/hwmon/hwmon-vid.c +++ b/drivers/hwmon/hwmon-vid.c @@ -22,7 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/hwmon-vid.h> diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index e407c74bda3..7576ec9426a 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c @@ -35,7 +35,6 @@ w83792d 9 7 7 3 0x7a 0x5ca3 yes no */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 8b46ef7d9ff..7be1d0a3e8f 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -494,8 +494,8 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id err = pci_request_region(dev, SMBBAR, i801_driver.name); if (err) { dev_err(&dev->dev, "Failed to request SMBus region " - "0x%lx-0x%lx\n", i801_smba, - pci_resource_end(dev, SMBBAR)); + "0x%lx-0x%Lx\n", i801_smba, + (unsigned long long)pci_resource_end(dev, SMBBAR)); goto exit; } diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 87fae937e66..0599bbd65d9 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c @@ -28,7 +28,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/ioport.h> diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c index d00a02fc23e..aca7e166860 100644 --- a/drivers/i2c/busses/i2c-iop3xx.c +++ b/drivers/i2c/busses/i2c-iop3xx.c @@ -26,7 +26,6 @@ * the Free Software Foundation, version 2. */ -#include <linux/config.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/module.h> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 2721e4c8184..377ab40944b 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c @@ -13,7 +13,6 @@ * warranty of any kind, whether express or implied. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/sched.h> @@ -319,7 +318,7 @@ static int fsl_i2c_probe(struct platform_device *pdev) if (i2c->irq != 0) if ((result = request_irq(i2c->irq, mpc_i2c_isr, - SA_SHIRQ, "i2c-mpc", i2c)) < 0) { + IRQF_SHARED, "i2c-mpc", i2c)) < 0) { printk(KERN_ERR "i2c-mpc - failed to attach interrupt\n"); goto fail_irq; diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index df786eb5529..2a0b3be7cdd 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c @@ -20,7 +20,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 5155010b455..ee114b48fac 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -968,7 +968,7 @@ static int i2c_pxa_probe(struct platform_device *dev) #endif pxa_set_cken(CKEN14_I2C, 1); - ret = request_irq(IRQ_I2C, i2c_pxa_handler, SA_INTERRUPT, + ret = request_irq(IRQ_I2C, i2c_pxa_handler, IRQF_DISABLED, "pxa2xx-i2c", i2c); if (ret) goto out; diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index f7d40f8e5f5..5d2950e91fc 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -20,7 +20,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> @@ -829,7 +828,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) goto out; } - ret = request_irq(res->start, s3c24xx_i2c_irq, SA_INTERRUPT, + ret = request_irq(res->start, s3c24xx_i2c_irq, IRQF_DISABLED, pdev->name, i2c); if (ret != 0) { diff --git a/drivers/i2c/busses/scx200_i2c.c b/drivers/i2c/busses/scx200_i2c.c index 27fbfecc414..cb3ef5ac99f 100644 --- a/drivers/i2c/busses/scx200_i2c.c +++ b/drivers/i2c/busses/scx200_i2c.c @@ -21,7 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/kernel.h> diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c index e6f1ab7b913..f92505b94c6 100644 --- a/drivers/i2c/chips/isp1301_omap.c +++ b/drivers/i2c/chips/isp1301_omap.c @@ -21,7 +21,6 @@ #undef DEBUG #undef VERBOSE -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> @@ -909,7 +908,7 @@ static int otg_bind(struct isp1301 *isp) if (otg_dev) status = request_irq(otg_dev->resource[1].start, omap_otg_irq, - SA_INTERRUPT, DRIVER_NAME, isp); + IRQF_DISABLED, DRIVER_NAME, isp); else status = -ENODEV; @@ -1579,7 +1578,7 @@ fail1: } status = request_irq(isp->irq, isp1301_irq, - SA_SAMPLE_RANDOM, DRIVER_NAME, isp); + IRQF_SAMPLE_RANDOM, DRIVER_NAME, isp); if (status < 0) { dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n", isp->irq, status); diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c index 179b1e022d8..e7e27049fbf 100644 --- a/drivers/i2c/chips/tps65010.c +++ b/drivers/i2c/chips/tps65010.c @@ -19,7 +19,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> @@ -522,14 +521,14 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind) } #ifdef CONFIG_ARM - irqflags = SA_SAMPLE_RANDOM | SA_TRIGGER_LOW; + irqflags = IRQF_SAMPLE_RANDOM | IRQF_TRIGGER_LOW; if (machine_is_omap_h2()) { tps->model = TPS65010; omap_cfg_reg(W4_GPIO58); tps->irq = OMAP_GPIO_IRQ(58); omap_request_gpio(58); omap_set_gpio_direction(58, 1); - irqflags |= SA_TRIGGER_FALLING; + irqflags |= IRQF_TRIGGER_FALLING; } if (machine_is_omap_osk()) { tps->model = TPS65010; @@ -537,7 +536,7 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind) tps->irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)); omap_request_gpio(OMAP_MPUIO(1)); omap_set_gpio_direction(OMAP_MPUIO(1), 1); - irqflags |= SA_TRIGGER_FALLING; + irqflags |= IRQF_TRIGGER_FALLING; } if (machine_is_omap_h3()) { tps->model = TPS65013; @@ -545,7 +544,7 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind) // FIXME set up this board's IRQ ... } #else - irqflags = SA_SAMPLE_RANDOM; + irqflags = IRQF_SAMPLE_RANDOM; #endif if (tps->irq > 0) { diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index d633081fa4c..d1266fe2d1a 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -774,11 +774,18 @@ config BLK_DEV_IDEDMA_PMAC performance. config BLK_DEV_IDE_PMAC_BLINK - bool "Blink laptop LED on drive activity" + bool "Blink laptop LED on drive activity (DEPRECATED)" depends on BLK_DEV_IDE_PMAC && ADB_PMU + select ADB_PMU_LED + select LEDS_TRIGGERS + select LEDS_TRIGGER_IDE_DISK help This option enables the use of the sleep LED as a hard drive activity LED. + This option is deprecated, it only selects ADB_PMU_LED and + LEDS_TRIGGER_IDE_DISK and changes the code in the new led class + device to default to the ide-disk trigger (which should be set + from userspace via sysfs). config BLK_DEV_IDE_SWARM tristate "IDE for Sibyte evaluation boards" diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 308897e57e4..8a1c27f2869 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -6,7 +6,6 @@ * Please note that this platform does not support 32-bit IDE IO. */ -#include <linux/config.h> #include <linux/string.h> #include <linux/module.h> #include <linux/ioport.h> diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index cd15e626051..5797e0b5a13 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c @@ -19,7 +19,6 @@ #undef REALLY_SLOW_IO /* most systems can safely undef this */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/timer.h> diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c index fb91cb8bf2d..15955996a1f 100644 --- a/drivers/ide/h8300/ide-h8300.c +++ b/drivers/ide/h8300/ide-h8300.c @@ -5,7 +5,6 @@ #include <linux/init.h> #include <linux/ide.h> -#include <linux/config.h> #include <asm/io.h> #include <asm/irq.h> diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 99fa42402e7..654d4cd0984 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -301,7 +301,6 @@ #define IDECD_VERSION "4.61" -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> @@ -3527,8 +3526,6 @@ static int ide_cd_probe(ide_drive_t *drive) drive->driver_data = info; g->minors = 1; - snprintf(g->devfs_name, sizeof(g->devfs_name), - "%s/cd", drive->devfs_name); g->driverfs_dev = &drive->gendev; g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; if (ide_cdrom_setup(drive)) { diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index f033d732f38..f712e4cfd9d 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -47,7 +47,6 @@ //#define DEBUG -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/string.h> @@ -1018,7 +1017,6 @@ static void ide_disk_release(struct kref *kref) struct gendisk *g = idkp->disk; drive->driver_data = NULL; - drive->devfs_name[0] = '\0'; g->private_data = NULL; put_disk(g); kfree(idkp); @@ -1222,7 +1220,6 @@ static int ide_disk_probe(ide_drive_t *drive) drive->attach = 1; g->minors = 1 << PARTN_BITS; - strcpy(g->devfs_name, drive->devfs_name); g->driverfs_dev = &drive->gendev; g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0; set_capacity(g, idedisk_capacity(drive)); diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 783a2475ee8..98918fb6b2c 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -74,7 +74,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 4656587aa2f..6ca3476d02c 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -82,7 +82,6 @@ #define IDEFLOPPY_VERSION "0.99.newide" -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/string.h> @@ -2176,7 +2175,6 @@ static int ide_floppy_probe(ide_drive_t *drive) g->minors = 1 << PARTN_BITS; g->driverfs_dev = &drive->gendev; - strcpy(g->devfs_name, drive->devfs_name); g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0; g->fops = &idefloppy_ops; drive->attach = 1; diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 26ceab1e90b..7dba9992ad3 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -24,7 +24,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/string.h> diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 32117f0ec5c..657165297dc 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -6,7 +6,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/string.h> diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 7ddb1182873..1feff23487d 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c @@ -1,4 +1,3 @@ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/string.h> diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 9ebf8ae2a5e..9cadf0106c6 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -33,7 +33,6 @@ #undef REALLY_SLOW_IO /* most systems can safely undef this */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/string.h> @@ -47,7 +46,6 @@ #include <linux/slab.h> #include <linux/delay.h> #include <linux/ide.h> -#include <linux/devfs_fs_kernel.h> #include <linux/spinlock.h> #include <linux/kmod.h> #include <linux/pci.h> @@ -1006,7 +1004,7 @@ static int ide_init_queue(ide_drive_t *drive) * and irq serialization situations. This is somewhat complex because * it handles static as well as dynamic (PCMCIA) IDE interfaces. * - * The SA_INTERRUPT in sa_flags means ide_intr() is always entered with + * The IRQF_DISABLED in sa_flags means ide_intr() is always entered with * interrupts completely disabled. This can be bad for interrupt latency, * but anything else has led to problems on some machines. We re-enable * interrupts as much as we can safely do in most places. @@ -1092,15 +1090,15 @@ static int init_irq (ide_hwif_t *hwif) * Allocate the irq, if not already obtained for another hwif */ if (!match || match->irq != hwif->irq) { - int sa = SA_INTERRUPT; + int sa = IRQF_DISABLED; #if defined(__mc68000__) || defined(CONFIG_APUS) - sa = SA_SHIRQ; + sa = IRQF_SHARED; #endif /* __mc68000__ || CONFIG_APUS */ if (IDE_CHIPSET_IS_PCI(hwif->chipset)) { - sa = SA_SHIRQ; + sa = IRQF_SHARED; #ifndef CONFIG_IDEPCI_SHARE_IRQ - sa |= SA_INTERRUPT; + sa |= IRQF_DISABLED; #endif /* CONFIG_IDEPCI_SHARE_IRQ */ } @@ -1279,10 +1277,6 @@ static void drive_release_dev (struct device *dev) ide_drive_t *drive = container_of(dev, ide_drive_t, gendev); spin_lock_irq(&ide_lock); - if (drive->devfs_name[0] != '\0') { - devfs_remove(drive->devfs_name); - drive->devfs_name[0] = '\0'; - } ide_remove_drive_from_hwgroup(drive); kfree(drive->id); drive->id = NULL; @@ -1316,12 +1310,6 @@ static void init_gendisk (ide_hwif_t *hwif) drive->gendev.bus = &ide_bus_type; drive->gendev.driver_data = drive; drive->gendev.release = drive_release_dev; - if (drive->present) { - sprintf(drive->devfs_name, "ide/host%d/bus%d/target%d/lun%d", - (hwif->channel && hwif->mate) ? - hwif->mate->index : hwif->index, - hwif->channel, unit, drive->lun); - } } blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS, THIS_MODULE, ata_probe, ata_lock, hwif); diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index 84665e2ba3c..c12f1b71e93 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c @@ -22,7 +22,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <asm/uaccess.h> diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 09f3a7dab28..7067ab99792 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -424,7 +424,6 @@ #define IDETAPE_VERSION "1.19" -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/string.h> @@ -435,7 +434,6 @@ #include <linux/interrupt.h> #include <linux/jiffies.h> #include <linux/major.h> -#include <linux/devfs_fs_kernel.h> #include <linux/errno.h> #include <linux/genhd.h> #include <linux/slab.h> @@ -4726,9 +4724,6 @@ static void ide_tape_release(struct kref *kref) MKDEV(IDETAPE_MAJOR, tape->minor)); class_device_destroy(idetape_sysfs_class, MKDEV(IDETAPE_MAJOR, tape->minor + 128)); - devfs_remove("%s/mt", drive->devfs_name); - devfs_remove("%s/mtn", drive->devfs_name); - devfs_unregister_tape(g->number); idetape_devs[tape->minor] = NULL; g->private_data = NULL; put_disk(g); @@ -4902,14 +4897,6 @@ static int ide_tape_probe(ide_drive_t *drive) class_device_create(idetape_sysfs_class, NULL, MKDEV(IDETAPE_MAJOR, minor + 128), &drive->gendev, "n%s", tape->name); - devfs_mk_cdev(MKDEV(HWIF(drive)->major, minor), - S_IFCHR | S_IRUGO | S_IWUGO, - "%s/mt", drive->devfs_name); - devfs_mk_cdev(MKDEV(HWIF(drive)->major, minor + 128), - S_IFCHR | S_IRUGO | S_IWUGO, - "%s/mtn", drive->devfs_name); - - g->number = devfs_register_tape(drive->devfs_name); g->fops = &idetape_block_ops; ide_register_region(g); diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index a839b2a8f6f..04547eb0833 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -27,7 +27,6 @@ * request. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/string.h> diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 59fe358048b..05fbd9298db 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -130,7 +130,6 @@ #define _IDE_C /* Tell ide.h it's really us */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/string.h> @@ -147,7 +146,6 @@ #include <linux/pci.h> #include <linux/delay.h> #include <linux/ide.h> -#include <linux/devfs_fs_kernel.h> #include <linux/completion.h> #include <linux/reboot.h> #include <linux/cdrom.h> @@ -592,13 +590,8 @@ void ide_unregister(unsigned int index) goto abort; for (unit = 0; unit < MAX_DRIVES; ++unit) { drive = &hwif->drives[unit]; - if (!drive->present) { - if (drive->devfs_name[0] != '\0') { - devfs_remove(drive->devfs_name); - drive->devfs_name[0] = '\0'; - } + if (!drive->present) continue; - } spin_unlock_irq(&ide_lock); device_unregister(&drive->gendev); wait_for_completion(&drive->gendev_rel_comp); @@ -1996,7 +1989,6 @@ EXPORT_SYMBOL_GPL(ide_bus_type); static int __init ide_init(void) { printk(KERN_INFO "Uniform Multi-Platform E-IDE driver " REVISION "\n"); - devfs_mk_dir("ide"); system_bus_speed = ide_system_bus_speed(); bus_register(&ide_bus_type); @@ -2074,7 +2066,6 @@ void cleanup_module (void) #ifdef CONFIG_PROC_FS proc_ide_destroy(); #endif - devfs_remove("ide"); bus_unregister(&ide_bus_type); } diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index fb88711812e..9c544467cb7 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c @@ -40,7 +40,6 @@ #undef REALLY_SLOW_IO /* most systems can safely undef this */ #include <linux/module.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/delay.h> diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c index 20eb5b872ca..3b1d33baaa2 100644 --- a/drivers/ide/legacy/dtc2278.c +++ b/drivers/ide/legacy/dtc2278.c @@ -7,7 +7,6 @@ #undef REALLY_SLOW_IO /* most systems can safely undef this */ #include <linux/module.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/delay.h> diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c index 3fac3e9ec47..64d42619ab0 100644 --- a/drivers/ide/legacy/gayle.c +++ b/drivers/ide/legacy/gayle.c @@ -8,7 +8,6 @@ * more details. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/mm.h> #include <linux/interrupt.h> diff --git a/drivers/ide/legacy/hd.c b/drivers/ide/legacy/hd.c index 6439dec6688..aebecd8f51c 100644 --- a/drivers/ide/legacy/hd.c +++ b/drivers/ide/legacy/hd.c @@ -691,7 +691,7 @@ static struct block_device_operations hd_fops = { }; /* - * This is the hard disk IRQ description. The SA_INTERRUPT in sa_flags + * This is the hard disk IRQ description. The IRQF_DISABLED in sa_flags * means we run the IRQ-handler with interrupts disabled: this is bad for * interrupt latency, but anything else has led to problems on some * machines. @@ -806,7 +806,7 @@ static int __init hd_init(void) p->cyl, p->head, p->sect); } - if (request_irq(HD_IRQ, hd_interrupt, SA_INTERRUPT, "hd", NULL)) { + if (request_irq(HD_IRQ, hd_interrupt, IRQF_DISABLED, "hd", NULL)) { printk("hd: unable to get IRQ%d for the hard disk driver\n", HD_IRQ); goto out1; diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c index a77fb249d5c..c48e87e512d 100644 --- a/drivers/ide/legacy/ht6560b.c +++ b/drivers/ide/legacy/ht6560b.c @@ -39,7 +39,6 @@ #undef REALLY_SLOW_IO /* most systems can safely undef this */ #include <linux/module.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/delay.h> diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 602797a4420..b7e459e4f28 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c @@ -146,7 +146,16 @@ static void ide_detach(struct pcmcia_device *link) kfree(link->priv); } /* ide_detach */ -static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq, struct pcmcia_device *handle) +static void idecs_mmio_fixup(ide_hwif_t *hwif) +{ + default_hwif_mmiops(hwif); + hwif->mmio = 2; + + ide_undecoded_slave(hwif); +} + +static int idecs_register(unsigned long io, unsigned long ctl, + unsigned long irq, struct pcmcia_device *handle, int is_mmio) { hw_regs_t hw; memset(&hw, 0, sizeof(hw)); @@ -154,7 +163,19 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq hw.irq = irq; hw.chipset = ide_pci; hw.dev = &handle->dev; - return ide_register_hw_with_fixup(&hw, NULL, ide_undecoded_slave); + + if(is_mmio) + return ide_register_hw_with_fixup(&hw, NULL, idecs_mmio_fixup); + else + return ide_register_hw_with_fixup(&hw, NULL, ide_undecoded_slave); +} + +void outb_io(unsigned char value, unsigned long port) { + outb(value, port); +} + +void outb_mem(unsigned char value, unsigned long port) { + writeb(value, (void __iomem *) port); } /*====================================================================== @@ -180,7 +201,8 @@ static int ide_config(struct pcmcia_device *link) } *stk = NULL; cistpl_cftable_entry_t *cfg; int i, pass, last_ret = 0, last_fn = 0, hd, is_kme = 0; - unsigned long io_base, ctl_base; + unsigned long io_base, ctl_base, is_mmio, try_slave; + void (*my_outb)(unsigned char, unsigned long); DEBUG(0, "ide_config(0x%p)\n", link); @@ -210,7 +232,7 @@ static int ide_config(struct pcmcia_device *link) /* Not sure if this is right... look up the current Vcc */ CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf)); - pass = io_base = ctl_base = 0; + pass = io_base = ctl_base = is_mmio = try_slave = 0; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.Attributes = 0; CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); @@ -258,11 +280,45 @@ static int ide_config(struct pcmcia_device *link) goto next_entry; io_base = link->io.BasePort1; ctl_base = link->io.BasePort1 + 0x0e; + + if (io->win[0].len >= 0x20) + try_slave = 1; + } else goto next_entry; /* If we've got this far, we're done */ break; } + if ((cfg->mem.nwin > 0) || (stk->dflt.mem.nwin > 0)) { + win_req_t req; + memreq_t map; + cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &stk->dflt.mem; + + if (mem->win[0].len < 16) + goto next_entry; + + req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; + req.Attributes |= WIN_ENABLE; + req.Base = mem->win[0].host_addr; + req.Size = 0; + + req.AccessSpeed = 0; + if (pcmcia_request_window(&link, &req, &link->win) != 0) + goto next_entry; + map.Page = 0; map.CardOffset = mem->win[0].card_addr; + if (pcmcia_map_mem_page(link->win, &map) != 0) + goto next_entry; + + io_base = (unsigned long) ioremap(req.Base, req.Size); + ctl_base = io_base + 0x0e; + is_mmio = 1; + + if (mem->win[0].len >= 0x20) + try_slave = 1; + + break; + } + next_entry: if (cfg->flags & CISTPL_CFTABLE_DEFAULT) memcpy(&stk->dflt, cfg, sizeof(stk->dflt)); @@ -278,21 +334,26 @@ static int ide_config(struct pcmcia_device *link) CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); + if(is_mmio) + my_outb = outb_mem; + else + my_outb = outb_io; + /* disable drive interrupts during IDE probe */ - outb(0x02, ctl_base); + my_outb(0x02, ctl_base); /* special setup for KXLC005 card */ if (is_kme) - outb(0x81, ctl_base+1); + my_outb(0x81, ctl_base+1); /* retry registration in case device is still spinning up */ for (hd = -1, i = 0; i < 10; i++) { - hd = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link); + hd = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link, is_mmio); if (hd >= 0) break; - if (link->io.NumPorts1 == 0x20) { - outb(0x02, ctl_base + 0x10); + if (try_slave) { + my_outb(0x02, ctl_base + 0x10); hd = idecs_register(io_base + 0x10, ctl_base + 0x10, - link->irq.AssignedIRQ, link); + link->irq.AssignedIRQ, link, is_mmio); if (hd >= 0) { io_base += 0x10; ctl_base += 0x10; diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c index 90cac609d9c..d655da74914 100644 --- a/drivers/ide/legacy/macide.c +++ b/drivers/ide/legacy/macide.c @@ -11,7 +11,6 @@ * more details. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/mm.h> #include <linux/interrupt.h> diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c index 563fab0098b..d3c3bc2640e 100644 --- a/drivers/ide/legacy/qd65xx.c +++ b/drivers/ide/legacy/qd65xx.c @@ -28,7 +28,6 @@ #undef REALLY_SLOW_IO /* most systems can safely undef this */ #include <linux/module.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/delay.h> diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c index cdbdb2ff9f1..6e2c58c5f6a 100644 --- a/drivers/ide/legacy/umc8672.c +++ b/drivers/ide/legacy/umc8672.c @@ -40,7 +40,6 @@ #define REALLY_SLOW_IO /* some systems can safely undef this */ #include <linux/module.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/delay.h> diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index ff0cdc142f1..a7c725f8bf6 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c @@ -6,7 +6,6 @@ */ #include <linux/module.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/pci.h> #include <linux/delay.h> @@ -254,7 +253,8 @@ static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const ch if (dev->resource[PCI_ROM_RESOURCE].start) { pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); - printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start); + printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, + (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); } if (bus_speed <= 33) diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 8b24b4f2a83..351dab2fcac 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -27,7 +27,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index 85007cb12c5..2b0ea8b6608 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c @@ -16,7 +16,6 @@ * the Free Software Foundation. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/ioport.h> diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c index 900efd1da58..a574de5f083 100644 --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c @@ -6,7 +6,6 @@ * */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c index 11d035f1983..61b5f9c0b2f 100644 --- a/drivers/ide/pci/cmd640.c +++ b/drivers/ide/pci/cmd640.c @@ -103,7 +103,6 @@ //#define CMD640_DUMP_REGS -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/delay.h> diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 92b7b1549b1..20c32716bbc 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c @@ -14,7 +14,6 @@ * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/pci.h> diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index ea3c52cc8ac..079f7c86726 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c @@ -32,7 +32,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c index 09269e574b3..380bb28c7c5 100644 --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c @@ -14,7 +14,6 @@ * CS5530 documentation available from National Semiconductor. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index 6eb305197f3..5c5aec28e67 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c @@ -23,7 +23,6 @@ * CS5535 documentation available from AMD */ -#include <linux/config.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/ide.h> diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c index 9f41ecd5633..120929fbe7a 100644 --- a/drivers/ide/pci/cy82c693.c +++ b/drivers/ide/pci/cy82c693.c @@ -44,7 +44,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/pci.h> diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index be334da7a75..b46cb042290 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c @@ -24,7 +24,6 @@ * Non-bootable card or HPT343 :: pcicmd == 0x05 */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> @@ -176,7 +175,7 @@ static unsigned int __devinit init_chipset_hpt34x(struct pci_dev *dev, const cha pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); printk(KERN_INFO "HPT345: ROM enabled at 0x%08lx\n", - dev->resource[PCI_ROM_RESOURCE].start); + (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); } pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xF0); } else { diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 940bdd4c578..e993a51f250 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c @@ -55,7 +55,6 @@ */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/it8172.c b/drivers/ide/pci/it8172.c index 93462926b9d..0fc89fafad6 100644 --- a/drivers/ide/pci/it8172.c +++ b/drivers/ide/pci/it8172.c @@ -28,7 +28,6 @@ * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 38f41b377ff..3cb04424d35 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c @@ -62,7 +62,6 @@ * - Move to libata once it grows up */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/pci.h> @@ -651,6 +650,8 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) } ide_set_hwifdata(hwif, idev); + hwif->atapi_dma = 1; + pci_read_config_byte(hwif->pci_dev, 0x50, &conf); if(conf & 1) { idev->smart = 1; diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index fcd5142f5cf..d95714bcee4 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c @@ -9,7 +9,6 @@ * Inspired by an earlier effort from David S. Miller <davem@redhat.com> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index 2c9e938dd1c..6c097e80b4d 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c @@ -14,7 +14,6 @@ * Released under terms of General Public License */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> @@ -313,8 +312,8 @@ static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev, const cha if (dev->resource[PCI_ROM_RESOURCE].start) { pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); - printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", - name, dev->resource[PCI_ROM_RESOURCE].start); + printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, + (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); } #ifdef CONFIG_PPC_PMAC diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c index 26bc688a182..b46022a11be 100644 --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c @@ -28,7 +28,6 @@ * Released under terms of General Public License */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/kernel.h> @@ -490,8 +489,8 @@ static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, if (dev->resource[PCI_ROM_RESOURCE].start) { pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); - printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", - name, dev->resource[PCI_ROM_RESOURCE].start); + printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, + (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); } return dev->irq; diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 7fac6f57b5d..50332ddd5dd 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c @@ -90,7 +90,6 @@ * ICH3 errata #18 - Don't use native mode */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 778b82ae964..fc2b5496b6d 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c @@ -11,7 +11,6 @@ * Available from National Semiconductor */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c index 5100b827a93..03677bff0d7 100644 --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c @@ -29,7 +29,6 @@ * */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 72dade14c72..25ceb4a39ed 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c @@ -27,7 +27,6 @@ * if neccessary */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/pci.h> diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 8e9d87701ce..8a6c23ac8cc 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c @@ -44,7 +44,6 @@ * 962/963. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c index 900301e4381..0b4b6049851 100644 --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c @@ -13,7 +13,6 @@ * -- Benjamin Herrenschmidt (01/11/03) benh@kernel.crashing.org */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index 0968f6bc669..4a1853af3bb 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c @@ -8,7 +8,6 @@ * */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c index f96b56838f3..56d84931d6d 100644 --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c @@ -27,7 +27,6 @@ * Not publically available. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index fe80295974e..2a282529bfc 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c @@ -128,7 +128,6 @@ * */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 3e677c4f8c2..afdaee3c15c 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -26,7 +26,6 @@ * the Free Software Foundation. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/ioport.h> diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c index b80c6135ae9..0ac9da3a737 100644 --- a/drivers/ide/ppc/mpc8xx.c +++ b/drivers/ide/ppc/mpc8xx.c @@ -11,7 +11,6 @@ * by Mathew Locke <mattl@mvista.com> */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/sched.h> #include <linux/kernel.h> diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index ffca8b63ee7..ebf961f1718 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -22,7 +22,6 @@ * big table * */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -421,107 +420,6 @@ static void pmac_ide_kauai_selectproc(ide_drive_t *drive); #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ /* - * Below is the code for blinking the laptop LED along with hard - * disk activity. - */ - -#ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK - -/* Set to 50ms minimum led-on time (also used to limit frequency - * of requests sent to the PMU - */ -#define PMU_HD_BLINK_TIME (HZ/50) - -static struct adb_request pmu_blink_on, pmu_blink_off; -static spinlock_t pmu_blink_lock; -static unsigned long pmu_blink_stoptime; -static int pmu_blink_ledstate; -static struct timer_list pmu_blink_timer; -static int pmu_ide_blink_enabled; - - -static void -pmu_hd_blink_timeout(unsigned long data) -{ - unsigned long flags; - - spin_lock_irqsave(&pmu_blink_lock, flags); - - /* We may have been triggered again in a racy way, check - * that we really want to switch it off - */ - if (time_after(pmu_blink_stoptime, jiffies)) - goto done; - - /* Previous req. not complete, try 100ms more */ - if (pmu_blink_off.complete == 0) - mod_timer(&pmu_blink_timer, jiffies + PMU_HD_BLINK_TIME); - else if (pmu_blink_ledstate) { - pmu_request(&pmu_blink_off, NULL, 4, 0xee, 4, 0, 0); - pmu_blink_ledstate = 0; - } -done: - spin_unlock_irqrestore(&pmu_blink_lock, flags); -} - -static void -pmu_hd_kick_blink(void *data, int rw) -{ - unsigned long flags; - - pmu_blink_stoptime = jiffies + PMU_HD_BLINK_TIME; - wmb(); - mod_timer(&pmu_blink_timer, pmu_blink_stoptime); - /* Fast path when LED is already ON */ - if (pmu_blink_ledstate == 1) - return; - spin_lock_irqsave(&pmu_blink_lock, flags); - if (pmu_blink_on.complete && !pmu_blink_ledstate) { - pmu_request(&pmu_blink_on, NULL, 4, 0xee, 4, 0, 1); - pmu_blink_ledstate = 1; - } - spin_unlock_irqrestore(&pmu_blink_lock, flags); -} - -static int -pmu_hd_blink_init(void) -{ - struct device_node *dt; - const char *model; - - /* Currently, I only enable this feature on KeyLargo based laptops, - * older laptops may support it (at least heathrow/paddington) but - * I don't feel like loading those venerable old machines with so - * much additional interrupt & PMU activity... - */ - if (pmu_get_model() != PMU_KEYLARGO_BASED) - return 0; - - dt = of_find_node_by_path("/"); - if (dt == NULL) - return 0; - model = (const char *)get_property(dt, "model", NULL); - if (model == NULL) - return 0; - if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 && - strncmp(model, "iBook", strlen("iBook")) != 0) { - of_node_put(dt); - return 0; - } - of_node_put(dt); - - pmu_blink_on.complete = 1; - pmu_blink_off.complete = 1; - spin_lock_init(&pmu_blink_lock); - init_timer(&pmu_blink_timer); - pmu_blink_timer.function = pmu_hd_blink_timeout; - - return 1; -} - -#endif /* CONFIG_BLK_DEV_IDE_PMAC_BLINK */ - -/* * N.B. this can't be an initfunc, because the media-bay task can * call ide_[un]register at any time. */ @@ -1192,23 +1090,6 @@ pmac_ide_do_suspend(ide_hwif_t *hwif) pmif->timings[0] = 0; pmif->timings[1] = 0; -#ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK - /* Note: This code will be called for every hwif, thus we'll - * try several time to stop the LED blinker timer, but that - * should be harmless - */ - if (pmu_ide_blink_enabled) { - unsigned long flags; - - /* Make sure we don't hit the PMU blink */ - spin_lock_irqsave(&pmu_blink_lock, flags); - if (pmu_blink_ledstate) - del_timer(&pmu_blink_timer); - pmu_blink_ledstate = 0; - spin_unlock_irqrestore(&pmu_blink_lock, flags); - } -#endif /* CONFIG_BLK_DEV_IDE_PMAC_BLINK */ - disable_irq(pmif->irq); /* The media bay will handle itself just fine */ @@ -1376,13 +1257,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) hwif->selectproc = pmac_ide_selectproc; hwif->speedproc = pmac_ide_tune_chipset; -#ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK - pmu_ide_blink_enabled = pmu_hd_blink_init(); - - if (pmu_ide_blink_enabled) - hwif->led_act = pmu_hd_kick_blink; -#endif - printk(KERN_INFO "ide%d: Found Apple %s controller, bus ID %d%s, irq %d\n", hwif->index, model_name[pmif->kind], pmif->aapl_bus_id, pmif->mediabay ? " (mediabay)" : "", hwif->irq); diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index c11e3b2e67a..eb0945284ac 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -18,7 +18,6 @@ * configuration of all PCI IDE interfaces present in a system. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/ieee1394/config_roms.c b/drivers/ieee1394/config_roms.c index 1017fd71724..e2de6fa0c9f 100644 --- a/drivers/ieee1394/config_roms.c +++ b/drivers/ieee1394/config_roms.c @@ -9,7 +9,6 @@ * directory of the kernel sources for details. */ -#include <linux/config.h> #include <linux/types.h> #include "csr1212.h" diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index 85c2d4ca0de..87532dd4337 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c @@ -83,7 +83,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/slab.h> diff --git a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c index 25b22609e79..694da82d820 100644 --- a/drivers/ieee1394/highlevel.c +++ b/drivers/ieee1394/highlevel.c @@ -17,7 +17,6 @@ * */ -#include <linux/config.h> #include <linux/slab.h> #include <linux/list.h> #include <linux/bitops.h> diff --git a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c index ad49c040b67..2c669287f5b 100644 --- a/drivers/ieee1394/hosts.c +++ b/drivers/ieee1394/hosts.c @@ -10,7 +10,6 @@ * directory of the kernel sources for details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/list.h> diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c index 49354de9fb8..f43739c5cab 100644 --- a/drivers/ieee1394/ieee1394_core.c +++ b/drivers/ieee1394/ieee1394_core.c @@ -20,7 +20,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/string.h> diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 50c71e17de7..d541b508a15 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c @@ -10,7 +10,6 @@ #include <linux/bitmap.h> #include <linux/kernel.h> -#include <linux/config.h> #include <linux/list.h> #include <linux/slab.h> #include <linux/smp_lock.h> diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 3d278412e1c..d4bad6704bb 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c @@ -82,7 +82,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/slab.h> @@ -590,11 +589,11 @@ static void ohci_initialize(struct ti_ohci *ohci) buf = reg_read(ohci, OHCI1394_Version); sprintf (irq_buf, "%d", ohci->dev->irq); PRINT(KERN_INFO, "OHCI-1394 %d.%d (PCI): IRQ=[%s] " - "MMIO=[%lx-%lx] Max Packet=[%d] IR/IT contexts=[%d/%d]", + "MMIO=[%llx-%llx] Max Packet=[%d] IR/IT contexts=[%d/%d]", ((((buf) >> 16) & 0xf) + (((buf) >> 20) & 0xf) * 10), ((((buf) >> 4) & 0xf) + ((buf) & 0xf) * 10), irq_buf, - pci_resource_start(ohci->dev, 0), - pci_resource_start(ohci->dev, 0) + OHCI1394_REGISTER_SIZE - 1, + (unsigned long long)pci_resource_start(ohci->dev, 0), + (unsigned long long)pci_resource_start(ohci->dev, 0) + OHCI1394_REGISTER_SIZE - 1, ohci->max_packet_size, ohci->nb_iso_rcv_ctx, ohci->nb_iso_xmit_ctx); @@ -3217,7 +3216,7 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev, { struct hpsb_host *host; struct ti_ohci *ohci; /* shortcut to currently handled device */ - unsigned long ohci_base; + resource_size_t ohci_base; if (pci_enable_device(dev)) FAIL(-ENXIO, "Failed to enable OHCI hardware"); @@ -3270,15 +3269,16 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev, * clearly says it's 2kb, so this shouldn't be a problem. */ ohci_base = pci_resource_start(dev, 0); if (pci_resource_len(dev, 0) < OHCI1394_REGISTER_SIZE) - PRINT(KERN_WARNING, "PCI resource length of %lx too small!", - pci_resource_len(dev, 0)); + PRINT(KERN_WARNING, "PCI resource length of 0x%llx too small!", + (unsigned long long)pci_resource_len(dev, 0)); /* Seems PCMCIA handles this internally. Not sure why. Seems * pretty bogus to force a driver to special case this. */ #ifndef PCMCIA if (!request_mem_region (ohci_base, OHCI1394_REGISTER_SIZE, OHCI1394_DRIVER_NAME)) - FAIL(-ENOMEM, "MMIO resource (0x%lx - 0x%lx) unavailable", - ohci_base, ohci_base + OHCI1394_REGISTER_SIZE); + FAIL(-ENOMEM, "MMIO resource (0x%llx - 0x%llx) unavailable", + (unsigned long long)ohci_base, + (unsigned long long)ohci_base + OHCI1394_REGISTER_SIZE); #endif ohci->init_state = OHCI_INIT_HAVE_MEM_REGION; @@ -3392,12 +3392,12 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev, spin_lock_init(&ohci->event_lock); /* - * interrupts are disabled, all right, but... due to SA_SHIRQ we + * interrupts are disabled, all right, but... due to IRQF_SHARED we * might get called anyway. We'll see no event, of course, but * we need to get to that "no event", so enough should be initialized * by that point. */ - if (request_irq(dev->irq, ohci_irq_handler, SA_SHIRQ, + if (request_irq(dev->irq, ohci_irq_handler, IRQF_SHARED, OHCI1394_DRIVER_NAME, ohci)) FAIL(-ENOMEM, "Failed to allocate shared interrupt %d", dev->irq); diff --git a/drivers/ieee1394/oui2c.sh b/drivers/ieee1394/oui2c.sh index d50dc7a2d08..b9d0e8f10ab 100644 --- a/drivers/ieee1394/oui2c.sh +++ b/drivers/ieee1394/oui2c.sh @@ -3,7 +3,6 @@ cat <<EOF /* Generated file for OUI database */ -#include <linux/config.h> #ifdef CONFIG_IEEE1394_OUI_DB struct oui_list_struct { diff --git a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c index e29dfd280be..e6f41238f5e 100644 --- a/drivers/ieee1394/pcilynx.c +++ b/drivers/ieee1394/pcilynx.c @@ -30,7 +30,6 @@ * Enhancements in async and iso send code */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/interrupt.h> @@ -1254,7 +1253,7 @@ static int __devinit add_card(struct pci_dev *dev, sprintf (irq_buf, "%d", dev->irq); - if (!request_irq(dev->irq, lynx_irq_handler, SA_SHIRQ, + if (!request_irq(dev->irq, lynx_irq_handler, IRQF_SHARED, PCILYNX_DRIVER_NAME, lynx)) { PRINT(KERN_INFO, lynx->id, "allocated interrupt %s", irq_buf); lynx->state = have_intr; diff --git a/drivers/ieee1394/pcilynx.h b/drivers/ieee1394/pcilynx.h index d631aa8383a..ec27321f672 100644 --- a/drivers/ieee1394/pcilynx.h +++ b/drivers/ieee1394/pcilynx.h @@ -1,7 +1,6 @@ #ifndef __PCILYNX_H__ #define __PCILYNX_H__ -#include <linux/config.h> #define PCILYNX_DRIVER_NAME "pcilynx" #define PCILYNX_MAJOR 177 diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 1d5ceb7ecc8..aaa74f293aa 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c @@ -38,7 +38,6 @@ * but the code needs additional debugging. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/string.h> diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c index 295d0f8c3d0..c6e3f02bc6d 100644 --- a/drivers/ieee1394/video1394.c +++ b/drivers/ieee1394/video1394.c @@ -28,7 +28,6 @@ * ENOTTY for unsupported ioctl request * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/slab.h> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 450adfe0a4f..3f6705f3083 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c @@ -3152,6 +3152,7 @@ static int cm_init_qp_rtr_attr(struct cm_id_private *cm_id_priv, } if (cm_id_priv->alt_av.ah_attr.dlid) { *qp_attr_mask |= IB_QP_ALT_PATH; + qp_attr->alt_port_num = cm_id_priv->alt_av.port->port_num; qp_attr->alt_ah_attr = cm_id_priv->alt_av.ah_attr; } ret = 0; diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index a908a7bdcd7..bdf5d509819 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -1963,7 +1963,7 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file, if (!obj) return -ENOMEM; - init_uobj(&obj->uobject, 0, file->ucontext); + init_uobj(&obj->uobject, cmd.user_handle, file->ucontext); down_write(&obj->uobject.mutex); pd = idr_read_pd(cmd.pd_handle, file->ucontext); diff --git a/drivers/infiniband/hw/ipath/Kconfig b/drivers/infiniband/hw/ipath/Kconfig index 9ea67c409b6..1db9489f1e8 100644 --- a/drivers/infiniband/hw/ipath/Kconfig +++ b/drivers/infiniband/hw/ipath/Kconfig @@ -1,16 +1,16 @@ config IPATH_CORE - tristate "PathScale InfiniPath Driver" + tristate "QLogic InfiniPath Driver" depends on 64BIT && PCI_MSI && NET ---help--- - This is a low-level driver for PathScale InfiniPath host channel + This is a low-level driver for QLogic InfiniPath host channel adapters (HCAs) based on the HT-400 and PE-800 chips. config INFINIBAND_IPATH - tristate "PathScale InfiniPath Verbs Driver" + tristate "QLogic InfiniPath Verbs Driver" depends on IPATH_CORE && INFINIBAND ---help--- This is a driver that provides InfiniBand verbs support for - PathScale InfiniPath host channel adapters (HCAs). This + QLogic InfiniPath host channel adapters (HCAs). This allows these devices to be used with both kernel upper level protocols such as IP-over-InfiniBand as well as with userspace applications (in conjunction with InfiniBand userspace access). diff --git a/drivers/infiniband/hw/ipath/Makefile b/drivers/infiniband/hw/ipath/Makefile index b4d084abfd2..b0bf7286413 100644 --- a/drivers/infiniband/hw/ipath/Makefile +++ b/drivers/infiniband/hw/ipath/Makefile @@ -1,4 +1,4 @@ -EXTRA_CFLAGS += -DIPATH_IDSTR='"PathScale kernel.org driver"' \ +EXTRA_CFLAGS += -DIPATH_IDSTR='"QLogic kernel.org driver"' \ -DIPATH_KERN_TYPE=0 obj-$(CONFIG_IPATH_CORE) += ipath_core.o diff --git a/drivers/infiniband/hw/ipath/ipath_common.h b/drivers/infiniband/hw/ipath/ipath_common.h index 48a55247b83..062bd392e7e 100644 --- a/drivers/infiniband/hw/ipath/ipath_common.h +++ b/drivers/infiniband/hw/ipath/ipath_common.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -38,7 +39,8 @@ * to communicate between kernel and user code. */ -/* This is the IEEE-assigned OUI for PathScale, Inc. */ + +/* This is the IEEE-assigned OUI for QLogic Inc. InfiniPath */ #define IPATH_SRC_OUI_1 0x00 #define IPATH_SRC_OUI_2 0x11 #define IPATH_SRC_OUI_3 0x75 @@ -96,8 +98,8 @@ struct infinipath_stats { __u64 sps_hwerrs; /* number of times IB link changed state unexpectedly */ __u64 sps_iblink; - /* no longer used; left for compatibility */ - __u64 sps_unused3; + /* kernel receive interrupts that didn't read intstat */ + __u64 sps_fastrcvint; /* number of kernel (port0) packets received */ __u64 sps_port0pkts; /* number of "ethernet" packets sent by driver */ @@ -121,8 +123,7 @@ struct infinipath_stats { __u64 sps_ports; /* list of pkeys (other than default) accepted (0 means not set) */ __u16 sps_pkeys[4]; - /* lids for up to 4 infinipaths, indexed by infinipath # */ - __u16 sps_lid[4]; + __u16 sps_unused16[4]; /* available; maintaining compatible layout */ /* number of user ports per chip (not IB ports) */ __u32 sps_nports; /* not our interrupt, or already handled */ @@ -140,10 +141,8 @@ struct infinipath_stats { * packets if ipath not configured, sma/mad, etc.) */ __u64 sps_krdrops; - /* mlids for up to 4 infinipaths, indexed by infinipath # */ - __u16 sps_mlid[4]; /* pad for future growth */ - __u64 __sps_pad[45]; + __u64 __sps_pad[46]; }; /* @@ -310,6 +309,9 @@ struct ipath_base_info { __u32 spi_rcv_egrchunksize; /* total size of mmap to cover full rcvegrbuffers */ __u32 spi_rcv_egrbuftotlen; + __u32 spi_filler_for_align; + /* address of readonly memory copy of the rcvhdrq tail register. */ + __u64 spi_rcvhdr_tailaddr; } __attribute__ ((aligned(8))); @@ -342,9 +344,9 @@ struct ipath_base_info { /* * Similarly, this is the kernel version going back to the user. It's * slightly different, in that we want to tell if the driver was built as - * part of a PathScale release, or from the driver from OpenIB, kernel.org, - * or a standard distribution, for support reasons. The high bit is 0 for - * non-PathScale, and 1 for PathScale-built/supplied. + * part of a QLogic release, or from the driver from openfabrics.org, + * kernel.org, or a standard distribution, for support reasons. + * The high bit is 0 for non-QLogic and 1 for QLogic-built/supplied. * * It's returned by the driver to the user code during initialization in the * spi_sw_version field of ipath_base_info, so the user code can in turn @@ -379,13 +381,7 @@ struct ipath_user_info { */ __u32 spu_rcvhdrsize; - /* - * cache line aligned (64 byte) user address to - * which the rcvhdrtail register will be written by infinipath - * whenever it changes, so that no chip registers are read in - * the performance path. - */ - __u64 spu_rcvhdraddr; + __u64 spu_unused; /* kept for compatible layout */ /* * address of struct base_info to write to @@ -481,7 +477,7 @@ struct ipath_sma_pkt * Data layout in I2C flash (for GUID, etc.) * All fields are little-endian binary unless otherwise stated */ -#define IPATH_FLASH_VERSION 1 +#define IPATH_FLASH_VERSION 2 struct ipath_flash { /* flash layout version (IPATH_FLASH_VERSION) */ __u8 if_fversion; @@ -489,14 +485,14 @@ struct ipath_flash { __u8 if_csum; /* * valid length (in use, protected by if_csum), including - * if_fversion and if_sum themselves) + * if_fversion and if_csum themselves) */ __u8 if_length; /* the GUID, in network order */ __u8 if_guid[8]; /* number of GUIDs to use, starting from if_guid */ __u8 if_numguid; - /* the board serial number, in ASCII */ + /* the (last 10 characters of) board serial number, in ASCII */ char if_serial[12]; /* board mfg date (YYYYMMDD ASCII) */ char if_mfgdate[8]; @@ -508,8 +504,10 @@ struct ipath_flash { __u8 if_powerhour[2]; /* ASCII free-form comment field */ char if_comment[32]; - /* 78 bytes used, min flash size is 128 bytes */ - __u8 if_future[50]; + /* Backwards compatible prefix for longer QLogic Serial Numbers */ + char if_sprefix[4]; + /* 82 bytes used, min flash size is 128 bytes */ + __u8 if_future[46]; }; /* @@ -603,14 +601,118 @@ struct infinipath_counters { #define INFINIPATH_KPF_INTR 0x1 /* SendPIO per-buffer control */ -#define INFINIPATH_SP_LENGTHP1_MASK 0x3FF -#define INFINIPATH_SP_LENGTHP1_SHIFT 0 -#define INFINIPATH_SP_INTR 0x80000000 -#define INFINIPATH_SP_TEST 0x40000000 -#define INFINIPATH_SP_TESTEBP 0x20000000 +#define INFINIPATH_SP_TEST 0x40 +#define INFINIPATH_SP_TESTEBP 0x20 /* SendPIOAvail bits */ #define INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT 1 #define INFINIPATH_SENDPIOAVAIL_CHECK_SHIFT 0 +/* infinipath header format */ +struct ipath_header { + /* + * Version - 4 bits, Port - 4 bits, TID - 10 bits and Offset - + * 14 bits before ECO change ~28 Dec 03. After that, Vers 4, + * Port 3, TID 11, offset 14. + */ + __le32 ver_port_tid_offset; + __le16 chksum; + __le16 pkt_flags; +}; + +/* infinipath user message header format. + * This structure contains the first 4 fields common to all protocols + * that employ infinipath. + */ +struct ipath_message_header { + __be16 lrh[4]; + __be32 bth[3]; + /* fields below this point are in host byte order */ + struct ipath_header iph; + __u8 sub_opcode; +}; + +/* infinipath ethernet header format */ +struct ether_header { + __be16 lrh[4]; + __be32 bth[3]; + struct ipath_header iph; + __u8 sub_opcode; + __u8 cmd; + __be16 lid; + __u16 mac[3]; + __u8 frag_num; + __u8 seq_num; + __le32 len; + /* MUST be of word size due to PIO write requirements */ + __le32 csum; + __le16 csum_offset; + __le16 flags; + __u16 first_2_bytes; + __u8 unused[2]; /* currently unused */ +}; + + +/* IB - LRH header consts */ +#define IPATH_LRH_GRH 0x0003 /* 1. word of IB LRH - next header: GRH */ +#define IPATH_LRH_BTH 0x0002 /* 1. word of IB LRH - next header: BTH */ + +/* misc. */ +#define SIZE_OF_CRC 1 + +#define IPATH_DEFAULT_P_KEY 0xFFFF +#define IPATH_PERMISSIVE_LID 0xFFFF +#define IPATH_AETH_CREDIT_SHIFT 24 +#define IPATH_AETH_CREDIT_MASK 0x1F +#define IPATH_AETH_CREDIT_INVAL 0x1F +#define IPATH_PSN_MASK 0xFFFFFF +#define IPATH_MSN_MASK 0xFFFFFF +#define IPATH_QPN_MASK 0xFFFFFF +#define IPATH_MULTICAST_LID_BASE 0xC000 +#define IPATH_MULTICAST_QPN 0xFFFFFF + +/* Receive Header Queue: receive type (from infinipath) */ +#define RCVHQ_RCV_TYPE_EXPECTED 0 +#define RCVHQ_RCV_TYPE_EAGER 1 +#define RCVHQ_RCV_TYPE_NON_KD 2 +#define RCVHQ_RCV_TYPE_ERROR 3 + + +/* sub OpCodes - ith4x */ +#define IPATH_ITH4X_OPCODE_ENCAP 0x81 +#define IPATH_ITH4X_OPCODE_LID_ARP 0x82 + +#define IPATH_HEADER_QUEUE_WORDS 9 + +/* functions for extracting fields from rcvhdrq entries for the driver. + */ +static inline __u32 ipath_hdrget_err_flags(const __le32 * rbuf) +{ + return __le32_to_cpu(rbuf[1]); +} + +static inline __u32 ipath_hdrget_rcv_type(const __le32 * rbuf) +{ + return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_RCVTYPE_SHIFT) + & INFINIPATH_RHF_RCVTYPE_MASK; +} + +static inline __u32 ipath_hdrget_length_in_bytes(const __le32 * rbuf) +{ + return ((__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_LENGTH_SHIFT) + & INFINIPATH_RHF_LENGTH_MASK) << 2; +} + +static inline __u32 ipath_hdrget_index(const __le32 * rbuf) +{ + return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_EGRINDEX_SHIFT) + & INFINIPATH_RHF_EGRINDEX_MASK; +} + +static inline __u32 ipath_hdrget_ipath_ver(__le32 hdrword) +{ + return (__le32_to_cpu(hdrword) >> INFINIPATH_I_VERS_SHIFT) + & INFINIPATH_I_VERS_MASK; +} + #endif /* _IPATH_COMMON_H */ diff --git a/drivers/infiniband/hw/ipath/ipath_cq.c b/drivers/infiniband/hw/ipath/ipath_cq.c index 7ece1135ddf..3efee341c9b 100644 --- a/drivers/infiniband/hw/ipath/ipath_cq.c +++ b/drivers/infiniband/hw/ipath/ipath_cq.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -157,10 +158,21 @@ struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, struct ib_ucontext *context, struct ib_udata *udata) { + struct ipath_ibdev *dev = to_idev(ibdev); struct ipath_cq *cq; struct ib_wc *wc; struct ib_cq *ret; + if (entries > ib_ipath_max_cqes) { + ret = ERR_PTR(-EINVAL); + goto bail; + } + + if (dev->n_cqs_allocated == ib_ipath_max_cqs) { + ret = ERR_PTR(-ENOMEM); + goto bail; + } + /* * Need to use vmalloc() if we want to support large #s of * entries. @@ -196,6 +208,8 @@ struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries, ret = &cq->ibcq; + dev->n_cqs_allocated++; + bail: return ret; } @@ -210,9 +224,11 @@ bail: */ int ipath_destroy_cq(struct ib_cq *ibcq) { + struct ipath_ibdev *dev = to_idev(ibcq->device); struct ipath_cq *cq = to_icq(ibcq); tasklet_kill(&cq->comptask); + dev->n_cqs_allocated--; vfree(cq->queue); kfree(cq); diff --git a/drivers/infiniband/hw/ipath/ipath_debug.h b/drivers/infiniband/hw/ipath/ipath_debug.h index 46762387f5f..f415beda0d3 100644 --- a/drivers/infiniband/hw/ipath/ipath_debug.h +++ b/drivers/infiniband/hw/ipath/ipath_debug.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c index 28ddceb260e..147dd89e21c 100644 --- a/drivers/infiniband/hw/ipath/ipath_diag.c +++ b/drivers/infiniband/hw/ipath/ipath_diag.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -43,10 +44,9 @@ #include <linux/pci.h> #include <asm/uaccess.h> -#include "ipath_common.h" #include "ipath_kernel.h" -#include "ips_common.h" #include "ipath_layer.h" +#include "ipath_common.h" int ipath_diag_inuse; static int diag_set_link; @@ -66,18 +66,20 @@ static struct file_operations diag_file_ops = { .release = ipath_diag_release }; -static struct cdev *diag_cdev; -static struct class_device *diag_class_dev; - -int ipath_diag_init(void) +int ipath_diag_add(struct ipath_devdata *dd) { - return ipath_cdev_init(IPATH_DIAG_MINOR, "ipath_diag", - &diag_file_ops, &diag_cdev, &diag_class_dev); + char name[16]; + + snprintf(name, sizeof(name), "ipath_diag%d", dd->ipath_unit); + + return ipath_cdev_init(IPATH_DIAG_MINOR_BASE + dd->ipath_unit, name, + &diag_file_ops, &dd->diag_cdev, + &dd->diag_class_dev); } -void ipath_diag_cleanup(void) +void ipath_diag_remove(struct ipath_devdata *dd) { - ipath_cdev_cleanup(&diag_cdev, &diag_class_dev); + ipath_cdev_cleanup(&dd->diag_cdev, &dd->diag_class_dev); } /** @@ -101,8 +103,7 @@ static int ipath_read_umem64(struct ipath_devdata *dd, void __user *uaddr, int ret; /* not very efficient, but it works for now */ - if (reg_addr < dd->ipath_kregbase || - reg_end > dd->ipath_kregend) { + if (reg_addr < dd->ipath_kregbase || reg_end > dd->ipath_kregend) { ret = -EINVAL; goto bail; } @@ -113,7 +114,7 @@ static int ipath_read_umem64(struct ipath_devdata *dd, void __user *uaddr, goto bail; } reg_addr++; - uaddr++; + uaddr += sizeof(u64); } ret = 0; bail: @@ -139,8 +140,7 @@ static int ipath_write_umem64(struct ipath_devdata *dd, void __iomem *caddr, int ret; /* not very efficient, but it works for now */ - if (reg_addr < dd->ipath_kregbase || - reg_end > dd->ipath_kregend) { + if (reg_addr < dd->ipath_kregbase || reg_end > dd->ipath_kregend) { ret = -EINVAL; goto bail; } @@ -153,7 +153,7 @@ static int ipath_write_umem64(struct ipath_devdata *dd, void __iomem *caddr, writeq(data, reg_addr); reg_addr++; - uaddr++; + uaddr += sizeof(u64); } ret = 0; bail: @@ -191,7 +191,8 @@ static int ipath_read_umem32(struct ipath_devdata *dd, void __user *uaddr, } reg_addr++; - uaddr++; + uaddr += sizeof(u32); + } ret = 0; bail: @@ -230,7 +231,7 @@ static int ipath_write_umem32(struct ipath_devdata *dd, void __iomem *caddr, writel(data, reg_addr); reg_addr++; - uaddr++; + uaddr += sizeof(u32); } ret = 0; bail: @@ -239,59 +240,45 @@ bail: static int ipath_diag_open(struct inode *in, struct file *fp) { + int unit = iminor(in) - IPATH_DIAG_MINOR_BASE; struct ipath_devdata *dd; - int unit = 0; /* XXX this is bogus */ - unsigned long flags; int ret; - dd = ipath_lookup(unit); - mutex_lock(&ipath_mutex); - spin_lock_irqsave(&ipath_devs_lock, flags); if (ipath_diag_inuse) { ret = -EBUSY; goto bail; } - list_for_each_entry(dd, &ipath_dev_list, ipath_list) { - /* - * we need at least one infinipath device to be present - * (don't use INITTED, because we want to be able to open - * even if device is in freeze mode, which cleared INITTED). - * There is a small amount of risk to this, which is why we - * also verify kregbase is set. - */ - - if (!(dd->ipath_flags & IPATH_PRESENT) || - !dd->ipath_kregbase) - continue; - - ipath_diag_inuse = 1; - diag_set_link = 0; - ret = 0; + dd = ipath_lookup(unit); + + if (dd == NULL || !(dd->ipath_flags & IPATH_PRESENT) || + !dd->ipath_kregbase) { + ret = -ENODEV; goto bail; } - ret = -ENODEV; - -bail: - spin_unlock_irqrestore(&ipath_devs_lock, flags); + fp->private_data = dd; + ipath_diag_inuse = 1; + diag_set_link = 0; + ret = 0; /* Only expose a way to reset the device if we make it into diag mode. */ - if (ret == 0) - ipath_expose_reset(&dd->pcidev->dev); + ipath_expose_reset(&dd->pcidev->dev); +bail: mutex_unlock(&ipath_mutex); return ret; } -static int ipath_diag_release(struct inode *i, struct file *f) +static int ipath_diag_release(struct inode *in, struct file *fp) { mutex_lock(&ipath_mutex); ipath_diag_inuse = 0; + fp->private_data = NULL; mutex_unlock(&ipath_mutex); return 0; } @@ -299,17 +286,10 @@ static int ipath_diag_release(struct inode *i, struct file *f) static ssize_t ipath_diag_read(struct file *fp, char __user *data, size_t count, loff_t *off) { - int unit = 0; /* XXX provide for reads on other units some day */ - struct ipath_devdata *dd; + struct ipath_devdata *dd = fp->private_data; void __iomem *kreg_base; ssize_t ret; - dd = ipath_lookup(unit); - if (!dd) { - ret = -ENODEV; - goto bail; - } - kreg_base = dd->ipath_kregbase; if (count == 0) @@ -328,23 +308,16 @@ static ssize_t ipath_diag_read(struct file *fp, char __user *data, ret = count; } -bail: return ret; } static ssize_t ipath_diag_write(struct file *fp, const char __user *data, size_t count, loff_t *off) { - int unit = 0; /* XXX this is bogus */ - struct ipath_devdata *dd; + struct ipath_devdata *dd = fp->private_data; void __iomem *kreg_base; ssize_t ret; - dd = ipath_lookup(unit); - if (!dd) { - ret = -ENODEV; - goto bail; - } kreg_base = dd->ipath_kregbase; if (count == 0) @@ -363,6 +336,5 @@ static ssize_t ipath_diag_write(struct file *fp, const char __user *data, ret = count; } -bail: return ret; } diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index dddcdae736a..823131d58b3 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -38,8 +39,8 @@ #include <linux/vmalloc.h> #include "ipath_kernel.h" -#include "ips_common.h" #include "ipath_layer.h" +#include "ipath_common.h" static void ipath_update_pio_bufs(struct ipath_devdata *); @@ -52,7 +53,7 @@ const char *ipath_get_unit_name(int unit) EXPORT_SYMBOL_GPL(ipath_get_unit_name); -#define DRIVER_LOAD_MSG "PathScale " IPATH_DRV_NAME " loaded: " +#define DRIVER_LOAD_MSG "QLogic " IPATH_DRV_NAME " loaded: " #define PFX IPATH_DRV_NAME ": " /* @@ -74,8 +75,8 @@ MODULE_PARM_DESC(debug, "mask for debug prints"); EXPORT_SYMBOL_GPL(ipath_debug); MODULE_LICENSE("GPL"); -MODULE_AUTHOR("PathScale <support@pathscale.com>"); -MODULE_DESCRIPTION("Pathscale InfiniPath driver"); +MODULE_AUTHOR("QLogic <support@pathscale.com>"); +MODULE_DESCRIPTION("QLogic InfiniPath driver"); const char *ipath_ibcstatus_str[] = { "Disabled", @@ -130,14 +131,6 @@ static struct pci_driver ipath_driver = { .id_table = ipath_pci_tbl, }; -/* - * This is where port 0's rcvhdrtail register is written back; we also - * want nothing else sharing the cache line, so make it a cache line - * in size. Used for all units. - */ -volatile __le64 *ipath_port0_rcvhdrtail; -dma_addr_t ipath_port0_rcvhdrtail_dma; -static int port0_rcvhdrtail_refs; static inline void read_bars(struct ipath_devdata *dd, struct pci_dev *dev, u32 *bar0, u32 *bar1) @@ -170,14 +163,13 @@ static void ipath_free_devdata(struct pci_dev *pdev, list_del(&dd->ipath_list); spin_unlock_irqrestore(&ipath_devs_lock, flags); } - dma_free_coherent(&pdev->dev, sizeof(*dd), dd, dd->ipath_dma_addr); + vfree(dd); } static struct ipath_devdata *ipath_alloc_devdata(struct pci_dev *pdev) { unsigned long flags; struct ipath_devdata *dd; - dma_addr_t dma_addr; int ret; if (!idr_pre_get(&unit_table, GFP_KERNEL)) { @@ -185,15 +177,12 @@ static struct ipath_devdata *ipath_alloc_devdata(struct pci_dev *pdev) goto bail; } - dd = dma_alloc_coherent(&pdev->dev, sizeof(*dd), &dma_addr, - GFP_KERNEL); - + dd = vmalloc(sizeof(*dd)); if (!dd) { dd = ERR_PTR(-ENOMEM); goto bail; } - - dd->ipath_dma_addr = dma_addr; + memset(dd, 0, sizeof(*dd)); dd->ipath_unit = -1; spin_lock_irqsave(&ipath_devs_lock, flags); @@ -271,47 +260,6 @@ int ipath_count_units(int *npresentp, int *nupp, u32 *maxportsp) return nunits; } -static int init_port0_rcvhdrtail(struct pci_dev *pdev) -{ - int ret; - - mutex_lock(&ipath_mutex); - - if (!ipath_port0_rcvhdrtail) { - ipath_port0_rcvhdrtail = - dma_alloc_coherent(&pdev->dev, - IPATH_PORT0_RCVHDRTAIL_SIZE, - &ipath_port0_rcvhdrtail_dma, - GFP_KERNEL); - - if (!ipath_port0_rcvhdrtail) { - ret = -ENOMEM; - goto bail; - } - } - port0_rcvhdrtail_refs++; - ret = 0; - -bail: - mutex_unlock(&ipath_mutex); - - return ret; -} - -static void cleanup_port0_rcvhdrtail(struct pci_dev *pdev) -{ - mutex_lock(&ipath_mutex); - - if (!--port0_rcvhdrtail_refs) { - dma_free_coherent(&pdev->dev, IPATH_PORT0_RCVHDRTAIL_SIZE, - (void *) ipath_port0_rcvhdrtail, - ipath_port0_rcvhdrtail_dma); - ipath_port0_rcvhdrtail = NULL; - } - - mutex_unlock(&ipath_mutex); -} - /* * These next two routines are placeholders in case we don't have per-arch * code for controlling write combining. If explicit control of write @@ -336,20 +284,12 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, u32 bar0 = 0, bar1 = 0; u8 rev; - ret = init_port0_rcvhdrtail(pdev); - if (ret < 0) { - printk(KERN_ERR IPATH_DRV_NAME - ": Could not allocate port0_rcvhdrtail: error %d\n", - -ret); - goto bail; - } - dd = ipath_alloc_devdata(pdev); if (IS_ERR(dd)) { ret = PTR_ERR(dd); printk(KERN_ERR IPATH_DRV_NAME ": Could not allocate devdata: error %d\n", -ret); - goto bail_rcvhdrtail; + goto bail; } ipath_cdbg(VERBOSE, "initializing unit #%u\n", dd->ipath_unit); @@ -424,12 +364,29 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, */ ret = pci_set_dma_mask(pdev, DMA_32BIT_MASK); if (ret) { - dev_info(&pdev->dev, "pci_set_dma_mask unit %u " - "fails: %d\n", dd->ipath_unit, ret); + dev_info(&pdev->dev, + "Unable to set DMA mask for unit %u: %d\n", + dd->ipath_unit, ret); goto bail_regions; } - else + else { ipath_dbg("No 64bit DMA mask, used 32 bit mask\n"); + ret = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); + if (ret) + dev_info(&pdev->dev, + "Unable to set DMA consistent mask " + "for unit %u: %d\n", + dd->ipath_unit, ret); + + } + } + else { + ret = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK); + if (ret) + dev_info(&pdev->dev, + "Unable to set DMA consistent mask " + "for unit %u: %d\n", + dd->ipath_unit, ret); } pci_set_master(pdev); @@ -452,7 +409,7 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, ipath_init_pe800_funcs(dd); break; default: - ipath_dev_err(dd, "Found unknown PathScale deviceid 0x%x, " + ipath_dev_err(dd, "Found unknown QLogic deviceid 0x%x, " "failing\n", ent->device); return -ENODEV; } @@ -460,10 +417,10 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, for (j = 0; j < 6; j++) { if (!pdev->resource[j].start) continue; - ipath_cdbg(VERBOSE, "BAR %d start %lx, end %lx, len %lx\n", - j, pdev->resource[j].start, - pdev->resource[j].end, - pci_resource_len(pdev, j)); + ipath_cdbg(VERBOSE, "BAR %d start %llx, end %llx, len %llx\n", + j, (unsigned long long)pdev->resource[j].start, + (unsigned long long)pdev->resource[j].end, + (unsigned long long)pci_resource_len(pdev, j)); } if (!addr) { @@ -495,23 +452,23 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, ((void __iomem *)dd->ipath_kregbase + len); dd->ipath_physaddr = addr; /* used for io_remap, etc. */ /* for user mmap */ - dd->ipath_kregvirt = (u64 __iomem *) phys_to_virt(addr); - ipath_cdbg(VERBOSE, "mapped io addr %llx to kregbase %p " - "kregvirt %p\n", addr, dd->ipath_kregbase, - dd->ipath_kregvirt); + ipath_cdbg(VERBOSE, "mapped io addr %llx to kregbase %p\n", + addr, dd->ipath_kregbase); /* * clear ipath_flags here instead of in ipath_init_chip as it is set * by ipath_setup_htconfig. */ dd->ipath_flags = 0; + dd->ipath_lli_counter = 0; + dd->ipath_lli_errors = 0; if (dd->ipath_f_bus(dd, pdev)) ipath_dev_err(dd, "Failed to setup config space; " "continuing anyway\n"); /* - * set up our interrupt handler; SA_SHIRQ probably not needed, + * set up our interrupt handler; IRQF_SHARED probably not needed, * since MSI interrupts shouldn't be shared but won't hurt for now. * check 0 irq after we return from chip-specific bus setup, since * that can affect this due to setup @@ -520,7 +477,7 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, ipath_dev_err(dd, "irq is 0, BIOS error? Interrupts won't " "work\n"); else { - ret = request_irq(pdev->irq, ipath_intr, SA_SHIRQ, + ret = request_irq(pdev->irq, ipath_intr, IRQF_SHARED, IPATH_DRV_NAME, dd); if (ret) { ipath_dev_err(dd, "Couldn't setup irq handler, " @@ -545,6 +502,7 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, ipath_device_create_group(&pdev->dev, dd); ipathfs_add_device(dd); ipath_user_add(dd); + ipath_diag_add(dd); ipath_layer_add(dd); goto bail; @@ -561,9 +519,6 @@ bail_disable: bail_devdata: ipath_free_devdata(pdev, dd); -bail_rcvhdrtail: - cleanup_port0_rcvhdrtail(pdev); - bail: return ret; } @@ -577,8 +532,9 @@ static void __devexit ipath_remove_one(struct pci_dev *pdev) return; dd = pci_get_drvdata(pdev); - ipath_layer_del(dd); - ipath_user_del(dd); + ipath_layer_remove(dd); + ipath_diag_remove(dd); + ipath_user_remove(dd); ipathfs_remove_device(dd); ipath_device_remove_group(&pdev->dev, dd); ipath_cdbg(VERBOSE, "Releasing pci memory regions, dd %p, " @@ -594,7 +550,6 @@ static void __devexit ipath_remove_one(struct pci_dev *pdev) pci_disable_device(pdev); ipath_free_devdata(pdev, dd); - cleanup_port0_rcvhdrtail(pdev); } /* general driver use */ @@ -868,7 +823,8 @@ static void ipath_rcv_layer(struct ipath_devdata *dd, u32 etail, u8 pad, *bthbytes; struct sk_buff *skb, *nskb; - if (dd->ipath_port0_skbs && hdr->sub_opcode == OPCODE_ENCAP) { + if (dd->ipath_port0_skbs && + hdr->sub_opcode == IPATH_ITH4X_OPCODE_ENCAP) { /* * Allocate a new sk_buff to replace the one we give * to the network stack. @@ -899,7 +855,7 @@ static void ipath_rcv_layer(struct ipath_devdata *dd, u32 etail, /* another ether packet received */ ipath_stats.sps_ether_rpkts++; } - else if (hdr->sub_opcode == OPCODE_LID_ARP) + else if (hdr->sub_opcode == IPATH_ITH4X_OPCODE_LID_ARP) __ipath_layer_rcv_lid(dd, hdr); } @@ -916,8 +872,8 @@ void ipath_kreceive(struct ipath_devdata *dd) const u32 rsize = dd->ipath_rcvhdrentsize; /* words */ const u32 maxcnt = dd->ipath_rcvhdrcnt * rsize; /* words */ u32 etail = -1, l, hdrqtail; - struct ips_message_header *hdr; - u32 eflags, i, etype, tlen, pkttot = 0; + struct ipath_message_header *hdr; + u32 eflags, i, etype, tlen, pkttot = 0, updegr=0, reloop=0; static u64 totcalls; /* stats, may eventually remove */ char emsg[128]; @@ -931,24 +887,18 @@ void ipath_kreceive(struct ipath_devdata *dd) if (test_and_set_bit(0, &dd->ipath_rcv_pending)) goto bail; - if (dd->ipath_port0head == - (u32)le64_to_cpu(*dd->ipath_hdrqtailptr)) + l = dd->ipath_port0head; + hdrqtail = (u32) le64_to_cpu(*dd->ipath_hdrqtailptr); + if (l == hdrqtail) goto done; -gotmore: - /* - * read only once at start. If in flood situation, this helps - * performance slightly. If more arrive while we are processing, - * we'll come back here and do them - */ - hdrqtail = (u32)le64_to_cpu(*dd->ipath_hdrqtailptr); - - for (i = 0, l = dd->ipath_port0head; l != hdrqtail; i++) { +reloop: + for (i = 0; l != hdrqtail; i++) { u32 qp; u8 *bthbytes; rc = (u64 *) (dd->ipath_pd[0]->port_rcvhdrq + (l << 2)); - hdr = (struct ips_message_header *)&rc[1]; + hdr = (struct ipath_message_header *)&rc[1]; /* * could make a network order version of IPATH_KD_QP, and * do the obvious shift before masking to speed this up. @@ -956,10 +906,10 @@ gotmore: qp = ntohl(hdr->bth[1]) & 0xffffff; bthbytes = (u8 *) hdr->bth; - eflags = ips_get_hdr_err_flags((__le32 *) rc); - etype = ips_get_rcv_type((__le32 *) rc); + eflags = ipath_hdrget_err_flags((__le32 *) rc); + etype = ipath_hdrget_rcv_type((__le32 *) rc); /* total length */ - tlen = ips_get_length_in_bytes((__le32 *) rc); + tlen = ipath_hdrget_length_in_bytes((__le32 *) rc); ebuf = NULL; if (etype != RCVHQ_RCV_TYPE_EXPECTED) { /* @@ -969,7 +919,7 @@ gotmore: * set ebuf (so we try to copy data) unless the * length requires it. */ - etail = ips_get_index((__le32 *) rc); + etail = ipath_hdrget_index((__le32 *) rc); if (tlen > sizeof(*hdr) || etype == RCVHQ_RCV_TYPE_NON_KD) ebuf = ipath_get_egrbuf(dd, etail, 0); @@ -981,7 +931,7 @@ gotmore: */ if (etype != RCVHQ_RCV_TYPE_NON_KD && etype != - RCVHQ_RCV_TYPE_ERROR && ips_get_ipath_ver( + RCVHQ_RCV_TYPE_ERROR && ipath_hdrget_ipath_ver( hdr->iph.ver_port_tid_offset) != IPS_PROTO_VERSION) { ipath_cdbg(PKT, "Bad InfiniPath protocol version " @@ -994,7 +944,19 @@ gotmore: ipath_cdbg(PKT, "RHFerrs %x hdrqtail=%x typ=%u " "tlen=%x opcode=%x egridx=%x: %s\n", eflags, l, etype, tlen, bthbytes[0], - ips_get_index((__le32 *) rc), emsg); + ipath_hdrget_index((__le32 *) rc), emsg); + /* Count local link integrity errors. */ + if (eflags & (INFINIPATH_RHF_H_ICRCERR | + INFINIPATH_RHF_H_VCRCERR)) { + u8 n = (dd->ipath_ibcctrl >> + INFINIPATH_IBCC_PHYERRTHRESHOLD_SHIFT) & + INFINIPATH_IBCC_PHYERRTHRESHOLD_MASK; + + if (++dd->ipath_lli_counter > n) { + dd->ipath_lli_counter = 0; + dd->ipath_lli_errors++; + } + } } else if (etype == RCVHQ_RCV_TYPE_NON_KD) { int ret = __ipath_verbs_rcv(dd, rc + 1, ebuf, tlen); @@ -1002,6 +964,9 @@ gotmore: ipath_cdbg(VERBOSE, "received IB packet, " "not SMA (QP=%x)\n", qp); + if (dd->ipath_lli_counter) + dd->ipath_lli_counter--; + } else if (etype == RCVHQ_RCV_TYPE_EAGER) { if (qp == IPATH_KD_QP && bthbytes[0] == ipath_layer_rcv_opcode && @@ -1054,25 +1019,49 @@ gotmore: l += rsize; if (l >= maxcnt) l = 0; + if (etype != RCVHQ_RCV_TYPE_EXPECTED) + updegr = 1; /* - * update for each packet, to help prevent overflows if we - * have lots of packets. + * update head regs on last packet, and every 16 packets. + * Reduce bus traffic, while still trying to prevent + * rcvhdrq overflows, for when the queue is nearly full */ - (void)ipath_write_ureg(dd, ur_rcvhdrhead, - dd->ipath_rhdrhead_intr_off | l, 0); - if (etype != RCVHQ_RCV_TYPE_EXPECTED) - (void)ipath_write_ureg(dd, ur_rcvegrindexhead, - etail, 0); + if (l == hdrqtail || (i && !(i&0xf))) { + u64 lval; + if (l == hdrqtail) /* PE-800 interrupt only on last */ + lval = dd->ipath_rhdrhead_intr_off | l; + else + lval = l; + (void)ipath_write_ureg(dd, ur_rcvhdrhead, lval, 0); + if (updegr) { + (void)ipath_write_ureg(dd, ur_rcvegrindexhead, + etail, 0); + updegr = 0; + } + } + } + + if (!dd->ipath_rhdrhead_intr_off && !reloop) { + /* HT-400 workaround; we can have a race clearing chip + * interrupt with another interrupt about to be delivered, + * and can clear it before it is delivered on the GPIO + * workaround. By doing the extra check here for the + * in-memory tail register updating while we were doing + * earlier packets, we "almost" guarantee we have covered + * that case. + */ + u32 hqtail = (u32)le64_to_cpu(*dd->ipath_hdrqtailptr); + if (hqtail != hdrqtail) { + hdrqtail = hqtail; + reloop = 1; /* loop 1 extra time at most */ + goto reloop; + } } pkttot += i; dd->ipath_port0head = l; - if (hdrqtail != (u32)le64_to_cpu(*dd->ipath_hdrqtailptr)) - /* more arrived while we handled first batch */ - goto gotmore; - if (pkttot > ipath_stats.sps_maxpkts_call) ipath_stats.sps_maxpkts_call = pkttot; ipath_stats.sps_port0pkts += pkttot; @@ -1369,26 +1358,20 @@ bail: * @dd: the infinipath device * @pd: the port data * - * this *must* be physically contiguous memory, and for now, - * that limits it to what kmalloc can do. + * this must be contiguous memory (from an i/o perspective), and must be + * DMA'able (which means for some systems, it will go through an IOMMU, + * or be forced into a low address range). */ int ipath_create_rcvhdrq(struct ipath_devdata *dd, struct ipath_portdata *pd) { - int ret = 0, amt; + int ret = 0; - amt = ALIGN(dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize * - sizeof(u32), PAGE_SIZE); if (!pd->port_rcvhdrq) { - /* - * not using REPEAT isn't viable; at 128KB, we can easily - * fail this. The problem with REPEAT is we can block here - * "forever". There isn't an inbetween, unfortunately. We - * could reduce the risk by never freeing the rcvhdrq except - * at unload, but even then, the first time a port is used, - * we could delay for some time... - */ + dma_addr_t phys_hdrqtail; gfp_t gfp_flags = GFP_USER | __GFP_COMP; + int amt = ALIGN(dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize * + sizeof(u32), PAGE_SIZE); pd->port_rcvhdrq = dma_alloc_coherent( &dd->pcidev->dev, amt, &pd->port_rcvhdrq_phys, @@ -1401,6 +1384,16 @@ int ipath_create_rcvhdrq(struct ipath_devdata *dd, ret = -ENOMEM; goto bail; } + pd->port_rcvhdrtail_kvaddr = dma_alloc_coherent( + &dd->pcidev->dev, PAGE_SIZE, &phys_hdrqtail, GFP_KERNEL); + if (!pd->port_rcvhdrtail_kvaddr) { + ipath_dev_err(dd, "attempt to allocate 1 page " + "for port %u rcvhdrqtailaddr failed\n", + pd->port_port); + ret = -ENOMEM; + goto bail; + } + pd->port_rcvhdrqtailaddr_phys = phys_hdrqtail; pd->port_rcvhdrq_size = amt; @@ -1410,20 +1403,28 @@ int ipath_create_rcvhdrq(struct ipath_devdata *dd, (unsigned long) pd->port_rcvhdrq_phys, (unsigned long) pd->port_rcvhdrq_size, pd->port_port); - } else { - /* - * clear for security, sanity, and/or debugging, each - * time we reuse - */ - memset(pd->port_rcvhdrq, 0, amt); + + ipath_cdbg(VERBOSE, "port %d hdrtailaddr, %llx physical\n", + pd->port_port, + (unsigned long long) phys_hdrqtail); } + else + ipath_cdbg(VERBOSE, "reuse port %d rcvhdrq @%p %llx phys; " + "hdrtailaddr@%p %llx physical\n", + pd->port_port, pd->port_rcvhdrq, + pd->port_rcvhdrq_phys, pd->port_rcvhdrtail_kvaddr, + (unsigned long long)pd->port_rcvhdrqtailaddr_phys); + + /* clear for security and sanity on each use */ + memset(pd->port_rcvhdrq, 0, pd->port_rcvhdrq_size); + memset((void *)pd->port_rcvhdrtail_kvaddr, 0, PAGE_SIZE); /* * tell chip each time we init it, even if we are re-using previous - * memory (we zero it at process close) + * memory (we zero the register at process close) */ - ipath_cdbg(VERBOSE, "writing port %d rcvhdraddr as %lx\n", - pd->port_port, (unsigned long) pd->port_rcvhdrq_phys); + ipath_write_kreg_port(dd, dd->ipath_kregs->kr_rcvhdrtailaddr, + pd->port_port, pd->port_rcvhdrqtailaddr_phys); ipath_write_kreg_port(dd, dd->ipath_kregs->kr_rcvhdraddr, pd->port_port, pd->port_rcvhdrq_phys); @@ -1511,15 +1512,27 @@ void ipath_set_ib_lstate(struct ipath_devdata *dd, int which) [INFINIPATH_IBCC_LINKCMD_ARMED] = "ARMED", [INFINIPATH_IBCC_LINKCMD_ACTIVE] = "ACTIVE" }; + int linkcmd = (which >> INFINIPATH_IBCC_LINKCMD_SHIFT) & + INFINIPATH_IBCC_LINKCMD_MASK; + ipath_cdbg(SMA, "Trying to move unit %u to %s, current ltstate " "is %s\n", dd->ipath_unit, - what[(which >> INFINIPATH_IBCC_LINKCMD_SHIFT) & - INFINIPATH_IBCC_LINKCMD_MASK], + what[linkcmd], ipath_ibcstatus_str[ (ipath_read_kreg64 (dd, dd->ipath_kregs->kr_ibcstatus) >> INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT) & INFINIPATH_IBCS_LINKTRAININGSTATE_MASK]); + /* flush all queued sends when going to DOWN or INIT, to be sure that + * they don't block SMA and other MAD packets */ + if (!linkcmd || linkcmd == INFINIPATH_IBCC_LINKCMD_INIT) { + ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, + INFINIPATH_S_ABORT); + ipath_disarm_piobufs(dd, dd->ipath_lastport_piobuf, + (unsigned)(dd->ipath_piobcnt2k + + dd->ipath_piobcnt4k) - + dd->ipath_lastport_piobuf); + } ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, dd->ipath_ibcctrl | which); @@ -1638,7 +1651,7 @@ void ipath_shutdown_device(struct ipath_devdata *dd) /* disable IBC */ dd->ipath_control &= ~INFINIPATH_C_LINKENABLE; ipath_write_kreg(dd, dd->ipath_kregs->kr_control, - dd->ipath_control); + dd->ipath_control | INFINIPATH_C_FREEZEMODE); /* * clear SerdesEnable and turn the leds off; do this here because @@ -1667,60 +1680,54 @@ void ipath_shutdown_device(struct ipath_devdata *dd) /** * ipath_free_pddata - free a port's allocated data * @dd: the infinipath device - * @port: the port - * @freehdrq: free the port data structure if true + * @pd: the portdata structure * - * when closing, free up any allocated data for a port, if the - * reference count goes to zero - * Note: this also optionally frees the portdata itself! - * Any changes here have to be matched up with the reinit case - * of ipath_init_chip(), which calls this routine on reinit after reset. + * free up any allocated data for a port + * This should not touch anything that would affect a simultaneous + * re-allocation of port data, because it is called after ipath_mutex + * is released (and can be called from reinit as well). + * It should never change any chip state, or global driver state. + * (The only exception to global state is freeing the port0 port0_skbs.) */ -void ipath_free_pddata(struct ipath_devdata *dd, u32 port, int freehdrq) +void ipath_free_pddata(struct ipath_devdata *dd, struct ipath_portdata *pd) { - struct ipath_portdata *pd = dd->ipath_pd[port]; - if (!pd) return; - if (freehdrq) - /* - * only clear and free portdata if we are going to also - * release the hdrq, otherwise we leak the hdrq on each - * open/close cycle - */ - dd->ipath_pd[port] = NULL; - if (freehdrq && pd->port_rcvhdrq) { + + if (pd->port_rcvhdrq) { ipath_cdbg(VERBOSE, "free closed port %d rcvhdrq @ %p " "(size=%lu)\n", pd->port_port, pd->port_rcvhdrq, (unsigned long) pd->port_rcvhdrq_size); dma_free_coherent(&dd->pcidev->dev, pd->port_rcvhdrq_size, pd->port_rcvhdrq, pd->port_rcvhdrq_phys); pd->port_rcvhdrq = NULL; + if (pd->port_rcvhdrtail_kvaddr) { + dma_free_coherent(&dd->pcidev->dev, PAGE_SIZE, + (void *)pd->port_rcvhdrtail_kvaddr, + pd->port_rcvhdrqtailaddr_phys); + pd->port_rcvhdrtail_kvaddr = NULL; + } } - if (port && pd->port_rcvegrbuf) { - /* always free this */ - if (pd->port_rcvegrbuf) { - unsigned e; - - for (e = 0; e < pd->port_rcvegrbuf_chunks; e++) { - void *base = pd->port_rcvegrbuf[e]; - size_t size = pd->port_rcvegrbuf_size; - - ipath_cdbg(VERBOSE, "egrbuf free(%p, %lu), " - "chunk %u/%u\n", base, - (unsigned long) size, - e, pd->port_rcvegrbuf_chunks); - dma_free_coherent( - &dd->pcidev->dev, size, base, - pd->port_rcvegrbuf_phys[e]); - } - vfree(pd->port_rcvegrbuf); - pd->port_rcvegrbuf = NULL; - vfree(pd->port_rcvegrbuf_phys); - pd->port_rcvegrbuf_phys = NULL; + if (pd->port_port && pd->port_rcvegrbuf) { + unsigned e; + + for (e = 0; e < pd->port_rcvegrbuf_chunks; e++) { + void *base = pd->port_rcvegrbuf[e]; + size_t size = pd->port_rcvegrbuf_size; + + ipath_cdbg(VERBOSE, "egrbuf free(%p, %lu), " + "chunk %u/%u\n", base, + (unsigned long) size, + e, pd->port_rcvegrbuf_chunks); + dma_free_coherent(&dd->pcidev->dev, size, + base, pd->port_rcvegrbuf_phys[e]); } + vfree(pd->port_rcvegrbuf); + pd->port_rcvegrbuf = NULL; + vfree(pd->port_rcvegrbuf_phys); + pd->port_rcvegrbuf_phys = NULL; pd->port_rcvegrbuf_chunks = 0; - } else if (port == 0 && dd->ipath_port0_skbs) { + } else if (pd->port_port == 0 && dd->ipath_port0_skbs) { unsigned e; struct sk_buff **skbs = dd->ipath_port0_skbs; @@ -1732,10 +1739,8 @@ void ipath_free_pddata(struct ipath_devdata *dd, u32 port, int freehdrq) dev_kfree_skb(skbs[e]); vfree(skbs); } - if (freehdrq) { - kfree(pd->port_tid_pg_list); - kfree(pd); - } + kfree(pd->port_tid_pg_list); + kfree(pd); } static int __init infinipath_init(void) @@ -1806,7 +1811,6 @@ static void cleanup_device(struct ipath_devdata *dd) * re-init */ dd->ipath_kregbase = NULL; - dd->ipath_kregvirt = NULL; dd->ipath_uregbase = 0; dd->ipath_sregbase = 0; dd->ipath_cregbase = 0; @@ -1821,6 +1825,12 @@ static void cleanup_device(struct ipath_devdata *dd) dd->ipath_pioavailregs_phys); dd->ipath_pioavailregs_dma = NULL; } + if (dd->ipath_dummy_hdrq) { + dma_free_coherent(&dd->pcidev->dev, + dd->ipath_pd[0]->port_rcvhdrq_size, + dd->ipath_dummy_hdrq, dd->ipath_dummy_hdrq_phys); + dd->ipath_dummy_hdrq = NULL; + } if (dd->ipath_pageshadow) { struct page **tmpp = dd->ipath_pageshadow; @@ -1861,10 +1871,14 @@ static void cleanup_device(struct ipath_devdata *dd) /* * free any resources still in use (usually just kernel ports) - * at unload + * at unload; we do for portcnt, not cfgports, because cfgports + * could have changed while we were loaded. */ - for (port = 0; port < dd->ipath_cfgports; port++) - ipath_free_pddata(dd, port, 1); + for (port = 0; port < dd->ipath_portcnt; port++) { + struct ipath_portdata *pd = dd->ipath_pd[port]; + dd->ipath_pd[port] = NULL; + ipath_free_pddata(dd, pd); + } kfree(dd->ipath_pd); /* * debuggability, in case some cleanup path tries to use it diff --git a/drivers/infiniband/hw/ipath/ipath_eeprom.c b/drivers/infiniband/hw/ipath/ipath_eeprom.c index a2f1ceafcca..3313356ab93 100644 --- a/drivers/infiniband/hw/ipath/ipath_eeprom.c +++ b/drivers/infiniband/hw/ipath/ipath_eeprom.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -600,8 +601,31 @@ void ipath_get_eeprom_info(struct ipath_devdata *dd) guid = *(__be64 *) ifp->if_guid; dd->ipath_guid = guid; dd->ipath_nguid = ifp->if_numguid; - memcpy(dd->ipath_serial, ifp->if_serial, - sizeof(ifp->if_serial)); + /* + * Things are slightly complicated by the desire to transparently + * support both the Pathscale 10-digit serial number and the QLogic + * 13-character version. + */ + if ((ifp->if_fversion > 1) && ifp->if_sprefix[0] + && ((u8 *)ifp->if_sprefix)[0] != 0xFF) { + /* This board has a Serial-prefix, which is stored + * elsewhere for backward-compatibility. + */ + char *snp = dd->ipath_serial; + int len; + memcpy(snp, ifp->if_sprefix, sizeof ifp->if_sprefix); + snp[sizeof ifp->if_sprefix] = '\0'; + len = strlen(snp); + snp += len; + len = (sizeof dd->ipath_serial) - len; + if (len > sizeof ifp->if_serial) { + len = sizeof ifp->if_serial; + } + memcpy(snp, ifp->if_serial, len); + } else + memcpy(dd->ipath_serial, ifp->if_serial, + sizeof ifp->if_serial); + ipath_cdbg(VERBOSE, "Initted GUID to %llx from eeprom\n", (unsigned long long) be64_to_cpu(dd->ipath_guid)); diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c index ada267e41f6..bbaa70e57db 100644 --- a/drivers/infiniband/hw/ipath/ipath_file_ops.c +++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -38,8 +39,8 @@ #include <asm/pgtable.h> #include "ipath_kernel.h" -#include "ips_common.h" #include "ipath_layer.h" +#include "ipath_common.h" static int ipath_open(struct inode *, struct file *); static int ipath_close(struct inode *, struct file *); @@ -122,6 +123,7 @@ static int ipath_get_base_info(struct ipath_portdata *pd, * on to yet another method of dealing with this */ kinfo->spi_rcvhdr_base = (u64) pd->port_rcvhdrq_phys; + kinfo->spi_rcvhdr_tailaddr = (u64)pd->port_rcvhdrqtailaddr_phys; kinfo->spi_rcv_egrbufs = (u64) pd->port_rcvegr_phys; kinfo->spi_pioavailaddr = (u64) dd->ipath_pioavailregs_phys; kinfo->spi_status = (u64) kinfo->spi_pioavailaddr + @@ -456,7 +458,7 @@ static int ipath_set_part_key(struct ipath_portdata *pd, u16 key) u16 lkey = key & 0x7FFF; int ret; - if (lkey == (IPS_DEFAULT_P_KEY & 0x7FFF)) { + if (lkey == (IPATH_DEFAULT_P_KEY & 0x7FFF)) { /* nothing to do; this key always valid */ ret = 0; goto bail; @@ -704,6 +706,15 @@ static int ipath_create_user_egr(struct ipath_portdata *pd) unsigned e, egrcnt, alloced, egrperchunk, chunk, egrsize, egroff; size_t size; int ret; + gfp_t gfp_flags; + + /* + * GFP_USER, but without GFP_FS, so buffer cache can be + * coalesced (we hope); otherwise, even at order 4, + * heavy filesystem activity makes these fail, and we can + * use compound pages. + */ + gfp_flags = __GFP_WAIT | __GFP_IO | __GFP_COMP; egrcnt = dd->ipath_rcvegrcnt; /* TID number offset for this port */ @@ -720,10 +731,8 @@ static int ipath_create_user_egr(struct ipath_portdata *pd) * memory pressure (creating large files and then copying them over * NFS while doing lots of MPI jobs), we hit some allocation * failures, even though we can sleep... (2.6.10) Still get - * failures at 64K. 32K is the lowest we can go without waiting - * more memory again. It seems likely that the coalescing in - * free_pages, etc. still has issues (as it has had previously - * during 2.6.x development). + * failures at 64K. 32K is the lowest we can go without wasting + * additional memory. */ size = 0x8000; alloced = ALIGN(egrsize * egrcnt, size); @@ -744,12 +753,6 @@ static int ipath_create_user_egr(struct ipath_portdata *pd) goto bail_rcvegrbuf; } for (e = 0; e < pd->port_rcvegrbuf_chunks; e++) { - /* - * GFP_USER, but without GFP_FS, so buffer cache can be - * coalesced (we hope); otherwise, even at order 4, - * heavy filesystem activity makes these fail - */ - gfp_t gfp_flags = __GFP_WAIT | __GFP_IO | __GFP_COMP; pd->port_rcvegrbuf[e] = dma_alloc_coherent( &dd->pcidev->dev, size, &pd->port_rcvegrbuf_phys[e], @@ -783,11 +786,12 @@ static int ipath_create_user_egr(struct ipath_portdata *pd) bail_rcvegrbuf_phys: for (e = 0; e < pd->port_rcvegrbuf_chunks && - pd->port_rcvegrbuf[e]; e++) + pd->port_rcvegrbuf[e]; e++) { dma_free_coherent(&dd->pcidev->dev, size, pd->port_rcvegrbuf[e], pd->port_rcvegrbuf_phys[e]); + } vfree(pd->port_rcvegrbuf_phys); pd->port_rcvegrbuf_phys = NULL; bail_rcvegrbuf: @@ -802,10 +806,7 @@ static int ipath_do_user_init(struct ipath_portdata *pd, { int ret = 0; struct ipath_devdata *dd = pd->port_dd; - u64 physaddr, uaddr, off, atmp; - struct page *pagep; u32 head32; - u64 head; /* for now, if major version is different, bail */ if ((uinfo->spu_userversion >> 16) != IPATH_USER_SWMAJOR) { @@ -830,54 +831,6 @@ static int ipath_do_user_init(struct ipath_portdata *pd, /* for now we do nothing with rcvhdrcnt: uinfo->spu_rcvhdrcnt */ - /* set up for the rcvhdr Q tail register writeback to user memory */ - if (!uinfo->spu_rcvhdraddr || - !access_ok(VERIFY_WRITE, (u64 __user *) (unsigned long) - uinfo->spu_rcvhdraddr, sizeof(u64))) { - ipath_dbg("Port %d rcvhdrtail addr %llx not valid\n", - pd->port_port, - (unsigned long long) uinfo->spu_rcvhdraddr); - ret = -EINVAL; - goto done; - } - - off = offset_in_page(uinfo->spu_rcvhdraddr); - uaddr = PAGE_MASK & (unsigned long) uinfo->spu_rcvhdraddr; - ret = ipath_get_user_pages_nocopy(uaddr, &pagep); - if (ret) { - dev_info(&dd->pcidev->dev, "Failed to lookup and lock " - "address %llx for rcvhdrtail: errno %d\n", - (unsigned long long) uinfo->spu_rcvhdraddr, -ret); - goto done; - } - ipath_stats.sps_pagelocks++; - pd->port_rcvhdrtail_uaddr = uaddr; - pd->port_rcvhdrtail_pagep = pagep; - pd->port_rcvhdrtail_kvaddr = - page_address(pagep); - pd->port_rcvhdrtail_kvaddr += off; - physaddr = page_to_phys(pagep) + off; - ipath_cdbg(VERBOSE, "port %d user addr %llx hdrtailaddr, %llx " - "physical (off=%llx)\n", - pd->port_port, - (unsigned long long) uinfo->spu_rcvhdraddr, - (unsigned long long) physaddr, (unsigned long long) off); - ipath_write_kreg_port(dd, dd->ipath_kregs->kr_rcvhdrtailaddr, - pd->port_port, physaddr); - atmp = ipath_read_kreg64_port(dd, - dd->ipath_kregs->kr_rcvhdrtailaddr, - pd->port_port); - if (physaddr != atmp) { - ipath_dev_err(dd, - "Catastrophic software error, " - "RcvHdrTailAddr%u written as %llx, " - "read back as %llx\n", pd->port_port, - (unsigned long long) physaddr, - (unsigned long long) atmp); - ret = -EINVAL; - goto done; - } - /* for right now, kernel piobufs are at end, so port 1 is at 0 */ pd->port_piobufs = dd->ipath_piobufbase + dd->ipath_pbufsport * (pd->port_port - @@ -896,26 +849,18 @@ static int ipath_do_user_init(struct ipath_portdata *pd, ret = ipath_create_user_egr(pd); if (ret) goto done; - /* enable receives now */ - /* atomically set enable bit for this port */ - set_bit(INFINIPATH_R_PORTENABLE_SHIFT + pd->port_port, - &dd->ipath_rcvctrl); /* - * set the head registers for this port to the current values + * set the eager head register for this port to the current values * of the tail pointers, since we don't know if they were * updated on last use of the port. */ - head32 = ipath_read_ureg32(dd, ur_rcvhdrtail, pd->port_port); - head = (u64) head32; - ipath_write_ureg(dd, ur_rcvhdrhead, head, pd->port_port); head32 = ipath_read_ureg32(dd, ur_rcvegrindextail, pd->port_port); ipath_write_ureg(dd, ur_rcvegrindexhead, head32, pd->port_port); dd->ipath_lastegrheads[pd->port_port] = -1; dd->ipath_lastrcvhdrqtails[pd->port_port] = -1; - ipath_cdbg(VERBOSE, "Wrote port%d head %llx, egrhead %x from " - "tail regs\n", pd->port_port, - (unsigned long long) head, head32); + ipath_cdbg(VERBOSE, "Wrote port%d egrhead %x from tail regs\n", + pd->port_port, head32); pd->port_tidcursor = 0; /* start at beginning after open */ /* * now enable the port; the tail registers will be written to memory @@ -924,24 +869,76 @@ static int ipath_do_user_init(struct ipath_portdata *pd, * transition from 0 to 1, so clear it first, then set it as part of * enabling the port. This will (very briefly) affect any other * open ports, but it shouldn't be long enough to be an issue. + * We explictly set the in-memory copy to 0 beforehand, so we don't + * have to wait to be sure the DMA update has happened. */ + *pd->port_rcvhdrtail_kvaddr = 0ULL; + set_bit(INFINIPATH_R_PORTENABLE_SHIFT + pd->port_port, + &dd->ipath_rcvctrl); ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, dd->ipath_rcvctrl & ~INFINIPATH_R_TAILUPD); ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvctrl, dd->ipath_rcvctrl); - done: return ret; } + +/* common code for the mappings on dma_alloc_coherent mem */ +static int ipath_mmap_mem(struct vm_area_struct *vma, + struct ipath_portdata *pd, unsigned len, + int write_ok, dma_addr_t addr, char *what) +{ + struct ipath_devdata *dd = pd->port_dd; + unsigned pfn = (unsigned long)addr >> PAGE_SHIFT; + int ret; + + if ((vma->vm_end - vma->vm_start) > len) { + dev_info(&dd->pcidev->dev, + "FAIL on %s: len %lx > %x\n", what, + vma->vm_end - vma->vm_start, len); + ret = -EFAULT; + goto bail; + } + + if (!write_ok) { + if (vma->vm_flags & VM_WRITE) { + dev_info(&dd->pcidev->dev, + "%s must be mapped readonly\n", what); + ret = -EPERM; + goto bail; + } + + /* don't allow them to later change with mprotect */ + vma->vm_flags &= ~VM_MAYWRITE; + } + + ret = remap_pfn_range(vma, vma->vm_start, pfn, + len, vma->vm_page_prot); + if (ret) + dev_info(&dd->pcidev->dev, + "%s port%u mmap of %lx, %x bytes r%c failed: %d\n", + what, pd->port_port, (unsigned long)addr, len, + write_ok?'w':'o', ret); + else + ipath_cdbg(VERBOSE, "%s port%u mmaped %lx, %x bytes r%c\n", + what, pd->port_port, (unsigned long)addr, len, + write_ok?'w':'o'); +bail: + return ret; +} + static int mmap_ureg(struct vm_area_struct *vma, struct ipath_devdata *dd, u64 ureg) { unsigned long phys; int ret; - /* it's the real hardware, so io_remap works */ - + /* + * This is real hardware, so use io_remap. This is the mechanism + * for the user process to update the head registers for their port + * in the chip. + */ if ((vma->vm_end - vma->vm_start) > PAGE_SIZE) { dev_info(&dd->pcidev->dev, "FAIL mmap userreg: reqlen " "%lx > PAGE\n", vma->vm_end - vma->vm_start); @@ -967,10 +964,11 @@ static int mmap_piobufs(struct vm_area_struct *vma, int ret; /* - * When we map the PIO buffers, we want to map them as writeonly, no - * read possible. + * When we map the PIO buffers in the chip, we want to map them as + * writeonly, no read possible. This prevents access to previous + * process data, and catches users who might try to read the i/o + * space due to a bug. */ - if ((vma->vm_end - vma->vm_start) > (dd->ipath_pbufsport * dd->ipath_palign)) { dev_info(&dd->pcidev->dev, "FAIL mmap piobufs: " @@ -981,11 +979,10 @@ static int mmap_piobufs(struct vm_area_struct *vma, } phys = dd->ipath_physaddr + pd->port_piobufs; + /* - * Do *NOT* mark this as non-cached (PWT bit), or we don't get the + * Don't mark this as non-cached, or we don't get the * write combining behavior we want on the PIO buffers! - * vma->vm_page_prot = - * pgprot_noncached(vma->vm_page_prot); */ if (vma->vm_flags & VM_READ) { @@ -997,8 +994,7 @@ static int mmap_piobufs(struct vm_area_struct *vma, } /* don't allow them to later change to readable with mprotect */ - - vma->vm_flags &= ~VM_MAYWRITE; + vma->vm_flags &= ~VM_MAYREAD; vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND; ret = io_remap_pfn_range(vma, vma->vm_start, phys >> PAGE_SHIFT, @@ -1017,11 +1013,6 @@ static int mmap_rcvegrbufs(struct vm_area_struct *vma, dma_addr_t *phys; int ret; - if (!pd->port_rcvegrbuf) { - ret = -EFAULT; - goto bail; - } - size = pd->port_rcvegrbuf_size; total_size = pd->port_rcvegrbuf_chunks * size; if ((vma->vm_end - vma->vm_start) > total_size) { @@ -1039,13 +1030,12 @@ static int mmap_rcvegrbufs(struct vm_area_struct *vma, ret = -EPERM; goto bail; } + /* don't allow them to later change to writeable with mprotect */ + vma->vm_flags &= ~VM_MAYWRITE; start = vma->vm_start; phys = pd->port_rcvegrbuf_phys; - /* don't allow them to later change to writeable with mprotect */ - vma->vm_flags &= ~VM_MAYWRITE; - for (i = 0; i < pd->port_rcvegrbuf_chunks; i++, start += size) { ret = remap_pfn_range(vma, start, phys[i] >> PAGE_SHIFT, size, vma->vm_page_prot); @@ -1058,78 +1048,6 @@ bail: return ret; } -static int mmap_rcvhdrq(struct vm_area_struct *vma, - struct ipath_portdata *pd) -{ - struct ipath_devdata *dd = pd->port_dd; - size_t total_size; - int ret; - - /* - * kmalloc'ed memory, physically contiguous; this is from - * spi_rcvhdr_base; we allow user to map read-write so they can - * write hdrq entries to allow protocol code to directly poll - * whether a hdrq entry has been written. - */ - total_size = ALIGN(dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize * - sizeof(u32), PAGE_SIZE); - if ((vma->vm_end - vma->vm_start) > total_size) { - dev_info(&dd->pcidev->dev, - "FAIL on rcvhdrq: reqlen %lx > actual %lx\n", - vma->vm_end - vma->vm_start, - (unsigned long) total_size); - ret = -EFAULT; - goto bail; - } - - ret = remap_pfn_range(vma, vma->vm_start, - pd->port_rcvhdrq_phys >> PAGE_SHIFT, - vma->vm_end - vma->vm_start, - vma->vm_page_prot); -bail: - return ret; -} - -static int mmap_pioavailregs(struct vm_area_struct *vma, - struct ipath_portdata *pd) -{ - struct ipath_devdata *dd = pd->port_dd; - int ret; - - /* - * when we map the PIO bufferavail registers, we want to map them as - * readonly, no write possible. - * - * kmalloc'ed memory, physically contiguous, one page only, readonly - */ - - if ((vma->vm_end - vma->vm_start) > PAGE_SIZE) { - dev_info(&dd->pcidev->dev, "FAIL on pioavailregs_dma: " - "reqlen %lx > actual %lx\n", - vma->vm_end - vma->vm_start, - (unsigned long) PAGE_SIZE); - ret = -EFAULT; - goto bail; - } - - if (vma->vm_flags & VM_WRITE) { - dev_info(&dd->pcidev->dev, - "Can't map pioavailregs as writable (flags=%lx)\n", - vma->vm_flags); - ret = -EPERM; - goto bail; - } - - /* don't allow them to later change with mprotect */ - vma->vm_flags &= ~VM_MAYWRITE; - - ret = remap_pfn_range(vma, vma->vm_start, - dd->ipath_pioavailregs_phys >> PAGE_SHIFT, - PAGE_SIZE, vma->vm_page_prot); -bail: - return ret; -} - /** * ipath_mmap - mmap various structures into user space * @fp: the file pointer @@ -1149,6 +1067,7 @@ static int ipath_mmap(struct file *fp, struct vm_area_struct *vma) pd = port_fp(fp); dd = pd->port_dd; + /* * This is the ipath_do_user_init() code, mapping the shared buffers * into the user process. The address referred to by vm_pgoff is the @@ -1158,28 +1077,59 @@ static int ipath_mmap(struct file *fp, struct vm_area_struct *vma) pgaddr = vma->vm_pgoff << PAGE_SHIFT; /* - * note that ureg does *NOT* have the kregvirt as part of it, to be - * sure that for 32 bit programs, we don't end up trying to map a > - * 44 address. Has to match ipath_get_base_info() code that sets - * __spi_uregbase + * Must fit in 40 bits for our hardware; some checked elsewhere, + * but we'll be paranoid. Check for 0 is mostly in case one of the + * allocations failed, but user called mmap anyway. We want to catch + * that before it can match. */ + if (!pgaddr || pgaddr >= (1ULL<<40)) { + ipath_dev_err(dd, "Bad phys addr %llx, start %lx, end %lx\n", + (unsigned long long)pgaddr, vma->vm_start, vma->vm_end); + return -EINVAL; + } + /* just the offset of the port user registers, not physical addr */ ureg = dd->ipath_uregbase + dd->ipath_palign * pd->port_port; ipath_cdbg(MM, "ushare: pgaddr %llx vm_start=%lx, vmlen %lx\n", (unsigned long long) pgaddr, vma->vm_start, vma->vm_end - vma->vm_start); - if (pgaddr == ureg) + if (vma->vm_start & (PAGE_SIZE-1)) { + ipath_dev_err(dd, + "vm_start not aligned: %lx, end=%lx phys %lx\n", + vma->vm_start, vma->vm_end, (unsigned long)pgaddr); + ret = -EINVAL; + } + else if (pgaddr == ureg) ret = mmap_ureg(vma, dd, ureg); else if (pgaddr == pd->port_piobufs) ret = mmap_piobufs(vma, dd, pd); else if (pgaddr == (u64) pd->port_rcvegr_phys) ret = mmap_rcvegrbufs(vma, pd); - else if (pgaddr == (u64) pd->port_rcvhdrq_phys) - ret = mmap_rcvhdrq(vma, pd); + else if (pgaddr == (u64) pd->port_rcvhdrq_phys) { + /* + * The rcvhdrq itself; readonly except on HT-400 (so have + * to allow writable mapping), multiple pages, contiguous + * from an i/o perspective. + */ + unsigned total_size = + ALIGN(dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize + * sizeof(u32), PAGE_SIZE); + ret = ipath_mmap_mem(vma, pd, total_size, 1, + pd->port_rcvhdrq_phys, + "rcvhdrq"); + } + else if (pgaddr == (u64)pd->port_rcvhdrqtailaddr_phys) + /* in-memory copy of rcvhdrq tail register */ + ret = ipath_mmap_mem(vma, pd, PAGE_SIZE, 0, + pd->port_rcvhdrqtailaddr_phys, + "rcvhdrq tail"); else if (pgaddr == dd->ipath_pioavailregs_phys) - ret = mmap_pioavailregs(vma, pd); + /* in-memory copy of pioavail registers */ + ret = ipath_mmap_mem(vma, pd, PAGE_SIZE, 0, + dd->ipath_pioavailregs_phys, + "pioavail registers"); else ret = -EINVAL; @@ -1442,16 +1392,16 @@ done: static int ipath_open(struct inode *in, struct file *fp) { - int ret, minor; + int ret, user_minor; mutex_lock(&ipath_mutex); - minor = iminor(in); + user_minor = iminor(in) - IPATH_USER_MINOR_BASE; ipath_cdbg(VERBOSE, "open on dev %lx (minor %d)\n", - (long)in->i_rdev, minor); + (long)in->i_rdev, user_minor); - if (minor) - ret = find_free_port(minor - 1, fp); + if (user_minor) + ret = find_free_port(user_minor - 1, fp); else ret = find_best_unit(fp); @@ -1536,53 +1486,54 @@ static int ipath_close(struct inode *in, struct file *fp) } if (dd->ipath_kregbase) { - if (pd->port_rcvhdrtail_uaddr) { - pd->port_rcvhdrtail_uaddr = 0; - pd->port_rcvhdrtail_kvaddr = NULL; - ipath_release_user_pages_on_close( - &pd->port_rcvhdrtail_pagep, 1); - pd->port_rcvhdrtail_pagep = NULL; - ipath_stats.sps_pageunlocks++; - } - ipath_write_kreg_port( - dd, dd->ipath_kregs->kr_rcvhdrtailaddr, - port, 0ULL); - ipath_write_kreg_port( - dd, dd->ipath_kregs->kr_rcvhdraddr, - pd->port_port, 0); + int i; + /* atomically clear receive enable port. */ + clear_bit(INFINIPATH_R_PORTENABLE_SHIFT + port, + &dd->ipath_rcvctrl); + ipath_write_kreg( dd, dd->ipath_kregs->kr_rcvctrl, + dd->ipath_rcvctrl); + /* and read back from chip to be sure that nothing + * else is in flight when we do the rest */ + (void)ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); /* clean up the pkeys for this port user */ ipath_clean_part_key(pd, dd); - if (port < dd->ipath_cfgports) { - int i = dd->ipath_pbufsport * (port - 1); - ipath_disarm_piobufs(dd, i, dd->ipath_pbufsport); - /* atomically clear receive enable port. */ - clear_bit(INFINIPATH_R_PORTENABLE_SHIFT + port, - &dd->ipath_rcvctrl); - ipath_write_kreg( - dd, - dd->ipath_kregs->kr_rcvctrl, - dd->ipath_rcvctrl); - - if (dd->ipath_pageshadow) - unlock_expected_tids(pd); - ipath_stats.sps_ports--; - ipath_cdbg(PROC, "%s[%u] closed port %u:%u\n", - pd->port_comm, pd->port_pid, - dd->ipath_unit, port); - } + /* + * be paranoid, and never write 0's to these, just use an + * unused part of the port 0 tail page. Of course, + * rcvhdraddr points to a large chunk of memory, so this + * could still trash things, but at least it won't trash + * page 0, and by disabling the port, it should stop "soon", + * even if a packet or two is in already in flight after we + * disabled the port. + */ + ipath_write_kreg_port(dd, + dd->ipath_kregs->kr_rcvhdrtailaddr, port, + dd->ipath_dummy_hdrq_phys); + ipath_write_kreg_port(dd, dd->ipath_kregs->kr_rcvhdraddr, + pd->port_port, dd->ipath_dummy_hdrq_phys); + + i = dd->ipath_pbufsport * (port - 1); + ipath_disarm_piobufs(dd, i, dd->ipath_pbufsport); + + if (dd->ipath_pageshadow) + unlock_expected_tids(pd); + ipath_stats.sps_ports--; + ipath_cdbg(PROC, "%s[%u] closed port %u:%u\n", + pd->port_comm, pd->port_pid, + dd->ipath_unit, port); + + dd->ipath_f_clear_tids(dd, pd->port_port); } pd->port_cnt = 0; pd->port_pid = 0; - dd->ipath_f_clear_tids(dd, pd->port_port); - - ipath_free_pddata(dd, pd->port_port, 0); - + dd->ipath_pd[pd->port_port] = NULL; /* before releasing mutex */ mutex_unlock(&ipath_mutex); + ipath_free_pddata(dd, pd); /* after releasing the mutex */ return ret; } @@ -1859,19 +1810,12 @@ int ipath_user_add(struct ipath_devdata *dd) "error %d\n", -ret); goto bail; } - ret = ipath_diag_init(); - if (ret < 0) { - ipath_dev_err(dd, "Unable to set up diag support: " - "error %d\n", -ret); - goto bail_sma; - } - ret = init_cdev(0, "ipath", &ipath_file_ops, &wildcard_cdev, &wildcard_class_dev); if (ret < 0) { ipath_dev_err(dd, "Could not create wildcard " "minor: error %d\n", -ret); - goto bail_diag; + goto bail_sma; } atomic_set(&user_setup, 1); @@ -1880,31 +1824,28 @@ int ipath_user_add(struct ipath_devdata *dd) snprintf(name, sizeof(name), "ipath%d", dd->ipath_unit); ret = init_cdev(dd->ipath_unit + 1, name, &ipath_file_ops, - &dd->cdev, &dd->class_dev); + &dd->user_cdev, &dd->user_class_dev); if (ret < 0) ipath_dev_err(dd, "Could not create user minor %d, %s\n", dd->ipath_unit + 1, name); goto bail; -bail_diag: - ipath_diag_cleanup(); bail_sma: user_cleanup(); bail: return ret; } -void ipath_user_del(struct ipath_devdata *dd) +void ipath_user_remove(struct ipath_devdata *dd) { - cleanup_cdev(&dd->cdev, &dd->class_dev); + cleanup_cdev(&dd->user_cdev, &dd->user_class_dev); if (atomic_dec_return(&user_count) == 0) { if (atomic_read(&user_setup) == 0) goto bail; cleanup_cdev(&wildcard_cdev, &wildcard_class_dev); - ipath_diag_cleanup(); user_cleanup(); atomic_set(&user_setup, 0); @@ -1912,3 +1853,4 @@ void ipath_user_del(struct ipath_devdata *dd) bail: return; } + diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c index 63de3046aff..0936d8e8d70 100644 --- a/drivers/infiniband/hw/ipath/ipath_fs.c +++ b/drivers/infiniband/hw/ipath/ipath_fs.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -31,7 +32,6 @@ */ #include <linux/version.h> -#include <linux/config.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/mount.h> diff --git a/drivers/infiniband/hw/ipath/ipath_ht400.c b/drivers/infiniband/hw/ipath/ipath_ht400.c index fac0a2b74de..3db015da6e7 100644 --- a/drivers/infiniband/hw/ipath/ipath_ht400.c +++ b/drivers/infiniband/hw/ipath/ipath_ht400.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -1572,7 +1573,6 @@ void ipath_init_ht400_funcs(struct ipath_devdata *dd) dd->ipath_f_reset = ipath_setup_ht_reset; dd->ipath_f_get_boardname = ipath_ht_boardname; dd->ipath_f_init_hwerrors = ipath_ht_init_hwerrors; - dd->ipath_f_init_hwerrors = ipath_ht_init_hwerrors; dd->ipath_f_early_init = ipath_ht_early_init; dd->ipath_f_handle_hwerrors = ipath_ht_handle_hwerrors; dd->ipath_f_quiet_serdes = ipath_ht_quiet_serdes; diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c index dc83250d26a..414cdd1d80a 100644 --- a/drivers/infiniband/hw/ipath/ipath_init_chip.c +++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -35,7 +36,7 @@ #include <linux/vmalloc.h> #include "ipath_kernel.h" -#include "ips_common.h" +#include "ipath_common.h" /* * min buffers we want to have per port, after driver @@ -114,6 +115,7 @@ static int create_port0_egr(struct ipath_devdata *dd) "eager TID %u\n", e); while (e != 0) dev_kfree_skb(skbs[--e]); + vfree(skbs); ret = -ENOMEM; goto bail; } @@ -275,7 +277,7 @@ static int init_chip_first(struct ipath_devdata *dd, pd->port_port = 0; pd->port_cnt = 1; /* The port 0 pkey table is used by the layer interface. */ - pd->port_pkeys[0] = IPS_DEFAULT_P_KEY; + pd->port_pkeys[0] = IPATH_DEFAULT_P_KEY; dd->ipath_rcvtidcnt = ipath_read_kreg32(dd, dd->ipath_kregs->kr_rcvtidcnt); dd->ipath_rcvtidbase = @@ -409,17 +411,8 @@ static int init_pioavailregs(struct ipath_devdata *dd) /* and its length */ dd->ipath_freezelen = L1_CACHE_BYTES - sizeof(dd->ipath_statusp[0]); - if (dd->ipath_unit * 64 > (IPATH_PORT0_RCVHDRTAIL_SIZE - 64)) { - ipath_dev_err(dd, "unit %u too large for port 0 " - "rcvhdrtail buffer size\n", dd->ipath_unit); - ret = -ENODEV; - } - else - ret = 0; + ret = 0; - /* so we can get current tail in ipath_kreceive(), per chip */ - dd->ipath_hdrqtailptr = &ipath_port0_rcvhdrtail[ - dd->ipath_unit * (64 / sizeof(*ipath_port0_rcvhdrtail))]; done: return ret; } @@ -652,8 +645,9 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) { int ret = 0, i; u32 val32, kpiobufs; - u64 val, atmp; + u64 val; struct ipath_portdata *pd = NULL; /* keep gcc4 happy */ + gfp_t gfp_flags = GFP_USER | __GFP_COMP; ret = init_housekeeping(dd, &pd, reinit); if (ret) @@ -775,24 +769,6 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) goto done; } - val = ipath_port0_rcvhdrtail_dma + dd->ipath_unit * 64; - - /* verify that the alignment requirement was met */ - ipath_write_kreg_port(dd, dd->ipath_kregs->kr_rcvhdrtailaddr, - 0, val); - atmp = ipath_read_kreg64_port( - dd, dd->ipath_kregs->kr_rcvhdrtailaddr, 0); - if (val != atmp) { - ipath_dev_err(dd, "Catastrophic software error, " - "RcvHdrTailAddr0 written as %llx, " - "read back as %llx from %x\n", - (unsigned long long) val, - (unsigned long long) atmp, - dd->ipath_kregs->kr_rcvhdrtailaddr); - ret = -EINVAL; - goto done; - } - ipath_write_kreg(dd, dd->ipath_kregs->kr_rcvbthqp, IPATH_KD_QP); /* @@ -836,25 +812,45 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) /* clear any interrups up to this point (ints still not enabled) */ ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, -1LL); - ipath_stats.sps_lid[dd->ipath_unit] = dd->ipath_lid; - /* * Set up the port 0 (kernel) rcvhdr q and egr TIDs. If doing * re-init, the simplest way to handle this is to free * existing, and re-allocate. */ - if (reinit) - ipath_free_pddata(dd, 0, 0); + if (reinit) { + struct ipath_portdata *pd = dd->ipath_pd[0]; + dd->ipath_pd[0] = NULL; + ipath_free_pddata(dd, pd); + } dd->ipath_f_tidtemplate(dd); ret = ipath_create_rcvhdrq(dd, pd); - if (!ret) + if (!ret) { + dd->ipath_hdrqtailptr = + (volatile __le64 *)pd->port_rcvhdrtail_kvaddr; ret = create_port0_egr(dd); + } if (ret) ipath_dev_err(dd, "failed to allocate port 0 (kernel) " "rcvhdrq and/or egr bufs\n"); else enable_chip(dd, pd, reinit); + + if (!ret && !reinit) { + /* used when we close a port, for DMA already in flight at close */ + dd->ipath_dummy_hdrq = dma_alloc_coherent( + &dd->pcidev->dev, pd->port_rcvhdrq_size, + &dd->ipath_dummy_hdrq_phys, + gfp_flags); + if (!dd->ipath_dummy_hdrq ) { + dev_info(&dd->pcidev->dev, + "Couldn't allocate 0x%lx bytes for dummy hdrq\n", + pd->port_rcvhdrq_size); + /* fallback to just 0'ing */ + dd->ipath_dummy_hdrq_phys = 0UL; + } + } + /* * cause retrigger of pending interrupts ignored during init, * even if we had errors diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c index 3e72a1fe3d7..280e732660a 100644 --- a/drivers/infiniband/hw/ipath/ipath_intr.c +++ b/drivers/infiniband/hw/ipath/ipath_intr.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -33,9 +34,10 @@ #include <linux/pci.h> #include "ipath_kernel.h" -#include "ips_common.h" #include "ipath_layer.h" +#include "ipath_common.h" +/* These are all rcv-related errors which we want to count for stats */ #define E_SUM_PKTERRS \ (INFINIPATH_E_RHDRLEN | INFINIPATH_E_RBADTID | \ INFINIPATH_E_RBADVERSION | INFINIPATH_E_RHDR | \ @@ -44,6 +46,7 @@ INFINIPATH_E_RFORMATERR | INFINIPATH_E_RUNSUPVL | \ INFINIPATH_E_RUNEXPCHAR | INFINIPATH_E_REBP) +/* These are all send-related errors which we want to count for stats */ #define E_SUM_ERRS \ (INFINIPATH_E_SPIOARMLAUNCH | INFINIPATH_E_SUNEXPERRPKTNUM | \ INFINIPATH_E_SDROPPEDDATAPKT | INFINIPATH_E_SDROPPEDSMPPKT | \ @@ -51,6 +54,18 @@ INFINIPATH_E_SMINPKTLEN | INFINIPATH_E_SPKTLEN | \ INFINIPATH_E_INVALIDADDR) +/* + * these are errors that can occur when the link changes state while + * a packet is being sent or received. This doesn't cover things + * like EBP or VCRC that can be the result of a sending having the + * link change state, so we receive a "known bad" packet. + */ +#define E_SUM_LINK_PKTERRS \ + (INFINIPATH_E_SDROPPEDDATAPKT | INFINIPATH_E_SDROPPEDSMPPKT | \ + INFINIPATH_E_SMINPKTLEN | INFINIPATH_E_SPKTLEN | \ + INFINIPATH_E_RSHORTPKTLEN | INFINIPATH_E_RMINPKTLEN | \ + INFINIPATH_E_RUNEXPCHAR) + static u64 handle_e_sum_errs(struct ipath_devdata *dd, ipath_err_t errs) { unsigned long sbuf[4]; @@ -100,9 +115,7 @@ static u64 handle_e_sum_errs(struct ipath_devdata *dd, ipath_err_t errs) if (ipath_debug & __IPATH_PKTDBG) printk("\n"); } - if ((errs & (INFINIPATH_E_SDROPPEDDATAPKT | - INFINIPATH_E_SDROPPEDSMPPKT | - INFINIPATH_E_SMINPKTLEN)) && + if ((errs & E_SUM_LINK_PKTERRS) && !(dd->ipath_flags & IPATH_LINKACTIVE)) { /* * This can happen when SMA is trying to bring the link @@ -111,11 +124,9 @@ static u64 handle_e_sum_errs(struct ipath_devdata *dd, ipath_err_t errs) * valid. We don't want to confuse people, so we just * don't print them, except at debug */ - ipath_dbg("Ignoring pktsend errors %llx, because not " - "yet active\n", (unsigned long long) errs); - ignore_this_time = INFINIPATH_E_SDROPPEDDATAPKT | - INFINIPATH_E_SDROPPEDSMPPKT | - INFINIPATH_E_SMINPKTLEN; + ipath_dbg("Ignoring packet errors %llx, because link not " + "ACTIVE\n", (unsigned long long) errs); + ignore_this_time = errs & E_SUM_LINK_PKTERRS; } return ignore_this_time; @@ -156,7 +167,29 @@ static void handle_e_ibstatuschanged(struct ipath_devdata *dd, */ val = ipath_read_kreg64(dd, dd->ipath_kregs->kr_ibcstatus); lstate = val & IPATH_IBSTATE_MASK; - if (lstate == IPATH_IBSTATE_INIT || lstate == IPATH_IBSTATE_ARM || + + /* + * this is confusing enough when it happens that I want to always put it + * on the console and in the logs. If it was a requested state change, + * we'll have already cleared the flags, so we won't print this warning + */ + if ((lstate != IPATH_IBSTATE_ARM && lstate != IPATH_IBSTATE_ACTIVE) + && (dd->ipath_flags & (IPATH_LINKARMED | IPATH_LINKACTIVE))) { + dev_info(&dd->pcidev->dev, "Link state changed from %s to %s\n", + (dd->ipath_flags & IPATH_LINKARMED) ? "ARM" : "ACTIVE", + ib_linkstate(lstate)); + /* + * Flush all queued sends when link went to DOWN or INIT, + * to be sure that they don't block SMA and other MAD packets + */ + ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, + INFINIPATH_S_ABORT); + ipath_disarm_piobufs(dd, dd->ipath_lastport_piobuf, + (unsigned)(dd->ipath_piobcnt2k + + dd->ipath_piobcnt4k) - + dd->ipath_lastport_piobuf); + } + else if (lstate == IPATH_IBSTATE_INIT || lstate == IPATH_IBSTATE_ARM || lstate == IPATH_IBSTATE_ACTIVE) { /* * only print at SMA if there is a change, debug if not @@ -229,6 +262,7 @@ static void handle_e_ibstatuschanged(struct ipath_devdata *dd, | IPATH_LINKACTIVE | IPATH_LINKARMED); *dd->ipath_statusp &= ~IPATH_STATUS_IB_READY; + dd->ipath_lli_counter = 0; if (!noprint) { if (((dd->ipath_lastibcstat >> INFINIPATH_IBCS_LINKSTATE_SHIFT) & @@ -350,7 +384,7 @@ static unsigned handle_frequent_errors(struct ipath_devdata *dd, return supp_msgs; } -static void handle_errors(struct ipath_devdata *dd, ipath_err_t errs) +static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs) { char msg[512]; u64 ignore_this_time = 0; @@ -379,6 +413,19 @@ static void handle_errors(struct ipath_devdata *dd, ipath_err_t errs) if (errs & E_SUM_ERRS) ignore_this_time = handle_e_sum_errs(dd, errs); + else if ((errs & E_SUM_LINK_PKTERRS) && + !(dd->ipath_flags & IPATH_LINKACTIVE)) { + /* + * This can happen when SMA is trying to bring the link + * up, but the IB link changes state at the "wrong" time. + * The IB logic then complains that the packet isn't + * valid. We don't want to confuse people, so we just + * don't print them, except at debug + */ + ipath_dbg("Ignoring packet errors %llx, because link not " + "ACTIVE\n", (unsigned long long) errs); + ignore_this_time = errs & E_SUM_LINK_PKTERRS; + } if (supp_msgs == 250000) { /* @@ -397,7 +444,7 @@ static void handle_errors(struct ipath_devdata *dd, ipath_err_t errs) if ((dd->ipath_maskederrs & ~dd->ipath_ignorederrs) & ~(INFINIPATH_E_RRCVEGRFULL | INFINIPATH_E_RRCVHDRFULL)) ipath_dev_err(dd, "Disabling error(s) %llx because " - "occuring too frequently (%s)\n", + "occurring too frequently (%s)\n", (unsigned long long) (dd->ipath_maskederrs & ~dd->ipath_ignorederrs), msg); @@ -434,7 +481,7 @@ static void handle_errors(struct ipath_devdata *dd, ipath_err_t errs) INFINIPATH_E_IBSTATUSCHANGED); } if (!errs) - return; + return 0; if (!noprint) /* @@ -493,10 +540,10 @@ static void handle_errors(struct ipath_devdata *dd, ipath_err_t errs) continue; if (hd == (tl + 1) || (!hd && tl == dd->ipath_hdrqlast)) { - dd->ipath_lastrcvhdrqtails[i] = tl; - pd->port_hdrqfull++; if (i == 0) chkerrpkts = 1; + dd->ipath_lastrcvhdrqtails[i] = tl; + pd->port_hdrqfull++; } } } @@ -558,9 +605,7 @@ static void handle_errors(struct ipath_devdata *dd, ipath_err_t errs) wake_up_interruptible(&ipath_sma_state_wait); } - if (chkerrpkts) - /* process possible error packets in hdrq */ - ipath_kreceive(dd); + return chkerrpkts; } /* this is separate to allow for better optimization of ipath_intr() */ @@ -678,7 +723,12 @@ set: dd->ipath_sendctrl); } -static void handle_rcv(struct ipath_devdata *dd, u32 istat) +/* + * Handle receive interrupts for user ports; this means a user + * process was waiting for a packet to arrive, and didn't want + * to poll + */ +static void handle_urcv(struct ipath_devdata *dd, u32 istat) { u64 portr; int i; @@ -688,22 +738,17 @@ static void handle_rcv(struct ipath_devdata *dd, u32 istat) infinipath_i_rcvavail_mask) | ((istat >> INFINIPATH_I_RCVURG_SHIFT) & infinipath_i_rcvurg_mask); - for (i = 0; i < dd->ipath_cfgports; i++) { + for (i = 1; i < dd->ipath_cfgports; i++) { struct ipath_portdata *pd = dd->ipath_pd[i]; - if (portr & (1 << i) && pd && - pd->port_cnt) { - if (i == 0) - ipath_kreceive(dd); - else if (test_bit(IPATH_PORT_WAITING_RCV, - &pd->port_flag)) { - int rcbit; - clear_bit(IPATH_PORT_WAITING_RCV, - &pd->port_flag); - rcbit = i + INFINIPATH_R_INTRAVAIL_SHIFT; - clear_bit(1UL << rcbit, &dd->ipath_rcvctrl); - wake_up_interruptible(&pd->port_wait); - rcvdint = 1; - } + if (portr & (1 << i) && pd && pd->port_cnt && + test_bit(IPATH_PORT_WAITING_RCV, &pd->port_flag)) { + int rcbit; + clear_bit(IPATH_PORT_WAITING_RCV, + &pd->port_flag); + rcbit = i + INFINIPATH_R_INTRAVAIL_SHIFT; + clear_bit(1UL << rcbit, &dd->ipath_rcvctrl); + wake_up_interruptible(&pd->port_wait); + rcvdint = 1; } } if (rcvdint) { @@ -719,16 +764,19 @@ static void handle_rcv(struct ipath_devdata *dd, u32 istat) irqreturn_t ipath_intr(int irq, void *data, struct pt_regs *regs) { struct ipath_devdata *dd = data; - u32 istat; + u32 istat, chk0rcv = 0; ipath_err_t estat = 0; - static unsigned unexpected = 0; irqreturn_t ret; + u32 oldhead, curtail; + static unsigned unexpected = 0; + static const u32 port0rbits = (1U<<INFINIPATH_I_RCVAVAIL_SHIFT) | + (1U<<INFINIPATH_I_RCVURG_SHIFT); + + ipath_stats.sps_ints++; - if(!(dd->ipath_flags & IPATH_PRESENT)) { - /* this is mostly so we don't try to touch the chip while - * it is being reset */ + if (!(dd->ipath_flags & IPATH_PRESENT)) { /* - * This return value is perhaps odd, but we do not want the + * This return value is not great, but we do not want the * interrupt core code to remove our interrupt handler * because we don't appear to be handling an interrupt * during a chip reset. @@ -736,7 +784,51 @@ irqreturn_t ipath_intr(int irq, void *data, struct pt_regs *regs) return IRQ_HANDLED; } + /* + * this needs to be flags&initted, not statusp, so we keep + * taking interrupts even after link goes down, etc. + * Also, we *must* clear the interrupt at some point, or we won't + * take it again, which can be real bad for errors, etc... + */ + + if (!(dd->ipath_flags & IPATH_INITTED)) { + ipath_bad_intr(dd, &unexpected); + ret = IRQ_NONE; + goto bail; + } + + /* + * We try to avoid reading the interrupt status register, since + * that's a PIO read, and stalls the processor for up to about + * ~0.25 usec. The idea is that if we processed a port0 packet, + * we blindly clear the port 0 receive interrupt bits, and nothing + * else, then return. If other interrupts are pending, the chip + * will re-interrupt us as soon as we write the intclear register. + * We then won't process any more kernel packets (if not the 2nd + * time, then the 3rd or 4th) and we'll then handle the other + * interrupts. We clear the interrupts first so that we don't + * lose intr for later packets that arrive while we are processing. + */ + oldhead = dd->ipath_port0head; + curtail = (u32)le64_to_cpu(*dd->ipath_hdrqtailptr); + if (oldhead != curtail) { + if (dd->ipath_flags & IPATH_GPIO_INTR) { + ipath_write_kreg(dd, dd->ipath_kregs->kr_gpio_clear, + (u64) (1 << 2)); + istat = port0rbits | INFINIPATH_I_GPIO; + } + else + istat = port0rbits; + ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, istat); + ipath_kreceive(dd); + if (oldhead != dd->ipath_port0head) { + ipath_stats.sps_fastrcvint++; + goto done; + } + } + istat = ipath_read_kreg32(dd, dd->ipath_kregs->kr_intstatus); + if (unlikely(!istat)) { ipath_stats.sps_nullintr++; ret = IRQ_NONE; /* not our interrupt, or already handled */ @@ -749,31 +841,17 @@ irqreturn_t ipath_intr(int irq, void *data, struct pt_regs *regs) goto bail; } - ipath_stats.sps_ints++; - - /* - * this needs to be flags&initted, not statusp, so we keep - * taking interrupts even after link goes down, etc. - * Also, we *must* clear the interrupt at some point, or we won't - * take it again, which can be real bad for errors, etc... - */ - - if (!(dd->ipath_flags & IPATH_INITTED)) { - ipath_bad_intr(dd, &unexpected); - ret = IRQ_NONE; - goto bail; - } if (unexpected) unexpected = 0; - ipath_cdbg(VERBOSE, "intr stat=0x%x\n", istat); - - if (istat & ~infinipath_i_bitsextant) + if (unlikely(istat & ~infinipath_i_bitsextant)) ipath_dev_err(dd, "interrupt with unknown interrupts %x set\n", istat & (u32) ~ infinipath_i_bitsextant); + else + ipath_cdbg(VERBOSE, "intr stat=0x%x\n", istat); - if (istat & INFINIPATH_I_ERROR) { + if (unlikely(istat & INFINIPATH_I_ERROR)) { ipath_stats.sps_errints++; estat = ipath_read_kreg64(dd, dd->ipath_kregs->kr_errorstatus); @@ -788,10 +866,18 @@ irqreturn_t ipath_intr(int irq, void *data, struct pt_regs *regs) ipath_dev_err(dd, "Read of error status failed " "(all bits set); ignoring\n"); else - handle_errors(dd, estat); + if (handle_errors(dd, estat)) + /* force calling ipath_kreceive() */ + chk0rcv = 1; } if (istat & INFINIPATH_I_GPIO) { + /* + * Packets are available in the port 0 rcv queue. + * Eventually this needs to be generalized to check + * IPATH_GPIO_INTR, and the specific GPIO bit, if + * GPIO interrupts are used for anything else. + */ if (unlikely(!(dd->ipath_flags & IPATH_GPIO_INTR))) { u32 gpiostatus; gpiostatus = ipath_read_kreg32( @@ -804,27 +890,39 @@ irqreturn_t ipath_intr(int irq, void *data, struct pt_regs *regs) else { /* Clear GPIO status bit 2 */ ipath_write_kreg(dd, dd->ipath_kregs->kr_gpio_clear, - (u64) (1 << 2)); - - /* - * Packets are available in the port 0 rcv queue. - * Eventually this needs to be generalized to check - * IPATH_GPIO_INTR, and the specific GPIO bit, if - * GPIO interrupts are used for anything else. - */ - ipath_kreceive(dd); + (u64) (1 << 2)); + chk0rcv = 1; } } + chk0rcv |= istat & port0rbits; /* - * clear the ones we will deal with on this round - * We clear it early, mostly for receive interrupts, so we - * know the chip will have seen this by the time we process - * the queue, and will re-interrupt if necessary. The processor - * itself won't take the interrupt again until we return. + * Clear the interrupt bits we found set, unless they are receive + * related, in which case we already cleared them above, and don't + * want to clear them again, because we might lose an interrupt. + * Clear it early, so we "know" know the chip will have seen this by + * the time we process the queue, and will re-interrupt if necessary. + * The processor itself won't take the interrupt again until we return. */ ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, istat); + /* + * handle port0 receive before checking for pio buffers available, + * since receives can overflow; piobuf waiters can afford a few + * extra cycles, since they were waiting anyway, and user's waiting + * for receive are at the bottom. + */ + if (chk0rcv) { + ipath_kreceive(dd); + istat &= ~port0rbits; + } + + if (istat & ((infinipath_i_rcvavail_mask << + INFINIPATH_I_RCVAVAIL_SHIFT) + | (infinipath_i_rcvurg_mask << + INFINIPATH_I_RCVURG_SHIFT))) + handle_urcv(dd, istat); + if (istat & INFINIPATH_I_SPIOBUFAVAIL) { clear_bit(IPATH_S_PIOINTBUFAVAIL, &dd->ipath_sendctrl); ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl, @@ -836,17 +934,7 @@ irqreturn_t ipath_intr(int irq, void *data, struct pt_regs *regs) handle_layer_pioavail(dd); } - /* - * we check for both transition from empty to non-empty, and urgent - * packets (those with the interrupt bit set in the header) - */ - - if (istat & ((infinipath_i_rcvavail_mask << - INFINIPATH_I_RCVAVAIL_SHIFT) - | (infinipath_i_rcvurg_mask << - INFINIPATH_I_RCVURG_SHIFT))) - handle_rcv(dd, istat); - +done: ret = IRQ_HANDLED; bail: diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h index 5d92d57b6f5..e9f374fb641 100644 --- a/drivers/infiniband/hw/ipath/ipath_kernel.h +++ b/drivers/infiniband/hw/ipath/ipath_kernel.h @@ -1,6 +1,7 @@ #ifndef _IPATH_KERNEL_H #define _IPATH_KERNEL_H /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -61,9 +62,7 @@ struct ipath_portdata { /* rcvhdrq base, needs mmap before useful */ void *port_rcvhdrq; /* kernel virtual address where hdrqtail is updated */ - u64 *port_rcvhdrtail_kvaddr; - /* page * used for uaddr */ - struct page *port_rcvhdrtail_pagep; + volatile __le64 *port_rcvhdrtail_kvaddr; /* * temp buffer for expected send setup, allocated at open, instead * of each setup call @@ -78,11 +77,7 @@ struct ipath_portdata { dma_addr_t port_rcvegr_phys; /* mmap of hdrq, must fit in 44 bits */ dma_addr_t port_rcvhdrq_phys; - /* - * the actual user address that we ipath_mlock'ed, so we can - * ipath_munlock it at close - */ - unsigned long port_rcvhdrtail_uaddr; + dma_addr_t port_rcvhdrqtailaddr_phys; /* * number of opens on this instance (0 or 1; ignoring forks, dup, * etc. for now) @@ -158,16 +153,10 @@ struct ipath_devdata { /* base of memory alloced for ipath_kregbase, for free */ u64 *ipath_kregalloc; /* - * version of kregbase that doesn't have high bits set (for 32 bit - * programs, so mmap64 44 bit works) - */ - u64 __iomem *ipath_kregvirt; - /* * virtual address where port0 rcvhdrqtail updated for this unit. * only written to by the chip, not the driver. */ volatile __le64 *ipath_hdrqtailptr; - dma_addr_t ipath_dma_addr; /* ipath_cfgports pointers */ struct ipath_portdata **ipath_pd; /* sk_buffs used by port 0 eager receive queue */ @@ -354,13 +343,17 @@ struct ipath_devdata { char *ipath_freezemsg; /* pci access data structure */ struct pci_dev *pcidev; - struct cdev *cdev; - struct class_device *class_dev; + struct cdev *user_cdev; + struct cdev *diag_cdev; + struct class_device *user_class_dev; + struct class_device *diag_class_dev; /* timer used to prevent stats overflow, error throttling, etc. */ struct timer_list ipath_stats_timer; /* check for stale messages in rcv queue */ /* only allow one intr at a time. */ unsigned long ipath_rcv_pending; + void *ipath_dummy_hdrq; /* used after port close */ + dma_addr_t ipath_dummy_hdrq_phys; /* * Shadow copies of registers; size indicates read access size. @@ -500,8 +493,11 @@ struct ipath_devdata { u16 ipath_lid; /* list of pkeys programmed; 0 if not set */ u16 ipath_pkeys[4]; - /* ASCII serial number, from flash */ - u8 ipath_serial[12]; + /* + * ASCII serial number, from flash, large enough for original + * all digit strings, and longer QLogic serial number format + */ + u8 ipath_serial[16]; /* human readable board version */ u8 ipath_boardversion[80]; /* chip major rev, from ipath_revision */ @@ -516,12 +512,12 @@ struct ipath_devdata { u8 ipath_pci_cacheline; /* LID mask control */ u8 ipath_lmc; -}; - -extern volatile __le64 *ipath_port0_rcvhdrtail; -extern dma_addr_t ipath_port0_rcvhdrtail_dma; -#define IPATH_PORT0_RCVHDRTAIL_SIZE PAGE_SIZE + /* local link integrity counter */ + u32 ipath_lli_counter; + /* local link integrity errors */ + u32 ipath_lli_errors; +}; extern struct list_head ipath_dev_list; extern spinlock_t ipath_devs_lock; @@ -537,7 +533,7 @@ extern int __ipath_verbs_piobufavail(struct ipath_devdata *); extern int __ipath_verbs_rcv(struct ipath_devdata *, void *, void *, u32); void ipath_layer_add(struct ipath_devdata *); -void ipath_layer_del(struct ipath_devdata *); +void ipath_layer_remove(struct ipath_devdata *); int ipath_init_chip(struct ipath_devdata *, int); int ipath_enable_wc(struct ipath_devdata *dd); @@ -551,14 +547,14 @@ int ipath_cdev_init(int minor, char *name, struct file_operations *fops, void ipath_cdev_cleanup(struct cdev **cdevp, struct class_device **class_devp); -int ipath_diag_init(void); -void ipath_diag_cleanup(void); +int ipath_diag_add(struct ipath_devdata *); +void ipath_diag_remove(struct ipath_devdata *); void ipath_diag_bringup_link(struct ipath_devdata *); extern wait_queue_head_t ipath_sma_state_wait; int ipath_user_add(struct ipath_devdata *dd); -void ipath_user_del(struct ipath_devdata *dd); +void ipath_user_remove(struct ipath_devdata *dd); struct sk_buff *ipath_alloc_skb(struct ipath_devdata *dd, gfp_t); @@ -582,7 +578,7 @@ void ipath_disarm_piobufs(struct ipath_devdata *, unsigned first, unsigned cnt); int ipath_create_rcvhdrq(struct ipath_devdata *, struct ipath_portdata *); -void ipath_free_pddata(struct ipath_devdata *, u32, int); +void ipath_free_pddata(struct ipath_devdata *, struct ipath_portdata *); int ipath_parse_ushort(const char *str, unsigned short *valp); @@ -720,13 +716,8 @@ u64 ipath_read_kreg64_port(const struct ipath_devdata *, ipath_kreg, * @port: port number * * Return the contents of a register that is virtualized to be per port. - * Prints a debug message and returns -1 on errors (not distinguishable from - * valid contents at runtime; we may add a separate error variable at some - * point). - * - * This is normally not used by the kernel, but may be for debugging, and - * has a different implementation than user mode, which is why it's not in - * _common.h. + * Returns -1 on errors (not distinguishable from valid contents at + * runtime; we may add a separate error variable at some point). */ static inline u32 ipath_read_ureg32(const struct ipath_devdata *dd, ipath_ureg regno, int port) @@ -842,9 +833,10 @@ extern struct mutex ipath_mutex; #define IPATH_DRV_NAME "ipath_core" #define IPATH_MAJOR 233 +#define IPATH_USER_MINOR_BASE 0 #define IPATH_SMA_MINOR 128 -#define IPATH_DIAG_MINOR 129 -#define IPATH_NMINORS 130 +#define IPATH_DIAG_MINOR_BASE 129 +#define IPATH_NMINORS 255 #define ipath_dev_err(dd,fmt,...) \ do { \ diff --git a/drivers/infiniband/hw/ipath/ipath_keys.c b/drivers/infiniband/hw/ipath/ipath_keys.c index 5ae8761f9dd..46773c673a1 100644 --- a/drivers/infiniband/hw/ipath/ipath_keys.c +++ b/drivers/infiniband/hw/ipath/ipath_keys.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -120,6 +121,7 @@ int ipath_lkey_ok(struct ipath_lkey_table *rkt, struct ipath_sge *isge, struct ib_sge *sge, int acc) { struct ipath_mregion *mr; + unsigned n, m; size_t off; int ret; @@ -151,20 +153,22 @@ int ipath_lkey_ok(struct ipath_lkey_table *rkt, struct ipath_sge *isge, } off += mr->offset; - isge->mr = mr; - isge->m = 0; - isge->n = 0; - while (off >= mr->map[isge->m]->segs[isge->n].length) { - off -= mr->map[isge->m]->segs[isge->n].length; - isge->n++; - if (isge->n >= IPATH_SEGSZ) { - isge->m++; - isge->n = 0; + m = 0; + n = 0; + while (off >= mr->map[m]->segs[n].length) { + off -= mr->map[m]->segs[n].length; + n++; + if (n >= IPATH_SEGSZ) { + m++; + n = 0; } } - isge->vaddr = mr->map[isge->m]->segs[isge->n].vaddr + off; - isge->length = mr->map[isge->m]->segs[isge->n].length - off; + isge->mr = mr; + isge->vaddr = mr->map[m]->segs[n].vaddr + off; + isge->length = mr->map[m]->segs[n].length - off; isge->sge_length = sge->length; + isge->m = m; + isge->n = n; ret = 1; @@ -189,6 +193,7 @@ int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss, struct ipath_lkey_table *rkt = &dev->lk_table; struct ipath_sge *sge = &ss->sge; struct ipath_mregion *mr; + unsigned n, m; size_t off; int ret; @@ -206,20 +211,22 @@ int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss, } off += mr->offset; - sge->mr = mr; - sge->m = 0; - sge->n = 0; - while (off >= mr->map[sge->m]->segs[sge->n].length) { - off -= mr->map[sge->m]->segs[sge->n].length; - sge->n++; - if (sge->n >= IPATH_SEGSZ) { - sge->m++; - sge->n = 0; + m = 0; + n = 0; + while (off >= mr->map[m]->segs[n].length) { + off -= mr->map[m]->segs[n].length; + n++; + if (n >= IPATH_SEGSZ) { + m++; + n = 0; } } - sge->vaddr = mr->map[sge->m]->segs[sge->n].vaddr + off; - sge->length = mr->map[sge->m]->segs[sge->n].length - off; + sge->mr = mr; + sge->vaddr = mr->map[m]->segs[n].vaddr + off; + sge->length = mr->map[m]->segs[n].length - off; sge->sge_length = len; + sge->m = m; + sge->n = n; ss->sg_list = NULL; ss->num_sge = 1; diff --git a/drivers/infiniband/hw/ipath/ipath_layer.c b/drivers/infiniband/hw/ipath/ipath_layer.c index 9ec4ac77b87..b28c6f81c73 100644 --- a/drivers/infiniband/hw/ipath/ipath_layer.c +++ b/drivers/infiniband/hw/ipath/ipath_layer.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -40,8 +41,8 @@ #include <asm/byteorder.h> #include "ipath_kernel.h" -#include "ips_common.h" #include "ipath_layer.h" +#include "ipath_common.h" /* Acquire before ipath_devs_lock. */ static DEFINE_MUTEX(ipath_layer_mutex); @@ -299,9 +300,8 @@ bail: EXPORT_SYMBOL_GPL(ipath_layer_set_mtu); -int ipath_set_sps_lid(struct ipath_devdata *dd, u32 arg, u8 lmc) +int ipath_set_lid(struct ipath_devdata *dd, u32 arg, u8 lmc) { - ipath_stats.sps_lid[dd->ipath_unit] = arg; dd->ipath_lid = arg; dd->ipath_lmc = lmc; @@ -315,7 +315,7 @@ int ipath_set_sps_lid(struct ipath_devdata *dd, u32 arg, u8 lmc) return 0; } -EXPORT_SYMBOL_GPL(ipath_set_sps_lid); +EXPORT_SYMBOL_GPL(ipath_set_lid); int ipath_layer_set_guid(struct ipath_devdata *dd, __be64 guid) { @@ -340,18 +340,26 @@ u32 ipath_layer_get_nguid(struct ipath_devdata *dd) EXPORT_SYMBOL_GPL(ipath_layer_get_nguid); -int ipath_layer_query_device(struct ipath_devdata *dd, u32 * vendor, - u32 * boardrev, u32 * majrev, u32 * minrev) +u32 ipath_layer_get_majrev(struct ipath_devdata *dd) { - *vendor = dd->ipath_vendorid; - *boardrev = dd->ipath_boardrev; - *majrev = dd->ipath_majrev; - *minrev = dd->ipath_minrev; + return dd->ipath_majrev; +} - return 0; +EXPORT_SYMBOL_GPL(ipath_layer_get_majrev); + +u32 ipath_layer_get_minrev(struct ipath_devdata *dd) +{ + return dd->ipath_minrev; +} + +EXPORT_SYMBOL_GPL(ipath_layer_get_minrev); + +u32 ipath_layer_get_pcirev(struct ipath_devdata *dd) +{ + return dd->ipath_pcirev; } -EXPORT_SYMBOL_GPL(ipath_layer_query_device); +EXPORT_SYMBOL_GPL(ipath_layer_get_pcirev); u32 ipath_layer_get_flags(struct ipath_devdata *dd) { @@ -374,6 +382,13 @@ u16 ipath_layer_get_deviceid(struct ipath_devdata *dd) EXPORT_SYMBOL_GPL(ipath_layer_get_deviceid); +u32 ipath_layer_get_vendorid(struct ipath_devdata *dd) +{ + return dd->ipath_vendorid; +} + +EXPORT_SYMBOL_GPL(ipath_layer_get_vendorid); + u64 ipath_layer_get_lastibcstat(struct ipath_devdata *dd) { return dd->ipath_lastibcstat; @@ -403,7 +418,7 @@ void ipath_layer_add(struct ipath_devdata *dd) mutex_unlock(&ipath_layer_mutex); } -void ipath_layer_del(struct ipath_devdata *dd) +void ipath_layer_remove(struct ipath_devdata *dd) { mutex_lock(&ipath_layer_mutex); @@ -607,7 +622,7 @@ int ipath_layer_open(struct ipath_devdata *dd, u32 * pktmax) goto bail; } - ret = ipath_setrcvhdrsize(dd, NUM_OF_EXTRA_WORDS_IN_HEADER_QUEUE); + ret = ipath_setrcvhdrsize(dd, IPATH_HEADER_QUEUE_WORDS); if (ret < 0) goto bail; @@ -616,9 +631,9 @@ int ipath_layer_open(struct ipath_devdata *dd, u32 * pktmax) if (*dd->ipath_statusp & IPATH_STATUS_IB_READY) intval |= IPATH_LAYER_INT_IF_UP; - if (ipath_stats.sps_lid[dd->ipath_unit]) + if (dd->ipath_lid) intval |= IPATH_LAYER_INT_LID; - if (ipath_stats.sps_mlid[dd->ipath_unit]) + if (dd->ipath_mlid) intval |= IPATH_LAYER_INT_BCAST; /* * do this on open, in case low level is already up and @@ -884,7 +899,7 @@ static void copy_io(u32 __iomem *piobuf, struct ipath_sge_state *ss, /** * ipath_verbs_send - send a packet from the verbs layer * @dd: the infinipath device - * @hdrwords: the number of works in the header + * @hdrwords: the number of words in the header * @hdr: the packet header * @len: the length of the packet in bytes * @ss: the SGE to send @@ -1016,19 +1031,22 @@ int ipath_layer_get_counters(struct ipath_devdata *dd, ipath_snap_cntr(dd, dd->ipath_cregs->cr_ibsymbolerrcnt); cntrs->link_error_recovery_counter = ipath_snap_cntr(dd, dd->ipath_cregs->cr_iblinkerrrecovcnt); + /* + * The link downed counter counts when the other side downs the + * connection. We add in the number of times we downed the link + * due to local link integrity errors to compensate. + */ cntrs->link_downed_counter = ipath_snap_cntr(dd, dd->ipath_cregs->cr_iblinkdowncnt); cntrs->port_rcv_errors = ipath_snap_cntr(dd, dd->ipath_cregs->cr_rxdroppktcnt) + ipath_snap_cntr(dd, dd->ipath_cregs->cr_rcvovflcnt) + ipath_snap_cntr(dd, dd->ipath_cregs->cr_portovflcnt) + - ipath_snap_cntr(dd, dd->ipath_cregs->cr_errrcvflowctrlcnt) + ipath_snap_cntr(dd, dd->ipath_cregs->cr_err_rlencnt) + ipath_snap_cntr(dd, dd->ipath_cregs->cr_invalidrlencnt) + ipath_snap_cntr(dd, dd->ipath_cregs->cr_erricrccnt) + ipath_snap_cntr(dd, dd->ipath_cregs->cr_errvcrccnt) + ipath_snap_cntr(dd, dd->ipath_cregs->cr_errlpcrccnt) + - ipath_snap_cntr(dd, dd->ipath_cregs->cr_errlinkcnt) + ipath_snap_cntr(dd, dd->ipath_cregs->cr_badformatcnt); cntrs->port_rcv_remphys_errors = ipath_snap_cntr(dd, dd->ipath_cregs->cr_rcvebpcnt); @@ -1042,6 +1060,8 @@ int ipath_layer_get_counters(struct ipath_devdata *dd, ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktsendcnt); cntrs->port_rcv_packets = ipath_snap_cntr(dd, dd->ipath_cregs->cr_pktrcvcnt); + cntrs->local_link_integrity_errors = dd->ipath_lli_errors; + cntrs->excessive_buffer_overrun_errors = 0; /* XXX */ ret = 0; @@ -1086,10 +1106,10 @@ int ipath_layer_send_hdr(struct ipath_devdata *dd, struct ether_header *hdr) } vlsllnh = *((__be16 *) hdr); - if (vlsllnh != htons(IPS_LRH_BTH)) { + if (vlsllnh != htons(IPATH_LRH_BTH)) { ipath_dbg("Warning: lrh[0] wrong (%x, not %x); " "not sending\n", be16_to_cpu(vlsllnh), - IPS_LRH_BTH); + IPATH_LRH_BTH); ret = -EINVAL; } if (ret) diff --git a/drivers/infiniband/hw/ipath/ipath_layer.h b/drivers/infiniband/hw/ipath/ipath_layer.h index 6fefd15bd2d..71485096fca 100644 --- a/drivers/infiniband/hw/ipath/ipath_layer.h +++ b/drivers/infiniband/hw/ipath/ipath_layer.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -54,6 +55,8 @@ struct ipath_layer_counters { u64 port_rcv_data; u64 port_xmit_packets; u64 port_rcv_packets; + u32 local_link_integrity_errors; + u32 excessive_buffer_overrun_errors; }; /* @@ -126,7 +129,7 @@ u16 ipath_layer_get_bcast(struct ipath_devdata *dd); u32 ipath_layer_get_cr_errpkey(struct ipath_devdata *dd); int ipath_layer_set_linkstate(struct ipath_devdata *dd, u8 state); int ipath_layer_set_mtu(struct ipath_devdata *, u16); -int ipath_set_sps_lid(struct ipath_devdata *, u32, u8); +int ipath_set_lid(struct ipath_devdata *, u32, u8); int ipath_layer_send_hdr(struct ipath_devdata *dd, struct ether_header *hdr); int ipath_verbs_send(struct ipath_devdata *dd, u32 hdrwords, @@ -143,11 +146,13 @@ int ipath_layer_want_buffer(struct ipath_devdata *dd); int ipath_layer_set_guid(struct ipath_devdata *, __be64 guid); __be64 ipath_layer_get_guid(struct ipath_devdata *); u32 ipath_layer_get_nguid(struct ipath_devdata *); -int ipath_layer_query_device(struct ipath_devdata *, u32 * vendor, - u32 * boardrev, u32 * majrev, u32 * minrev); +u32 ipath_layer_get_majrev(struct ipath_devdata *); +u32 ipath_layer_get_minrev(struct ipath_devdata *); +u32 ipath_layer_get_pcirev(struct ipath_devdata *); u32 ipath_layer_get_flags(struct ipath_devdata *dd); struct device *ipath_layer_get_device(struct ipath_devdata *dd); u16 ipath_layer_get_deviceid(struct ipath_devdata *dd); +u32 ipath_layer_get_vendorid(struct ipath_devdata *); u64 ipath_layer_get_lastibcstat(struct ipath_devdata *dd); u32 ipath_layer_get_ibmtu(struct ipath_devdata *dd); int ipath_layer_enable_timer(struct ipath_devdata *dd); diff --git a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c index 1a9d0a2c33c..d3402341b7d 100644 --- a/drivers/infiniband/hw/ipath/ipath_mad.c +++ b/drivers/infiniband/hw/ipath/ipath_mad.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -34,7 +35,7 @@ #include "ipath_kernel.h" #include "ipath_verbs.h" -#include "ips_common.h" +#include "ipath_common.h" #define IB_SMP_UNSUP_VERSION __constant_htons(0x0004) #define IB_SMP_UNSUP_METHOD __constant_htons(0x0008) @@ -84,7 +85,7 @@ static int recv_subn_get_nodeinfo(struct ib_smp *smp, { struct nodeinfo *nip = (struct nodeinfo *)&smp->data; struct ipath_devdata *dd = to_idev(ibdev)->dd; - u32 vendor, boardid, majrev, minrev; + u32 vendor, majrev, minrev; if (smp->attr_mod) smp->status |= IB_SMP_INVALID_FIELD; @@ -104,9 +105,11 @@ static int recv_subn_get_nodeinfo(struct ib_smp *smp, nip->port_guid = nip->sys_guid; nip->partition_cap = cpu_to_be16(ipath_layer_get_npkeys(dd)); nip->device_id = cpu_to_be16(ipath_layer_get_deviceid(dd)); - ipath_layer_query_device(dd, &vendor, &boardid, &majrev, &minrev); + majrev = ipath_layer_get_majrev(dd); + minrev = ipath_layer_get_minrev(dd); nip->revision = cpu_to_be32((majrev << 16) | minrev); nip->local_port_num = port; + vendor = ipath_layer_get_vendorid(dd); nip->vendor_id[0] = 0; nip->vendor_id[1] = vendor >> 8; nip->vendor_id[2] = vendor; @@ -215,7 +218,7 @@ static int recv_subn_get_portinfo(struct ib_smp *smp, /* P_KeyViolations are counted by hardware. */ pip->pkey_violations = cpu_to_be16((ipath_layer_get_cr_errpkey(dev->dd) - - dev->n_pkey_violations) & 0xFFFF); + dev->z_pkey_violations) & 0xFFFF); pip->qkey_violations = cpu_to_be16(dev->qkey_violations); /* Only the hardware GUID is supported for now */ pip->guid_cap = 1; @@ -303,9 +306,9 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, lid = be16_to_cpu(pip->lid); if (lid != ipath_layer_get_lid(dev->dd)) { /* Must be a valid unicast LID address. */ - if (lid == 0 || lid >= IPS_MULTICAST_LID_BASE) + if (lid == 0 || lid >= IPATH_MULTICAST_LID_BASE) goto err; - ipath_set_sps_lid(dev->dd, lid, pip->mkeyprot_resv_lmc & 7); + ipath_set_lid(dev->dd, lid, pip->mkeyprot_resv_lmc & 7); event.event = IB_EVENT_LID_CHANGE; ib_dispatch_event(&event); } @@ -313,7 +316,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, smlid = be16_to_cpu(pip->sm_lid); if (smlid != dev->sm_lid) { /* Must be a valid unicast LID address. */ - if (smlid == 0 || smlid >= IPS_MULTICAST_LID_BASE) + if (smlid == 0 || smlid >= IPATH_MULTICAST_LID_BASE) goto err; dev->sm_lid = smlid; event.event = IB_EVENT_SM_CHANGE; @@ -389,7 +392,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, * later. */ if (pip->pkey_violations == 0) - dev->n_pkey_violations = + dev->z_pkey_violations = ipath_layer_get_cr_errpkey(dev->dd); if (pip->qkey_violations == 0) @@ -610,6 +613,9 @@ struct ib_pma_portcounters { #define IB_PMA_SEL_PORT_RCV_ERRORS __constant_htons(0x0008) #define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS __constant_htons(0x0010) #define IB_PMA_SEL_PORT_XMIT_DISCARDS __constant_htons(0x0040) +#define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS __constant_htons(0x0200) +#define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS __constant_htons(0x0400) +#define IB_PMA_SEL_PORT_VL15_DROPPED __constant_htons(0x0800) #define IB_PMA_SEL_PORT_XMIT_DATA __constant_htons(0x1000) #define IB_PMA_SEL_PORT_RCV_DATA __constant_htons(0x2000) #define IB_PMA_SEL_PORT_XMIT_PACKETS __constant_htons(0x4000) @@ -844,18 +850,22 @@ static int recv_pma_get_portcounters(struct ib_perf *pmp, ipath_layer_get_counters(dev->dd, &cntrs); /* Adjust counters for any resets done. */ - cntrs.symbol_error_counter -= dev->n_symbol_error_counter; + cntrs.symbol_error_counter -= dev->z_symbol_error_counter; cntrs.link_error_recovery_counter -= - dev->n_link_error_recovery_counter; - cntrs.link_downed_counter -= dev->n_link_downed_counter; + dev->z_link_error_recovery_counter; + cntrs.link_downed_counter -= dev->z_link_downed_counter; cntrs.port_rcv_errors += dev->rcv_errors; - cntrs.port_rcv_errors -= dev->n_port_rcv_errors; - cntrs.port_rcv_remphys_errors -= dev->n_port_rcv_remphys_errors; - cntrs.port_xmit_discards -= dev->n_port_xmit_discards; - cntrs.port_xmit_data -= dev->n_port_xmit_data; - cntrs.port_rcv_data -= dev->n_port_rcv_data; - cntrs.port_xmit_packets -= dev->n_port_xmit_packets; - cntrs.port_rcv_packets -= dev->n_port_rcv_packets; + cntrs.port_rcv_errors -= dev->z_port_rcv_errors; + cntrs.port_rcv_remphys_errors -= dev->z_port_rcv_remphys_errors; + cntrs.port_xmit_discards -= dev->z_port_xmit_discards; + cntrs.port_xmit_data -= dev->z_port_xmit_data; + cntrs.port_rcv_data -= dev->z_port_rcv_data; + cntrs.port_xmit_packets -= dev->z_port_xmit_packets; + cntrs.port_rcv_packets -= dev->z_port_rcv_packets; + cntrs.local_link_integrity_errors -= + dev->z_local_link_integrity_errors; + cntrs.excessive_buffer_overrun_errors -= + dev->z_excessive_buffer_overrun_errors; memset(pmp->data, 0, sizeof(pmp->data)); @@ -893,6 +903,16 @@ static int recv_pma_get_portcounters(struct ib_perf *pmp, else p->port_xmit_discards = cpu_to_be16((u16)cntrs.port_xmit_discards); + if (cntrs.local_link_integrity_errors > 0xFUL) + cntrs.local_link_integrity_errors = 0xFUL; + if (cntrs.excessive_buffer_overrun_errors > 0xFUL) + cntrs.excessive_buffer_overrun_errors = 0xFUL; + p->lli_ebor_errors = (cntrs.local_link_integrity_errors << 4) | + cntrs.excessive_buffer_overrun_errors; + if (dev->n_vl15_dropped > 0xFFFFUL) + p->vl15_dropped = __constant_cpu_to_be16(0xFFFF); + else + p->vl15_dropped = cpu_to_be16((u16)dev->n_vl15_dropped); if (cntrs.port_xmit_data > 0xFFFFFFFFUL) p->port_xmit_data = __constant_cpu_to_be32(0xFFFFFFFF); else @@ -928,10 +948,10 @@ static int recv_pma_get_portcounters_ext(struct ib_perf *pmp, &rpkts, &xwait); /* Adjust counters for any resets done. */ - swords -= dev->n_port_xmit_data; - rwords -= dev->n_port_rcv_data; - spkts -= dev->n_port_xmit_packets; - rpkts -= dev->n_port_rcv_packets; + swords -= dev->z_port_xmit_data; + rwords -= dev->z_port_rcv_data; + spkts -= dev->z_port_xmit_packets; + rpkts -= dev->z_port_rcv_packets; memset(pmp->data, 0, sizeof(pmp->data)); @@ -967,37 +987,48 @@ static int recv_pma_set_portcounters(struct ib_perf *pmp, ipath_layer_get_counters(dev->dd, &cntrs); if (p->counter_select & IB_PMA_SEL_SYMBOL_ERROR) - dev->n_symbol_error_counter = cntrs.symbol_error_counter; + dev->z_symbol_error_counter = cntrs.symbol_error_counter; if (p->counter_select & IB_PMA_SEL_LINK_ERROR_RECOVERY) - dev->n_link_error_recovery_counter = + dev->z_link_error_recovery_counter = cntrs.link_error_recovery_counter; if (p->counter_select & IB_PMA_SEL_LINK_DOWNED) - dev->n_link_downed_counter = cntrs.link_downed_counter; + dev->z_link_downed_counter = cntrs.link_downed_counter; if (p->counter_select & IB_PMA_SEL_PORT_RCV_ERRORS) - dev->n_port_rcv_errors = + dev->z_port_rcv_errors = cntrs.port_rcv_errors + dev->rcv_errors; if (p->counter_select & IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS) - dev->n_port_rcv_remphys_errors = + dev->z_port_rcv_remphys_errors = cntrs.port_rcv_remphys_errors; if (p->counter_select & IB_PMA_SEL_PORT_XMIT_DISCARDS) - dev->n_port_xmit_discards = cntrs.port_xmit_discards; + dev->z_port_xmit_discards = cntrs.port_xmit_discards; + + if (p->counter_select & IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS) + dev->z_local_link_integrity_errors = + cntrs.local_link_integrity_errors; + + if (p->counter_select & IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS) + dev->z_excessive_buffer_overrun_errors = + cntrs.excessive_buffer_overrun_errors; + + if (p->counter_select & IB_PMA_SEL_PORT_VL15_DROPPED) + dev->n_vl15_dropped = 0; if (p->counter_select & IB_PMA_SEL_PORT_XMIT_DATA) - dev->n_port_xmit_data = cntrs.port_xmit_data; + dev->z_port_xmit_data = cntrs.port_xmit_data; if (p->counter_select & IB_PMA_SEL_PORT_RCV_DATA) - dev->n_port_rcv_data = cntrs.port_rcv_data; + dev->z_port_rcv_data = cntrs.port_rcv_data; if (p->counter_select & IB_PMA_SEL_PORT_XMIT_PACKETS) - dev->n_port_xmit_packets = cntrs.port_xmit_packets; + dev->z_port_xmit_packets = cntrs.port_xmit_packets; if (p->counter_select & IB_PMA_SEL_PORT_RCV_PACKETS) - dev->n_port_rcv_packets = cntrs.port_rcv_packets; + dev->z_port_rcv_packets = cntrs.port_rcv_packets; return recv_pma_get_portcounters(pmp, ibdev, port); } @@ -1014,16 +1045,16 @@ static int recv_pma_set_portcounters_ext(struct ib_perf *pmp, &rpkts, &xwait); if (p->counter_select & IB_PMA_SELX_PORT_XMIT_DATA) - dev->n_port_xmit_data = swords; + dev->z_port_xmit_data = swords; if (p->counter_select & IB_PMA_SELX_PORT_RCV_DATA) - dev->n_port_rcv_data = rwords; + dev->z_port_rcv_data = rwords; if (p->counter_select & IB_PMA_SELX_PORT_XMIT_PACKETS) - dev->n_port_xmit_packets = spkts; + dev->z_port_xmit_packets = spkts; if (p->counter_select & IB_PMA_SELX_PORT_RCV_PACKETS) - dev->n_port_rcv_packets = rpkts; + dev->z_port_rcv_packets = rpkts; if (p->counter_select & IB_PMA_SELX_PORT_UNI_XMIT_PACKETS) dev->n_unicast_xmit = 0; @@ -1272,32 +1303,8 @@ int ipath_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, struct ib_wc *in_wc, struct ib_grh *in_grh, struct ib_mad *in_mad, struct ib_mad *out_mad) { - struct ipath_ibdev *dev = to_idev(ibdev); int ret; - /* - * Snapshot current HW counters to "clear" them. - * This should be done when the driver is loaded except that for - * some reason we get a zillion errors when brining up the link. - */ - if (dev->rcv_errors == 0) { - struct ipath_layer_counters cntrs; - - ipath_layer_get_counters(to_idev(ibdev)->dd, &cntrs); - dev->rcv_errors++; - dev->n_symbol_error_counter = cntrs.symbol_error_counter; - dev->n_link_error_recovery_counter = - cntrs.link_error_recovery_counter; - dev->n_link_downed_counter = cntrs.link_downed_counter; - dev->n_port_rcv_errors = cntrs.port_rcv_errors + 1; - dev->n_port_rcv_remphys_errors = - cntrs.port_rcv_remphys_errors; - dev->n_port_xmit_discards = cntrs.port_xmit_discards; - dev->n_port_xmit_data = cntrs.port_xmit_data; - dev->n_port_rcv_data = cntrs.port_rcv_data; - dev->n_port_xmit_packets = cntrs.port_xmit_packets; - dev->n_port_rcv_packets = cntrs.port_rcv_packets; - } switch (in_mad->mad_hdr.mgmt_class) { case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE: case IB_MGMT_CLASS_SUBN_LID_ROUTED: diff --git a/drivers/infiniband/hw/ipath/ipath_mr.c b/drivers/infiniband/hw/ipath/ipath_mr.c index 69ffec66d45..4ac31a5da33 100644 --- a/drivers/infiniband/hw/ipath/ipath_mr.c +++ b/drivers/infiniband/hw/ipath/ipath_mr.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -169,6 +170,11 @@ struct ib_mr *ipath_reg_user_mr(struct ib_pd *pd, struct ib_umem *region, int n, m, i; struct ib_mr *ret; + if (region->length == 0) { + ret = ERR_PTR(-EINVAL); + goto bail; + } + n = 0; list_for_each_entry(chunk, ®ion->chunk_list, list) n += chunk->nents; diff --git a/drivers/infiniband/hw/ipath/ipath_pe800.c b/drivers/infiniband/hw/ipath/ipath_pe800.c index 02e8c75b24f..b83f66d8262 100644 --- a/drivers/infiniband/hw/ipath/ipath_pe800.c +++ b/drivers/infiniband/hw/ipath/ipath_pe800.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -44,7 +45,7 @@ /* * This file contains all the chip-specific register information and - * access functions for the PathScale PE800, the PCI-Express chip. + * access functions for the QLogic InfiniPath PE800, the PCI-Express chip. * * This lists the InfiniPath PE800 registers, in the actual chip layout. * This structure should never be directly accessed. @@ -532,7 +533,7 @@ static int ipath_pe_boardname(struct ipath_devdata *dd, char *name, if (n) snprintf(name, namelen, "%s", n); - if (dd->ipath_majrev != 4 || dd->ipath_minrev != 1) { + if (dd->ipath_majrev != 4 || !dd->ipath_minrev || dd->ipath_minrev>2) { ipath_dev_err(dd, "Unsupported PE-800 revision %u.%u!\n", dd->ipath_majrev, dd->ipath_minrev); ret = 1; diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c index 9f8855d970c..83e557be591 100644 --- a/drivers/infiniband/hw/ipath/ipath_qp.c +++ b/drivers/infiniband/hw/ipath/ipath_qp.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -34,7 +35,7 @@ #include <linux/vmalloc.h> #include "ipath_verbs.h" -#include "ips_common.h" +#include "ipath_common.h" #define BITS_PER_PAGE (PAGE_SIZE*BITS_PER_BYTE) #define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1) @@ -332,10 +333,11 @@ static void ipath_reset_qp(struct ipath_qp *qp) qp->remote_qpn = 0; qp->qkey = 0; qp->qp_access_flags = 0; + clear_bit(IPATH_S_BUSY, &qp->s_flags); qp->s_hdrwords = 0; qp->s_psn = 0; qp->r_psn = 0; - atomic_set(&qp->msn, 0); + qp->r_msn = 0; if (qp->ibqp.qp_type == IB_QPT_RC) { qp->s_state = IB_OPCODE_RC_SEND_LAST; qp->r_state = IB_OPCODE_RC_SEND_LAST; @@ -344,7 +346,8 @@ static void ipath_reset_qp(struct ipath_qp *qp) qp->r_state = IB_OPCODE_UC_SEND_LAST; } qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE; - qp->s_nak_state = 0; + qp->r_ack_state = IB_OPCODE_RC_ACKNOWLEDGE; + qp->r_nak_state = 0; qp->s_rnr_timeout = 0; qp->s_head = 0; qp->s_tail = 0; @@ -362,10 +365,10 @@ static void ipath_reset_qp(struct ipath_qp *qp) * @qp: the QP to put into an error state * * Flushes both send and receive work queues. - * QP r_rq.lock and s_lock should be held. + * QP s_lock should be held and interrupts disabled. */ -static void ipath_error_qp(struct ipath_qp *qp) +void ipath_error_qp(struct ipath_qp *qp) { struct ipath_ibdev *dev = to_idev(qp->ibqp.device); struct ib_wc wc; @@ -408,12 +411,14 @@ static void ipath_error_qp(struct ipath_qp *qp) qp->s_ack_state = IB_OPCODE_RC_ACKNOWLEDGE; wc.opcode = IB_WC_RECV; + spin_lock(&qp->r_rq.lock); while (qp->r_rq.tail != qp->r_rq.head) { wc.wr_id = get_rwqe_ptr(&qp->r_rq, qp->r_rq.tail)->wr_id; if (++qp->r_rq.tail >= qp->r_rq.size) qp->r_rq.tail = 0; ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1); } + spin_unlock(&qp->r_rq.lock); } /** @@ -433,8 +438,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, unsigned long flags; int ret; - spin_lock_irqsave(&qp->r_rq.lock, flags); - spin_lock(&qp->s_lock); + spin_lock_irqsave(&qp->s_lock, flags); cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state; @@ -446,7 +450,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, if (attr_mask & IB_QP_AV) if (attr->ah_attr.dlid == 0 || - attr->ah_attr.dlid >= IPS_MULTICAST_LID_BASE) + attr->ah_attr.dlid >= IPATH_MULTICAST_LID_BASE) goto inval; if (attr_mask & IB_QP_PKEY_INDEX) @@ -505,34 +509,19 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, } if (attr_mask & IB_QP_MIN_RNR_TIMER) - qp->s_min_rnr_timer = attr->min_rnr_timer; + qp->r_min_rnr_timer = attr->min_rnr_timer; if (attr_mask & IB_QP_QKEY) qp->qkey = attr->qkey; - if (attr_mask & IB_QP_PKEY_INDEX) - qp->s_pkey_index = attr->pkey_index; - qp->state = new_state; - spin_unlock(&qp->s_lock); - spin_unlock_irqrestore(&qp->r_rq.lock, flags); - - /* - * If QP1 changed to the RTS state, try to move to the link to INIT - * even if it was ACTIVE so the SM will reinitialize the SMA's - * state. - */ - if (qp->ibqp.qp_num == 1 && new_state == IB_QPS_RTS) { - struct ipath_ibdev *dev = to_idev(ibqp->device); + spin_unlock_irqrestore(&qp->s_lock, flags); - ipath_layer_set_linkstate(dev->dd, IPATH_IB_LINKDOWN); - } ret = 0; goto bail; inval: - spin_unlock(&qp->s_lock); - spin_unlock_irqrestore(&qp->r_rq.lock, flags); + spin_unlock_irqrestore(&qp->s_lock, flags); ret = -EINVAL; bail: @@ -566,7 +555,7 @@ int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, attr->sq_draining = 0; attr->max_rd_atomic = 1; attr->max_dest_rd_atomic = 1; - attr->min_rnr_timer = qp->s_min_rnr_timer; + attr->min_rnr_timer = qp->r_min_rnr_timer; attr->port_num = 1; attr->timeout = 0; attr->retry_cnt = qp->s_retry_cnt; @@ -593,21 +582,17 @@ int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, * @qp: the queue pair to compute the AETH for * * Returns the AETH. - * - * The QP s_lock should be held. */ __be32 ipath_compute_aeth(struct ipath_qp *qp) { - u32 aeth = atomic_read(&qp->msn) & IPS_MSN_MASK; + u32 aeth = qp->r_msn & IPATH_MSN_MASK; - if (qp->s_nak_state) { - aeth |= qp->s_nak_state << IPS_AETH_CREDIT_SHIFT; - } else if (qp->ibqp.srq) { + if (qp->ibqp.srq) { /* * Shared receive queues don't generate credits. * Set the credit field to the invalid value. */ - aeth |= IPS_AETH_CREDIT_INVAL << IPS_AETH_CREDIT_SHIFT; + aeth |= IPATH_AETH_CREDIT_INVAL << IPATH_AETH_CREDIT_SHIFT; } else { u32 min, max, x; u32 credits; @@ -637,7 +622,7 @@ __be32 ipath_compute_aeth(struct ipath_qp *qp) else min = x; } - aeth |= x << IPS_AETH_CREDIT_SHIFT; + aeth |= x << IPATH_AETH_CREDIT_SHIFT; } return cpu_to_be32(aeth); } @@ -663,12 +648,22 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, size_t sz; struct ib_qp *ret; - if (init_attr->cap.max_send_sge > 255 || - init_attr->cap.max_recv_sge > 255) { + if (init_attr->cap.max_send_sge > ib_ipath_max_sges || + init_attr->cap.max_recv_sge > ib_ipath_max_sges || + init_attr->cap.max_send_wr > ib_ipath_max_qp_wrs || + init_attr->cap.max_recv_wr > ib_ipath_max_qp_wrs) { ret = ERR_PTR(-ENOMEM); goto bail; } + if (init_attr->cap.max_send_sge + + init_attr->cap.max_recv_sge + + init_attr->cap.max_send_wr + + init_attr->cap.max_recv_wr == 0) { + ret = ERR_PTR(-EINVAL); + goto bail; + } + switch (init_attr->qp_type) { case IB_QPT_UC: case IB_QPT_RC: @@ -686,18 +681,26 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, case IB_QPT_GSI: qp = kmalloc(sizeof(*qp), GFP_KERNEL); if (!qp) { + vfree(swq); ret = ERR_PTR(-ENOMEM); goto bail; } - qp->r_rq.size = init_attr->cap.max_recv_wr + 1; - sz = sizeof(struct ipath_sge) * - init_attr->cap.max_recv_sge + - sizeof(struct ipath_rwqe); - qp->r_rq.wq = vmalloc(qp->r_rq.size * sz); - if (!qp->r_rq.wq) { - kfree(qp); - ret = ERR_PTR(-ENOMEM); - goto bail; + if (init_attr->srq) { + qp->r_rq.size = 0; + qp->r_rq.max_sge = 0; + qp->r_rq.wq = NULL; + } else { + qp->r_rq.size = init_attr->cap.max_recv_wr + 1; + qp->r_rq.max_sge = init_attr->cap.max_recv_sge; + sz = (sizeof(struct ipath_sge) * qp->r_rq.max_sge) + + sizeof(struct ipath_rwqe); + qp->r_rq.wq = vmalloc(qp->r_rq.size * sz); + if (!qp->r_rq.wq) { + kfree(qp); + vfree(swq); + ret = ERR_PTR(-ENOMEM); + goto bail; + } } /* @@ -708,9 +711,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, spin_lock_init(&qp->r_rq.lock); atomic_set(&qp->refcount, 0); init_waitqueue_head(&qp->wait); - tasklet_init(&qp->s_task, - init_attr->qp_type == IB_QPT_RC ? - ipath_do_rc_send : ipath_do_uc_send, + tasklet_init(&qp->s_task, ipath_do_ruc_send, (unsigned long)qp); INIT_LIST_HEAD(&qp->piowait); INIT_LIST_HEAD(&qp->timerwait); @@ -718,7 +719,6 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, qp->s_wq = swq; qp->s_size = init_attr->cap.max_send_wr + 1; qp->s_max_sge = init_attr->cap.max_send_sge; - qp->r_rq.max_sge = init_attr->cap.max_recv_sge; qp->s_flags = init_attr->sq_sig_type == IB_SIGNAL_REQ_WR ? 1 << IPATH_S_SIGNAL_REQ_WR : 0; dev = to_idev(ibpd->device); @@ -888,18 +888,18 @@ void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc) */ void ipath_get_credit(struct ipath_qp *qp, u32 aeth) { - u32 credit = (aeth >> IPS_AETH_CREDIT_SHIFT) & IPS_AETH_CREDIT_MASK; + u32 credit = (aeth >> IPATH_AETH_CREDIT_SHIFT) & IPATH_AETH_CREDIT_MASK; /* * If the credit is invalid, we can send * as many packets as we like. Otherwise, we have to * honor the credit field. */ - if (credit == IPS_AETH_CREDIT_INVAL) { + if (credit == IPATH_AETH_CREDIT_INVAL) qp->s_lsn = (u32) -1; - } else if (qp->s_lsn != (u32) -1) { + else if (qp->s_lsn != (u32) -1) { /* Compute new LSN (i.e., MSN + credit) */ - credit = (aeth + credit_table[credit]) & IPS_MSN_MASK; + credit = (aeth + credit_table[credit]) & IPATH_MSN_MASK; if (ipath_cmp24(credit, qp->s_lsn) > 0) qp->s_lsn = credit; } diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c index 493b1821a93..774d1615ce2 100644 --- a/drivers/infiniband/hw/ipath/ipath_rc.c +++ b/drivers/infiniband/hw/ipath/ipath_rc.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -31,7 +32,7 @@ */ #include "ipath_verbs.h" -#include "ips_common.h" +#include "ipath_common.h" /* cut down ridiculously long IB macro names */ #define OP(x) IB_OPCODE_RC_##x @@ -41,14 +42,14 @@ * @qp: the QP who's SGE we're restarting * @wqe: the work queue to initialize the QP's SGE from * - * The QP s_lock should be held. + * The QP s_lock should be held and interrupts disabled. */ static void ipath_init_restart(struct ipath_qp *qp, struct ipath_swqe *wqe) { struct ipath_ibdev *dev; u32 len; - len = ((qp->s_psn - wqe->psn) & IPS_PSN_MASK) * + len = ((qp->s_psn - wqe->psn) & IPATH_PSN_MASK) * ib_mtu_enum_to_int(qp->path_mtu); qp->s_sge.sge = wqe->sg_list[0]; qp->s_sge.sg_list = wqe->sg_list + 1; @@ -72,11 +73,10 @@ static void ipath_init_restart(struct ipath_qp *qp, struct ipath_swqe *wqe) * Return bth0 if constructed; otherwise, return 0. * Note the QP s_lock must be held. */ -static inline u32 ipath_make_rc_ack(struct ipath_qp *qp, - struct ipath_other_headers *ohdr, - u32 pmtu) +u32 ipath_make_rc_ack(struct ipath_qp *qp, + struct ipath_other_headers *ohdr, + u32 pmtu) { - struct ipath_sge_state *ss; u32 hwords; u32 len; u32 bth0; @@ -90,13 +90,12 @@ static inline u32 ipath_make_rc_ack(struct ipath_qp *qp, */ switch (qp->s_ack_state) { case OP(RDMA_READ_REQUEST): - ss = &qp->s_rdma_sge; + qp->s_cur_sge = &qp->s_rdma_sge; len = qp->s_rdma_len; if (len > pmtu) { len = pmtu; qp->s_ack_state = OP(RDMA_READ_RESPONSE_FIRST); - } - else + } else qp->s_ack_state = OP(RDMA_READ_RESPONSE_ONLY); qp->s_rdma_len -= len; bth0 = qp->s_ack_state << 24; @@ -108,7 +107,7 @@ static inline u32 ipath_make_rc_ack(struct ipath_qp *qp, qp->s_ack_state = OP(RDMA_READ_RESPONSE_MIDDLE); /* FALLTHROUGH */ case OP(RDMA_READ_RESPONSE_MIDDLE): - ss = &qp->s_rdma_sge; + qp->s_cur_sge = &qp->s_rdma_sge; len = qp->s_rdma_len; if (len > pmtu) len = pmtu; @@ -127,41 +126,50 @@ static inline u32 ipath_make_rc_ack(struct ipath_qp *qp, * We have to prevent new requests from changing * the r_sge state while a ipath_verbs_send() * is in progress. - * Changing r_state allows the receiver - * to continue processing new packets. - * We do it here now instead of above so - * that we are sure the packet was sent before - * changing the state. */ - qp->r_state = OP(RDMA_READ_RESPONSE_LAST); qp->s_ack_state = OP(ACKNOWLEDGE); - return 0; + bth0 = 0; + goto bail; case OP(COMPARE_SWAP): case OP(FETCH_ADD): - ss = NULL; + qp->s_cur_sge = NULL; len = 0; - qp->r_state = OP(SEND_LAST); - qp->s_ack_state = OP(ACKNOWLEDGE); - bth0 = IB_OPCODE_ATOMIC_ACKNOWLEDGE << 24; + /* + * Set the s_ack_state so the receive interrupt handler + * won't try to send an ACK (out of order) until this one + * is actually sent. + */ + qp->s_ack_state = OP(RDMA_READ_RESPONSE_LAST); + bth0 = OP(ATOMIC_ACKNOWLEDGE) << 24; ohdr->u.at.aeth = ipath_compute_aeth(qp); - ohdr->u.at.atomic_ack_eth = cpu_to_be64(qp->s_ack_atomic); + ohdr->u.at.atomic_ack_eth = cpu_to_be64(qp->r_atomic_data); hwords += sizeof(ohdr->u.at) / 4; break; default: /* Send a regular ACK. */ - ss = NULL; + qp->s_cur_sge = NULL; len = 0; - qp->s_ack_state = OP(ACKNOWLEDGE); - bth0 = qp->s_ack_state << 24; - ohdr->u.aeth = ipath_compute_aeth(qp); + /* + * Set the s_ack_state so the receive interrupt handler + * won't try to send an ACK (out of order) until this one + * is actually sent. + */ + qp->s_ack_state = OP(RDMA_READ_RESPONSE_LAST); + bth0 = OP(ACKNOWLEDGE) << 24; + if (qp->s_nak_state) + ohdr->u.aeth = cpu_to_be32((qp->r_msn & IPATH_MSN_MASK) | + (qp->s_nak_state << + IPATH_AETH_CREDIT_SHIFT)); + else + ohdr->u.aeth = ipath_compute_aeth(qp); hwords++; } qp->s_hdrwords = hwords; - qp->s_cur_sge = ss; qp->s_cur_size = len; +bail: return bth0; } @@ -174,11 +182,11 @@ static inline u32 ipath_make_rc_ack(struct ipath_qp *qp, * @bth2p: pointer to the BTH PSN word * * Return 1 if constructed; otherwise, return 0. - * Note the QP s_lock must be held. + * Note the QP s_lock must be held and interrupts disabled. */ -static inline int ipath_make_rc_req(struct ipath_qp *qp, - struct ipath_other_headers *ohdr, - u32 pmtu, u32 *bth0p, u32 *bth2p) +int ipath_make_rc_req(struct ipath_qp *qp, + struct ipath_other_headers *ohdr, + u32 pmtu, u32 *bth0p, u32 *bth2p) { struct ipath_ibdev *dev = to_idev(qp->ibqp.device); struct ipath_sge_state *ss; @@ -257,7 +265,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp, break; case IB_WR_RDMA_WRITE: - if (newreq) + if (newreq && qp->s_lsn != (u32) -1) qp->s_lsn++; /* FALLTHROUGH */ case IB_WR_RDMA_WRITE_WITH_IMM: @@ -283,8 +291,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp, else { qp->s_state = OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE); - /* Immediate data comes - * after RETH */ + /* Immediate data comes after RETH */ ohdr->u.rc.imm_data = wqe->wr.imm_data; hwords += 1; if (wqe->wr.send_flags & IB_SEND_SOLICITED) @@ -304,7 +311,8 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp, qp->s_state = OP(RDMA_READ_REQUEST); hwords += sizeof(ohdr->u.rc.reth) / 4; if (newreq) { - qp->s_lsn++; + if (qp->s_lsn != (u32) -1) + qp->s_lsn++; /* * Adjust s_next_psn to count the * expected number of responses. @@ -335,7 +343,8 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp, wqe->wr.wr.atomic.compare_add); hwords += sizeof(struct ib_atomic_eth) / 4; if (newreq) { - qp->s_lsn++; + if (qp->s_lsn != (u32) -1) + qp->s_lsn++; wqe->lpsn = wqe->psn; } if (++qp->s_cur == qp->s_size) @@ -352,9 +361,14 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp, if (qp->s_tail >= qp->s_size) qp->s_tail = 0; } - bth2 |= qp->s_psn++ & IPS_PSN_MASK; + bth2 |= qp->s_psn++ & IPATH_PSN_MASK; if ((int)(qp->s_psn - qp->s_next_psn) > 0) qp->s_next_psn = qp->s_psn; + /* + * Put the QP on the pending list so lost ACKs will cause + * a retry. More than one request can be pending so the + * QP may already be on the dev->pending list. + */ spin_lock(&dev->pending_lock); if (list_empty(&qp->timerwait)) list_add_tail(&qp->timerwait, @@ -364,8 +378,8 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp, case OP(RDMA_READ_RESPONSE_FIRST): /* - * This case can only happen if a send is restarted. See - * ipath_restart_rc(). + * This case can only happen if a send is restarted. + * See ipath_restart_rc(). */ ipath_init_restart(qp, wqe); /* FALLTHROUGH */ @@ -373,7 +387,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp, qp->s_state = OP(SEND_MIDDLE); /* FALLTHROUGH */ case OP(SEND_MIDDLE): - bth2 = qp->s_psn++ & IPS_PSN_MASK; + bth2 = qp->s_psn++ & IPATH_PSN_MASK; if ((int)(qp->s_psn - qp->s_next_psn) > 0) qp->s_next_psn = qp->s_psn; ss = &qp->s_sge; @@ -415,7 +429,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp, qp->s_state = OP(RDMA_WRITE_MIDDLE); /* FALLTHROUGH */ case OP(RDMA_WRITE_MIDDLE): - bth2 = qp->s_psn++ & IPS_PSN_MASK; + bth2 = qp->s_psn++ & IPATH_PSN_MASK; if ((int)(qp->s_psn - qp->s_next_psn) > 0) qp->s_next_psn = qp->s_psn; ss = &qp->s_sge; @@ -452,7 +466,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp, * See ipath_restart_rc(). */ ipath_init_restart(qp, wqe); - len = ((qp->s_psn - wqe->psn) & IPS_PSN_MASK) * pmtu; + len = ((qp->s_psn - wqe->psn) & IPATH_PSN_MASK) * pmtu; ohdr->u.rc.reth.vaddr = cpu_to_be64(wqe->wr.wr.rdma.remote_addr + len); ohdr->u.rc.reth.rkey = @@ -460,7 +474,7 @@ static inline int ipath_make_rc_req(struct ipath_qp *qp, ohdr->u.rc.reth.length = cpu_to_be32(qp->s_len); qp->s_state = OP(RDMA_READ_REQUEST); hwords += sizeof(ohdr->u.rc.reth) / 4; - bth2 = qp->s_psn++ & IPS_PSN_MASK; + bth2 = qp->s_psn++ & IPATH_PSN_MASK; if ((int)(qp->s_psn - qp->s_next_psn) > 0) qp->s_next_psn = qp->s_psn; ss = NULL; @@ -496,189 +510,169 @@ done: return 0; } -static inline void ipath_make_rc_grh(struct ipath_qp *qp, - struct ib_global_route *grh, - u32 nwords) -{ - struct ipath_ibdev *dev = to_idev(qp->ibqp.device); - - /* GRH header size in 32-bit words. */ - qp->s_hdrwords += 10; - qp->s_hdr.u.l.grh.version_tclass_flow = - cpu_to_be32((6 << 28) | - (grh->traffic_class << 20) | - grh->flow_label); - qp->s_hdr.u.l.grh.paylen = - cpu_to_be16(((qp->s_hdrwords - 12) + nwords + - SIZE_OF_CRC) << 2); - /* next_hdr is defined by C8-7 in ch. 8.4.1 */ - qp->s_hdr.u.l.grh.next_hdr = 0x1B; - qp->s_hdr.u.l.grh.hop_limit = grh->hop_limit; - /* The SGID is 32-bit aligned. */ - qp->s_hdr.u.l.grh.sgid.global.subnet_prefix = dev->gid_prefix; - qp->s_hdr.u.l.grh.sgid.global.interface_id = - ipath_layer_get_guid(dev->dd); - qp->s_hdr.u.l.grh.dgid = grh->dgid; -} - /** - * ipath_do_rc_send - perform a send on an RC QP - * @data: contains a pointer to the QP + * send_rc_ack - Construct an ACK packet and send it + * @qp: a pointer to the QP * - * Process entries in the send work queue until credit or queue is - * exhausted. Only allow one CPU to send a packet per QP (tasklet). - * Otherwise, after we drop the QP s_lock, two threads could send - * packets out of order. + * This is called from ipath_rc_rcv() and only uses the receive + * side QP state. + * Note that RDMA reads are handled in the send side QP state and tasklet. */ -void ipath_do_rc_send(unsigned long data) +static void send_rc_ack(struct ipath_qp *qp) { - struct ipath_qp *qp = (struct ipath_qp *)data; struct ipath_ibdev *dev = to_idev(qp->ibqp.device); - unsigned long flags; u16 lrh0; - u32 nwords; - u32 extra_bytes; u32 bth0; - u32 bth2; - u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); + u32 hwords; + struct ipath_ib_header hdr; struct ipath_other_headers *ohdr; - if (test_and_set_bit(IPATH_S_BUSY, &qp->s_flags)) - goto bail; - - if (unlikely(qp->remote_ah_attr.dlid == - ipath_layer_get_lid(dev->dd))) { - struct ib_wc wc; - - /* - * Pass in an uninitialized ib_wc to be consistent with - * other places where ipath_ruc_loopback() is called. - */ - ipath_ruc_loopback(qp, &wc); - goto clear; - } - - ohdr = &qp->s_hdr.u.oth; - if (qp->remote_ah_attr.ah_flags & IB_AH_GRH) - ohdr = &qp->s_hdr.u.l.oth; - -again: - /* Check for a constructed packet to be sent. */ - if (qp->s_hdrwords != 0) { - /* - * If no PIO bufs are available, return. An interrupt will - * call ipath_ib_piobufavail() when one is available. - */ - _VERBS_INFO("h %u %p\n", qp->s_hdrwords, &qp->s_hdr); - _VERBS_INFO("d %u %p %u %p %u %u %u %u\n", qp->s_cur_size, - qp->s_cur_sge->sg_list, - qp->s_cur_sge->num_sge, - qp->s_cur_sge->sge.vaddr, - qp->s_cur_sge->sge.sge_length, - qp->s_cur_sge->sge.length, - qp->s_cur_sge->sge.m, - qp->s_cur_sge->sge.n); - if (ipath_verbs_send(dev->dd, qp->s_hdrwords, - (u32 *) &qp->s_hdr, qp->s_cur_size, - qp->s_cur_sge)) { - ipath_no_bufs_available(qp, dev); - goto bail; - } - dev->n_unicast_xmit++; - /* Record that we sent the packet and s_hdr is empty. */ - qp->s_hdrwords = 0; - } - - /* - * The lock is needed to synchronize between setting - * qp->s_ack_state, resend timer, and post_send(). - */ - spin_lock_irqsave(&qp->s_lock, flags); - - /* Sending responses has higher priority over sending requests. */ - if (qp->s_ack_state != OP(ACKNOWLEDGE) && - (bth0 = ipath_make_rc_ack(qp, ohdr, pmtu)) != 0) - bth2 = qp->s_ack_psn++ & IPS_PSN_MASK; - else if (!ipath_make_rc_req(qp, ohdr, pmtu, &bth0, &bth2)) - goto done; - - spin_unlock_irqrestore(&qp->s_lock, flags); - /* Construct the header. */ - extra_bytes = (4 - qp->s_cur_size) & 3; - nwords = (qp->s_cur_size + extra_bytes) >> 2; - lrh0 = IPS_LRH_BTH; + ohdr = &hdr.u.oth; + lrh0 = IPATH_LRH_BTH; + /* header size in 32-bit words LRH+BTH+AETH = (8+12+4)/4. */ + hwords = 6; if (unlikely(qp->remote_ah_attr.ah_flags & IB_AH_GRH)) { - ipath_make_rc_grh(qp, &qp->remote_ah_attr.grh, nwords); - lrh0 = IPS_LRH_GRH; + hwords += ipath_make_grh(dev, &hdr.u.l.grh, + &qp->remote_ah_attr.grh, + hwords, 0); + ohdr = &hdr.u.l.oth; + lrh0 = IPATH_LRH_GRH; } + /* read pkey_index w/o lock (its atomic) */ + bth0 = ipath_layer_get_pkey(dev->dd, qp->s_pkey_index); + if (qp->r_nak_state) + ohdr->u.aeth = cpu_to_be32((qp->r_msn & IPATH_MSN_MASK) | + (qp->r_nak_state << + IPATH_AETH_CREDIT_SHIFT)); + else + ohdr->u.aeth = ipath_compute_aeth(qp); + if (qp->r_ack_state >= OP(COMPARE_SWAP)) { + bth0 |= OP(ATOMIC_ACKNOWLEDGE) << 24; + ohdr->u.at.atomic_ack_eth = cpu_to_be64(qp->r_atomic_data); + hwords += sizeof(ohdr->u.at.atomic_ack_eth) / 4; + } else + bth0 |= OP(ACKNOWLEDGE) << 24; lrh0 |= qp->remote_ah_attr.sl << 4; - qp->s_hdr.lrh[0] = cpu_to_be16(lrh0); - qp->s_hdr.lrh[1] = cpu_to_be16(qp->remote_ah_attr.dlid); - qp->s_hdr.lrh[2] = cpu_to_be16(qp->s_hdrwords + nwords + - SIZE_OF_CRC); - qp->s_hdr.lrh[3] = cpu_to_be16(ipath_layer_get_lid(dev->dd)); - bth0 |= ipath_layer_get_pkey(dev->dd, qp->s_pkey_index); - bth0 |= extra_bytes << 20; + hdr.lrh[0] = cpu_to_be16(lrh0); + hdr.lrh[1] = cpu_to_be16(qp->remote_ah_attr.dlid); + hdr.lrh[2] = cpu_to_be16(hwords + SIZE_OF_CRC); + hdr.lrh[3] = cpu_to_be16(ipath_layer_get_lid(dev->dd)); ohdr->bth[0] = cpu_to_be32(bth0); ohdr->bth[1] = cpu_to_be32(qp->remote_qpn); - ohdr->bth[2] = cpu_to_be32(bth2); + ohdr->bth[2] = cpu_to_be32(qp->r_ack_psn & IPATH_PSN_MASK); - /* Check for more work to do. */ - goto again; + /* + * If we can send the ACK, clear the ACK state. + */ + if (ipath_verbs_send(dev->dd, hwords, (u32 *) &hdr, 0, NULL) == 0) { + qp->r_ack_state = OP(ACKNOWLEDGE); + dev->n_unicast_xmit++; + } else { + /* + * We are out of PIO buffers at the moment. + * Pass responsibility for sending the ACK to the + * send tasklet so that when a PIO buffer becomes + * available, the ACK is sent ahead of other outgoing + * packets. + */ + dev->n_rc_qacks++; + spin_lock_irq(&qp->s_lock); + /* Don't coalesce if a RDMA read or atomic is pending. */ + if (qp->s_ack_state == OP(ACKNOWLEDGE) || + qp->s_ack_state < OP(RDMA_READ_REQUEST)) { + qp->s_ack_state = qp->r_ack_state; + qp->s_nak_state = qp->r_nak_state; + qp->s_ack_psn = qp->r_ack_psn; + qp->r_ack_state = OP(ACKNOWLEDGE); + } + spin_unlock_irq(&qp->s_lock); -done: - spin_unlock_irqrestore(&qp->s_lock, flags); -clear: - clear_bit(IPATH_S_BUSY, &qp->s_flags); -bail: - return; + /* Call ipath_do_rc_send() in another thread. */ + tasklet_hi_schedule(&qp->s_task); + } } -static void send_rc_ack(struct ipath_qp *qp) +/** + * reset_psn - reset the QP state to send starting from PSN + * @qp: the QP + * @psn: the packet sequence number to restart at + * + * This is called from ipath_rc_rcv() to process an incoming RC ACK + * for the given QP. + * Called at interrupt level with the QP s_lock held. + */ +static void reset_psn(struct ipath_qp *qp, u32 psn) { - struct ipath_ibdev *dev = to_idev(qp->ibqp.device); - u16 lrh0; - u32 bth0; - struct ipath_other_headers *ohdr; + u32 n = qp->s_last; + struct ipath_swqe *wqe = get_swqe_ptr(qp, n); + u32 opcode; - /* Construct the header. */ - ohdr = &qp->s_hdr.u.oth; - lrh0 = IPS_LRH_BTH; - /* header size in 32-bit words LRH+BTH+AETH = (8+12+4)/4. */ - qp->s_hdrwords = 6; - if (unlikely(qp->remote_ah_attr.ah_flags & IB_AH_GRH)) { - ipath_make_rc_grh(qp, &qp->remote_ah_attr.grh, 0); - ohdr = &qp->s_hdr.u.l.oth; - lrh0 = IPS_LRH_GRH; + qp->s_cur = n; + + /* + * If we are starting the request from the beginning, + * let the normal send code handle initialization. + */ + if (ipath_cmp24(psn, wqe->psn) <= 0) { + qp->s_state = OP(SEND_LAST); + goto done; } - bth0 = ipath_layer_get_pkey(dev->dd, qp->s_pkey_index); - ohdr->u.aeth = ipath_compute_aeth(qp); - if (qp->s_ack_state >= OP(COMPARE_SWAP)) { - bth0 |= IB_OPCODE_ATOMIC_ACKNOWLEDGE << 24; - ohdr->u.at.atomic_ack_eth = cpu_to_be64(qp->s_ack_atomic); - qp->s_hdrwords += sizeof(ohdr->u.at.atomic_ack_eth) / 4; + + /* Find the work request opcode corresponding to the given PSN. */ + opcode = wqe->wr.opcode; + for (;;) { + int diff; + + if (++n == qp->s_size) + n = 0; + if (n == qp->s_tail) + break; + wqe = get_swqe_ptr(qp, n); + diff = ipath_cmp24(psn, wqe->psn); + if (diff < 0) + break; + qp->s_cur = n; + /* + * If we are starting the request from the beginning, + * let the normal send code handle initialization. + */ + if (diff == 0) { + qp->s_state = OP(SEND_LAST); + goto done; + } + opcode = wqe->wr.opcode; } - else - bth0 |= OP(ACKNOWLEDGE) << 24; - lrh0 |= qp->remote_ah_attr.sl << 4; - qp->s_hdr.lrh[0] = cpu_to_be16(lrh0); - qp->s_hdr.lrh[1] = cpu_to_be16(qp->remote_ah_attr.dlid); - qp->s_hdr.lrh[2] = cpu_to_be16(qp->s_hdrwords + SIZE_OF_CRC); - qp->s_hdr.lrh[3] = cpu_to_be16(ipath_layer_get_lid(dev->dd)); - ohdr->bth[0] = cpu_to_be32(bth0); - ohdr->bth[1] = cpu_to_be32(qp->remote_qpn); - ohdr->bth[2] = cpu_to_be32(qp->s_ack_psn & IPS_PSN_MASK); /* - * If we can send the ACK, clear the ACK state. + * Set the state to restart in the middle of a request. + * Don't change the s_sge, s_cur_sge, or s_cur_size. + * See ipath_do_rc_send(). */ - if (ipath_verbs_send(dev->dd, qp->s_hdrwords, (u32 *) &qp->s_hdr, - 0, NULL) == 0) { - qp->s_ack_state = OP(ACKNOWLEDGE); - dev->n_rc_qacks++; - dev->n_unicast_xmit++; + switch (opcode) { + case IB_WR_SEND: + case IB_WR_SEND_WITH_IMM: + qp->s_state = OP(RDMA_READ_RESPONSE_FIRST); + break; + + case IB_WR_RDMA_WRITE: + case IB_WR_RDMA_WRITE_WITH_IMM: + qp->s_state = OP(RDMA_READ_RESPONSE_LAST); + break; + + case IB_WR_RDMA_READ: + qp->s_state = OP(RDMA_READ_RESPONSE_MIDDLE); + break; + + default: + /* + * This case shouldn't happen since its only + * one PSN per req. + */ + qp->s_state = OP(SEND_LAST); } +done: + qp->s_psn = psn; } /** @@ -687,13 +681,12 @@ static void send_rc_ack(struct ipath_qp *qp) * @psn: packet sequence number for the request * @wc: the work completion request * - * The QP s_lock should be held. + * The QP s_lock should be held and interrupts disabled. */ void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc) { struct ipath_swqe *wqe = get_swqe_ptr(qp, qp->s_last); struct ipath_ibdev *dev; - u32 n; /* * If there are no requests pending, we are done. @@ -735,62 +728,7 @@ void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc) else dev->n_rc_resends += (int)qp->s_psn - (int)psn; - /* - * If we are starting the request from the beginning, let the normal - * send code handle initialization. - */ - qp->s_cur = qp->s_last; - if (ipath_cmp24(psn, wqe->psn) <= 0) { - qp->s_state = OP(SEND_LAST); - qp->s_psn = wqe->psn; - } else { - n = qp->s_cur; - for (;;) { - if (++n == qp->s_size) - n = 0; - if (n == qp->s_tail) { - if (ipath_cmp24(psn, qp->s_next_psn) >= 0) { - qp->s_cur = n; - wqe = get_swqe_ptr(qp, n); - } - break; - } - wqe = get_swqe_ptr(qp, n); - if (ipath_cmp24(psn, wqe->psn) < 0) - break; - qp->s_cur = n; - } - qp->s_psn = psn; - - /* - * Reset the state to restart in the middle of a request. - * Don't change the s_sge, s_cur_sge, or s_cur_size. - * See ipath_do_rc_send(). - */ - switch (wqe->wr.opcode) { - case IB_WR_SEND: - case IB_WR_SEND_WITH_IMM: - qp->s_state = OP(RDMA_READ_RESPONSE_FIRST); - break; - - case IB_WR_RDMA_WRITE: - case IB_WR_RDMA_WRITE_WITH_IMM: - qp->s_state = OP(RDMA_READ_RESPONSE_LAST); - break; - - case IB_WR_RDMA_READ: - qp->s_state = - OP(RDMA_READ_RESPONSE_MIDDLE); - break; - - default: - /* - * This case shouldn't happen since its only - * one PSN per req. - */ - qp->s_state = OP(SEND_LAST); - } - } + reset_psn(qp, psn); done: tasklet_hi_schedule(&qp->s_task); @@ -800,76 +738,14 @@ bail: } /** - * reset_psn - reset the QP state to send starting from PSN - * @qp: the QP - * @psn: the packet sequence number to restart at - * - * This is called from ipath_rc_rcv() to process an incoming RC ACK - * for the given QP. - * Called at interrupt level with the QP s_lock held. - */ -static void reset_psn(struct ipath_qp *qp, u32 psn) -{ - struct ipath_swqe *wqe; - u32 n; - - n = qp->s_cur; - wqe = get_swqe_ptr(qp, n); - for (;;) { - if (++n == qp->s_size) - n = 0; - if (n == qp->s_tail) { - if (ipath_cmp24(psn, qp->s_next_psn) >= 0) { - qp->s_cur = n; - wqe = get_swqe_ptr(qp, n); - } - break; - } - wqe = get_swqe_ptr(qp, n); - if (ipath_cmp24(psn, wqe->psn) < 0) - break; - qp->s_cur = n; - } - qp->s_psn = psn; - - /* - * Set the state to restart in the middle of a - * request. Don't change the s_sge, s_cur_sge, or - * s_cur_size. See ipath_do_rc_send(). - */ - switch (wqe->wr.opcode) { - case IB_WR_SEND: - case IB_WR_SEND_WITH_IMM: - qp->s_state = OP(RDMA_READ_RESPONSE_FIRST); - break; - - case IB_WR_RDMA_WRITE: - case IB_WR_RDMA_WRITE_WITH_IMM: - qp->s_state = OP(RDMA_READ_RESPONSE_LAST); - break; - - case IB_WR_RDMA_READ: - qp->s_state = OP(RDMA_READ_RESPONSE_MIDDLE); - break; - - default: - /* - * This case shouldn't happen since its only - * one PSN per req. - */ - qp->s_state = OP(SEND_LAST); - } -} - -/** * do_rc_ack - process an incoming RC ACK * @qp: the QP the ACK came in on * @psn: the packet sequence number of the ACK * @opcode: the opcode of the request that resulted in the ACK * - * This is called from ipath_rc_rcv() to process an incoming RC ACK + * This is called from ipath_rc_rcv_resp() to process an incoming RC ACK * for the given QP. - * Called at interrupt level with the QP s_lock held. + * Called at interrupt level with the QP s_lock held and interrupts disabled. * Returns 1 if OK, 0 if current operation should be aborted (NAK). */ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode) @@ -1006,26 +882,16 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode) if (qp->s_last == qp->s_tail) goto bail; - /* The last valid PSN seen is the previous request's. */ - qp->s_last_psn = wqe->psn - 1; + /* The last valid PSN is the previous PSN. */ + qp->s_last_psn = psn - 1; dev->n_rc_resends += (int)qp->s_psn - (int)psn; - /* - * If we are starting the request from the beginning, let - * the normal send code handle initialization. - */ - qp->s_cur = qp->s_last; - wqe = get_swqe_ptr(qp, qp->s_cur); - if (ipath_cmp24(psn, wqe->psn) <= 0) { - qp->s_state = OP(SEND_LAST); - qp->s_psn = wqe->psn; - } else - reset_psn(qp, psn); + reset_psn(qp, psn); qp->s_rnr_timeout = - ib_ipath_rnr_table[(aeth >> IPS_AETH_CREDIT_SHIFT) & - IPS_AETH_CREDIT_MASK]; + ib_ipath_rnr_table[(aeth >> IPATH_AETH_CREDIT_SHIFT) & + IPATH_AETH_CREDIT_MASK]; ipath_insert_rnr_queue(qp); goto bail; @@ -1033,8 +899,8 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode) /* The last valid PSN seen is the previous request's. */ if (qp->s_last != qp->s_tail) qp->s_last_psn = wqe->psn - 1; - switch ((aeth >> IPS_AETH_CREDIT_SHIFT) & - IPS_AETH_CREDIT_MASK) { + switch ((aeth >> IPATH_AETH_CREDIT_SHIFT) & + IPATH_AETH_CREDIT_MASK) { case 0: /* PSN sequence error */ dev->n_seq_naks++; /* @@ -1182,32 +1048,33 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev, goto ack_done; } rdma_read: - if (unlikely(qp->s_state != OP(RDMA_READ_REQUEST))) - goto ack_done; - if (unlikely(tlen != (hdrsize + pmtu + 4))) - goto ack_done; - if (unlikely(pmtu >= qp->s_len)) - goto ack_done; - /* We got a response so update the timeout. */ - if (unlikely(qp->s_last == qp->s_tail || - get_swqe_ptr(qp, qp->s_last)->wr.opcode != - IB_WR_RDMA_READ)) - goto ack_done; - spin_lock(&dev->pending_lock); - if (qp->s_rnr_timeout == 0 && !list_empty(&qp->timerwait)) - list_move_tail(&qp->timerwait, - &dev->pending[dev->pending_index]); - spin_unlock(&dev->pending_lock); - /* - * Update the RDMA receive state but do the copy w/o holding the - * locks and blocking interrupts. XXX Yet another place that - * affects relaxed RDMA order since we don't want s_sge modified. - */ - qp->s_len -= pmtu; - qp->s_last_psn = psn; - spin_unlock_irqrestore(&qp->s_lock, flags); - ipath_copy_sge(&qp->s_sge, data, pmtu); - goto bail; + if (unlikely(qp->s_state != OP(RDMA_READ_REQUEST))) + goto ack_done; + if (unlikely(tlen != (hdrsize + pmtu + 4))) + goto ack_done; + if (unlikely(pmtu >= qp->s_len)) + goto ack_done; + /* We got a response so update the timeout. */ + if (unlikely(qp->s_last == qp->s_tail || + get_swqe_ptr(qp, qp->s_last)->wr.opcode != + IB_WR_RDMA_READ)) + goto ack_done; + spin_lock(&dev->pending_lock); + if (qp->s_rnr_timeout == 0 && !list_empty(&qp->timerwait)) + list_move_tail(&qp->timerwait, + &dev->pending[dev->pending_index]); + spin_unlock(&dev->pending_lock); + /* + * Update the RDMA receive state but do the copy w/o + * holding the locks and blocking interrupts. + * XXX Yet another place that affects relaxed RDMA order + * since we don't want s_sge modified. + */ + qp->s_len -= pmtu; + qp->s_last_psn = psn; + spin_unlock_irqrestore(&qp->s_lock, flags); + ipath_copy_sge(&qp->s_sge, data, pmtu); + goto bail; case OP(RDMA_READ_RESPONSE_LAST): /* ACKs READ req. */ @@ -1230,18 +1097,12 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev, * ICRC (4). */ if (unlikely(tlen <= (hdrsize + pad + 8))) { - /* - * XXX Need to generate an error CQ - * entry. - */ + /* XXX Need to generate an error CQ entry. */ goto ack_done; } tlen -= hdrsize + pad + 8; if (unlikely(tlen != qp->s_len)) { - /* - * XXX Need to generate an error CQ - * entry. - */ + /* XXX Need to generate an error CQ entry. */ goto ack_done; } if (!header_in_data) @@ -1254,9 +1115,12 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev, if (do_rc_ack(qp, aeth, psn, OP(RDMA_READ_RESPONSE_LAST))) { /* * Change the state so we contimue - * processing new requests. + * processing new requests and wake up the + * tasklet if there are posted sends. */ qp->s_state = OP(SEND_LAST); + if (qp->s_tail != qp->s_head) + tasklet_hi_schedule(&qp->s_task); } goto ack_done; } @@ -1302,18 +1166,16 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev, * Don't queue the NAK if a RDMA read, atomic, or * NAK is pending though. */ - spin_lock(&qp->s_lock); - if ((qp->s_ack_state >= OP(RDMA_READ_REQUEST) && - qp->s_ack_state != IB_OPCODE_ACKNOWLEDGE) || - qp->s_nak_state != 0) { - spin_unlock(&qp->s_lock); + if (qp->s_ack_state != OP(ACKNOWLEDGE) || + qp->r_nak_state != 0) goto done; + if (qp->r_ack_state < OP(COMPARE_SWAP)) { + qp->r_ack_state = OP(SEND_ONLY); + qp->r_nak_state = IB_NAK_PSN_ERROR; + /* Use the expected PSN. */ + qp->r_ack_psn = qp->r_psn; } - qp->s_ack_state = OP(SEND_ONLY); - qp->s_nak_state = IB_NAK_PSN_ERROR; - /* Use the expected PSN. */ - qp->s_ack_psn = qp->r_psn; - goto resched; + goto send_ack; } /* @@ -1327,27 +1189,7 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev, * send the earliest so that RDMA reads can be restarted at * the requester's expected PSN. */ - spin_lock(&qp->s_lock); - if (qp->s_ack_state != IB_OPCODE_ACKNOWLEDGE && - ipath_cmp24(psn, qp->s_ack_psn) >= 0) { - if (qp->s_ack_state < IB_OPCODE_RDMA_READ_REQUEST) - qp->s_ack_psn = psn; - spin_unlock(&qp->s_lock); - goto done; - } - switch (opcode) { - case OP(RDMA_READ_REQUEST): - /* - * We have to be careful to not change s_rdma_sge - * while ipath_do_rc_send() is using it and not - * holding the s_lock. - */ - if (qp->s_ack_state != OP(ACKNOWLEDGE) && - qp->s_ack_state >= IB_OPCODE_RDMA_READ_REQUEST) { - spin_unlock(&qp->s_lock); - dev->n_rdma_dup_busy++; - goto done; - } + if (opcode == OP(RDMA_READ_REQUEST)) { /* RETH comes after BTH */ if (!header_in_data) reth = &ohdr->u.rc.reth; @@ -1355,6 +1197,22 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev, reth = (struct ib_reth *)data; data += sizeof(*reth); } + /* + * If we receive a duplicate RDMA request, it means the + * requester saw a sequence error and needs to restart + * from an earlier point. We can abort the current + * RDMA read send in that case. + */ + spin_lock_irq(&qp->s_lock); + if (qp->s_ack_state != OP(ACKNOWLEDGE) && + (qp->s_hdrwords || ipath_cmp24(psn, qp->s_ack_psn) >= 0)) { + /* + * We are already sending earlier requested data. + * Don't abort it to send later out of sequence data. + */ + spin_unlock_irq(&qp->s_lock); + goto done; + } qp->s_rdma_len = be32_to_cpu(reth->length); if (qp->s_rdma_len != 0) { u32 rkey = be32_to_cpu(reth->rkey); @@ -1368,8 +1226,10 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev, ok = ipath_rkey_ok(dev, &qp->s_rdma_sge, qp->s_rdma_len, vaddr, rkey, IB_ACCESS_REMOTE_READ); - if (unlikely(!ok)) + if (unlikely(!ok)) { + spin_unlock_irq(&qp->s_lock); goto done; + } } else { qp->s_rdma_sge.sg_list = NULL; qp->s_rdma_sge.num_sge = 0; @@ -1378,25 +1238,44 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev, qp->s_rdma_sge.sge.length = 0; qp->s_rdma_sge.sge.sge_length = 0; } - break; + qp->s_ack_state = opcode; + qp->s_ack_psn = psn; + spin_unlock_irq(&qp->s_lock); + tasklet_hi_schedule(&qp->s_task); + goto send_ack; + } + + /* + * A pending RDMA read will ACK anything before it so + * ignore earlier duplicate requests. + */ + if (qp->s_ack_state != OP(ACKNOWLEDGE)) + goto done; + /* + * If an ACK is pending, don't replace the pending ACK + * with an earlier one since the later one will ACK the earlier. + * Also, if we already have a pending atomic, send it. + */ + if (qp->r_ack_state != OP(ACKNOWLEDGE) && + (ipath_cmp24(psn, qp->r_ack_psn) <= 0 || + qp->r_ack_state >= OP(COMPARE_SWAP))) + goto send_ack; + switch (opcode) { case OP(COMPARE_SWAP): case OP(FETCH_ADD): /* - * Check for the PSN of the last atomic operations + * Check for the PSN of the last atomic operation * performed and resend the result if found. */ - if ((psn & IPS_PSN_MASK) != qp->r_atomic_psn) { - spin_unlock(&qp->s_lock); + if ((psn & IPATH_PSN_MASK) != qp->r_atomic_psn) goto done; - } - qp->s_ack_atomic = qp->r_atomic_data; break; } - qp->s_ack_state = opcode; - qp->s_nak_state = 0; - qp->s_ack_psn = psn; -resched: + qp->r_ack_state = opcode; + qp->r_nak_state = 0; + qp->r_ack_psn = psn; +send_ack: return 0; done: @@ -1424,7 +1303,6 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, u32 hdrsize; u32 psn; u32 pad; - unsigned long flags; struct ib_wc wc; u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); int diff; @@ -1453,11 +1331,6 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, } else psn = be32_to_cpu(ohdr->bth[2]); } - /* - * The opcode is in the low byte when its in network order - * (top byte when in host order). - */ - opcode = be32_to_cpu(ohdr->bth[0]) >> 24; /* * Process responses (ACKs) before anything else. Note that the @@ -1465,22 +1338,21 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, * queue rather than the expected receive packet sequence number. * In other words, this QP is the requester. */ + opcode = be32_to_cpu(ohdr->bth[0]) >> 24; if (opcode >= OP(RDMA_READ_RESPONSE_FIRST) && opcode <= OP(ATOMIC_ACKNOWLEDGE)) { ipath_rc_rcv_resp(dev, ohdr, data, tlen, qp, opcode, psn, hdrsize, pmtu, header_in_data); - goto bail; + goto done; } - spin_lock_irqsave(&qp->r_rq.lock, flags); - /* Compute 24 bits worth of difference. */ diff = ipath_cmp24(psn, qp->r_psn); if (unlikely(diff)) { if (ipath_rc_rcv_error(dev, ohdr, data, qp, opcode, psn, diff, header_in_data)) goto done; - goto resched; + goto send_ack; } /* Check for opcode sequence errors. */ @@ -1492,22 +1364,19 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, opcode == OP(SEND_LAST_WITH_IMMEDIATE)) break; nack_inv: - /* - * A NAK will ACK earlier sends and RDMA writes. Don't queue the - * NAK if a RDMA read, atomic, or NAK is pending though. - */ - spin_lock(&qp->s_lock); - if (qp->s_ack_state >= OP(RDMA_READ_REQUEST) && - qp->s_ack_state != IB_OPCODE_ACKNOWLEDGE) { - spin_unlock(&qp->s_lock); - goto done; - } - /* XXX Flush WQEs */ - qp->state = IB_QPS_ERR; - qp->s_ack_state = OP(SEND_ONLY); - qp->s_nak_state = IB_NAK_INVALID_REQUEST; - qp->s_ack_psn = qp->r_psn; - goto resched; + /* + * A NAK will ACK earlier sends and RDMA writes. + * Don't queue the NAK if a RDMA read, atomic, or NAK + * is pending though. + */ + if (qp->r_ack_state >= OP(COMPARE_SWAP)) + goto send_ack; + /* XXX Flush WQEs */ + qp->state = IB_QPS_ERR; + qp->r_ack_state = OP(SEND_ONLY); + qp->r_nak_state = IB_NAK_INVALID_REQUEST; + qp->r_ack_psn = qp->r_psn; + goto send_ack; case OP(RDMA_WRITE_FIRST): case OP(RDMA_WRITE_MIDDLE): @@ -1517,20 +1386,6 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, break; goto nack_inv; - case OP(RDMA_READ_REQUEST): - case OP(COMPARE_SWAP): - case OP(FETCH_ADD): - /* - * Drop all new requests until a response has been sent. A - * new request then ACKs the RDMA response we sent. Relaxed - * ordering would allow new requests to be processed but we - * would need to keep a queue of rwqe's for all that are in - * progress. Note that we can't RNR NAK this request since - * the RDMA READ or atomic response is already queued to be - * sent (unless we implement a response send queue). - */ - goto done; - default: if (opcode == OP(SEND_MIDDLE) || opcode == OP(SEND_LAST) || @@ -1539,6 +1394,11 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, opcode == OP(RDMA_WRITE_LAST) || opcode == OP(RDMA_WRITE_LAST_WITH_IMMEDIATE)) goto nack_inv; + /* + * Note that it is up to the requester to not send a new + * RDMA read or atomic operation before receiving an ACK + * for the previous operation. + */ break; } @@ -1555,17 +1415,12 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, * Don't queue the NAK if a RDMA read or atomic * is pending though. */ - spin_lock(&qp->s_lock); - if (qp->s_ack_state >= - OP(RDMA_READ_REQUEST) && - qp->s_ack_state != IB_OPCODE_ACKNOWLEDGE) { - spin_unlock(&qp->s_lock); - goto done; - } - qp->s_ack_state = OP(SEND_ONLY); - qp->s_nak_state = IB_RNR_NAK | qp->s_min_rnr_timer; - qp->s_ack_psn = qp->r_psn; - goto resched; + if (qp->r_ack_state >= OP(COMPARE_SWAP)) + goto send_ack; + qp->r_ack_state = OP(SEND_ONLY); + qp->r_nak_state = IB_RNR_NAK | qp->r_min_rnr_timer; + qp->r_ack_psn = qp->r_psn; + goto send_ack; } qp->r_rcv_len = 0; /* FALLTHROUGH */ @@ -1622,7 +1477,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, if (unlikely(wc.byte_len > qp->r_len)) goto nack_inv; ipath_copy_sge(&qp->r_sge, data, tlen); - atomic_inc(&qp->msn); + qp->r_msn++; if (opcode == OP(RDMA_WRITE_LAST) || opcode == OP(RDMA_WRITE_ONLY)) break; @@ -1666,29 +1521,8 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, ok = ipath_rkey_ok(dev, &qp->r_sge, qp->r_len, vaddr, rkey, IB_ACCESS_REMOTE_WRITE); - if (unlikely(!ok)) { - nack_acc: - /* - * A NAK will ACK earlier sends and RDMA - * writes. Don't queue the NAK if a RDMA - * read, atomic, or NAK is pending though. - */ - spin_lock(&qp->s_lock); - if (qp->s_ack_state >= - OP(RDMA_READ_REQUEST) && - qp->s_ack_state != - IB_OPCODE_ACKNOWLEDGE) { - spin_unlock(&qp->s_lock); - goto done; - } - /* XXX Flush WQEs */ - qp->state = IB_QPS_ERR; - qp->s_ack_state = OP(RDMA_WRITE_ONLY); - qp->s_nak_state = - IB_NAK_REMOTE_ACCESS_ERROR; - qp->s_ack_psn = qp->r_psn; - goto resched; - } + if (unlikely(!ok)) + goto nack_acc; } else { qp->r_sge.sg_list = NULL; qp->r_sge.sge.mr = NULL; @@ -1715,12 +1549,10 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, reth = (struct ib_reth *)data; data += sizeof(*reth); } - spin_lock(&qp->s_lock); - if (qp->s_ack_state != OP(ACKNOWLEDGE) && - qp->s_ack_state >= IB_OPCODE_RDMA_READ_REQUEST) { - spin_unlock(&qp->s_lock); - goto done; - } + if (unlikely(!(qp->qp_access_flags & + IB_ACCESS_REMOTE_READ))) + goto nack_acc; + spin_lock_irq(&qp->s_lock); qp->s_rdma_len = be32_to_cpu(reth->length); if (qp->s_rdma_len != 0) { u32 rkey = be32_to_cpu(reth->rkey); @@ -1732,7 +1564,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, qp->s_rdma_len, vaddr, rkey, IB_ACCESS_REMOTE_READ); if (unlikely(!ok)) { - spin_unlock(&qp->s_lock); + spin_unlock_irq(&qp->s_lock); goto nack_acc; } /* @@ -1749,21 +1581,25 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, qp->s_rdma_sge.sge.length = 0; qp->s_rdma_sge.sge.sge_length = 0; } - if (unlikely(!(qp->qp_access_flags & - IB_ACCESS_REMOTE_READ))) - goto nack_acc; /* * We need to increment the MSN here instead of when we * finish sending the result since a duplicate request would * increment it more than once. */ - atomic_inc(&qp->msn); + qp->r_msn++; + qp->s_ack_state = opcode; - qp->s_nak_state = 0; qp->s_ack_psn = psn; + spin_unlock_irq(&qp->s_lock); + qp->r_psn++; qp->r_state = opcode; - goto rdmadone; + qp->r_nak_state = 0; + + /* Call ipath_do_rc_send() in another thread. */ + tasklet_hi_schedule(&qp->s_task); + + goto done; case OP(COMPARE_SWAP): case OP(FETCH_ADD): { @@ -1792,7 +1628,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, goto nack_acc; /* Perform atomic OP and save result. */ sdata = be64_to_cpu(ateth->swap_data); - spin_lock(&dev->pending_lock); + spin_lock_irq(&dev->pending_lock); qp->r_atomic_data = *(u64 *) qp->r_sge.sge.vaddr; if (opcode == OP(FETCH_ADD)) *(u64 *) qp->r_sge.sge.vaddr = @@ -1800,9 +1636,9 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, else if (qp->r_atomic_data == be64_to_cpu(ateth->compare_data)) *(u64 *) qp->r_sge.sge.vaddr = sdata; - spin_unlock(&dev->pending_lock); - atomic_inc(&qp->msn); - qp->r_atomic_psn = psn & IPS_PSN_MASK; + spin_unlock_irq(&dev->pending_lock); + qp->r_msn++; + qp->r_atomic_psn = psn & IPATH_PSN_MASK; psn |= 1 << 31; break; } @@ -1813,44 +1649,39 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, } qp->r_psn++; qp->r_state = opcode; + qp->r_nak_state = 0; /* Send an ACK if requested or required. */ if (psn & (1 << 31)) { /* * Coalesce ACKs unless there is a RDMA READ or * ATOMIC pending. */ - spin_lock(&qp->s_lock); - if (qp->s_ack_state == OP(ACKNOWLEDGE) || - qp->s_ack_state < IB_OPCODE_RDMA_READ_REQUEST) { - qp->s_ack_state = opcode; - qp->s_nak_state = 0; - qp->s_ack_psn = psn; - qp->s_ack_atomic = qp->r_atomic_data; - goto resched; + if (qp->r_ack_state < OP(COMPARE_SWAP)) { + qp->r_ack_state = opcode; + qp->r_ack_psn = psn; } - spin_unlock(&qp->s_lock); + goto send_ack; } -done: - spin_unlock_irqrestore(&qp->r_rq.lock, flags); - goto bail; + goto done; -resched: +nack_acc: /* - * Try to send ACK right away but not if ipath_do_rc_send() is - * active. + * A NAK will ACK earlier sends and RDMA writes. + * Don't queue the NAK if a RDMA read, atomic, or NAK + * is pending though. */ - if (qp->s_hdrwords == 0 && - (qp->s_ack_state < IB_OPCODE_RDMA_READ_REQUEST || - qp->s_ack_state >= IB_OPCODE_COMPARE_SWAP)) + if (qp->r_ack_state < OP(COMPARE_SWAP)) { + /* XXX Flush WQEs */ + qp->state = IB_QPS_ERR; + qp->r_ack_state = OP(RDMA_WRITE_ONLY); + qp->r_nak_state = IB_NAK_REMOTE_ACCESS_ERROR; + qp->r_ack_psn = qp->r_psn; + } +send_ack: + /* Send ACK right away unless the send tasklet has a pending ACK. */ + if (qp->s_ack_state == OP(ACKNOWLEDGE)) send_rc_ack(qp); -rdmadone: - spin_unlock(&qp->s_lock); - spin_unlock_irqrestore(&qp->r_rq.lock, flags); - - /* Call ipath_do_rc_send() in another thread. */ - tasklet_hi_schedule(&qp->s_task); - -bail: +done: return; } diff --git a/drivers/infiniband/hw/ipath/ipath_registers.h b/drivers/infiniband/hw/ipath/ipath_registers.h index 402126eb79c..89df8f5ea99 100644 --- a/drivers/infiniband/hw/ipath/ipath_registers.h +++ b/drivers/infiniband/hw/ipath/ipath_registers.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c b/drivers/infiniband/hw/ipath/ipath_ruc.c index d38f4f3cfd1..772bc59fb85 100644 --- a/drivers/infiniband/hw/ipath/ipath_ruc.c +++ b/drivers/infiniband/hw/ipath/ipath_ruc.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -31,6 +32,7 @@ */ #include "ipath_verbs.h" +#include "ipath_common.h" /* * Convert the AETH RNR timeout code into the number of milliseconds. @@ -111,20 +113,23 @@ void ipath_insert_rnr_queue(struct ipath_qp *qp) * * Return 0 if no RWQE is available, otherwise return 1. * - * Called at interrupt level with the QP r_rq.lock held. + * Can be called from interrupt level. */ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only) { + unsigned long flags; struct ipath_rq *rq; struct ipath_srq *srq; struct ipath_rwqe *wqe; - int ret; + int ret = 1; if (!qp->ibqp.srq) { rq = &qp->r_rq; + spin_lock_irqsave(&rq->lock, flags); + if (unlikely(rq->tail == rq->head)) { ret = 0; - goto bail; + goto done; } wqe = get_rwqe_ptr(rq, rq->tail); qp->r_wr_id = wqe->wr_id; @@ -136,17 +141,16 @@ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only) } if (++rq->tail >= rq->size) rq->tail = 0; - ret = 1; - goto bail; + goto done; } srq = to_isrq(qp->ibqp.srq); rq = &srq->rq; - spin_lock(&rq->lock); + spin_lock_irqsave(&rq->lock, flags); + if (unlikely(rq->tail == rq->head)) { - spin_unlock(&rq->lock); ret = 0; - goto bail; + goto done; } wqe = get_rwqe_ptr(rq, rq->tail); qp->r_wr_id = wqe->wr_id; @@ -168,18 +172,18 @@ int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only) n = rq->head - rq->tail; if (n < srq->limit) { srq->limit = 0; - spin_unlock(&rq->lock); + spin_unlock_irqrestore(&rq->lock, flags); ev.device = qp->ibqp.device; ev.element.srq = qp->ibqp.srq; ev.event = IB_EVENT_SRQ_LIMIT_REACHED; srq->ibsrq.event_handler(&ev, srq->ibsrq.srq_context); - } else - spin_unlock(&rq->lock); - } else - spin_unlock(&rq->lock); - ret = 1; + goto bail; + } + } +done: + spin_unlock_irqrestore(&rq->lock, flags); bail: return ret; } @@ -187,7 +191,6 @@ bail: /** * ipath_ruc_loopback - handle UC and RC lookback requests * @sqp: the loopback QP - * @wc: the work completion entry * * This is called from ipath_do_uc_send() or ipath_do_rc_send() to * forward a WQE addressed to the same HCA. @@ -196,13 +199,14 @@ bail: * receive interrupts since this is a connected protocol and all packets * will pass through here. */ -void ipath_ruc_loopback(struct ipath_qp *sqp, struct ib_wc *wc) +static void ipath_ruc_loopback(struct ipath_qp *sqp) { struct ipath_ibdev *dev = to_idev(sqp->ibqp.device); struct ipath_qp *qp; struct ipath_swqe *wqe; struct ipath_sge *sge; unsigned long flags; + struct ib_wc wc; u64 sdata; qp = ipath_lookup_qpn(&dev->qp_table, sqp->remote_qpn); @@ -233,8 +237,8 @@ again: wqe = get_swqe_ptr(sqp, sqp->s_last); spin_unlock_irqrestore(&sqp->s_lock, flags); - wc->wc_flags = 0; - wc->imm_data = 0; + wc.wc_flags = 0; + wc.imm_data = 0; sqp->s_sge.sge = wqe->sg_list[0]; sqp->s_sge.sg_list = wqe->sg_list + 1; @@ -242,39 +246,34 @@ again: sqp->s_len = wqe->length; switch (wqe->wr.opcode) { case IB_WR_SEND_WITH_IMM: - wc->wc_flags = IB_WC_WITH_IMM; - wc->imm_data = wqe->wr.imm_data; + wc.wc_flags = IB_WC_WITH_IMM; + wc.imm_data = wqe->wr.imm_data; /* FALLTHROUGH */ case IB_WR_SEND: - spin_lock_irqsave(&qp->r_rq.lock, flags); if (!ipath_get_rwqe(qp, 0)) { rnr_nak: - spin_unlock_irqrestore(&qp->r_rq.lock, flags); /* Handle RNR NAK */ if (qp->ibqp.qp_type == IB_QPT_UC) goto send_comp; if (sqp->s_rnr_retry == 0) { - wc->status = IB_WC_RNR_RETRY_EXC_ERR; + wc.status = IB_WC_RNR_RETRY_EXC_ERR; goto err; } if (sqp->s_rnr_retry_cnt < 7) sqp->s_rnr_retry--; dev->n_rnr_naks++; sqp->s_rnr_timeout = - ib_ipath_rnr_table[sqp->s_min_rnr_timer]; + ib_ipath_rnr_table[sqp->r_min_rnr_timer]; ipath_insert_rnr_queue(sqp); goto done; } - spin_unlock_irqrestore(&qp->r_rq.lock, flags); break; case IB_WR_RDMA_WRITE_WITH_IMM: - wc->wc_flags = IB_WC_WITH_IMM; - wc->imm_data = wqe->wr.imm_data; - spin_lock_irqsave(&qp->r_rq.lock, flags); + wc.wc_flags = IB_WC_WITH_IMM; + wc.imm_data = wqe->wr.imm_data; if (!ipath_get_rwqe(qp, 1)) goto rnr_nak; - spin_unlock_irqrestore(&qp->r_rq.lock, flags); /* FALLTHROUGH */ case IB_WR_RDMA_WRITE: if (wqe->length == 0) @@ -284,20 +283,20 @@ again: wqe->wr.wr.rdma.rkey, IB_ACCESS_REMOTE_WRITE))) { acc_err: - wc->status = IB_WC_REM_ACCESS_ERR; + wc.status = IB_WC_REM_ACCESS_ERR; err: - wc->wr_id = wqe->wr.wr_id; - wc->opcode = ib_ipath_wc_opcode[wqe->wr.opcode]; - wc->vendor_err = 0; - wc->byte_len = 0; - wc->qp_num = sqp->ibqp.qp_num; - wc->src_qp = sqp->remote_qpn; - wc->pkey_index = 0; - wc->slid = sqp->remote_ah_attr.dlid; - wc->sl = sqp->remote_ah_attr.sl; - wc->dlid_path_bits = 0; - wc->port_num = 0; - ipath_sqerror_qp(sqp, wc); + wc.wr_id = wqe->wr.wr_id; + wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode]; + wc.vendor_err = 0; + wc.byte_len = 0; + wc.qp_num = sqp->ibqp.qp_num; + wc.src_qp = sqp->remote_qpn; + wc.pkey_index = 0; + wc.slid = sqp->remote_ah_attr.dlid; + wc.sl = sqp->remote_ah_attr.sl; + wc.dlid_path_bits = 0; + wc.port_num = 0; + ipath_sqerror_qp(sqp, &wc); goto done; } break; @@ -373,22 +372,22 @@ again: goto send_comp; if (wqe->wr.opcode == IB_WR_RDMA_WRITE_WITH_IMM) - wc->opcode = IB_WC_RECV_RDMA_WITH_IMM; + wc.opcode = IB_WC_RECV_RDMA_WITH_IMM; else - wc->opcode = IB_WC_RECV; - wc->wr_id = qp->r_wr_id; - wc->status = IB_WC_SUCCESS; - wc->vendor_err = 0; - wc->byte_len = wqe->length; - wc->qp_num = qp->ibqp.qp_num; - wc->src_qp = qp->remote_qpn; + wc.opcode = IB_WC_RECV; + wc.wr_id = qp->r_wr_id; + wc.status = IB_WC_SUCCESS; + wc.vendor_err = 0; + wc.byte_len = wqe->length; + wc.qp_num = qp->ibqp.qp_num; + wc.src_qp = qp->remote_qpn; /* XXX do we know which pkey matched? Only needed for GSI. */ - wc->pkey_index = 0; - wc->slid = qp->remote_ah_attr.dlid; - wc->sl = qp->remote_ah_attr.sl; - wc->dlid_path_bits = 0; + wc.pkey_index = 0; + wc.slid = qp->remote_ah_attr.dlid; + wc.sl = qp->remote_ah_attr.sl; + wc.dlid_path_bits = 0; /* Signal completion event if the solicited bit is set. */ - ipath_cq_enter(to_icq(qp->ibqp.recv_cq), wc, + ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, wqe->wr.send_flags & IB_SEND_SOLICITED); send_comp: @@ -396,19 +395,19 @@ send_comp: if (!test_bit(IPATH_S_SIGNAL_REQ_WR, &sqp->s_flags) || (wqe->wr.send_flags & IB_SEND_SIGNALED)) { - wc->wr_id = wqe->wr.wr_id; - wc->status = IB_WC_SUCCESS; - wc->opcode = ib_ipath_wc_opcode[wqe->wr.opcode]; - wc->vendor_err = 0; - wc->byte_len = wqe->length; - wc->qp_num = sqp->ibqp.qp_num; - wc->src_qp = 0; - wc->pkey_index = 0; - wc->slid = 0; - wc->sl = 0; - wc->dlid_path_bits = 0; - wc->port_num = 0; - ipath_cq_enter(to_icq(sqp->ibqp.send_cq), wc, 0); + wc.wr_id = wqe->wr.wr_id; + wc.status = IB_WC_SUCCESS; + wc.opcode = ib_ipath_wc_opcode[wqe->wr.opcode]; + wc.vendor_err = 0; + wc.byte_len = wqe->length; + wc.qp_num = sqp->ibqp.qp_num; + wc.src_qp = 0; + wc.pkey_index = 0; + wc.slid = 0; + wc.sl = 0; + wc.dlid_path_bits = 0; + wc.port_num = 0; + ipath_cq_enter(to_icq(sqp->ibqp.send_cq), &wc, 0); } /* Update s_last now that we are finished with the SWQE */ @@ -454,11 +453,11 @@ void ipath_no_bufs_available(struct ipath_qp *qp, struct ipath_ibdev *dev) } /** - * ipath_post_rc_send - post RC and UC sends + * ipath_post_ruc_send - post RC and UC sends * @qp: the QP to post on * @wr: the work request to send */ -int ipath_post_rc_send(struct ipath_qp *qp, struct ib_send_wr *wr) +int ipath_post_ruc_send(struct ipath_qp *qp, struct ib_send_wr *wr) { struct ipath_swqe *wqe; unsigned long flags; @@ -533,13 +532,149 @@ int ipath_post_rc_send(struct ipath_qp *qp, struct ib_send_wr *wr) qp->s_head = next; spin_unlock_irqrestore(&qp->s_lock, flags); - if (qp->ibqp.qp_type == IB_QPT_UC) - ipath_do_uc_send((unsigned long) qp); - else - ipath_do_rc_send((unsigned long) qp); + ipath_do_ruc_send((unsigned long) qp); ret = 0; bail: return ret; } + +/** + * ipath_make_grh - construct a GRH header + * @dev: a pointer to the ipath device + * @hdr: a pointer to the GRH header being constructed + * @grh: the global route address to send to + * @hwords: the number of 32 bit words of header being sent + * @nwords: the number of 32 bit words of data being sent + * + * Return the size of the header in 32 bit words. + */ +u32 ipath_make_grh(struct ipath_ibdev *dev, struct ib_grh *hdr, + struct ib_global_route *grh, u32 hwords, u32 nwords) +{ + hdr->version_tclass_flow = + cpu_to_be32((6 << 28) | + (grh->traffic_class << 20) | + grh->flow_label); + hdr->paylen = cpu_to_be16((hwords - 2 + nwords + SIZE_OF_CRC) << 2); + /* next_hdr is defined by C8-7 in ch. 8.4.1 */ + hdr->next_hdr = 0x1B; + hdr->hop_limit = grh->hop_limit; + /* The SGID is 32-bit aligned. */ + hdr->sgid.global.subnet_prefix = dev->gid_prefix; + hdr->sgid.global.interface_id = ipath_layer_get_guid(dev->dd); + hdr->dgid = grh->dgid; + + /* GRH header size in 32-bit words. */ + return sizeof(struct ib_grh) / sizeof(u32); +} + +/** + * ipath_do_ruc_send - perform a send on an RC or UC QP + * @data: contains a pointer to the QP + * + * Process entries in the send work queue until credit or queue is + * exhausted. Only allow one CPU to send a packet per QP (tasklet). + * Otherwise, after we drop the QP s_lock, two threads could send + * packets out of order. + */ +void ipath_do_ruc_send(unsigned long data) +{ + struct ipath_qp *qp = (struct ipath_qp *)data; + struct ipath_ibdev *dev = to_idev(qp->ibqp.device); + unsigned long flags; + u16 lrh0; + u32 nwords; + u32 extra_bytes; + u32 bth0; + u32 bth2; + u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); + struct ipath_other_headers *ohdr; + + if (test_and_set_bit(IPATH_S_BUSY, &qp->s_flags)) + goto bail; + + if (unlikely(qp->remote_ah_attr.dlid == + ipath_layer_get_lid(dev->dd))) { + ipath_ruc_loopback(qp); + goto clear; + } + + ohdr = &qp->s_hdr.u.oth; + if (qp->remote_ah_attr.ah_flags & IB_AH_GRH) + ohdr = &qp->s_hdr.u.l.oth; + +again: + /* Check for a constructed packet to be sent. */ + if (qp->s_hdrwords != 0) { + /* + * If no PIO bufs are available, return. An interrupt will + * call ipath_ib_piobufavail() when one is available. + */ + if (ipath_verbs_send(dev->dd, qp->s_hdrwords, + (u32 *) &qp->s_hdr, qp->s_cur_size, + qp->s_cur_sge)) { + ipath_no_bufs_available(qp, dev); + goto bail; + } + dev->n_unicast_xmit++; + /* Record that we sent the packet and s_hdr is empty. */ + qp->s_hdrwords = 0; + } + + /* + * The lock is needed to synchronize between setting + * qp->s_ack_state, resend timer, and post_send(). + */ + spin_lock_irqsave(&qp->s_lock, flags); + + /* Sending responses has higher priority over sending requests. */ + if (qp->s_ack_state != IB_OPCODE_RC_ACKNOWLEDGE && + (bth0 = ipath_make_rc_ack(qp, ohdr, pmtu)) != 0) + bth2 = qp->s_ack_psn++ & IPATH_PSN_MASK; + else if (!((qp->ibqp.qp_type == IB_QPT_RC) ? + ipath_make_rc_req(qp, ohdr, pmtu, &bth0, &bth2) : + ipath_make_uc_req(qp, ohdr, pmtu, &bth0, &bth2))) { + /* + * Clear the busy bit before unlocking to avoid races with + * adding new work queue items and then failing to process + * them. + */ + clear_bit(IPATH_S_BUSY, &qp->s_flags); + spin_unlock_irqrestore(&qp->s_lock, flags); + goto bail; + } + + spin_unlock_irqrestore(&qp->s_lock, flags); + + /* Construct the header. */ + extra_bytes = (4 - qp->s_cur_size) & 3; + nwords = (qp->s_cur_size + extra_bytes) >> 2; + lrh0 = IPATH_LRH_BTH; + if (unlikely(qp->remote_ah_attr.ah_flags & IB_AH_GRH)) { + qp->s_hdrwords += ipath_make_grh(dev, &qp->s_hdr.u.l.grh, + &qp->remote_ah_attr.grh, + qp->s_hdrwords, nwords); + lrh0 = IPATH_LRH_GRH; + } + lrh0 |= qp->remote_ah_attr.sl << 4; + qp->s_hdr.lrh[0] = cpu_to_be16(lrh0); + qp->s_hdr.lrh[1] = cpu_to_be16(qp->remote_ah_attr.dlid); + qp->s_hdr.lrh[2] = cpu_to_be16(qp->s_hdrwords + nwords + + SIZE_OF_CRC); + qp->s_hdr.lrh[3] = cpu_to_be16(ipath_layer_get_lid(dev->dd)); + bth0 |= ipath_layer_get_pkey(dev->dd, qp->s_pkey_index); + bth0 |= extra_bytes << 20; + ohdr->bth[0] = cpu_to_be32(bth0); + ohdr->bth[1] = cpu_to_be32(qp->remote_qpn); + ohdr->bth[2] = cpu_to_be32(bth2); + + /* Check for more work to do. */ + goto again; + +clear: + clear_bit(IPATH_S_BUSY, &qp->s_flags); +bail: + return; +} diff --git a/drivers/infiniband/hw/ipath/ipath_srq.c b/drivers/infiniband/hw/ipath/ipath_srq.c index 01c4c6c5611..f760434660b 100644 --- a/drivers/infiniband/hw/ipath/ipath_srq.c +++ b/drivers/infiniband/hw/ipath/ipath_srq.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -125,11 +126,23 @@ struct ib_srq *ipath_create_srq(struct ib_pd *ibpd, struct ib_srq_init_attr *srq_init_attr, struct ib_udata *udata) { + struct ipath_ibdev *dev = to_idev(ibpd->device); struct ipath_srq *srq; u32 sz; struct ib_srq *ret; - if (srq_init_attr->attr.max_sge < 1) { + if (dev->n_srqs_allocated == ib_ipath_max_srqs) { + ret = ERR_PTR(-ENOMEM); + goto bail; + } + + if (srq_init_attr->attr.max_wr == 0) { + ret = ERR_PTR(-EINVAL); + goto bail; + } + + if ((srq_init_attr->attr.max_sge > ib_ipath_max_srq_sges) || + (srq_init_attr->attr.max_wr > ib_ipath_max_srq_wrs)) { ret = ERR_PTR(-EINVAL); goto bail; } @@ -164,6 +177,8 @@ struct ib_srq *ipath_create_srq(struct ib_pd *ibpd, ret = &srq->ibsrq; + dev->n_srqs_allocated++; + bail: return ret; } @@ -181,24 +196,26 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, unsigned long flags; int ret; - if (attr_mask & IB_SRQ_LIMIT) { - spin_lock_irqsave(&srq->rq.lock, flags); - srq->limit = attr->srq_limit; - spin_unlock_irqrestore(&srq->rq.lock, flags); - } - if (attr_mask & IB_SRQ_MAX_WR) { - u32 size = attr->max_wr + 1; - struct ipath_rwqe *wq, *p; - u32 n; - u32 sz; + if (attr_mask & IB_SRQ_MAX_WR) + if ((attr->max_wr > ib_ipath_max_srq_wrs) || + (attr->max_sge > srq->rq.max_sge)) { + ret = -EINVAL; + goto bail; + } - if (attr->max_sge < srq->rq.max_sge) { + if (attr_mask & IB_SRQ_LIMIT) + if (attr->srq_limit >= srq->rq.size) { ret = -EINVAL; goto bail; } + if (attr_mask & IB_SRQ_MAX_WR) { + struct ipath_rwqe *wq, *p; + u32 sz, size, n; + sz = sizeof(struct ipath_rwqe) + attr->max_sge * sizeof(struct ipath_sge); + size = attr->max_wr + 1; wq = vmalloc(size * sz); if (!wq) { ret = -ENOMEM; @@ -242,6 +259,11 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, spin_unlock_irqrestore(&srq->rq.lock, flags); } + if (attr_mask & IB_SRQ_LIMIT) { + spin_lock_irqsave(&srq->rq.lock, flags); + srq->limit = attr->srq_limit; + spin_unlock_irqrestore(&srq->rq.lock, flags); + } ret = 0; bail: @@ -265,7 +287,9 @@ int ipath_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr) int ipath_destroy_srq(struct ib_srq *ibsrq) { struct ipath_srq *srq = to_isrq(ibsrq); + struct ipath_ibdev *dev = to_idev(ibsrq->device); + dev->n_srqs_allocated--; vfree(srq->rq.wq); kfree(srq); diff --git a/drivers/infiniband/hw/ipath/ipath_stats.c b/drivers/infiniband/hw/ipath/ipath_stats.c index fe209137ee7..70351b7e35c 100644 --- a/drivers/infiniband/hw/ipath/ipath_stats.c +++ b/drivers/infiniband/hw/ipath/ipath_stats.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -185,7 +186,6 @@ static void ipath_qcheck(struct ipath_devdata *dd) dd->ipath_port0head, (unsigned long long) ipath_stats.sps_port0pkts); - ipath_kreceive(dd); } dd->ipath_lastport0rcv_cnt = ipath_stats.sps_port0pkts; } diff --git a/drivers/infiniband/hw/ipath/ipath_sysfs.c b/drivers/infiniband/hw/ipath/ipath_sysfs.c index f323791cc49..b98821d7801 100644 --- a/drivers/infiniband/hw/ipath/ipath_sysfs.c +++ b/drivers/infiniband/hw/ipath/ipath_sysfs.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -34,8 +35,8 @@ #include <linux/pci.h> #include "ipath_kernel.h" -#include "ips_common.h" #include "ipath_layer.h" +#include "ipath_common.h" /** * ipath_parse_ushort - parse an unsigned short value in an arbitrary base @@ -84,99 +85,6 @@ static ssize_t show_num_units(struct device_driver *dev, char *buf) ipath_count_units(NULL, NULL, NULL)); } -#define DRIVER_STAT(name, attr) \ - static ssize_t show_stat_##name(struct device_driver *dev, \ - char *buf) \ - { \ - return scnprintf( \ - buf, PAGE_SIZE, "%llu\n", \ - (unsigned long long) ipath_stats.sps_ ##attr); \ - } \ - static DRIVER_ATTR(name, S_IRUGO, show_stat_##name, NULL) - -DRIVER_STAT(intrs, ints); -DRIVER_STAT(err_intrs, errints); -DRIVER_STAT(errs, errs); -DRIVER_STAT(pkt_errs, pkterrs); -DRIVER_STAT(crc_errs, crcerrs); -DRIVER_STAT(hw_errs, hwerrs); -DRIVER_STAT(ib_link, iblink); -DRIVER_STAT(port0_pkts, port0pkts); -DRIVER_STAT(ether_spkts, ether_spkts); -DRIVER_STAT(ether_rpkts, ether_rpkts); -DRIVER_STAT(sma_spkts, sma_spkts); -DRIVER_STAT(sma_rpkts, sma_rpkts); -DRIVER_STAT(hdrq_full, hdrqfull); -DRIVER_STAT(etid_full, etidfull); -DRIVER_STAT(no_piobufs, nopiobufs); -DRIVER_STAT(ports, ports); -DRIVER_STAT(pkey0, pkeys[0]); -DRIVER_STAT(pkey1, pkeys[1]); -DRIVER_STAT(pkey2, pkeys[2]); -DRIVER_STAT(pkey3, pkeys[3]); -/* XXX fix the following when dynamic table of devices used */ -DRIVER_STAT(lid0, lid[0]); -DRIVER_STAT(lid1, lid[1]); -DRIVER_STAT(lid2, lid[2]); -DRIVER_STAT(lid3, lid[3]); - -DRIVER_STAT(nports, nports); -DRIVER_STAT(null_intr, nullintr); -DRIVER_STAT(max_pkts_call, maxpkts_call); -DRIVER_STAT(avg_pkts_call, avgpkts_call); -DRIVER_STAT(page_locks, pagelocks); -DRIVER_STAT(page_unlocks, pageunlocks); -DRIVER_STAT(krdrops, krdrops); -/* XXX fix the following when dynamic table of devices used */ -DRIVER_STAT(mlid0, mlid[0]); -DRIVER_STAT(mlid1, mlid[1]); -DRIVER_STAT(mlid2, mlid[2]); -DRIVER_STAT(mlid3, mlid[3]); - -static struct attribute *driver_stat_attributes[] = { - &driver_attr_intrs.attr, - &driver_attr_err_intrs.attr, - &driver_attr_errs.attr, - &driver_attr_pkt_errs.attr, - &driver_attr_crc_errs.attr, - &driver_attr_hw_errs.attr, - &driver_attr_ib_link.attr, - &driver_attr_port0_pkts.attr, - &driver_attr_ether_spkts.attr, - &driver_attr_ether_rpkts.attr, - &driver_attr_sma_spkts.attr, - &driver_attr_sma_rpkts.attr, - &driver_attr_hdrq_full.attr, - &driver_attr_etid_full.attr, - &driver_attr_no_piobufs.attr, - &driver_attr_ports.attr, - &driver_attr_pkey0.attr, - &driver_attr_pkey1.attr, - &driver_attr_pkey2.attr, - &driver_attr_pkey3.attr, - &driver_attr_lid0.attr, - &driver_attr_lid1.attr, - &driver_attr_lid2.attr, - &driver_attr_lid3.attr, - &driver_attr_nports.attr, - &driver_attr_null_intr.attr, - &driver_attr_max_pkts_call.attr, - &driver_attr_avg_pkts_call.attr, - &driver_attr_page_locks.attr, - &driver_attr_page_unlocks.attr, - &driver_attr_krdrops.attr, - &driver_attr_mlid0.attr, - &driver_attr_mlid1.attr, - &driver_attr_mlid2.attr, - &driver_attr_mlid3.attr, - NULL -}; - -static struct attribute_group driver_stat_attr_group = { - .name = "stats", - .attrs = driver_stat_attributes -}; - static ssize_t show_status(struct device *dev, struct device_attribute *attr, char *buf) @@ -272,23 +180,23 @@ static ssize_t store_lid(struct device *dev, size_t count) { struct ipath_devdata *dd = dev_get_drvdata(dev); - u16 lid; + u16 lid = 0; int ret; ret = ipath_parse_ushort(buf, &lid); if (ret < 0) goto invalid; - if (lid == 0 || lid >= 0xc000) { + if (lid == 0 || lid >= IPATH_MULTICAST_LID_BASE) { ret = -EINVAL; goto invalid; } - ipath_set_sps_lid(dd, lid, 0); + ipath_set_lid(dd, lid, 0); goto bail; invalid: - ipath_dev_err(dd, "attempt to set invalid LID\n"); + ipath_dev_err(dd, "attempt to set invalid LID 0x%x\n", lid); bail: return ret; } @@ -313,13 +221,12 @@ static ssize_t store_mlid(struct device *dev, int ret; ret = ipath_parse_ushort(buf, &mlid); - if (ret < 0) + if (ret < 0 || mlid < IPATH_MULTICAST_LID_BASE) goto invalid; unit = dd->ipath_unit; dd->ipath_mlid = mlid; - ipath_stats.sps_mlid[unit] = mlid; ipath_layer_intr(dd, IPATH_LAYER_INT_BCAST); goto bail; @@ -734,20 +641,12 @@ int ipath_driver_create_group(struct device_driver *drv) int ret; ret = sysfs_create_group(&drv->kobj, &driver_attr_group); - if (ret) - goto bail; - ret = sysfs_create_group(&drv->kobj, &driver_stat_attr_group); - if (ret) - sysfs_remove_group(&drv->kobj, &driver_attr_group); - -bail: return ret; } void ipath_driver_remove_group(struct device_driver *drv) { - sysfs_remove_group(&drv->kobj, &driver_stat_attr_group); sysfs_remove_group(&drv->kobj, &driver_attr_group); } diff --git a/drivers/infiniband/hw/ipath/ipath_uc.c b/drivers/infiniband/hw/ipath/ipath_uc.c index 0d6dbc0a541..c33abea2d5a 100644 --- a/drivers/infiniband/hw/ipath/ipath_uc.c +++ b/drivers/infiniband/hw/ipath/ipath_uc.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -31,7 +32,7 @@ */ #include "ipath_verbs.h" -#include "ips_common.h" +#include "ipath_common.h" /* cut down ridiculously long IB macro names */ #define OP(x) IB_OPCODE_UC_##x @@ -61,90 +62,40 @@ static void complete_last_send(struct ipath_qp *qp, struct ipath_swqe *wqe, } /** - * ipath_do_uc_send - do a send on a UC queue - * @data: contains a pointer to the QP to send on + * ipath_make_uc_req - construct a request packet (SEND, RDMA write) + * @qp: a pointer to the QP + * @ohdr: a pointer to the IB header being constructed + * @pmtu: the path MTU + * @bth0p: pointer to the BTH opcode word + * @bth2p: pointer to the BTH PSN word * - * Process entries in the send work queue until the queue is exhausted. - * Only allow one CPU to send a packet per QP (tasklet). - * Otherwise, after we drop the QP lock, two threads could send - * packets out of order. - * This is similar to ipath_do_rc_send() below except we don't have - * timeouts or resends. + * Return 1 if constructed; otherwise, return 0. + * Note the QP s_lock must be held and interrupts disabled. */ -void ipath_do_uc_send(unsigned long data) +int ipath_make_uc_req(struct ipath_qp *qp, + struct ipath_other_headers *ohdr, + u32 pmtu, u32 *bth0p, u32 *bth2p) { - struct ipath_qp *qp = (struct ipath_qp *)data; - struct ipath_ibdev *dev = to_idev(qp->ibqp.device); struct ipath_swqe *wqe; - unsigned long flags; - u16 lrh0; u32 hwords; - u32 nwords; - u32 extra_bytes; u32 bth0; - u32 bth2; - u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); u32 len; - struct ipath_other_headers *ohdr; struct ib_wc wc; - if (test_and_set_bit(IPATH_S_BUSY, &qp->s_flags)) - goto bail; - - if (unlikely(qp->remote_ah_attr.dlid == - ipath_layer_get_lid(dev->dd))) { - /* Pass in an uninitialized ib_wc to save stack space. */ - ipath_ruc_loopback(qp, &wc); - clear_bit(IPATH_S_BUSY, &qp->s_flags); - goto bail; - } - - ohdr = &qp->s_hdr.u.oth; - if (qp->remote_ah_attr.ah_flags & IB_AH_GRH) - ohdr = &qp->s_hdr.u.l.oth; - -again: - /* Check for a constructed packet to be sent. */ - if (qp->s_hdrwords != 0) { - /* - * If no PIO bufs are available, return. - * An interrupt will call ipath_ib_piobufavail() - * when one is available. - */ - if (ipath_verbs_send(dev->dd, qp->s_hdrwords, - (u32 *) &qp->s_hdr, - qp->s_cur_size, - qp->s_cur_sge)) { - ipath_no_bufs_available(qp, dev); - goto bail; - } - dev->n_unicast_xmit++; - /* Record that we sent the packet and s_hdr is empty. */ - qp->s_hdrwords = 0; - } - - lrh0 = IPS_LRH_BTH; - /* header size in 32-bit words LRH+BTH = (8+12)/4. */ - hwords = 5; - - /* - * The lock is needed to synchronize between - * setting qp->s_ack_state and post_send(). - */ - spin_lock_irqsave(&qp->s_lock, flags); - if (!(ib_ipath_state_ops[qp->state] & IPATH_PROCESS_SEND_OK)) goto done; - bth0 = ipath_layer_get_pkey(dev->dd, qp->s_pkey_index); + /* header size in 32-bit words LRH+BTH = (8+12)/4. */ + hwords = 5; + bth0 = 0; - /* Send a request. */ + /* Get the next send request. */ wqe = get_swqe_ptr(qp, qp->s_last); switch (qp->s_state) { default: /* - * Signal the completion of the last send (if there is - * one). + * Signal the completion of the last send + * (if there is one). */ if (qp->s_last != qp->s_tail) complete_last_send(qp, wqe, &wc); @@ -257,61 +208,16 @@ again: } break; } - bth2 = qp->s_next_psn++ & IPS_PSN_MASK; qp->s_len -= len; - bth0 |= qp->s_state << 24; - - spin_unlock_irqrestore(&qp->s_lock, flags); - - /* Construct the header. */ - extra_bytes = (4 - len) & 3; - nwords = (len + extra_bytes) >> 2; - if (unlikely(qp->remote_ah_attr.ah_flags & IB_AH_GRH)) { - /* Header size in 32-bit words. */ - hwords += 10; - lrh0 = IPS_LRH_GRH; - qp->s_hdr.u.l.grh.version_tclass_flow = - cpu_to_be32((6 << 28) | - (qp->remote_ah_attr.grh.traffic_class - << 20) | - qp->remote_ah_attr.grh.flow_label); - qp->s_hdr.u.l.grh.paylen = - cpu_to_be16(((hwords - 12) + nwords + - SIZE_OF_CRC) << 2); - /* next_hdr is defined by C8-7 in ch. 8.4.1 */ - qp->s_hdr.u.l.grh.next_hdr = 0x1B; - qp->s_hdr.u.l.grh.hop_limit = - qp->remote_ah_attr.grh.hop_limit; - /* The SGID is 32-bit aligned. */ - qp->s_hdr.u.l.grh.sgid.global.subnet_prefix = - dev->gid_prefix; - qp->s_hdr.u.l.grh.sgid.global.interface_id = - ipath_layer_get_guid(dev->dd); - qp->s_hdr.u.l.grh.dgid = qp->remote_ah_attr.grh.dgid; - } qp->s_hdrwords = hwords; qp->s_cur_sge = &qp->s_sge; qp->s_cur_size = len; - lrh0 |= qp->remote_ah_attr.sl << 4; - qp->s_hdr.lrh[0] = cpu_to_be16(lrh0); - /* DEST LID */ - qp->s_hdr.lrh[1] = cpu_to_be16(qp->remote_ah_attr.dlid); - qp->s_hdr.lrh[2] = cpu_to_be16(hwords + nwords + SIZE_OF_CRC); - qp->s_hdr.lrh[3] = cpu_to_be16(ipath_layer_get_lid(dev->dd)); - bth0 |= extra_bytes << 20; - ohdr->bth[0] = cpu_to_be32(bth0); - ohdr->bth[1] = cpu_to_be32(qp->remote_qpn); - ohdr->bth[2] = cpu_to_be32(bth2); - - /* Check for more work to do. */ - goto again; + *bth0p = bth0 | (qp->s_state << 24); + *bth2p = qp->s_next_psn++ & IPATH_PSN_MASK; + return 1; done: - spin_unlock_irqrestore(&qp->s_lock, flags); - clear_bit(IPATH_S_BUSY, &qp->s_flags); - -bail: - return; + return 0; } /** @@ -335,7 +241,6 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, u32 hdrsize; u32 psn; u32 pad; - unsigned long flags; struct ib_wc wc; u32 pmtu = ib_mtu_enum_to_int(qp->path_mtu); struct ib_reth *reth; @@ -373,8 +278,6 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, wc.imm_data = 0; wc.wc_flags = 0; - spin_lock_irqsave(&qp->r_rq.lock, flags); - /* Compare the PSN verses the expected PSN. */ if (unlikely(ipath_cmp24(psn, qp->r_psn) != 0)) { /* @@ -535,12 +438,13 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, if (qp->r_len != 0) { u32 rkey = be32_to_cpu(reth->rkey); u64 vaddr = be64_to_cpu(reth->vaddr); + int ok; /* Check rkey */ - if (unlikely(!ipath_rkey_ok( - dev, &qp->r_sge, qp->r_len, - vaddr, rkey, - IB_ACCESS_REMOTE_WRITE))) { + ok = ipath_rkey_ok(dev, &qp->r_sge, qp->r_len, + vaddr, rkey, + IB_ACCESS_REMOTE_WRITE); + if (unlikely(!ok)) { dev->n_pkt_drops++; goto done; } @@ -558,8 +462,7 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, } if (opcode == OP(RDMA_WRITE_ONLY)) goto rdma_last; - else if (opcode == - OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE)) + else if (opcode == OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE)) goto rdma_last_imm; /* FALLTHROUGH */ case OP(RDMA_WRITE_MIDDLE): @@ -592,9 +495,9 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, dev->n_pkt_drops++; goto done; } - if (qp->r_reuse_sge) { + if (qp->r_reuse_sge) qp->r_reuse_sge = 0; - } else if (!ipath_get_rwqe(qp, 1)) { + else if (!ipath_get_rwqe(qp, 1)) { dev->n_pkt_drops++; goto done; } @@ -631,15 +534,11 @@ void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, default: /* Drop packet for unknown opcodes. */ - spin_unlock_irqrestore(&qp->r_rq.lock, flags); dev->n_pkt_drops++; - goto bail; + goto done; } qp->r_psn++; qp->r_state = opcode; done: - spin_unlock_irqrestore(&qp->r_rq.lock, flags); - -bail: return; } diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c index e606daf8321..3466129af80 100644 --- a/drivers/infiniband/hw/ipath/ipath_ud.c +++ b/drivers/infiniband/hw/ipath/ipath_ud.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -33,7 +34,7 @@ #include <rdma/ib_smi.h> #include "ipath_verbs.h" -#include "ips_common.h" +#include "ipath_common.h" /** * ipath_ud_loopback - handle send on loopback QPs @@ -274,6 +275,11 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr) len += wr->sg_list[i].length; ss.num_sge++; } + /* Check for invalid packet size. */ + if (len > ipath_layer_get_ibmtu(dev->dd)) { + ret = -EINVAL; + goto bail; + } extra_bytes = (4 - len) & 3; nwords = (len + extra_bytes) >> 2; @@ -283,8 +289,8 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr) ret = -EINVAL; goto bail; } - if (ah_attr->dlid >= IPS_MULTICAST_LID_BASE) { - if (ah_attr->dlid != IPS_PERMISSIVE_LID) + if (ah_attr->dlid >= IPATH_MULTICAST_LID_BASE) { + if (ah_attr->dlid != IPATH_PERMISSIVE_LID) dev->n_multicast_xmit++; else dev->n_unicast_xmit++; @@ -304,7 +310,7 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr) if (ah_attr->ah_flags & IB_AH_GRH) { /* Header size in 32-bit words. */ hwords = 17; - lrh0 = IPS_LRH_GRH; + lrh0 = IPATH_LRH_GRH; ohdr = &qp->s_hdr.u.l.oth; qp->s_hdr.u.l.grh.version_tclass_flow = cpu_to_be32((6 << 28) | @@ -330,7 +336,7 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr) } else { /* Header size in 32-bit words. */ hwords = 7; - lrh0 = IPS_LRH_BTH; + lrh0 = IPATH_LRH_BTH; ohdr = &qp->s_hdr.u.oth; } if (wr->opcode == IB_WR_SEND_WITH_IMM) { @@ -361,18 +367,18 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr) if (wr->send_flags & IB_SEND_SOLICITED) bth0 |= 1 << 23; bth0 |= extra_bytes << 20; - bth0 |= qp->ibqp.qp_type == IB_QPT_SMI ? IPS_DEFAULT_P_KEY : + bth0 |= qp->ibqp.qp_type == IB_QPT_SMI ? IPATH_DEFAULT_P_KEY : ipath_layer_get_pkey(dev->dd, qp->s_pkey_index); ohdr->bth[0] = cpu_to_be32(bth0); /* * Use the multicast QP if the destination LID is a multicast LID. */ - ohdr->bth[1] = ah_attr->dlid >= IPS_MULTICAST_LID_BASE && - ah_attr->dlid != IPS_PERMISSIVE_LID ? - __constant_cpu_to_be32(IPS_MULTICAST_QPN) : + ohdr->bth[1] = ah_attr->dlid >= IPATH_MULTICAST_LID_BASE && + ah_attr->dlid != IPATH_PERMISSIVE_LID ? + __constant_cpu_to_be32(IPATH_MULTICAST_QPN) : cpu_to_be32(wr->wr.ud.remote_qpn); /* XXX Could lose a PSN count but not worth locking */ - ohdr->bth[2] = cpu_to_be32(qp->s_next_psn++ & IPS_PSN_MASK); + ohdr->bth[2] = cpu_to_be32(qp->s_next_psn++ & IPATH_PSN_MASK); /* * Qkeys with the high order bit set mean use the * qkey from the QP context instead of the WR (see 10.2.5). @@ -463,7 +469,7 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, src_qp = be32_to_cpu(ohdr->u.ud.deth[1]); } } - src_qp &= IPS_QPN_MASK; + src_qp &= IPATH_QPN_MASK; /* * Check that the permissive LID is only used on QP0 @@ -554,7 +560,16 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, spin_lock_irqsave(&rq->lock, flags); if (rq->tail == rq->head) { spin_unlock_irqrestore(&rq->lock, flags); - dev->n_pkt_drops++; + /* + * Count VL15 packets dropped due to no receive buffer. + * Otherwise, count them as buffer overruns since usually, + * the HW will be able to receive packets even if there are + * no QPs with posted receive buffers. + */ + if (qp->ibqp.qp_num == 0) + dev->n_vl15_dropped++; + else + dev->rcv_errors++; goto bail; } /* Silently drop packets which are too big. */ @@ -612,7 +627,7 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, /* * Save the LMC lower bits if the destination LID is a unicast LID. */ - wc.dlid_path_bits = dlid >= IPS_MULTICAST_LID_BASE ? 0 : + wc.dlid_path_bits = dlid >= IPATH_MULTICAST_LID_BASE ? 0 : dlid & ((1 << (dev->mkeyprot_resv_lmc & 7)) - 1); /* Signal completion event if the solicited bit is set. */ ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, diff --git a/drivers/infiniband/hw/ipath/ipath_user_pages.c b/drivers/infiniband/hw/ipath/ipath_user_pages.c index 2bb08afc86d..e32fca9faf8 100644 --- a/drivers/infiniband/hw/ipath/ipath_user_pages.c +++ b/drivers/infiniband/hw/ipath/ipath_user_pages.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -57,17 +58,6 @@ static int __get_user_pages(unsigned long start_page, size_t num_pages, size_t got; int ret; -#if 0 - /* - * XXX - causes MPI programs to fail, haven't had time to check - * yet - */ - if (!capable(CAP_IPC_LOCK)) { - ret = -EPERM; - goto bail; - } -#endif - lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT; diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index 28fdbdaa789..56ac336dd1e 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -36,7 +37,7 @@ #include "ipath_kernel.h" #include "ipath_verbs.h" -#include "ips_common.h" +#include "ipath_common.h" /* Not static, because we don't want the compiler removing it */ const char ipath_verbs_version[] = "ipath_verbs " IPATH_IDSTR; @@ -55,9 +56,62 @@ unsigned int ib_ipath_debug; /* debug mask */ module_param_named(debug, ib_ipath_debug, uint, S_IWUSR | S_IRUGO); MODULE_PARM_DESC(debug, "Verbs debug mask"); +static unsigned int ib_ipath_max_pds = 0xFFFF; +module_param_named(max_pds, ib_ipath_max_pds, uint, S_IWUSR | S_IRUGO); +MODULE_PARM_DESC(max_pds, + "Maximum number of protection domains to support"); + +static unsigned int ib_ipath_max_ahs = 0xFFFF; +module_param_named(max_ahs, ib_ipath_max_ahs, uint, S_IWUSR | S_IRUGO); +MODULE_PARM_DESC(max_ahs, "Maximum number of address handles to support"); + +unsigned int ib_ipath_max_cqes = 0x2FFFF; +module_param_named(max_cqes, ib_ipath_max_cqes, uint, S_IWUSR | S_IRUGO); +MODULE_PARM_DESC(max_cqes, + "Maximum number of completion queue entries to support"); + +unsigned int ib_ipath_max_cqs = 0x1FFFF; +module_param_named(max_cqs, ib_ipath_max_cqs, uint, S_IWUSR | S_IRUGO); +MODULE_PARM_DESC(max_cqs, "Maximum number of completion queues to support"); + +unsigned int ib_ipath_max_qp_wrs = 0x3FFF; +module_param_named(max_qp_wrs, ib_ipath_max_qp_wrs, uint, + S_IWUSR | S_IRUGO); +MODULE_PARM_DESC(max_qp_wrs, "Maximum number of QP WRs to support"); + +unsigned int ib_ipath_max_sges = 0x60; +module_param_named(max_sges, ib_ipath_max_sges, uint, S_IWUSR | S_IRUGO); +MODULE_PARM_DESC(max_sges, "Maximum number of SGEs to support"); + +unsigned int ib_ipath_max_mcast_grps = 16384; +module_param_named(max_mcast_grps, ib_ipath_max_mcast_grps, uint, + S_IWUSR | S_IRUGO); +MODULE_PARM_DESC(max_mcast_grps, + "Maximum number of multicast groups to support"); + +unsigned int ib_ipath_max_mcast_qp_attached = 16; +module_param_named(max_mcast_qp_attached, ib_ipath_max_mcast_qp_attached, + uint, S_IWUSR | S_IRUGO); +MODULE_PARM_DESC(max_mcast_qp_attached, + "Maximum number of attached QPs to support"); + +unsigned int ib_ipath_max_srqs = 1024; +module_param_named(max_srqs, ib_ipath_max_srqs, uint, S_IWUSR | S_IRUGO); +MODULE_PARM_DESC(max_srqs, "Maximum number of SRQs to support"); + +unsigned int ib_ipath_max_srq_sges = 128; +module_param_named(max_srq_sges, ib_ipath_max_srq_sges, + uint, S_IWUSR | S_IRUGO); +MODULE_PARM_DESC(max_srq_sges, "Maximum number of SRQ SGEs to support"); + +unsigned int ib_ipath_max_srq_wrs = 0x1FFFF; +module_param_named(max_srq_wrs, ib_ipath_max_srq_wrs, + uint, S_IWUSR | S_IRUGO); +MODULE_PARM_DESC(max_srq_wrs, "Maximum number of SRQ WRs support"); + MODULE_LICENSE("GPL"); -MODULE_AUTHOR("PathScale <support@pathscale.com>"); -MODULE_DESCRIPTION("Pathscale InfiniPath driver"); +MODULE_AUTHOR("QLogic <support@pathscale.com>"); +MODULE_DESCRIPTION("QLogic InfiniPath driver"); const int ib_ipath_state_ops[IB_QPS_ERR + 1] = { [IB_QPS_RESET] = 0, @@ -193,7 +247,7 @@ static int ipath_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, switch (qp->ibqp.qp_type) { case IB_QPT_UC: case IB_QPT_RC: - err = ipath_post_rc_send(qp, wr); + err = ipath_post_ruc_send(qp, wr); break; case IB_QPT_SMI: @@ -375,7 +429,7 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen) /* Check for a valid destination LID (see ch. 7.11.1). */ lid = be16_to_cpu(hdr->lrh[1]); - if (lid < IPS_MULTICAST_LID_BASE) { + if (lid < IPATH_MULTICAST_LID_BASE) { lid &= ~((1 << (dev->mkeyprot_resv_lmc & 7)) - 1); if (unlikely(lid != ipath_layer_get_lid(dev->dd))) { dev->rcv_errors++; @@ -385,9 +439,9 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen) /* Check for GRH */ lnh = be16_to_cpu(hdr->lrh[0]) & 3; - if (lnh == IPS_LRH_BTH) + if (lnh == IPATH_LRH_BTH) ohdr = &hdr->u.oth; - else if (lnh == IPS_LRH_GRH) + else if (lnh == IPATH_LRH_GRH) ohdr = &hdr->u.l.oth; else { dev->rcv_errors++; @@ -399,8 +453,8 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen) dev->opstats[opcode].n_packets++; /* Get the destination QP number. */ - qp_num = be32_to_cpu(ohdr->bth[1]) & IPS_QPN_MASK; - if (qp_num == IPS_MULTICAST_QPN) { + qp_num = be32_to_cpu(ohdr->bth[1]) & IPATH_QPN_MASK; + if (qp_num == IPATH_MULTICAST_QPN) { struct ipath_mcast *mcast; struct ipath_mcast_qp *p; @@ -411,7 +465,7 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen) } dev->n_multicast_rcv++; list_for_each_entry_rcu(p, &mcast->qp_list, list) - ipath_qp_rcv(dev, hdr, lnh == IPS_LRH_GRH, data, + ipath_qp_rcv(dev, hdr, lnh == IPATH_LRH_GRH, data, tlen, p->qp); /* * Notify ipath_multicast_detach() if it is waiting for us @@ -423,7 +477,7 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen) qp = ipath_lookup_qpn(&dev->qp_table, qp_num); if (qp) { dev->n_unicast_rcv++; - ipath_qp_rcv(dev, hdr, lnh == IPS_LRH_GRH, data, + ipath_qp_rcv(dev, hdr, lnh == IPATH_LRH_GRH, data, tlen, qp); /* * Notify ipath_destroy_qp() if it is waiting @@ -567,40 +621,38 @@ static int ipath_query_device(struct ib_device *ibdev, struct ib_device_attr *props) { struct ipath_ibdev *dev = to_idev(ibdev); - u32 vendor, boardrev, majrev, minrev; memset(props, 0, sizeof(*props)); props->device_cap_flags = IB_DEVICE_BAD_PKEY_CNTR | IB_DEVICE_BAD_QKEY_CNTR | IB_DEVICE_SHUTDOWN_PORT | IB_DEVICE_SYS_IMAGE_GUID; - ipath_layer_query_device(dev->dd, &vendor, &boardrev, - &majrev, &minrev); - props->vendor_id = vendor; - props->vendor_part_id = boardrev; - props->hw_ver = boardrev << 16 | majrev << 8 | minrev; + props->vendor_id = ipath_layer_get_vendorid(dev->dd); + props->vendor_part_id = ipath_layer_get_deviceid(dev->dd); + props->hw_ver = ipath_layer_get_pcirev(dev->dd); props->sys_image_guid = dev->sys_image_guid; props->max_mr_size = ~0ull; - props->max_qp = 0xffff; - props->max_qp_wr = 0xffff; - props->max_sge = 255; - props->max_cq = 0xffff; - props->max_cqe = 0xffff; - props->max_mr = 0xffff; - props->max_pd = 0xffff; + props->max_qp = dev->qp_table.max; + props->max_qp_wr = ib_ipath_max_qp_wrs; + props->max_sge = ib_ipath_max_sges; + props->max_cq = ib_ipath_max_cqs; + props->max_ah = ib_ipath_max_ahs; + props->max_cqe = ib_ipath_max_cqes; + props->max_mr = dev->lk_table.max; + props->max_pd = ib_ipath_max_pds; props->max_qp_rd_atom = 1; props->max_qp_init_rd_atom = 1; /* props->max_res_rd_atom */ - props->max_srq = 0xffff; - props->max_srq_wr = 0xffff; - props->max_srq_sge = 255; + props->max_srq = ib_ipath_max_srqs; + props->max_srq_wr = ib_ipath_max_srq_wrs; + props->max_srq_sge = ib_ipath_max_srq_sges; /* props->local_ca_ack_delay */ props->atomic_cap = IB_ATOMIC_HCA; props->max_pkeys = ipath_layer_get_npkeys(dev->dd); - props->max_mcast_grp = 0xffff; - props->max_mcast_qp_attach = 0xffff; + props->max_mcast_grp = ib_ipath_max_mcast_grps; + props->max_mcast_qp_attach = ib_ipath_max_mcast_qp_attached; props->max_total_mcast_qp_attach = props->max_mcast_qp_attach * props->max_mcast_grp; @@ -643,10 +695,10 @@ static int ipath_query_port(struct ib_device *ibdev, ipath_layer_get_lastibcstat(dev->dd) & 0xf]; props->port_cap_flags = dev->port_cap_flags; props->gid_tbl_len = 1; - props->max_msg_sz = 4096; + props->max_msg_sz = 0x80000000; props->pkey_tbl_len = ipath_layer_get_npkeys(dev->dd); props->bad_pkey_cntr = ipath_layer_get_cr_errpkey(dev->dd) - - dev->n_pkey_violations; + dev->z_pkey_violations; props->qkey_viol_cntr = dev->qkey_violations; props->active_width = IB_WIDTH_4X; /* See rate_show() */ @@ -743,15 +795,30 @@ static struct ib_pd *ipath_alloc_pd(struct ib_device *ibdev, struct ib_ucontext *context, struct ib_udata *udata) { + struct ipath_ibdev *dev = to_idev(ibdev); struct ipath_pd *pd; struct ib_pd *ret; + /* + * This is actually totally arbitrary. Some correctness tests + * assume there's a maximum number of PDs that can be allocated. + * We don't actually have this limit, but we fail the test if + * we allow allocations of more than we report for this value. + */ + + if (dev->n_pds_allocated == ib_ipath_max_pds) { + ret = ERR_PTR(-ENOMEM); + goto bail; + } + pd = kmalloc(sizeof *pd, GFP_KERNEL); if (!pd) { ret = ERR_PTR(-ENOMEM); goto bail; } + dev->n_pds_allocated++; + /* ib_alloc_pd() will initialize pd->ibpd. */ pd->user = udata != NULL; @@ -764,6 +831,9 @@ bail: static int ipath_dealloc_pd(struct ib_pd *ibpd) { struct ipath_pd *pd = to_ipd(ibpd); + struct ipath_ibdev *dev = to_idev(ibpd->device); + + dev->n_pds_allocated--; kfree(pd); @@ -782,21 +852,40 @@ static struct ib_ah *ipath_create_ah(struct ib_pd *pd, { struct ipath_ah *ah; struct ib_ah *ret; + struct ipath_ibdev *dev = to_idev(pd->device); + + if (dev->n_ahs_allocated == ib_ipath_max_ahs) { + ret = ERR_PTR(-ENOMEM); + goto bail; + } /* A multicast address requires a GRH (see ch. 8.4.1). */ - if (ah_attr->dlid >= IPS_MULTICAST_LID_BASE && - ah_attr->dlid != IPS_PERMISSIVE_LID && + if (ah_attr->dlid >= IPATH_MULTICAST_LID_BASE && + ah_attr->dlid != IPATH_PERMISSIVE_LID && !(ah_attr->ah_flags & IB_AH_GRH)) { ret = ERR_PTR(-EINVAL); goto bail; } + if (ah_attr->dlid == 0) { + ret = ERR_PTR(-EINVAL); + goto bail; + } + + if (ah_attr->port_num < 1 || + ah_attr->port_num > pd->device->phys_port_cnt) { + ret = ERR_PTR(-EINVAL); + goto bail; + } + ah = kmalloc(sizeof *ah, GFP_ATOMIC); if (!ah) { ret = ERR_PTR(-ENOMEM); goto bail; } + dev->n_ahs_allocated++; + /* ib_create_ah() will initialize ah->ibah. */ ah->attr = *ah_attr; @@ -814,8 +903,11 @@ bail: */ static int ipath_destroy_ah(struct ib_ah *ibah) { + struct ipath_ibdev *dev = to_idev(ibah->device); struct ipath_ah *ah = to_iah(ibah); + dev->n_ahs_allocated--; + kfree(ah); return 0; @@ -889,6 +981,7 @@ static int ipath_verbs_register_sysfs(struct ib_device *dev); */ static void *ipath_register_ib_device(int unit, struct ipath_devdata *dd) { + struct ipath_layer_counters cntrs; struct ipath_ibdev *idev; struct ib_device *dev; int ret; @@ -939,6 +1032,25 @@ static void *ipath_register_ib_device(int unit, struct ipath_devdata *dd) idev->pma_counter_select[5] = IB_PMA_PORT_XMIT_WAIT; idev->link_width_enabled = 3; /* 1x or 4x */ + /* Snapshot current HW counters to "clear" them. */ + ipath_layer_get_counters(dd, &cntrs); + idev->z_symbol_error_counter = cntrs.symbol_error_counter; + idev->z_link_error_recovery_counter = + cntrs.link_error_recovery_counter; + idev->z_link_downed_counter = cntrs.link_downed_counter; + idev->z_port_rcv_errors = cntrs.port_rcv_errors; + idev->z_port_rcv_remphys_errors = + cntrs.port_rcv_remphys_errors; + idev->z_port_xmit_discards = cntrs.port_xmit_discards; + idev->z_port_xmit_data = cntrs.port_xmit_data; + idev->z_port_rcv_data = cntrs.port_rcv_data; + idev->z_port_xmit_packets = cntrs.port_xmit_packets; + idev->z_port_rcv_packets = cntrs.port_rcv_packets; + idev->z_local_link_integrity_errors = + cntrs.local_link_integrity_errors; + idev->z_excessive_buffer_overrun_errors = + cntrs.excessive_buffer_overrun_errors; + /* * The system image GUID is supposed to be the same for all * IB HCAs in a single system but since there can be other @@ -1109,11 +1221,8 @@ static ssize_t show_rev(struct class_device *cdev, char *buf) { struct ipath_ibdev *dev = container_of(cdev, struct ipath_ibdev, ibdev.class_dev); - int vendor, boardrev, majrev, minrev; - ipath_layer_query_device(dev->dd, &vendor, &boardrev, - &majrev, &minrev); - return sprintf(buf, "%d.%d\n", majrev, minrev); + return sprintf(buf, "%x\n", ipath_layer_get_pcirev(dev->dd)); } static ssize_t show_hca(struct class_device *cdev, char *buf) diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.h b/drivers/infiniband/hw/ipath/ipath_verbs.h index 4f8d59300e9..2df684727dc 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.h +++ b/drivers/infiniband/hw/ipath/ipath_verbs.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -148,6 +149,7 @@ struct ipath_mcast { struct list_head qp_list; wait_queue_head_t wait; atomic_t refcount; + int n_attached; }; /* Memory region */ @@ -305,32 +307,34 @@ struct ipath_qp { u32 s_next_psn; /* PSN for next request */ u32 s_last_psn; /* last response PSN processed */ u32 s_psn; /* current packet sequence number */ + u32 s_ack_psn; /* PSN for RDMA_READ */ u32 s_rnr_timeout; /* number of milliseconds for RNR timeout */ - u32 s_ack_psn; /* PSN for next ACK or RDMA_READ */ - u64 s_ack_atomic; /* data for atomic ACK */ + u32 r_ack_psn; /* PSN for next ACK or atomic ACK */ u64 r_wr_id; /* ID for current receive WQE */ u64 r_atomic_data; /* data for last atomic op */ u32 r_atomic_psn; /* PSN of last atomic op */ u32 r_len; /* total length of r_sge */ u32 r_rcv_len; /* receive data len processed */ u32 r_psn; /* expected rcv packet sequence number */ + u32 r_msn; /* message sequence number */ u8 state; /* QP state */ u8 s_state; /* opcode of last packet sent */ u8 s_ack_state; /* opcode of packet to ACK */ u8 s_nak_state; /* non-zero if NAK is pending */ u8 r_state; /* opcode of last packet received */ + u8 r_ack_state; /* opcode of packet to ACK */ + u8 r_nak_state; /* non-zero if NAK is pending */ + u8 r_min_rnr_timer; /* retry timeout value for RNR NAKs */ u8 r_reuse_sge; /* for UC receive errors */ u8 r_sge_inx; /* current index into sg_list */ - u8 s_max_sge; /* size of s_wq->sg_list */ u8 qp_access_flags; + u8 s_max_sge; /* size of s_wq->sg_list */ u8 s_retry_cnt; /* number of times to retry */ u8 s_rnr_retry_cnt; - u8 s_min_rnr_timer; u8 s_retry; /* requester retry counter */ u8 s_rnr_retry; /* requester RNR retry counter */ u8 s_pkey_index; /* PKEY index to use */ enum ib_mtu path_mtu; - atomic_t msn; /* message sequence number */ u32 remote_qpn; u32 qkey; /* QKEY for this QP (for UD or RD) */ u32 s_size; /* send work queue size */ @@ -431,6 +435,11 @@ struct ipath_ibdev { __be64 sys_image_guid; /* in network order */ __be64 gid_prefix; /* in network order */ __be64 mkey; + u32 n_pds_allocated; /* number of PDs allocated for device */ + u32 n_ahs_allocated; /* number of AHs allocated for device */ + u32 n_cqs_allocated; /* number of CQs allocated for device */ + u32 n_srqs_allocated; /* number of SRQs allocated for device */ + u32 n_mcast_grps_allocated; /* number of mcast groups allocated */ u64 ipath_sword; /* total dwords sent (sample result) */ u64 ipath_rword; /* total dwords received (sample result) */ u64 ipath_spkts; /* total packets sent (sample result) */ @@ -442,17 +451,19 @@ struct ipath_ibdev { u64 n_unicast_rcv; /* total unicast packets received */ u64 n_multicast_xmit; /* total multicast packets sent */ u64 n_multicast_rcv; /* total multicast packets received */ - u64 n_symbol_error_counter; /* starting count for PMA */ - u64 n_link_error_recovery_counter; /* starting count for PMA */ - u64 n_link_downed_counter; /* starting count for PMA */ - u64 n_port_rcv_errors; /* starting count for PMA */ - u64 n_port_rcv_remphys_errors; /* starting count for PMA */ - u64 n_port_xmit_discards; /* starting count for PMA */ - u64 n_port_xmit_data; /* starting count for PMA */ - u64 n_port_rcv_data; /* starting count for PMA */ - u64 n_port_xmit_packets; /* starting count for PMA */ - u64 n_port_rcv_packets; /* starting count for PMA */ - u32 n_pkey_violations; /* starting count for PMA */ + u64 z_symbol_error_counter; /* starting count for PMA */ + u64 z_link_error_recovery_counter; /* starting count for PMA */ + u64 z_link_downed_counter; /* starting count for PMA */ + u64 z_port_rcv_errors; /* starting count for PMA */ + u64 z_port_rcv_remphys_errors; /* starting count for PMA */ + u64 z_port_xmit_discards; /* starting count for PMA */ + u64 z_port_xmit_data; /* starting count for PMA */ + u64 z_port_rcv_data; /* starting count for PMA */ + u64 z_port_xmit_packets; /* starting count for PMA */ + u64 z_port_rcv_packets; /* starting count for PMA */ + u32 z_pkey_violations; /* starting count for PMA */ + u32 z_local_link_integrity_errors; /* starting count for PMA */ + u32 z_excessive_buffer_overrun_errors; /* starting count for PMA */ u32 n_rc_resends; u32 n_rc_acks; u32 n_rc_qacks; @@ -462,6 +473,7 @@ struct ipath_ibdev { u32 n_other_naks; u32 n_timeouts; u32 n_pkt_drops; + u32 n_vl15_dropped; u32 n_wqe_errs; u32 n_rdma_dup_busy; u32 n_piowait; @@ -580,10 +592,6 @@ void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc); void ipath_get_credit(struct ipath_qp *qp, u32 aeth); -void ipath_do_rc_send(unsigned long data); - -void ipath_do_uc_send(unsigned long data); - void ipath_cq_enter(struct ipath_cq *cq, struct ib_wc *entry, int sig); int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss, @@ -596,7 +604,7 @@ void ipath_copy_sge(struct ipath_sge_state *ss, void *data, u32 length); void ipath_skip_sge(struct ipath_sge_state *ss, u32 length); -int ipath_post_rc_send(struct ipath_qp *qp, struct ib_send_wr *wr); +int ipath_post_ruc_send(struct ipath_qp *qp, struct ib_send_wr *wr); void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr, int has_grh, void *data, u32 tlen, struct ipath_qp *qp); @@ -678,7 +686,19 @@ void ipath_insert_rnr_queue(struct ipath_qp *qp); int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only); -void ipath_ruc_loopback(struct ipath_qp *sqp, struct ib_wc *wc); +u32 ipath_make_grh(struct ipath_ibdev *dev, struct ib_grh *hdr, + struct ib_global_route *grh, u32 hwords, u32 nwords); + +void ipath_do_ruc_send(unsigned long data); + +u32 ipath_make_rc_ack(struct ipath_qp *qp, struct ipath_other_headers *ohdr, + u32 pmtu); + +int ipath_make_rc_req(struct ipath_qp *qp, struct ipath_other_headers *ohdr, + u32 pmtu, u32 *bth0p, u32 *bth2p); + +int ipath_make_uc_req(struct ipath_qp *qp, struct ipath_other_headers *ohdr, + u32 pmtu, u32 *bth0p, u32 *bth2p); extern const enum ib_wc_opcode ib_ipath_wc_opcode[]; @@ -688,6 +708,24 @@ extern const int ib_ipath_state_ops[]; extern unsigned int ib_ipath_lkey_table_size; +extern unsigned int ib_ipath_max_cqes; + +extern unsigned int ib_ipath_max_cqs; + +extern unsigned int ib_ipath_max_qp_wrs; + +extern unsigned int ib_ipath_max_sges; + +extern unsigned int ib_ipath_max_mcast_grps; + +extern unsigned int ib_ipath_max_mcast_qp_attached; + +extern unsigned int ib_ipath_max_srqs; + +extern unsigned int ib_ipath_max_srq_sges; + +extern unsigned int ib_ipath_max_srq_wrs; + extern const u32 ib_ipath_rnr_table[]; #endif /* IPATH_VERBS_H */ diff --git a/drivers/infiniband/hw/ipath/ipath_verbs_mcast.c b/drivers/infiniband/hw/ipath/ipath_verbs_mcast.c index 10b31d2c4f2..ee0e1d96d72 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs_mcast.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs_mcast.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -92,6 +93,7 @@ static struct ipath_mcast *ipath_mcast_alloc(union ib_gid *mgid) INIT_LIST_HEAD(&mcast->qp_list); init_waitqueue_head(&mcast->wait); atomic_set(&mcast->refcount, 0); + mcast->n_attached = 0; bail: return mcast; @@ -157,7 +159,8 @@ bail: * the table but the QP was added. Return ESRCH if the QP was already * attached and neither structure was added. */ -static int ipath_mcast_add(struct ipath_mcast *mcast, +static int ipath_mcast_add(struct ipath_ibdev *dev, + struct ipath_mcast *mcast, struct ipath_mcast_qp *mqp) { struct rb_node **n = &mcast_tree.rb_node; @@ -188,34 +191,47 @@ static int ipath_mcast_add(struct ipath_mcast *mcast, /* Search the QP list to see if this is already there. */ list_for_each_entry_rcu(p, &tmcast->qp_list, list) { if (p->qp == mqp->qp) { - spin_unlock_irqrestore(&mcast_lock, flags); ret = ESRCH; goto bail; } } + if (tmcast->n_attached == ib_ipath_max_mcast_qp_attached) { + ret = ENOMEM; + goto bail; + } + + tmcast->n_attached++; + list_add_tail_rcu(&mqp->list, &tmcast->qp_list); - spin_unlock_irqrestore(&mcast_lock, flags); ret = EEXIST; goto bail; } + if (dev->n_mcast_grps_allocated == ib_ipath_max_mcast_grps) { + ret = ENOMEM; + goto bail; + } + + dev->n_mcast_grps_allocated++; + list_add_tail_rcu(&mqp->list, &mcast->qp_list); atomic_inc(&mcast->refcount); rb_link_node(&mcast->rb_node, pn, n); rb_insert_color(&mcast->rb_node, &mcast_tree); - spin_unlock_irqrestore(&mcast_lock, flags); - ret = 0; bail: + spin_unlock_irqrestore(&mcast_lock, flags); + return ret; } int ipath_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) { struct ipath_qp *qp = to_iqp(ibqp); + struct ipath_ibdev *dev = to_idev(ibqp->device); struct ipath_mcast *mcast; struct ipath_mcast_qp *mqp; int ret; @@ -235,7 +251,7 @@ int ipath_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) ret = -ENOMEM; goto bail; } - switch (ipath_mcast_add(mcast, mqp)) { + switch (ipath_mcast_add(dev, mcast, mqp)) { case ESRCH: /* Neither was used: can't attach the same QP twice. */ ipath_mcast_qp_free(mqp); @@ -245,6 +261,12 @@ int ipath_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) case EEXIST: /* The mcast wasn't used */ ipath_mcast_free(mcast); break; + case ENOMEM: + /* Exceeded the maximum number of mcast groups. */ + ipath_mcast_qp_free(mqp); + ipath_mcast_free(mcast); + ret = -ENOMEM; + goto bail; default: break; } @@ -258,6 +280,7 @@ bail: int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) { struct ipath_qp *qp = to_iqp(ibqp); + struct ipath_ibdev *dev = to_idev(ibqp->device); struct ipath_mcast *mcast = NULL; struct ipath_mcast_qp *p, *tmp; struct rb_node *n; @@ -272,7 +295,7 @@ int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) while (1) { if (n == NULL) { spin_unlock_irqrestore(&mcast_lock, flags); - ret = 0; + ret = -EINVAL; goto bail; } @@ -296,6 +319,7 @@ int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) * link until we are sure there are no list walkers. */ list_del_rcu(&p->list); + mcast->n_attached--; /* If this was the last attached QP, remove the GID too. */ if (list_empty(&mcast->qp_list)) { @@ -319,6 +343,7 @@ int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) atomic_dec(&mcast->refcount); wait_event(mcast->wait, !atomic_read(&mcast->refcount)); ipath_mcast_free(mcast); + dev->n_mcast_grps_allocated--; } ret = 0; diff --git a/drivers/infiniband/hw/ipath/ipath_wc_x86_64.c b/drivers/infiniband/hw/ipath/ipath_wc_x86_64.c index adc5322f15c..f8f9e2e8cbd 100644 --- a/drivers/infiniband/hw/ipath/ipath_wc_x86_64.c +++ b/drivers/infiniband/hw/ipath/ipath_wc_x86_64.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two diff --git a/drivers/infiniband/hw/ipath/ips_common.h b/drivers/infiniband/hw/ipath/ips_common.h deleted file mode 100644 index ab7cbbbfd03..00000000000 --- a/drivers/infiniband/hw/ipath/ips_common.h +++ /dev/null @@ -1,263 +0,0 @@ -#ifndef IPS_COMMON_H -#define IPS_COMMON_H -/* - * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU - * General Public License (GPL) Version 2, available from the file - * COPYING in the main directory of this source tree, or the - * OpenIB.org BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include "ipath_common.h" - -struct ipath_header { - /* - * Version - 4 bits, Port - 4 bits, TID - 10 bits and Offset - - * 14 bits before ECO change ~28 Dec 03. After that, Vers 4, - * Port 3, TID 11, offset 14. - */ - __le32 ver_port_tid_offset; - __le16 chksum; - __le16 pkt_flags; -}; - -struct ips_message_header { - __be16 lrh[4]; - __be32 bth[3]; - /* fields below this point are in host byte order */ - struct ipath_header iph; - __u8 sub_opcode; - __u8 flags; - __u16 src_rank; - /* 24 bits. The upper 8 bit is available for other use */ - union { - struct { - unsigned ack_seq_num:24; - unsigned port:4; - unsigned unused:4; - }; - __u32 ack_seq_num_org; - }; - __u8 expected_tid_session_id; - __u8 tinylen; /* to aid MPI */ - union { - __u16 tag; /* to aid MPI */ - __u16 mqhdr; /* for PSM MQ */ - }; - union { - __u32 mpi[4]; /* to aid MPI */ - __u32 data[4]; - __u64 mq[2]; /* for PSM MQ */ - struct { - __u16 mtu; - __u8 major_ver; - __u8 minor_ver; - __u32 not_used; //free - __u32 run_id; - __u32 client_ver; - }; - }; -}; - -struct ether_header { - __be16 lrh[4]; - __be32 bth[3]; - struct ipath_header iph; - __u8 sub_opcode; - __u8 cmd; - __be16 lid; - __u16 mac[3]; - __u8 frag_num; - __u8 seq_num; - __le32 len; - /* MUST be of word size due to PIO write requirements */ - __le32 csum; - __le16 csum_offset; - __le16 flags; - __u16 first_2_bytes; - __u8 unused[2]; /* currently unused */ -}; - -/* - * The PIO buffer used for sending infinipath messages must only be written - * in 32-bit words, all the data must be written, and no writes can occur - * after the last word is written (which transfers "ownership" of the buffer - * to the chip and triggers the message to be sent). - * Since the Linux sk_buff structure can be recursive, non-aligned, and - * any number of bytes in each segment, we use the following structure - * to keep information about the overall state of the copy operation. - * This is used to save the information needed to store the checksum - * in the right place before sending the last word to the hardware and - * to buffer the last 0-3 bytes of non-word sized segments. - */ -struct copy_data_s { - struct ether_header *hdr; - /* addr of PIO buf to write csum to */ - __u32 __iomem *csum_pio; - __u32 __iomem *to; /* addr of PIO buf to write data to */ - __u32 device; /* which device to allocate PIO bufs from */ - __s32 error; /* set if there is an error. */ - __s32 extra; /* amount of data saved in u.buf below */ - __u32 len; /* total length to send in bytes */ - __u32 flen; /* frament length in words */ - __u32 csum; /* partial IP checksum */ - __u32 pos; /* position for partial checksum */ - __u32 offset; /* offset to where data currently starts */ - __s32 checksum_calc; /* set to 1 when csum has been calculated */ - struct sk_buff *skb; - union { - __u32 w; - __u8 buf[4]; - } u; -}; - -/* IB - LRH header consts */ -#define IPS_LRH_GRH 0x0003 /* 1. word of IB LRH - next header: GRH */ -#define IPS_LRH_BTH 0x0002 /* 1. word of IB LRH - next header: BTH */ - -#define IPS_OFFSET 0 - -/* - * defines the cut-off point between the header queue and eager/expected - * TID queue - */ -#define NUM_OF_EXTRA_WORDS_IN_HEADER_QUEUE \ - ((sizeof(struct ips_message_header) - \ - offsetof(struct ips_message_header, iph)) >> 2) - -/* OpCodes */ -#define OPCODE_IPS 0xC0 -#define OPCODE_ITH4X 0xC1 - -/* OpCode 30 is use by stand-alone test programs */ -#define OPCODE_RAW_DATA 0xDE -/* last OpCode (31) is reserved for test */ -#define OPCODE_TEST 0xDF - -/* sub OpCodes - ips */ -#define OPCODE_SEQ_DATA 0x01 -#define OPCODE_SEQ_CTRL 0x02 - -#define OPCODE_SEQ_MQ_DATA 0x03 -#define OPCODE_SEQ_MQ_CTRL 0x04 - -#define OPCODE_ACK 0x10 -#define OPCODE_NAK 0x11 - -#define OPCODE_ERR_CHK 0x20 -#define OPCODE_ERR_CHK_PLS 0x21 - -#define OPCODE_STARTUP 0x30 -#define OPCODE_STARTUP_ACK 0x31 -#define OPCODE_STARTUP_NAK 0x32 - -#define OPCODE_STARTUP_EXT 0x34 -#define OPCODE_STARTUP_ACK_EXT 0x35 -#define OPCODE_STARTUP_NAK_EXT 0x36 - -#define OPCODE_TIDS_RELEASE 0x40 -#define OPCODE_TIDS_RELEASE_CONFIRM 0x41 - -#define OPCODE_CLOSE 0x50 -#define OPCODE_CLOSE_ACK 0x51 -/* - * like OPCODE_CLOSE, but no complaint if other side has already closed. - * Used when doing abort(), MPI_Abort(), etc. - */ -#define OPCODE_ABORT 0x52 - -/* sub OpCodes - ith4x */ -#define OPCODE_ENCAP 0x81 -#define OPCODE_LID_ARP 0x82 - -/* Receive Header Queue: receive type (from infinipath) */ -#define RCVHQ_RCV_TYPE_EXPECTED 0 -#define RCVHQ_RCV_TYPE_EAGER 1 -#define RCVHQ_RCV_TYPE_NON_KD 2 -#define RCVHQ_RCV_TYPE_ERROR 3 - -/* misc. */ -#define SIZE_OF_CRC 1 - -#define EAGER_TID_ID INFINIPATH_I_TID_MASK - -#define IPS_DEFAULT_P_KEY 0xFFFF - -#define IPS_PERMISSIVE_LID 0xFFFF -#define IPS_MULTICAST_LID_BASE 0xC000 - -#define IPS_AETH_CREDIT_SHIFT 24 -#define IPS_AETH_CREDIT_MASK 0x1F -#define IPS_AETH_CREDIT_INVAL 0x1F - -#define IPS_PSN_MASK 0xFFFFFF -#define IPS_MSN_MASK 0xFFFFFF -#define IPS_QPN_MASK 0xFFFFFF -#define IPS_MULTICAST_QPN 0xFFFFFF - -/* functions for extracting fields from rcvhdrq entries */ -static inline __u32 ips_get_hdr_err_flags(const __le32 * rbuf) -{ - return __le32_to_cpu(rbuf[1]); -} - -static inline __u32 ips_get_index(const __le32 * rbuf) -{ - return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_EGRINDEX_SHIFT) - & INFINIPATH_RHF_EGRINDEX_MASK; -} - -static inline __u32 ips_get_rcv_type(const __le32 * rbuf) -{ - return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_RCVTYPE_SHIFT) - & INFINIPATH_RHF_RCVTYPE_MASK; -} - -static inline __u32 ips_get_length_in_bytes(const __le32 * rbuf) -{ - return ((__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_LENGTH_SHIFT) - & INFINIPATH_RHF_LENGTH_MASK) << 2; -} - -static inline void *ips_get_first_protocol_header(const __u32 * rbuf) -{ - return (void *)&rbuf[2]; -} - -static inline struct ips_message_header *ips_get_ips_header(const __u32 * - rbuf) -{ - return (struct ips_message_header *)&rbuf[2]; -} - -static inline __u32 ips_get_ipath_ver(__le32 hdrword) -{ - return (__le32_to_cpu(hdrword) >> INFINIPATH_I_VERS_SHIFT) - & INFINIPATH_I_VERS_MASK; -} - -#endif /* IPS_COMMON_H */ diff --git a/drivers/infiniband/hw/ipath/verbs_debug.h b/drivers/infiniband/hw/ipath/verbs_debug.h index 40d693cf3f9..6186676f2a1 100644 --- a/drivers/infiniband/hw/ipath/verbs_debug.h +++ b/drivers/infiniband/hw/ipath/verbs_debug.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2006 QLogic, Inc. All rights reserved. * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two diff --git a/drivers/infiniband/hw/mthca/mthca_eq.c b/drivers/infiniband/hw/mthca/mthca_eq.c index d536217e700..a29b1b6d82b 100644 --- a/drivers/infiniband/hw/mthca/mthca_eq.c +++ b/drivers/infiniband/hw/mthca/mthca_eq.c @@ -900,7 +900,7 @@ int __devinit mthca_init_eq_table(struct mthca_dev *dev) mthca_is_memfree(dev) ? mthca_arbel_interrupt : mthca_tavor_interrupt, - SA_SHIRQ, DRV_NAME, dev); + IRQF_SHARED, DRV_NAME, dev); if (err) goto err_out_cmd; dev->eq_table.have_irq = 1; diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c index 9b9ff7bff35..557cde3a456 100644 --- a/drivers/infiniband/hw/mthca/mthca_main.c +++ b/drivers/infiniband/hw/mthca/mthca_main.c @@ -34,7 +34,6 @@ * $Id: mthca_main.c 1396 2004-12-28 04:10:27Z roland $ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/errno.h> @@ -172,8 +171,9 @@ static int __devinit mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim if (dev_lim->uar_size > pci_resource_len(mdev->pdev, 2)) { mthca_err(mdev, "HCA reported UAR size of 0x%x bigger than " - "PCI resource 2 size of 0x%lx, aborting.\n", - dev_lim->uar_size, pci_resource_len(mdev->pdev, 2)); + "PCI resource 2 size of 0x%llx, aborting.\n", + dev_lim->uar_size, + (unsigned long long)pci_resource_len(mdev->pdev, 2)); return -ENODEV; } diff --git a/drivers/infiniband/hw/mthca/mthca_reset.c b/drivers/infiniband/hw/mthca/mthca_reset.c index f4fddd5327f..91934f2d9db 100644 --- a/drivers/infiniband/hw/mthca/mthca_reset.c +++ b/drivers/infiniband/hw/mthca/mthca_reset.c @@ -32,7 +32,6 @@ * $Id: mthca_reset.c 1349 2004-12-16 21:09:43Z roland $ */ -#include <linux/config.h> #include <linux/init.h> #include <linux/errno.h> #include <linux/pci.h> diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 491d2afaf5b..3f89f5e1903 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h @@ -42,7 +42,6 @@ #include <linux/netdevice.h> #include <linux/workqueue.h> #include <linux/pci.h> -#include <linux/config.h> #include <linux/kref.h> #include <linux/if_infiniband.h> #include <linux/mutex.h> diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 4c3f2de2a06..b2c033edb03 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -54,7 +54,6 @@ #include <linux/blkdev.h> #include <linux/init.h> #include <linux/ioctl.h> -#include <linux/devfs_fs_kernel.h> #include <linux/cdev.h> #include <linux/in.h> #include <linux/net.h> diff --git a/drivers/input/gameport/emu10k1-gp.c b/drivers/input/gameport/emu10k1-gp.c index 462f8d300aa..9793ac36d17 100644 --- a/drivers/input/gameport/emu10k1-gp.c +++ b/drivers/input/gameport/emu10k1-gp.c @@ -32,7 +32,6 @@ #include <linux/module.h> #include <linux/ioport.h> -#include <linux/config.h> #include <linux/init.h> #include <linux/gameport.h> #include <linux/slab.h> diff --git a/drivers/input/gameport/ns558.c b/drivers/input/gameport/ns558.c index 3e2d28f263e..f68dbe6f7f0 100644 --- a/drivers/input/gameport/ns558.c +++ b/drivers/input/gameport/ns558.c @@ -33,7 +33,6 @@ #include <linux/module.h> #include <linux/ioport.h> -#include <linux/config.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/gameport.h> diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c index 01dc0b195d5..e9a02db36ec 100644 --- a/drivers/input/joystick/analog.c +++ b/drivers/input/joystick/analog.c @@ -28,7 +28,6 @@ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic */ -#include <linux/config.h> #include <linux/delay.h> #include <linux/kernel.h> #include <linux/module.h> diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h index 668f24535ba..e9924d6f01b 100644 --- a/drivers/input/joystick/iforce/iforce.h +++ b/drivers/input/joystick/iforce/iforce.h @@ -35,7 +35,6 @@ #include <linux/spinlock.h> #include <linux/usb.h> #include <linux/serio.h> -#include <linux/config.h> #include <linux/circ_buf.h> #include <linux/mutex.h> diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c index 1f0e720267d..1e03153b9bc 100644 --- a/drivers/input/keyboard/corgikbd.c +++ b/drivers/input/keyboard/corgikbd.c @@ -352,7 +352,7 @@ static int __init corgikbd_probe(struct platform_device *pdev) for (i = 0; i < CORGI_KEY_SENSE_NUM; i++) { pxa_gpio_mode(CORGI_GPIO_KEY_SENSE(i) | GPIO_IN); if (request_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd_interrupt, - SA_INTERRUPT | SA_TRIGGER_RISING, + IRQF_DISABLED | IRQF_TRIGGER_RISING, "corgikbd", corgikbd)) printk(KERN_WARNING "corgikbd: Can't get IRQ: %d!\n", i); } diff --git a/drivers/input/keyboard/hilkbd.c b/drivers/input/keyboard/hilkbd.c index 33edd030aa7..d22c7c62429 100644 --- a/drivers/input/keyboard/hilkbd.c +++ b/drivers/input/keyboard/hilkbd.c @@ -18,7 +18,6 @@ #include <linux/pci_ids.h> #include <linux/ioport.h> #include <linux/module.h> -#include <linux/config.h> #include <linux/errno.h> #include <linux/input.h> #include <linux/init.h> diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c index 2c510881874..83906f80ba2 100644 --- a/drivers/input/keyboard/locomokbd.c +++ b/drivers/input/keyboard/locomokbd.c @@ -25,7 +25,6 @@ * */ -#include <linux/config.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/init.h> diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c index c5d03fb77bc..e385710233f 100644 --- a/drivers/input/keyboard/spitzkbd.c +++ b/drivers/input/keyboard/spitzkbd.c @@ -410,7 +410,7 @@ static int __init spitzkbd_probe(struct platform_device *dev) for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++) { pxa_gpio_mode(spitz_senses[i] | GPIO_IN); if (request_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd_interrupt, - SA_INTERRUPT|SA_TRIGGER_RISING, + IRQF_DISABLED|IRQF_TRIGGER_RISING, "Spitzkbd Sense", spitzkbd)) printk(KERN_WARNING "spitzkbd: Can't get Sense IRQ: %d!\n", i); } @@ -425,19 +425,19 @@ static int __init spitzkbd_probe(struct platform_device *dev) pxa_gpio_mode(SPITZ_GPIO_SWB | GPIO_IN); request_irq(SPITZ_IRQ_GPIO_SYNC, spitzkbd_interrupt, - SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, + IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "Spitzkbd Sync", spitzkbd); request_irq(SPITZ_IRQ_GPIO_ON_KEY, spitzkbd_interrupt, - SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, + IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "Spitzkbd PwrOn", spitzkbd); request_irq(SPITZ_IRQ_GPIO_SWA, spitzkbd_hinge_isr, - SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, + IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "Spitzkbd SWA", spitzkbd); request_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd_hinge_isr, - SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, + IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "Spitzkbd SWB", spitzkbd); request_irq(SPITZ_IRQ_GPIO_AK_INT, spitzkbd_hinge_isr, - SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING, + IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "Spitzkbd HP", spitzkbd); printk(KERN_INFO "input: Spitz Keyboard Registered\n"); diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c index 3a6ae85cd69..805b636e73d 100644 --- a/drivers/input/misc/ixp4xx-beeper.c +++ b/drivers/input/misc/ixp4xx-beeper.c @@ -113,7 +113,7 @@ static int __devinit ixp4xx_spkr_probe(struct platform_device *dev) input_dev->event = ixp4xx_spkr_event; err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt, - SA_INTERRUPT | SA_TIMER, "ixp4xx-beeper", (void *) dev->id); + IRQF_DISABLED | IRQF_TIMER, "ixp4xx-beeper", (void *) dev->id); if (err) goto err_free_device; diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c index 42c11fbf3c7..106c94f33b9 100644 --- a/drivers/input/misc/sparcspkr.c +++ b/drivers/input/misc/sparcspkr.c @@ -4,7 +4,6 @@ * Copyright (c) 2002 Vojtech Pavlik * Copyright (c) 2002, 2006 David S. Miller (davem@davemloft.net) */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> diff --git a/drivers/input/mouse/inport.c b/drivers/input/mouse/inport.c index afc66f56df4..50f1fed10be 100644 --- a/drivers/input/mouse/inport.c +++ b/drivers/input/mouse/inport.c @@ -36,7 +36,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> -#include <linux/config.h> #include <linux/ioport.h> #include <linux/init.h> #include <linux/interrupt.h> diff --git a/drivers/input/mouse/rpcmouse.c b/drivers/input/mouse/rpcmouse.c index 09b6ffdb758..872b30bf7aa 100644 --- a/drivers/input/mouse/rpcmouse.c +++ b/drivers/input/mouse/rpcmouse.c @@ -85,7 +85,7 @@ static int __init rpcmouse_init(void) rpcmouse_lastx = (short) iomd_readl(IOMD_MOUSEX); rpcmouse_lasty = (short) iomd_readl(IOMD_MOUSEY); - if (request_irq(IRQ_VSYNCPULSE, rpcmouse_irq, SA_SHIRQ, "rpcmouse", rpcmouse_dev)) { + if (request_irq(IRQ_VSYNCPULSE, rpcmouse_irq, IRQF_SHARED, "rpcmouse", rpcmouse_dev)) { printk(KERN_ERR "rpcmouse: unable to allocate VSYNC interrupt\n"); input_free_device(rpcmouse_dev); return -EBUSY; diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c index a8974243171..0023501a5b6 100644 --- a/drivers/input/mouse/sermouse.c +++ b/drivers/input/mouse/sermouse.c @@ -33,7 +33,6 @@ #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/input.h> -#include <linux/config.h> #include <linux/serio.h> #include <linux/init.h> diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c index 7b85bc21ae4..47edcfd022b 100644 --- a/drivers/input/mouse/vsxxxaa.c +++ b/drivers/input/mouse/vsxxxaa.c @@ -81,7 +81,6 @@ #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/input.h> -#include <linux/config.h> #include <linux/serio.h> #include <linux/init.h> diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index eb721b11ff3..1f851acab30 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c @@ -19,7 +19,6 @@ #include <linux/moduleparam.h> #include <linux/init.h> #include <linux/input.h> -#include <linux/config.h> #include <linux/smp_lock.h> #include <linux/random.h> #include <linux/major.h> diff --git a/drivers/input/power.c b/drivers/input/power.c index 526e6070600..51a519e24b6 100644 --- a/drivers/input/power.c +++ b/drivers/input/power.c @@ -28,7 +28,6 @@ */ #include <linux/module.h> -#include <linux/config.h> #include <linux/input.h> #include <linux/slab.h> #include <linux/init.h> diff --git a/drivers/input/serio/ct82c710.c b/drivers/input/serio/ct82c710.c index 096b6a0b5cc..bc6e87add09 100644 --- a/drivers/input/serio/ct82c710.c +++ b/drivers/input/serio/ct82c710.c @@ -31,7 +31,6 @@ #include <linux/delay.h> #include <linux/module.h> #include <linux/ioport.h> -#include <linux/config.h> #include <linux/init.h> #include <linux/interrupt.h> #include <linux/serio.h> @@ -189,7 +188,7 @@ static int __devinit ct82c710_probe(struct platform_device *dev) strlcpy(ct82c710_port->name, "C&T 82c710 mouse port", sizeof(ct82c710_port->name)); snprintf(ct82c710_port->phys, sizeof(ct82c710_port->phys), - "isa%04lx/serio0", CT82C710_DATA); + "isa%16llx/serio0", (unsigned long long)CT82C710_DATA); serio_register_port(ct82c710_port); @@ -241,8 +240,8 @@ static int __init ct82c710_init(void) serio_register_port(ct82c710_port); - printk(KERN_INFO "serio: C&T 82c710 mouse port at %#lx irq %d\n", - CT82C710_DATA, CT82C710_IRQ); + printk(KERN_INFO "serio: C&T 82c710 mouse port at %#llx irq %d\n", + (unsigned long long)CT82C710_DATA, CT82C710_IRQ); return 0; diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c index c0b1e4becad..cde036a9216 100644 --- a/drivers/input/serio/gscps2.c +++ b/drivers/input/serio/gscps2.c @@ -22,7 +22,6 @@ * was usable/enabled ?) */ -#include <linux/config.h> #include <linux/init.h> #include <linux/module.h> #include <linux/serio.h> @@ -371,7 +370,7 @@ static int __init gscps2_probe(struct parisc_device *dev) serio->dev.parent = &dev->dev; ret = -EBUSY; - if (request_irq(dev->irq, gscps2_interrupt, SA_SHIRQ, ps2port->port->name, ps2port)) + if (request_irq(dev->irq, gscps2_interrupt, IRQF_SHARED, ps2port->port->name, ps2port)) goto fail_miserably; if (ps2port->id != GSC_ID_KEYBOARD && ps2port->id != GSC_ID_MOUSE) { diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h index 6d66351805a..7d9fafea961 100644 --- a/drivers/input/serio/i8042-sparcio.h +++ b/drivers/input/serio/i8042-sparcio.h @@ -1,13 +1,10 @@ #ifndef _I8042_SPARCIO_H #define _I8042_SPARCIO_H -#include <linux/config.h> #include <asm/io.h> - -#ifdef CONFIG_PCI #include <asm/oplib.h> -#include <asm/ebus.h> -#endif +#include <asm/prom.h> +#include <asm/of_device.h> static int i8042_kbd_irq = -1; static int i8042_aux_irq = -1; @@ -48,54 +45,83 @@ static inline void i8042_write_command(int val) #define OBP_PS2MS_NAME1 "kdmouse" #define OBP_PS2MS_NAME2 "mouse" +static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_device_id *match) +{ + struct device_node *dp = op->node; + + dp = dp->child; + while (dp) { + if (!strcmp(dp->name, OBP_PS2KBD_NAME1) || + !strcmp(dp->name, OBP_PS2KBD_NAME2)) { + struct of_device *kbd = of_find_device_by_node(dp); + unsigned int irq = kbd->irqs[0]; + if (irq == 0xffffffff) + irq = op->irqs[0]; + i8042_kbd_irq = irq; + kbd_iobase = of_ioremap(&kbd->resource[0], + 0, 8, "kbd"); + } else if (!strcmp(dp->name, OBP_PS2MS_NAME1) || + !strcmp(dp->name, OBP_PS2MS_NAME2)) { + struct of_device *ms = of_find_device_by_node(dp); + unsigned int irq = ms->irqs[0]; + if (irq == 0xffffffff) + irq = op->irqs[0]; + i8042_aux_irq = irq; + } + + dp = dp->sibling; + } + + return 0; +} + +static int __devexit sparc_i8042_remove(struct of_device *op) +{ + of_iounmap(kbd_iobase, 8); + + return 0; +} + +static struct of_device_id sparc_i8042_match[] = { + { + .name = "8042", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, i8042_match); + +static struct of_platform_driver sparc_i8042_driver = { + .name = "i8042", + .match_table = sparc_i8042_match, + .probe = sparc_i8042_probe, + .remove = __devexit_p(sparc_i8042_remove), +}; + static int __init i8042_platform_init(void) { #ifndef CONFIG_PCI return -ENODEV; #else - char prop[128]; - int len; + struct device_node *root = of_find_node_by_path("/"); - len = prom_getproperty(prom_root_node, "name", prop, sizeof(prop)); - if (len < 0) { - printk("i8042: Cannot get name property of root OBP node.\n"); - return -ENODEV; - } - if (strncmp(prop, "SUNW,JavaStation-1", len) == 0) { + if (!strcmp(root->name, "SUNW,JavaStation-1")) { /* Hardcoded values for MrCoffee. */ i8042_kbd_irq = i8042_aux_irq = 13 | 0x20; kbd_iobase = ioremap(0x71300060, 8); if (!kbd_iobase) return -ENODEV; } else { - struct linux_ebus *ebus; - struct linux_ebus_device *edev; - struct linux_ebus_child *child; - - for_each_ebus(ebus) { - for_each_ebusdev(edev, ebus) { - if (!strcmp(edev->prom_node->name, "8042")) - goto edev_found; - } - } - return -ENODEV; - - edev_found: - for_each_edevchild(edev, child) { - if (!strcmp(child->prom_node->name, OBP_PS2KBD_NAME1) || - !strcmp(child->prom_node->name, OBP_PS2KBD_NAME2)) { - i8042_kbd_irq = child->irqs[0]; - kbd_iobase = - ioremap(child->resource[0].start, 8); - } - if (!strcmp(child->prom_node->name, OBP_PS2MS_NAME1) || - !strcmp(child->prom_node->name, OBP_PS2MS_NAME2)) - i8042_aux_irq = child->irqs[0]; - } + int err = of_register_driver(&sparc_i8042_driver, + &of_bus_type); + if (err) + return err; + if (i8042_kbd_irq == -1 || i8042_aux_irq == -1) { - printk("i8042: Error, 8042 device lacks both kbd and " - "mouse nodes.\n"); + if (kbd_iobase) { + of_iounmap(kbd_iobase, 8); + kbd_iobase = (void __iomem *) NULL; + } return -ENODEV; } } @@ -109,7 +135,10 @@ static int __init i8042_platform_init(void) static inline void i8042_platform_exit(void) { #ifdef CONFIG_PCI - iounmap(kbd_iobase); + struct device_node *root = of_find_node_by_path("/"); + + if (strcmp(root->name, "SUNW,JavaStation-1")) + of_unregister_driver(&sparc_i8042_driver); #endif } diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index a7d91d5356a..06a3f25657d 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -15,7 +15,6 @@ #include <linux/moduleparam.h> #include <linux/interrupt.h> #include <linux/ioport.h> -#include <linux/config.h> #include <linux/init.h> #include <linux/serio.h> #include <linux/err.h> @@ -329,7 +328,7 @@ static int i8042_open(struct serio *serio) return 0; if (request_irq(port->irq, i8042_interrupt, - SA_SHIRQ, "i8042", i8042_request_irq_cookie)) { + IRQF_SHARED, "i8042", i8042_request_irq_cookie)) { printk(KERN_ERR "i8042.c: Can't get irq %d for %s, unregistering the port.\n", port->irq, port->name); goto irq_fail; } @@ -611,7 +610,7 @@ static int __devinit i8042_check_aux(void) */ if (request_irq(i8042_ports[I8042_AUX_PORT_NO].irq, i8042_interrupt, - SA_SHIRQ, "i8042", &i8042_check_aux_cookie)) + IRQF_SHARED, "i8042", &i8042_check_aux_cookie)) return -1; free_irq(i8042_ports[I8042_AUX_PORT_NO].irq, &i8042_check_aux_cookie); diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h index cbbf3842da5..af526ab9ec0 100644 --- a/drivers/input/serio/i8042.h +++ b/drivers/input/serio/i8042.h @@ -1,7 +1,6 @@ #ifndef _I8042_H #define _I8042_H -#include <linux/config.h> /* * Copyright (c) 1999-2002 Vojtech Pavlik diff --git a/drivers/input/serio/pcips2.c b/drivers/input/serio/pcips2.c index 1e139c5e59d..fb727c66525 100644 --- a/drivers/input/serio/pcips2.c +++ b/drivers/input/serio/pcips2.c @@ -107,7 +107,7 @@ static int pcips2_open(struct serio *io) outb(PS2_CTRL_ENABLE, ps2if->base); pcips2_flush_input(ps2if); - ret = request_irq(ps2if->dev->irq, pcips2_interrupt, SA_SHIRQ, + ret = request_irq(ps2if->dev->irq, pcips2_interrupt, IRQF_SHARED, "pcips2", ps2if); if (ret == 0) val = PS2_CTRL_ENABLE | PS2_CTRL_RXIRQ; diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c index 5a2703b536d..71a8eea816c 100644 --- a/drivers/input/serio/serio_raw.c +++ b/drivers/input/serio/serio_raw.c @@ -16,7 +16,6 @@ #include <linux/init.h> #include <linux/major.h> #include <linux/device.h> -#include <linux/devfs_fs_kernel.h> #include <linux/miscdevice.h> #include <linux/wait.h> #include <linux/mutex.h> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 386023c594d..66e411badf7 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -773,7 +773,7 @@ static int __devinit ads7846_probe(struct spi_device *spi) ts->last_msg = m; - if (request_irq(spi->irq, ads7846_irq, SA_TRIGGER_FALLING, + if (request_irq(spi->irq, ads7846_irq, IRQF_TRIGGER_FALLING, spi->dev.driver->name, ts)) { dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); err = -EBUSY; diff --git a/drivers/input/touchscreen/corgi_ts.c b/drivers/input/touchscreen/corgi_ts.c index 5013703db0e..d2f9759cd3e 100644 --- a/drivers/input/touchscreen/corgi_ts.c +++ b/drivers/input/touchscreen/corgi_ts.c @@ -318,7 +318,7 @@ static int __init corgits_probe(struct platform_device *pdev) corgi_ssp_ads7846_putget((5u << ADSCTRL_ADR_SH) | ADSCTRL_STS); mdelay(5); - if (request_irq(corgi_ts->irq_gpio, ts_interrupt, SA_INTERRUPT, "ts", corgi_ts)) { + if (request_irq(corgi_ts->irq_gpio, ts_interrupt, IRQF_DISABLED, "ts", corgi_ts)) { err = -EBUSY; goto fail; } diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c index 2de2139f2fe..e2b91001877 100644 --- a/drivers/input/touchscreen/h3600_ts_input.c +++ b/drivers/input/touchscreen/h3600_ts_input.c @@ -399,14 +399,14 @@ static int h3600ts_connect(struct serio *serio, struct serio_driver *drv) set_GPIO_IRQ_edge(GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE); if (request_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, action_button_handler, - SA_SHIRQ | SA_INTERRUPT, "h3600_action", &ts->dev)) { + IRQF_SHARED | IRQF_DISABLED, "h3600_action", &ts->dev)) { printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n"); err = -EBUSY; goto fail2; } if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, - SA_SHIRQ | SA_INTERRUPT, "h3600_suspend", &ts->dev)) { + IRQF_SHARED | IRQF_DISABLED, "h3600_suspend", &ts->dev)) { printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n"); err = -EBUSY; goto fail3; diff --git a/drivers/input/touchscreen/hp680_ts_input.c b/drivers/input/touchscreen/hp680_ts_input.c index 957dd5a1b15..fa97e0f79e7 100644 --- a/drivers/input/touchscreen/hp680_ts_input.c +++ b/drivers/input/touchscreen/hp680_ts_input.c @@ -109,7 +109,7 @@ static int __init hp680_ts_init(void) input_register_device(hp680_ts_dev); if (request_irq(HP680_TS_IRQ, hp680_ts_interrupt, - SA_INTERRUPT, MODNAME, 0) < 0) { + IRQF_DISABLED, MODNAME, 0) < 0) { printk(KERN_ERR "hp680_touchscreen.c: Can't allocate irq %d\n", HP680_TS_IRQ); input_unregister_device(hp680_ts_dev); diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c index 5f9ecad2ca7..00e3929c628 100644 --- a/drivers/input/tsdev.c +++ b/drivers/input/tsdev.c @@ -48,7 +48,6 @@ #include <linux/init.h> #include <linux/input.h> #include <linux/major.h> -#include <linux/config.h> #include <linux/smp_lock.h> #include <linux/random.h> #include <linux/time.h> diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 2e541fa0202..669f76393b5 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/kernel.h> @@ -39,7 +38,6 @@ #include <linux/init.h> #include <linux/device.h> #include <linux/moduleparam.h> -#include <linux/devfs_fs_kernel.h> #include <linux/isdn/capiutil.h> #include <linux/isdn/capicmd.h> #if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE) @@ -1337,7 +1335,6 @@ static int capinc_tty_init(void) drv->owner = THIS_MODULE; drv->driver_name = "capi_nc"; - drv->devfs_name = "capi/"; drv->name = "capi"; drv->major = capi_ttymajor; drv->minor_start = 0; @@ -1516,8 +1513,6 @@ static int __init capi_init(void) } class_device_create(capi_class, NULL, MKDEV(capi_major, 0), NULL, "capi"); - devfs_mk_cdev(MKDEV(capi_major, 0), S_IFCHR | S_IRUSR | S_IWUSR, - "isdn/capi20"); #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE if (capinc_tty_init() < 0) { @@ -1552,7 +1547,6 @@ static void __exit capi_exit(void) class_device_destroy(capi_class, MKDEV(capi_major, 0)); class_destroy(capi_class); unregister_chrdev(capi_major, "capi20"); - devfs_remove("isdn/capi20"); #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE capinc_tty_exit(); diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c index e7cf6bc286a..c1b21552fc0 100644 --- a/drivers/isdn/capi/capiutil.c +++ b/drivers/isdn/capi/capiutil.c @@ -17,7 +17,6 @@ #include <linux/kernel.h> #include <linux/mm.h> #include <linux/init.h> -#include <linux/config.h> #include <linux/isdn/capiutil.h> /* from CAPI2.0 DDK AVM Berlin GmbH */ diff --git a/drivers/isdn/divert/divert_procfs.c b/drivers/isdn/divert/divert_procfs.c index 1b37d86d5ee..399b316111f 100644 --- a/drivers/isdn/divert/divert_procfs.c +++ b/drivers/isdn/divert/divert_procfs.c @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/poll.h> #include <linux/smp_lock.h> diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index 8a45715dd4c..3845defd490 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c @@ -41,7 +41,6 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode"); #define GIGASET_MINORS 1 #define GIGASET_MINOR 16 #define GIGASET_MODULENAME "bas_gigaset" -#define GIGASET_DEVFSNAME "gig/bas/" #define GIGASET_DEVNAME "ttyGB" /* length limit according to Siemens 3070usb-protokoll.doc ch. 2.1 */ @@ -2349,8 +2348,7 @@ static int __init bas_gigaset_init(void) /* allocate memory for our driver state and intialize it */ if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, GIGASET_MODULENAME, GIGASET_DEVNAME, - GIGASET_DEVFSNAME, &gigops, - THIS_MODULE)) == NULL) + &gigops, THIS_MODULE)) == NULL) goto error; /* allocate memory for our device state and intialize it */ diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index 2a56bf33a67..aca165d43aa 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c @@ -1092,14 +1092,12 @@ EXPORT_SYMBOL_GPL(gigaset_freedriver); * minors Number of minors this driver can handle * procname Name of the driver * devname Name of the device files (prefix without minor number) - * devfsname Devfs name of the device files without %d * return value: * Pointer to the gigaset_driver structure on success, NULL on failure. */ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, const char *procname, const char *devname, - const char *devfsname, const struct gigaset_ops *ops, struct module *owner) { @@ -1139,7 +1137,7 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, drv->cs[i].minor_index = i; } - gigaset_if_initdriver(drv, procname, devname, devfsname); + gigaset_if_initdriver(drv, procname, devname); spin_lock_irqsave(&driver_lock, flags); list_add(&drv->list, &drivers); diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h index 8d63d822104..884bd72c1bf 100644 --- a/drivers/isdn/gigaset/gigaset.h +++ b/drivers/isdn/gigaset/gigaset.h @@ -16,7 +16,6 @@ #ifndef GIGASET_H #define GIGASET_H -#include <linux/config.h> #include <linux/kernel.h> #include <linux/compiler.h> #include <linux/types.h> @@ -769,7 +768,6 @@ void gigaset_block_channels(struct cardstate *cs); struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, const char *procname, const char *devname, - const char *devfsname, const struct gigaset_ops *ops, struct module *owner); @@ -892,7 +890,7 @@ int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, /* initialize interface */ void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname, - const char *devname, const char *devfsname); + const char *devname); /* release interface */ void gigaset_if_freedriver(struct gigaset_driver *drv); /* add minor */ diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index 74fd234956c..bd2e4267528 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c @@ -673,10 +673,9 @@ EXPORT_SYMBOL_GPL(gigaset_if_receive); * drv Driver * procname Name of the driver (e.g. for /proc/tty/drivers) * devname Name of the device files (prefix without minor number) - * devfsname Devfs name of the device files without %d */ void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname, - const char *devname, const char *devfsname) + const char *devname) { unsigned minors = drv->minors; int ret; @@ -692,7 +691,7 @@ void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname, tty->major = GIG_MAJOR, tty->type = TTY_DRIVER_TYPE_SERIAL, tty->subtype = SERIAL_TYPE_NORMAL, - tty->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS, + tty->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; tty->driver_name = procname; tty->name = devname; @@ -700,7 +699,6 @@ void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname, tty->num = drv->minors; tty->owner = THIS_MODULE; - tty->devfs_name = devfsname; tty->init_termios = tty_std_termios; //FIXME tty->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; //FIXME diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c index d86ab68114b..6e05d9d4a51 100644 --- a/drivers/isdn/gigaset/usb-gigaset.c +++ b/drivers/isdn/gigaset/usb-gigaset.c @@ -41,7 +41,6 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode"); #define GIGASET_MINORS 1 #define GIGASET_MINOR 8 #define GIGASET_MODULENAME "usb_gigaset" -#define GIGASET_DEVFSNAME "gig/usb/" #define GIGASET_DEVNAME "ttyGU" #define IF_WRITEBUF 2000 //FIXME // WAKEUP_CHARS: 256 @@ -896,8 +895,7 @@ static int __init usb_gigaset_init(void) /* allocate memory for our driver state and intialize it */ if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, GIGASET_MODULENAME, GIGASET_DEVNAME, - GIGASET_DEVFSNAME, &ops, - THIS_MODULE)) == NULL) + &ops, THIS_MODULE)) == NULL) goto error; /* allocate memory for our device state and intialize it */ diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c index 4d64e5cbcdb..a4beeb46c85 100644 --- a/drivers/isdn/hardware/avm/b1dma.c +++ b/drivers/isdn/hardware/avm/b1dma.c @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/skbuff.h> diff --git a/drivers/isdn/hardware/avm/b1pci.c b/drivers/isdn/hardware/avm/b1pci.c index 5435a6cfb5e..90e2e6643d1 100644 --- a/drivers/isdn/hardware/avm/b1pci.c +++ b/drivers/isdn/hardware/avm/b1pci.c @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/skbuff.h> @@ -98,7 +97,7 @@ static int b1pci_probe(struct capicardparams *p, struct pci_dev *pdev) b1_reset(card->port); b1_getrevision(card); - retval = request_irq(card->irq, b1_interrupt, SA_SHIRQ, card->name, card); + retval = request_irq(card->irq, b1_interrupt, IRQF_SHARED, card->name, card); if (retval) { printk(KERN_ERR "b1pci: unable to get IRQ %d.\n", card->irq); retval = -EBUSY; @@ -235,7 +234,7 @@ static int b1pciv4_probe(struct capicardparams *p, struct pci_dev *pdev) b1dma_reset(card); b1_getrevision(card); - retval = request_irq(card->irq, b1dma_interrupt, SA_SHIRQ, card->name, card); + retval = request_irq(card->irq, b1dma_interrupt, IRQF_SHARED, card->name, card); if (retval) { printk(KERN_ERR "b1pci: unable to get IRQ %d.\n", card->irq); diff --git a/drivers/isdn/hardware/avm/b1pcmcia.c b/drivers/isdn/hardware/avm/b1pcmcia.c index 9746cc5ffff..e479c0aef38 100644 --- a/drivers/isdn/hardware/avm/b1pcmcia.c +++ b/drivers/isdn/hardware/avm/b1pcmcia.c @@ -82,7 +82,7 @@ static int b1pcmcia_add_card(unsigned int port, unsigned irq, card->irq = irq; card->cardtype = cardtype; - retval = request_irq(card->irq, b1_interrupt, 0, card->name, card); + retval = request_irq(card->irq, b1_interrupt, IRQF_SHARED, card->name, card); if (retval) { printk(KERN_ERR "b1pcmcia: unable to get IRQ %d.\n", card->irq); diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c index f7253b2136e..6c3d5f5f1f4 100644 --- a/drivers/isdn/hardware/avm/c4.c +++ b/drivers/isdn/hardware/avm/c4.c @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/skbuff.h> @@ -1173,7 +1172,7 @@ static int c4_add_card(struct capicardparams *p, struct pci_dev *dev, } c4_reset(card); - retval = request_irq(card->irq, c4_interrupt, SA_SHIRQ, card->name, card); + retval = request_irq(card->irq, c4_interrupt, IRQF_SHARED, card->name, card); if (retval) { printk(KERN_ERR "c4: unable to get IRQ %d.\n",card->irq); retval = -EBUSY; diff --git a/drivers/isdn/hardware/avm/t1pci.c b/drivers/isdn/hardware/avm/t1pci.c index 2ceec8e8419..d1e253c94db 100644 --- a/drivers/isdn/hardware/avm/t1pci.c +++ b/drivers/isdn/hardware/avm/t1pci.c @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/skbuff.h> @@ -104,7 +103,7 @@ static int t1pci_add_card(struct capicardparams *p, struct pci_dev *pdev) } b1dma_reset(card); - retval = request_irq(card->irq, b1dma_interrupt, SA_SHIRQ, card->name, card); + retval = request_irq(card->irq, b1dma_interrupt, IRQF_SHARED, card->name, card); if (retval) { printk(KERN_ERR "t1pci: unable to get IRQ %d.\n", card->irq); retval = -EBUSY; diff --git a/drivers/isdn/hardware/eicon/capimain.c b/drivers/isdn/hardware/eicon/capimain.c index 8fe4f3f0935..7a74ed35b1b 100644 --- a/drivers/isdn/hardware/eicon/capimain.c +++ b/drivers/isdn/hardware/eicon/capimain.c @@ -10,7 +10,6 @@ * of the GNU General Public License, incorporated herein by reference. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <asm/uaccess.h> diff --git a/drivers/isdn/hardware/eicon/diva_didd.c b/drivers/isdn/hardware/eicon/diva_didd.c index 27204f4b111..14298b8c835 100644 --- a/drivers/isdn/hardware/eicon/diva_didd.c +++ b/drivers/isdn/hardware/eicon/diva_didd.c @@ -11,7 +11,6 @@ * of the GNU General Public License, incorporated herein by reference. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> diff --git a/drivers/isdn/hardware/eicon/divamnt.c b/drivers/isdn/hardware/eicon/divamnt.c index 6146f7633be..77155d9f399 100644 --- a/drivers/isdn/hardware/eicon/divamnt.c +++ b/drivers/isdn/hardware/eicon/divamnt.c @@ -10,14 +10,12 @@ * of the GNU General Public License, incorporated herein by reference. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/smp_lock.h> #include <linux/poll.h> -#include <linux/devfs_fs_kernel.h> #include <asm/uaccess.h> #include "platform.h" @@ -178,7 +176,6 @@ static struct file_operations divas_maint_fops = { static void divas_maint_unregister_chrdev(void) { - devfs_remove(DEVNAME); unregister_chrdev(major, DEVNAME); } @@ -190,7 +187,6 @@ static int DIVA_INIT_FUNCTION divas_maint_register_chrdev(void) DRIVERLNAME); return (0); } - devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DEVNAME); return (1); } diff --git a/drivers/isdn/hardware/eicon/divasi.c b/drivers/isdn/hardware/eicon/divasi.c index df715b47e2b..fff0d89c806 100644 --- a/drivers/isdn/hardware/eicon/divasi.c +++ b/drivers/isdn/hardware/eicon/divasi.c @@ -10,7 +10,6 @@ * of the GNU General Public License, incorporated herein by reference. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> @@ -19,7 +18,6 @@ #include <linux/poll.h> #include <linux/proc_fs.h> #include <linux/skbuff.h> -#include <linux/devfs_fs_kernel.h> #include <asm/uaccess.h> #include "platform.h" @@ -145,7 +143,6 @@ static struct file_operations divas_idi_fops = { static void divas_idi_unregister_chrdev(void) { - devfs_remove(DEVNAME); unregister_chrdev(major, DEVNAME); } @@ -157,7 +154,6 @@ static int DIVA_INIT_FUNCTION divas_idi_register_chrdev(void) DRIVERLNAME); return (0); } - devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DEVNAME); return (1); } diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c index c9b26e86d18..b7dadba13e8 100644 --- a/drivers/isdn/hardware/eicon/divasmain.c +++ b/drivers/isdn/hardware/eicon/divasmain.c @@ -9,12 +9,10 @@ * of the GNU General Public License, incorporated herein by reference. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/sched.h> -#include <linux/devfs_fs_kernel.h> #include <asm/uaccess.h> #include <asm/io.h> #include <linux/ioport.h> @@ -488,7 +486,7 @@ void __inline__ outpp(void __iomem *addr, word p) int diva_os_register_irq(void *context, byte irq, const char *name) { int result = request_irq(irq, diva_os_irq_wrapper, - SA_INTERRUPT | SA_SHIRQ, name, context); + IRQF_DISABLED | IRQF_SHARED, name, context); return (result); } @@ -678,7 +676,6 @@ static struct file_operations divas_fops = { static void divas_unregister_chrdev(void) { - devfs_remove(DEVNAME); unregister_chrdev(major, DEVNAME); } @@ -690,7 +687,6 @@ static int DIVA_INIT_FUNCTION divas_register_chrdev(void) DRIVERLNAME); return (0); } - devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DEVNAME); return (1); } diff --git a/drivers/isdn/hardware/eicon/divasproc.c b/drivers/isdn/hardware/eicon/divasproc.c index c12efa6f842..6a4373a4f1e 100644 --- a/drivers/isdn/hardware/eicon/divasproc.c +++ b/drivers/isdn/hardware/eicon/divasproc.c @@ -10,7 +10,6 @@ * of the GNU General Public License, incorporated herein by reference. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/poll.h> diff --git a/drivers/isdn/hardware/eicon/platform.h b/drivers/isdn/hardware/eicon/platform.h index 12b8ff29e97..a66836cf756 100644 --- a/drivers/isdn/hardware/eicon/platform.h +++ b/drivers/isdn/hardware/eicon/platform.h @@ -18,7 +18,6 @@ #define DIVA_BUILD "local" #endif -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> diff --git a/drivers/isdn/hisax/avm_a1p.c b/drivers/isdn/hisax/avm_a1p.c index d643bb32ad0..574e252dfa4 100644 --- a/drivers/isdn/hisax/avm_a1p.c +++ b/drivers/isdn/hisax/avm_a1p.c @@ -255,7 +255,7 @@ setup_avm_a1_pcmcia(struct IsdnCard *card) cs->BC_Write_Reg = &WriteHSCX; cs->BC_Send_Data = &hscx_fill_fifo; cs->cardmsg = &AVM_card_msg; - cs->irq_flags = SA_SHIRQ; + cs->irq_flags = IRQF_SHARED; cs->irq_func = &avm_a1p_interrupt; ISACVersion(cs, "AVM A1 PCMCIA:"); diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c index 4abe5ff10e7..04f5917bf5a 100644 --- a/drivers/isdn/hisax/avm_pci.c +++ b/drivers/isdn/hisax/avm_pci.c @@ -12,7 +12,6 @@ * */ -#include <linux/config.h> #include <linux/init.h> #include "hisax.h" #include "isac.h" @@ -809,7 +808,7 @@ setup_avm_pcipnp(struct IsdnCard *card) printk(KERN_WARNING "FritzPCI: No PCI card found\n"); return(0); } - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; #else printk(KERN_WARNING "FritzPCI: NO_PCI_BIOS\n"); return (0); diff --git a/drivers/isdn/hisax/bkm_a4t.c b/drivers/isdn/hisax/bkm_a4t.c index dcb308aeb50..3cf1f242178 100644 --- a/drivers/isdn/hisax/bkm_a4t.c +++ b/drivers/isdn/hisax/bkm_a4t.c @@ -11,7 +11,6 @@ */ -#include <linux/config.h> #include <linux/init.h> #include "hisax.h" #include "isac.h" @@ -336,7 +335,7 @@ setup_bkm_a4t(struct IsdnCard *card) cs->BC_Send_Data = &jade_fill_fifo; cs->cardmsg = &BKM_card_msg; cs->irq_func = &bkm_interrupt; - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; ISACVersion(cs, "Telekom A4T:"); /* Jade version */ JadeVersion(cs, "Telekom A4T:"); diff --git a/drivers/isdn/hisax/bkm_a8.c b/drivers/isdn/hisax/bkm_a8.c index 5f21b82c8c8..15681f3e73b 100644 --- a/drivers/isdn/hisax/bkm_a8.c +++ b/drivers/isdn/hisax/bkm_a8.c @@ -11,7 +11,6 @@ */ -#include <linux/config.h> #include <linux/init.h> #include "hisax.h" #include "isac.h" @@ -375,7 +374,7 @@ setup_sct_quadro(struct IsdnCard *card) pci_ioaddr5 &= PCI_BASE_ADDRESS_IO_MASK; /* Take over */ cs->irq = pci_irq; - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; /* pci_ioaddr1 is unique to all subdevices */ /* pci_ioaddr2 is for the fourth subdevice only */ /* pci_ioaddr3 is for the third subdevice only */ diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c index 27332506f9f..5333be5d2c4 100644 --- a/drivers/isdn/hisax/config.c +++ b/drivers/isdn/hisax/config.c @@ -17,7 +17,6 @@ #include <linux/types.h> #include <linux/stddef.h> #include <linux/timer.h> -#include <linux/config.h> #include <linux/init.h> #include "hisax.h" #include <linux/module.h> diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c index b0ff1cc97d7..323a02ef384 100644 --- a/drivers/isdn/hisax/diva.c +++ b/drivers/isdn/hisax/diva.c @@ -16,7 +16,6 @@ */ #include <linux/init.h> -#include <linux/config.h> #include "hisax.h" #include "isac.h" #include "hscx.h" @@ -1077,7 +1076,7 @@ setup_diva(struct IsdnCard *card) printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n"); return(0); } - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; #else printk(KERN_WARNING "Diva: cfgreg 0 and NO_PCI_BIOS\n"); printk(KERN_WARNING "Diva: unable to config DIVA PCI\n"); diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c index f8ca4b32333..3b3e318f607 100644 --- a/drivers/isdn/hisax/elsa.c +++ b/drivers/isdn/hisax/elsa.c @@ -19,7 +19,6 @@ */ #include <linux/init.h> -#include <linux/config.h> #include "hisax.h" #include "arcofi.h" #include "isac.h" @@ -86,8 +85,8 @@ static const char *ITACVer[] = *** ***/ /* Config-Register (Read) */ -#define ELSA_TIMER_RUN 0x02 /* Bit 1 des Config-Reg */ -#define ELSA_TIMER_RUN_PCC8 0x01 /* Bit 0 des Config-Reg bei PCC */ +#define ELIRQF_TIMER_RUN 0x02 /* Bit 1 des Config-Reg */ +#define ELIRQF_TIMER_RUN_PCC8 0x01 /* Bit 0 des Config-Reg bei PCC */ #define ELSA_IRQ_IDX 0x38 /* Bit 3,4,5 des Config-Reg */ #define ELSA_IRQ_IDX_PCC8 0x30 /* Bit 4,5 des Config-Reg */ #define ELSA_IRQ_IDX_PC 0x0c /* Bit 2,3 des Config-Reg */ @@ -103,7 +102,7 @@ static const char *ITACVer[] = #define ELSA_S0_POWER_BAD 0x08 /* Bit 3 S0-Bus Spannung fehlt */ /* Status Flags */ -#define ELSA_TIMER_AKTIV 1 +#define ELIRQF_TIMER_AKTIV 1 #define ELSA_BAD_PWR 2 #define ELSA_ASSIGN 4 @@ -260,10 +259,10 @@ TimerRun(struct IsdnCardState *cs) v = bytein(cs->hw.elsa.cfg); if ((cs->subtyp == ELSA_QS1000) || (cs->subtyp == ELSA_QS3000)) - return (0 == (v & ELSA_TIMER_RUN)); + return (0 == (v & ELIRQF_TIMER_RUN)); else if (cs->subtyp == ELSA_PCC8) - return (v & ELSA_TIMER_RUN_PCC8); - return (v & ELSA_TIMER_RUN); + return (v & ELIRQF_TIMER_RUN_PCC8); + return (v & ELIRQF_TIMER_RUN); } /* * fast interrupt HSCX stuff goes here @@ -335,7 +334,7 @@ elsa_interrupt(int intno, void *dev_id, struct pt_regs *regs) writereg(cs->hw.elsa.ale, cs->hw.elsa.hscx, HSCX_MASK, 0xFF); writereg(cs->hw.elsa.ale, cs->hw.elsa.hscx, HSCX_MASK + 0x40, 0xFF); writereg(cs->hw.elsa.ale, cs->hw.elsa.isac, ISAC_MASK, 0xFF); - if (cs->hw.elsa.status & ELSA_TIMER_AKTIV) { + if (cs->hw.elsa.status & ELIRQF_TIMER_AKTIV) { if (!TimerRun(cs)) { /* Timer Restart */ byteout(cs->hw.elsa.timer, 0); @@ -686,7 +685,7 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg) spin_lock_irqsave(&cs->lock, flags); cs->hw.elsa.counter = 0; cs->hw.elsa.ctrl_reg |= ELSA_ENA_TIMER_INT; - cs->hw.elsa.status |= ELSA_TIMER_AKTIV; + cs->hw.elsa.status |= ELIRQF_TIMER_AKTIV; byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg); byteout(cs->hw.elsa.timer, 0); spin_unlock_irqrestore(&cs->lock, flags); @@ -694,7 +693,7 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg) spin_lock_irqsave(&cs->lock, flags); cs->hw.elsa.ctrl_reg &= ~ELSA_ENA_TIMER_INT; byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg); - cs->hw.elsa.status &= ~ELSA_TIMER_AKTIV; + cs->hw.elsa.status &= ~ELIRQF_TIMER_AKTIV; spin_unlock_irqrestore(&cs->lock, flags); printk(KERN_INFO "Elsa: %d timer tics in 110 msek\n", cs->hw.elsa.counter); @@ -1013,7 +1012,7 @@ setup_elsa(struct IsdnCard *card) cs->hw.elsa.timer = 0; cs->hw.elsa.trig = 0; cs->hw.elsa.ctrl = 0; - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; printk(KERN_INFO "Elsa: %s defined at %#lx IRQ %d\n", Elsa_Types[cs->subtyp], @@ -1062,7 +1061,7 @@ setup_elsa(struct IsdnCard *card) test_and_set_bit(HW_IPAC, &cs->HW_Flags); cs->hw.elsa.timer = 0; cs->hw.elsa.trig = 0; - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; printk(KERN_INFO "Elsa: %s defined at %#lx/0x%x IRQ %d\n", Elsa_Types[cs->subtyp], diff --git a/drivers/isdn/hisax/elsa_ser.c b/drivers/isdn/hisax/elsa_ser.c index 898ec091619..0279fb323cb 100644 --- a/drivers/isdn/hisax/elsa_ser.c +++ b/drivers/isdn/hisax/elsa_ser.c @@ -7,7 +7,6 @@ * */ -#include <linux/config.h> #include <linux/serial.h> #include <linux/serial_reg.h> diff --git a/drivers/isdn/hisax/enternow_pci.c b/drivers/isdn/hisax/enternow_pci.c index 3341cf15553..8fcbe2e7d76 100644 --- a/drivers/isdn/hisax/enternow_pci.c +++ b/drivers/isdn/hisax/enternow_pci.c @@ -60,7 +60,6 @@ */ -#include <linux/config.h> #include "hisax.h" #include "isac.h" #include "isdnl1.h" @@ -406,7 +405,7 @@ setup_enternow_pci(struct IsdnCard *card) cs->BC_Send_Data = &netjet_fill_dma; cs->cardmsg = &enpci_card_msg; cs->irq_func = &enpci_interrupt; - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; return (1); } diff --git a/drivers/isdn/hisax/gazel.c b/drivers/isdn/hisax/gazel.c index 60b04c6d9e7..3e7d9230358 100644 --- a/drivers/isdn/hisax/gazel.c +++ b/drivers/isdn/hisax/gazel.c @@ -11,7 +11,6 @@ * */ -#include <linux/config.h> #include <linux/init.h> #include "hisax.h" #include "isac.h" @@ -593,7 +592,7 @@ setup_gazelpci(struct IsdnCardState *cs) cs->hw.gazel.hscxfifo[0] = cs->hw.gazel.hscx[0]; cs->hw.gazel.hscxfifo[1] = cs->hw.gazel.hscx[1]; cs->irq = pci_irq; - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; switch (seekcard) { case PCI_DEVICE_ID_PLX_R685: diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c index e3866b0a97f..0f967b3df79 100644 --- a/drivers/isdn/hisax/hfc4s8s_l1.c +++ b/drivers/isdn/hisax/hfc4s8s_l1.c @@ -22,7 +22,6 @@ #include <linux/module.h> #include <linux/init.h> -#include <linux/config.h> #include <linux/pci.h> #include <linux/interrupt.h> #include <linux/delay.h> @@ -1553,7 +1552,7 @@ setup_instance(hfc4s8s_hw * hw) INIT_WORK(&hw->tqueue, (void *) (void *) hfc4s8s_bh, hw); if (request_irq - (hw->irq, hfc4s8s_interrupt, SA_SHIRQ, hw->card_name, hw)) { + (hw->irq, hfc4s8s_interrupt, IRQF_SHARED, hw->card_name, hw)) { printk(KERN_INFO "HFC-4S/8S: unable to alloc irq %d, card ignored\n", hw->irq); diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c index 91d25acb5ed..7241e73879b 100644 --- a/drivers/isdn/hisax/hfc_pci.c +++ b/drivers/isdn/hisax/hfc_pci.c @@ -16,7 +16,6 @@ */ #include <linux/init.h> -#include <linux/config.h> #include "hisax.h" #include "hfc_pci.h" #include "isdnl1.h" @@ -1688,7 +1687,7 @@ setup_hfcpci(struct IsdnCard *card) printk(KERN_WARNING "HFC-PCI: No IRQ for PCI card found\n"); return (0); } - cs->hw.hfcpci.pci_io = (char *) dev_hfcpci->resource[ 1].start; + cs->hw.hfcpci.pci_io = (char *)(unsigned long)dev_hfcpci->resource[1].start; printk(KERN_INFO "HiSax: HFC-PCI card manufacturer: %s card name: %s\n", id_list[i].vendor_name, id_list[i].card_name); } else { printk(KERN_WARNING "HFC-PCI: No PCI card found\n"); @@ -1733,7 +1732,7 @@ setup_hfcpci(struct IsdnCard *card) cs->BC_Read_Reg = NULL; cs->BC_Write_Reg = NULL; cs->irq_func = &hfcpci_interrupt; - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; cs->hw.hfcpci.timer.function = (void *) hfcpci_Timer; cs->hw.hfcpci.timer.data = (long) cs; init_timer(&cs->hw.hfcpci.timer); diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c index 262c4412741..b5e571a5269 100644 --- a/drivers/isdn/hisax/hfc_usb.c +++ b/drivers/isdn/hisax/hfc_usb.c @@ -32,7 +32,6 @@ #include <linux/types.h> #include <linux/stddef.h> #include <linux/timer.h> -#include <linux/config.h> #include <linux/init.h> #include <linux/module.h> #include <linux/kernel_stat.h> diff --git a/drivers/isdn/hisax/hisax.h b/drivers/isdn/hisax/hisax.h index 11fe537e2f6..75920aa0a3c 100644 --- a/drivers/isdn/hisax/hisax.h +++ b/drivers/isdn/hisax/hisax.h @@ -6,7 +6,6 @@ * of the GNU General Public License, incorporated herein by reference. * */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/fs.h> #include <linux/major.h> diff --git a/drivers/isdn/hisax/hisax_debug.h b/drivers/isdn/hisax/hisax_debug.h index ba518a7a7fb..ceafecdb103 100644 --- a/drivers/isdn/hisax/hisax_debug.h +++ b/drivers/isdn/hisax/hisax_debug.h @@ -22,7 +22,6 @@ #ifndef __HISAX_DEBUG_H__ #define __HISAX_DEBUG_H__ -#include <linux/config.h> #ifdef CONFIG_HISAX_DEBUG diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c index dbcca287ee2..1d7cf3bd6aa 100644 --- a/drivers/isdn/hisax/hisax_fcpcipnp.c +++ b/drivers/isdn/hisax/hisax_fcpcipnp.c @@ -725,11 +725,11 @@ static int __devinit fcpcipnp_setup(struct fritz_adapter *adapter) switch (adapter->type) { case AVM_FRITZ_PCIV2: - retval = request_irq(adapter->irq, fcpci2_irq, SA_SHIRQ, + retval = request_irq(adapter->irq, fcpci2_irq, IRQF_SHARED, "fcpcipnp", adapter); break; case AVM_FRITZ_PCI: - retval = request_irq(adapter->irq, fcpci_irq, SA_SHIRQ, + retval = request_irq(adapter->irq, fcpci_irq, IRQF_SHARED, "fcpcipnp", adapter); break; case AVM_FRITZ_PNP: diff --git a/drivers/isdn/hisax/ipacx.c b/drivers/isdn/hisax/ipacx.c index 2e9afae1254..df5fc92a89b 100644 --- a/drivers/isdn/hisax/ipacx.c +++ b/drivers/isdn/hisax/ipacx.c @@ -10,7 +10,6 @@ * */ #include <linux/kernel.h> -#include <linux/config.h> #include <linux/init.h> #include "hisax_if.h" #include "hisax.h" diff --git a/drivers/isdn/hisax/isdnl3.c b/drivers/isdn/hisax/isdnl3.c index c9917cd2132..281fa27d9f0 100644 --- a/drivers/isdn/hisax/isdnl3.c +++ b/drivers/isdn/hisax/isdnl3.c @@ -18,7 +18,6 @@ #include <linux/init.h> #include "hisax.h" #include "isdnl3.h" -#include <linux/config.h> const char *l3_revision = "$Revision: 2.22.2.3 $"; diff --git a/drivers/isdn/hisax/l3dss1.c b/drivers/isdn/hisax/l3dss1.c index e96845cdd4f..99feae8b921 100644 --- a/drivers/isdn/hisax/l3dss1.c +++ b/drivers/isdn/hisax/l3dss1.c @@ -23,7 +23,6 @@ #include "isdnl3.h" #include "l3dss1.h" #include <linux/ctype.h> -#include <linux/config.h> extern char *HiSax_getrev(const char *revision); static const char *dss1_revision = "$Revision: 2.32.2.3 $"; diff --git a/drivers/isdn/hisax/niccy.c b/drivers/isdn/hisax/niccy.c index 68a2159cbd1..79a97b1c381 100644 --- a/drivers/isdn/hisax/niccy.c +++ b/drivers/isdn/hisax/niccy.c @@ -14,7 +14,6 @@ */ -#include <linux/config.h> #include <linux/init.h> #include "hisax.h" #include "isac.h" @@ -337,7 +336,7 @@ setup_niccy(struct IsdnCard *card) printk(KERN_WARNING "Niccy: No PCI card found\n"); return(0); } - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; cs->hw.niccy.isac = pci_ioaddr + ISAC_PCI_DATA; cs->hw.niccy.isac_ale = pci_ioaddr + ISAC_PCI_ADDR; cs->hw.niccy.hscx = pci_ioaddr + HSCX_PCI_DATA; diff --git a/drivers/isdn/hisax/nj_s.c b/drivers/isdn/hisax/nj_s.c index a7d3cd3f36f..e5b900a6fa0 100644 --- a/drivers/isdn/hisax/nj_s.c +++ b/drivers/isdn/hisax/nj_s.c @@ -5,7 +5,6 @@ * */ -#include <linux/config.h> #include <linux/init.h> #include "hisax.h" #include "isac.h" @@ -272,7 +271,7 @@ setup_netjet_s(struct IsdnCard *card) setup_isac(cs); cs->cardmsg = &NETjet_S_card_msg; cs->irq_func = &netjet_s_interrupt; - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; ISACVersion(cs, "NETjet-S:"); return (1); } diff --git a/drivers/isdn/hisax/nj_u.c b/drivers/isdn/hisax/nj_u.c index 1ae7cac98a8..7002b09936d 100644 --- a/drivers/isdn/hisax/nj_u.c +++ b/drivers/isdn/hisax/nj_u.c @@ -5,7 +5,6 @@ * */ -#include <linux/config.h> #include <linux/init.h> #include "hisax.h" #include "icc.h" @@ -238,7 +237,7 @@ setup_netjet_u(struct IsdnCard *card) cs->BC_Send_Data = &netjet_fill_dma; cs->cardmsg = &NETjet_U_card_msg; cs->irq_func = &netjet_u_interrupt; - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; ICCVersion(cs, "NETspider-U:"); return (1); } diff --git a/drivers/isdn/hisax/sedlbauer.c b/drivers/isdn/hisax/sedlbauer.c index 8c044a6a7fe..8d8e8a29989 100644 --- a/drivers/isdn/hisax/sedlbauer.c +++ b/drivers/isdn/hisax/sedlbauer.c @@ -39,7 +39,6 @@ */ #include <linux/init.h> -#include <linux/config.h> #include "hisax.h" #include "isac.h" #include "ipac.h" @@ -633,7 +632,7 @@ setup_sedlbauer(struct IsdnCard *card) printk(KERN_WARNING "Sedlbauer: No PCI card found\n"); return(0); } - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; cs->hw.sedl.bus = SEDL_BUS_PCI; sub_vendor_id = dev_sedl->subsystem_vendor; sub_id = dev_sedl->subsystem_device; @@ -810,7 +809,7 @@ ready: cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_HSCX; cs->hw.sedl.reset_on = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_RESET; cs->hw.sedl.reset_off = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_RESET; - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; } else { cs->hw.sedl.adr = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_ADR; cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_ISAC; diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 9bb18f3f782..f9c14a2970b 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c @@ -164,7 +164,7 @@ static int sedlbauer_probe(struct pcmcia_device *link) link->priv = local; /* Interrupt setup */ - link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; + link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; link->irq.IRQInfo1 = IRQ_LEVEL_ID; link->irq.Handler = NULL; diff --git a/drivers/isdn/hisax/st5481.h b/drivers/isdn/hisax/st5481.h index 9ffaae7c657..04416bad611 100644 --- a/drivers/isdn/hisax/st5481.h +++ b/drivers/isdn/hisax/st5481.h @@ -13,7 +13,6 @@ #ifndef _ST5481_H_ #define _ST5481_H_ -#include <linux/config.h> // USB IDs, the Product Id is in the range 0x4810-0x481F diff --git a/drivers/isdn/hisax/st5481_init.c b/drivers/isdn/hisax/st5481_init.c index 99cb0f3d59a..2716aa5c60f 100644 --- a/drivers/isdn/hisax/st5481_init.c +++ b/drivers/isdn/hisax/st5481_init.c @@ -24,7 +24,6 @@ * clean up debug */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/usb.h> diff --git a/drivers/isdn/hisax/teles3.c b/drivers/isdn/hisax/teles3.c index a3eaf4d6570..5cb712437da 100644 --- a/drivers/isdn/hisax/teles3.c +++ b/drivers/isdn/hisax/teles3.c @@ -369,6 +369,7 @@ setup_teles3(struct IsdnCard *card) cs->hw.teles3.hscx[1] + 96); return (0); } + cs->irq_flags |= IRQF_SHARED; /* cardbus can share */ } else { if (cs->hw.teles3.cfg_reg) { if (cs->typ == ISDN_CTYPE_COMPAQ_ISA) { diff --git a/drivers/isdn/hisax/telespci.c b/drivers/isdn/hisax/telespci.c index e2bb4fd8e25..9382cdf04d8 100644 --- a/drivers/isdn/hisax/telespci.c +++ b/drivers/isdn/hisax/telespci.c @@ -13,7 +13,6 @@ */ #include <linux/init.h> -#include <linux/config.h> #include "hisax.h" #include "isac.h" #include "hscx.h" @@ -311,8 +310,9 @@ setup_telespci(struct IsdnCard *card) } cs->hw.teles0.membase = ioremap(pci_resource_start(dev_tel, 0), PAGE_SIZE); - printk(KERN_INFO "Found: Zoran, base-address: 0x%lx, irq: 0x%x\n", - pci_resource_start(dev_tel, 0), dev_tel->irq); + printk(KERN_INFO "Found: Zoran, base-address: 0x%llx, irq: 0x%x\n", + (unsigned long long)pci_resource_start(dev_tel, 0), + dev_tel->irq); } else { printk(KERN_WARNING "TelesPCI: No PCI card found\n"); return(0); @@ -347,7 +347,7 @@ setup_telespci(struct IsdnCard *card) cs->BC_Send_Data = &hscx_fill_fifo; cs->cardmsg = &TelesPCI_card_msg; cs->irq_func = &telespci_interrupt; - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; ISACVersion(cs, "TelesPCI:"); if (HscxVersion(cs, "TelesPCI:")) { printk(KERN_WARNING diff --git a/drivers/isdn/hisax/w6692.c b/drivers/isdn/hisax/w6692.c index 0352ee5f706..6c68419c05f 100644 --- a/drivers/isdn/hisax/w6692.c +++ b/drivers/isdn/hisax/w6692.c @@ -10,7 +10,6 @@ * */ -#include <linux/config.h> #include <linux/init.h> #include "hisax.h" #include "w6692.h" @@ -1081,7 +1080,7 @@ setup_w6692(struct IsdnCard *card) cs->BC_Send_Data = &W6692B_fill_fifo; cs->cardmsg = &w6692_card_msg; cs->irq_func = &W6692_interrupt; - cs->irq_flags |= SA_SHIRQ; + cs->irq_flags |= IRQF_SHARED; W6692Version(cs, "W6692:"); printk(KERN_INFO "W6692 ISTA=0x%X\n", ReadW6692(cs, W_ISTA)); printk(KERN_INFO "W6692 IMASK=0x%X\n", ReadW6692(cs, W_IMASK)); diff --git a/drivers/isdn/hysdn/boardergo.c b/drivers/isdn/hysdn/boardergo.c index 48d134be990..73afebdf80b 100644 --- a/drivers/isdn/hysdn/boardergo.c +++ b/drivers/isdn/hysdn/boardergo.c @@ -14,7 +14,6 @@ * */ -#include <linux/config.h> #include <linux/sched.h> #include <linux/signal.h> #include <linux/kernel.h> @@ -436,7 +435,7 @@ ergo_inithardware(hysdn_card * card) } ergo_stopcard(card); /* disable interrupts */ - if (request_irq(card->irq, ergo_interrupt, SA_SHIRQ, "HYSDN", card)) { + if (request_irq(card->irq, ergo_interrupt, IRQF_SHARED, "HYSDN", card)) { ergo_releasehardware(card); /* return the acquired hardware */ return (-1); } diff --git a/drivers/isdn/hysdn/hysdn_defs.h b/drivers/isdn/hysdn/hysdn_defs.h index 3a9b29b38bc..461e831592d 100644 --- a/drivers/isdn/hysdn/hysdn_defs.h +++ b/drivers/isdn/hysdn/hysdn_defs.h @@ -14,7 +14,6 @@ #ifndef HYSDN_DEFS_H #define HYSDN_DEFS_H -#include <linux/config.h> #include <linux/hysdn_if.h> #include <linux/interrupt.h> #include <linux/workqueue.h> diff --git a/drivers/isdn/hysdn/hysdn_init.c b/drivers/isdn/hysdn/hysdn_init.c index b75ac5af236..b702ed27252 100644 --- a/drivers/isdn/hysdn/hysdn_init.c +++ b/drivers/isdn/hysdn/hysdn_init.c @@ -10,7 +10,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/poll.h> diff --git a/drivers/isdn/hysdn/hysdn_sched.c b/drivers/isdn/hysdn/hysdn_sched.c index 133032920ff..1c0d54ac12a 100644 --- a/drivers/isdn/hysdn/hysdn_sched.c +++ b/drivers/isdn/hysdn/hysdn_sched.c @@ -11,7 +11,6 @@ * */ -#include <linux/config.h> #include <linux/sched.h> #include <linux/signal.h> #include <linux/kernel.h> diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index b26e509ec75..9f6c6375ff7 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c @@ -11,7 +11,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/poll.h> @@ -340,6 +339,16 @@ isdn_command(isdn_ctrl *cmd) printk(KERN_WARNING "isdn_command command(%x) driver -1\n", cmd->command); return(1); } + if (!dev->drv[cmd->driver]) { + printk(KERN_WARNING "isdn_command command(%x) dev->drv[%d] NULL\n", + cmd->command, cmd->driver); + return(1); + } + if (!dev->drv[cmd->driver]->interface) { + printk(KERN_WARNING "isdn_command command(%x) dev->drv[%d]->interface NULL\n", + cmd->command, cmd->driver); + return(1); + } if (cmd->command == ISDN_CMD_SETL2) { int idx = isdn_dc2minor(cmd->driver, cmd->arg & 255); unsigned long l2prot = (cmd->arg >> 8) & 255; @@ -1903,6 +1912,11 @@ isdn_free_channel(int di, int ch, int usage) { int i; + if ((di < 0) || (ch < 0)) { + printk(KERN_WARNING "%s: called with invalid drv(%d) or channel(%d)\n", + __FUNCTION__, di, ch); + return; + } for (i = 0; i < ISDN_MAX_CHANNELS; i++) if (((!usage) || ((dev->usage[i] & ISDN_USAGE_MASK) == usage)) && (dev->drvmap[i] == di) && @@ -1918,7 +1932,8 @@ isdn_free_channel(int di, int ch, int usage) dev->v110[i] = NULL; // 20.10.99 JIM, try to reinitialize v110 ! isdn_info_update(); - skb_queue_purge(&dev->drv[di]->rpqueue[ch]); + if (dev->drv[di]) + skb_queue_purge(&dev->drv[di]->rpqueue[ch]); } } diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 96c115e1338..43da8ae1b2a 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c @@ -22,7 +22,6 @@ * http://i4l.zabbadoz.net/i4l/cisco-hdlc.txt */ -#include <linux/config.h> #include <linux/isdn.h> #include <net/arp.h> #include <net/dst.h> diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 918742271c7..29e7667ec96 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/isdn.h> #include <linux/poll.h> #include <linux/ppp-comp.h> diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index 433389daedb..9ab66e8960d 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c @@ -11,7 +11,6 @@ */ #undef ISDN_TTY_STAT_DEBUG -#include <linux/config.h> #include <linux/isdn.h> #include <linux/delay.h> #include "isdn_common.h" @@ -1890,14 +1889,13 @@ isdn_tty_modem_init(void) if (!m->tty_modem) return -ENOMEM; m->tty_modem->name = "ttyI"; - m->tty_modem->devfs_name = "isdn/ttyI"; m->tty_modem->major = ISDN_TTY_MAJOR; m->tty_modem->minor_start = 0; m->tty_modem->type = TTY_DRIVER_TYPE_SERIAL; m->tty_modem->subtype = SERIAL_TYPE_NORMAL; m->tty_modem->init_termios = tty_std_termios; m->tty_modem->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; - m->tty_modem->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; + m->tty_modem->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; m->tty_modem->driver_name = "isdn_tty"; tty_set_operations(m->tty_modem, &modem_ops); retval = tty_register_driver(m->tty_modem); diff --git a/drivers/isdn/i4l/isdn_tty.h b/drivers/isdn/i4l/isdn_tty.h index 9f0fa9501f4..692c74d6b74 100644 --- a/drivers/isdn/i4l/isdn_tty.h +++ b/drivers/isdn/i4l/isdn_tty.h @@ -10,7 +10,6 @@ * */ -#include <linux/config.h> #define DLE 0x10 #define ETX 0x03 diff --git a/drivers/isdn/i4l/isdn_x25iface.c b/drivers/isdn/i4l/isdn_x25iface.c index 743ac4077f3..8b3efc24316 100644 --- a/drivers/isdn/i4l/isdn_x25iface.c +++ b/drivers/isdn/i4l/isdn_x25iface.c @@ -208,7 +208,7 @@ static int isdn_x25iface_receive(struct concap_proto *cprot, struct sk_buff *skb */ static int isdn_x25iface_connect_ind(struct concap_proto *cprot) { - struct sk_buff * skb = dev_alloc_skb(1); + struct sk_buff * skb; enum wan_states *state_p = &( ( (ix25_pdata_t*) (cprot->proto_data) ) -> state); IX25DEBUG( "isdn_x25iface_connect_ind %s \n" @@ -220,6 +220,8 @@ static int isdn_x25iface_connect_ind(struct concap_proto *cprot) return -1; } *state_p = WAN_CONNECTED; + + skb = dev_alloc_skb(1); if( skb ){ *( skb_put(skb, 1) ) = 0x01; skb->protocol = x25_type_trans(skb, cprot->net_dev); diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c index a67d31af797..fabbd461603 100644 --- a/drivers/isdn/isdnloop/isdnloop.c +++ b/drivers/isdn/isdnloop/isdnloop.c @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/init.h> diff --git a/drivers/isdn/sc/init.c b/drivers/isdn/sc/init.c index 62b7acfad8a..a627e68023f 100644 --- a/drivers/isdn/sc/init.c +++ b/drivers/isdn/sc/init.c @@ -342,7 +342,7 @@ static int __init sc_init(void) */ sc_adapter[cinst]->interrupt = irq[b]; if (request_irq(sc_adapter[cinst]->interrupt, interrupt_handler, - SA_INTERRUPT, interface->id, NULL)) + IRQF_DISABLED, interface->id, NULL)) { kfree(sc_adapter[cinst]->channel); indicate_status(cinst, ISDN_STAT_UNLOAD, 0, NULL); /* Fix me */ diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index c75d0ef1609..d424b445202 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -9,7 +9,6 @@ * published by the Free Software Foundation. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c index 1b1ce652396..47f0ff19632 100644 --- a/drivers/leds/led-triggers.c +++ b/drivers/leds/led-triggers.c @@ -11,7 +11,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> diff --git a/drivers/leds/leds-corgi.c b/drivers/leds/leds-corgi.c index bb7d84df012..cf1dcd719a2 100644 --- a/drivers/leds/leds-corgi.c +++ b/drivers/leds/leds-corgi.c @@ -11,7 +11,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> diff --git a/drivers/leds/leds-ixp4xx-gpio.c b/drivers/leds/leds-ixp4xx-gpio.c index 30ced150e4c..7dcf0b92c46 100644 --- a/drivers/leds/leds-ixp4xx-gpio.c +++ b/drivers/leds/leds-ixp4xx-gpio.c @@ -31,7 +31,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> diff --git a/drivers/leds/leds-locomo.c b/drivers/leds/leds-locomo.c index 8419e29b71f..3b87951aa55 100644 --- a/drivers/leds/leds-locomo.c +++ b/drivers/leds/leds-locomo.c @@ -8,7 +8,6 @@ * published by the Free Software Foundation. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/device.h> diff --git a/drivers/leds/leds-s3c24xx.c b/drivers/leds/leds-s3c24xx.c index 650cf72dc67..fb1edc1c9ed 100644 --- a/drivers/leds/leds-s3c24xx.c +++ b/drivers/leds/leds-s3c24xx.c @@ -11,7 +11,6 @@ * published by the Free Software Foundation. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> diff --git a/drivers/leds/leds-spitz.c b/drivers/leds/leds-spitz.c index 65bbef4a5e0..126d09cc96e 100644 --- a/drivers/leds/leds-spitz.c +++ b/drivers/leds/leds-spitz.c @@ -11,7 +11,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> diff --git a/drivers/leds/leds-tosa.c b/drivers/leds/leds-tosa.c index c9e8cc1ec48..fb2416a3830 100644 --- a/drivers/leds/leds-tosa.c +++ b/drivers/leds/leds-tosa.c @@ -12,7 +12,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c index fbf141ef46e..179c2876b54 100644 --- a/drivers/leds/ledtrig-timer.c +++ b/drivers/leds/ledtrig-timer.c @@ -11,7 +11,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig index 37cd6ee4586..54f3f6b94ef 100644 --- a/drivers/macintosh/Kconfig +++ b/drivers/macintosh/Kconfig @@ -78,6 +78,18 @@ config ADB_PMU this device; you should do so if your machine is one of those mentioned above. +config ADB_PMU_LED + bool "Support for the Power/iBook front LED" + depends on ADB_PMU + select NEW_LEDS + select LEDS_CLASS + help + Support the front LED on Power/iBooks as a generic LED that can + be triggered by any of the supported triggers. To get the + behaviour of the old CONFIG_BLK_DEV_IDE_PMAC_BLINK, select this + and the ide-disk LED trigger and configure appropriately through + sysfs. + config PMAC_SMU bool "Support for SMU based PowerMacs" depends on PPC_PMAC64 diff --git a/drivers/macintosh/Makefile b/drivers/macintosh/Makefile index 45a268f8047..b53d45f87b0 100644 --- a/drivers/macintosh/Makefile +++ b/drivers/macintosh/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_INPUT_ADBHID) += adbhid.o obj-$(CONFIG_ANSLCD) += ans-lcd.o obj-$(CONFIG_ADB_PMU) += via-pmu.o via-pmu-event.o +obj-$(CONFIG_ADB_PMU_LED) += via-pmu-led.o obj-$(CONFIG_PMAC_BACKLIGHT) += via-pmu-backlight.o obj-$(CONFIG_ADB_CUDA) += via-cuda.o obj-$(CONFIG_PMAC_APM_EMU) += apm_emu.o diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index 259fd8973ce..360f93f6fcd 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c @@ -16,7 +16,6 @@ * - move bus probe to a kernel thread */ -#include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/kernel.h> @@ -36,7 +35,6 @@ #include <linux/spinlock.h> #include <linux/completion.h> #include <linux/device.h> -#include <linux/devfs_fs_kernel.h> #include <asm/uaccess.h> #include <asm/semaphore.h> @@ -904,8 +902,6 @@ adbdev_init(void) return; } - devfs_mk_cdev(MKDEV(ADB_MAJOR, 0), S_IFCHR | S_IRUSR | S_IWUSR, "adb"); - adb_dev_class = class_create(THIS_MODULE, "adb"); if (IS_ERR(adb_dev_class)) return; diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c index cbfbbe2b150..545be1ed692 100644 --- a/drivers/macintosh/adbhid.c +++ b/drivers/macintosh/adbhid.c @@ -34,7 +34,6 @@ * Move to syfs */ -#include <linux/config.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/init.h> diff --git a/drivers/macintosh/apm_emu.c b/drivers/macintosh/apm_emu.c index e5a2bbf9939..1293876a2eb 100644 --- a/drivers/macintosh/apm_emu.c +++ b/drivers/macintosh/apm_emu.c @@ -18,7 +18,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/poll.h> diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c index a66636116f0..6b129eef798 100644 --- a/drivers/macintosh/mac_hid.c +++ b/drivers/macintosh/mac_hid.c @@ -8,7 +8,6 @@ * This file will soon be removed in favor of an uinput userspace tool. */ -#include <linux/config.h> #include <linux/init.h> #include <linux/proc_fs.h> #include <linux/sysctl.h> diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index 431bd37225a..40ae7b6a939 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c @@ -17,7 +17,6 @@ * sub-devices. */ -#include <linux/config.h> #include <linux/string.h> #include <linux/kernel.h> #include <linux/pci.h> @@ -428,10 +427,10 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, /* MacIO itself has a different reg, we use it's PCI base */ if (np == chip->of_node) { - sprintf(dev->ofdev.dev.bus_id, "%1d.%08lx:%.*s", + sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s", chip->lbus.index, #ifdef CONFIG_PCI - pci_resource_start(chip->lbus.pdev, 0), + (unsigned int)pci_resource_start(chip->lbus.pdev, 0), #else 0, /* NuBus may want to do something better here */ #endif diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c index 7f7d4eaca87..cae24a13526 100644 --- a/drivers/macintosh/macio_sysfs.c +++ b/drivers/macintosh/macio_sysfs.c @@ -1,4 +1,3 @@ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/stat.h> #include <asm/macio.h> diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index 53c1c790941..0acf2f7fd9d 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c @@ -10,7 +10,6 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/kernel.h> diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index f4516ca7aa3..ff6d9bfdc3d 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c @@ -19,7 +19,6 @@ * the userland interface */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/device.h> @@ -556,7 +555,7 @@ static int smu_late_init(void) if (smu->db_irq != NO_IRQ) { if (request_irq(smu->db_irq, smu_db_intr, - SA_SHIRQ, "SMU doorbell", smu) < 0) { + IRQF_SHARED, "SMU doorbell", smu) < 0) { printk(KERN_WARNING "SMU: can't " "request interrupt %d\n", smu->db_irq); @@ -566,7 +565,7 @@ static int smu_late_init(void) if (smu->msg_irq != NO_IRQ) { if (request_irq(smu->msg_irq, smu_msg_intr, - SA_SHIRQ, "SMU message", smu) < 0) { + IRQF_SHARED, "SMU message", smu) < 0) { printk(KERN_WARNING "SMU: can't " "request interrupt %d\n", smu->msg_irq); diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 5282fec1707..7f86478bdd3 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/errno.h> diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index 231146f439d..c1fe0b368f7 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c @@ -97,7 +97,6 @@ * */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/errno.h> diff --git a/drivers/macintosh/therm_pm72.h b/drivers/macintosh/therm_pm72.h index c17e61f9c41..fc7e9b7ecaf 100644 --- a/drivers/macintosh/therm_pm72.h +++ b/drivers/macintosh/therm_pm72.h @@ -93,7 +93,7 @@ static char * critical_overtemp_path = "/sbin/critical_overtemp"; * 0. This appear to be safe enough for this first version * of the driver, though I would accept any clean patch * doing a better use of the device-tree without turning the - * while i2c registration mecanism into a racy mess + * while i2c registration mechanism into a racy mess * * Note: Xserve changed this. We have some bits on the K2 bus, * which I arbitrarily set to 0x200. Ultimately, we really want diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index 3d9dd2e166a..c7d1c290cb0 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c @@ -27,7 +27,6 @@ * */ -#include <linux/config.h> #include <linux/types.h> #include <linux/module.h> #include <linux/errno.h> diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c index 2d9d7915040..6501db50fb8 100644 --- a/drivers/macintosh/via-cuda.c +++ b/drivers/macintosh/via-cuda.c @@ -9,7 +9,6 @@ * Copyright (C) 1996 Paul Mackerras. */ #include <stdarg.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/kernel.h> diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c new file mode 100644 index 00000000000..af8375ed0f5 --- /dev/null +++ b/drivers/macintosh/via-pmu-led.c @@ -0,0 +1,144 @@ +/* + * via-pmu LED class device + * + * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or + * NON INFRINGEMENT. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include <linux/types.h> +#include <linux/kernel.h> +#include <linux/device.h> +#include <linux/leds.h> +#include <linux/adb.h> +#include <linux/pmu.h> +#include <asm/prom.h> + +static spinlock_t pmu_blink_lock; +static struct adb_request pmu_blink_req; +/* -1: no change, 0: request off, 1: request on */ +static int requested_change; +static int sleeping; + +static void pmu_req_done(struct adb_request * req) +{ + unsigned long flags; + + spin_lock_irqsave(&pmu_blink_lock, flags); + /* if someone requested a change in the meantime + * (we only see the last one which is fine) + * then apply it now */ + if (requested_change != -1 && !sleeping) + pmu_request(&pmu_blink_req, NULL, 4, 0xee, 4, 0, requested_change); + /* reset requested change */ + requested_change = -1; + spin_unlock_irqrestore(&pmu_blink_lock, flags); +} + +static void pmu_led_set(struct led_classdev *led_cdev, + enum led_brightness brightness) +{ + unsigned long flags; + + spin_lock_irqsave(&pmu_blink_lock, flags); + switch (brightness) { + case LED_OFF: + requested_change = 0; + break; + case LED_FULL: + requested_change = 1; + break; + default: + goto out; + break; + } + /* if request isn't done, then don't do anything */ + if (pmu_blink_req.complete && !sleeping) + pmu_request(&pmu_blink_req, NULL, 4, 0xee, 4, 0, requested_change); + out: + spin_unlock_irqrestore(&pmu_blink_lock, flags); +} + +static struct led_classdev pmu_led = { + .name = "pmu-front-led", +#ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK + .default_trigger = "ide-disk", +#endif + .brightness_set = pmu_led_set, +}; + +#ifdef CONFIG_PM +static int pmu_led_sleep_call(struct pmu_sleep_notifier *self, int when) +{ + unsigned long flags; + + spin_lock_irqsave(&pmu_blink_lock, flags); + + switch (when) { + case PBOOK_SLEEP_REQUEST: + sleeping = 1; + break; + case PBOOK_WAKE: + sleeping = 0; + break; + default: + /* do nothing */ + break; + } + spin_unlock_irqrestore(&pmu_blink_lock, flags); + + return PBOOK_SLEEP_OK; +} + +static struct pmu_sleep_notifier via_pmu_led_sleep_notif = { + .notifier_call = pmu_led_sleep_call, +}; +#endif + +static int __init via_pmu_led_init(void) +{ + struct device_node *dt; + const char *model; + + /* only do this on keylargo based models */ + if (pmu_get_model() != PMU_KEYLARGO_BASED) + return -ENODEV; + + dt = of_find_node_by_path("/"); + if (dt == NULL) + return -ENODEV; + model = (const char *)get_property(dt, "model", NULL); + if (model == NULL) + return -ENODEV; + if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 && + strncmp(model, "iBook", strlen("iBook")) != 0) { + of_node_put(dt); + /* ignore */ + return -ENODEV; + } + of_node_put(dt); + + spin_lock_init(&pmu_blink_lock); + /* no outstanding req */ + pmu_blink_req.complete = 1; + pmu_blink_req.done = pmu_req_done; +#ifdef CONFIG_PM + pmu_register_sleep_notifier(&via_pmu_led_sleep_notif); +#endif + return led_classdev_register(NULL, &pmu_led); +} + +late_initcall(via_pmu_led_init); diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index 1ab4f16c08b..c1193d34ec9 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c @@ -21,7 +21,6 @@ * */ #include <stdarg.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/kernel.h> diff --git a/drivers/macintosh/windfarm_cpufreq_clamp.c b/drivers/macintosh/windfarm_cpufreq_clamp.c index 81337cd16e8..900aade0619 100644 --- a/drivers/macintosh/windfarm_cpufreq_clamp.c +++ b/drivers/macintosh/windfarm_cpufreq_clamp.c @@ -1,4 +1,3 @@ -#include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/kernel.h> diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index ebbd2d85625..ecc56765d94 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -20,7 +20,6 @@ #include <linux/errno.h> #include <linux/slab.h> #include <linux/init.h> -#include <linux/config.h> #include <linux/timer.h> #include <linux/sched.h> #include <linux/list.h> diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 3edb3477f98..d13bb15a8a0 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c @@ -13,7 +13,6 @@ #include <linux/init.h> #include <linux/wait.h> #include <linux/slab.h> -#include <linux/devfs_fs_kernel.h> #include <linux/dm-ioctl.h> #include <linux/hdreg.h> @@ -68,14 +67,12 @@ static int dm_hash_init(void) { init_buckets(_name_buckets); init_buckets(_uuid_buckets); - devfs_mk_dir(DM_DIR); return 0; } static void dm_hash_exit(void) { dm_hash_remove_all(0); - devfs_remove(DM_DIR); } /*----------------------------------------------------------------- @@ -172,25 +169,6 @@ static void free_cell(struct hash_cell *hc) } /* - * devfs stuff. - */ -static int register_with_devfs(struct hash_cell *hc) -{ - struct gendisk *disk = dm_disk(hc->md); - - devfs_mk_bdev(MKDEV(disk->major, disk->first_minor), - S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP, - DM_DIR "/%s", hc->name); - return 0; -} - -static int unregister_with_devfs(struct hash_cell *hc) -{ - devfs_remove(DM_DIR"/%s", hc->name); - return 0; -} - -/* * The kdev_t and uuid of a device can never change once it is * initially inserted. */ @@ -226,7 +204,6 @@ static int dm_hash_insert(const char *name, const char *uuid, struct mapped_devi } list_add(&cell->uuid_list, _uuid_buckets + hash_str(uuid)); } - register_with_devfs(cell); dm_get(md); dm_set_mdptr(md, cell); up_write(&_hash_lock); @@ -246,7 +223,6 @@ static void __hash_remove(struct hash_cell *hc) /* remove from the dev hash */ list_del(&hc->uuid_list); list_del(&hc->name_list); - unregister_with_devfs(hc); dm_set_mdptr(hc->md, NULL); table = dm_get_table(hc->md); @@ -342,16 +318,11 @@ static int dm_hash_rename(const char *old, const char *new) /* * rename and move the name cell. */ - unregister_with_devfs(hc); - list_del(&hc->name_list); old_name = hc->name; hc->name = new_name; list_add(&hc->name_list, _name_buckets + hash_str(new_name)); - /* rename the device node in devfs */ - register_with_devfs(hc); - /* * Wake up any dm event waiters. */ @@ -1501,7 +1472,6 @@ static struct file_operations _ctl_fops = { static struct miscdevice _dm_misc = { .minor = MISC_DYNAMIC_MINOR, .name = DM_NAME, - .devfs_name = "mapper/control", .fops = &_ctl_fops }; diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 8eea0ddbf5e..1d0fafda0f7 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -7,7 +7,6 @@ */ #include <linux/blkdev.h> -#include <linux/config.h> #include <linux/ctype.h> #include <linux/device-mapper.h> #include <linux/fs.h> diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 3ed2e53b9eb..c99bf9f0175 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -167,7 +167,7 @@ static void local_exit(void) bioset_free(dm_set); if (unregister_blkdev(_major, _name) < 0) - DMERR("devfs_unregister_blkdev failed"); + DMERR("unregister_blkdev failed"); _major = 0; diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c index 73ab875fb15..f1db6eff485 100644 --- a/drivers/md/kcopyd.c +++ b/drivers/md/kcopyd.c @@ -12,7 +12,6 @@ #include <asm/atomic.h> #include <linux/blkdev.h> -#include <linux/config.h> #include <linux/fs.h> #include <linux/init.h> #include <linux/list.h> diff --git a/drivers/md/md.c b/drivers/md/md.c index 306268ec99f..2fe32c26192 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -33,13 +33,11 @@ */ #include <linux/module.h> -#include <linux/config.h> #include <linux/kthread.h> #include <linux/linkage.h> #include <linux/raid/md.h> #include <linux/raid/bitmap.h> #include <linux/sysctl.h> -#include <linux/devfs_fs_kernel.h> #include <linux/buffer_head.h> /* for invalidate_bdev */ #include <linux/suspend.h> #include <linux/poll.h> @@ -2911,13 +2909,10 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data) } disk->major = MAJOR(dev); disk->first_minor = unit << shift; - if (partitioned) { + if (partitioned) sprintf(disk->disk_name, "md_d%d", unit); - sprintf(disk->devfs_name, "md/d%d", unit); - } else { + else sprintf(disk->disk_name, "md%d", unit); - sprintf(disk->devfs_name, "md/%d", unit); - } disk->fops = &md_fops; disk->private_data = mddev; disk->queue = mddev->queue; @@ -5538,8 +5533,6 @@ static void md_geninit(void) static int __init md_init(void) { - int minor; - printk(KERN_INFO "md: md driver %d.%d.%d MAX_MD_DEVS=%d," " MD_SB_DISKS=%d\n", MD_MAJOR_VERSION, MD_MINOR_VERSION, @@ -5553,23 +5546,11 @@ static int __init md_init(void) unregister_blkdev(MAJOR_NR, "md"); return -1; } - devfs_mk_dir("md"); blk_register_region(MKDEV(MAJOR_NR, 0), MAX_MD_DEVS, THIS_MODULE, md_probe, NULL, NULL); blk_register_region(MKDEV(mdp_major, 0), MAX_MD_DEVS<<MdpMinorShift, THIS_MODULE, md_probe, NULL, NULL); - for (minor=0; minor < MAX_MD_DEVS; ++minor) - devfs_mk_bdev(MKDEV(MAJOR_NR, minor), - S_IFBLK|S_IRUSR|S_IWUSR, - "md/%d", minor); - - for (minor=0; minor < MAX_MD_DEVS; ++minor) - devfs_mk_bdev(MKDEV(mdp_major, minor<<MdpMinorShift), - S_IFBLK|S_IRUSR|S_IWUSR, - "md/mdp%d", minor); - - register_reboot_notifier(&md_notifier); raid_table_header = register_sysctl_table(raid_root_table, 1); @@ -5625,15 +5606,9 @@ static __exit void md_exit(void) { mddev_t *mddev; struct list_head *tmp; - int i; + blk_unregister_region(MKDEV(MAJOR_NR,0), MAX_MD_DEVS); blk_unregister_region(MKDEV(mdp_major,0), MAX_MD_DEVS << MdpMinorShift); - for (i=0; i < MAX_MD_DEVS; i++) - devfs_remove("md/%d", i); - for (i=0; i < MAX_MD_DEVS; i++) - devfs_remove("md/d%d", i); - - devfs_remove("md"); unregister_blkdev(MAJOR_NR,"md"); unregister_blkdev(mdp_major, "mdp"); diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index f920e50ea12..7433871f4b3 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -19,7 +19,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/highmem.h> @@ -2827,7 +2826,6 @@ static inline sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *ski struct stripe_head *sh; int pd_idx; int raid_disks = conf->raid_disks; - int data_disks = raid_disks - conf->max_degraded; sector_t max_sector = mddev->size << 1; int sync_blocks; int still_degraded = 0; diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c index 8cdd4d265ff..b88451e33c0 100644 --- a/drivers/media/common/saa7146_core.c +++ b/drivers/media/common/saa7146_core.c @@ -363,7 +363,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent saa7146_write(dev, MC2, 0xf8000000); /* request an interrupt for the saa7146 */ - err = request_irq(pci->irq, interrupt_hw, SA_SHIRQ | SA_INTERRUPT, + err = request_irq(pci->irq, interrupt_hw, IRQF_SHARED | IRQF_DISABLED, dev->name, dev); if (err < 0) { ERR(("request_irq() failed.\n")); diff --git a/drivers/media/common/saa7146_hlp.c b/drivers/media/common/saa7146_hlp.c index 2092e6c33dd..d2905720eb7 100644 --- a/drivers/media/common/saa7146_hlp.c +++ b/drivers/media/common/saa7146_hlp.c @@ -158,7 +158,7 @@ static int calculate_h_scale_registers(struct saa7146_dev *dev, } /* the horizontal scaling increment controls the UV filter - to reduce the bandwith to improve the display quality, + to reduce the bandwidth to improve the display quality, so set it ... */ if ( xsci == 0x400) pfuv = 0x00; diff --git a/drivers/media/dvb/b2c2/flexcop-common.h b/drivers/media/dvb/b2c2/flexcop-common.h index b3dd0603cd9..5a6c4fe249e 100644 --- a/drivers/media/dvb/b2c2/flexcop-common.h +++ b/drivers/media/dvb/b2c2/flexcop-common.h @@ -8,7 +8,6 @@ #ifndef __FLEXCOP_COMMON_H__ #define __FLEXCOP_COMMON_H__ -#include <linux/config.h> #include <linux/pci.h> #include <linux/mutex.h> diff --git a/drivers/media/dvb/b2c2/flexcop-pci.c b/drivers/media/dvb/b2c2/flexcop-pci.c index f0404170219..eb2e6432c8c 100644 --- a/drivers/media/dvb/b2c2/flexcop-pci.c +++ b/drivers/media/dvb/b2c2/flexcop-pci.c @@ -294,7 +294,7 @@ static int flexcop_pci_init(struct flexcop_pci *fc_pci) pci_set_drvdata(fc_pci->pdev, fc_pci); if ((ret = request_irq(fc_pci->pdev->irq, flexcop_pci_isr, - SA_SHIRQ, DRIVER_NAME, fc_pci)) != 0) + IRQF_SHARED, DRIVER_NAME, fc_pci)) != 0) goto err_pci_iounmap; spin_lock_init(&fc_pci->irq_lock); diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c index 761fa6e7d76..755822ee6e9 100644 --- a/drivers/media/dvb/bt8xx/bt878.c +++ b/drivers/media/dvb/bt8xx/bt878.c @@ -488,7 +488,7 @@ static int __devinit bt878_probe(struct pci_dev *dev, btwrite(0, BT848_INT_MASK); result = request_irq(bt->irq, bt878_irq, - SA_SHIRQ | SA_INTERRUPT, "bt878", + IRQF_SHARED | IRQF_DISABLED, "bt878", (void *) bt); if (result == -EINVAL) { printk(KERN_ERR "bt878(%d): Bad irq number or handler\n", diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index 1b895360042..001c71b6be6 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c @@ -22,7 +22,6 @@ * */ -#include <linux/config.h> #include <linux/init.h> #include <linux/module.h> #include <linux/slab.h> diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 5e8bb41a088..59ac35ddd51 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -570,7 +570,8 @@ static int dvb_frontend_thread(void *data) dvb_frontend_add_event(fe, s); fepriv->status = s; } - } + } else + dvb_frontend_swzigzag(fe); } else dvb_frontend_swzigzag(fe); } @@ -975,6 +976,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file, case FE_SET_FRONTEND_TUNE_MODE: fepriv->tune_mode_flags = (unsigned long) parg; + err = 0; break; }; diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c index 134c2bbbeeb..40774feb895 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.c +++ b/drivers/media/dvb/dvb-core/dvbdev.c @@ -231,10 +231,6 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, mutex_unlock(&dvbdev_register_lock); - devfs_mk_cdev(MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), - S_IFCHR | S_IRUSR | S_IWUSR, - "dvb/adapter%d/%s%d", adap->num, dnames[type], id); - class_device_create(dvb_class, NULL, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), adap->device, "dvb%d.%s%d", adap->num, dnames[type], id); @@ -252,9 +248,6 @@ void dvb_unregister_device(struct dvb_device *dvbdev) if (!dvbdev) return; - devfs_remove("dvb/adapter%d/%s%d", dvbdev->adapter->num, - dnames[dvbdev->type], dvbdev->id); - class_device_destroy(dvb_class, MKDEV(DVB_MAJOR, nums2minor(dvbdev->adapter->num, dvbdev->type, dvbdev->id))); @@ -302,7 +295,6 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct modu printk ("DVB: registering new adapter (%s).\n", name); - devfs_mk_dir("dvb/adapter%d", num); adap->num = num; adap->name = name; adap->module = module; @@ -319,8 +311,6 @@ EXPORT_SYMBOL(dvb_register_adapter); int dvb_unregister_adapter(struct dvb_adapter *adap) { - devfs_remove("dvb/adapter%d", adap->num); - if (mutex_lock_interruptible(&dvbdev_register_lock)) return -ERESTARTSYS; list_del (&adap->list_head); @@ -410,8 +400,6 @@ static int __init init_dvbdev(void) goto error; } - devfs_mk_dir("dvb"); - dvb_class = class_create(THIS_MODULE, "dvb"); if (IS_ERR(dvb_class)) { retval = PTR_ERR(dvb_class); @@ -428,7 +416,6 @@ error: static void __exit exit_dvbdev(void) { - devfs_remove("dvb"); class_destroy(dvb_class); cdev_del(&dvb_device_cdev); unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS); diff --git a/drivers/media/dvb/dvb-core/dvbdev.h b/drivers/media/dvb/dvb-core/dvbdev.h index d7a976d040d..7a7f75fd168 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.h +++ b/drivers/media/dvb/dvb-core/dvbdev.h @@ -27,7 +27,6 @@ #include <linux/poll.h> #include <linux/fs.h> #include <linux/list.h> -#include <linux/devfs_fs_kernel.h> #include <linux/smp_lock.h> #define DVB_MAJOR 212 diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 4cf9f89c51b..97f8ea96243 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h @@ -8,7 +8,6 @@ #ifndef __DVB_USB_H__ #define __DVB_USB_H__ -#include <linux/config.h> #include <linux/input.h> #include <linux/usb.h> #include <linux/firmware.h> diff --git a/drivers/media/dvb/frontends/cx22700.c b/drivers/media/dvb/frontends/cx22700.c index 3c7c09a362b..13ad1bfae66 100644 --- a/drivers/media/dvb/frontends/cx22700.c +++ b/drivers/media/dvb/frontends/cx22700.c @@ -134,6 +134,7 @@ static int cx22700_set_tps (struct cx22700_state *state, struct dvb_ofdm_paramet return -EINVAL; if (p->code_rate_LP < FEC_1_2 || p->code_rate_LP > FEC_7_8) + return -EINVAL; if (p->code_rate_HP == FEC_4_5 || p->code_rate_LP == FEC_4_5) return -EINVAL; diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c index f2f795cba56..274a87b7a5d 100644 --- a/drivers/media/dvb/frontends/cx24123.c +++ b/drivers/media/dvb/frontends/cx24123.c @@ -670,10 +670,10 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage switch (voltage) { case SEC_VOLTAGE_13: dprintk("%s: setting voltage 13V\n", __FUNCTION__); - return cx24123_writereg(state, 0x29, val | 0x80); + return cx24123_writereg(state, 0x29, val & 0x7f); case SEC_VOLTAGE_18: dprintk("%s: setting voltage 18V\n", __FUNCTION__); - return cx24123_writereg(state, 0x29, val & 0x7f); + return cx24123_writereg(state, 0x29, val | 0x80); default: return -EINVAL; }; diff --git a/drivers/media/dvb/frontends/dib3000mb.c b/drivers/media/dvb/frontends/dib3000mb.c index 7c6dc7e3090..5302e11883a 100644 --- a/drivers/media/dvb/frontends/dib3000mb.c +++ b/drivers/media/dvb/frontends/dib3000mb.c @@ -21,7 +21,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/moduleparam.h> diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index 6c3be252998..98673474a14 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c @@ -20,7 +20,6 @@ * see Documentation/dvb/README.dibusb for more information * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/moduleparam.h> diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c index 6e8ad176e1a..9a354708bd2 100644 --- a/drivers/media/dvb/frontends/lgdt330x.c +++ b/drivers/media/dvb/frontends/lgdt330x.c @@ -216,7 +216,7 @@ static int lgdt330x_init(struct dvb_frontend* fe) AGC_DELAY0, 0x07, AGC_DELAY2, 0xfe, /* Change the value of IAGCBW[15:8] - of inner AGC loop filter bandwith */ + of inner AGC loop filter bandwidth */ AGC_LOOP_BANDWIDTH0, 0x08, AGC_LOOP_BANDWIDTH1, 0x9a }; diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c index e83ff2104c9..9cbd164aa28 100644 --- a/drivers/media/dvb/frontends/tda10021.c +++ b/drivers/media/dvb/frontends/tda10021.c @@ -21,7 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/delay.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c index 6bffe85c161..9b57576bfeb 100644 --- a/drivers/media/dvb/frontends/ves1820.c +++ b/drivers/media/dvb/frontends/ves1820.c @@ -18,7 +18,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/delay.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c index acabea0793b..2310b2bfed4 100644 --- a/drivers/media/dvb/pluto2/pluto2.c +++ b/drivers/media/dvb/pluto2/pluto2.c @@ -616,7 +616,7 @@ static int __devinit pluto2_probe(struct pci_dev *pdev, pci_set_drvdata(pdev, pluto); - ret = request_irq(pdev->irq, pluto_irq, SA_SHIRQ, DRIVER_NAME, pluto); + ret = request_irq(pdev->irq, pluto_irq, IRQF_SHARED, DRIVER_NAME, pluto); if (ret < 0) goto err_pci_iounmap; diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index 7a5c99c200e..500f15c10aa 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c @@ -30,7 +30,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kmod.h> #include <linux/delay.h> diff --git a/drivers/media/dvb/ttpci/av7110.h b/drivers/media/dvb/ttpci/av7110.h index 3e2e12124ba..9c79696da08 100644 --- a/drivers/media/dvb/ttpci/av7110.h +++ b/drivers/media/dvb/ttpci/av7110.h @@ -6,10 +6,6 @@ #include <linux/netdevice.h> #include <linux/i2c.h> -#ifdef CONFIG_DEVFS_FS -#include <linux/devfs_fs_kernel.h> -#endif - #include <linux/dvb/video.h> #include <linux/dvb/audio.h> #include <linux/dvb/dmx.h> diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c index 6163cb03b8f..5f111d40773 100644 --- a/drivers/media/dvb/ttpci/budget-av.c +++ b/drivers/media/dvb/ttpci/budget-av.c @@ -1141,6 +1141,15 @@ static void frontend_init(struct budget_av *budget_av) break; case SUBID_DVBC_KNC1: + budget_av->reinitialise_demod = 1; + fe = tda10021_attach(&philips_cu1216_config, + &budget_av->budget.i2c_adap, + read_pwm(budget_av)); + if (fe) { + fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params; + } + break; + case SUBID_DVBC_KNC1_PLUS: case SUBID_DVBC_CINERGY1200: budget_av->reinitialise_demod = 1; @@ -1293,11 +1302,7 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio budget_av->budget.dvb_adapter.priv = budget_av; frontend_init(budget_av); - - if (!budget_av->has_saa7113) { - ciintf_init(budget_av); - } - + ciintf_init(budget_av); return 0; } diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 14559ef6153..04cef302345 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c @@ -43,7 +43,7 @@ is a bit braindead (no matching channel masks or no matching filter mask), we won't support this - yet. it doesn't event support negative filters, so the best way is maybe to keep TTUSB_HWSECTIONS undef'd and just - parse TS data. USB bandwith will be a problem when having large + parse TS data. USB bandwidth will be a problem when having large datastreams, especially for dvb-net, but hey, that's not my problem. TTUSB_DISEQC, TTUSB_TONE: @@ -126,10 +126,6 @@ struct ttusb { int revision; -#if 0 - devfs_handle_t stc_devfs_handle; -#endif - struct dvb_frontend* fe; }; @@ -1746,13 +1742,6 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i return -ENODEV; } -#if 0 - ttusb->stc_devfs_handle = - devfs_register(ttusb->adapter->devfs_handle, TTUSB_BUDGET_NAME, - DEVFS_FL_DEFAULT, 0, 192, - S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP - | S_IROTH | S_IWOTH, &stc_fops, ttusb); -#endif usb_set_intfdata(intf, (void *) ttusb); frontend_init(ttusb); diff --git a/drivers/media/radio/miropcm20-rds.c b/drivers/media/radio/miropcm20-rds.c index 87b37b7691d..c1b1db65e66 100644 --- a/drivers/media/radio/miropcm20-rds.c +++ b/drivers/media/radio/miropcm20-rds.c @@ -115,7 +115,6 @@ static struct file_operations rds_fops = { static struct miscdevice rds_miscdev = { .minor = MISC_DYNAMIC_MINOR, .name = "radiotext", - .devfs_name = "v4l/rds/radiotext", .fops = &rds_fops, }; diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c index 9f249e7e60c..4c82956390c 100644 --- a/drivers/media/radio/radio-gemtek-pci.c +++ b/drivers/media/radio/radio-gemtek-pci.c @@ -37,7 +37,6 @@ *************************************************************************** */ -#include <linux/config.h> #include <linux/types.h> #include <linux/list.h> #include <linux/module.h> diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c index 6e08e32346e..5c5e682a300 100644 --- a/drivers/media/video/arv.c +++ b/drivers/media/video/arv.c @@ -18,9 +18,7 @@ * 2003-09-01: Support w3cam by Takeo Takahashi */ -#include <linux/config.h> #include <linux/init.h> -#include <linux/devfs_fs_kernel.h> #include <linux/module.h> #include <linux/delay.h> #include <linux/errno.h> diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index e68a6d2fff2..de14818d5cc 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c @@ -25,7 +25,6 @@ */ -#include <linux/config.h> #include <linux/delay.h> #include <linux/module.h> #include <linux/moduleparam.h> @@ -3548,11 +3547,6 @@ void __devinit bttv_init_card2(struct bttv *btv) /* Hybrid DVB card, DOES have a tda9887 */ if (btv->c.type == BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE) tda9887 = 1; - if((btv->tuner_type == TUNER_PHILIPS_FM1216ME_MK3) || - (btv->tuner_type == TUNER_PHILIPS_FM1236_MK3) || - (btv->tuner_type == TUNER_PHILIPS_FM1256_IH3) || - tda9887) - request_module("tda9887"); if (btv->tuner_type != UNSET) request_module("tuner"); } diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 423e954948b..5764a89d356 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -4019,8 +4019,9 @@ static int __devinit bttv_probe(struct pci_dev *dev, if (!request_mem_region(pci_resource_start(dev,0), pci_resource_len(dev,0), btv->c.name)) { - printk(KERN_WARNING "bttv%d: can't request iomem (0x%lx).\n", - btv->c.nr, pci_resource_start(dev,0)); + printk(KERN_WARNING "bttv%d: can't request iomem (0x%llx).\n", + btv->c.nr, + (unsigned long long)pci_resource_start(dev,0)); return -EBUSY; } pci_set_master(dev); @@ -4031,8 +4032,9 @@ static int __devinit bttv_probe(struct pci_dev *dev, pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); printk(KERN_INFO "bttv%d: Bt%d (rev %d) at %s, ", bttv_num,btv->id, btv->revision, pci_name(dev)); - printk("irq: %d, latency: %d, mmio: 0x%lx\n", - btv->c.pci->irq, lat, pci_resource_start(dev,0)); + printk("irq: %d, latency: %d, mmio: 0x%llx\n", + btv->c.pci->irq, lat, + (unsigned long long)pci_resource_start(dev,0)); schedule(); btv->bt848_mmio=ioremap(pci_resource_start(dev,0), 0x1000); @@ -4048,7 +4050,7 @@ static int __devinit bttv_probe(struct pci_dev *dev, /* disable irqs, register irq handler */ btwrite(0, BT848_INT_MASK); result = request_irq(btv->c.pci->irq, bttv_irq, - SA_SHIRQ | SA_INTERRUPT,btv->c.name,(void *)btv); + IRQF_SHARED | IRQF_DISABLED,btv->c.name,(void *)btv); if (result < 0) { printk(KERN_ERR "bttv%d: can't get IRQ %d\n", bttv_num,btv->c.pci->irq); diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index d2956010f76..311c4c541e0 100644 --- a/drivers/media/video/bt8xx/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h @@ -360,7 +360,7 @@ struct bttv { int mbox_csel; /* risc memory management data - - must aquire s_lock before changing these + - must acquire s_lock before changing these - only the irq handler is supported to touch top + bottom + vcurr */ struct btcx_riscmem main; struct bttv_buffer *screen; /* overlay */ diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c index 840fe017712..353d02b67c3 100644 --- a/drivers/media/video/compat_ioctl32.c +++ b/drivers/media/video/compat_ioctl32.c @@ -12,7 +12,6 @@ * ioctls. */ -#include <linux/config.h> #include <linux/compat.h> #include <linux/videodev.h> #include <linux/videodev2.h> diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c index 95c5aceecc5..3b31a0dd2f0 100644 --- a/drivers/media/video/cpia.c +++ b/drivers/media/video/cpia.c @@ -26,7 +26,6 @@ /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ /* #define _CPIA_DEBUG_ 1 */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index d129db57fcd..d09f49950f2 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c @@ -31,7 +31,6 @@ #include <linux/version.h> -#include <linux/config.h> #include <linux/module.h> #include <linux/time.h> diff --git a/drivers/media/video/cpia_pp.c b/drivers/media/video/cpia_pp.c index 4c89bd395d3..41f4b8d1755 100644 --- a/drivers/media/video/cpia_pp.c +++ b/drivers/media/video/cpia_pp.c @@ -25,7 +25,6 @@ /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ /* #define _CPIA_DEBUG_ 1 */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index 2194cbeca33..f0340662e07 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c @@ -700,7 +700,7 @@ static int __devinit snd_cx88_create(struct snd_card *card, /* get irq */ err = request_irq(chip->pci->irq, cx8801_irq, - SA_SHIRQ | SA_INTERRUPT, chip->core->name, chip); + IRQF_SHARED | IRQF_DISABLED, chip->core->name, chip); if (err < 0) { dprintk(0, "%s: can't get IRQ %d\n", chip->core->name, chip->pci->irq); @@ -712,9 +712,9 @@ static int __devinit snd_cx88_create(struct snd_card *card, pci_read_config_byte(pci, PCI_LATENCY_TIMER, &chip->pci_lat); dprintk(1,"ALSA %s/%i: found at %s, rev: %d, irq: %d, " - "latency: %d, mmio: 0x%lx\n", core->name, devno, + "latency: %d, mmio: 0x%llx\n", core->name, devno, pci_name(pci), chip->pci_rev, pci->irq, - chip->pci_lat,pci_resource_start(pci,0)); + chip->pci_lat,(unsigned long long)pci_resource_start(pci,0)); chip->irq = pci->irq; synchronize_irq(chip->irq); @@ -766,8 +766,8 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci, strcpy (card->driver, "CX88x"); sprintf(card->shortname, "Conexant CX%x", pci->device); - sprintf(card->longname, "%s at %#lx", - card->shortname, pci_resource_start(pci, 0)); + sprintf(card->longname, "%s at %#llx", + card->shortname,(unsigned long long)pci_resource_start(pci, 0)); strcpy (card->mixername, "CX88"); dprintk (0, "%s/%i: ALSA support for cx2388x boards\n", diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 4ff81582ec5..349632b48e9 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c @@ -686,6 +686,39 @@ static struct videobuf_queue_ops blackbird_qops = { /* ------------------------------------------------------------------ */ +static const u32 *ctrl_classes[] = { + cx88_user_ctrls, + cx2341x_mpeg_ctrls, + NULL +}; + +static int blackbird_queryctrl(struct cx8802_dev *dev, struct v4l2_queryctrl *qctrl) +{ + qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id); + if (qctrl->id == 0) + return -EINVAL; + + /* Standard V4L2 controls */ + if (cx8800_ctrl_query(qctrl) == 0) + return 0; + + /* MPEG V4L2 controls */ + if (cx2341x_ctrl_query(&dev->params, qctrl)) + qctrl->flags |= V4L2_CTRL_FLAG_DISABLED; + return 0; +} + +static int blackbird_querymenu(struct cx8802_dev *dev, struct v4l2_querymenu *qmenu) +{ + struct v4l2_queryctrl qctrl; + + qctrl.id = qmenu->id; + blackbird_queryctrl(dev, &qctrl); + return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id)); +} + +/* ------------------------------------------------------------------ */ + static int mpeg_do_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg) { @@ -866,6 +899,16 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file, core->name); return 0; } + case VIDIOC_QUERYMENU: + return blackbird_querymenu(dev, arg); + case VIDIOC_QUERYCTRL: + { + struct v4l2_queryctrl *c = arg; + + if (blackbird_queryctrl(dev, c) == 0) + return 0; + return cx88_do_ioctl(inode, file, 0, dev->core, cmd, arg, mpeg_do_ioctl); + } default: return cx88_do_ioctl(inode, file, 0, dev->core, cmd, arg, mpeg_do_ioctl); diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index f9d68f20dc8..14bd4863d15 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -1194,6 +1194,21 @@ struct cx88_board cx88_boards[] = { }}, .dvb = 1, }, + [CX88_BOARD_GENIATECH_DVBS] = { + .name = "Geniatech DVB-S", + .tuner_type = TUNER_ABSENT, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .input = {{ + .type = CX88_VMUX_DVB, + .vmux = 0, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + }}, + .dvb = 1, + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); @@ -1439,6 +1454,10 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x18ac, .subdevice = 0xd800, /* FusionHDTV 3 Gold (original revision) */ .card = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q, + },{ + .subvendor = 0x14f1, + .subdevice = 0x0084, + .card = CX88_BOARD_GENIATECH_DVBS, }, }; const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 26f4c0fb8c3..973d3f39b2d 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c @@ -1031,8 +1031,8 @@ static int get_ressources(struct cx88_core *core, struct pci_dev *pci) pci_resource_len(pci,0), core->name)) return 0; - printk(KERN_ERR "%s: can't get MMIO memory @ 0x%lx\n", - core->name,pci_resource_start(pci,0)); + printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx\n", + core->name,(unsigned long long)pci_resource_start(pci,0)); return -EBUSY; } diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index dce1feddd55..afde3789d70 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -496,6 +496,26 @@ static int kworld_dvbs_100_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t return 0; } +static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) +{ + struct cx8802_dev *dev= fe->dvb->priv; + struct cx88_core *core = dev->core; + + if (voltage == SEC_VOLTAGE_OFF) { + dprintk(1,"LNB Voltage OFF\n"); + cx_write(MO_GP0_IO, 0x0000efff); + } + + if (core->prev_set_voltage) + return core->prev_set_voltage(fe, voltage); + return 0; +} + +static struct cx24123_config geniatech_dvbs_config = { + .demod_address = 0x55, + .set_ts_params = cx24123_set_ts_param, +}; + static struct cx24123_config hauppauge_novas_config = { .demod_address = 0x55, .set_ts_params = cx24123_set_ts_param, @@ -760,6 +780,14 @@ static int dvb_register(struct cx8802_dev *dev) dev->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage; } break; + case CX88_BOARD_GENIATECH_DVBS: + dev->dvb.frontend = cx24123_attach(&geniatech_dvbs_config, + &dev->core->i2c_adap); + if (dev->dvb.frontend) { + dev->core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; + dev->dvb.frontend->ops.set_voltage = geniatech_dvbs_set_voltage; + } + break; #endif default: printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n", diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index a9d7795a8e1..138a4f69250 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -420,9 +420,9 @@ int cx8802_init_common(struct cx8802_dev *dev) pci_read_config_byte(dev->pci, PCI_CLASS_REVISION, &dev->pci_rev); pci_read_config_byte(dev->pci, PCI_LATENCY_TIMER, &dev->pci_lat); printk(KERN_INFO "%s/2: found at %s, rev: %d, irq: %d, " - "latency: %d, mmio: 0x%lx\n", dev->core->name, + "latency: %d, mmio: 0x%llx\n", dev->core->name, pci_name(dev->pci), dev->pci_rev, dev->pci->irq, - dev->pci_lat,pci_resource_start(dev->pci,0)); + dev->pci_lat,(unsigned long long)pci_resource_start(dev->pci,0)); /* initialize driver struct */ spin_lock_init(&dev->slock); @@ -438,7 +438,7 @@ int cx8802_init_common(struct cx8802_dev *dev) /* get irq */ err = request_irq(dev->pci->irq, cx8802_irq, - SA_SHIRQ | SA_INTERRUPT, dev->core->name, dev); + IRQF_SHARED | IRQF_DISABLED, dev->core->name, dev); if (err < 0) { printk(KERN_ERR "%s: can't get IRQ %d\n", dev->core->name, dev->pci->irq); diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index dcda5291b99..2225d4b9414 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -327,6 +327,51 @@ static struct cx88_ctrl cx8800_ctls[] = { }; static const int CX8800_CTLS = ARRAY_SIZE(cx8800_ctls); +const u32 cx88_user_ctrls[] = { + V4L2_CID_USER_CLASS, + V4L2_CID_BRIGHTNESS, + V4L2_CID_CONTRAST, + V4L2_CID_SATURATION, + V4L2_CID_HUE, + V4L2_CID_AUDIO_VOLUME, + V4L2_CID_AUDIO_BALANCE, + V4L2_CID_AUDIO_MUTE, + 0 +}; +EXPORT_SYMBOL(cx88_user_ctrls); + +static const u32 *ctrl_classes[] = { + cx88_user_ctrls, + NULL +}; + +int cx8800_ctrl_query(struct v4l2_queryctrl *qctrl) +{ + int i; + + if (qctrl->id < V4L2_CID_BASE || + qctrl->id >= V4L2_CID_LASTP1) + return -EINVAL; + for (i = 0; i < CX8800_CTLS; i++) + if (cx8800_ctls[i].v.id == qctrl->id) + break; + if (i == CX8800_CTLS) { + *qctrl = no_ctl; + return 0; + } + *qctrl = cx8800_ctls[i].v; + return 0; +} +EXPORT_SYMBOL(cx8800_ctrl_query); + +static int cx88_queryctrl(struct v4l2_queryctrl *qctrl) +{ + qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id); + if (qctrl->id == 0) + return -EINVAL; + return cx8800_ctrl_query(qctrl); +} + /* ------------------------------------------------------------------- */ /* resource management */ @@ -1362,20 +1407,8 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, case VIDIOC_QUERYCTRL: { struct v4l2_queryctrl *c = arg; - int i; - if (c->id < V4L2_CID_BASE || - c->id >= V4L2_CID_LASTP1) - return -EINVAL; - for (i = 0; i < CX8800_CTLS; i++) - if (cx8800_ctls[i].v.id == c->id) - break; - if (i == CX8800_CTLS) { - *c = no_ctl; - return 0; - } - *c = cx8800_ctls[i].v; - return 0; + return cx88_queryctrl(c); } case VIDIOC_G_CTRL: return get_control(core,arg); @@ -1847,9 +1880,9 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &dev->pci_rev); pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat); printk(KERN_INFO "%s/0: found at %s, rev: %d, irq: %d, " - "latency: %d, mmio: 0x%lx\n", core->name, + "latency: %d, mmio: 0x%llx\n", core->name, pci_name(pci_dev), dev->pci_rev, pci_dev->irq, - dev->pci_lat,pci_resource_start(pci_dev,0)); + dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0)); pci_set_master(pci_dev); if (!pci_dma_supported(pci_dev,0xffffffff)) { @@ -1882,7 +1915,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, /* get irq */ err = request_irq(pci_dev->irq, cx8800_irq, - SA_SHIRQ | SA_INTERRUPT, core->name, dev); + IRQF_SHARED | IRQF_DISABLED, core->name, dev); if (err < 0) { printk(KERN_ERR "%s: can't get IRQ %d\n", core->name,pci_dev->irq); @@ -1893,8 +1926,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, /* load and configure helper modules */ if (TUNER_ABSENT != core->tuner_type) request_module("tuner"); - if (core->tda9887_conf) - request_module("tda9887"); /* register v4l devices */ dev->video_dev = cx88_vdev_init(core,dev->pci, diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 9a9a0fc7a41..e7810955dd4 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -196,6 +196,7 @@ extern struct sram_channel cx88_sram_channels[]; #define CX88_BOARD_PIXELVIEW_PLAYTV_P7000 49 #define CX88_BOARD_NPGTECH_REALTV_TOP10FM 50 #define CX88_BOARD_WINFAST_DTV2000H 51 +#define CX88_BOARD_GENIATECH_DVBS 52 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, @@ -590,6 +591,8 @@ int cx8802_resume_common(struct pci_dev *pci_dev); extern int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, struct cx88_core *core, unsigned int cmd, void *arg, v4l2_kioctl driver_ioctl); +extern const u32 cx88_user_ctrls[]; +extern int cx8800_ctrl_query(struct v4l2_queryctrl *qctrl); /* * Local variables: diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 9286090817c..2a461dde480 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -1574,8 +1574,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, request_module("tvp5150"); if (dev->has_tuner) request_module("tuner"); - if (dev->tda9887_conf) - request_module("tda9887"); #endif errCode = em28xx_config(dev); if (errCode) { diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index f68ca7d9f53..e278753f8f2 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c @@ -26,7 +26,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/sched.h> @@ -1882,7 +1881,7 @@ static int __devinit meye_probe(struct pci_dev *pcidev, meye.mchip_irq = pcidev->irq; if (request_irq(meye.mchip_irq, meye_irq, - SA_INTERRUPT | SA_SHIRQ, "meye", meye_irq)) { + IRQF_DISABLED | IRQF_SHARED, "meye", meye_irq)) { printk(KERN_ERR "meye: request_irq failed\n"); goto outreqirq; } diff --git a/drivers/media/video/meye.h b/drivers/media/video/meye.h index 0d09a0e3803..ea107cb5c84 100644 --- a/drivers/media/video/meye.h +++ b/drivers/media/video/meye.h @@ -36,7 +36,6 @@ #define MEYE_DRIVER_VERSION __stringify(MEYE_DRIVER_MAJORVERSION) "." \ __stringify(MEYE_DRIVER_MINORVERSION) -#include <linux/config.h> #include <linux/types.h> #include <linux/pci.h> #include <linux/kfifo.h> diff --git a/drivers/media/video/msp3400-driver.h b/drivers/media/video/msp3400-driver.h index 4e451049013..545e4ac094f 100644 --- a/drivers/media/video/msp3400-driver.h +++ b/drivers/media/video/msp3400-driver.h @@ -90,8 +90,8 @@ struct msp_state { /* thread */ struct task_struct *kthread; wait_queue_head_t wq; - int restart:1; - int watch_stereo:1; + unsigned int restart:1; + unsigned int watch_stereo:1; }; /* msp3400-driver.c */ diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c index a988df226aa..1b07a61c2eb 100644 --- a/drivers/media/video/ov511.c +++ b/drivers/media/video/ov511.c @@ -35,7 +35,6 @@ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/vmalloc.h> diff --git a/drivers/media/video/pvrusb2/Makefile b/drivers/media/video/pvrusb2/Makefile index fed603ad0a6..02e414210da 100644 --- a/drivers/media/video/pvrusb2/Makefile +++ b/drivers/media/video/pvrusb2/Makefile @@ -8,7 +8,7 @@ obj-pvrusb2-24xxx-$(CONFIG_VIDEO_PVRUSB2_24XXX) := \ pvrusb2-objs := pvrusb2-i2c-core.o pvrusb2-i2c-cmd-v4l2.o \ pvrusb2-audio.o pvrusb2-i2c-chips-v4l2.o \ pvrusb2-encoder.o pvrusb2-video-v4l.o \ - pvrusb2-eeprom.o pvrusb2-tuner.o pvrusb2-demod.o \ + pvrusb2-eeprom.o pvrusb2-tuner.o \ pvrusb2-main.o pvrusb2-hdw.o pvrusb2-v4l2.o \ pvrusb2-ctrl.o pvrusb2-std.o \ pvrusb2-context.o pvrusb2-io.o pvrusb2-ioread.o \ diff --git a/drivers/media/video/pvrusb2/pvrusb2-audio.c b/drivers/media/video/pvrusb2/pvrusb2-audio.c index 313d2dcf9e4..9846c464ec8 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-audio.c +++ b/drivers/media/video/pvrusb2/pvrusb2-audio.c @@ -145,8 +145,8 @@ static int get_audio_status(struct pvr2_msp3400_handler *ctxt) static void pvr2_msp3400_detach(struct pvr2_msp3400_handler *ctxt) { - ctxt->client->handler = 0; - ctxt->hdw->audio_stat = 0; + ctxt->client->handler = NULL; + ctxt->hdw->audio_stat = NULL; kfree(ctxt); } diff --git a/drivers/media/video/pvrusb2/pvrusb2-context.c b/drivers/media/video/pvrusb2/pvrusb2-context.c index 40dc59871a4..f129f316d20 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-context.c +++ b/drivers/media/video/pvrusb2/pvrusb2-context.c @@ -77,7 +77,7 @@ struct pvr2_context *pvr2_context_create( const struct usb_device_id *devid, void (*setup_func)(struct pvr2_context *)) { - struct pvr2_context *mp = 0; + struct pvr2_context *mp = NULL; mp = kmalloc(sizeof(*mp),GFP_KERNEL); if (!mp) goto done; memset(mp,0,sizeof(*mp)); @@ -87,7 +87,7 @@ struct pvr2_context *pvr2_context_create( mp->hdw = pvr2_hdw_create(intf,devid); if (!mp->hdw) { pvr2_context_destroy(mp); - mp = 0; + mp = NULL; goto done; } @@ -145,7 +145,7 @@ void pvr2_channel_init(struct pvr2_channel *cp,struct pvr2_context *mp) { cp->hdw = mp->hdw; cp->mc_head = mp; - cp->mc_next = 0; + cp->mc_next = NULL; cp->mc_prev = mp->mc_last; if (mp->mc_last) { mp->mc_last->mc_next = cp; @@ -160,8 +160,8 @@ static void pvr2_channel_disclaim_stream(struct pvr2_channel *cp) { if (!cp->stream) return; pvr2_stream_kill(cp->stream->stream); - cp->stream->user = 0; - cp->stream = 0; + cp->stream->user = NULL; + cp->stream = NULL; } @@ -179,7 +179,7 @@ void pvr2_channel_done(struct pvr2_channel *cp) } else { mp->mc_first = cp->mc_next; } - cp->hdw = 0; + cp->hdw = NULL; } @@ -212,7 +212,7 @@ struct pvr2_ioread *pvr2_channel_create_mpeg_stream( { struct pvr2_ioread *cp; cp = pvr2_ioread_create(); - if (!cp) return 0; + if (!cp) return NULL; pvr2_ioread_setup(cp,sp->stream); pvr2_ioread_set_sync_key(cp,stream_sync_key,sizeof(stream_sync_key)); return cp; diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c index d5df9fbeba2..fb6198f1df9 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c @@ -158,7 +158,7 @@ int pvr2_ctrl_get_mask(struct pvr2_ctrl *cptr) /* Retrieve the control's name */ const char *pvr2_ctrl_get_name(struct pvr2_ctrl *cptr) { - if (!cptr) return 0; + if (!cptr) return NULL; return cptr->info->name; } @@ -166,7 +166,7 @@ const char *pvr2_ctrl_get_name(struct pvr2_ctrl *cptr) /* Retrieve the control's desc */ const char *pvr2_ctrl_get_desc(struct pvr2_ctrl *cptr) { - if (!cptr) return 0; + if (!cptr) return NULL; return cptr->info->desc; } @@ -488,7 +488,7 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr, LOCK_TAKE(cptr->hdw->big_lock); do { if (cptr->info->type == pvr2_ctl_int) { - ret = parse_token(ptr,len,valptr,0,0); + ret = parse_token(ptr,len,valptr,NULL,0); if ((ret >= 0) && ((*valptr < cptr->info->def.type_int.min_value) || (*valptr > cptr->info->def.type_int.max_value))) { diff --git a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c index 27eadaff75a..c80c26be6e4 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c +++ b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c @@ -139,8 +139,8 @@ static const struct pvr2_v4l_cx2584x_ops decoder_ops[] = { static void decoder_detach(struct pvr2_v4l_cx2584x *ctxt) { - ctxt->client->handler = 0; - ctxt->hdw->decoder_ctrl = 0; + ctxt->client->handler = NULL; + ctxt->hdw->decoder_ctrl = NULL; kfree(ctxt); } @@ -221,7 +221,7 @@ static unsigned int decoder_describe(struct pvr2_v4l_cx2584x *ctxt, static void decoder_reset(struct pvr2_v4l_cx2584x *ctxt) { int ret; - ret = pvr2_i2c_client_cmd(ctxt->client,VIDIOC_INT_RESET,0); + ret = pvr2_i2c_client_cmd(ctxt->client,VIDIOC_INT_RESET,NULL); pvr2_trace(PVR2_TRACE_CHIPS,"i2c cx25840 decoder_reset (ret=%d)",ret); } diff --git a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c index 586900e365f..f985f00d885 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c +++ b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c @@ -82,7 +82,7 @@ static unsigned int debugifc_isolate_word(const char *buf,unsigned int count, unsigned int wlen; unsigned int scnt; - wptr = 0; + wptr = NULL; wlen = 0; scnt = debugifc_count_whitespace(buf,count); consume_cnt += scnt; count -= scnt; buf += scnt; @@ -337,8 +337,8 @@ int pvr2_debugifc_print_status(struct pvr2_hdw *hdw, } -int pvr2_debugifc_do1cmd(struct pvr2_hdw *hdw,const char *buf, - unsigned int count) +static int pvr2_debugifc_do1cmd(struct pvr2_hdw *hdw,const char *buf, + unsigned int count) { const char *wptr; unsigned int wlen; diff --git a/drivers/media/video/pvrusb2/pvrusb2-demod.c b/drivers/media/video/pvrusb2/pvrusb2-demod.c deleted file mode 100644 index 9686569a11f..00000000000 --- a/drivers/media/video/pvrusb2/pvrusb2-demod.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * - * $Id$ - * - * Copyright (C) 2005 Mike Isely <isely@pobox.com> - * Copyright (C) 2004 Aurelien Alleaume <slts@free.fr> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "pvrusb2.h" -#include "pvrusb2-util.h" -#include "pvrusb2-demod.h" -#include "pvrusb2-hdw-internal.h" -#include "pvrusb2-debug.h" -#include <linux/videodev2.h> -#include <media/tuner.h> -#include <media/v4l2-common.h> - - -struct pvr2_demod_handler { - struct pvr2_hdw *hdw; - struct pvr2_i2c_client *client; - struct pvr2_i2c_handler i2c_handler; - int type_update_fl; -}; - - -static void set_config(struct pvr2_demod_handler *ctxt) -{ - struct pvr2_hdw *hdw = ctxt->hdw; - int cfg = 0; - - switch (hdw->tuner_type) { - case TUNER_PHILIPS_FM1216ME_MK3: - case TUNER_PHILIPS_FM1236_MK3: - cfg = TDA9887_PORT1_ACTIVE|TDA9887_PORT2_ACTIVE; - break; - default: - break; - } - pvr2_trace(PVR2_TRACE_CHIPS,"i2c demod set_config(0x%x)",cfg); - pvr2_i2c_client_cmd(ctxt->client,TDA9887_SET_CONFIG,&cfg); - ctxt->type_update_fl = 0; -} - - -static int demod_check(struct pvr2_demod_handler *ctxt) -{ - struct pvr2_hdw *hdw = ctxt->hdw; - if (hdw->tuner_updated) ctxt->type_update_fl = !0; - return ctxt->type_update_fl != 0; -} - - -static void demod_update(struct pvr2_demod_handler *ctxt) -{ - if (ctxt->type_update_fl) set_config(ctxt); -} - - -static void demod_detach(struct pvr2_demod_handler *ctxt) -{ - ctxt->client->handler = 0; - kfree(ctxt); -} - - -static unsigned int demod_describe(struct pvr2_demod_handler *ctxt,char *buf,unsigned int cnt) -{ - return scnprintf(buf,cnt,"handler: pvrusb2-demod"); -} - - -const static struct pvr2_i2c_handler_functions tuner_funcs = { - .detach = (void (*)(void *))demod_detach, - .check = (int (*)(void *))demod_check, - .update = (void (*)(void *))demod_update, - .describe = (unsigned int (*)(void *,char *,unsigned int))demod_describe, -}; - - -int pvr2_i2c_demod_setup(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp) -{ - struct pvr2_demod_handler *ctxt; - if (cp->handler) return 0; - - ctxt = kmalloc(sizeof(*ctxt),GFP_KERNEL); - if (!ctxt) return 0; - memset(ctxt,0,sizeof(*ctxt)); - - ctxt->i2c_handler.func_data = ctxt; - ctxt->i2c_handler.func_table = &tuner_funcs; - ctxt->type_update_fl = !0; - ctxt->client = cp; - ctxt->hdw = hdw; - cp->handler = &ctxt->i2c_handler; - pvr2_trace(PVR2_TRACE_CHIPS,"i2c 0x%x tda9887 V4L2 handler set up", - cp->client->addr); - return !0; -} - - - - -/* - Stuff for Emacs to see, in order to encourage consistent editing style: - *** Local Variables: *** - *** mode: c *** - *** fill-column: 70 *** - *** tab-width: 8 *** - *** c-basic-offset: 8 *** - *** End: *** - */ diff --git a/drivers/media/video/pvrusb2/pvrusb2-demod.h b/drivers/media/video/pvrusb2/pvrusb2-demod.h deleted file mode 100644 index 4c4e40ffbf0..00000000000 --- a/drivers/media/video/pvrusb2/pvrusb2-demod.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * $Id$ - * - * Copyright (C) 2005 Mike Isely <isely@pobox.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#ifndef __PVRUSB2_DEMOD_H -#define __PVRUSB2_DEMOD_H - -#include "pvrusb2-i2c-core.h" - -int pvr2_i2c_demod_setup(struct pvr2_hdw *,struct pvr2_i2c_client *); - -#endif /* __PVRUSB2_DEMOD_H */ - -/* - Stuff for Emacs to see, in order to encourage consistent editing style: - *** Local Variables: *** - *** mode: c *** - *** fill-column: 70 *** - *** tab-width: 8 *** - *** c-basic-offset: 8 *** - *** End: *** - */ diff --git a/drivers/media/video/pvrusb2/pvrusb2-eeprom.c b/drivers/media/video/pvrusb2/pvrusb2-eeprom.c index 94d383ff988..6cff8e75f42 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-eeprom.c +++ b/drivers/media/video/pvrusb2/pvrusb2-eeprom.c @@ -58,7 +58,7 @@ static u8 *pvr2_eeprom_fetch(struct pvr2_hdw *hdw) pvr2_trace(PVR2_TRACE_ERROR_LEGS, "Failed to allocate memory" " required to read eeprom"); - return 0; + return NULL; } trace_eeprom("Value for eeprom addr from controller was 0x%x", @@ -108,7 +108,7 @@ static u8 *pvr2_eeprom_fetch(struct pvr2_hdw *hdw) pvr2_trace(PVR2_TRACE_ERROR_LEGS, "eeprom fetch set offs err=%d",ret); kfree(eeprom); - return 0; + return NULL; } } return eeprom; diff --git a/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/drivers/media/video/pvrusb2/pvrusb2-encoder.c index 2cc31695b43..18a7073501c 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-encoder.c +++ b/drivers/media/video/pvrusb2/pvrusb2-encoder.c @@ -65,7 +65,7 @@ static int pvr2_encoder_write_words(struct pvr2_hdw *hdw, } ret = pvr2_send_request(hdw, hdw->cmd_buffer,1+(chunkCnt*7), - 0,0); + NULL,0); if (ret) return ret; data += chunkCnt; dlen -= chunkCnt; @@ -322,7 +322,7 @@ int pvr2_encoder_configure(struct pvr2_hdw *hdw) } ret = cx2341x_update(hdw,pvr2_encoder_cmd, - (hdw->enc_cur_valid ? &hdw->enc_cur_state : 0), + (hdw->enc_cur_valid ? &hdw->enc_cur_state : NULL), &hdw->enc_ctl_state); if (ret) { pvr2_trace(PVR2_TRACE_ERROR_LEGS, diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index ba2afbfe32c..0d6dc33ca32 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h @@ -354,23 +354,6 @@ struct pvr2_hdw { unsigned int control_cnt; }; -int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw); - -unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *); - -void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw, - unsigned long msk,unsigned long val); -void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw, - unsigned long msk, - unsigned long val); - -void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw); -void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw); - -int pvr2_i2c_basic_op(struct pvr2_hdw *,u8 i2c_addr, - u8 *wdata,u16 wlen, - u8 *rdata,u16 rlen); - #endif /* __PVRUSB2_HDW_INTERNAL_H */ /* diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 643c471375d..9b48abcf608 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -63,7 +63,6 @@ struct pvr2_string_table { static const char *pvr2_client_24xxx[] = { "cx25840", "tuner", - "tda9887", "wm8775", }; #endif @@ -73,7 +72,6 @@ static const char *pvr2_client_29xxx[] = { "msp3400", "saa7115", "tuner", - "tda9887", }; static struct pvr2_string_table pvr2_client_lists[] = { @@ -89,8 +87,8 @@ static struct pvr2_string_table pvr2_client_lists[] = { #endif }; -static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = 0}; -DECLARE_MUTEX(pvr2_unit_sem); +static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL}; +static DECLARE_MUTEX(pvr2_unit_sem); static int ctlchg = 0; static int initusbreset = 1; @@ -263,6 +261,25 @@ static const char *control_values_subsystem[] = { [PVR2_SUBSYS_B_ENC_RUN] = "enc_run", }; +static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl); +static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw); +static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw); +static unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *hdw); +static void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw); +static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw); +static void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw); +static void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw, + unsigned long msk, + unsigned long val); +static void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw, + unsigned long msk, + unsigned long val); +static int pvr2_send_request_ex(struct pvr2_hdw *hdw, + unsigned int timeout,int probe_fl, + void *write_data,unsigned int write_len, + void *read_data,unsigned int read_len); +static int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res); +static int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res); static int ctrl_channelfreq_get(struct pvr2_ctrl *cptr,int *vp) { @@ -405,7 +422,7 @@ static unsigned int ctrl_cx2341x_getv4lflags(struct pvr2_ctrl *cptr) info = (struct pvr2_ctl_info *)(cptr->info); if (qctrl.flags & V4L2_CTRL_FLAG_READ_ONLY) { if (info->set_value) { - info->set_value = 0; + info->set_value = NULL; } } else { if (!(info->set_value)) { @@ -836,14 +853,6 @@ unsigned long pvr2_hdw_get_sn(struct pvr2_hdw *hdw) } -struct pvr2_hdw *pvr2_hdw_find(int unit_number) -{ - if (unit_number < 0) return 0; - if (unit_number >= PVR_NUM) return 0; - return unit_pointers[unit_number]; -} - - int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw) { return hdw->unit_number; @@ -917,9 +926,9 @@ static int pvr2_locate_firmware(struct pvr2_hdw *hdw, * is not suitable for an usb transaction. * */ -int pvr2_upload_firmware1(struct pvr2_hdw *hdw) +static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) { - const struct firmware *fw_entry = 0; + const struct firmware *fw_entry = NULL; void *fw_ptr; unsigned int pipe; int ret; @@ -1015,7 +1024,7 @@ int pvr2_upload_firmware1(struct pvr2_hdw *hdw) int pvr2_upload_firmware2(struct pvr2_hdw *hdw) { - const struct firmware *fw_entry = 0; + const struct firmware *fw_entry = NULL; void *fw_ptr; unsigned int pipe, fw_len, fw_done; int actual_length; @@ -1166,8 +1175,9 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) reconfigure and start over. */ -void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw, - unsigned long msk,unsigned long val) +static void pvr2_hdw_subsys_bit_chg_no_lock(struct pvr2_hdw *hdw, + unsigned long msk, + unsigned long val) { unsigned long nmsk; unsigned long vmsk; @@ -1318,18 +1328,6 @@ void pvr2_hdw_subsys_bit_chg(struct pvr2_hdw *hdw, } -void pvr2_hdw_subsys_bit_set(struct pvr2_hdw *hdw,unsigned long msk) -{ - pvr2_hdw_subsys_bit_chg(hdw,msk,msk); -} - - -void pvr2_hdw_subsys_bit_clr(struct pvr2_hdw *hdw,unsigned long msk) -{ - pvr2_hdw_subsys_bit_chg(hdw,msk,0); -} - - unsigned long pvr2_hdw_subsys_get(struct pvr2_hdw *hdw) { return hdw->subsys_enabled_mask; @@ -1342,9 +1340,9 @@ unsigned long pvr2_hdw_subsys_stream_get(struct pvr2_hdw *hdw) } -void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw, - unsigned long msk, - unsigned long val) +static void pvr2_hdw_subsys_stream_bit_chg_no_lock(struct pvr2_hdw *hdw, + unsigned long msk, + unsigned long val) { unsigned long val2; msk &= PVR2_SUBSYS_ALL; @@ -1366,7 +1364,7 @@ void pvr2_hdw_subsys_stream_bit_chg(struct pvr2_hdw *hdw, } -int pvr2_hdw_set_streaming_no_lock(struct pvr2_hdw *hdw,int enableFl) +static int pvr2_hdw_set_streaming_no_lock(struct pvr2_hdw *hdw,int enableFl) { if ((!enableFl) == !(hdw->flag_streaming_enabled)) return 0; if (enableFl) { @@ -1400,8 +1398,8 @@ int pvr2_hdw_set_streaming(struct pvr2_hdw *hdw,int enable_flag) } -int pvr2_hdw_set_stream_type_no_lock(struct pvr2_hdw *hdw, - enum pvr2_config config) +static int pvr2_hdw_set_stream_type_no_lock(struct pvr2_hdw *hdw, + enum pvr2_config config) { unsigned long sm = hdw->subsys_enabled_mask; if (!hdw->flag_ok) return -EIO; @@ -1741,7 +1739,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, sizeof(pvr2_device_names)/sizeof(pvr2_device_names[0])) { pvr2_trace(PVR2_TRACE_ERROR_LEGS, "Bogus device type of %u reported",hdw_type); - return 0; + return NULL; } hdw = kmalloc(sizeof(*hdw),GFP_KERNEL); @@ -1922,38 +1920,38 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, if (hdw->mpeg_ctrl_info) kfree(hdw->mpeg_ctrl_info); kfree(hdw); } - return 0; + return NULL; } /* Remove _all_ associations between this driver and the underlying USB layer. */ -void pvr2_hdw_remove_usb_stuff(struct pvr2_hdw *hdw) +static void pvr2_hdw_remove_usb_stuff(struct pvr2_hdw *hdw) { if (hdw->flag_disconnected) return; pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_remove_usb_stuff: hdw=%p",hdw); if (hdw->ctl_read_urb) { usb_kill_urb(hdw->ctl_read_urb); usb_free_urb(hdw->ctl_read_urb); - hdw->ctl_read_urb = 0; + hdw->ctl_read_urb = NULL; } if (hdw->ctl_write_urb) { usb_kill_urb(hdw->ctl_write_urb); usb_free_urb(hdw->ctl_write_urb); - hdw->ctl_write_urb = 0; + hdw->ctl_write_urb = NULL; } if (hdw->ctl_read_buffer) { kfree(hdw->ctl_read_buffer); - hdw->ctl_read_buffer = 0; + hdw->ctl_read_buffer = NULL; } if (hdw->ctl_write_buffer) { kfree(hdw->ctl_write_buffer); - hdw->ctl_write_buffer = 0; + hdw->ctl_write_buffer = NULL; } pvr2_hdw_render_useless_unlocked(hdw); hdw->flag_disconnected = !0; - hdw->usb_dev = 0; - hdw->usb_intf = 0; + hdw->usb_dev = NULL; + hdw->usb_intf = NULL; } @@ -1963,11 +1961,11 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw) pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_destroy: hdw=%p",hdw); if (hdw->fw_buffer) { kfree(hdw->fw_buffer); - hdw->fw_buffer = 0; + hdw->fw_buffer = NULL; } if (hdw->vid_stream) { pvr2_stream_destroy(hdw->vid_stream); - hdw->vid_stream = 0; + hdw->vid_stream = NULL; } if (hdw->audio_stat) { hdw->audio_stat->detach(hdw->audio_stat->ctxt); @@ -1981,7 +1979,7 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw) if ((hdw->unit_number >= 0) && (hdw->unit_number < PVR_NUM) && (unit_pointers[hdw->unit_number] == hdw)) { - unit_pointers[hdw->unit_number] = 0; + unit_pointers[hdw->unit_number] = NULL; } } while (0); up(&pvr2_unit_sem); if (hdw->controls) kfree(hdw->controls); @@ -2018,7 +2016,7 @@ void pvr2_hdw_disconnect(struct pvr2_hdw *hdw) // Attempt to autoselect an appropriate value for std_enum_cur given // whatever is currently in std_mask_cur -void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw) +static void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw) { unsigned int idx; for (idx = 1; idx < hdw->std_enum_cnt; idx++) { @@ -2033,7 +2031,7 @@ void pvr2_hdw_internal_find_stdenum(struct pvr2_hdw *hdw) // Calculate correct set of enumerated standards based on currently known // set of available standards bits. -void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw) +static void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw) { struct v4l2_standard *newstd; unsigned int std_cnt; @@ -2043,12 +2041,12 @@ void pvr2_hdw_internal_set_std_avail(struct pvr2_hdw *hdw) if (hdw->std_defs) { kfree(hdw->std_defs); - hdw->std_defs = 0; + hdw->std_defs = NULL; } hdw->std_enum_cnt = 0; if (hdw->std_enum_names) { kfree(hdw->std_enum_names); - hdw->std_enum_names = 0; + hdw->std_enum_names = NULL; } if (!std_cnt) { @@ -2099,7 +2097,7 @@ unsigned int pvr2_hdw_get_ctrl_count(struct pvr2_hdw *hdw) struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_index(struct pvr2_hdw *hdw, unsigned int idx) { - if (idx >= hdw->control_cnt) return 0; + if (idx >= hdw->control_cnt) return NULL; return hdw->controls + idx; } @@ -2118,7 +2116,7 @@ struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_id(struct pvr2_hdw *hdw, i = cptr->info->internal_id; if (i && (i == ctl_id)) return cptr; } - return 0; + return NULL; } @@ -2135,7 +2133,7 @@ struct pvr2_ctrl *pvr2_hdw_get_ctrl_v4l(struct pvr2_hdw *hdw,unsigned int ctl_id i = cptr->info->v4l_id; if (i && (i == ctl_id)) return cptr; } - return 0; + return NULL; } @@ -2149,7 +2147,7 @@ struct pvr2_ctrl *pvr2_hdw_get_ctrl_nextv4l(struct pvr2_hdw *hdw, int i; /* This could be made a lot more efficient, but for now... */ - cp2 = 0; + cp2 = NULL; for (idx = 0; idx < hdw->control_cnt; idx++) { cptr = hdw->controls + idx; i = cptr->info->v4l_id; @@ -2159,7 +2157,7 @@ struct pvr2_ctrl *pvr2_hdw_get_ctrl_nextv4l(struct pvr2_hdw *hdw, cp2 = cptr; } return cp2; - return 0; + return NULL; } @@ -2182,7 +2180,7 @@ static const char *get_ctrl_typename(enum pvr2_ctl_type tp) state(s) back to their previous value before this function was called. Thus we can automatically reconfigure affected pieces of the driver as controls are changed. */ -int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw) +static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw) { unsigned long saved_subsys_mask = hdw->subsys_enabled_mask; unsigned long stale_subsys_mask = 0; @@ -2321,14 +2319,6 @@ void pvr2_hdw_poll_trigger_unlocked(struct pvr2_hdw *hdw) } -void pvr2_hdw_poll_trigger(struct pvr2_hdw *hdw) -{ - LOCK_TAKE(hdw->big_lock); do { - pvr2_hdw_poll_trigger_unlocked(hdw); - } while (0); LOCK_GIVE(hdw->big_lock); -} - - /* Return name for this driver instance */ const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw) { @@ -2337,7 +2327,7 @@ const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw) /* Return bit mask indicating signal status */ -unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *hdw) +static unsigned int pvr2_hdw_get_signal_status_internal(struct pvr2_hdw *hdw) { unsigned int msk = 0; switch (hdw->input_val) { @@ -2424,7 +2414,7 @@ void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *hdw, int enable_flag) pvr2_trace(PVR2_TRACE_FIRMWARE, "Cleaning up after CPU firmware fetch"); kfree(hdw->fw_buffer); - hdw->fw_buffer = 0; + hdw->fw_buffer = NULL; hdw->fw_size = 0; /* Now release the CPU. It will disconnect and reconnect later. */ @@ -2519,22 +2509,6 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *hdw,int v) } -void pvr2_reset_ctl_endpoints(struct pvr2_hdw *hdw) -{ - if (!hdw->usb_dev) return; - usb_settoggle(hdw->usb_dev, PVR2_CTL_WRITE_ENDPOINT & 0xf, - !(PVR2_CTL_WRITE_ENDPOINT & USB_DIR_IN), 0); - usb_settoggle(hdw->usb_dev, PVR2_CTL_READ_ENDPOINT & 0xf, - !(PVR2_CTL_READ_ENDPOINT & USB_DIR_IN), 0); - usb_clear_halt(hdw->usb_dev, - usb_rcvbulkpipe(hdw->usb_dev, - PVR2_CTL_READ_ENDPOINT & 0x7f)); - usb_clear_halt(hdw->usb_dev, - usb_sndbulkpipe(hdw->usb_dev, - PVR2_CTL_WRITE_ENDPOINT & 0x7f)); -} - - static void pvr2_ctl_write_complete(struct urb *urb, struct pt_regs *regs) { struct pvr2_hdw *hdw = urb->context; @@ -2568,10 +2542,10 @@ static void pvr2_ctl_timeout(unsigned long data) } -int pvr2_send_request_ex(struct pvr2_hdw *hdw, - unsigned int timeout,int probe_fl, - void *write_data,unsigned int write_len, - void *read_data,unsigned int read_len) +static int pvr2_send_request_ex(struct pvr2_hdw *hdw, + unsigned int timeout,int probe_fl, + void *write_data,unsigned int write_len, + void *read_data,unsigned int read_len) { unsigned int idx; int status = 0; @@ -2826,7 +2800,7 @@ int pvr2_write_register(struct pvr2_hdw *hdw, u16 reg, u32 data) } -int pvr2_read_register(struct pvr2_hdw *hdw, u16 reg, u32 *data) +static int pvr2_read_register(struct pvr2_hdw *hdw, u16 reg, u32 *data) { int ret = 0; @@ -2850,7 +2824,7 @@ int pvr2_read_register(struct pvr2_hdw *hdw, u16 reg, u32 *data) } -int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res) +static int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res) { int ret; @@ -2867,7 +2841,7 @@ int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res) } -int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res) +static int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res) { int ret; @@ -2883,13 +2857,13 @@ int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res) } -void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw) +static void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw) { if (!hdw->flag_ok) return; pvr2_trace(PVR2_TRACE_INIT,"render_useless"); hdw->flag_ok = 0; if (hdw->vid_stream) { - pvr2_stream_setup(hdw->vid_stream,0,0,0); + pvr2_stream_setup(hdw->vid_stream,NULL,0,0); } hdw->flag_streaming_enabled = 0; hdw->subsys_enabled_mask = 0; @@ -2908,7 +2882,7 @@ void pvr2_hdw_device_reset(struct pvr2_hdw *hdw) { int ret; pvr2_trace(PVR2_TRACE_INIT,"Performing a device reset..."); - ret = usb_lock_device_for_reset(hdw->usb_dev,0); + ret = usb_lock_device_for_reset(hdw->usb_dev,NULL); if (ret == 1) { ret = usb_reset_device(hdw->usb_dev); usb_unlock_device(hdw->usb_dev); @@ -2957,7 +2931,7 @@ int pvr2_hdw_cmd_deep_reset(struct pvr2_hdw *hdw) pvr2_trace(PVR2_TRACE_INIT,"Requesting uproc hard reset"); hdw->flag_ok = !0; hdw->cmd_buffer[0] = 0xdd; - status = pvr2_send_request(hdw,hdw->cmd_buffer,1,0,0); + status = pvr2_send_request(hdw,hdw->cmd_buffer,1,NULL,0); } while (0); LOCK_GIVE(hdw->ctl_lock); return status; } @@ -2969,7 +2943,7 @@ int pvr2_hdw_cmd_powerup(struct pvr2_hdw *hdw) LOCK_TAKE(hdw->ctl_lock); do { pvr2_trace(PVR2_TRACE_INIT,"Requesting powerup"); hdw->cmd_buffer[0] = 0xde; - status = pvr2_send_request(hdw,hdw->cmd_buffer,1,0,0); + status = pvr2_send_request(hdw,hdw->cmd_buffer,1,NULL,0); } while (0); LOCK_GIVE(hdw->ctl_lock); return status; } @@ -2996,12 +2970,12 @@ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw) } -int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl) +static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl) { int status; LOCK_TAKE(hdw->ctl_lock); do { hdw->cmd_buffer[0] = (runFl ? 0x36 : 0x37); - status = pvr2_send_request(hdw,hdw->cmd_buffer,1,0,0); + status = pvr2_send_request(hdw,hdw->cmd_buffer,1,NULL,0); } while (0); LOCK_GIVE(hdw->ctl_lock); if (!status) { hdw->subsys_enabled_mask = @@ -3094,7 +3068,7 @@ int pvr2_hdw_gpio_chg_out(struct pvr2_hdw *hdw,u32 msk,u32 val) } -int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw) +static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw) { int result; LOCK_TAKE(hdw->ctl_lock); do { diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h index 63f52915443..fd931b5da49 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h @@ -91,7 +91,6 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, void pvr2_hdw_poll(struct pvr2_hdw *); /* Trigger a poll to take place later at a convenient time */ -void pvr2_hdw_poll_trigger(struct pvr2_hdw *); void pvr2_hdw_poll_trigger_unlocked(struct pvr2_hdw *); /* Register a callback used to trigger a future poll */ @@ -99,9 +98,6 @@ void pvr2_hdw_setup_poll_trigger(struct pvr2_hdw *, void (*func)(void *), void *data); -/* Get pointer to structure given unit number */ -struct pvr2_hdw *pvr2_hdw_find(int unit_number); - /* Destroy hardware interaction structure */ void pvr2_hdw_destroy(struct pvr2_hdw *); @@ -180,12 +176,6 @@ int pvr2_hdw_get_stdenum_value(struct pvr2_hdw *hdw,struct v4l2_standard *std, void pvr2_hdw_subsys_bit_chg(struct pvr2_hdw *hdw, unsigned long msk,unsigned long val); -/* Shortcut for pvr2_hdw_subsys_bit_chg(hdw,msk,msk) */ -void pvr2_hdw_subsys_bit_set(struct pvr2_hdw *hdw,unsigned long msk); - -/* Shortcut for pvr2_hdw_subsys_bit_chg(hdw,msk,0) */ -void pvr2_hdw_subsys_bit_clr(struct pvr2_hdw *hdw,unsigned long msk); - /* Retrieve mask indicating which pieces of hardware are currently enabled / configured. */ unsigned long pvr2_hdw_subsys_get(struct pvr2_hdw *); @@ -225,34 +215,18 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,int); /* The following entry points are all lower level things you normally don't want to worry about. */ -/* Attempt to recover from a USB foul-up (in practice I find that if you - have to do this, then it's already too late). */ -void pvr2_reset_ctl_endpoints(struct pvr2_hdw *hdw); - /* Issue a command and get a response from the device. LOTS of higher level stuff is built on this. */ int pvr2_send_request(struct pvr2_hdw *, void *write_ptr,unsigned int write_len, void *read_ptr,unsigned int read_len); -/* Issue a command and get a response from the device. This extended - version includes a probe flag (which if set means that device errors - should not be logged or treated as fatal) and a timeout in jiffies. - This can be used to non-lethally probe the health of endpoint 1. */ -int pvr2_send_request_ex(struct pvr2_hdw *,unsigned int timeout,int probe_fl, - void *write_ptr,unsigned int write_len, - void *read_ptr,unsigned int read_len); - /* Slightly higher level device communication functions. */ int pvr2_write_register(struct pvr2_hdw *, u16, u32); -int pvr2_read_register(struct pvr2_hdw *, u16, u32 *); -int pvr2_write_u16(struct pvr2_hdw *, u16, int); -int pvr2_write_u8(struct pvr2_hdw *, u8, int); /* Call if for any reason we can't talk to the hardware anymore - this will cause the driver to stop flailing on the device. */ void pvr2_hdw_render_useless(struct pvr2_hdw *); -void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *); /* Set / clear 8051's reset bit */ void pvr2_hdw_cpureset_assert(struct pvr2_hdw *,int); @@ -271,12 +245,6 @@ int pvr2_hdw_cmd_powerup(struct pvr2_hdw *); /* Order decoder to reset */ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *); -/* Stop / start video stream transport */ -int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl); - -/* Find I2C address of eeprom */ -int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *); - /* Direct manipulation of GPIO bits */ int pvr2_hdw_gpio_get_dir(struct pvr2_hdw *hdw,u32 *); int pvr2_hdw_gpio_get_out(struct pvr2_hdw *hdw,u32 *); diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c index 1dd4f6249b9..fbe6039aeb6 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c @@ -25,7 +25,6 @@ #include "pvrusb2-i2c-cmd-v4l2.h" #include "pvrusb2-audio.h" #include "pvrusb2-tuner.h" -#include "pvrusb2-demod.h" #include "pvrusb2-video-v4l.h" #ifdef CONFIG_VIDEO_PVRUSB2_24XXX #include "pvrusb2-cx2584x-v4l.h" @@ -89,11 +88,6 @@ void pvr2_i2c_probe(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp) return; } } - if (id == I2C_DRIVERID_TDA9887) { - if (pvr2_i2c_demod_setup(hdw,cp)) { - return; - } - } } diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c index 9f81aff2b38..8a9933dec91 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c @@ -196,7 +196,7 @@ const struct pvr2_i2c_op pvr2_i2c_op_v4l2_size = { static void do_log(struct pvr2_hdw *hdw) { pvr2_trace(PVR2_TRACE_CHIPS,"i2c v4l2 do_log()"); - pvr2_i2c_core_cmd(hdw,VIDIOC_LOG_STATUS,0); + pvr2_i2c_core_cmd(hdw,VIDIOC_LOG_STATUS,NULL); } @@ -217,7 +217,7 @@ const struct pvr2_i2c_op pvr2_i2c_op_v4l2_log = { void pvr2_v4l2_cmd_stream(struct pvr2_i2c_client *cp,int fl) { pvr2_i2c_client_cmd(cp, - (fl ? VIDIOC_STREAMON : VIDIOC_STREAMOFF),0); + (fl ? VIDIOC_STREAMON : VIDIOC_STREAMOFF),NULL); } diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c index c8d0bdee3ff..7fca4798227 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c @@ -37,6 +37,10 @@ static unsigned int i2c_scan = 0; module_param(i2c_scan, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); +static unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp, + unsigned int detail, + char *buf,unsigned int maxlen); + static int pvr2_i2c_write(struct pvr2_hdw *hdw, /* Context */ u8 i2c_addr, /* I2C address we're talking to */ u8 *data, /* Data to write */ @@ -165,12 +169,12 @@ static int pvr2_i2c_read(struct pvr2_hdw *hdw, /* Context */ /* This is the common low level entry point for doing I2C operations to the hardware. */ -int pvr2_i2c_basic_op(struct pvr2_hdw *hdw, - u8 i2c_addr, - u8 *wdata, - u16 wlen, - u8 *rdata, - u16 rlen) +static int pvr2_i2c_basic_op(struct pvr2_hdw *hdw, + u8 i2c_addr, + u8 *wdata, + u16 wlen, + u8 *rdata, + u16 rlen) { if (!rdata) rlen = 0; if (!wdata) wlen = 0; @@ -267,7 +271,7 @@ static int i2c_hack_cx25840(struct pvr2_hdw *hdw, "WARNING: Disabling further access to the device" " to prevent other foul-ups."); // This blocks all further communication with the part. - hdw->i2c_func[0x44] = 0; + hdw->i2c_func[0x44] = NULL; pvr2_hdw_render_useless(hdw); goto fail; } @@ -294,7 +298,7 @@ static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap, int num) { int ret = -ENOTSUPP; - pvr2_i2c_func funcp = 0; + pvr2_i2c_func funcp = NULL; struct pvr2_hdw *hdw = (struct pvr2_hdw *)(i2c_adap->algo_data); if (!num) { @@ -319,7 +323,7 @@ static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap, u16 tcnt,bcnt,offs; if (!msgs[0].len) { /* Length == 0 read. This is a probe. */ - if (funcp(hdw,msgs[0].addr,0,0,0,0)) { + if (funcp(hdw,msgs[0].addr,NULL,0,NULL,0)) { ret = -EIO; goto done; } @@ -336,7 +340,7 @@ static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap, if (bcnt > sizeof(hdw->cmd_buffer)-1) { bcnt = sizeof(hdw->cmd_buffer)-1; } - if (funcp(hdw,msgs[0].addr,0,0, + if (funcp(hdw,msgs[0].addr,NULL,0, msgs[0].buf+offs,bcnt)) { ret = -EIO; goto done; @@ -350,7 +354,7 @@ static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap, /* Simple write */ ret = 1; if (funcp(hdw,msgs[0].addr, - msgs[0].buf,msgs[0].len,0,0)) { + msgs[0].buf,msgs[0].len,NULL,0)) { ret = -EIO; } goto done; @@ -705,9 +709,9 @@ int pvr2_i2c_core_check_stale(struct pvr2_hdw *hdw) return (hdw->i2c_pend_types & PVR2_I2C_PEND_ALL) != 0; } -unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp, - unsigned int detail, - char *buf,unsigned int maxlen) +static unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp, + unsigned int detail, + char *buf,unsigned int maxlen) { unsigned int ccnt,bcnt; int spcfl = 0; @@ -871,7 +875,7 @@ static void do_i2c_scan(struct pvr2_hdw *hdw) msg[0].addr = 0; msg[0].flags = I2C_M_RD; msg[0].len = 0; - msg[0].buf = 0; + msg[0].buf = NULL; printk("%s: i2c scan beginning\n",hdw->name); for (i = 0; i < 128; i++) { msg[0].addr = i; diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.h b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.h index e8af5b0ed3c..6d7e2524757 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.h +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.h @@ -75,9 +75,6 @@ unsigned int pvr2_i2c_report(struct pvr2_hdw *,char *buf,unsigned int maxlen); PVR2_I2C_DETAIL_DEBUG |\ PVR2_I2C_DETAIL_HANDLER |\ PVR2_I2C_DETAIL_CTLMASK) -unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *, - unsigned int detail_mask, - char *buf,unsigned int maxlen); void pvr2_i2c_probe(struct pvr2_hdw *,struct pvr2_i2c_client *); const struct pvr2_i2c_op *pvr2_i2c_get_op(unsigned int idx); diff --git a/drivers/media/video/pvrusb2/pvrusb2-io.c b/drivers/media/video/pvrusb2/pvrusb2-io.c index a984c91f571..681f79c8064 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-io.c +++ b/drivers/media/video/pvrusb2/pvrusb2-io.c @@ -93,7 +93,7 @@ struct pvr2_buffer { struct urb *purb; }; -const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st) +static const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st) { switch (st) { case pvr2_buffer_state_none: return "none"; @@ -104,7 +104,8 @@ const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st) return "unknown"; } -void pvr2_buffer_describe(struct pvr2_buffer *bp,const char *msg) +#ifdef SANITY_CHECK_BUFFERS +static void pvr2_buffer_describe(struct pvr2_buffer *bp,const char *msg) { pvr2_trace(PVR2_TRACE_INFO, "buffer%s%s %p state=%s id=%d status=%d" @@ -115,10 +116,11 @@ void pvr2_buffer_describe(struct pvr2_buffer *bp,const char *msg) (bp ? pvr2_buffer_state_decode(bp->state) : "(invalid)"), (bp ? bp->id : 0), (bp ? bp->status : 0), - (bp ? bp->stream : 0), - (bp ? bp->purb : 0), + (bp ? bp->stream : NULL), + (bp ? bp->purb : NULL), (bp ? bp->signature : 0)); } +#endif /* SANITY_CHECK_BUFFERS */ static void pvr2_buffer_remove(struct pvr2_buffer *bp) { @@ -284,7 +286,7 @@ static void pvr2_buffer_done(struct pvr2_buffer *bp) pvr2_buffer_wipe(bp); pvr2_buffer_set_none(bp); bp->signature = 0; - bp->stream = 0; + bp->stream = NULL; if (bp->purb) usb_free_urb(bp->purb); pvr2_trace(PVR2_TRACE_BUF_POOL,"/*---TRACE_FLOW---*/" " bufferDone %p",bp); @@ -339,13 +341,13 @@ static int pvr2_stream_buffer_count(struct pvr2_stream *sp,unsigned int cnt) struct pvr2_buffer *bp; bp = sp->buffers[sp->buffer_total_count - 1]; /* Paranoia */ - sp->buffers[sp->buffer_total_count - 1] = 0; + sp->buffers[sp->buffer_total_count - 1] = NULL; (sp->buffer_total_count)--; pvr2_buffer_done(bp); kfree(bp); } if (scnt < sp->buffer_slot_count) { - struct pvr2_buffer **nb = 0; + struct pvr2_buffer **nb = NULL; if (scnt) { nb = kmalloc(scnt * sizeof(*nb),GFP_KERNEL); if (!nb) return -ENOMEM; @@ -513,10 +515,6 @@ void pvr2_stream_set_callback(struct pvr2_stream *sp, } /* Query / set the nominal buffer count */ -int pvr2_stream_get_buffer_count(struct pvr2_stream *sp) -{ - return sp->buffer_target_count; -} int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt) { @@ -532,21 +530,21 @@ int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt) struct pvr2_buffer *pvr2_stream_get_idle_buffer(struct pvr2_stream *sp) { struct list_head *lp = sp->idle_list.next; - if (lp == &sp->idle_list) return 0; + if (lp == &sp->idle_list) return NULL; return list_entry(lp,struct pvr2_buffer,list_overhead); } struct pvr2_buffer *pvr2_stream_get_ready_buffer(struct pvr2_stream *sp) { struct list_head *lp = sp->ready_list.next; - if (lp == &sp->ready_list) return 0; + if (lp == &sp->ready_list) return NULL; return list_entry(lp,struct pvr2_buffer,list_overhead); } struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp,int id) { - if (id < 0) return 0; - if (id >= sp->buffer_total_count) return 0; + if (id < 0) return NULL; + if (id >= sp->buffer_total_count) return NULL; return sp->buffers[id]; } @@ -555,17 +553,6 @@ int pvr2_stream_get_ready_count(struct pvr2_stream *sp) return sp->r_count; } -int pvr2_stream_get_idle_count(struct pvr2_stream *sp) -{ - return sp->i_count; -} - -void pvr2_stream_flush(struct pvr2_stream *sp) -{ - mutex_lock(&sp->mutex); do { - pvr2_stream_internal_flush(sp); - } while(0); mutex_unlock(&sp->mutex); -} void pvr2_stream_kill(struct pvr2_stream *sp) { @@ -620,20 +607,6 @@ int pvr2_buffer_queue(struct pvr2_buffer *bp) return ret; } -int pvr2_buffer_idle(struct pvr2_buffer *bp) -{ - struct pvr2_stream *sp; - if (!bp) return -EINVAL; - sp = bp->stream; - mutex_lock(&sp->mutex); do { - pvr2_buffer_wipe(bp); - pvr2_buffer_set_idle(bp); - if (sp->buffer_total_count != sp->buffer_target_count) { - pvr2_stream_achieve_buffer_count(sp); - } - } while(0); mutex_unlock(&sp->mutex); - return 0; -} int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt) { @@ -673,10 +646,6 @@ int pvr2_buffer_get_status(struct pvr2_buffer *bp) return bp->status; } -enum pvr2_buffer_state pvr2_buffer_get_state(struct pvr2_buffer *bp) -{ - return bp->state; -} int pvr2_buffer_get_id(struct pvr2_buffer *bp) { diff --git a/drivers/media/video/pvrusb2/pvrusb2-io.h b/drivers/media/video/pvrusb2/pvrusb2-io.h index 65e11385b2b..96285ad234a 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-io.h +++ b/drivers/media/video/pvrusb2/pvrusb2-io.h @@ -36,8 +36,6 @@ enum pvr2_buffer_state { struct pvr2_stream; struct pvr2_buffer; -const char *pvr2_buffer_state_decode(enum pvr2_buffer_state); - /* Initialize / tear down stream structure */ struct pvr2_stream *pvr2_stream_create(void); void pvr2_stream_destroy(struct pvr2_stream *); @@ -49,7 +47,6 @@ void pvr2_stream_set_callback(struct pvr2_stream *, void *data); /* Query / set the nominal buffer count */ -int pvr2_stream_get_buffer_count(struct pvr2_stream *); int pvr2_stream_set_buffer_count(struct pvr2_stream *,unsigned int); /* Get a pointer to a buffer that is either idle, ready, or is specified @@ -59,12 +56,8 @@ struct pvr2_buffer *pvr2_stream_get_ready_buffer(struct pvr2_stream *); struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp,int id); /* Find out how many buffers are idle or ready */ -int pvr2_stream_get_idle_count(struct pvr2_stream *); int pvr2_stream_get_ready_count(struct pvr2_stream *); -/* Kill all pending operations */ -void pvr2_stream_flush(struct pvr2_stream *); - /* Kill all pending buffers and throw away any ready buffers as well */ void pvr2_stream_kill(struct pvr2_stream *); @@ -77,18 +70,12 @@ unsigned int pvr2_buffer_get_count(struct pvr2_buffer *); /* Retrieve completion code for given ready buffer */ int pvr2_buffer_get_status(struct pvr2_buffer *); -/* Retrieve state of given buffer */ -enum pvr2_buffer_state pvr2_buffer_get_state(struct pvr2_buffer *); - /* Retrieve ID of given buffer */ int pvr2_buffer_get_id(struct pvr2_buffer *); /* Start reading into given buffer (kill it if needed) */ int pvr2_buffer_queue(struct pvr2_buffer *); -/* Move buffer back to idle pool (kill it if needed) */ -int pvr2_buffer_idle(struct pvr2_buffer *); - #endif /* __PVRUSB2_IO_H */ /* diff --git a/drivers/media/video/pvrusb2/pvrusb2-ioread.c b/drivers/media/video/pvrusb2/pvrusb2-ioread.c index 49da062e327..f7a2e225a00 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ioread.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ioread.c @@ -54,7 +54,7 @@ static int pvr2_ioread_init(struct pvr2_ioread *cp) { unsigned int idx; - cp->stream = 0; + cp->stream = NULL; mutex_init(&cp->mutex); for (idx = 0; idx < BUFFER_COUNT; idx++) { @@ -77,7 +77,7 @@ static void pvr2_ioread_done(struct pvr2_ioread *cp) { unsigned int idx; - pvr2_ioread_setup(cp,0); + pvr2_ioread_setup(cp,NULL); for (idx = 0; idx < BUFFER_COUNT; idx++) { if (!(cp->buffer_storage[idx])) continue; kfree(cp->buffer_storage[idx]); @@ -88,12 +88,12 @@ struct pvr2_ioread *pvr2_ioread_create(void) { struct pvr2_ioread *cp; cp = kmalloc(sizeof(*cp),GFP_KERNEL); - if (!cp) return 0; + if (!cp) return NULL; pvr2_trace(PVR2_TRACE_STRUCT,"pvr2_ioread_create id=%p",cp); memset(cp,0,sizeof(*cp)); if (pvr2_ioread_init(cp) < 0) { kfree(cp); - return 0; + return NULL; } return cp; } @@ -105,7 +105,7 @@ void pvr2_ioread_destroy(struct pvr2_ioread *cp) pvr2_trace(PVR2_TRACE_STRUCT,"pvr2_ioread_destroy id=%p",cp); if (cp->sync_key_ptr) { kfree(cp->sync_key_ptr); - cp->sync_key_ptr = 0; + cp->sync_key_ptr = NULL; } kfree(cp); } @@ -124,7 +124,7 @@ void pvr2_ioread_set_sync_key(struct pvr2_ioread *cp, if (sync_key_len != cp->sync_key_len) { if (cp->sync_key_ptr) { kfree(cp->sync_key_ptr); - cp->sync_key_ptr = 0; + cp->sync_key_ptr = NULL; } cp->sync_key_len = 0; if (sync_key_len) { @@ -144,8 +144,8 @@ static void pvr2_ioread_stop(struct pvr2_ioread *cp) pvr2_trace(PVR2_TRACE_START_STOP, "/*---TRACE_READ---*/ pvr2_ioread_stop id=%p",cp); pvr2_stream_kill(cp->stream); - cp->c_buf = 0; - cp->c_data_ptr = 0; + cp->c_buf = NULL; + cp->c_data_ptr = NULL; cp->c_data_len = 0; cp->c_data_offs = 0; cp->enabled = 0; @@ -179,8 +179,8 @@ static int pvr2_ioread_start(struct pvr2_ioread *cp) } } cp->enabled = !0; - cp->c_buf = 0; - cp->c_data_ptr = 0; + cp->c_buf = NULL; + cp->c_data_ptr = NULL; cp->c_data_len = 0; cp->c_data_offs = 0; cp->stream_running = 0; @@ -214,7 +214,7 @@ int pvr2_ioread_setup(struct pvr2_ioread *cp,struct pvr2_stream *sp) pvr2_ioread_stop(cp); pvr2_stream_kill(cp->stream); pvr2_stream_set_buffer_count(cp->stream,0); - cp->stream = 0; + cp->stream = NULL; } if (sp) { pvr2_trace(PVR2_TRACE_START_STOP, @@ -251,12 +251,8 @@ int pvr2_ioread_set_enabled(struct pvr2_ioread *cp,int fl) return ret; } -int pvr2_ioread_get_enabled(struct pvr2_ioread *cp) -{ - return cp->enabled != 0; -} -int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) +static int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) { int stat; @@ -274,8 +270,8 @@ int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) pvr2_ioread_stop(cp); return 0; } - cp->c_buf = 0; - cp->c_data_ptr = 0; + cp->c_buf = NULL; + cp->c_data_ptr = NULL; cp->c_data_len = 0; cp->c_data_offs = 0; } @@ -307,7 +303,7 @@ int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) return !0; } -void pvr2_ioread_filter(struct pvr2_ioread *cp) +static void pvr2_ioread_filter(struct pvr2_ioread *cp) { unsigned int idx; if (!cp->enabled) return; diff --git a/drivers/media/video/pvrusb2/pvrusb2-ioread.h b/drivers/media/video/pvrusb2/pvrusb2-ioread.h index 6b002597f5d..1d362f83358 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ioread.h +++ b/drivers/media/video/pvrusb2/pvrusb2-ioread.h @@ -33,7 +33,6 @@ void pvr2_ioread_set_sync_key(struct pvr2_ioread *, const char *sync_key_ptr, unsigned int sync_key_len); int pvr2_ioread_set_enabled(struct pvr2_ioread *,int fl); -int pvr2_ioread_get_enabled(struct pvr2_ioread *); int pvr2_ioread_read(struct pvr2_ioread *,void __user *buf,unsigned int cnt); int pvr2_ioread_avail(struct pvr2_ioread *); diff --git a/drivers/media/video/pvrusb2/pvrusb2-main.c b/drivers/media/video/pvrusb2/pvrusb2-main.c index b95248274ed..8f1a5afdd34 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-main.c +++ b/drivers/media/video/pvrusb2/pvrusb2-main.c @@ -54,7 +54,7 @@ module_param_named(debug,pvrusb2_debug,int,S_IRUGO|S_IWUSR); MODULE_PARM_DESC(debug, "Debug trace mask"); #ifdef CONFIG_VIDEO_PVRUSB2_SYSFS -static struct pvr2_sysfs_class *class_ptr = 0; +static struct pvr2_sysfs_class *class_ptr = NULL; #endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */ static void pvr_setup_attach(struct pvr2_context *pvr) @@ -104,10 +104,10 @@ static void pvr_disconnect(struct usb_interface *intf) } static struct usb_driver pvr_driver = { - name: "pvrusb2", - id_table: pvr2_device_table, - probe: pvr_probe, - disconnect: pvr_disconnect + .name = "pvrusb2", + .id_table = pvr2_device_table, + .probe = pvr_probe, + .disconnect = pvr_disconnect }; /* diff --git a/drivers/media/video/pvrusb2/pvrusb2-std.c b/drivers/media/video/pvrusb2/pvrusb2-std.c index 13406369364..f95c598ff62 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-std.c +++ b/drivers/media/video/pvrusb2/pvrusb2-std.c @@ -121,7 +121,7 @@ static const struct std_name *find_std_name(const struct std_name *arrPtr, if (strlen(p->name) != bufSize) continue; if (!memcmp(bufPtr,p->name,bufSize)) return p; } - return 0; + return NULL; } @@ -289,7 +289,7 @@ static struct v4l2_standard *match_std(v4l2_std_id id) return generic_standards + idx; } } - return 0; + return NULL; } static int pvr2_std_fill(struct v4l2_standard *std,v4l2_std_id id) @@ -364,7 +364,7 @@ struct v4l2_standard *pvr2_std_create_enum(unsigned int *countptr, pvr2_trace(PVR2_TRACE_INIT,"Setting up %u unique standard(s)", std_cnt); - if (!std_cnt) return 0; // paranoia + if (!std_cnt) return NULL; // paranoia stddefs = kmalloc(sizeof(struct v4l2_standard) * std_cnt, GFP_KERNEL); diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index c6e6523d74b..6af55a8b6f0 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c @@ -504,7 +504,7 @@ static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id) cip->cptr = cptr; cip->chptr = sfp; - cip->item_next = 0; + cip->item_next = NULL; if (sfp->item_last) { sfp->item_last->item_next = cip; } else { @@ -625,7 +625,7 @@ static void pvr2_sysfs_tear_down_debugifc(struct pvr2_sysfs *sfp) &sfp->debugifc->attr_debuginfo); class_device_remove_file(sfp->class_dev,&sfp->debugifc->attr_debugcmd); kfree(sfp->debugifc); - sfp->debugifc = 0; + sfp->debugifc = NULL; } #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ @@ -678,9 +678,9 @@ static void class_dev_destroy(struct pvr2_sysfs *sfp) class_device_remove_file(sfp->class_dev,&sfp->attr_v4l_minor_number); class_device_remove_file(sfp->class_dev,&sfp->attr_unit_number); pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); - sfp->class_dev->class_data = 0; + sfp->class_dev->class_data = NULL; class_device_unregister(sfp->class_dev); - sfp->class_dev = 0; + sfp->class_dev = NULL; } @@ -739,13 +739,13 @@ static void class_dev_create(struct pvr2_sysfs *sfp, sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number"; sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; sfp->attr_v4l_minor_number.show = v4l_minor_number_show; - sfp->attr_v4l_minor_number.store = 0; + sfp->attr_v4l_minor_number.store = NULL; class_device_create_file(sfp->class_dev,&sfp->attr_v4l_minor_number); sfp->attr_unit_number.attr.owner = THIS_MODULE; sfp->attr_unit_number.attr.name = "unit_number"; sfp->attr_unit_number.attr.mode = S_IRUGO; sfp->attr_unit_number.show = unit_number_show; - sfp->attr_unit_number.store = 0; + sfp->attr_unit_number.store = NULL; class_device_create_file(sfp->class_dev,&sfp->attr_unit_number); pvr2_sysfs_add_controls(sfp); @@ -806,7 +806,7 @@ struct pvr2_sysfs_class *pvr2_sysfs_class_create(void) pvr2_sysfs_trace( "Registration failed for pvr2_sysfs_class id=%p",clp); kfree(clp); - clp = 0; + clp = NULL; } return clp; } diff --git a/drivers/media/video/pvrusb2/pvrusb2-tuner.c b/drivers/media/video/pvrusb2/pvrusb2-tuner.c index f4aba8144ce..af9f246f8d3 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-tuner.c +++ b/drivers/media/video/pvrusb2/pvrusb2-tuner.c @@ -69,7 +69,7 @@ static void tuner_update(struct pvr2_tuner_handler *ctxt) static void pvr2_tuner_detach(struct pvr2_tuner_handler *ctxt) { - ctxt->client->handler = 0; + ctxt->client->handler = NULL; kfree(ctxt); } diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 961951010c2..0caf70b8c0d 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -81,7 +81,7 @@ static int video_nr[PVR_NUM] = {[0 ... PVR_NUM-1] = -1}; module_param_array(video_nr, int, NULL, 0444); MODULE_PARM_DESC(video_nr, "Offset for device's minor"); -struct v4l2_capability pvr_capability ={ +static struct v4l2_capability pvr_capability ={ .driver = "pvrusb2", .card = "Hauppauge WinTV pvr-usb2", .bus_info = "usb", @@ -111,7 +111,7 @@ static struct v4l2_tuner pvr_v4l2_tuners[]= { } }; -struct v4l2_fmtdesc pvr_fmtdesc [] = { +static struct v4l2_fmtdesc pvr_fmtdesc [] = { { .index = 0, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, @@ -127,7 +127,7 @@ struct v4l2_fmtdesc pvr_fmtdesc [] = { #define PVR_FORMAT_PIX 0 #define PVR_FORMAT_VBI 1 -struct v4l2_format pvr_format [] = { +static struct v4l2_format pvr_format [] = { [PVR_FORMAT_PIX] = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, .fmt = { @@ -701,9 +701,8 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip) { - pvr2_trace(PVR2_TRACE_INIT, - "unregistering device video%d [%s]", - dip->vdev->minor,pvr2_config_get_name(dip->config)); + printk(KERN_INFO "pvrusb2: unregistering device video%d [%s]\n", + dip->vdev->minor,pvr2_config_get_name(dip->config)); if (dip->ctxt_idx >= 0) { mutex_lock(&device_lock); devices[dip->ctxt_idx] = NULL; @@ -725,7 +724,7 @@ static void pvr2_v4l2_destroy_no_lock(struct pvr2_v4l2 *vp) } -void pvr2_v4l2_internal_check(struct pvr2_channel *chp) +static void pvr2_v4l2_internal_check(struct pvr2_channel *chp) { struct pvr2_v4l2 *vp; vp = container_of(chp,struct pvr2_v4l2,channel); @@ -735,8 +734,8 @@ void pvr2_v4l2_internal_check(struct pvr2_channel *chp) } -int pvr2_v4l2_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) +static int pvr2_v4l2_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg) { /* Temporary hack : use ivtv api until a v4l2 one is available. */ @@ -747,7 +746,7 @@ int pvr2_v4l2_ioctl(struct inode *inode, struct file *file, } -int pvr2_v4l2_release(struct inode *inode, struct file *file) +static int pvr2_v4l2_release(struct inode *inode, struct file *file) { struct pvr2_v4l2_fh *fhp = file->private_data; struct pvr2_v4l2 *vp = fhp->vhead; @@ -761,9 +760,9 @@ int pvr2_v4l2_release(struct inode *inode, struct file *file) hdw = fhp->channel.mc_head->hdw; pvr2_hdw_set_streaming(hdw,0); sp = pvr2_ioread_get_stream(fhp->rhp); - if (sp) pvr2_stream_set_callback(sp,0,0); + if (sp) pvr2_stream_set_callback(sp,NULL,NULL); pvr2_ioread_destroy(fhp->rhp); - fhp->rhp = 0; + fhp->rhp = NULL; } v4l2_prio_close(&vp->prio, &fhp->prio); file->private_data = NULL; @@ -779,9 +778,9 @@ int pvr2_v4l2_release(struct inode *inode, struct file *file) } else { vp->vfirst = fhp->vnext; } - fhp->vnext = 0; - fhp->vprev = 0; - fhp->vhead = 0; + fhp->vnext = NULL; + fhp->vprev = NULL; + fhp->vhead = NULL; pvr2_channel_done(&fhp->channel); pvr2_trace(PVR2_TRACE_STRUCT, "Destroying pvr_v4l2_fh id=%p",fhp); @@ -794,9 +793,9 @@ int pvr2_v4l2_release(struct inode *inode, struct file *file) } -int pvr2_v4l2_open(struct inode *inode, struct file *file) +static int pvr2_v4l2_open(struct inode *inode, struct file *file) { - struct pvr2_v4l2_dev *dip = 0; /* Our own context pointer */ + struct pvr2_v4l2_dev *dip = NULL; /* Our own context pointer */ struct pvr2_v4l2_fh *fhp; struct pvr2_v4l2 *vp; struct pvr2_hdw *hdw; @@ -854,7 +853,7 @@ int pvr2_v4l2_open(struct inode *inode, struct file *file) pvr2_context_enter(vp->channel.mc_head); do { pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr_v4l2_fh id=%p",fhp); pvr2_channel_init(&fhp->channel,vp->channel.mc_head); - fhp->vnext = 0; + fhp->vnext = NULL; fhp->vprev = vp->vlast; if (vp->vlast) { vp->vlast->vnext = fhp; @@ -897,7 +896,7 @@ static int pvr2_v4l2_iosetup(struct pvr2_v4l2_fh *fh) fh->rhp = pvr2_channel_create_mpeg_stream(fh->dev_info->stream); if (!fh->rhp) { - pvr2_channel_claim_stream(&fh->channel,0); + pvr2_channel_claim_stream(&fh->channel,NULL); return -ENOMEM; } @@ -1078,9 +1077,8 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, (video_register_device(dip->vdev, v4l_type, -1) < 0)) { err("Failed to register pvrusb2 v4l video device"); } else { - pvr2_trace(PVR2_TRACE_INIT, - "registered device video%d [%s]", - dip->vdev->minor,pvr2_config_get_name(dip->config)); + printk(KERN_INFO "pvrusb2: registered device video%d [%s]\n", + dip->vdev->minor,pvr2_config_get_name(dip->config)); } if ((dip->vdev->minor < sizeof(devices)/sizeof(devices[0])) && diff --git a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c index e4ec7f25194..05f2cddeb47 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c +++ b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c @@ -126,8 +126,8 @@ static const struct pvr2_v4l_decoder_ops decoder_ops[] = { static void decoder_detach(struct pvr2_v4l_decoder *ctxt) { - ctxt->client->handler = 0; - ctxt->hdw->decoder_ctrl = 0; + ctxt->client->handler = NULL; + ctxt->hdw->decoder_ctrl = NULL; kfree(ctxt); } diff --git a/drivers/media/video/pvrusb2/pvrusb2-wm8775.c b/drivers/media/video/pvrusb2/pvrusb2-wm8775.c index fcad346e395..2413e5198e1 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-wm8775.c +++ b/drivers/media/video/pvrusb2/pvrusb2-wm8775.c @@ -89,7 +89,7 @@ static unsigned int wm8775_describe(struct pvr2_v4l_wm8775 *ctxt, static void wm8775_detach(struct pvr2_v4l_wm8775 *ctxt) { - ctxt->client->handler = 0; + ctxt->client->handler = NULL; kfree(ctxt); } diff --git a/drivers/media/video/pwc/pwc-uncompress.h b/drivers/media/video/pwc/pwc-uncompress.h index 041227f6524..43028e74e9e 100644 --- a/drivers/media/video/pwc/pwc-uncompress.h +++ b/drivers/media/video/pwc/pwc-uncompress.h @@ -30,7 +30,6 @@ #ifndef PWC_UNCOMPRESS_H #define PWC_UNCOMPRESS_H -#include <linux/config.h> #include <media/pwc-ioctl.h> diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 629f79e44fb..7e9c4237d1e 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -25,7 +25,6 @@ #ifndef PWC_H #define PWC_H -#include <linux/config.h> #include <linux/module.h> #include <linux/usb.h> #include <linux/spinlock.h> diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index d77e6a8d943..f1fd69e7f11 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -929,7 +929,7 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum) err = request_irq(dev->pci->irq, saa7134_alsa_irq, - SA_SHIRQ | SA_INTERRUPT, dev->name, + IRQF_SHARED | IRQF_DISABLED, dev->name, (void*) &dev->dmasound); if (err < 0) { diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index f0c2111f14a..6e97cc84ba8 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -20,7 +20,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/init.h> #include <linux/list.h> #include <linux/module.h> @@ -871,9 +870,9 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &dev->pci_rev); pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat); printk(KERN_INFO "%s: found at %s, rev: %d, irq: %d, " - "latency: %d, mmio: 0x%lx\n", dev->name, + "latency: %d, mmio: 0x%llx\n", dev->name, pci_name(pci_dev), dev->pci_rev, pci_dev->irq, - dev->pci_lat,pci_resource_start(pci_dev,0)); + dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0)); pci_set_master(pci_dev); if (!pci_dma_supported(pci_dev, DMA_32BIT_MASK)) { printk("%s: Oops: no 32bit PCI DMA ???\n",dev->name); @@ -905,8 +904,8 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, pci_resource_len(pci_dev,0), dev->name)) { err = -EBUSY; - printk(KERN_ERR "%s: can't get MMIO memory @ 0x%lx\n", - dev->name,pci_resource_start(pci_dev,0)); + printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx\n", + dev->name,(unsigned long long)pci_resource_start(pci_dev,0)); goto fail1; } dev->lmmio = ioremap(pci_resource_start(pci_dev,0), 0x1000); @@ -924,7 +923,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, /* get irq */ err = request_irq(pci_dev->irq, saa7134_irq, - SA_SHIRQ | SA_INTERRUPT, dev->name, dev); + IRQF_SHARED | IRQF_DISABLED, dev->name, dev); if (err < 0) { printk(KERN_ERR "%s: can't get IRQ %d\n", dev->name,pci_dev->irq); @@ -942,8 +941,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, /* load i2c helpers */ if (TUNER_ABSENT != dev->tuner_type) request_module("tuner"); - if (dev->tda9887_conf) - request_module("tda9887"); if (card_is_empress(dev)) { request_module("saa6752hs"); request_module_depend("saa7134-empress",&need_empress); diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index 7aa02b34e01..3895d05804a 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c @@ -845,7 +845,7 @@ int saa7134_oss_init1(struct saa7134_dev *dev) { if ((request_irq(dev->pci->irq, saa7134_oss_irq, - SA_SHIRQ | SA_INTERRUPT, dev->name, + IRQF_SHARED | IRQF_DISABLED, dev->name, (void*) &dev->dmasound)) < 0) return -1; diff --git a/drivers/media/video/se401.c b/drivers/media/video/se401.c index a846ebc78cd..67987baee77 100644 --- a/drivers/media/video/se401.c +++ b/drivers/media/video/se401.c @@ -27,7 +27,6 @@ static const char version[] = "0.24"; -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/vmalloc.h> diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c index c18b31d9928..b36ba9fa3a2 100644 --- a/drivers/media/video/stradis.c +++ b/drivers/media/video/stradis.c @@ -1983,7 +1983,7 @@ static int __devinit configure_saa7146(struct pci_dev *pdev, int num) memcpy(&saa->video_dev, &saa_template, sizeof(saa_template)); saawrite(0, SAA7146_IER); /* turn off all interrupts */ - retval = request_irq(saa->irq, saa7146_irq, SA_SHIRQ | SA_INTERRUPT, + retval = request_irq(saa->irq, saa7146_irq, IRQF_SHARED | IRQF_DISABLED, "stradis", saa); if (retval == -EINVAL) dev_err(&pdev->dev, "%d: Bad irq number or handler\n", num); diff --git a/drivers/media/video/stv680.c b/drivers/media/video/stv680.c index 351b182d921..2ba2991a214 100644 --- a/drivers/media/video/stv680.c +++ b/drivers/media/video/stv680.c @@ -58,7 +58,6 @@ * Fixed proc entry removal bug. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/vmalloc.h> diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 2fadabf9968..8dab481d384 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c @@ -590,8 +590,8 @@ int tda9887_tuner_init(struct i2c_client *c) t->set_tv_freq = tda9887_set_freq; t->set_radio_freq = tda9887_set_freq; t->standby = tda9887_standby; - t->tuner_status=tda9887_tuner_status; - t->get_afc=tda9887_get_afc; + t->tuner_status = tda9887_tuner_status; + t->get_afc = tda9887_get_afc; return 0; } diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 011413cf34a..f7eb402d5f2 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -416,7 +416,7 @@ static void tuner_status(struct i2c_client *client) /* ---------------------------------------------------------------------- */ -/* static var Used only in tuner_attach and tuner_probe */ +/* static vars: used only in tuner_attach and tuner_probe */ static unsigned default_mode_mask; /* During client attach, set_type is called by adapter's attach_inform callback. @@ -608,13 +608,13 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) tuner_dbg("VIDIOCSAUDIO not implemented.\n"); break; case TDA9887_SET_CONFIG: - { - int *i = arg; + if (t->type == TUNER_TDA9887) { + int *i = arg; - t->tda9887_config = *i; - set_freq(client, t->tv_freq); + t->tda9887_config = *i; + set_freq(client, t->tv_freq); + } break; - } /* --- v4l ioctls --- */ /* take care: bttv does userspace copying, we'll get a kernel pointer here... */ diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index 6da6f82b8c8..d071c5cbf01 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c @@ -7,6 +7,7 @@ #include <linux/i2c.h> #include <linux/videodev.h> #include <media/tuner.h> +#include <media/v4l2-common.h> static int offset = 0; module_param(offset, int, 0666); @@ -128,6 +129,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) u8 buffer[4]; int rc, IFPCoff, i, j; enum param_type desired_type; + struct tuner_params *params; tun = &tuners[t->type]; @@ -169,19 +171,20 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) IFPCoff,t->type); j = 0; } + params = &tun->params[j]; - for (i = 0; i < tun->params[j].count; i++) { - if (freq > tun->params[j].ranges[i].limit) + for (i = 0; i < params->count; i++) { + if (freq > params->ranges[i].limit) continue; break; } - if (i == tun->params[j].count) { + if (i == params->count) { tuner_dbg("TV frequency out of range (%d > %d)", - freq, tun->params[j].ranges[i - 1].limit); - freq = tun->params[j].ranges[--i].limit; + freq, params->ranges[i - 1].limit); + freq = params->ranges[--i].limit; } - config = tun->params[j].ranges[i].config; - cb = tun->params[j].ranges[i].cb; + config = params->ranges[i].config; + cb = params->ranges[i].cb; /* i == 0 -> VHF_LO * i == 1 -> VHF_HI * i == 2 -> UHF */ @@ -281,7 +284,7 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) break; } - if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) { + if (params->cb_first_if_lower_freq && div < t->last_div) { buffer[0] = config; buffer[1] = cb; buffer[2] = (div>>8) & 0x7f; @@ -293,6 +296,43 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) buffer[3] = cb; } t->last_div = div; + if (params->has_tda9887) { + int config = 0; + int is_secam_l = (t->std & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC)) && + !(t->std & ~(V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC)); + + if (t->std == V4L2_STD_SECAM_LC) { + if (params->port1_active ^ params->port1_invert_for_secam_lc) + config |= TDA9887_PORT1_ACTIVE; + if (params->port2_active ^ params->port2_invert_for_secam_lc) + config |= TDA9887_PORT2_ACTIVE; + } + else { + if (params->port1_active) + config |= TDA9887_PORT1_ACTIVE; + if (params->port2_active) + config |= TDA9887_PORT2_ACTIVE; + } + if (params->intercarrier_mode) + config |= TDA9887_INTERCARRIER; + if (is_secam_l) { + if (i == 0 && params->default_top_secam_low) + config |= TDA9887_TOP(params->default_top_secam_low); + else if (i == 1 && params->default_top_secam_mid) + config |= TDA9887_TOP(params->default_top_secam_mid); + else if (params->default_top_secam_high) + config |= TDA9887_TOP(params->default_top_secam_high); + } + else { + if (i == 0 && params->default_top_low) + config |= TDA9887_TOP(params->default_top_low); + else if (i == 1 && params->default_top_mid) + config |= TDA9887_TOP(params->default_top_mid); + else if (params->default_top_high) + config |= TDA9887_TOP(params->default_top_high); + } + i2c_clients_command(c->adapter, TDA9887_SET_CONFIG, &config); + } tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", buffer[0],buffer[1],buffer[2],buffer[3]); @@ -339,6 +379,7 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) u16 div; int rc, j; enum param_type desired_type = TUNER_PARAM_TYPE_RADIO; + struct tuner_params *params; tun = &tuners[t->type]; @@ -352,7 +393,8 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) j = 0; div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */ - buffer[2] = (tun->params[j].ranges[0].config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */ + params = &tun->params[j]; + buffer[2] = (params->ranges[0].config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */ switch (t->type) { case TUNER_TENA_9533_DI: @@ -384,7 +426,7 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) } buffer[0] = (div>>8) & 0x7f; buffer[1] = div & 0xff; - if (tuners[t->type].params->cb_first_if_lower_freq && div < t->last_div) { + if (params->cb_first_if_lower_freq && div < t->last_div) { buffer[0] = buffer[2]; buffer[1] = buffer[3]; buffer[2] = (div>>8) & 0x7f; @@ -398,6 +440,18 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) buffer[0],buffer[1],buffer[2],buffer[3]); t->last_div = div; + if (params->has_tda9887) { + int config = 0; + if (params->port1_active && !params->port1_fm_high_sensitivity) + config |= TDA9887_PORT1_ACTIVE; + if (params->port2_active && !params->port2_fm_high_sensitivity) + config |= TDA9887_PORT2_ACTIVE; + if (params->intercarrier_mode) + config |= TDA9887_INTERCARRIER; +/* if (params->port1_set_for_fm_mono) + config &= ~TDA9887_PORT1_ACTIVE;*/ + i2c_clients_command(c->adapter, TDA9887_SET_CONFIG, &config); + } if (4 != (rc = i2c_master_send(c,buffer,4))) tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); } diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c index 9d9226cb639..a167e17c6dc 100644 --- a/drivers/media/video/tuner-types.c +++ b/drivers/media/video/tuner-types.c @@ -380,6 +380,10 @@ static struct tuner_params tuner_philips_fq1216me_params[] = { .type = TUNER_PARAM_TYPE_PAL, .ranges = tuner_lg_pal_ranges, .count = ARRAY_SIZE(tuner_lg_pal_ranges), + .has_tda9887 = 1, + .port1_active = 1, + .port2_active = 1, + .port2_invert_for_secam_lc = 1, }, }; @@ -542,6 +546,14 @@ static struct tuner_params tuner_fm1216me_mk3_params[] = { .ranges = tuner_fm1216me_mk3_pal_ranges, .count = ARRAY_SIZE(tuner_fm1216me_mk3_pal_ranges), .cb_first_if_lower_freq = 1, + .has_tda9887 = 1, + .port1_active = 1, + .port2_active = 1, + .port2_invert_for_secam_lc = 1, + .port1_fm_high_sensitivity = 1, + .default_top_mid = -2, + .default_top_secam_mid = -2, + .default_top_secam_high = -2, }, }; @@ -612,6 +624,10 @@ static struct tuner_params tuner_fm1236_mk3_params[] = { .ranges = tuner_fm1236_mk3_ntsc_ranges, .count = ARRAY_SIZE(tuner_fm1236_mk3_ntsc_ranges), .cb_first_if_lower_freq = 1, + .has_tda9887 = 1, + .port1_active = 1, + .port2_active = 1, + .port1_fm_high_sensitivity = 1, }, }; @@ -632,6 +648,8 @@ static struct tuner_params tuner_microtune_4049_fm5_params[] = { .type = TUNER_PARAM_TYPE_PAL, .ranges = tuner_temic_4009f_5_pal_ranges, .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges), + .has_tda9887 = 1, + .port1_invert_for_secam_lc = 1, }, }; @@ -648,6 +666,8 @@ static struct tuner_params tuner_panasonic_vp27_params[] = { .type = TUNER_PARAM_TYPE_NTSC, .ranges = tuner_panasonic_vp27_ntsc_ranges, .count = ARRAY_SIZE(tuner_panasonic_vp27_ntsc_ranges), + .has_tda9887 = 1, + .intercarrier_mode = 1, }, }; @@ -782,6 +802,13 @@ static struct tuner_params tuner_philips_fq1216ame_mk4_params[] = { .type = TUNER_PARAM_TYPE_PAL, .ranges = tuner_philips_fq12_6a___mk4_pal_ranges, .count = ARRAY_SIZE(tuner_philips_fq12_6a___mk4_pal_ranges), + .has_tda9887 = 1, + .port1_active = 1, + .port2_invert_for_secam_lc = 1, + .default_top_mid = -2, + .default_top_secam_low = -2, + .default_top_secam_mid = -2, + .default_top_secam_high = -2, }, }; @@ -870,6 +897,12 @@ static struct tuner_params tuner_philips_fmd1216me_mk3_params[] = { .type = TUNER_PARAM_TYPE_PAL, .ranges = tuner_philips_fmd1216me_mk3_pal_ranges, .count = ARRAY_SIZE(tuner_philips_fmd1216me_mk3_pal_ranges), + .has_tda9887 = 1, + .port1_active = 1, + .port2_active = 1, + .port2_fm_high_sensitivity = 1, + .port2_invert_for_secam_lc = 1, + .port1_set_for_fm_mono = 1, }, }; @@ -1005,6 +1038,7 @@ static struct tuner_params tuner_samsung_tcpn_2121p30a_params[] = { .type = TUNER_PARAM_TYPE_NTSC, .ranges = tuner_samsung_tcpn_2121p30a_ntsc_ranges, .count = ARRAY_SIZE(tuner_samsung_tcpn_2121p30a_ntsc_ranges), + .has_tda9887 = 1, }, }; @@ -1037,6 +1071,10 @@ static struct tuner_params tuner_samsung_tcpg_6121p30a_params[] = { .type = TUNER_PARAM_TYPE_PAL, .ranges = tuner_samsung_tcpg_6121p30a_pal_ranges, .count = ARRAY_SIZE(tuner_samsung_tcpg_6121p30a_pal_ranges), + .has_tda9887 = 1, + .port1_active = 1, + .port2_active = 1, + .port2_invert_for_secam_lc = 1, }, }; diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index c2b75610754..936e3f746fb 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c @@ -14,7 +14,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 30f8d80ddca..d95529e8e51 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -73,14 +73,14 @@ static struct HAUPPAUGE_TUNER_FMT } hauppauge_tuner_fmt[] = { - { V4L2_STD_UNKNOWN," UNKNOWN" }, - { V4L2_STD_UNKNOWN," FM" }, - { V4L2_STD_PAL_BG, " PAL(B/G)" }, - { V4L2_STD_NTSC_M, " NTSC(M)" }, - { V4L2_STD_PAL_I, " PAL(I)" }, - { V4L2_STD_SECAM_L," SECAM(L/L')" }, - { V4L2_STD_PAL_DK, " PAL(D/D1/K)" }, - { V4L2_STD_ATSC, " ATSC/DVB Digital" }, + { V4L2_STD_UNKNOWN, " UNKNOWN" }, + { V4L2_STD_UNKNOWN, " FM" }, + { V4L2_STD_B|V4L2_STD_GH, " PAL(B/G)" }, + { V4L2_STD_MN, " NTSC(M)" }, + { V4L2_STD_PAL_I, " PAL(I)" }, + { V4L2_STD_SECAM_L|V4L2_STD_SECAM_LC, " SECAM(L/L')" }, + { V4L2_STD_DK, " PAL(D/D1/K)" }, + { V4L2_STD_ATSC, " ATSC/DVB Digital" }, }; /* This is the full list of possible tuners. Many thanks to Hauppauge for @@ -219,7 +219,7 @@ hauppauge_tuner[] = { TUNER_ABSENT, "Thompson DTT75105"}, { TUNER_ABSENT, "Conexant_CX24109"}, { TUNER_TCL_2002N, "TCL M2523_5N_E"}, - { TUNER_ABSENT, "TCL M2523_3DB_E"}, + { TUNER_TCL_2002MB, "TCL M2523_3DB_E"}, { TUNER_ABSENT, "Philips 8275A"}, { TUNER_ABSENT, "Microtune MT2060"}, { TUNER_ABSENT, "Philips FM1236 MK5"}, diff --git a/drivers/media/video/usbvideo/usbvideo.h b/drivers/media/video/usbvideo/usbvideo.h index 49dbee5f562..051775d4c72 100644 --- a/drivers/media/video/usbvideo/usbvideo.h +++ b/drivers/media/video/usbvideo/usbvideo.h @@ -16,7 +16,6 @@ #ifndef usbvideo_h #define usbvideo_h -#include <linux/config.h> #include <linux/videodev.h> #include <media/v4l2-common.h> #include <linux/usb.h> diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index 19d3c20dc7e..d83a2c84d23 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c @@ -16,7 +16,6 @@ * */ -#include <linux/config.h> #include <linux/init.h> #include <linux/module.h> diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 97f946db859..f06dc19e504 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c @@ -44,7 +44,6 @@ * Added Gerd Knorrs v4l1 enhancements (Justin Schoeman) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/media/video/videocodec.c b/drivers/media/video/videocodec.c index 8f271de57fd..2ae3fb25063 100644 --- a/drivers/media/video/videocodec.c +++ b/drivers/media/video/videocodec.c @@ -36,7 +36,6 @@ #include <linux/slab.h> // kernel config is here (procfs flag) -#include <linux/config.h> #ifdef CONFIG_PROC_FS #include <linux/proc_fs.h> diff --git a/drivers/media/video/videocodec.h b/drivers/media/video/videocodec.h index 8c233720b6a..97a3bbeda50 100644 --- a/drivers/media/video/videocodec.h +++ b/drivers/media/video/videocodec.h @@ -222,14 +222,14 @@ M zr36055[1] 0001 0000c001 00000000 (zr36050[1]) /* ========================= */ struct vfe_polarity { - int vsync_pol:1; - int hsync_pol:1; - int field_pol:1; - int blank_pol:1; - int subimg_pol:1; - int poe_pol:1; - int pvalid_pol:1; - int vclk_pol:1; + unsigned int vsync_pol:1; + unsigned int hsync_pol:1; + unsigned int field_pol:1; + unsigned int blank_pol:1; + unsigned int subimg_pol:1; + unsigned int poe_pol:1; + unsigned int pvalid_pol:1; + unsigned int vclk_pol:1; }; struct vfe_settings { diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index 2dfa7f23d0c..b26ebaff226 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c @@ -37,7 +37,6 @@ #include <linux/init.h> #include <linux/kmod.h> #include <linux/slab.h> -#include <linux/devfs_fs_kernel.h> #include <asm/uaccess.h> #include <asm/system.h> @@ -1563,10 +1562,6 @@ int video_register_device(struct video_device *vfd, int type, int nr) video_device[i]=vfd; vfd->minor=i; mutex_unlock(&videodev_lock); - - sprintf(vfd->devfs_name, "v4l/%s%d", name_base, i - base); - devfs_mk_cdev(MKDEV(VIDEO_MAJOR, vfd->minor), - S_IFCHR | S_IRUSR | S_IWUSR, vfd->devfs_name); mutex_init(&vfd->lock); /* sysfs class */ @@ -1575,7 +1570,7 @@ int video_register_device(struct video_device *vfd, int type, int nr) vfd->class_dev.dev = vfd->dev; vfd->class_dev.class = &video_class; vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); - strlcpy(vfd->class_dev.class_id, vfd->devfs_name + 4, BUS_ID_SIZE); + sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base); class_device_register(&vfd->class_dev); class_device_create_file(&vfd->class_dev, &class_device_attr_name); @@ -1604,7 +1599,6 @@ void video_unregister_device(struct video_device *vfd) if(video_device[vfd->minor]!=vfd) panic("videodev: bad unregister"); - devfs_remove(vfd->devfs_name); video_device[vfd->minor]=NULL; class_device_unregister(&vfd->class_dev); mutex_unlock(&videodev_lock); diff --git a/drivers/media/video/w9968cf.h b/drivers/media/video/w9968cf.h index 2836b45ec20..ec7696e8f1f 100644 --- a/drivers/media/video/w9968cf.h +++ b/drivers/media/video/w9968cf.h @@ -28,7 +28,6 @@ #include <linux/spinlock.h> #include <linux/list.h> #include <linux/wait.h> -#include <linux/config.h> #include <linux/param.h> #include <linux/types.h> #include <linux/rwsem.h> diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c index 958c1e6fc85..f2249ed2527 100644 --- a/drivers/media/video/zoran_card.c +++ b/drivers/media/video/zoran_card.c @@ -29,7 +29,6 @@ #include <linux/delay.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/module.h> @@ -1381,7 +1380,7 @@ find_zr36057 (void) result = request_irq(zr->pci_dev->irq, zoran_irq, - SA_SHIRQ | SA_INTERRUPT, + IRQF_SHARED | IRQF_DISABLED, ZR_DEVNAME(zr), (void *) zr); if (result < 0) { diff --git a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c index 02168d9c218..3cbac2e8aed 100644 --- a/drivers/media/video/zoran_device.c +++ b/drivers/media/video/zoran_device.c @@ -27,7 +27,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/module.h> diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index 9711f6248ef..d9a5876eb38 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c @@ -44,7 +44,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/version.h> #include <linux/init.h> #include <linux/module.h> diff --git a/drivers/media/video/zoran_procfs.c b/drivers/media/video/zoran_procfs.c index f4ffe79bdc5..c7f6f648836 100644 --- a/drivers/media/video/zoran_procfs.c +++ b/drivers/media/video/zoran_procfs.c @@ -27,7 +27,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/module.h> diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c index 6ac3b674008..50437383ed6 100644 --- a/drivers/media/video/zr36120.c +++ b/drivers/media/video/zr36120.c @@ -1858,7 +1858,7 @@ int __init find_zoran(void) DEBUG(printk(KERN_DEBUG "zoran: mapped-memory at 0x%p\n",ztv->zoran_mem)); result = request_irq(dev->irq, zoran_irq, - SA_SHIRQ|SA_INTERRUPT,"zoran", ztv); + IRQF_SHARED|IRQF_DISABLED,"zoran", ztv); if (result==-EINVAL) { iounmap(ztv->zoran_mem); diff --git a/drivers/media/video/zr36120_mem.c b/drivers/media/video/zr36120_mem.c index c87113d6cc6..416eaa93b8a 100644 --- a/drivers/media/video/zr36120_mem.c +++ b/drivers/media/video/zr36120_mem.c @@ -18,7 +18,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/mm.h> #include <linux/pci.h> #include <linux/slab.h> diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 12dd8d493ee..57543603d6c 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -46,7 +46,6 @@ */ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/errno.h> @@ -1706,7 +1705,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) printk(MYIOC_s_INFO_FMT "PCI-MSI enabled\n", ioc->name); rc = request_irq(ioc->pcidev->irq, mpt_interrupt, - SA_SHIRQ, ioc->name, ioc); + IRQF_SHARED, ioc->name, ioc); if (rc < 0) { printk(MYIOC_s_ERR_FMT "Unable to allocate " "interrupt %d!\n", ioc->name, @@ -5592,7 +5591,7 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag) /* The SCSI driver needs to adjust timeouts on all current * commands prior to the diagnostic reset being issued. - * Prevents timeouts occuring during a diagnostic reset...very bad. + * Prevents timeouts occurring during a diagnostic reset...very bad. * For all other protocol drivers, this is a no-op. */ { diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index 4720f9ae86a..32ae4d66454 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h @@ -49,7 +49,6 @@ #define MPTBASE_H_INCLUDED /*{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/pci.h> diff --git a/drivers/message/i2o/debug.c b/drivers/message/i2o/debug.c index 5a6cca8e8c4..8abe45e49ad 100644 --- a/drivers/message/i2o/debug.c +++ b/drivers/message/i2o/debug.c @@ -1,4 +1,3 @@ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/pci.h> diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index 7d4c5497785..1ddc2fb429d 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c @@ -1089,7 +1089,6 @@ static int i2o_block_probe(struct device *dev) gd = i2o_blk_dev->gd; gd->first_minor = unit << 4; sprintf(gd->disk_name, "i2o/hd%c", 'a' + unit); - sprintf(gd->devfs_name, "i2o/hd%c", 'a' + unit); gd->driverfs_dev = &i2o_dev->device; /* setup request queue */ diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c index c74e5460f83..3305c12372a 100644 --- a/drivers/message/i2o/iop.c +++ b/drivers/message/i2o/iop.c @@ -683,9 +683,10 @@ static int i2o_iop_systab_set(struct i2o_controller *c) c->mem_alloc = 1; sb->current_mem_size = 1 + res->end - res->start; sb->current_mem_base = res->start; - osm_info("%s: allocated %ld bytes of PCI memory at " - "0x%08lX.\n", c->name, - 1 + res->end - res->start, res->start); + osm_info("%s: allocated %llu bytes of PCI memory at " + "0x%016llX.\n", c->name, + (unsigned long long)(1 + res->end - res->start), + (unsigned long long)res->start); } } @@ -704,9 +705,10 @@ static int i2o_iop_systab_set(struct i2o_controller *c) c->io_alloc = 1; sb->current_io_size = 1 + res->end - res->start; sb->current_mem_base = res->start; - osm_info("%s: allocated %ld bytes of PCI I/O at 0x%08lX" - ".\n", c->name, 1 + res->end - res->start, - res->start); + osm_info("%s: allocated %llu bytes of PCI I/O at " + "0x%016llX.\n", c->name, + (unsigned long long)(1 + res->end - res->start), + (unsigned long long)res->start); } } diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c index 4f1515cae5d..1b58444d5aa 100644 --- a/drivers/message/i2o/pci.c +++ b/drivers/message/i2o/pci.c @@ -274,7 +274,7 @@ static int i2o_pci_irq_enable(struct i2o_controller *c) writel(0xffffffff, c->irq_mask); if (pdev->irq) { - rc = request_irq(pdev->irq, i2o_pci_interrupt, SA_SHIRQ, + rc = request_irq(pdev->irq, i2o_pci_interrupt, IRQF_SHARED, c->name, c); if (rc < 0) { printk(KERN_ERR "%s: unable to allocate interrupt %d." diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index c8426a9bf27..632bc218c86 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c @@ -16,7 +16,6 @@ * Note that all locks are private to this file. Nothing else may * touch them. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> @@ -509,7 +508,7 @@ static int ucb1x00_probe(struct mcp *mcp) goto err_free; } - ret = request_irq(ucb->irq, ucb1x00_irq, SA_TRIGGER_RISING, + ret = request_irq(ucb->irq, ucb1x00_irq, IRQF_TRIGGER_RISING, "UCB1x00", ucb); if (ret) { printk(KERN_ERR "ucb1x00: unable to grab irq%d: %d\n", diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c index 79fd062ccb3..02776814443 100644 --- a/drivers/mfd/ucb1x00-ts.c +++ b/drivers/mfd/ucb1x00-ts.c @@ -17,7 +17,6 @@ * pin should provide pulses even when the LCD is blanked, otherwise * a pen touch needed to unblank the LCD will never be read. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> diff --git a/drivers/misc/ibmasm/ibmasm.h b/drivers/misc/ibmasm/ibmasm.h index 6aba4195444..634d538ccd1 100644 --- a/drivers/misc/ibmasm/ibmasm.h +++ b/drivers/misc/ibmasm/ibmasm.h @@ -29,7 +29,6 @@ #include <linux/wait.h> #include <linux/spinlock.h> #include <linux/slab.h> -#include <linux/config.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/device.h> diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c index 9706cc19134..2f3bddfab93 100644 --- a/drivers/misc/ibmasm/module.c +++ b/drivers/misc/ibmasm/module.c @@ -113,7 +113,7 @@ static int __devinit ibmasm_init_one(struct pci_dev *pdev, const struct pci_devi goto error_ioremap; } - result = request_irq(sp->irq, ibmasm_interrupt_handler, SA_SHIRQ, sp->devname, (void*)sp); + result = request_irq(sp->irq, ibmasm_interrupt_handler, IRQF_SHARED, sp->devname, (void*)sp); if (result) { dev_err(sp->dev, "Failed to register interrupt handler\n"); goto error_request_irq; diff --git a/drivers/mmc/at91_mci.c b/drivers/mmc/at91_mci.c index 3228516b7d1..6b7638b8429 100644 --- a/drivers/mmc/at91_mci.c +++ b/drivers/mmc/at91_mci.c @@ -53,7 +53,6 @@ Gets the status of the write protect pin, if available. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> @@ -851,7 +850,7 @@ static int at91_mci_probe(struct platform_device *pdev) /* * Allocate the MCI interrupt */ - ret = request_irq(AT91_ID_MCI, at91_mci_irq, SA_SHIRQ, DRIVER_NAME, host); + ret = request_irq(AT91_ID_MCI, at91_mci_irq, IRQF_SHARED, DRIVER_NAME, host); if (ret) { printk(KERN_ERR "Failed to request MCI interrupt\n"); clk_disable(mci_clk); diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c index 5dc4bee7abe..fb606165af3 100644 --- a/drivers/mmc/au1xmmc.c +++ b/drivers/mmc/au1xmmc.c @@ -34,7 +34,6 @@ * So we use the timer to check the status manually. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/platform_device.h> @@ -887,7 +886,7 @@ static int __devinit au1xmmc_probe(struct platform_device *pdev) int i, ret = 0; /* THe interrupt is shared among all controllers */ - ret = request_irq(AU1100_SD_IRQ, au1xmmc_irq, SA_INTERRUPT, "MMC", 0); + ret = request_irq(AU1100_SD_IRQ, au1xmmc_irq, IRQF_DISABLED, "MMC", 0); if (ret) { printk(DRIVER_NAME "ERROR: Couldn't get int %d: %d\n", diff --git a/drivers/mmc/imxmmc.c b/drivers/mmc/imxmmc.c index 5c62f4e6ad0..7ca9e95bdf8 100644 --- a/drivers/mmc/imxmmc.c +++ b/drivers/mmc/imxmmc.c @@ -25,7 +25,6 @@ * deficiencies * */ -#include <linux/config.h> #ifdef CONFIG_MMC_DEBUG #define DEBUG diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 6201f3086a0..247ff2f23ac 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -9,7 +9,6 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/interrupt.h> diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c index 587458b370b..115cc21094b 100644 --- a/drivers/mmc/mmc_block.c +++ b/drivers/mmc/mmc_block.c @@ -27,7 +27,6 @@ #include <linux/hdreg.h> #include <linux/kdev_t.h> #include <linux/blkdev.h> -#include <linux/devfs_fs_kernel.h> #include <linux/mutex.h> #include <linux/mmc/card.h> @@ -409,7 +408,6 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) */ sprintf(md->disk->disk_name, "mmcblk%d", devidx); - sprintf(md->disk->devfs_name, "mmc/blk%d", devidx); blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits); @@ -555,7 +553,6 @@ static int __init mmc_blk_init(void) if (major == 0) major = res; - devfs_mk_dir("mmc"); return mmc_register_driver(&mmc_driver); out: @@ -565,7 +562,6 @@ static int __init mmc_blk_init(void) static void __exit mmc_blk_exit(void) { mmc_unregister_driver(&mmc_driver); - devfs_remove("mmc"); unregister_blkdev(major, "mmc"); } diff --git a/drivers/mmc/mmci.c b/drivers/mmc/mmci.c index da8e4d7339c..1886562abdd 100644 --- a/drivers/mmc/mmci.c +++ b/drivers/mmc/mmci.c @@ -7,7 +7,6 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> @@ -532,11 +531,11 @@ static int mmci_probe(struct amba_device *dev, void *id) writel(0, host->base + MMCIMASK1); writel(0xfff, host->base + MMCICLEAR); - ret = request_irq(dev->irq[0], mmci_irq, SA_SHIRQ, DRIVER_NAME " (cmd)", host); + ret = request_irq(dev->irq[0], mmci_irq, IRQF_SHARED, DRIVER_NAME " (cmd)", host); if (ret) goto unmap; - ret = request_irq(dev->irq[1], mmci_pio_irq, SA_SHIRQ, DRIVER_NAME " (pio)", host); + ret = request_irq(dev->irq[1], mmci_pio_irq, IRQF_SHARED, DRIVER_NAME " (pio)", host); if (ret) goto irq0_free; @@ -546,9 +545,9 @@ static int mmci_probe(struct amba_device *dev, void *id) mmc_add_host(mmc); - printk(KERN_INFO "%s: MMCI rev %x cfg %02x at 0x%08lx irq %d,%d\n", + printk(KERN_INFO "%s: MMCI rev %x cfg %02x at 0x%016llx irq %d,%d\n", mmc_hostname(mmc), amba_rev(dev), amba_config(dev), - dev->res.start, dev->irq[0], dev->irq[1]); + (unsigned long long)dev->res.start, dev->irq[0], dev->irq[1]); init_timer(&host->timer); host->timer.data = (unsigned long)host; diff --git a/drivers/mmc/omap.c b/drivers/mmc/omap.c index 2b7996da875..ddf06b32c15 100644 --- a/drivers/mmc/omap.c +++ b/drivers/mmc/omap.c @@ -11,7 +11,6 @@ * published by the Free Software Foundation. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> @@ -1083,7 +1082,7 @@ static int __init mmc_omap_probe(struct platform_device *pdev) omap_set_gpio_direction(host->switch_pin, 1); ret = request_irq(OMAP_GPIO_IRQ(host->switch_pin), - mmc_omap_switch_irq, SA_TRIGGER_RISING, DRIVER_NAME, host); + mmc_omap_switch_irq, IRQF_TRIGGER_RISING, DRIVER_NAME, host); if (ret) { dev_warn(mmc_dev(host->mmc), "Unable to get IRQ for MMC cover switch\n"); omap_free_gpio(host->switch_pin); diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c index b49368fd96b..ef350908478 100644 --- a/drivers/mmc/pxamci.c +++ b/drivers/mmc/pxamci.c @@ -16,7 +16,6 @@ * 1 and 3 byte data transfers not supported * max block length up to 1023 */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/ioport.h> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 8e9100bd57e..74134699cce 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -8,12 +8,6 @@ * published by the Free Software Foundation. */ - /* - * Note that PIO transfer is rather crappy atm. The buffer full/empty - * interrupts aren't reliable so we currently transfer the entire buffer - * directly. Patches to solve the problem are welcome. - */ - #include <linux/delay.h> #include <linux/highmem.h> #include <linux/pci.h> @@ -27,13 +21,17 @@ #include "sdhci.h" #define DRIVER_NAME "sdhci" -#define DRIVER_VERSION "0.11" +#define DRIVER_VERSION "0.12" #define BUGMAIL "<sdhci-devel@list.drzeus.cx>" #define DBG(f, x...) \ pr_debug(DRIVER_NAME " [%s()]: " f, __func__,## x) +static unsigned int debug_nodma = 0; +static unsigned int debug_forcedma = 0; +static unsigned int debug_quirks = 0; + static const struct pci_device_id pci_ids[] __devinitdata = { /* handle any SD host controller */ {PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)}, @@ -94,12 +92,27 @@ static void sdhci_dumpregs(struct sdhci_host *host) static void sdhci_reset(struct sdhci_host *host, u8 mask) { + unsigned long timeout; + writeb(mask, host->ioaddr + SDHCI_SOFTWARE_RESET); - if (mask & SDHCI_RESET_ALL) { + if (mask & SDHCI_RESET_ALL) host->clock = 0; - mdelay(50); + /* Wait max 100 ms */ + timeout = 100; + + /* hw clears the bit when it's done */ + while (readb(host->ioaddr + SDHCI_SOFTWARE_RESET) & mask) { + if (timeout == 0) { + printk(KERN_ERR "%s: Reset 0x%x never completed. " + "Please report this to " BUGMAIL ".\n", + mmc_hostname(host->mmc), (int)mask); + sdhci_dumpregs(host); + return; + } + timeout--; + mdelay(1); } } @@ -109,13 +122,15 @@ static void sdhci_init(struct sdhci_host *host) sdhci_reset(host, SDHCI_RESET_ALL); - intmask = ~(SDHCI_INT_CARD_INT | SDHCI_INT_BUF_EMPTY | SDHCI_INT_BUF_FULL); + intmask = SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT | + SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_INDEX | + SDHCI_INT_END_BIT | SDHCI_INT_CRC | SDHCI_INT_TIMEOUT | + SDHCI_INT_CARD_REMOVE | SDHCI_INT_CARD_INSERT | + SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | + SDHCI_INT_DMA_END | SDHCI_INT_DATA_END | SDHCI_INT_RESPONSE; writel(intmask, host->ioaddr + SDHCI_INT_ENABLE); writel(intmask, host->ioaddr + SDHCI_SIGNAL_ENABLE); - - /* This is unknown magic. */ - writeb(0xE, host->ioaddr + SDHCI_TIMEOUT_CONTROL); } static void sdhci_activate_led(struct sdhci_host *host) @@ -172,79 +187,96 @@ static inline int sdhci_next_sg(struct sdhci_host* host) return host->num_sg; } -static void sdhci_transfer_pio(struct sdhci_host *host) +static void sdhci_read_block_pio(struct sdhci_host *host) { + int blksize, chunk_remain; + u32 data; char *buffer; - u32 mask; - int bytes, size; - unsigned long max_jiffies; - - BUG_ON(!host->data); + int size; - if (host->num_sg == 0) - return; + DBG("PIO reading\n"); - bytes = 0; - if (host->data->flags & MMC_DATA_READ) - mask = SDHCI_DATA_AVAILABLE; - else - mask = SDHCI_SPACE_AVAILABLE; + blksize = host->data->blksz; + chunk_remain = 0; + data = 0; buffer = sdhci_kmap_sg(host) + host->offset; - /* Transfer shouldn't take more than 5 s */ - max_jiffies = jiffies + HZ * 5; + while (blksize) { + if (chunk_remain == 0) { + data = readl(host->ioaddr + SDHCI_BUFFER); + chunk_remain = min(blksize, 4); + } - while (host->size > 0) { - if (time_after(jiffies, max_jiffies)) { - printk(KERN_ERR "%s: PIO transfer stalled. " - "Please report this to " - BUGMAIL ".\n", mmc_hostname(host->mmc)); - sdhci_dumpregs(host); + size = min(host->size, host->remain); + size = min(size, chunk_remain); - sdhci_kunmap_sg(host); + chunk_remain -= size; + blksize -= size; + host->offset += size; + host->remain -= size; + host->size -= size; + while (size) { + *buffer = data & 0xFF; + buffer++; + data >>= 8; + size--; + } - host->data->error = MMC_ERR_FAILED; - sdhci_finish_data(host); - return; + if (host->remain == 0) { + sdhci_kunmap_sg(host); + if (sdhci_next_sg(host) == 0) { + BUG_ON(blksize != 0); + return; + } + buffer = sdhci_kmap_sg(host); } + } - if (!(readl(host->ioaddr + SDHCI_PRESENT_STATE) & mask)) - continue; + sdhci_kunmap_sg(host); +} - size = min(host->size, host->remain); +static void sdhci_write_block_pio(struct sdhci_host *host) +{ + int blksize, chunk_remain; + u32 data; + char *buffer; + int bytes, size; - if (size >= 4) { - if (host->data->flags & MMC_DATA_READ) - *(u32*)buffer = readl(host->ioaddr + SDHCI_BUFFER); - else - writel(*(u32*)buffer, host->ioaddr + SDHCI_BUFFER); - size = 4; - } else if (size >= 2) { - if (host->data->flags & MMC_DATA_READ) - *(u16*)buffer = readw(host->ioaddr + SDHCI_BUFFER); - else - writew(*(u16*)buffer, host->ioaddr + SDHCI_BUFFER); - size = 2; - } else { - if (host->data->flags & MMC_DATA_READ) - *(u8*)buffer = readb(host->ioaddr + SDHCI_BUFFER); - else - writeb(*(u8*)buffer, host->ioaddr + SDHCI_BUFFER); - size = 1; - } + DBG("PIO writing\n"); + + blksize = host->data->blksz; + chunk_remain = 4; + data = 0; - buffer += size; + bytes = 0; + buffer = sdhci_kmap_sg(host) + host->offset; + + while (blksize) { + size = min(host->size, host->remain); + size = min(size, chunk_remain); + + chunk_remain -= size; + blksize -= size; host->offset += size; host->remain -= size; - - bytes += size; host->size -= size; + while (size) { + data >>= 8; + data |= (u32)*buffer << 24; + buffer++; + size--; + } + + if (chunk_remain == 0) { + writel(data, host->ioaddr + SDHCI_BUFFER); + chunk_remain = min(blksize, 4); + } if (host->remain == 0) { sdhci_kunmap_sg(host); if (sdhci_next_sg(host) == 0) { - DBG("PIO transfer: %d bytes\n", bytes); + BUG_ON(blksize != 0); return; } buffer = sdhci_kmap_sg(host); @@ -252,38 +284,87 @@ static void sdhci_transfer_pio(struct sdhci_host *host) } sdhci_kunmap_sg(host); +} + +static void sdhci_transfer_pio(struct sdhci_host *host) +{ + u32 mask; + + BUG_ON(!host->data); + + if (host->size == 0) + return; + + if (host->data->flags & MMC_DATA_READ) + mask = SDHCI_DATA_AVAILABLE; + else + mask = SDHCI_SPACE_AVAILABLE; + + while (readl(host->ioaddr + SDHCI_PRESENT_STATE) & mask) { + if (host->data->flags & MMC_DATA_READ) + sdhci_read_block_pio(host); + else + sdhci_write_block_pio(host); - DBG("PIO transfer: %d bytes\n", bytes); + if (host->size == 0) + break; + + BUG_ON(host->num_sg == 0); + } + + DBG("PIO transfer complete.\n"); } static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data) { - u16 mode; + u8 count; + unsigned target_timeout, current_timeout; WARN_ON(host->data); - if (data == NULL) { - writew(0, host->ioaddr + SDHCI_TRANSFER_MODE); + if (data == NULL) return; - } DBG("blksz %04x blks %04x flags %08x\n", data->blksz, data->blocks, data->flags); DBG("tsac %d ms nsac %d clk\n", data->timeout_ns / 1000000, data->timeout_clks); - mode = SDHCI_TRNS_BLK_CNT_EN; - if (data->blocks > 1) - mode |= SDHCI_TRNS_MULTI; - if (data->flags & MMC_DATA_READ) - mode |= SDHCI_TRNS_READ; - if (host->flags & SDHCI_USE_DMA) - mode |= SDHCI_TRNS_DMA; + /* Sanity checks */ + BUG_ON(data->blksz * data->blocks > 524288); + BUG_ON(data->blksz > host->max_block); + BUG_ON(data->blocks > 65535); - writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE); + /* timeout in us */ + target_timeout = data->timeout_ns / 1000 + + data->timeout_clks / host->clock; - writew(data->blksz, host->ioaddr + SDHCI_BLOCK_SIZE); - writew(data->blocks, host->ioaddr + SDHCI_BLOCK_COUNT); + /* + * Figure out needed cycles. + * We do this in steps in order to fit inside a 32 bit int. + * The first step is the minimum timeout, which will have a + * minimum resolution of 6 bits: + * (1) 2^13*1000 > 2^22, + * (2) host->timeout_clk < 2^16 + * => + * (1) / (2) > 2^6 + */ + count = 0; + current_timeout = (1 << 13) * 1000 / host->timeout_clk; + while (current_timeout < target_timeout) { + count++; + current_timeout <<= 1; + if (count >= 0xF) + break; + } + + if (count >= 0xF) { + printk(KERN_WARNING "%s: Too large timeout requested!\n", + mmc_hostname(host->mmc)); + count = 0xE; + } + + writeb(count, host->ioaddr + SDHCI_TIMEOUT_CONTROL); if (host->flags & SDHCI_USE_DMA) { int count; @@ -302,12 +383,37 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data) host->offset = 0; host->remain = host->cur_sg->length; } + + /* We do not handle DMA boundaries, so set it to max (512 KiB) */ + writew(SDHCI_MAKE_BLKSZ(7, data->blksz), + host->ioaddr + SDHCI_BLOCK_SIZE); + writew(data->blocks, host->ioaddr + SDHCI_BLOCK_COUNT); +} + +static void sdhci_set_transfer_mode(struct sdhci_host *host, + struct mmc_data *data) +{ + u16 mode; + + WARN_ON(host->data); + + if (data == NULL) + return; + + mode = SDHCI_TRNS_BLK_CNT_EN; + if (data->blocks > 1) + mode |= SDHCI_TRNS_MULTI; + if (data->flags & MMC_DATA_READ) + mode |= SDHCI_TRNS_READ; + if (host->flags & SDHCI_USE_DMA) + mode |= SDHCI_TRNS_DMA; + + writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE); } static void sdhci_finish_data(struct sdhci_host *host) { struct mmc_data *data; - u32 intmask; u16 blocks; BUG_ON(!host->data); @@ -318,14 +424,6 @@ static void sdhci_finish_data(struct sdhci_host *host) if (host->flags & SDHCI_USE_DMA) { pci_unmap_sg(host->chip->pdev, data->sg, data->sg_len, (data->flags & MMC_DATA_READ)?PCI_DMA_FROMDEVICE:PCI_DMA_TODEVICE); - } else { - intmask = readl(host->ioaddr + SDHCI_SIGNAL_ENABLE); - intmask &= ~(SDHCI_INT_BUF_EMPTY | SDHCI_INT_BUF_FULL); - writel(intmask, host->ioaddr + SDHCI_SIGNAL_ENABLE); - - intmask = readl(host->ioaddr + SDHCI_INT_ENABLE); - intmask &= ~(SDHCI_INT_BUF_EMPTY | SDHCI_INT_BUF_FULL); - writel(intmask, host->ioaddr + SDHCI_INT_ENABLE); } /* @@ -371,27 +469,38 @@ static void sdhci_finish_data(struct sdhci_host *host) static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) { int flags; - u32 present; - unsigned long max_jiffies; + u32 mask; + unsigned long timeout; WARN_ON(host->cmd); DBG("Sending cmd (%x)\n", cmd->opcode); /* Wait max 10 ms */ - max_jiffies = jiffies + (HZ + 99)/100; - do { - if (time_after(jiffies, max_jiffies)) { + timeout = 10; + + mask = SDHCI_CMD_INHIBIT; + if ((cmd->data != NULL) || (cmd->flags & MMC_RSP_BUSY)) + mask |= SDHCI_DATA_INHIBIT; + + /* We shouldn't wait for data inihibit for stop commands, even + though they might use busy signaling */ + if (host->mrq->data && (cmd == host->mrq->data->stop)) + mask &= ~SDHCI_DATA_INHIBIT; + + while (readl(host->ioaddr + SDHCI_PRESENT_STATE) & mask) { + if (timeout == 0) { printk(KERN_ERR "%s: Controller never released " - "inhibit bits. Please report this to " + "inhibit bit(s). Please report this to " BUGMAIL ".\n", mmc_hostname(host->mmc)); sdhci_dumpregs(host); cmd->error = MMC_ERR_FAILED; tasklet_schedule(&host->finish_tasklet); return; } - present = readl(host->ioaddr + SDHCI_PRESENT_STATE); - } while (present & (SDHCI_CMD_INHIBIT | SDHCI_DATA_INHIBIT)); + timeout--; + mdelay(1); + } mod_timer(&host->timer, jiffies + 10 * HZ); @@ -401,6 +510,8 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) writel(cmd->arg, host->ioaddr + SDHCI_ARGUMENT); + sdhci_set_transfer_mode(host, cmd->data); + if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { printk(KERN_ERR "%s: Unsupported response type! " "Please report this to " BUGMAIL ".\n", @@ -456,31 +567,9 @@ static void sdhci_finish_command(struct sdhci_host *host) DBG("Ending cmd (%x)\n", host->cmd->opcode); - if (host->cmd->data) { - u32 intmask; - + if (host->cmd->data) host->data = host->cmd->data; - - if (!(host->flags & SDHCI_USE_DMA)) { - /* - * Don't enable the interrupts until now to make sure we - * get stable handling of the FIFO. - */ - intmask = readl(host->ioaddr + SDHCI_INT_ENABLE); - intmask |= SDHCI_INT_BUF_EMPTY | SDHCI_INT_BUF_FULL; - writel(intmask, host->ioaddr + SDHCI_INT_ENABLE); - - intmask = readl(host->ioaddr + SDHCI_SIGNAL_ENABLE); - intmask |= SDHCI_INT_BUF_EMPTY | SDHCI_INT_BUF_FULL; - writel(intmask, host->ioaddr + SDHCI_SIGNAL_ENABLE); - - /* - * The buffer interrupts are to unreliable so we - * start the transfer immediatly. - */ - sdhci_transfer_pio(host); - } - } else + else tasklet_schedule(&host->finish_tasklet); host->cmd = NULL; @@ -490,7 +579,7 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) { int div; u16 clk; - unsigned long max_jiffies; + unsigned long timeout; if (clock == host->clock) return; @@ -511,17 +600,19 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) writew(clk, host->ioaddr + SDHCI_CLOCK_CONTROL); /* Wait max 10 ms */ - max_jiffies = jiffies + (HZ + 99)/100; - do { - if (time_after(jiffies, max_jiffies)) { + timeout = 10; + while (!((clk = readw(host->ioaddr + SDHCI_CLOCK_CONTROL)) + & SDHCI_CLOCK_INT_STABLE)) { + if (timeout == 0) { printk(KERN_ERR "%s: Internal clock never stabilised. " "Please report this to " BUGMAIL ".\n", mmc_hostname(host->mmc)); sdhci_dumpregs(host); return; } - clk = readw(host->ioaddr + SDHCI_CLOCK_CONTROL); - } while (!(clk & SDHCI_CLOCK_INT_STABLE)); + timeout--; + mdelay(1); + } clk |= SDHCI_CLOCK_CARD_EN; writew(clk, host->ioaddr + SDHCI_CLOCK_CONTROL); @@ -530,6 +621,46 @@ out: host->clock = clock; } +static void sdhci_set_power(struct sdhci_host *host, unsigned short power) +{ + u8 pwr; + + if (host->power == power) + return; + + writeb(0, host->ioaddr + SDHCI_POWER_CONTROL); + + if (power == (unsigned short)-1) + goto out; + + pwr = SDHCI_POWER_ON; + + switch (power) { + case MMC_VDD_170: + case MMC_VDD_180: + case MMC_VDD_190: + pwr |= SDHCI_POWER_180; + break; + case MMC_VDD_290: + case MMC_VDD_300: + case MMC_VDD_310: + pwr |= SDHCI_POWER_300; + break; + case MMC_VDD_320: + case MMC_VDD_330: + case MMC_VDD_340: + pwr |= SDHCI_POWER_330; + break; + default: + BUG(); + } + + writeb(pwr, host->ioaddr + SDHCI_POWER_CONTROL); + +out: + host->power = power; +} + /*****************************************************************************\ * * * MMC callbacks * @@ -576,17 +707,15 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) */ if (ios->power_mode == MMC_POWER_OFF) { writel(0, host->ioaddr + SDHCI_SIGNAL_ENABLE); - spin_unlock_irqrestore(&host->lock, flags); sdhci_init(host); - spin_lock_irqsave(&host->lock, flags); } sdhci_set_clock(host, ios->clock); if (ios->power_mode == MMC_POWER_OFF) - writeb(0, host->ioaddr + SDHCI_POWER_CONTROL); + sdhci_set_power(host, -1); else - writeb(0xFF, host->ioaddr + SDHCI_POWER_CONTROL); + sdhci_set_power(host, ios->vdd); ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL); if (ios->bus_width == MMC_BUS_WIDTH_4) @@ -793,7 +922,7 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) if (host->data->error != MMC_ERR_NONE) sdhci_finish_data(host); else { - if (intmask & (SDHCI_INT_BUF_FULL | SDHCI_INT_BUF_EMPTY)) + if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL)) sdhci_transfer_pio(host); if (intmask & SDHCI_INT_DATA_END) @@ -818,50 +947,44 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id, struct pt_regs *regs) DBG("*** %s got interrupt: 0x%08x\n", host->slot_descr, intmask); - if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) + if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) { + writel(intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE), + host->ioaddr + SDHCI_INT_STATUS); tasklet_schedule(&host->card_tasklet); + } - if (intmask & SDHCI_INT_CMD_MASK) { - sdhci_cmd_irq(host, intmask & SDHCI_INT_CMD_MASK); + intmask &= ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE); + if (intmask & SDHCI_INT_CMD_MASK) { writel(intmask & SDHCI_INT_CMD_MASK, host->ioaddr + SDHCI_INT_STATUS); + sdhci_cmd_irq(host, intmask & SDHCI_INT_CMD_MASK); } if (intmask & SDHCI_INT_DATA_MASK) { - sdhci_data_irq(host, intmask & SDHCI_INT_DATA_MASK); - writel(intmask & SDHCI_INT_DATA_MASK, host->ioaddr + SDHCI_INT_STATUS); + sdhci_data_irq(host, intmask & SDHCI_INT_DATA_MASK); } intmask &= ~(SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK); - if (intmask & SDHCI_INT_CARD_INT) { - printk(KERN_ERR "%s: Unexpected card interrupt. Please " - "report this to " BUGMAIL ".\n", - mmc_hostname(host->mmc)); - sdhci_dumpregs(host); - } - if (intmask & SDHCI_INT_BUS_POWER) { - printk(KERN_ERR "%s: Unexpected bus power interrupt. Please " - "report this to " BUGMAIL ".\n", + printk(KERN_ERR "%s: Card is consuming too much power!\n", mmc_hostname(host->mmc)); - sdhci_dumpregs(host); + writel(SDHCI_INT_BUS_POWER, host->ioaddr + SDHCI_INT_STATUS); } - if (intmask & SDHCI_INT_ACMD12ERR) { - printk(KERN_ERR "%s: Unexpected auto CMD12 error. Please " + intmask &= SDHCI_INT_BUS_POWER; + + if (intmask) { + printk(KERN_ERR "%s: Unexpected interrupt 0x%08x. Please " "report this to " BUGMAIL ".\n", - mmc_hostname(host->mmc)); + mmc_hostname(host->mmc), intmask); sdhci_dumpregs(host); - writew(~0, host->ioaddr + SDHCI_ACMD12_ERR); - } - - if (intmask) writel(intmask, host->ioaddr + SDHCI_INT_STATUS); + } result = IRQ_HANDLED; @@ -954,6 +1077,7 @@ static int sdhci_resume (struct pci_dev *pdev) static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) { int ret; + unsigned int version; struct sdhci_chip *chip; struct mmc_host *mmc; struct sdhci_host *host; @@ -985,6 +1109,16 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) return -ENODEV; } + if ((pdev->class & 0x0000FF) == PCI_SDHCI_IFVENDOR) { + printk(KERN_ERR DRIVER_NAME ": Vendor specific interface. Aborting.\n"); + return -ENODEV; + } + + if ((pdev->class & 0x0000FF) > PCI_SDHCI_IFVENDOR) { + printk(KERN_ERR DRIVER_NAME ": Unknown interface. Aborting.\n"); + return -ENODEV; + } + mmc = mmc_alloc_host(sizeof(struct sdhci_host), &pdev->dev); if (!mmc) return -ENOMEM; @@ -1012,9 +1146,30 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) goto release; } + sdhci_reset(host, SDHCI_RESET_ALL); + + version = readw(host->ioaddr + SDHCI_HOST_VERSION); + version = (version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT; + if (version != 0) { + printk(KERN_ERR "%s: Unknown controller version (%d). " + "Cowardly refusing to continue.\n", host->slot_descr, + version); + ret = -ENODEV; + goto unmap; + } + caps = readl(host->ioaddr + SDHCI_CAPABILITIES); - if ((caps & SDHCI_CAN_DO_DMA) && ((pdev->class & 0x0000FF) == 0x01)) + if (debug_nodma) + DBG("DMA forced off\n"); + else if (debug_forcedma) { + DBG("DMA forced on\n"); + host->flags |= SDHCI_USE_DMA; + } else if ((pdev->class & 0x0000FF) != PCI_SDHCI_IFDMA) + DBG("Controller doesn't have DMA interface\n"); + else if (!(caps & SDHCI_CAN_DO_DMA)) + DBG("Controller doesn't have DMA capability\n"); + else host->flags |= SDHCI_USE_DMA; if (host->flags & SDHCI_USE_DMA) { @@ -1030,18 +1185,59 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) else /* XXX: Hack to get MMC layer to avoid highmem */ pdev->dma_mask = 0; - host->max_clk = (caps & SDHCI_CLOCK_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT; + host->max_clk = + (caps & SDHCI_CLOCK_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT; + if (host->max_clk == 0) { + printk(KERN_ERR "%s: Hardware doesn't specify base clock " + "frequency.\n", host->slot_descr); + ret = -ENODEV; + goto unmap; + } host->max_clk *= 1000000; + host->timeout_clk = + (caps & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT; + if (host->timeout_clk == 0) { + printk(KERN_ERR "%s: Hardware doesn't specify timeout clock " + "frequency.\n", host->slot_descr); + ret = -ENODEV; + goto unmap; + } + if (caps & SDHCI_TIMEOUT_CLK_UNIT) + host->timeout_clk *= 1000; + + host->max_block = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT; + if (host->max_block >= 3) { + printk(KERN_ERR "%s: Invalid maximum block size.\n", + host->slot_descr); + ret = -ENODEV; + goto unmap; + } + host->max_block = 512 << host->max_block; + /* * Set host parameters. */ mmc->ops = &sdhci_ops; mmc->f_min = host->max_clk / 256; mmc->f_max = host->max_clk; - mmc->ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34; mmc->caps = MMC_CAP_4_BIT_DATA; + mmc->ocr_avail = 0; + if (caps & SDHCI_CAN_VDD_330) + mmc->ocr_avail |= MMC_VDD_32_33|MMC_VDD_33_34; + else if (caps & SDHCI_CAN_VDD_300) + mmc->ocr_avail |= MMC_VDD_29_30|MMC_VDD_30_31; + else if (caps & SDHCI_CAN_VDD_180) + mmc->ocr_avail |= MMC_VDD_17_18|MMC_VDD_18_19; + + if (mmc->ocr_avail == 0) { + printk(KERN_ERR "%s: Hardware doesn't report any " + "support voltages.\n", host->slot_descr); + ret = -ENODEV; + goto unmap; + } + spin_lock_init(&host->lock); /* @@ -1054,10 +1250,10 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) mmc->max_phys_segs = 16; /* - * Maximum number of sectors in one transfer. Limited by sector - * count register. + * Maximum number of sectors in one transfer. Limited by DMA boundary + * size (512KiB), which means (512 KiB/512=) 1024 entries. */ - mmc->max_sectors = 0x3FFF; + mmc->max_sectors = 1024; /* * Maximum segment size. Could be one segment with the maximum number @@ -1075,10 +1271,10 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) setup_timer(&host->timer, sdhci_timeout_timer, (long)host); - ret = request_irq(host->irq, sdhci_irq, SA_SHIRQ, + ret = request_irq(host->irq, sdhci_irq, IRQF_SHARED, host->slot_descr, host); if (ret) - goto unmap; + goto untasklet; sdhci_init(host); @@ -1097,10 +1293,10 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) return 0; -unmap: +untasklet: tasklet_kill(&host->card_tasklet); tasklet_kill(&host->finish_tasklet); - +unmap: iounmap(host->ioaddr); release: pci_release_region(pdev, host->bar); @@ -1144,13 +1340,18 @@ static int __devinit sdhci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { int ret, i; - u8 slots; + u8 slots, rev; struct sdhci_chip *chip; BUG_ON(pdev == NULL); BUG_ON(ent == NULL); - DBG("found at %s\n", pci_name(pdev)); + pci_read_config_byte(pdev, PCI_CLASS_REVISION, &rev); + + printk(KERN_INFO DRIVER_NAME + ": SDHCI controller found at %s [%04x:%04x] (rev %x)\n", + pci_name(pdev), (int)pdev->vendor, (int)pdev->device, + (int)rev); ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &slots); if (ret) @@ -1173,6 +1374,10 @@ static int __devinit sdhci_probe(struct pci_dev *pdev, } chip->pdev = pdev; + chip->quirks = ent->driver_data; + + if (debug_quirks) + chip->quirks = debug_quirks; chip->num_slots = slots; pci_set_drvdata(pdev, chip); @@ -1251,7 +1456,15 @@ static void __exit sdhci_drv_exit(void) module_init(sdhci_drv_init); module_exit(sdhci_drv_exit); +module_param(debug_nodma, uint, 0444); +module_param(debug_forcedma, uint, 0444); +module_param(debug_quirks, uint, 0444); + MODULE_AUTHOR("Pierre Ossman <drzeus@drzeus.cx>"); MODULE_DESCRIPTION("Secure Digital Host Controller Interface driver"); MODULE_VERSION(DRIVER_VERSION); MODULE_LICENSE("GPL"); + +MODULE_PARM_DESC(debug_nodma, "Forcefully disable DMA transfers. (default 0)"); +MODULE_PARM_DESC(debug_forcedma, "Forcefully enable DMA transfers. (default 0)"); +MODULE_PARM_DESC(debug_quirks, "Force certain quirks."); diff --git a/drivers/mmc/sdhci.h b/drivers/mmc/sdhci.h index 3b270ef486b..f2453343f78 100644 --- a/drivers/mmc/sdhci.h +++ b/drivers/mmc/sdhci.h @@ -12,6 +12,10 @@ * PCI registers */ +#define PCI_SDHCI_IFPIO 0x00 +#define PCI_SDHCI_IFDMA 0x01 +#define PCI_SDHCI_IFVENDOR 0x02 + #define PCI_SLOT_INFO 0x40 /* 8 bits */ #define PCI_SLOT_INFO_SLOTS(x) ((x >> 4) & 7) #define PCI_SLOT_INFO_FIRST_BAR_MASK 0x07 @@ -23,6 +27,7 @@ #define SDHCI_DMA_ADDRESS 0x00 #define SDHCI_BLOCK_SIZE 0x04 +#define SDHCI_MAKE_BLKSZ(dma, blksz) (((dma & 0x7) << 12) | (blksz & 0xFFF)) #define SDHCI_BLOCK_COUNT 0x06 @@ -67,6 +72,10 @@ #define SDHCI_CTRL_4BITBUS 0x02 #define SDHCI_POWER_CONTROL 0x29 +#define SDHCI_POWER_ON 0x01 +#define SDHCI_POWER_180 0x0A +#define SDHCI_POWER_300 0x0C +#define SDHCI_POWER_330 0x0E #define SDHCI_BLOCK_GAP_CONTROL 0x2A @@ -91,8 +100,8 @@ #define SDHCI_INT_RESPONSE 0x00000001 #define SDHCI_INT_DATA_END 0x00000002 #define SDHCI_INT_DMA_END 0x00000008 -#define SDHCI_INT_BUF_EMPTY 0x00000010 -#define SDHCI_INT_BUF_FULL 0x00000020 +#define SDHCI_INT_SPACE_AVAIL 0x00000010 +#define SDHCI_INT_DATA_AVAIL 0x00000020 #define SDHCI_INT_CARD_INSERT 0x00000040 #define SDHCI_INT_CARD_REMOVE 0x00000080 #define SDHCI_INT_CARD_INT 0x00000100 @@ -112,7 +121,7 @@ #define SDHCI_INT_CMD_MASK (SDHCI_INT_RESPONSE | SDHCI_INT_TIMEOUT | \ SDHCI_INT_CRC | SDHCI_INT_END_BIT | SDHCI_INT_INDEX) #define SDHCI_INT_DATA_MASK (SDHCI_INT_DATA_END | SDHCI_INT_DMA_END | \ - SDHCI_INT_BUF_EMPTY | SDHCI_INT_BUF_FULL | \ + SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | \ SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_DATA_CRC | \ SDHCI_INT_DATA_END_BIT) @@ -121,9 +130,17 @@ /* 3E-3F reserved */ #define SDHCI_CAPABILITIES 0x40 -#define SDHCI_CAN_DO_DMA 0x00400000 +#define SDHCI_TIMEOUT_CLK_MASK 0x0000003F +#define SDHCI_TIMEOUT_CLK_SHIFT 0 +#define SDHCI_TIMEOUT_CLK_UNIT 0x00000080 #define SDHCI_CLOCK_BASE_MASK 0x00003F00 #define SDHCI_CLOCK_BASE_SHIFT 8 +#define SDHCI_MAX_BLOCK_MASK 0x00030000 +#define SDHCI_MAX_BLOCK_SHIFT 16 +#define SDHCI_CAN_DO_DMA 0x00400000 +#define SDHCI_CAN_VDD_330 0x01000000 +#define SDHCI_CAN_VDD_300 0x02000000 +#define SDHCI_CAN_VDD_180 0x04000000 /* 44-47 reserved for more caps */ @@ -136,6 +153,10 @@ #define SDHCI_SLOT_INT_STATUS 0xFC #define SDHCI_HOST_VERSION 0xFE +#define SDHCI_VENDOR_VER_MASK 0xFF00 +#define SDHCI_VENDOR_VER_SHIFT 8 +#define SDHCI_SPEC_VER_MASK 0x00FF +#define SDHCI_SPEC_VER_SHIFT 0 struct sdhci_chip; @@ -149,8 +170,11 @@ struct sdhci_host { #define SDHCI_USE_DMA (1<<0) unsigned int max_clk; /* Max possible freq (MHz) */ + unsigned int timeout_clk; /* Timeout freq (KHz) */ + unsigned int max_block; /* Max block size (bytes) */ unsigned int clock; /* Current clock (MHz) */ + unsigned short power; /* Current voltage */ struct mmc_request *mrq; /* Current request */ struct mmc_command *cmd; /* Current command */ @@ -180,6 +204,8 @@ struct sdhci_host { struct sdhci_chip { struct pci_dev *pdev; + unsigned long quirks; + int num_slots; /* Slots on controller */ struct sdhci_host *hosts[0]; /* Pointers to hosts */ }; diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c index 8167332d401..8a30ef3ae41 100644 --- a/drivers/mmc/wbsd.c +++ b/drivers/mmc/wbsd.c @@ -21,7 +21,6 @@ * - On APIC systems the FIFO empty interrupt is sometimes lost. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> @@ -1554,7 +1553,7 @@ static int __devinit wbsd_request_irq(struct wbsd_host *host, int irq) * Allocate interrupt. */ - ret = request_irq(irq, wbsd_irq, SA_SHIRQ, DRIVER_NAME, host); + ret = request_irq(irq, wbsd_irq, IRQF_SHARED, DRIVER_NAME, host); if (ret) return ret; diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 1e01ad38b26..9885726a16e 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -21,7 +21,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c index 4bf9f8cac0d..60e11a0ada9 100644 --- a/drivers/mtd/chips/cfi_probe.c +++ b/drivers/mtd/chips/cfi_probe.c @@ -4,7 +4,6 @@ $Id: cfi_probe.c,v 1.86 2005/11/29 14:48:31 gleixner Exp $ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/mtd/chips/chipreg.c b/drivers/mtd/chips/chipreg.c index c2127840a18..2174c97549f 100644 --- a/drivers/mtd/chips/chipreg.c +++ b/drivers/mtd/chips/chipreg.c @@ -6,7 +6,6 @@ */ #include <linux/kernel.h> -#include <linux/config.h> #include <linux/module.h> #include <linux/kmod.h> #include <linux/spinlock.h> diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c index 517ea33e726..8f39d0a3143 100644 --- a/drivers/mtd/chips/jedec_probe.c +++ b/drivers/mtd/chips/jedec_probe.c @@ -8,7 +8,6 @@ Occasionally maintained by Thayne Harbaugh tharbaugh at lnxi dot com */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/types.h> diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index be3f1c136d0..ede3561be87 100644 --- a/drivers/mtd/devices/block2mtd.c +++ b/drivers/mtd/devices/block2mtd.c @@ -8,7 +8,6 @@ * * Licence: GPL */ -#include <linux/config.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/blkdev.h> diff --git a/drivers/mtd/devices/docprobe.c b/drivers/mtd/devices/docprobe.c index 593bb033a3f..78872c3f376 100644 --- a/drivers/mtd/devices/docprobe.c +++ b/drivers/mtd/devices/docprobe.c @@ -40,7 +40,6 @@ */ #define DOC_SINGLE_DRIVER -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <asm/errno.h> diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c index 04271d02b6b..5db71604592 100644 --- a/drivers/mtd/devices/mtd_dataflash.c +++ b/drivers/mtd/devices/mtd_dataflash.c @@ -9,7 +9,6 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c index b4438eacfd8..e427c82d5f4 100644 --- a/drivers/mtd/devices/mtdram.c +++ b/drivers/mtd/devices/mtdram.c @@ -10,7 +10,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/ioport.h> diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c index f620d74f100..6f9bbf6fee4 100644 --- a/drivers/mtd/devices/pmc551.c +++ b/drivers/mtd/devices/pmc551.c @@ -82,7 +82,6 @@ * * Comb the init routine. It's still a bit cludgy on a few things. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <asm/uaccess.h> @@ -551,11 +550,11 @@ static u32 fixup_pmc551 (struct pci_dev *dev) /* * Some screen fun */ - printk(KERN_DEBUG "pmc551: %d%c (0x%x) of %sprefetchable memory at 0x%lx\n", + printk(KERN_DEBUG "pmc551: %d%c (0x%x) of %sprefetchable memory at 0x%llx\n", (size<1024)?size:(size<1048576)?size>>10:size>>20, (size<1024)?'B':(size<1048576)?'K':'M', size, ((dcmd&(0x1<<3)) == 0)?"non-":"", - (dev->resource[0].start)&PCI_BASE_ADDRESS_MEM_MASK ); + (unsigned long long)((dev->resource[0].start)&PCI_BASE_ADDRESS_MEM_MASK)); /* * Check to see the state of the memory @@ -685,8 +684,8 @@ static int __init init_pmc551(void) break; } - printk(KERN_NOTICE "pmc551: Found PCI V370PDC at 0x%lX\n", - PCI_Device->resource[0].start); + printk(KERN_NOTICE "pmc551: Found PCI V370PDC at 0x%llx\n", + (unsigned long long)PCI_Device->resource[0].start); /* * The PMC551 device acts VERY weird if you don't init it diff --git a/drivers/mtd/inftlcore.c b/drivers/mtd/inftlcore.c index 1e21a2c3dd2..4116535805f 100644 --- a/drivers/mtd/inftlcore.c +++ b/drivers/mtd/inftlcore.c @@ -24,7 +24,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/delay.h> diff --git a/drivers/mtd/maps/alchemy-flash.c b/drivers/mtd/maps/alchemy-flash.c index b933a2a27b1..7fc8097e41d 100644 --- a/drivers/mtd/maps/alchemy-flash.c +++ b/drivers/mtd/maps/alchemy-flash.c @@ -7,7 +7,6 @@ * */ -#include <linux/config.h> #include <linux/init.h> #include <linux/module.h> #include <linux/types.h> diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c index c350878d459..447955be18a 100644 --- a/drivers/mtd/maps/amd76xrom.c +++ b/drivers/mtd/maps/amd76xrom.c @@ -14,7 +14,6 @@ #include <linux/mtd/map.h> #include <linux/mtd/cfi.h> #include <linux/mtd/flashchip.h> -#include <linux/config.h> #include <linux/pci.h> #include <linux/pci_ids.h> #include <linux/list.h> @@ -123,9 +122,10 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev, window->rsrc.parent = NULL; printk(KERN_ERR MOD_NAME " %s(): Unable to register resource" - " 0x%.08lx-0x%.08lx - kernel bug?\n", + " 0x%.16llx-0x%.16llx - kernel bug?\n", __func__, - window->rsrc.start, window->rsrc.end); + (unsigned long long)window->rsrc.start, + (unsigned long long)window->rsrc.end); } #if 0 diff --git a/drivers/mtd/maps/ceiva.c b/drivers/mtd/maps/ceiva.c index 5a95ab370a9..0402c21e291 100644 --- a/drivers/mtd/maps/ceiva.c +++ b/drivers/mtd/maps/ceiva.c @@ -14,7 +14,6 @@ * $Id: ceiva.c,v 1.11 2004/09/16 23:27:12 gleixner Exp $ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/ioport.h> diff --git a/drivers/mtd/maps/cstm_mips_ixx.c b/drivers/mtd/maps/cstm_mips_ixx.c index a370953c151..aa56defb94c 100644 --- a/drivers/mtd/maps/cstm_mips_ixx.c +++ b/drivers/mtd/maps/cstm_mips_ixx.c @@ -38,7 +38,6 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> -#include <linux/config.h> #include <linux/delay.h> #if defined(CONFIG_MIPS_ITE8172) || defined(CONFIG_MIPS_IVR) diff --git a/drivers/mtd/maps/dbox2-flash.c b/drivers/mtd/maps/dbox2-flash.c index 85c2a9e22b1..92a9c7fac99 100644 --- a/drivers/mtd/maps/dbox2-flash.c +++ b/drivers/mtd/maps/dbox2-flash.c @@ -12,7 +12,6 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> -#include <linux/config.h> #include <linux/errno.h> /* partition_info gives details on the logical partitions that the split the diff --git a/drivers/mtd/maps/dc21285.c b/drivers/mtd/maps/dc21285.c index 8b3784e2de8..b32bb9347d7 100644 --- a/drivers/mtd/maps/dc21285.c +++ b/drivers/mtd/maps/dc21285.c @@ -7,7 +7,6 @@ * * $Id: dc21285.c,v 1.24 2005/11/07 11:14:26 gleixner Exp $ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/mtd/maps/dilnetpc.c b/drivers/mtd/maps/dilnetpc.c index c299d10b33e..b1104fe1f20 100644 --- a/drivers/mtd/maps/dilnetpc.c +++ b/drivers/mtd/maps/dilnetpc.c @@ -25,7 +25,6 @@ * and http://www.ssv-embedded.de/ssv/pc104/p170.htm */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/mtd/maps/dmv182.c b/drivers/mtd/maps/dmv182.c index 2bb3c0f0f97..a43c49905ca 100644 --- a/drivers/mtd/maps/dmv182.c +++ b/drivers/mtd/maps/dmv182.c @@ -16,7 +16,6 @@ * option) any later version. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/types.h> diff --git a/drivers/mtd/maps/ebony.c b/drivers/mtd/maps/ebony.c index 60a6e51d662..641e1dd8479 100644 --- a/drivers/mtd/maps/ebony.c +++ b/drivers/mtd/maps/ebony.c @@ -20,7 +20,6 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> -#include <linux/config.h> #include <asm/io.h> #include <asm/ibm44x.h> #include <platforms/4xx/ebony.h> diff --git a/drivers/mtd/maps/edb7312.c b/drivers/mtd/maps/edb7312.c index b48a3473ffc..1c5b97c8968 100644 --- a/drivers/mtd/maps/edb7312.c +++ b/drivers/mtd/maps/edb7312.c @@ -17,7 +17,6 @@ #include <asm/io.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> -#include <linux/config.h> #ifdef CONFIG_MTD_PARTITIONS #include <linux/mtd/partitions.h> diff --git a/drivers/mtd/maps/h720x-flash.c b/drivers/mtd/maps/h720x-flash.c index 0667101ccbe..6dde3182d64 100644 --- a/drivers/mtd/maps/h720x-flash.c +++ b/drivers/mtd/maps/h720x-flash.c @@ -8,7 +8,6 @@ * 2003 Thomas Gleixner <tglx@linutronix.de> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/mtd/maps/ichxrom.c b/drivers/mtd/maps/ichxrom.c index ea5073781b3..db4b570d874 100644 --- a/drivers/mtd/maps/ichxrom.c +++ b/drivers/mtd/maps/ichxrom.c @@ -14,7 +14,6 @@ #include <linux/mtd/map.h> #include <linux/mtd/cfi.h> #include <linux/mtd/flashchip.h> -#include <linux/config.h> #include <linux/pci.h> #include <linux/pci_ids.h> #include <linux/list.h> @@ -177,9 +176,10 @@ static int __devinit ichxrom_init_one (struct pci_dev *pdev, window->rsrc.parent = NULL; printk(KERN_DEBUG MOD_NAME ": %s(): Unable to register resource" - " 0x%.08lx-0x%.08lx - kernel bug?\n", + " 0x%.16llx-0x%.16llx - kernel bug?\n", __func__, - window->rsrc.start, window->rsrc.end); + (unsigned long long)window->rsrc.start, + (unsigned long long)window->rsrc.end); } /* Map the firmware hub into my address space. */ diff --git a/drivers/mtd/maps/impa7.c b/drivers/mtd/maps/impa7.c index ba7f40311a7..a0b4dc7155d 100644 --- a/drivers/mtd/maps/impa7.c +++ b/drivers/mtd/maps/impa7.c @@ -17,7 +17,6 @@ #include <asm/io.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> -#include <linux/config.h> #ifdef CONFIG_MTD_PARTITIONS #include <linux/mtd/partitions.h> diff --git a/drivers/mtd/maps/integrator-flash.c b/drivers/mtd/maps/integrator-flash.c index a3ba52fbd86..c8db01b3e45 100644 --- a/drivers/mtd/maps/integrator-flash.c +++ b/drivers/mtd/maps/integrator-flash.c @@ -26,7 +26,6 @@ ======================================================================*/ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/mtd/maps/ipaq-flash.c b/drivers/mtd/maps/ipaq-flash.c index b8ccb0a9578..f27c132794c 100644 --- a/drivers/mtd/maps/ipaq-flash.c +++ b/drivers/mtd/maps/ipaq-flash.c @@ -8,7 +8,6 @@ * $Id: ipaq-flash.c,v 1.5 2005/11/07 11:14:27 gleixner Exp $ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/mtd/maps/l440gx.c b/drivers/mtd/maps/l440gx.c index 851bf957605..6b784ef5ee7 100644 --- a/drivers/mtd/maps/l440gx.c +++ b/drivers/mtd/maps/l440gx.c @@ -13,7 +13,6 @@ #include <asm/io.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> -#include <linux/config.h> #define PIIXE_IOBASE_RESOURCE 11 diff --git a/drivers/mtd/maps/lasat.c b/drivers/mtd/maps/lasat.c index c658d4045ef..1c13d2dc0cd 100644 --- a/drivers/mtd/maps/lasat.c +++ b/drivers/mtd/maps/lasat.c @@ -19,7 +19,6 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> -#include <linux/config.h> #include <asm/lasat/lasat.h> static struct mtd_info *lasat_mtd; diff --git a/drivers/mtd/maps/mpc1211.c b/drivers/mtd/maps/mpc1211.c index 4685e8e1346..45a00fac88a 100644 --- a/drivers/mtd/maps/mpc1211.c +++ b/drivers/mtd/maps/mpc1211.c @@ -15,7 +15,6 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> -#include <linux/config.h> static struct mtd_info *flash_mtd; static struct mtd_partition *parsed_parts; diff --git a/drivers/mtd/maps/mtx-1_flash.c b/drivers/mtd/maps/mtx-1_flash.c index 5c25d4e552c..d884f2be28f 100644 --- a/drivers/mtd/maps/mtx-1_flash.c +++ b/drivers/mtd/maps/mtx-1_flash.c @@ -8,7 +8,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/init.h> diff --git a/drivers/mtd/maps/ocotea.c b/drivers/mtd/maps/ocotea.c index a21fcd195ab..2f07602ba94 100644 --- a/drivers/mtd/maps/ocotea.c +++ b/drivers/mtd/maps/ocotea.c @@ -18,7 +18,6 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> -#include <linux/config.h> #include <asm/io.h> #include <asm/ibm44x.h> #include <platforms/4xx/ocotea.h> diff --git a/drivers/mtd/maps/omap-toto-flash.c b/drivers/mtd/maps/omap-toto-flash.c index dc376527005..e6e391efbeb 100644 --- a/drivers/mtd/maps/omap-toto-flash.c +++ b/drivers/mtd/maps/omap-toto-flash.c @@ -8,7 +8,6 @@ * $Id: omap-toto-flash.c,v 1.5 2005/11/07 11:14:27 gleixner Exp $ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index d6301f08906..7799a25a7f2 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c @@ -18,7 +18,6 @@ #include <linux/platform_device.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> -#include <linux/config.h> #include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h> #include <asm/io.h> diff --git a/drivers/mtd/maps/redwood.c b/drivers/mtd/maps/redwood.c index 50b14033613..ec8fdae1dd9 100644 --- a/drivers/mtd/maps/redwood.c +++ b/drivers/mtd/maps/redwood.c @@ -13,7 +13,6 @@ * or implied. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index 5cefb015633..950bf1c5784 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c @@ -5,7 +5,6 @@ * * $Id: sa1100-flash.c,v 1.51 2005/11/07 11:14:28 gleixner Exp $ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/ioport.h> diff --git a/drivers/mtd/maps/sbc8240.c b/drivers/mtd/maps/sbc8240.c index 350286dc1d2..7d0fcf8f4f3 100644 --- a/drivers/mtd/maps/sbc8240.c +++ b/drivers/mtd/maps/sbc8240.c @@ -18,7 +18,6 @@ * Both parts are JEDEC compatible. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/mtd/maps/sc520cdp.c b/drivers/mtd/maps/sc520cdp.c index e8c130e1efd..9b50cfc355b 100644 --- a/drivers/mtd/maps/sc520cdp.c +++ b/drivers/mtd/maps/sc520cdp.c @@ -25,7 +25,6 @@ * For details see http://www.amd.com/products/epd/desiging/evalboards/18.elansc520/520_cdp_brief/index.html */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/mtd/maps/scb2_flash.c b/drivers/mtd/maps/scb2_flash.c index 97a8dfd6925..dcfb85840d1 100644 --- a/drivers/mtd/maps/scb2_flash.c +++ b/drivers/mtd/maps/scb2_flash.c @@ -53,7 +53,6 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/cfi.h> -#include <linux/config.h> #include <linux/pci.h> #include <linux/pci_ids.h> diff --git a/drivers/mtd/maps/scx200_docflash.c b/drivers/mtd/maps/scx200_docflash.c index 28b8a571a91..7391fd544e8 100644 --- a/drivers/mtd/maps/scx200_docflash.c +++ b/drivers/mtd/maps/scx200_docflash.c @@ -8,7 +8,6 @@ */ #include <linux/module.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> @@ -164,8 +163,9 @@ static int __init init_scx200_docflash(void) outl(pmr, scx200_cb_base + SCx200_PMR); } - printk(KERN_INFO NAME ": DOCCS mapped at 0x%lx-0x%lx, width %d\n", - docmem.start, docmem.end, width); + printk(KERN_INFO NAME ": DOCCS mapped at 0x%llx-0x%llx, width %d\n", + (unsigned long long)docmem.start, + (unsigned long long)docmem.end, width); scx200_docflash_map.size = size; if (width == 8) diff --git a/drivers/mtd/maps/solutionengine.c b/drivers/mtd/maps/solutionengine.c index c53c2c369c9..d76ceef453c 100644 --- a/drivers/mtd/maps/solutionengine.c +++ b/drivers/mtd/maps/solutionengine.c @@ -16,7 +16,6 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> -#include <linux/config.h> #include <linux/errno.h> static struct mtd_info *flash_mtd; diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c index 24a03152d19..4db2055cee3 100644 --- a/drivers/mtd/maps/sun_uflash.c +++ b/drivers/mtd/maps/sun_uflash.c @@ -62,9 +62,10 @@ int uflash_devinit(struct linux_ebus_device *edev, struct device_node *dp) /* Non-CFI userflash device-- once I find one we * can work on supporting it. */ - printk("%s: unsupported device at 0x%lx (%d regs): " \ + printk("%s: unsupported device at 0x%llx (%d regs): " \ "email ebrower@usa.net\n", - dp->full_name, res->start, edev->num_addrs); + dp->full_name, (unsigned long long)res->start, + edev->num_addrs); return -ENODEV; } diff --git a/drivers/mtd/maps/tqm834x.c b/drivers/mtd/maps/tqm834x.c index c7ae9a515c1..58e5912bd38 100644 --- a/drivers/mtd/maps/tqm834x.c +++ b/drivers/mtd/maps/tqm834x.c @@ -11,7 +11,6 @@ * */ -#include <linux/config.h> #include <linux/init.h> #include <linux/module.h> #include <linux/types.h> diff --git a/drivers/mtd/maps/tqm8xxl.c b/drivers/mtd/maps/tqm8xxl.c index a43517053e7..19578ba84ee 100644 --- a/drivers/mtd/maps/tqm8xxl.c +++ b/drivers/mtd/maps/tqm8xxl.c @@ -22,7 +22,6 @@ * Thus, we choose CONFIG_MTD_CFI_I2 & CONFIG_MTD_CFI_B4 at * kernel configuration. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/mtd/maps/ts5500_flash.c b/drivers/mtd/maps/ts5500_flash.c index a7422c20056..b47270e850b 100644 --- a/drivers/mtd/maps/ts5500_flash.c +++ b/drivers/mtd/maps/ts5500_flash.c @@ -26,7 +26,6 @@ * $Id: ts5500_flash.c,v 1.5 2005/11/07 11:14:28 gleixner Exp $ */ -#include <linux/config.h> #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c index f7264dc2ac9..389fea28b9a 100644 --- a/drivers/mtd/maps/uclinux.c +++ b/drivers/mtd/maps/uclinux.c @@ -10,7 +10,6 @@ /****************************************************************************/ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/init.h> diff --git a/drivers/mtd/maps/walnut.c b/drivers/mtd/maps/walnut.c index f46bec66150..ec80eec376b 100644 --- a/drivers/mtd/maps/walnut.c +++ b/drivers/mtd/maps/walnut.c @@ -20,7 +20,6 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> -#include <linux/config.h> #include <asm/io.h> #include <asm/ibm4xx.h> #include <platforms/4xx/walnut.h> diff --git a/drivers/mtd/maps/wr_sbc82xx_flash.c b/drivers/mtd/maps/wr_sbc82xx_flash.c index 60c197ec455..ac5b8105b6e 100644 --- a/drivers/mtd/maps/wr_sbc82xx_flash.c +++ b/drivers/mtd/maps/wr_sbc82xx_flash.c @@ -17,7 +17,6 @@ #include <asm/io.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> -#include <linux/config.h> #include <linux/mtd/partitions.h> #include <asm/immap_cpm2.h> diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c index e5c78463ebf..04ed34694b1 100644 --- a/drivers/mtd/mtdblock.c +++ b/drivers/mtd/mtdblock.c @@ -7,7 +7,6 @@ * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> */ -#include <linux/config.h> #include <linux/fs.h> #include <linux/init.h> #include <linux/kernel.h> diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 9a4b59d9252..fb8b4f7e48d 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -5,7 +5,6 @@ * */ -#include <linux/config.h> #include <linux/device.h> #include <linux/fs.h> #include <linux/init.h> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 16a952dd486..168d3ba063c 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -6,7 +6,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 77a7123a5c5..06a930372b7 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -16,7 +16,6 @@ #include <linux/kernel.h> #include <linux/slab.h> #include <linux/list.h> -#include <linux/config.h> #include <linux/kmod.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index ebd64abc8be..545ff252d81 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c @@ -25,7 +25,6 @@ * $Id: nandsim.c,v 1.8 2005/03/19 15:33:56 dedekind Exp $ */ -#include <linux/config.h> #include <linux/init.h> #include <linux/types.h> #include <linux/module.h> diff --git a/drivers/mtd/nftlcore.c b/drivers/mtd/nftlcore.c index dc7573501d8..dd5cea8b4a7 100644 --- a/drivers/mtd/nftlcore.c +++ b/drivers/mtd/nftlcore.c @@ -11,7 +11,6 @@ #define PRERELEASE -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <asm/errno.h> diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c index dc845f36fe4..cbdae54f715 100644 --- a/drivers/net/3c509.c +++ b/drivers/net/3c509.c @@ -68,7 +68,6 @@ /* Maximum events (Rx packets, etc.) to handle at each interrupt. */ static int max_interrupt_work = 10; -#include <linux/config.h> #include <linux/module.h> #ifdef CONFIG_MCA #include <linux/mca.h> diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c index 91d1c4c24d9..4532b17e40e 100644 --- a/drivers/net/3c515.c +++ b/drivers/net/3c515.c @@ -57,7 +57,6 @@ static int max_interrupt_work = 20; #define RX_RING_SIZE 16 #define PKT_BUF_SZ 1536 /* Size of each temporary Rx buffer. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/isapnp.h> #include <linux/kernel.h> @@ -761,7 +760,7 @@ static int corkscrew_open(struct net_device *dev) vp->product_name, dev)) return -EAGAIN; enable_dma(dev->dma); set_dma_mode(dev->dma, DMA_MODE_CASCADE); - } else if (request_irq(dev->irq, &corkscrew_interrupt, SA_SHIRQ, + } else if (request_irq(dev->irq, &corkscrew_interrupt, IRQF_SHARED, vp->product_name, dev)) { return -EAGAIN; } diff --git a/drivers/net/3c523.c b/drivers/net/3c523.c index 4bf8510655c..5dfd97f0ba9 100644 --- a/drivers/net/3c523.c +++ b/drivers/net/3c523.c @@ -289,7 +289,7 @@ static int elmc_open(struct net_device *dev) elmc_id_attn586(); /* disable interrupts */ - ret = request_irq(dev->irq, &elmc_interrupt, SA_SHIRQ | SA_SAMPLE_RANDOM, + ret = request_irq(dev->irq, &elmc_interrupt, IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev); if (ret) { printk(KERN_ERR "%s: couldn't get irq %d\n", dev->name, dev->irq); diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c index 157eda57392..03c0f7176fc 100644 --- a/drivers/net/3c527.c +++ b/drivers/net/3c527.c @@ -435,7 +435,7 @@ static int __init mc32_probe1(struct net_device *dev, int slot) * Grab the IRQ */ - err = request_irq(dev->irq, &mc32_interrupt, SA_SHIRQ | SA_SAMPLE_RANDOM, DRV_NAME, dev); + err = request_irq(dev->irq, &mc32_interrupt, IRQF_SHARED | IRQF_SAMPLE_RANDOM, DRV_NAME, dev); if (err) { release_region(dev->base_addr, MC32_IO_EXTENT); printk(KERN_ERR "%s: unable to get IRQ %d.\n", DRV_NAME, dev->irq); diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index b467c383ae6..8ab03b4a885 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c @@ -236,7 +236,6 @@ static int vortex_debug = VORTEX_DEBUG; static int vortex_debug = 1; #endif -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/string.h> @@ -997,7 +996,7 @@ static int vortex_resume(struct pci_dev *pdev) pci_enable_device(pdev); pci_set_master(pdev); if (request_irq(dev->irq, vp->full_bus_master_rx ? - &boomerang_interrupt : &vortex_interrupt, SA_SHIRQ, dev->name, dev)) { + &boomerang_interrupt : &vortex_interrupt, IRQF_SHARED, dev->name, dev)) { printk(KERN_WARNING "%s: Could not reserve IRQ %d\n", dev->name, dev->irq); pci_disable_device(pdev); return -EBUSY; @@ -1407,8 +1406,10 @@ static int __devinit vortex_probe1(struct device *gendev, } if (print_info) { - printk(KERN_INFO "%s: CardBus functions mapped %8.8lx->%p\n", - print_name, pci_resource_start(pdev, 2), + printk(KERN_INFO "%s: CardBus functions mapped " + "%16.16llx->%p\n", + print_name, + (unsigned long long)pci_resource_start(pdev, 2), vp->cb_fn_base); } EL3WINDOW(2); @@ -1832,7 +1833,7 @@ vortex_open(struct net_device *dev) /* Use the now-standard shared IRQ implementation. */ if ((retval = request_irq(dev->irq, vp->full_bus_master_rx ? - &boomerang_interrupt : &vortex_interrupt, SA_SHIRQ, dev->name, dev))) { + &boomerang_interrupt : &vortex_interrupt, IRQF_SHARED, dev->name, dev))) { printk(KERN_ERR "%s: Could not reserve IRQ %d\n", dev->name, dev->irq); goto out; } diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index 0cdc830449d..1959654cbec 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c @@ -52,7 +52,6 @@ #define DRV_RELDATE "Mar 22, 2004" -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> @@ -1204,7 +1203,7 @@ static int cp_open (struct net_device *dev) cp_init_hw(cp); - rc = request_irq(dev->irq, cp_interrupt, SA_SHIRQ, dev->name, dev); + rc = request_irq(dev->irq, cp_interrupt, IRQF_SHARED, dev->name, dev); if (rc) goto err_out_hw; @@ -1823,7 +1822,7 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) struct cp_private *cp; int rc; void __iomem *regs; - long pciaddr; + resource_size_t pciaddr; unsigned int addr_len, i, pci_using_dac; u8 pci_rev; @@ -1883,8 +1882,8 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) } if (pci_resource_len(pdev, 1) < CP_REGS_SIZE) { rc = -EIO; - printk(KERN_ERR PFX "MMIO resource (%lx) too small on pci dev %s\n", - pci_resource_len(pdev, 1), pci_name(pdev)); + printk(KERN_ERR PFX "MMIO resource (%llx) too small on pci dev %s\n", + (unsigned long long)pci_resource_len(pdev, 1), pci_name(pdev)); goto err_out_res; } @@ -1916,8 +1915,9 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) regs = ioremap(pciaddr, CP_REGS_SIZE); if (!regs) { rc = -EIO; - printk(KERN_ERR PFX "Cannot map PCI MMIO (%lx@%lx) on pci dev %s\n", - pci_resource_len(pdev, 1), pciaddr, pci_name(pdev)); + printk(KERN_ERR PFX "Cannot map PCI MMIO (%llx@%llx) on pci dev %s\n", + (unsigned long long)pci_resource_len(pdev, 1), + (unsigned long long)pciaddr, pci_name(pdev)); goto err_out_res; } dev->base_addr = (unsigned long) regs; diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index abd6261465f..717506b2b13 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c @@ -93,7 +93,6 @@ #define DRV_VERSION "0.9.27" -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/compiler.h> @@ -1311,7 +1310,7 @@ static int rtl8139_open (struct net_device *dev) int retval; void __iomem *ioaddr = tp->mmio_addr; - retval = request_irq (dev->irq, rtl8139_interrupt, SA_SHIRQ, dev->name, dev); + retval = request_irq (dev->irq, rtl8139_interrupt, IRQF_SHARED, dev->name, dev); if (retval) return retval; @@ -1341,9 +1340,9 @@ static int rtl8139_open (struct net_device *dev) netif_start_queue (dev); if (netif_msg_ifup(tp)) - printk(KERN_DEBUG "%s: rtl8139_open() ioaddr %#lx IRQ %d" - " GP Pins %2.2x %s-duplex.\n", - dev->name, pci_resource_start (tp->pci_dev, 1), + printk(KERN_DEBUG "%s: rtl8139_open() ioaddr %#llx IRQ %d" + " GP Pins %2.2x %s-duplex.\n", dev->name, + (unsigned long long)pci_resource_start (tp->pci_dev, 1), dev->irq, RTL_R8 (MediaStatus), tp->mii.full_duplex ? "full" : "half"); diff --git a/drivers/net/82596.c b/drivers/net/82596.c index 8a9f7d61b9b..7e2ca957146 100644 --- a/drivers/net/82596.c +++ b/drivers/net/82596.c @@ -40,7 +40,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/string.h> diff --git a/drivers/net/8390.h b/drivers/net/8390.h index 51e39dcd060..a9a58f518f4 100644 --- a/drivers/net/8390.h +++ b/drivers/net/8390.h @@ -7,7 +7,6 @@ #ifndef _8390_h #define _8390_h -#include <linux/config.h> #include <linux/if_ether.h> #include <linux/ioport.h> #include <linux/skbuff.h> diff --git a/drivers/net/Space.c b/drivers/net/Space.c index 60304f7e7e5..a8c245a8226 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c @@ -27,7 +27,6 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ -#include <linux/config.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> #include <linux/trdevice.h> diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c index 71165ac0257..f4ea62641ac 100644 --- a/drivers/net/a2065.c +++ b/drivers/net/a2065.c @@ -48,7 +48,6 @@ #include <linux/skbuff.h> #include <linux/slab.h> #include <linux/string.h> -#include <linux/config.h> #include <linux/init.h> #include <linux/crc32.h> #include <linux/zorro.h> @@ -496,7 +495,7 @@ static int lance_open (struct net_device *dev) ll->rdp = LE_C0_STOP; /* Install the Interrupt handler */ - ret = request_irq(IRQ_AMIGA_PORTS, lance_interrupt, SA_SHIRQ, + ret = request_irq(IRQ_AMIGA_PORTS, lance_interrupt, IRQF_SHARED, dev->name, dev); if (ret) return ret; diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c index 23ff22ba5d3..1c01e9b3d07 100644 --- a/drivers/net/acenic.c +++ b/drivers/net/acenic.c @@ -50,7 +50,6 @@ * Grant Grundler <grundler@cup.hp.com>: PCI write posting fixes. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/version.h> @@ -1195,7 +1194,7 @@ static int __devinit ace_init(struct net_device *dev) goto init_error; } - ecode = request_irq(pdev->irq, ace_interrupt, SA_SHIRQ, + ecode = request_irq(pdev->irq, ace_interrupt, IRQF_SHARED, DRV_NAME, dev); if (ecode) { printk(KERN_WARNING "%s: Requested IRQ %d is busy\n", diff --git a/drivers/net/acenic.h b/drivers/net/acenic.h index a9710702349..62ec8ceee69 100644 --- a/drivers/net/acenic.h +++ b/drivers/net/acenic.h @@ -1,7 +1,6 @@ #ifndef _ACENIC_H_ #define _ACENIC_H_ -#include <linux/config.h> /* * Generate TX index update each time, when TX ring is closed. diff --git a/drivers/net/acenic_firmware.h b/drivers/net/acenic_firmware.h index d7882dd783c..ec146f60d77 100644 --- a/drivers/net/acenic_firmware.h +++ b/drivers/net/acenic_firmware.h @@ -1,4 +1,3 @@ -#include <linux/config.h> /* * Declare these here even if Tigon I support is disabled to avoid * the compiler complaining about undefined symbols. diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c index d9ba8be72af..ed322a76980 100644 --- a/drivers/net/amd8111e.c +++ b/drivers/net/amd8111e.c @@ -69,7 +69,6 @@ Revision History: */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> @@ -1377,7 +1376,7 @@ static int amd8111e_open(struct net_device * dev ) { struct amd8111e_priv *lp = netdev_priv(dev); - if(dev->irq ==0 || request_irq(dev->irq, amd8111e_interrupt, SA_SHIRQ, + if(dev->irq ==0 || request_irq(dev->irq, amd8111e_interrupt, IRQF_SHARED, dev->name, dev)) return -EAGAIN; diff --git a/drivers/net/apne.c b/drivers/net/apne.c index b9820b86cdc..9cc13a0250d 100644 --- a/drivers/net/apne.c +++ b/drivers/net/apne.c @@ -313,7 +313,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr) dev->base_addr = ioaddr; /* Install the Interrupt handler */ - i = request_irq(IRQ_AMIGA_PORTS, apne_interrupt, SA_SHIRQ, DRV_NAME, dev); + i = request_irq(IRQ_AMIGA_PORTS, apne_interrupt, IRQF_SHARED, DRV_NAME, dev); if (i) return i; for(i = 0; i < ETHER_ADDR_LEN; i++) { diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c index 9edaa183227..1d01ac0000e 100644 --- a/drivers/net/appletalk/cops.c +++ b/drivers/net/appletalk/cops.c @@ -48,7 +48,6 @@ static const char *version = * the driver figure it out. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> diff --git a/drivers/net/appletalk/cops_ffdrv.h b/drivers/net/appletalk/cops_ffdrv.h index 31cf8c9c947..b02005087c1 100644 --- a/drivers/net/appletalk/cops_ffdrv.h +++ b/drivers/net/appletalk/cops_ffdrv.h @@ -24,7 +24,6 @@ * - Jay Schulist <jschlst@samba.org> */ -#include <linux/config.h> #ifdef CONFIG_COPS_DAYNA diff --git a/drivers/net/appletalk/cops_ltdrv.h b/drivers/net/appletalk/cops_ltdrv.h index 4afb8e18ba6..c699b1ad31d 100644 --- a/drivers/net/appletalk/cops_ltdrv.h +++ b/drivers/net/appletalk/cops_ltdrv.h @@ -23,7 +23,6 @@ * - Jay Schulist <jschlst@samba.org> */ -#include <linux/config.h> #ifdef CONFIG_COPS_TANGENT diff --git a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c index 1a44a79ed06..7f7dd450226 100644 --- a/drivers/net/appletalk/ipddp.c +++ b/drivers/net/appletalk/ipddp.c @@ -23,7 +23,6 @@ * of the GNU General Public License, incorporated herein by reference. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index fabc0607b0f..5a95005253f 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c @@ -44,7 +44,6 @@ #define VERSION "arcnet: v3.93 BETA 2000/04/29 - by Avery Pennarun et al.\n" #include <linux/module.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/delay.h> #include <linux/netdevice.h> diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index 96636ca8754..979a33df0a8 100644 --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -120,7 +120,7 @@ static int __devinit com20020pci_probe(struct pci_dev *pdev, const struct pci_de goto out_port; } - if ((err = com20020_found(dev, SA_SHIRQ)) != 0) + if ((err = com20020_found(dev, IRQF_SHARED)) != 0) goto out_port; return 0; diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c index a9bb7a4aff9..cc721addd57 100644 --- a/drivers/net/ariadne.c +++ b/drivers/net/ariadne.c @@ -320,7 +320,7 @@ static int ariadne_open(struct net_device *dev) netif_start_queue(dev); - i = request_irq(IRQ_AMIGA_PORTS, ariadne_interrupt, SA_SHIRQ, + i = request_irq(IRQ_AMIGA_PORTS, ariadne_interrupt, IRQF_SHARED, dev->name, dev); if (i) return i; diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c index 613005a0285..85493b7b924 100644 --- a/drivers/net/arm/at91_ether.c +++ b/drivers/net/arm/at91_ether.c @@ -19,7 +19,6 @@ #include <linux/module.h> #include <linux/init.h> -#include <linux/config.h> #include <linux/mii.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c index e613cc28974..5d7929c79bc 100644 --- a/drivers/net/at1700.c +++ b/drivers/net/at1700.c @@ -35,7 +35,6 @@ response to inb()s from other device probes! */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index 038d5fcb15e..55f6e3f65b5 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c @@ -35,7 +35,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/drivers/net/b44.c b/drivers/net/b44.c index a7e4ba5a580..cd98d31dee8 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -1421,7 +1421,7 @@ static int b44_open(struct net_device *dev) b44_check_phy(bp); - err = request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev); + err = request_irq(dev->irq, b44_interrupt, IRQF_SHARED, dev->name, dev); if (unlikely(err < 0)) { b44_chip_reset(bp); b44_free_rings(bp); @@ -2322,7 +2322,7 @@ static int b44_resume(struct pci_dev *pdev) if (!netif_running(dev)) return 0; - if (request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev)) + if (request_irq(dev->irq, b44_interrupt, IRQF_SHARED, dev->name, dev)) printk(KERN_ERR PFX "%s: request_irq failed\n", dev->name); spin_lock_irq(&bp->lock); diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c index bbca8ae8018..6fad83f24c4 100644 --- a/drivers/net/bmac.c +++ b/drivers/net/bmac.c @@ -7,7 +7,6 @@ * May 1999, Al Viro: proper release of /proc/net/bmac entry, switched to * dynamic procfs inode. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/netdevice.h> diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 7635736cc79..4f4db5ae503 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -9,7 +9,6 @@ * Written by: Michael Chan (mchan@broadcom.com) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> @@ -57,8 +56,8 @@ #define DRV_MODULE_NAME "bnx2" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "1.4.42" -#define DRV_MODULE_RELDATE "June 12, 2006" +#define DRV_MODULE_VERSION "1.4.43" +#define DRV_MODULE_RELDATE "June 28, 2006" #define RUN_AT(x) (jiffies + (x)) @@ -1676,7 +1675,7 @@ bnx2_tx_int(struct bnx2 *bp) tx_free_bd += last + 1; - dev_kfree_skb_irq(skb); + dev_kfree_skb(skb); hw_cons = bp->hw_tx_cons = sblk->status_tx_quick_consumer_index0; @@ -1824,7 +1823,7 @@ reuse_rx: if ((len > (bp->dev->mtu + ETH_HLEN)) && (ntohs(skb->protocol) != 0x8100)) { - dev_kfree_skb_irq(skb); + dev_kfree_skb(skb); goto next_rx; } @@ -3643,7 +3642,7 @@ bnx2_free_tx_skbs(struct bnx2 *bp) skb_shinfo(skb)->frags[j].size, PCI_DMA_TODEVICE); } - dev_kfree_skb_any(skb); + dev_kfree_skb(skb); i += j + 1; } @@ -3669,7 +3668,7 @@ bnx2_free_rx_skbs(struct bnx2 *bp) rx_buf->skb = NULL; - dev_kfree_skb_any(skb); + dev_kfree_skb(skb); } } @@ -3999,7 +3998,7 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode) udelay(5); pci_unmap_single(bp->pdev, map, pkt_size, PCI_DMA_TODEVICE); - dev_kfree_skb_irq(skb); + dev_kfree_skb(skb); if (bp->status_blk->status_tx_quick_consumer_index0 != bp->tx_prod) { goto loopback_test_done; @@ -4261,11 +4260,11 @@ bnx2_open(struct net_device *dev) } else { rc = request_irq(bp->pdev->irq, bnx2_interrupt, - SA_SHIRQ, dev->name, dev); + IRQF_SHARED, dev->name, dev); } } else { - rc = request_irq(bp->pdev->irq, bnx2_interrupt, SA_SHIRQ, + rc = request_irq(bp->pdev->irq, bnx2_interrupt, IRQF_SHARED, dev->name, dev); } if (rc) { @@ -4312,7 +4311,7 @@ bnx2_open(struct net_device *dev) if (!rc) { rc = request_irq(bp->pdev->irq, bnx2_interrupt, - SA_SHIRQ, dev->name, dev); + IRQF_SHARED, dev->name, dev); } if (rc) { bnx2_free_skbs(bp); @@ -4541,7 +4540,7 @@ bnx2_close(struct net_device *dev) bnx2_netif_stop(bp); del_timer_sync(&bp->timer); if (bp->flags & NO_WOL_FLAG) - reset_code = BNX2_DRV_MSG_CODE_UNLOAD; + reset_code = BNX2_DRV_MSG_CODE_UNLOAD_LNK_DN; else if (bp->wol) reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL; else @@ -5128,6 +5127,16 @@ bnx2_set_rx_csum(struct net_device *dev, u32 data) return 0; } +static int +bnx2_set_tso(struct net_device *dev, u32 data) +{ + if (data) + dev->features |= NETIF_F_TSO | NETIF_F_TSO_ECN; + else + dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO_ECN); + return 0; +} + #define BNX2_NUM_STATS 46 static struct { @@ -5445,7 +5454,7 @@ static struct ethtool_ops bnx2_ethtool_ops = { .set_sg = ethtool_op_set_sg, #ifdef BCM_TSO .get_tso = ethtool_op_get_tso, - .set_tso = ethtool_op_set_tso, + .set_tso = bnx2_set_tso, #endif .self_test_count = bnx2_self_test_count, .self_test = bnx2_self_test, @@ -5926,7 +5935,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; #endif #ifdef BCM_TSO - dev->features |= NETIF_F_TSO; + dev->features |= NETIF_F_TSO | NETIF_F_TSO_ECN; #endif netif_carrier_off(bp->dev); @@ -5968,7 +5977,7 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state) netif_device_detach(dev); del_timer_sync(&bp->timer); if (bp->flags & NO_WOL_FLAG) - reset_code = BNX2_DRV_MSG_CODE_UNLOAD; + reset_code = BNX2_DRV_MSG_CODE_UNLOAD_LNK_DN; else if (bp->wol) reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL; else diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index 5845e334941..658c5ee95c7 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h @@ -4174,6 +4174,7 @@ struct fw_info { #define BNX2_DRV_MSG_CODE_PULSE 0x06000000 #define BNX2_DRV_MSG_CODE_DIAG 0x07000000 #define BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL 0x09000000 +#define BNX2_DRV_MSG_CODE_UNLOAD_LNK_DN 0x0b000000 #define BNX2_DRV_MSG_DATA 0x00ff0000 #define BNX2_DRV_MSG_DATA_WAIT0 0x00010000 diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 8171cae0668..8b951238f3a 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -33,7 +33,6 @@ //#define BONDING_DEBUG 1 -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/sched.h> diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 5a9bd95884b..cfe4dc3a93a 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -20,7 +20,6 @@ * file called LICENSE. * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/sched.h> diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 565a54f1d06..d33130f6470 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c @@ -66,7 +66,6 @@ * by default, the selective clear mask is set up to process rx packets. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> @@ -4350,7 +4349,7 @@ static int cas_open(struct net_device *dev) * mapping to expose them */ if (request_irq(cp->pdev->irq, cas_interrupt, - SA_SHIRQ, dev->name, (void *) dev)) { + IRQF_SHARED, dev->name, (void *) dev)) { printk(KERN_ERR "%s: failed to request irq !\n", cp->dev->name); err = -EAGAIN; diff --git a/drivers/net/chelsio/common.h b/drivers/net/chelsio/common.h index bf3e7b6a7a1..5d9dd14427c 100644 --- a/drivers/net/chelsio/common.h +++ b/drivers/net/chelsio/common.h @@ -39,7 +39,6 @@ #ifndef _CXGB_COMMON_H_ #define _CXGB_COMMON_H_ -#include <linux/config.h> #include <linux/module.h> #include <linux/netdevice.h> #include <linux/types.h> diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c index 7fe2638ae06..e67872433e9 100644 --- a/drivers/net/chelsio/cxgb2.c +++ b/drivers/net/chelsio/cxgb2.c @@ -37,7 +37,6 @@ ****************************************************************************/ #include "common.h" -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/pci.h> @@ -219,7 +218,7 @@ static int cxgb_up(struct adapter *adapter) t1_interrupts_clear(adapter); if ((err = request_irq(adapter->pdev->irq, - t1_select_intr_handler(adapter), SA_SHIRQ, + t1_select_intr_handler(adapter), IRQF_SHARED, adapter->name, adapter))) { goto out_err; } diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c index 53efff6da78..87f94d939ff 100644 --- a/drivers/net/chelsio/sge.c +++ b/drivers/net/chelsio/sge.c @@ -39,7 +39,6 @@ #include "common.h" -#include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/pci.h> diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c index 64105e4eaf3..0eb1f8787ed 100644 --- a/drivers/net/cris/eth_v10.c +++ b/drivers/net/cris/eth_v10.c @@ -218,7 +218,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> @@ -672,7 +671,7 @@ e100_open(struct net_device *dev) /* allocate the irq corresponding to the receiving DMA */ if (request_irq(NETWORK_DMA_RX_IRQ_NBR, e100rxtx_interrupt, - SA_SAMPLE_RANDOM, cardname, (void *)dev)) { + IRQF_SAMPLE_RANDOM, cardname, (void *)dev)) { goto grace_exit0; } diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index ef54ebeb29b..47eecce35fa 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -100,7 +100,6 @@ /* Always include 'config.h' first in case the user wants to turn on or override something. */ -#include <linux/config.h> #include <linux/module.h> /* diff --git a/drivers/net/cs89x0.h b/drivers/net/cs89x0.h index bd954aaa636..968fe11a0bf 100644 --- a/drivers/net/cs89x0.h +++ b/drivers/net/cs89x0.h @@ -14,7 +14,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #define PP_ChipID 0x0000 /* offset 0h -> Corp -ID */ /* offset 2h -> Model/Product Number */ diff --git a/drivers/net/declance.c b/drivers/net/declance.c index d3d958e7ac5..2038ca7e49c 100644 --- a/drivers/net/declance.c +++ b/drivers/net/declance.c @@ -42,7 +42,6 @@ * bits. macro */ -#include <linux/config.h> #include <linux/crc32.h> #include <linux/delay.h> #include <linux/errno.h> diff --git a/drivers/net/defxx.c b/drivers/net/defxx.c index 5acd35c312a..91cc8cbdd44 100644 --- a/drivers/net/defxx.c +++ b/drivers/net/defxx.c @@ -1228,7 +1228,7 @@ static int dfx_open(struct net_device *dev) /* Register IRQ - support shared interrupts by passing device ptr */ - ret = request_irq(dev->irq, dfx_interrupt, SA_SHIRQ, dev->name, dev); + ret = request_irq(dev->irq, dfx_interrupt, IRQF_SHARED, dev->name, dev); if (ret) { printk(KERN_ERR "%s: Requested IRQ %d is busy\n", dev->name, dev->irq); return ret; diff --git a/drivers/net/depca.c b/drivers/net/depca.c index e946c43d3b1..b1cbe99249c 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c @@ -235,7 +235,6 @@ ========================================================================= */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/string.h> diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c index e175d487668..fa4f0943297 100644 --- a/drivers/net/dgrs.c +++ b/drivers/net/dgrs.c @@ -1191,7 +1191,7 @@ dgrs_probe1(struct net_device *dev) if (priv->plxreg) OUTL(dev->base_addr + PLX_LCL2PCI_DOORBELL, 1); - rc = request_irq(dev->irq, &dgrs_intr, SA_SHIRQ, "RightSwitch", dev); + rc = request_irq(dev->irq, &dgrs_intr, IRQF_SHARED, "RightSwitch", dev); if (rc) goto err_out; diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index 038447fb5c5..4b6ddb70f92 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c @@ -390,7 +390,7 @@ parse_eeprom (struct net_device *dev) for (i = 0; i < 6; i++) dev->dev_addr[i] = psrom->mac_addr[i]; - /* Parse Software Infomation Block */ + /* Parse Software Information Block */ i = 0x30; psib = (u8 *) sromdata; do { @@ -440,7 +440,7 @@ rio_open (struct net_device *dev) int i; u16 macctrl; - i = request_irq (dev->irq, &rio_interrupt, SA_SHIRQ, dev->name, dev); + i = request_irq (dev->irq, &rio_interrupt, IRQF_SHARED, dev->name, dev); if (i) return i; diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index 7965a9b08e7..1b758b70713 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c @@ -603,7 +603,7 @@ dm9000_open(struct net_device *dev) PRINTK2("entering dm9000_open\n"); - if (request_irq(dev->irq, &dm9000_interrupt, SA_SHIRQ, dev->name, dev)) + if (request_irq(dev->irq, &dm9000_interrupt, IRQF_SHARED, dev->name, dev)) return -EAGAIN; /* Initialize DM9000 board */ diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index dd8c15ac5c7..36d511729f7 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c @@ -28,7 +28,6 @@ Alan Cox, 30th May 1994 */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/netdevice.h> diff --git a/drivers/net/e100.c b/drivers/net/e100.c index f37170cc1a3..91ef5f2fd76 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -138,7 +138,6 @@ * - Stratus87247: protect MDI control register manipulations */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> @@ -2064,7 +2063,7 @@ static int e100_up(struct nic *nic) e100_set_multicast_list(nic->netdev); e100_start_receiver(nic, NULL); mod_timer(&nic->watchdog, jiffies); - if((err = request_irq(nic->pdev->irq, e100_intr, SA_SHIRQ, + if((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED, nic->netdev->name, nic->netdev))) goto err_no_irq; netif_wake_queue(nic->netdev); @@ -2678,9 +2677,9 @@ static int __devinit e100_probe(struct pci_dev *pdev, goto err_out_free; } - DPRINTK(PROBE, INFO, "addr 0x%lx, irq %d, " + DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, " "MAC addr %02X:%02X:%02X:%02X:%02X:%02X\n", - pci_resource_start(pdev, 0), pdev->irq, + (unsigned long long)pci_resource_start(pdev, 0), pdev->irq, netdev->dev_addr[0], netdev->dev_addr[1], netdev->dev_addr[2], netdev->dev_addr[3], netdev->dev_addr[4], netdev->dev_addr[5]); diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index 2bc34fbfa69..3042d33e2d4 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h @@ -34,7 +34,6 @@ #define _E1000_H_ #include <linux/stddef.h> -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <asm/byteorder.h> diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index 6ed7f599eba..d1966489176 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c @@ -871,10 +871,10 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) *data = 0; /* Hook up test interrupt handler just for this test */ - if (!request_irq(irq, &e1000_test_intr, SA_PROBEIRQ, netdev->name, - netdev)) { + if (!request_irq(irq, &e1000_test_intr, IRQF_PROBE_SHARED, + netdev->name, netdev)) { shared_int = FALSE; - } else if (request_irq(irq, &e1000_test_intr, SA_SHIRQ, + } else if (request_irq(irq, &e1000_test_intr, IRQF_SHARED, netdev->name, netdev)){ *data = 1; return -1; diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 32b7d444b37..f77624f5f17 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -426,7 +426,7 @@ e1000_up(struct e1000_adapter *adapter) } #endif if ((err = request_irq(adapter->pdev->irq, &e1000_intr, - SA_SHIRQ | SA_SAMPLE_RANDOM, + IRQF_SHARED | IRQF_SAMPLE_RANDOM, netdev->name, netdev))) { DPRINTK(PROBE, ERR, "Unable to allocate interrupt Error: %d\n", err); diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c index e70f172699d..20d31430c74 100644 --- a/drivers/net/eepro.c +++ b/drivers/net/eepro.c @@ -920,7 +920,7 @@ static int eepro_grab_irq(struct net_device *dev) eepro_sw2bank0(ioaddr); /* Switch back to Bank 0 */ - if (request_irq (*irqp, NULL, SA_SHIRQ, "bogus", dev) != EBUSY) { + if (request_irq (*irqp, NULL, IRQF_SHARED, "bogus", dev) != EBUSY) { unsigned long irq_mask; /* Twinkle the interrupt, and check if it's seen */ irq_mask = probe_irq_on(); diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index ecf5ad85a68..2ad32754292 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -87,7 +87,6 @@ static int options[] = {-1, -1, -1, -1, -1, -1, -1, -1}; /* Size of an pre-allocated Rx buffer: <Ethernet MTU> + slack.*/ #define PKT_BUF_SZ 1536 -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> @@ -978,7 +977,7 @@ speedo_open(struct net_device *dev) sp->in_interrupt = 0; /* .. we can safely take handler calls during init. */ - retval = request_irq(dev->irq, &speedo_interrupt, SA_SHIRQ, dev->name, dev); + retval = request_irq(dev->irq, &speedo_interrupt, IRQF_SHARED, dev->name, dev); if (retval) { return retval; } diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c index a74b2071575..33291bcf6d4 100644 --- a/drivers/net/eexpress.c +++ b/drivers/net/eexpress.c @@ -97,7 +97,6 @@ #define LOCKUP16 0 #endif -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index ee34a16eb4e..9f3e09a3d88 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c @@ -114,7 +114,6 @@ static int rx_copybreak; #define TX_FIFO_THRESH 256 #define RX_FIFO_THRESH 1 /* 0-3, 0==32, 64,96, or 3==128 bytes */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/string.h> @@ -714,7 +713,7 @@ static int epic_open(struct net_device *dev) /* Soft reset the chip. */ outl(0x4001, ioaddr + GENCTL); - if ((retval = request_irq(dev->irq, &epic_interrupt, SA_SHIRQ, dev->name, dev))) + if ((retval = request_irq(dev->irq, &epic_interrupt, IRQF_SHARED, dev->name, dev))) return retval; epic_init_ring(dev); diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c index 13eca7ede2a..c701951dcd6 100644 --- a/drivers/net/fealnx.c +++ b/drivers/net/fealnx.c @@ -834,7 +834,7 @@ static int netdev_open(struct net_device *dev) iowrite32(0x00000001, ioaddr + BCR); /* Reset */ - if (request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev)) + if (request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev)) return -EAGAIN; for (i = 0; i < 3; i++) diff --git a/drivers/net/fec.c b/drivers/net/fec.c index db694c83298..9b403003174 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c @@ -25,7 +25,6 @@ * Copyright (c) 2004-2006 Macq Electronique SA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/string.h> diff --git a/drivers/net/fec_8xx/fec_8xx-netta.c b/drivers/net/fec_8xx/fec_8xx-netta.c index 29c275e1d56..790d9dbe42d 100644 --- a/drivers/net/fec_8xx/fec_8xx-netta.c +++ b/drivers/net/fec_8xx/fec_8xx-netta.c @@ -2,7 +2,6 @@ * FEC instantatiation file for NETTA */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/sched.h> diff --git a/drivers/net/fec_8xx/fec_main.c b/drivers/net/fec_8xx/fec_main.c index 7e433809713..282b1452c39 100644 --- a/drivers/net/fec_8xx/fec_main.c +++ b/drivers/net/fec_8xx/fec_main.c @@ -10,7 +10,6 @@ * Released under the GPL */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> diff --git a/drivers/net/fec_8xx/fec_mii.c b/drivers/net/fec_8xx/fec_mii.c index 3b44ac1a7bf..d3c16b85d9a 100644 --- a/drivers/net/fec_8xx/fec_mii.c +++ b/drivers/net/fec_8xx/fec_mii.c @@ -10,7 +10,6 @@ * Released under the GPL */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 21be4fa071b..3c90003f423 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c @@ -2622,21 +2622,21 @@ static int nv_request_irq(struct net_device *dev, int intr_test) np->msi_flags |= NV_MSI_X_ENABLED; if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT && !intr_test) { /* Request irq for rx handling */ - if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, &nv_nic_irq_rx, SA_SHIRQ, dev->name, dev) != 0) { + if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, &nv_nic_irq_rx, IRQF_SHARED, dev->name, dev) != 0) { printk(KERN_INFO "forcedeth: request_irq failed for rx %d\n", ret); pci_disable_msix(np->pci_dev); np->msi_flags &= ~NV_MSI_X_ENABLED; goto out_err; } /* Request irq for tx handling */ - if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, &nv_nic_irq_tx, SA_SHIRQ, dev->name, dev) != 0) { + if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, &nv_nic_irq_tx, IRQF_SHARED, dev->name, dev) != 0) { printk(KERN_INFO "forcedeth: request_irq failed for tx %d\n", ret); pci_disable_msix(np->pci_dev); np->msi_flags &= ~NV_MSI_X_ENABLED; goto out_free_rx; } /* Request irq for link and timer handling */ - if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, &nv_nic_irq_other, SA_SHIRQ, dev->name, dev) != 0) { + if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, &nv_nic_irq_other, IRQF_SHARED, dev->name, dev) != 0) { printk(KERN_INFO "forcedeth: request_irq failed for link %d\n", ret); pci_disable_msix(np->pci_dev); np->msi_flags &= ~NV_MSI_X_ENABLED; @@ -2651,9 +2651,9 @@ static int nv_request_irq(struct net_device *dev, int intr_test) } else { /* Request irq for all interrupts */ if ((!intr_test && - request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) || + request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq, IRQF_SHARED, dev->name, dev) != 0) || (intr_test && - request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq_test, SA_SHIRQ, dev->name, dev) != 0)) { + request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector, &nv_nic_irq_test, IRQF_SHARED, dev->name, dev) != 0)) { printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); pci_disable_msix(np->pci_dev); np->msi_flags &= ~NV_MSI_X_ENABLED; @@ -2669,8 +2669,8 @@ static int nv_request_irq(struct net_device *dev, int intr_test) if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) { if ((ret = pci_enable_msi(np->pci_dev)) == 0) { np->msi_flags |= NV_MSI_ENABLED; - if ((!intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) || - (intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq_test, SA_SHIRQ, dev->name, dev) != 0)) { + if ((!intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq, IRQF_SHARED, dev->name, dev) != 0) || + (intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq_test, IRQF_SHARED, dev->name, dev) != 0)) { printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); pci_disable_msi(np->pci_dev); np->msi_flags &= ~NV_MSI_ENABLED; @@ -2685,8 +2685,8 @@ static int nv_request_irq(struct net_device *dev, int intr_test) } } if (ret != 0) { - if ((!intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq, SA_SHIRQ, dev->name, dev) != 0) || - (intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq_test, SA_SHIRQ, dev->name, dev) != 0)) + if ((!intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq, IRQF_SHARED, dev->name, dev) != 0) || + (intr_test && request_irq(np->pci_dev->irq, &nv_nic_irq_test, IRQF_SHARED, dev->name, dev) != 0)) goto out_err; } diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index 196298f33db..f6abff5846b 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c @@ -15,7 +15,6 @@ * kind, whether express or implied. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> @@ -672,7 +671,7 @@ static int fs_request_irq(struct net_device *dev, int irq, const char *name, struct fs_enet_private *fep = netdev_priv(dev); (*fep->ops->pre_request_irq)(dev, irq); - return request_irq(irq, irqf, SA_SHIRQ, name, dev); + return request_irq(irq, irqf, IRQF_SHARED, name, dev); } static void fs_free_irq(struct net_device *dev, int irq) diff --git a/drivers/net/fs_enet/fs_enet-mii.c b/drivers/net/fs_enet/fs_enet-mii.c index 0cd07150bf4..b7e6e21725c 100644 --- a/drivers/net/fs_enet/fs_enet-mii.c +++ b/drivers/net/fs_enet/fs_enet-mii.c @@ -16,7 +16,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c index 95e2bb8dd7b..64e20982c1f 100644 --- a/drivers/net/fs_enet/mac-fcc.c +++ b/drivers/net/fs_enet/mac-fcc.c @@ -12,7 +12,6 @@ * kind, whether express or implied. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c index 3dad69dfdb2..e0954707752 100644 --- a/drivers/net/fs_enet/mac-fec.c +++ b/drivers/net/fs_enet/mac-fec.c @@ -12,7 +12,6 @@ * kind, whether express or implied. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c index a772b286f96..eaa24fab645 100644 --- a/drivers/net/fs_enet/mac-scc.c +++ b/drivers/net/fs_enet/mac-scc.c @@ -12,7 +12,6 @@ * kind, whether express or implied. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c index 24a5e2e23d1..48f9cf83ab6 100644 --- a/drivers/net/fs_enet/mii-bitbang.c +++ b/drivers/net/fs_enet/mii-bitbang.c @@ -13,7 +13,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/net/fs_enet/mii-fixed.c b/drivers/net/fs_enet/mii-fixed.c index b3e192d612e..ae4a9c3bb39 100644 --- a/drivers/net/fs_enet/mii-fixed.c +++ b/drivers/net/fs_enet/mii-fixed.c @@ -13,7 +13,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 218d31764c5..ebbbd6ca620 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -64,7 +64,6 @@ * The driver then cleans up the buffer. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index 127c98cf333..f87bbc408da 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h @@ -22,7 +22,6 @@ #ifndef __GIANFAR_H #define __GIANFAR_H -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index d69698c695e..e0f505285e5 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c @@ -15,7 +15,6 @@ * by reference. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c index c6b725529af..c92e65984fd 100644 --- a/drivers/net/gianfar_mii.c +++ b/drivers/net/gianfar_mii.c @@ -16,7 +16,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> diff --git a/drivers/net/gianfar_sysfs.c b/drivers/net/gianfar_sysfs.c index a6d5c43199c..e8a18f18d08 100644 --- a/drivers/net/gianfar_sysfs.c +++ b/drivers/net/gianfar_sysfs.c @@ -19,7 +19,6 @@ * Sysfs file creation and management */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> diff --git a/drivers/net/gt96100eth.c b/drivers/net/gt96100eth.c index 2d243540461..49dacc6e35a 100644 --- a/drivers/net/gt96100eth.c +++ b/drivers/net/gt96100eth.c @@ -1030,7 +1030,7 @@ gt96100_open(struct net_device *dev) } if ((retval = request_irq(dev->irq, >96100_interrupt, - SA_SHIRQ, dev->name, dev))) { + IRQF_SHARED, dev->name, dev))) { err("unable to get IRQ %d\n", dev->irq); return retval; } diff --git a/drivers/net/gt96100eth.h b/drivers/net/gt96100eth.h index 395869c5ed3..2a8331938b8 100644 --- a/drivers/net/gt96100eth.h +++ b/drivers/net/gt96100eth.h @@ -27,7 +27,6 @@ #ifndef _GT96100ETH_H #define _GT96100ETH_H -#include <linux/config.h> #include <asm/galileo-boards/gt96100.h> #define dbg(lvl, format, arg...) \ diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c index 0ea4cb4a0d8..7bcd939c6ed 100644 --- a/drivers/net/hamachi.c +++ b/drivers/net/hamachi.c @@ -871,7 +871,7 @@ static int hamachi_open(struct net_device *dev) u32 rx_int_var, tx_int_var; u16 fifo_info; - i = request_irq(dev->irq, &hamachi_interrupt, SA_SHIRQ, dev->name, dev); + i = request_irq(dev->irq, &hamachi_interrupt, IRQF_SHARED, dev->name, dev); if (i) return i; diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index d12605f0ac7..86b3bb9bec2 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c @@ -12,7 +12,6 @@ * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> */ -#include <linux/config.h> #include <linux/module.h> #include <asm/system.h> #include <asm/uaccess.h> diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c index 232793d2ce6..55906c7b4bb 100644 --- a/drivers/net/hamradio/baycom_ser_fdx.c +++ b/drivers/net/hamradio/baycom_ser_fdx.c @@ -434,7 +434,7 @@ static int ser12_open(struct net_device *dev) outb(0, FCR(dev->base_addr)); /* disable FIFOs */ outb(0x0d, MCR(dev->base_addr)); outb(0, IER(dev->base_addr)); - if (request_irq(dev->irq, ser12_interrupt, SA_INTERRUPT | SA_SHIRQ, + if (request_irq(dev->irq, ser12_interrupt, IRQF_DISABLED | IRQF_SHARED, "baycom_ser_fdx", dev)) { release_region(dev->base_addr, SER12_EXTENT); return -EBUSY; diff --git a/drivers/net/hamradio/baycom_ser_hdx.c b/drivers/net/hamradio/baycom_ser_hdx.c index be596a3eb3f..de95de8983d 100644 --- a/drivers/net/hamradio/baycom_ser_hdx.c +++ b/drivers/net/hamradio/baycom_ser_hdx.c @@ -488,7 +488,7 @@ static int ser12_open(struct net_device *dev) outb(0, FCR(dev->base_addr)); /* disable FIFOs */ outb(0x0d, MCR(dev->base_addr)); outb(0, IER(dev->base_addr)); - if (request_irq(dev->irq, ser12_interrupt, SA_INTERRUPT | SA_SHIRQ, + if (request_irq(dev->irq, ser12_interrupt, IRQF_DISABLED | IRQF_SHARED, "baycom_ser12", dev)) { release_region(dev->base_addr, SER12_EXTENT); return -EBUSY; diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index cb43a9d2877..0641f54fc63 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c @@ -54,7 +54,6 @@ * BPQ 004 Joerg(DL1BKE) Fixed to not lock up on ifconfig. */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/types.h> #include <linux/socket.h> diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 3ebbbe56b6e..d8715b200c1 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c @@ -16,7 +16,6 @@ * Copyright (C) 2004, 05 Ralf Baechle DL5RB <ralf@linux-mips.org> * Copyright (C) 2004, 05 Thomas Osterried DL9SAU <thomas@x-berg.in-berlin.de> */ -#include <linux/config.h> #include <linux/module.h> #include <asm/system.h> #include <linux/bitops.h> diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c index 5927784df3f..df4b68142ac 100644 --- a/drivers/net/hamradio/scc.c +++ b/drivers/net/hamradio/scc.c @@ -148,7 +148,6 @@ /* ----------------------------------------------------------------------- */ -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/signal.h> @@ -1737,7 +1736,7 @@ static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) if (!Ivec[hwcfg.irq].used && hwcfg.irq) { - if (request_irq(hwcfg.irq, scc_isr, SA_INTERRUPT, "AX.25 SCC", NULL)) + if (request_irq(hwcfg.irq, scc_isr, IRQF_DISABLED, "AX.25 SCC", NULL)) printk(KERN_WARNING "z8530drv: warning, cannot get IRQ %d\n", hwcfg.irq); else Ivec[hwcfg.irq].used = 1; diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c index b49884048ca..f98f5777dfb 100644 --- a/drivers/net/hamradio/yam.c +++ b/drivers/net/hamradio/yam.c @@ -42,7 +42,6 @@ /*****************************************************************************/ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/net.h> @@ -874,7 +873,7 @@ static int yam_open(struct net_device *dev) goto out_release_base; } outb(0, IER(dev->base_addr)); - if (request_irq(dev->irq, yam_interrupt, SA_INTERRUPT | SA_SHIRQ, dev->name, dev)) { + if (request_irq(dev->irq, yam_interrupt, IRQF_DISABLED | IRQF_SHARED, dev->name, dev)) { printk(KERN_ERR "%s: irq %d busy\n", dev->name, dev->irq); ret = -EBUSY; goto out_release_base; diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index dd1dc32dc98..e7d9bf33028 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c @@ -1079,7 +1079,7 @@ static int hp100_open(struct net_device *dev) /* New: if bus is PCI or EISA, interrupts might be shared interrupts */ if (request_irq(dev->irq, hp100_interrupt, lp->bus == HP100_BUS_PCI || lp->bus == - HP100_BUS_EISA ? SA_SHIRQ : SA_INTERRUPT, + HP100_BUS_EISA ? IRQF_SHARED : IRQF_DISABLED, "hp100", dev)) { printk("hp100: %s: unable to get IRQ %d\n", dev->name, dev->irq); return -EAGAIN; diff --git a/drivers/net/hydra.c b/drivers/net/hydra.c index d9fb8e74e63..91326ea3e12 100644 --- a/drivers/net/hydra.c +++ b/drivers/net/hydra.c @@ -117,7 +117,7 @@ static int __devinit hydra_init(struct zorro_dev *z) dev->irq = IRQ_AMIGA_PORTS; /* Install the Interrupt handler */ - if (request_irq(IRQ_AMIGA_PORTS, ei_interrupt, SA_SHIRQ, "Hydra Ethernet", + if (request_irq(IRQ_AMIGA_PORTS, ei_interrupt, IRQF_SHARED, "Hydra Ethernet", dev)) { free_netdev(dev); return -EAGAIN; diff --git a/drivers/net/ibm_emac/ibm_emac.h b/drivers/net/ibm_emac/ibm_emac.h index c2dae6092c4..97ed22bb432 100644 --- a/drivers/net/ibm_emac/ibm_emac.h +++ b/drivers/net/ibm_emac/ibm_emac.h @@ -20,7 +20,6 @@ #ifndef __IBM_EMAC_H_ #define __IBM_EMAC_H_ -#include <linux/config.h> #include <linux/types.h> /* This is a simple check to prevent use of this driver on non-tested SoCs */ diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c index 7e49522b8b3..82468e2dc79 100644 --- a/drivers/net/ibm_emac/ibm_emac_core.c +++ b/drivers/net/ibm_emac/ibm_emac_core.c @@ -19,7 +19,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/drivers/net/ibm_emac/ibm_emac_core.h b/drivers/net/ibm_emac/ibm_emac_core.h index f61273b2e94..dabb94afeb9 100644 --- a/drivers/net/ibm_emac/ibm_emac_core.h +++ b/drivers/net/ibm_emac/ibm_emac_core.h @@ -20,7 +20,6 @@ #ifndef __IBM_EMAC_CORE_H_ #define __IBM_EMAC_CORE_H_ -#include <linux/config.h> #include <linux/netdevice.h> #include <linux/dma-mapping.h> #include <asm/ocp.h> diff --git a/drivers/net/ibm_emac/ibm_emac_debug.c b/drivers/net/ibm_emac/ibm_emac_debug.c index c7e1ecfa08f..c3645908034 100644 --- a/drivers/net/ibm_emac/ibm_emac_debug.c +++ b/drivers/net/ibm_emac/ibm_emac_debug.c @@ -12,7 +12,6 @@ * option) any later version. * */ -#include <linux/config.h> #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/net/ibm_emac/ibm_emac_debug.h b/drivers/net/ibm_emac/ibm_emac_debug.h index e85fbe0a8da..5761389495d 100644 --- a/drivers/net/ibm_emac/ibm_emac_debug.h +++ b/drivers/net/ibm_emac/ibm_emac_debug.h @@ -15,7 +15,6 @@ #ifndef __IBM_EMAC_DEBUG_H_ #define __IBM_EMAC_DEBUG_H_ -#include <linux/config.h> #include <linux/init.h> #include "ibm_emac_core.h" #include "ibm_emac_mal.h" diff --git a/drivers/net/ibm_emac/ibm_emac_mal.c b/drivers/net/ibm_emac/ibm_emac_mal.c index da88d43081c..af50e7b2e0d 100644 --- a/drivers/net/ibm_emac/ibm_emac_mal.c +++ b/drivers/net/ibm_emac/ibm_emac_mal.c @@ -19,7 +19,6 @@ * option) any later version. * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/net/ibm_emac/ibm_emac_mal.h b/drivers/net/ibm_emac/ibm_emac_mal.h index 2a2d3b24b03..f73f10a0a56 100644 --- a/drivers/net/ibm_emac/ibm_emac_mal.h +++ b/drivers/net/ibm_emac/ibm_emac_mal.h @@ -19,7 +19,6 @@ #ifndef __IBM_EMAC_MAL_H_ #define __IBM_EMAC_MAL_H_ -#include <linux/config.h> #include <linux/init.h> #include <linux/list.h> #include <linux/netdevice.h> diff --git a/drivers/net/ibm_emac/ibm_emac_phy.c b/drivers/net/ibm_emac/ibm_emac_phy.c index 67935dd33a6..4a97024061e 100644 --- a/drivers/net/ibm_emac/ibm_emac_phy.c +++ b/drivers/net/ibm_emac/ibm_emac_phy.c @@ -12,7 +12,6 @@ * (c) 2004-2005, Eugene Surovegin <ebs@ebshome.net> * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> diff --git a/drivers/net/ibm_emac/ibm_emac_rgmii.c b/drivers/net/ibm_emac/ibm_emac_rgmii.c index f0b1ffb2dbb..53d281cb9a1 100644 --- a/drivers/net/ibm_emac/ibm_emac_rgmii.c +++ b/drivers/net/ibm_emac/ibm_emac_rgmii.c @@ -16,7 +16,6 @@ * option) any later version. * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/ethtool.h> #include <asm/io.h> diff --git a/drivers/net/ibm_emac/ibm_emac_rgmii.h b/drivers/net/ibm_emac/ibm_emac_rgmii.h index 7f03d536c9a..94abde55e2e 100644 --- a/drivers/net/ibm_emac/ibm_emac_rgmii.h +++ b/drivers/net/ibm_emac/ibm_emac_rgmii.h @@ -21,7 +21,6 @@ #ifndef _IBM_EMAC_RGMII_H_ #define _IBM_EMAC_RGMII_H_ -#include <linux/config.h> /* RGMII bridge */ struct rgmii_regs { diff --git a/drivers/net/ibm_emac/ibm_emac_tah.c b/drivers/net/ibm_emac/ibm_emac_tah.c index af08afc22f9..e287b451bb4 100644 --- a/drivers/net/ibm_emac/ibm_emac_tah.c +++ b/drivers/net/ibm_emac/ibm_emac_tah.c @@ -13,7 +13,6 @@ * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ -#include <linux/config.h> #include <asm/io.h> #include "ibm_emac_core.h" diff --git a/drivers/net/ibm_emac/ibm_emac_tah.h b/drivers/net/ibm_emac/ibm_emac_tah.h index 9299b5dd7eb..38153945a24 100644 --- a/drivers/net/ibm_emac/ibm_emac_tah.h +++ b/drivers/net/ibm_emac/ibm_emac_tah.h @@ -17,7 +17,6 @@ #ifndef _IBM_EMAC_TAH_H #define _IBM_EMAC_TAH_H -#include <linux/config.h> #include <linux/init.h> #include <asm/ocp.h> diff --git a/drivers/net/ibm_emac/ibm_emac_zmii.c b/drivers/net/ibm_emac/ibm_emac_zmii.c index e129e0aaa04..37dc8f34286 100644 --- a/drivers/net/ibm_emac/ibm_emac_zmii.c +++ b/drivers/net/ibm_emac/ibm_emac_zmii.c @@ -16,7 +16,6 @@ * option) any later version. * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/ethtool.h> #include <asm/io.h> diff --git a/drivers/net/ibm_emac/ibm_emac_zmii.h b/drivers/net/ibm_emac/ibm_emac_zmii.h index 92c85441075..972e3a44a09 100644 --- a/drivers/net/ibm_emac/ibm_emac_zmii.h +++ b/drivers/net/ibm_emac/ibm_emac_zmii.h @@ -19,7 +19,6 @@ #ifndef _IBM_EMAC_ZMII_H_ #define _IBM_EMAC_ZMII_H_ -#include <linux/config.h> #include <linux/init.h> #include <asm/ocp.h> diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c index 51fd51609ea..2a95d72fa59 100644 --- a/drivers/net/ibmlana.c +++ b/drivers/net/ibmlana.c @@ -782,7 +782,7 @@ static int ibmlana_open(struct net_device *dev) /* register resources - only necessary for IRQ */ - result = request_irq(priv->realirq, irq_handler, SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); + result = request_irq(priv->realirq, irq_handler, IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev); if (result != 0) { printk(KERN_ERR "%s: failed to register irq %d\n", dev->name, dev->irq); return result; diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index 4c2e7279ba3..0464e78f733 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c @@ -33,7 +33,6 @@ - possibly remove procfs support */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/errno.h> diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 2e222ef91e2..3a42afab503 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -27,7 +27,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/netdevice.h> diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index e76e6e7be0b..68d8af7df08 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c @@ -30,7 +30,6 @@ #define IOC3_NAME "ioc3-eth" #define IOC3_VERSION "2.6.3-3" -#include <linux/config.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/kernel.h> @@ -1064,7 +1063,7 @@ static int ioc3_open(struct net_device *dev) { struct ioc3_private *ip = netdev_priv(dev); - if (request_irq(dev->irq, ioc3_interrupt, SA_SHIRQ, ioc3_str, dev)) { + if (request_irq(dev->irq, ioc3_interrupt, IRQF_SHARED, ioc3_str, dev)) { printk(KERN_ERR "%s: Can't get irq %d\n", dev->name, dev->irq); return -EAGAIN; diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig index d2ce4896abf..e9e6d99a9ad 100644 --- a/drivers/net/irda/Kconfig +++ b/drivers/net/irda/Kconfig @@ -350,7 +350,7 @@ config TOSHIBA_FIR config AU1000_FIR tristate "Alchemy Au1000 SIR/FIR" - depends on MIPS_AU1000 && IRDA + depends on SOC_AU1000 && IRDA config SMC_IRCC_FIR tristate "SMSC IrCC (EXPERIMENTAL)" diff --git a/drivers/net/irda/au1k_ir.c b/drivers/net/irda/au1k_ir.c index e6b1985767c..7b2b4135bb2 100644 --- a/drivers/net/irda/au1k_ir.c +++ b/drivers/net/irda/au1k_ir.c @@ -18,7 +18,6 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/init.h> diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c index 910c0cab35b..33c07d5275d 100644 --- a/drivers/net/irda/donauboe.c +++ b/drivers/net/irda/donauboe.c @@ -1372,7 +1372,7 @@ toshoboe_net_open (struct net_device *dev) return 0; if (request_irq (self->io.irq, toshoboe_interrupt, - SA_SHIRQ | SA_INTERRUPT, dev->name, (void *) self)) + IRQF_SHARED | IRQF_DISABLED, dev->name, (void *) self)) { return -EAGAIN; } @@ -1573,7 +1573,7 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid) self->io.fir_base = self->base; self->io.fir_ext = OBOE_IO_EXTENT; self->io.irq = pci_dev->irq; - self->io.irqflags = SA_SHIRQ | SA_INTERRUPT; + self->io.irqflags = IRQF_SHARED | IRQF_DISABLED; self->speed = self->io.speed = 9600; self->async = 0; diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c index 754297fc8f2..47f6f64d604 100644 --- a/drivers/net/irda/mcs7780.c +++ b/drivers/net/irda/mcs7780.c @@ -101,7 +101,7 @@ static int transceiver_type = MCS_TSC_VISHAY; module_param(transceiver_type, int, 0444); MODULE_PARM_DESC(transceiver_type, "IR transceiver type, see mcs7780.h."); -struct usb_driver mcs_driver = { +static struct usb_driver mcs_driver = { .name = "mcs7780", .probe = mcs_probe, .disconnect = mcs_disconnect, diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index e1aa9910503..afb19e8d95c 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c @@ -12,7 +12,6 @@ * Infra-red driver (SIR/FIR) for the PXA2xx embedded microprocessor * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/init.h> diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c index f530686bd09..8d5a288d797 100644 --- a/drivers/net/irda/sa1100_ir.c +++ b/drivers/net/irda/sa1100_ir.c @@ -18,7 +18,6 @@ * power_leve:level - set the transmitter power level * tx_lpm:0|1 - set transmit low power mode */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/types.h> diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c index d70b9e8d6e6..92d646cc9ed 100644 --- a/drivers/net/irda/vlsi_ir.c +++ b/drivers/net/irda/vlsi_ir.c @@ -21,7 +21,6 @@ * ********************************************************************/ -#include <linux/config.h> #include <linux/module.h> #define DRIVER_NAME "vlsi_ir" @@ -1518,7 +1517,7 @@ static int vlsi_open(struct net_device *ndev) outb(IRINTR_INT_MASK, ndev->base_addr+VLSI_PIO_IRINTR); - if (request_irq(ndev->irq, vlsi_interrupt, SA_SHIRQ, + if (request_irq(ndev->irq, vlsi_interrupt, IRQF_SHARED, drivername, ndev)) { IRDA_WARNING("%s: couldn't get IRQ: %d\n", __FUNCTION__, ndev->irq); diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index 93394d76587..cdc14401cdb 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c @@ -56,7 +56,6 @@ * number of packets outstanding to a remote partition at a time. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/errno.h> diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h index a83ef28dadb..82b67af54c9 100644 --- a/drivers/net/ixgb/ixgb.h +++ b/drivers/net/ixgb/ixgb.h @@ -30,7 +30,6 @@ #define _IXGB_H_ #include <linux/stddef.h> -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <asm/byteorder.h> diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 8bb32f94699..b91e082483f 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c @@ -253,7 +253,7 @@ ixgb_up(struct ixgb_adapter *adapter) #endif if((err = request_irq(adapter->pdev->irq, &ixgb_intr, - SA_SHIRQ | SA_SAMPLE_RANDOM, + IRQF_SHARED | IRQF_SAMPLE_RANDOM, netdev->name, netdev))) { DPRINTK(PROBE, ERR, "Unable to allocate interrupt Error: %d\n", err); diff --git a/drivers/net/ixp2000/caleb.c b/drivers/net/ixp2000/caleb.c index 3595e107df2..7dea5b95012 100644 --- a/drivers/net/ixp2000/caleb.c +++ b/drivers/net/ixp2000/caleb.c @@ -9,7 +9,6 @@ * (at your option) any later version. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/delay.h> #include <asm/io.h> diff --git a/drivers/net/ixp2000/enp2611.c b/drivers/net/ixp2000/enp2611.c index b67f586d739..d3f4235c585 100644 --- a/drivers/net/ixp2000/enp2611.c +++ b/drivers/net/ixp2000/enp2611.c @@ -9,7 +9,6 @@ * (at your option) any later version. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/netdevice.h> diff --git a/drivers/net/ixp2000/ixp2400-msf.c b/drivers/net/ixp2000/ixp2400-msf.c index 48a3a891d3a..9ec38eebfb5 100644 --- a/drivers/net/ixp2000/ixp2400-msf.c +++ b/drivers/net/ixp2000/ixp2400-msf.c @@ -11,7 +11,6 @@ * License, or (at your option) any later version. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> #include <asm/hardware.h> diff --git a/drivers/net/ixp2000/ixpdev.c b/drivers/net/ixp2000/ixpdev.c index fbc2d21020f..6eeb965b4d7 100644 --- a/drivers/net/ixp2000/ixpdev.c +++ b/drivers/net/ixp2000/ixpdev.c @@ -9,7 +9,6 @@ * (at your option) any later version. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/netdevice.h> @@ -236,7 +235,7 @@ static int ixpdev_open(struct net_device *dev) if (!nds_open++) { err = request_irq(IRQ_IXP2000_THDA0, ixpdev_interrupt, - SA_SHIRQ, "ixp2000_eth", nds); + IRQF_SHARED, "ixp2000_eth", nds); if (err) { nds_open--; return err; diff --git a/drivers/net/ixp2000/pm3386.c b/drivers/net/ixp2000/pm3386.c index 5224651c9aa..e08d3f9863b 100644 --- a/drivers/net/ixp2000/pm3386.c +++ b/drivers/net/ixp2000/pm3386.c @@ -9,7 +9,6 @@ * (at your option) any later version. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/delay.h> #include <linux/netdevice.h> diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c index 272d331d29c..661d75b4cad 100644 --- a/drivers/net/jazzsonic.c +++ b/drivers/net/jazzsonic.c @@ -260,7 +260,7 @@ MODULE_DESCRIPTION("Jazz SONIC ethernet driver"); module_param(sonic_debug, int, 0); MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)"); -#define SONIC_IRQ_FLAG SA_INTERRUPT +#define SONIC_IRQ_FLAG IRQF_DISABLED #include "sonic.c" diff --git a/drivers/net/lp486e.c b/drivers/net/lp486e.c index bf3f343ae71..b783a6984ab 100644 --- a/drivers/net/lp486e.c +++ b/drivers/net/lp486e.c @@ -851,7 +851,7 @@ static int i596_open(struct net_device *dev) { int i; - i = request_irq(dev->irq, &i596_interrupt, SA_SHIRQ, dev->name, dev); + i = request_irq(dev->irq, &i596_interrupt, IRQF_SHARED, dev->name, dev); if (i) { printk(KERN_ERR "%s: IRQ %d not free\n", dev->name, dev->irq); return i; diff --git a/drivers/net/mace.c b/drivers/net/mace.c index 77792b28602..f2c0bf89f0c 100644 --- a/drivers/net/mace.c +++ b/drivers/net/mace.c @@ -5,7 +5,6 @@ * Copyright (C) 1996 Paul Mackerras. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/netdevice.h> diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c index bbffb585b3b..07e58f4a291 100644 --- a/drivers/net/mipsnet.c +++ b/drivers/net/mipsnet.c @@ -179,7 +179,7 @@ static int mipsnet_open(struct net_device *dev) pr_debug("%s: mipsnet_open\n", dev->name); err = request_irq(dev->irq, &mipsnet_interrupt, - SA_SHIRQ, dev->name, (void *) dev); + IRQF_SHARED, dev->name, (void *) dev); if (err) { pr_debug("%s: %s(): can't get irq %d\n", diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 625ff61c998..760c61b9886 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c @@ -778,7 +778,7 @@ static int mv643xx_eth_open(struct net_device *dev) int err; err = request_irq(dev->irq, mv643xx_eth_int_handler, - SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); + IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev); if (err) { printk(KERN_ERR "Can not assign IRQ number to MV643XX_eth%d\n", port_num); diff --git a/drivers/net/mv643xx_eth.h b/drivers/net/mv643xx_eth.h index 4262c1da6d4..33c5fafdbbd 100644 --- a/drivers/net/mv643xx_eth.h +++ b/drivers/net/mv643xx_eth.h @@ -258,7 +258,7 @@ struct pkt_info { struct sk_buff *return_info; /* User resource return information */ }; -/* Ethernet port specific infomation */ +/* Ethernet port specific information */ struct mv643xx_mib_counters { u64 good_octets_received; diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index dbdf189436f..72aad42db7b 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c @@ -2413,7 +2413,7 @@ static int myri10ge_resume(struct pci_dev *pdev) pci_enable_device(pdev); pci_set_master(pdev); - status = request_irq(pdev->irq, myri10ge_intr, SA_SHIRQ, + status = request_irq(pdev->irq, myri10ge_intr, IRQF_SHARED, netdev->name, mgp); if (status != 0) { dev_err(&pdev->dev, "failed to allocate IRQ\n"); @@ -2694,7 +2694,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) mgp->msi_enabled = 1; } - status = request_irq(pdev->irq, myri10ge_intr, SA_SHIRQ, + status = request_irq(pdev->irq, myri10ge_intr, IRQF_SHARED, netdev->name, mgp); if (status != 0) { dev_err(&pdev->dev, "failed to allocate IRQ\n"); diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c index d9f616fea3d..1b965a2b56e 100644 --- a/drivers/net/myri_sbus.c +++ b/drivers/net/myri_sbus.c @@ -7,7 +7,6 @@ static char version[] = "myri_sbus.c:v2.0 June 23, 2006 David S. Miller (davem@davemloft.net)\n"; #include <linux/module.h> -#include <linux/config.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/types.h> @@ -1070,7 +1069,7 @@ static int __init myri_ether_init(struct sbus_dev *sdev) /* Register interrupt handler now. */ DET(("Requesting MYRIcom IRQ line.\n")); if (request_irq(dev->irq, &myri_interrupt, - SA_SHIRQ, "MyriCOM Ethernet", (void *) dev)) { + IRQF_SHARED, "MyriCOM Ethernet", (void *) dev)) { printk("MyriCOM: Cannot register interrupt handler.\n"); goto err; } diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index 5657049c216..9df2628be1e 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c @@ -138,7 +138,6 @@ * big endian support with CFG:BEM instead of cpu_to_le32 */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/string.h> @@ -1575,7 +1574,7 @@ static int netdev_open(struct net_device *dev) /* Reset the chip, just in case. */ natsemi_reset(dev); - i = request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev); + i = request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev); if (i) return i; if (netif_msg_ifup(np)) diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c index ced9fdb8335..fa50eb88940 100644 --- a/drivers/net/ne2k-pci.c +++ b/drivers/net/ne2k-pci.c @@ -420,7 +420,7 @@ static int ne2k_pci_set_fdx(struct net_device *dev) static int ne2k_pci_open(struct net_device *dev) { - int ret = request_irq(dev->irq, ei_interrupt, SA_SHIRQ, dev->name, dev); + int ret = request_irq(dev->irq, ei_interrupt, IRQF_SHARED, dev->name, dev); if (ret) return ret; diff --git a/drivers/net/netx-eth.c b/drivers/net/netx-eth.c index b92430c4e3a..b1311ae8267 100644 --- a/drivers/net/netx-eth.c +++ b/drivers/net/netx-eth.c @@ -223,7 +223,7 @@ static int netx_eth_open(struct net_device *ndev) struct netx_eth_priv *priv = netdev_priv(ndev); if (request_irq - (ndev->irq, &netx_eth_interrupt, SA_SHIRQ, ndev->name, ndev)) + (ndev->irq, &netx_eth_interrupt, IRQF_SHARED, ndev->name, ndev)) return -EAGAIN; writel(ndev->dev_addr[0] | diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index 706aed7d717..70429108c40 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c @@ -96,7 +96,6 @@ //#define dprintk printk #define dprintk(x...) do { } while (0) -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/types.h> @@ -1882,7 +1881,7 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_ dev->IMR_cache = 0; - err = request_irq(pci_dev->irq, ns83820_irq, SA_SHIRQ, + err = request_irq(pci_dev->irq, ns83820_irq, IRQF_SHARED, DRV_NAME, ndev); if (err) { printk(KERN_INFO "ns83820: unable to register irq %d\n", diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c index a7bb54df75a..3388ee1313e 100644 --- a/drivers/net/pci-skeleton.c +++ b/drivers/net/pci-skeleton.c @@ -85,7 +85,6 @@ IVc. Errata */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/pci.h> @@ -1076,7 +1075,7 @@ static int netdrv_open (struct net_device *dev) DPRINTK ("ENTER\n"); - retval = request_irq (dev->irq, netdrv_interrupt, SA_SHIRQ, dev->name, dev); + retval = request_irq (dev->irq, netdrv_interrupt, IRQF_SHARED, dev->name, dev); if (retval) { DPRINTK ("EXIT, returning %d\n", retval); return retval; diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 2ea66aca648..297e9f80536 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -535,7 +535,7 @@ static int axnet_open(struct net_device *dev) link->open++; - request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, "axnet_cs", dev); + request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, "axnet_cs", dev); info->link_status = 0x00; init_timer(&info->watchdog); diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index 441de824ab6..48434d7924e 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c @@ -387,7 +387,10 @@ static int com20020_resume(struct pcmcia_device *link) } static struct pcmcia_device_id com20020_ids[] = { - PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.", "PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf), + PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.", + "PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf), + PCMCIA_DEVICE_PROD_ID12("SoHard AG", + "SH ARC PCMCIA", 0xf8991729, 0x69dff0c7), PCMCIA_DEVICE_NULL }; MODULE_DEVICE_TABLE(pcmcia, com20020_ids); diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 661bfe54ff5..0ecebfc31f0 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -998,7 +998,7 @@ static int pcnet_open(struct net_device *dev) link->open++; set_misc_reg(dev); - request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, dev_info, dev); + request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev); info->phy_id = info->eth_phy; info->link_status = 0x00; diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 0e01c75da42..d768f3d1ac2 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c @@ -1541,7 +1541,7 @@ static int pcnet32_open(struct net_device *dev) unsigned long flags; if (request_irq(dev->irq, &pcnet32_interrupt, - lp->shared_irq ? SA_SHIRQ : 0, dev->name, + lp->shared_irq ? IRQF_SHARED : 0, dev->name, (void *)dev)) { return -EAGAIN; } diff --git a/drivers/net/phy/cicada.c b/drivers/net/phy/cicada.c index 7d8d534255c..3efb715c28d 100644 --- a/drivers/net/phy/cicada.c +++ b/drivers/net/phy/cicada.c @@ -13,7 +13,6 @@ * option) any later version. * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c index 5e9002e444c..aa7983f5583 100644 --- a/drivers/net/phy/davicom.c +++ b/drivers/net/phy/davicom.c @@ -13,7 +13,6 @@ * option) any later version. * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c index 3f702c503af..69d2325f848 100644 --- a/drivers/net/phy/lxt.c +++ b/drivers/net/phy/lxt.c @@ -13,7 +13,6 @@ * option) any later version. * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index a2d6386d13b..0ad253282d0 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -13,7 +13,6 @@ * option) any later version. * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 1b236bdf6b9..1dde390c164 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -13,7 +13,6 @@ * option) any later version. * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 33cec2dab94..7d5c2233c25 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -14,7 +14,6 @@ * option) any later version. * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> @@ -557,7 +556,7 @@ int phy_start_interrupts(struct phy_device *phydev) INIT_WORK(&phydev->phy_queue, phy_change, phydev); if (request_irq(phydev->irq, phy_interrupt, - SA_SHIRQ, + IRQF_SHARED, "phy_interrupt", phydev) < 0) { printk(KERN_WARNING "%s: Can't get IRQ %d (PHY)\n", diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 7da0e3dd5fe..1bc1e032c5d 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -14,7 +14,6 @@ * option) any later version. * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> diff --git a/drivers/net/phy/qsemi.c b/drivers/net/phy/qsemi.c index 65d995b02b2..2b50e1739aa 100644 --- a/drivers/net/phy/qsemi.c +++ b/drivers/net/phy/qsemi.c @@ -13,7 +13,6 @@ * option) any later version. * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/string.h> diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index d643a097faa..0ec6e9d57b9 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c @@ -22,13 +22,11 @@ * ==FILEVERSION 20041108== */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/kmod.h> #include <linux/init.h> #include <linux/list.h> -#include <linux/devfs_fs_kernel.h> #include <linux/netdevice.h> #include <linux/poll.h> #include <linux/ppp_defs.h> @@ -863,10 +861,6 @@ static int __init ppp_init(void) goto out_chrdev; } class_device_create(ppp_class, NULL, MKDEV(PPP_MAJOR, 0), NULL, "ppp"); - err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0), - S_IFCHR|S_IRUSR|S_IWUSR, "ppp"); - if (err) - goto out_class; } out: @@ -874,9 +868,6 @@ out: printk(KERN_ERR "failed to register PPP device (%d)\n", err); return err; -out_class: - class_device_destroy(ppp_class, MKDEV(PPP_MAJOR,0)); - class_destroy(ppp_class); out_chrdev: unregister_chrdev(PPP_MAJOR, "ppp"); goto out; @@ -2681,7 +2672,6 @@ static void __exit ppp_cleanup(void) cardmap_destroy(&all_ppp_units); if (unregister_chrdev(PPP_MAJOR, "ppp") != 0) printk(KERN_ERR "PPP: failed to unregister PPP device\n"); - devfs_remove("ppp"); class_device_destroy(ppp_class, MKDEV(PPP_MAJOR, 0)); class_destroy(ppp_class); } diff --git a/drivers/net/ppp_mppe.c b/drivers/net/ppp_mppe.c index 1985d1b57c4..51ff9a9d1bb 100644 --- a/drivers/net/ppp_mppe.c +++ b/drivers/net/ppp_mppe.c @@ -43,7 +43,6 @@ * deprecated in 2.6 */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/version.h> diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 12d1cb289bb..16a0ef1b136 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c @@ -1726,7 +1726,7 @@ static int rtl8169_open(struct net_device *dev) rtl8169_set_rxbufsize(tp, dev); retval = - request_irq(dev->irq, rtl8169_interrupt, SA_SHIRQ, dev->name, dev); + request_irq(dev->irq, rtl8169_interrupt, IRQF_SHARED, dev->name, dev); if (retval < 0) goto out; diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index 19c2df9c86f..c3ed734cbe3 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c @@ -28,7 +28,6 @@ #define RX_DMA_SKBUFF 1 #define PKT_COPY_THRESHOLD 512 -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/errno.h> @@ -1253,7 +1252,7 @@ static int rr_open(struct net_device *dev) readl(®s->HostCtrl); spin_unlock_irqrestore(&rrpriv->lock, flags); - if (request_irq(dev->irq, rr_interrupt, SA_SHIRQ, dev->name, dev)) { + if (request_irq(dev->irq, rr_interrupt, IRQF_SHARED, dev->name, dev)) { printk(KERN_WARNING "%s: Requested IRQ %d is busy\n", dev->name, dev->irq); ecode = -EAGAIN; diff --git a/drivers/net/rrunner.h b/drivers/net/rrunner.h index 10baae55953..2c3c91ebd99 100644 --- a/drivers/net/rrunner.h +++ b/drivers/net/rrunner.h @@ -1,7 +1,6 @@ #ifndef _RRUNNER_H_ #define _RRUNNER_H_ -#include <linux/config.h> #include <linux/interrupt.h> #if ((BITS_PER_LONG != 32) && (BITS_PER_LONG != 64)) diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 3defe5d4f7d..c6b77acb35e 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c @@ -44,7 +44,6 @@ * aggregated as a single large packet ************************************************************************/ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/errno.h> @@ -3762,7 +3761,7 @@ static int s2io_open(struct net_device *dev) /* After proper initialization of H/W, register ISR */ if (sp->intr_type == MSI) { err = request_irq((int) sp->pdev->irq, s2io_msi_handle, - SA_SHIRQ, sp->name, dev); + IRQF_SHARED, sp->name, dev); if (err) { DBG_PRINT(ERR_DBG, "%s: MSI registration \ failed\n", dev->name); @@ -3800,7 +3799,7 @@ failed\n", dev->name, i); } } if (sp->intr_type == INTA) { - err = request_irq((int) sp->pdev->irq, s2io_isr, SA_SHIRQ, + err = request_irq((int) sp->pdev->irq, s2io_isr, IRQF_SHARED, sp->name, dev); if (err) { DBG_PRINT(ERR_DBG, "%s: ISR registration failed\n", @@ -3960,7 +3959,7 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) txdp->Control_2 = 0; #ifdef NETIF_F_TSO mss = skb_shinfo(skb)->gso_size; - if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV4) { + if (skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) { txdp->Control_1 |= TXD_TCP_LSO_EN; txdp->Control_1 |= TXD_TCP_LSO_MSS(mss); } @@ -3980,7 +3979,7 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) } frg_len = skb->len - skb->data_len; - if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4) { + if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP) { int ufo_size; ufo_size = skb_shinfo(skb)->gso_size; @@ -4009,7 +4008,7 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) txdp->Host_Control = (unsigned long) skb; txdp->Control_1 |= TXD_BUFFER0_SIZE(frg_len); - if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4) + if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP) txdp->Control_1 |= TXD_UFO_EN; frg_cnt = skb_shinfo(skb)->nr_frags; @@ -4024,12 +4023,12 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) (sp->pdev, frag->page, frag->page_offset, frag->size, PCI_DMA_TODEVICE); txdp->Control_1 = TXD_BUFFER0_SIZE(frag->size); - if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4) + if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP) txdp->Control_1 |= TXD_UFO_EN; } txdp->Control_1 |= TXD_GATHER_CODE_LAST; - if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4) + if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP) frg_cnt++; /* as Txd0 was used for inband header */ tx_fifo = mac_control->tx_FIFO_start[queue]; @@ -4043,7 +4042,7 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) if (mss) val64 |= TX_FIFO_SPECIAL_FUNC; #endif - if (skb_shinfo(skb)->gso_type == SKB_GSO_UDPV4) + if (skb_shinfo(skb)->gso_type == SKB_GSO_UDP) val64 |= TX_FIFO_SPECIAL_FUNC; writeq(val64, &tx_fifo->List_Control); @@ -7021,6 +7020,9 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) #ifdef NETIF_F_TSO dev->features |= NETIF_F_TSO; #endif +#ifdef NETIF_F_TSO6 + dev->features |= NETIF_F_TSO6; +#endif if (sp->device_type & XFRAME_II_DEVICE) { dev->features |= NETIF_F_UFO; dev->features |= NETIF_F_HW_CSUM; diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h index 3203732a668..c43f5217970 100644 --- a/drivers/net/s2io.h +++ b/drivers/net/s2io.h @@ -652,7 +652,7 @@ typedef struct fifo_info { nic_t *nic; }fifo_info_t; -/* Infomation related to the Tx and Rx FIFOs and Rings of Xena +/* Information related to the Tx and Rx FIFOs and Rings of Xena * is maintained in this structure. */ typedef struct mac_info { diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c index f2be9f83f09..9ab1618e82a 100644 --- a/drivers/net/sb1250-mac.c +++ b/drivers/net/sb1250-mac.c @@ -31,7 +31,6 @@ #include <linux/etherdevice.h> #include <linux/skbuff.h> #include <linux/init.h> -#include <linux/config.h> #include <linux/bitops.h> #include <asm/processor.h> /* Processor type for cache alignment. */ #include <asm/io.h> @@ -2451,7 +2450,7 @@ static int sbmac_open(struct net_device *dev) */ __raw_readq(sc->sbm_isr); - if (request_irq(dev->irq, &sbmac_intr, SA_SHIRQ, dev->name, dev)) + if (request_irq(dev->irq, &sbmac_intr, IRQF_SHARED, dev->name, dev)) return -EBUSY; /* diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c index 88e212043a4..c7832e69f17 100644 --- a/drivers/net/shaper.c +++ b/drivers/net/shaper.c @@ -69,7 +69,6 @@ * 2000/03 Andi Kleen */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/fcntl.h> diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index df39f344765..df0cbebb327 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c @@ -1054,7 +1054,7 @@ static int sis190_open(struct net_device *dev) sis190_request_timer(dev); - rc = request_irq(dev->irq, sis190_interrupt, SA_SHIRQ, dev->name, dev); + rc = request_irq(dev->irq, sis190_interrupt, IRQF_SHARED, dev->name, dev); if (rc < 0) goto err_release_timer_2; diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index d0587417220..29ee7ffedff 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c @@ -1013,7 +1013,7 @@ sis900_open(struct net_device *net_dev) /* Equalizer workaround Rule */ sis630_set_eq(net_dev, sis_priv->chipset_rev); - ret = request_irq(net_dev->irq, &sis900_interrupt, SA_SHIRQ, + ret = request_irq(net_dev->irq, &sis900_interrupt, IRQF_SHARED, net_dev->name, net_dev); if (ret) return ret; diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index f3efbd177ae..ee62845d3ac 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c @@ -570,9 +570,9 @@ SK_BOOL DualNet; spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); if (pAC->GIni.GIMacsFound == 2) { - Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, "sk98lin", dev); + Ret = request_irq(dev->irq, SkGeIsr, IRQF_SHARED, "sk98lin", dev); } else if (pAC->GIni.GIMacsFound == 1) { - Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, + Ret = request_irq(dev->irq, SkGeIsrOnePort, IRQF_SHARED, "sk98lin", dev); } else { printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n", @@ -5073,9 +5073,9 @@ static int skge_resume(struct pci_dev *pdev) pci_enable_device(pdev); pci_set_master(pdev); if (pAC->GIni.GIMacsFound == 2) - ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, "sk98lin", dev); + ret = request_irq(dev->irq, SkGeIsr, IRQF_SHARED, "sk98lin", dev); else - ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, "sk98lin", dev); + ret = request_irq(dev->irq, SkGeIsrOnePort, IRQF_SHARED, "sk98lin", dev); if (ret) { printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq); pAC->AllocFlag &= ~SK_ALLOC_IRQ; diff --git a/drivers/net/sk98lin/skvpd.c b/drivers/net/sk98lin/skvpd.c index 17786056c66..1e662aaebf8 100644 --- a/drivers/net/sk98lin/skvpd.c +++ b/drivers/net/sk98lin/skvpd.c @@ -22,7 +22,7 @@ ******************************************************************************/ /* - Please refer skvpd.txt for infomation how to include this module + Please refer skvpd.txt for information how to include this module */ static const char SysKonnectFileId[] = "@(#)$Id: skvpd.c,v 1.37 2003/01/13 10:42:45 rschmidt Exp $ (C) SK"; diff --git a/drivers/net/sk_mca.c b/drivers/net/sk_mca.c index e5d6d95960c..799e0980193 100644 --- a/drivers/net/sk_mca.c +++ b/drivers/net/sk_mca.c @@ -824,7 +824,7 @@ static int skmca_open(struct net_device *dev) /* register resources - only necessary for IRQ */ result = request_irq(priv->realirq, irq_handler, - SA_SHIRQ | SA_SAMPLE_RANDOM, "sk_mca", dev); + IRQF_SHARED | IRQF_SAMPLE_RANDOM, "sk_mca", dev); if (result != 0) { printk("%s: failed to register irq %d\n", dev->name, dev->irq); diff --git a/drivers/net/skfp/h/sba.h b/drivers/net/skfp/h/sba.h index df716cd5784..638cf0283bc 100644 --- a/drivers/net/skfp/h/sba.h +++ b/drivers/net/skfp/h/sba.h @@ -13,7 +13,7 @@ ******************************************************************************/ /* - * Synchronous Bandwith Allocation (SBA) structs + * Synchronous Bandwidth Allocation (SBA) structs */ #ifndef _SBA_ diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c index c7fb6133047..b5714a60237 100644 --- a/drivers/net/skfp/skfddi.c +++ b/drivers/net/skfp/skfddi.c @@ -497,7 +497,7 @@ static int skfp_open(struct net_device *dev) PRINTK(KERN_INFO "entering skfp_open\n"); /* Register IRQ - support shared interrupts by passing device ptr */ - err = request_irq(dev->irq, (void *) skfp_interrupt, SA_SHIRQ, + err = request_irq(dev->irq, (void *) skfp_interrupt, IRQF_SHARED, dev->name, dev); if (err) return err; diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 19a4a16055d..82200bfaa8e 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -24,7 +24,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/in.h> #include <linux/kernel.h> #include <linux/module.h> @@ -3342,7 +3341,7 @@ static int __devinit skge_probe(struct pci_dev *pdev, goto err_out_free_hw; } - err = request_irq(pdev->irq, skge_intr, SA_SHIRQ, DRV_NAME, hw); + err = request_irq(pdev->irq, skge_intr, IRQF_SHARED, DRV_NAME, hw); if (err) { printk(KERN_ERR PFX "%s: cannot assign irq %d\n", pci_name(pdev), pdev->irq); @@ -3354,8 +3353,8 @@ static int __devinit skge_probe(struct pci_dev *pdev, if (err) goto err_out_free_irq; - printk(KERN_INFO PFX DRV_VERSION " addr 0x%lx irq %d chip %s rev %d\n", - pci_resource_start(pdev, 0), pdev->irq, + printk(KERN_INFO PFX DRV_VERSION " addr 0x%llx irq %d chip %s rev %d\n", + (unsigned long long)pci_resource_start(pdev, 0), pdev->irq, skge_board_name(hw), hw->chip_rev); if ((dev = skge_devinit(hw, 0, using_dac)) == NULL) diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index d3577871be2..418f169a6a3 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -23,7 +23,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/crc32.h> #include <linux/kernel.h> #include <linux/version.h> @@ -3189,7 +3188,7 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw) sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW); - err = request_irq(pdev->irq, sky2_test_intr, SA_SHIRQ, DRV_NAME, hw); + err = request_irq(pdev->irq, sky2_test_intr, IRQF_SHARED, DRV_NAME, hw); if (err) { printk(KERN_ERR PFX "%s: cannot assign irq %d\n", pci_name(pdev), pdev->irq); @@ -3311,9 +3310,9 @@ static int __devinit sky2_probe(struct pci_dev *pdev, if (err) goto err_out_iounmap; - printk(KERN_INFO PFX "v%s addr 0x%lx irq %d Yukon-%s (0x%x) rev %d\n", - DRV_VERSION, pci_resource_start(pdev, 0), pdev->irq, - yukon2_name[hw->chip_id - CHIP_ID_YUKON_XL], + printk(KERN_INFO PFX "v%s addr 0x%llx irq %d Yukon-%s (0x%x) rev %d\n", + DRV_VERSION, (unsigned long long)pci_resource_start(pdev, 0), + pdev->irq, yukon2_name[hw->chip_id - CHIP_ID_YUKON_XL], hw->chip_id, hw->chip_rev); dev = sky2_init_netdev(hw, 0, using_dac); @@ -3349,7 +3348,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, goto err_out_unregister; } - err = request_irq(pdev->irq, sky2_intr, SA_SHIRQ, DRV_NAME, hw); + err = request_irq(pdev->irq, sky2_intr, IRQF_SHARED, DRV_NAME, hw); if (err) { printk(KERN_ERR PFX "%s: cannot assign irq %d\n", pci_name(pdev), pdev->irq); diff --git a/drivers/net/slhc.c b/drivers/net/slhc.c index c6fbb1ede0e..3a1b7131681 100644 --- a/drivers/net/slhc.c +++ b/drivers/net/slhc.c @@ -50,7 +50,6 @@ * driver code belonging close to PPP and SLIP */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/string.h> diff --git a/drivers/net/slip.c b/drivers/net/slip.c index b2e18d28850..1588cb7f6c8 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -55,7 +55,6 @@ */ #define SL_CHECK_TRANSMIT -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> diff --git a/drivers/net/slip.h b/drivers/net/slip.h index ab3efe66a64..29d87dd45a2 100644 --- a/drivers/net/slip.h +++ b/drivers/net/slip.h @@ -22,7 +22,6 @@ #ifndef _LINUX_SLIP_H #define _LINUX_SLIP_H -#include <linux/config.h> #if defined(CONFIG_INET) && defined(CONFIG_SLIP_COMPRESSED) # define SL_INCLUDE_CSLIP diff --git a/drivers/net/smc-ultra.c b/drivers/net/smc-ultra.c index 5b4e8529d4a..45449353a95 100644 --- a/drivers/net/smc-ultra.c +++ b/drivers/net/smc-ultra.c @@ -57,7 +57,6 @@ static const char version[] = "smc-ultra.c:v2.02 2/3/98 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n"; -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/net/smc-ultra32.c b/drivers/net/smc-ultra32.c index ff9bd97746d..85be22a0597 100644 --- a/drivers/net/smc-ultra32.c +++ b/drivers/net/smc-ultra32.c @@ -290,7 +290,7 @@ out: static int ultra32_open(struct net_device *dev) { int ioaddr = dev->base_addr - ULTRA32_NIC_OFFSET; /* ASIC addr */ - int irq_flags = (inb(ioaddr + ULTRA32_CFG5) & 0x08) ? 0 : SA_SHIRQ; + int irq_flags = (inb(ioaddr + ULTRA32_CFG5) & 0x08) ? 0 : IRQF_SHARED; int retval; retval = request_irq(dev->irq, ei_interrupt, irq_flags, dev->name, dev); diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index bdd8702ead5..d37bd860b33 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -2081,7 +2081,7 @@ static int __init smc911x_probe(struct net_device *dev, unsigned long ioaddr) lp->ctl_rspeed = 100; /* Grab the IRQ */ - retval = request_irq(dev->irq, &smc911x_interrupt, SA_SHIRQ, dev->name, dev); + retval = request_irq(dev->irq, &smc911x_interrupt, IRQF_SHARED, dev->name, dev); if (retval) goto err_out; diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 0e9833adf9f..3d8dcb6c875 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c @@ -66,7 +66,6 @@ static const char version[] = #endif -#include <linux/config.h> #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index bf776125ca3..b4028049ed7 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h @@ -207,7 +207,7 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) machine_is_omap_h2() \ || machine_is_omap_h3() \ || (machine_is_omap_innovator() && !cpu_is_omap1510()) \ - ) ? SA_TRIGGER_FALLING : SA_TRIGGER_RISING) + ) ? IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING) #elif defined(CONFIG_SH_SH4202_MICRODEV) @@ -540,7 +540,7 @@ smc_pxa_dma_irq(int dma, void *dummy, struct pt_regs *regs) #endif #ifndef SMC_IRQ_FLAGS -#define SMC_IRQ_FLAGS SA_TRIGGER_RISING +#define SMC_IRQ_FLAGS IRQF_TRIGGER_RISING #endif #ifndef SMC_INTERRUPT_PREAMBLE diff --git a/drivers/net/sonic.h b/drivers/net/sonic.h index cede969a8ba..7f5c4ebcc17 100644 --- a/drivers/net/sonic.h +++ b/drivers/net/sonic.h @@ -22,7 +22,6 @@ #ifndef SONIC_H #define SONIC_H -#include <linux/config.h> /* * SONIC register offsets diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index 394339d5e87..fb1d5a8a45c 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c @@ -21,7 +21,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/compiler.h> #include <linux/crc32.h> #include <linux/delay.h> @@ -1745,7 +1744,7 @@ spider_net_open(struct net_device *netdev) result = -EBUSY; if (request_irq(netdev->irq, spider_net_interrupt, - SA_SHIRQ, netdev->name, netdev)) + IRQF_SHARED, netdev->name, netdev)) goto register_int_failed; spider_net_enable_card(card); diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index c158eedc781..ed1f59901ff 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c @@ -146,7 +146,6 @@ TODO: - fix forced speed/duplexing code (broken a long time ago, when #define DRV_VERSION "1.03+LK1.4.2.1" #define DRV_RELDATE "October 3, 2005" -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/pci.h> @@ -1071,7 +1070,7 @@ static int netdev_open(struct net_device *dev) /* Do we ever need to reset the chip??? */ - retval = request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev); + retval = request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev); if (retval) return retval; diff --git a/drivers/net/stnic.c b/drivers/net/stnic.c index b6dfdf8f44d..74228348995 100644 --- a/drivers/net/stnic.c +++ b/drivers/net/stnic.c @@ -7,7 +7,6 @@ * Copyright (C) 1999 kaz Kojima */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c index a2fad50437e..2dcadb169a2 100644 --- a/drivers/net/sun3lance.c +++ b/drivers/net/sun3lance.c @@ -341,7 +341,7 @@ static int __init lance_probe( struct net_device *dev) REGA(CSR0) = CSR0_STOP; - request_irq(LANCE_IRQ, lance_interrupt, SA_INTERRUPT, "SUN3 Lance", dev); + request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev); dev->irq = (unsigned short)LANCE_IRQ; diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c index 7127f0f36f0..d4689151076 100644 --- a/drivers/net/sunbmac.c +++ b/drivers/net/sunbmac.c @@ -918,7 +918,7 @@ static int bigmac_open(struct net_device *dev) struct bigmac *bp = (struct bigmac *) dev->priv; int ret; - ret = request_irq(dev->irq, &bigmac_interrupt, SA_SHIRQ, dev->name, bp); + ret = request_irq(dev->irq, &bigmac_interrupt, IRQF_SHARED, dev->name, bp); if (ret) { printk(KERN_ERR "BIGMAC: Can't order irq %d to go.\n", dev->irq); return ret; diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index f13b2a195c7..643fceae3db 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c @@ -870,7 +870,7 @@ static int netdev_open(struct net_device *dev) /* Do we need to reset the chip??? */ - i = request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev); + i = request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev); if (i) return i; diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 5248670d29f..b70bbd74897 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c @@ -2220,7 +2220,7 @@ static int gem_do_start(struct net_device *dev) spin_unlock_irqrestore(&gp->lock, flags); if (request_irq(gp->pdev->irq, gem_interrupt, - SA_SHIRQ, dev->name, (void *)dev)) { + IRQF_SHARED, dev->name, (void *)dev)) { printk(KERN_ERR "%s: failed to request irq !\n", gp->dev->name); spin_lock_irqsave(&gp->lock, flags); diff --git a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c index 9282b4b0c02..278c7cb2221 100644 --- a/drivers/net/sungem_phy.c +++ b/drivers/net/sungem_phy.c @@ -19,7 +19,6 @@ * of darwin, still need to reverse engineer that */ -#include <linux/config.h> #include <linux/module.h> diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index c33ead3470d..8673fd4c08c 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c @@ -13,7 +13,6 @@ * argument : macaddr=0x00,0x10,0x20,0x30,0x40,0x50 */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> @@ -2195,7 +2194,7 @@ static int happy_meal_open(struct net_device *dev) */ if ((hp->happy_flags & (HFLAG_QUATTRO|HFLAG_PCI)) != HFLAG_QUATTRO) { if (request_irq(dev->irq, &happy_meal_interrupt, - SA_SHIRQ, dev->name, (void *)dev)) { + IRQF_SHARED, dev->name, (void *)dev)) { HMD(("EAGAIN\n")); printk(KERN_ERR "happy_meal(SBUS): Can't order irq %d to go.\n", dev->irq); @@ -2523,7 +2522,7 @@ static struct ethtool_ops hme_ethtool_ops = { static int hme_version_printed; #ifdef CONFIG_SBUS -void __init quattro_get_ranges(struct quattro *qp) +void __devinit quattro_get_ranges(struct quattro *qp) { struct sbus_dev *sdev = qp->quattro_dev; int err; @@ -2539,7 +2538,7 @@ void __init quattro_get_ranges(struct quattro *qp) qp->nranges = (err / sizeof(struct linux_prom_ranges)); } -static void __init quattro_apply_ranges(struct quattro *qp, struct happy_meal *hp) +static void __devinit quattro_apply_ranges(struct quattro *qp, struct happy_meal *hp) { struct sbus_dev *sdev = hp->happy_dev; int rng; @@ -2566,7 +2565,7 @@ static void __init quattro_apply_ranges(struct quattro *qp, struct happy_meal *h * * Return NULL on failure. */ -static struct quattro * __init quattro_sbus_find(struct sbus_dev *goal_sdev) +static struct quattro * __devinit quattro_sbus_find(struct sbus_dev *goal_sdev) { struct sbus_dev *sdev; struct quattro *qp; @@ -2609,7 +2608,7 @@ static void __init quattro_sbus_register_irqs(void) err = request_irq(sdev->irqs[0], quattro_sbus_interrupt, - SA_SHIRQ, "Quattro", + IRQF_SHARED, "Quattro", qp); if (err != 0) { printk(KERN_ERR "Quattro: Fatal IRQ registery error %d.\n", err); @@ -2618,7 +2617,7 @@ static void __init quattro_sbus_register_irqs(void) } } -static void __devexit quattro_sbus_free_irqs(void) +static void quattro_sbus_free_irqs(void) { struct quattro *qp; @@ -2662,7 +2661,7 @@ static struct quattro * __init quattro_pci_find(struct pci_dev *pdev) #endif /* CONFIG_PCI */ #ifdef CONFIG_SBUS -static int __init happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe) +static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe) { struct device_node *dp = sdev->ofdev.node; struct quattro *qp = NULL; diff --git a/drivers/net/sunhme.h b/drivers/net/sunhme.h index 9b7ccaeeee8..90f446db9ba 100644 --- a/drivers/net/sunhme.h +++ b/drivers/net/sunhme.h @@ -8,7 +8,6 @@ #ifndef _SUNHME_H #define _SUNHME_H -#include <linux/config.h> #include <linux/pci.h> /* Happy Meal global registers. */ diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c index 2c239ab63a8..1ef9fd39a79 100644 --- a/drivers/net/sunlance.c +++ b/drivers/net/sunlance.c @@ -71,7 +71,6 @@ static char lancestr[] = "LANCE"; -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> @@ -931,7 +930,7 @@ static int lance_open(struct net_device *dev) STOP_LANCE(lp); - if (request_irq(dev->irq, &lance_interrupt, SA_SHIRQ, + if (request_irq(dev->irq, &lance_interrupt, IRQF_SHARED, lancestr, (void *) dev)) { printk(KERN_ERR "Lance: Can't get irq %d\n", dev->irq); return -EAGAIN; diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c index 9da6d5b8717..817a40b6663 100644 --- a/drivers/net/sunqe.c +++ b/drivers/net/sunqe.c @@ -811,7 +811,7 @@ static struct sunqec * __init get_qec(struct sbus_dev *child_sdev) qec_init_once(qecp, qec_sdev); if (request_irq(qec_sdev->irqs[0], &qec_interrupt, - SA_SHIRQ, "qec", (void *) qecp)) { + IRQF_SHARED, "qec", (void *) qecp)) { printk(KERN_ERR "qec: Can't register irq.\n"); goto fail; } diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c index c2ec9fd8c31..8b53ded66d3 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c @@ -880,7 +880,7 @@ tc35815_open(struct net_device *dev) */ if (dev->irq == 0 || - request_irq(dev->irq, &tc35815_interrupt, SA_SHIRQ, cardname, dev)) { + request_irq(dev->irq, &tc35815_interrupt, IRQF_SHARED, cardname, dev)) { return -EAGAIN; } diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 35f93163875..e5e1b296293 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -15,7 +15,6 @@ * notice is accompanying it. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> @@ -69,8 +68,8 @@ #define DRV_MODULE_NAME "tg3" #define PFX DRV_MODULE_NAME ": " -#define DRV_MODULE_VERSION "3.60" -#define DRV_MODULE_RELDATE "June 17, 2006" +#define DRV_MODULE_VERSION "3.61" +#define DRV_MODULE_RELDATE "June 29, 2006" #define TG3_DEF_MAC_MODE 0 #define TG3_DEF_RX_MODE 0 @@ -3195,7 +3194,7 @@ static int tg3_vlan_rx(struct tg3 *tp, struct sk_buff *skb, u16 vlan_tag) */ static int tg3_rx(struct tg3 *tp, int budget) { - u32 work_mask; + u32 work_mask, rx_std_posted = 0; u32 sw_idx = tp->rx_rcb_ptr; u16 hw_idx; int received; @@ -3222,6 +3221,7 @@ static int tg3_rx(struct tg3 *tp, int budget) mapping); skb = tp->rx_std_buffers[desc_idx].skb; post_ptr = &tp->rx_std_ptr; + rx_std_posted++; } else if (opaque_key == RXD_OPAQUE_RING_JUMBO) { dma_addr = pci_unmap_addr(&tp->rx_jumbo_buffers[desc_idx], mapping); @@ -3309,6 +3309,15 @@ static int tg3_rx(struct tg3 *tp, int budget) next_pkt: (*post_ptr)++; + + if (unlikely(rx_std_posted >= tp->rx_std_max_post)) { + u32 idx = *post_ptr % TG3_RX_RING_SIZE; + + tw32_rx_mbox(MAILBOX_RCV_STD_PROD_IDX + + TG3_64BIT_REG_LOW, idx); + work_mask &= ~RXD_OPAQUE_RING_STD; + rx_std_posted = 0; + } next_pkt_nopost: sw_idx++; sw_idx %= TG3_RX_RCB_RING_SIZE(tp); @@ -3870,6 +3879,40 @@ out_unlock: return NETDEV_TX_OK; } +#if TG3_TSO_SUPPORT != 0 +static int tg3_start_xmit_dma_bug(struct sk_buff *, struct net_device *); + +/* Use GSO to workaround a rare TSO bug that may be triggered when the + * TSO header is greater than 80 bytes. + */ +static int tg3_tso_bug(struct tg3 *tp, struct sk_buff *skb) +{ + struct sk_buff *segs, *nskb; + + /* Estimate the number of fragments in the worst case */ + if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->gso_segs * 3))) { + netif_stop_queue(tp->dev); + return NETDEV_TX_BUSY; + } + + segs = skb_gso_segment(skb, tp->dev->features & ~NETIF_F_TSO); + if (unlikely(IS_ERR(segs))) + goto tg3_tso_bug_end; + + do { + nskb = segs; + segs = segs->next; + nskb->next = NULL; + tg3_start_xmit_dma_bug(nskb, tp->dev); + } while (segs); + +tg3_tso_bug_end: + dev_kfree_skb(skb); + + return NETDEV_TX_OK; +} +#endif + /* hard_start_xmit for devices that have the 4G bug and/or 40-bit bug and * support TG3_FLG2_HW_TSO_1 or firmware TSO only. */ @@ -3906,7 +3949,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) mss = 0; if (skb->len > (tp->dev->mtu + ETH_HLEN) && (mss = skb_shinfo(skb)->gso_size) != 0) { - int tcp_opt_len, ip_tcp_len; + int tcp_opt_len, ip_tcp_len, hdr_len; if (skb_header_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) { @@ -3917,11 +3960,16 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev) tcp_opt_len = ((skb->h.th->doff - 5) * 4); ip_tcp_len = (skb->nh.iph->ihl * 4) + sizeof(struct tcphdr); + hdr_len = ip_tcp_len + tcp_opt_len; + if (unlikely((ETH_HLEN + hdr_len) > 80) && + (tp->tg3_flags2 & TG3_FLG2_HW_TSO_1_BUG)) + return (tg3_tso_bug(tp, skb)); + base_flags |= (TXD_FLAG_CPU_PRE_DMA | TXD_FLAG_CPU_POST_DMA); skb->nh.iph->check = 0; - skb->nh.iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len); + skb->nh.iph->tot_len = htons(mss + hdr_len); if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) { skb->h.th->check = 0; base_flags &= ~TXD_FLAG_TCPUDP_CSUM; @@ -5981,7 +6029,13 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) } /* Setup replenish threshold. */ - tw32(RCVBDI_STD_THRESH, tp->rx_pending / 8); + val = tp->rx_pending / 8; + if (val == 0) + val = 1; + else if (val > tp->rx_std_max_post) + val = tp->rx_std_max_post; + + tw32(RCVBDI_STD_THRESH, val); /* Initialize TG3_BDINFO's at: * RCVDBDI_STD_BD: standard eth size rx ring @@ -6141,8 +6195,12 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) #endif /* Receive/send statistics. */ - if ((rdmac_mode & RDMAC_MODE_FIFO_SIZE_128) && - (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) { + if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) { + val = tr32(RCVLPC_STATS_ENABLE); + val &= ~RCVLPC_STATSENAB_DACK_FIX; + tw32(RCVLPC_STATS_ENABLE, val); + } else if ((rdmac_mode & RDMAC_MODE_FIFO_SIZE_128) && + (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE)) { val = tr32(RCVLPC_STATS_ENABLE); val &= ~RCVLPC_STATSENAB_LNGBRST_RFIX; tw32(RCVLPC_STATS_ENABLE, val); @@ -6644,12 +6702,12 @@ static int tg3_request_irq(struct tg3 *tp) fn = tg3_msi; if (tp->tg3_flags2 & TG3_FLG2_1SHOT_MSI) fn = tg3_msi_1shot; - flags = SA_SAMPLE_RANDOM; + flags = IRQF_SAMPLE_RANDOM; } else { fn = tg3_interrupt; if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) fn = tg3_interrupt_tagged; - flags = SA_SHIRQ | SA_SAMPLE_RANDOM; + flags = IRQF_SHARED | IRQF_SAMPLE_RANDOM; } return (request_irq(tp->pdev->irq, fn, flags, dev->name, dev)); } @@ -6668,7 +6726,7 @@ static int tg3_test_interrupt(struct tg3 *tp) free_irq(tp->pdev->irq, dev); err = request_irq(tp->pdev->irq, tg3_test_isr, - SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev); + IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev); if (err) return err; @@ -8738,6 +8796,9 @@ static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) { struct tg3 *tp = netdev_priv(dev); + if (netif_running(dev)) + tg3_netif_stop(tp); + tg3_full_lock(tp, 0); tp->vlgrp = grp; @@ -8746,16 +8807,25 @@ static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) __tg3_set_rx_mode(dev); tg3_full_unlock(tp); + + if (netif_running(dev)) + tg3_netif_start(tp); } static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) { struct tg3 *tp = netdev_priv(dev); + if (netif_running(dev)) + tg3_netif_stop(tp); + tg3_full_lock(tp, 0); if (tp->vlgrp) tp->vlgrp->vlan_devices[vid] = NULL; tg3_full_unlock(tp); + + if (netif_running(dev)) + tg3_netif_start(tp); } #endif @@ -10160,8 +10230,14 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) { tp->tg3_flags2 |= TG3_FLG2_HW_TSO_2; tp->tg3_flags2 |= TG3_FLG2_1SHOT_MSI; - } else - tp->tg3_flags2 |= TG3_FLG2_HW_TSO_1; + } else { + tp->tg3_flags2 |= TG3_FLG2_HW_TSO_1 | + TG3_FLG2_HW_TSO_1_BUG; + if (GET_ASIC_REV(tp->pci_chip_rev_id) == + ASIC_REV_5750 && + tp->pci_chip_rev_id >= CHIPREV_ID_5750_C2) + tp->tg3_flags2 &= ~TG3_FLG2_HW_TSO_1_BUG; + } } if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705 && @@ -10533,6 +10609,16 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) (tp->tg3_flags & TG3_FLAG_PCIX_MODE) != 0) tp->rx_offset = 0; + tp->rx_std_max_post = TG3_RX_RING_SIZE; + + /* Increment the rx prod index on the rx std ring by at most + * 8 for these chips to workaround hw errata. + */ + if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 || + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || + GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755) + tp->rx_std_max_post = 8; + /* By default, disable wake-on-lan. User can change this * using ETHTOOL_SWOL. */ diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 8209da5dd15..ba2c98711c8 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h @@ -125,6 +125,7 @@ #define CHIPREV_ID_5750_A0 0x4000 #define CHIPREV_ID_5750_A1 0x4001 #define CHIPREV_ID_5750_A3 0x4003 +#define CHIPREV_ID_5750_C2 0x4202 #define CHIPREV_ID_5752_A0_HW 0x5000 #define CHIPREV_ID_5752_A0 0x6000 #define CHIPREV_ID_5752_A1 0x6001 @@ -760,6 +761,7 @@ #define RCVLPC_STATSCTRL_ENABLE 0x00000001 #define RCVLPC_STATSCTRL_FASTUPD 0x00000002 #define RCVLPC_STATS_ENABLE 0x00002018 +#define RCVLPC_STATSENAB_DACK_FIX 0x00040000 #define RCVLPC_STATSENAB_LNGBRST_RFIX 0x00400000 #define RCVLPC_STATS_INCMASK 0x0000201c /* 0x2020 --> 0x2100 unused */ @@ -2137,6 +2139,7 @@ struct tg3 { struct tg3_rx_buffer_desc *rx_std; struct ring_info *rx_std_buffers; dma_addr_t rx_std_mapping; + u32 rx_std_max_post; struct tg3_rx_buffer_desc *rx_jumbo; struct ring_info *rx_jumbo_buffers; @@ -2191,7 +2194,7 @@ struct tg3 { #define TG3_FLAG_INIT_COMPLETE 0x80000000 u32 tg3_flags2; #define TG3_FLG2_RESTART_TIMER 0x00000001 -/* 0x00000002 available */ +#define TG3_FLG2_HW_TSO_1_BUG 0x00000002 #define TG3_FLG2_NO_ETH_WIRE_SPEED 0x00000004 #define TG3_FLG2_IS_5788 0x00000008 #define TG3_FLG2_MAX_RXPEND_64 0x00000010 diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c index 12076f8f942..23c0017f25a 100644 --- a/drivers/net/tlan.c +++ b/drivers/net/tlan.c @@ -943,7 +943,7 @@ static int TLan_Open( struct net_device *dev ) int err; priv->tlanRev = TLan_DioRead8( dev->base_addr, TLAN_DEF_REVISION ); - err = request_irq( dev->irq, TLan_HandleInterrupt, SA_SHIRQ, TLanSignature, dev ); + err = request_irq( dev->irq, TLan_HandleInterrupt, IRQF_SHARED, TLanSignature, dev ); if ( err ) { printk(KERN_ERR "TLAN: Cannot open %s because IRQ %d is already in use.\n", dev->name, dev->irq ); diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c index 41e0cd8f478..465921e3874 100644 --- a/drivers/net/tokenring/3c359.c +++ b/drivers/net/tokenring/3c359.c @@ -42,7 +42,6 @@ #define XL_DEBUG 0 -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> @@ -577,7 +576,7 @@ static int xl_open(struct net_device *dev) u16 switchsettings, switchsettings_eeprom ; - if(request_irq(dev->irq, &xl_interrupt, SA_SHIRQ , "3c359", dev)) { + if(request_irq(dev->irq, &xl_interrupt, IRQF_SHARED , "3c359", dev)) { return -EAGAIN; } diff --git a/drivers/net/tokenring/abyss.c b/drivers/net/tokenring/abyss.c index 649d8ea354f..1bdd3beefbe 100644 --- a/drivers/net/tokenring/abyss.c +++ b/drivers/net/tokenring/abyss.c @@ -123,7 +123,7 @@ static int __devinit abyss_attach(struct pci_dev *pdev, const struct pci_device_ goto err_out_trdev; } - ret = request_irq(pdev->irq, tms380tr_interrupt, SA_SHIRQ, + ret = request_irq(pdev->irq, tms380tr_interrupt, IRQF_SHARED, dev->name, dev); if (ret) goto err_out_region; diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c index c58a4c31d0d..28d968ffd5d 100644 --- a/drivers/net/tokenring/lanstreamer.c +++ b/drivers/net/tokenring/lanstreamer.c @@ -100,7 +100,6 @@ #define STREAMER_IOCTL 0 -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> @@ -602,7 +601,7 @@ static int streamer_open(struct net_device *dev) rc=streamer_reset(dev); } - if (request_irq(dev->irq, &streamer_interrupt, SA_SHIRQ, "lanstreamer", dev)) { + if (request_irq(dev->irq, &streamer_interrupt, IRQF_SHARED, "lanstreamer", dev)) { return -EAGAIN; } #if STREAMER_DEBUG diff --git a/drivers/net/tokenring/madgemc.c b/drivers/net/tokenring/madgemc.c index 19e6f4dfd69..666bbaaae82 100644 --- a/drivers/net/tokenring/madgemc.c +++ b/drivers/net/tokenring/madgemc.c @@ -311,7 +311,7 @@ static int __devinit madgemc_probe(struct device *device) */ outb(0, dev->base_addr + MC_CONTROL_REG0); /* sanity */ madgemc_setsifsel(dev, 1); - if (request_irq(dev->irq, madgemc_interrupt, SA_SHIRQ, + if (request_irq(dev->irq, madgemc_interrupt, IRQF_SHARED, "madgemc", dev)) { ret = -EBUSY; goto getout3; diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c index c3cb8d26cfe..85831484bc4 100644 --- a/drivers/net/tokenring/olympic.c +++ b/drivers/net/tokenring/olympic.c @@ -80,7 +80,6 @@ #define OLYMPIC_DEBUG 0 -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> @@ -446,7 +445,7 @@ static int olympic_open(struct net_device *dev) olympic_init(dev); - if(request_irq(dev->irq, &olympic_interrupt, SA_SHIRQ , "olympic", dev)) { + if(request_irq(dev->irq, &olympic_interrupt, IRQF_SHARED , "olympic", dev)) { return -EAGAIN; } diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c index 67d2b596ce2..cd2e0251e2b 100644 --- a/drivers/net/tokenring/smctr.c +++ b/drivers/net/tokenring/smctr.c @@ -29,7 +29,6 @@ */ #include <linux/module.h> -#include <linux/config.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/fcntl.h> @@ -532,7 +531,7 @@ static int __init smctr_chk_mca(struct net_device *dev) dev->irq = 15; break; } - if (request_irq(dev->irq, smctr_interrupt, SA_SHIRQ, smctr_name, dev)) { + if (request_irq(dev->irq, smctr_interrupt, IRQF_SHARED, smctr_name, dev)) { release_region(dev->base_addr, SMCTR_IO_EXTENT); return -ENODEV; } @@ -1062,7 +1061,7 @@ static int __init smctr_chk_isa(struct net_device *dev) goto out2; } - if (request_irq(dev->irq, smctr_interrupt, SA_SHIRQ, smctr_name, dev)) + if (request_irq(dev->irq, smctr_interrupt, IRQF_SHARED, smctr_name, dev)) goto out2; /* Get 58x Rom Base */ diff --git a/drivers/net/tokenring/smctr_firmware.h b/drivers/net/tokenring/smctr_firmware.h index 48994b043b7..292e50ddf01 100644 --- a/drivers/net/tokenring/smctr_firmware.h +++ b/drivers/net/tokenring/smctr_firmware.h @@ -17,7 +17,6 @@ * - Jay Schulist <jschlst@samba.org> */ -#include <linux/config.h> #if defined(CONFIG_SMCTR) || defined(CONFIG_SMCTR_MODULE) diff --git a/drivers/net/tokenring/tmspci.c b/drivers/net/tokenring/tmspci.c index ab47c0547a3..7d3e270c4f4 100644 --- a/drivers/net/tokenring/tmspci.c +++ b/drivers/net/tokenring/tmspci.c @@ -122,7 +122,7 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic goto err_out_trdev; } - ret = request_irq(pdev->irq, tms380tr_interrupt, SA_SHIRQ, + ret = request_irq(pdev->irq, tms380tr_interrupt, IRQF_SHARED, dev->name, dev); if (ret) goto err_out_region; diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 5f743b97294..d05c5aa254e 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c @@ -31,7 +31,6 @@ #define DRV_VERSION "0.7" #define DRV_RELDATE "Mar 17, 2004" -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/netdevice.h> @@ -1372,7 +1371,7 @@ static int de_open (struct net_device *dev) dw32(IntrMask, 0); - rc = request_irq(dev->irq, de_interrupt, SA_SHIRQ, dev->name, dev); + rc = request_irq(dev->irq, de_interrupt, IRQF_SHARED, dev->name, dev); if (rc) { printk(KERN_ERR "%s: IRQ %d request failure, err=%d\n", dev->name, dev->irq, rc); @@ -2007,8 +2006,8 @@ static int __init de_init_one (struct pci_dev *pdev, } if (pci_resource_len(pdev, 1) < DE_REGS_SIZE) { rc = -EIO; - printk(KERN_ERR PFX "MMIO resource (%lx) too small on pci dev %s\n", - pci_resource_len(pdev, 1), pci_name(pdev)); + printk(KERN_ERR PFX "MMIO resource (%llx) too small on pci dev %s\n", + (unsigned long long)pci_resource_len(pdev, 1), pci_name(pdev)); goto err_out_res; } @@ -2016,8 +2015,9 @@ static int __init de_init_one (struct pci_dev *pdev, regs = ioremap_nocache(pciaddr, DE_REGS_SIZE); if (!regs) { rc = -EIO; - printk(KERN_ERR PFX "Cannot map PCI MMIO (%lx@%lx) on pci dev %s\n", - pci_resource_len(pdev, 1), pciaddr, pci_name(pdev)); + printk(KERN_ERR PFX "Cannot map PCI MMIO (%llx@%lx) on pci dev %s\n", + (unsigned long long)pci_resource_len(pdev, 1), + pciaddr, pci_name(pdev)); goto err_out_res; } dev->base_addr = (unsigned long) regs; diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index da8bd0d62a3..75ff14a5523 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c @@ -292,7 +292,7 @@ 0.41 21-Mar-96 Don't check for get_hw_addr checksum unless DEC card only <niles@axp745gsfc.nasa.gov> Fix for multiple PCI cards reported by <jos@xos.nl> - Duh, put the SA_SHIRQ flag into request_interrupt(). + Duh, put the IRQF_SHARED flag into request_interrupt(). Fix SMC ethernet address in enet_det[]. Print chip name instead of "UNKNOWN" during boot. 0.42 26-Apr-96 Fix MII write TA bit error. @@ -353,7 +353,7 @@ infoblocks. Added DC21142 and DC21143 functions. Added byte counters from <phil@tazenda.demon.co.uk> - Added SA_INTERRUPT temporary fix from + Added IRQF_DISABLED temporary fix from <mjacob@feral.com>. 0.53 12-Nov-97 Fix the *_probe() to include 'eth??' name during module load: bug reported by @@ -443,7 +443,6 @@ ========================================================================= */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/string.h> @@ -1320,10 +1319,10 @@ de4x5_open(struct net_device *dev) lp->state = OPEN; de4x5_dbg_open(dev); - if (request_irq(dev->irq, (void *)de4x5_interrupt, SA_SHIRQ, + if (request_irq(dev->irq, (void *)de4x5_interrupt, IRQF_SHARED, lp->adapter_name, dev)) { printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq); - if (request_irq(dev->irq, de4x5_interrupt, SA_INTERRUPT | SA_SHIRQ, + if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED, lp->adapter_name, dev)) { printk("\n Cannot get IRQ- reconfigure your hardware.\n"); disable_ast(dev); diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index ba5b112093f..4e5b0f2acc3 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c @@ -506,7 +506,7 @@ static int dmfe_open(struct DEVICE *dev) DMFE_DBUG(0, "dmfe_open", 0); - ret = request_irq(dev->irq, &dmfe_interrupt, SA_SHIRQ, dev->name, dev); + ret = request_irq(dev->irq, &dmfe_interrupt, IRQF_SHARED, dev->name, dev); if (ret) return ret; diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c index da4f7593c50..99ccf2ebb34 100644 --- a/drivers/net/tulip/interrupt.c +++ b/drivers/net/tulip/interrupt.c @@ -16,7 +16,6 @@ #include <linux/pci.h> #include "tulip.h" -#include <linux/config.h> #include <linux/etherdevice.h> int tulip_rx_copybreak; diff --git a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h index d25020da679..3bcfbf3d23e 100644 --- a/drivers/net/tulip/tulip.h +++ b/drivers/net/tulip/tulip.h @@ -16,7 +16,6 @@ #ifndef __NET_TULIP_H__ #define __NET_TULIP_H__ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/spinlock.h> diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index e0de66739a4..7351831f57c 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c @@ -14,7 +14,6 @@ */ -#include <linux/config.h> #define DRV_NAME "tulip" #ifdef CONFIG_TULIP_NAPI @@ -490,7 +489,7 @@ tulip_open(struct net_device *dev) { int retval; - if ((retval = request_irq(dev->irq, &tulip_interrupt, SA_SHIRQ, dev->name, dev))) + if ((retval = request_irq(dev->irq, &tulip_interrupt, IRQF_SHARED, dev->name, dev))) return retval; tulip_init_ring (dev); @@ -1350,10 +1349,10 @@ static int __devinit tulip_init_one (struct pci_dev *pdev, SET_MODULE_OWNER(dev); SET_NETDEV_DEV(dev, &pdev->dev); if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) { - printk (KERN_ERR PFX "%s: I/O region (0x%lx@0x%lx) too small, " + printk (KERN_ERR PFX "%s: I/O region (0x%llx@0x%llx) too small, " "aborting\n", pci_name(pdev), - pci_resource_len (pdev, 0), - pci_resource_start (pdev, 0)); + (unsigned long long)pci_resource_len (pdev, 0), + (unsigned long long)pci_resource_start (pdev, 0)); goto err_out_free_netdev; } @@ -1771,7 +1770,7 @@ static int tulip_resume(struct pci_dev *pdev) pci_enable_device(pdev); - if ((retval = request_irq(dev->irq, &tulip_interrupt, SA_SHIRQ, dev->name, dev))) { + if ((retval = request_irq(dev->irq, &tulip_interrupt, IRQF_SHARED, dev->name, dev))) { printk (KERN_ERR "tulip: request_irq failed in resume\n"); return retval; } diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c index 8b3a28f53c3..fd64b2b3e99 100644 --- a/drivers/net/tulip/uli526x.c +++ b/drivers/net/tulip/uli526x.c @@ -436,7 +436,7 @@ static int uli526x_open(struct net_device *dev) ULI526X_DBUG(0, "uli526x_open", 0); - ret = request_irq(dev->irq, &uli526x_interrupt, SA_SHIRQ, dev->name, dev); + ret = request_irq(dev->irq, &uli526x_interrupt, IRQF_SHARED, dev->name, dev); if (ret) return ret; diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index 602a6e5002a..b4c0d101a7d 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c @@ -658,7 +658,7 @@ static int netdev_open(struct net_device *dev) iowrite32(0x00000001, ioaddr + PCIBusCfg); /* Reset */ netif_device_detach(dev); - i = request_irq(dev->irq, &intr_handler, SA_SHIRQ, dev->name, dev); + i = request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev); if (i) goto out_err; diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c index 63c2175ed13..f874e4f6ccf 100644 --- a/drivers/net/tulip/xircom_cb.c +++ b/drivers/net/tulip/xircom_cb.c @@ -457,7 +457,7 @@ static int xircom_open(struct net_device *dev) int retval; enter("xircom_open"); printk(KERN_INFO "xircom cardbus adaptor found, registering as %s, using irq %i \n",dev->name,dev->irq); - retval = request_irq(dev->irq, &xircom_interrupt, SA_SHIRQ, dev->name, dev); + retval = request_irq(dev->irq, &xircom_interrupt, IRQF_SHARED, dev->name, dev); if (retval) { leave("xircom_open - No IRQ"); return retval; diff --git a/drivers/net/tulip/xircom_tulip_cb.c b/drivers/net/tulip/xircom_tulip_cb.c index 887d7245fe7..091ebb7a62f 100644 --- a/drivers/net/tulip/xircom_tulip_cb.c +++ b/drivers/net/tulip/xircom_tulip_cb.c @@ -98,7 +98,6 @@ static int csr0 = 0x00A00000 | 0x4800; /* PCI registers */ #define PCI_POWERMGMT 0x40 -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> @@ -808,7 +807,7 @@ xircom_open(struct net_device *dev) { struct xircom_private *tp = netdev_priv(dev); - if (request_irq(dev->irq, &xircom_interrupt, SA_SHIRQ, dev->name, dev)) + if (request_irq(dev->irq, &xircom_interrupt, IRQF_SHARED, dev->name, dev)) return -EAGAIN; xircom_up(dev); diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 6c62d5c8826..329d9feb9b8 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -39,7 +39,6 @@ #define DRV_DESCRIPTION "Universal TUN/TAP device driver" #define DRV_COPYRIGHT "(C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>" -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/kernel.h> @@ -780,7 +779,6 @@ static struct miscdevice tun_miscdev = { .minor = TUN_MINOR, .name = "tun", .fops = &tun_fops, - .devfs_name = "net/tun", }; /* ethtool interface */ diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index e49e8b520c2..063816f2b11 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c @@ -2131,7 +2131,7 @@ typhoon_open(struct net_device *dev) goto out_sleep; } - err = request_irq(dev->irq, &typhoon_interrupt, SA_SHIRQ, + err = request_irq(dev->irq, &typhoon_interrupt, IRQF_SHARED, dev->name, dev); if(err < 0) goto out_sleep; @@ -2568,9 +2568,10 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) pci_set_drvdata(pdev, dev); - printk(KERN_INFO "%s: %s at %s 0x%lx, ", + printk(KERN_INFO "%s: %s at %s 0x%llx, ", dev->name, typhoon_card_info[card_id].name, - use_mmio ? "MMIO" : "IO", pci_resource_start(pdev, use_mmio)); + use_mmio ? "MMIO" : "IO", + (unsigned long long)pci_resource_start(pdev, use_mmio)); for(i = 0; i < 5; i++) printk("%2.2x:", dev->dev_addr[i]); printk("%2.2x\n", dev->dev_addr[i]); diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index c80a4f1d5f7..98b6f3207d3 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c @@ -1210,7 +1210,7 @@ static int rhine_open(struct net_device *dev) void __iomem *ioaddr = rp->base; int rc; - rc = request_irq(rp->pdev->irq, &rhine_interrupt, SA_SHIRQ, dev->name, + rc = request_irq(rp->pdev->irq, &rhine_interrupt, IRQF_SHARED, dev->name, dev); if (rc) return rc; @@ -1999,7 +1999,7 @@ static int rhine_resume(struct pci_dev *pdev) if (!netif_running(dev)) return 0; - if (request_irq(dev->irq, rhine_interrupt, SA_SHIRQ, dev->name, dev)) + if (request_irq(dev->irq, rhine_interrupt, IRQF_SHARED, dev->name, dev)) printk(KERN_ERR "via-rhine %s: request_irq failed\n", dev->name); ret = pci_set_power_state(pdev, PCI_D0); diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 09e05fe40c3..ba2972ba375 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c @@ -47,7 +47,6 @@ #include <linux/module.h> #include <linux/types.h> -#include <linux/config.h> #include <linux/init.h> #include <linux/mm.h> #include <linux/errno.h> @@ -65,7 +64,6 @@ #include <linux/wait.h> #include <asm/io.h> #include <linux/if.h> -#include <linux/config.h> #include <asm/uaccess.h> #include <linux/proc_fs.h> #include <linux/inetdevice.h> @@ -1752,7 +1750,7 @@ static int velocity_open(struct net_device *dev) velocity_init_registers(vptr, VELOCITY_INIT_COLD); - ret = request_irq(vptr->pdev->irq, &velocity_intr, SA_SHIRQ, + ret = request_irq(vptr->pdev->irq, &velocity_intr, IRQF_SHARED, dev->name, dev); if (ret < 0) { /* Power down the chip */ diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index e392ee8b37a..1f95b4864ea 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c @@ -79,13 +79,11 @@ /* ---------- Headers, macros, data structures ---------- */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/poll.h> #include <linux/fs.h> -#include <linux/devfs_fs_kernel.h> #include <linux/interrupt.h> #include <linux/delay.h> #include <linux/errno.h> @@ -393,7 +391,6 @@ static int __init cosa_init(void) err = -ENODEV; goto out; } - devfs_mk_dir("cosa"); cosa_class = class_create(THIS_MODULE, "cosa"); if (IS_ERR(cosa_class)) { err = PTR_ERR(cosa_class); @@ -402,13 +399,6 @@ static int __init cosa_init(void) for (i=0; i<nr_cards; i++) { class_device_create(cosa_class, NULL, MKDEV(cosa_major, i), NULL, "cosa%d", i); - err = devfs_mk_cdev(MKDEV(cosa_major, i), - S_IFCHR|S_IRUSR|S_IWUSR, - "cosa/%d", i); - if (err) { - class_device_destroy(cosa_class, MKDEV(cosa_major, i)); - goto out_chrdev; - } } err = 0; goto out; @@ -426,12 +416,9 @@ static void __exit cosa_exit(void) int i; printk(KERN_INFO "Unloading the cosa module\n"); - for (i=0; i<nr_cards; i++) { + for (i=0; i<nr_cards; i++) class_device_destroy(cosa_class, MKDEV(cosa_major, i)); - devfs_remove("cosa/%d", i); - } class_destroy(cosa_class); - devfs_remove("cosa"); for (cosa=cosa_cards; nr_cards--; cosa++) { /* Clean up the per-channel data */ for (i=0; i<cosa->nchannels; i++) { diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index 4505540e3c5..684af4316ff 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c @@ -732,15 +732,15 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev, ioaddr = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); if (!ioaddr) { - printk(KERN_ERR "%s: cannot remap MMIO region %lx @ %lx\n", - DRV_NAME, pci_resource_len(pdev, 0), - pci_resource_start(pdev, 0)); + printk(KERN_ERR "%s: cannot remap MMIO region %llx @ %llx\n", + DRV_NAME, (unsigned long long)pci_resource_len(pdev, 0), + (unsigned long long)pci_resource_start(pdev, 0)); rc = -EIO; goto err_free_mmio_regions_2; } - printk(KERN_DEBUG "Siemens DSCC4, MMIO at %#lx (regs), %#lx (lbi), IRQ %d\n", - pci_resource_start(pdev, 0), - pci_resource_start(pdev, 1), pdev->irq); + printk(KERN_DEBUG "Siemens DSCC4, MMIO at %#llx (regs), %#llx (lbi), IRQ %d\n", + (unsigned long long)pci_resource_start(pdev, 0), + (unsigned long long)pci_resource_start(pdev, 1), pdev->irq); /* Cf errata DS5 p.2 */ pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xf8); @@ -752,7 +752,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev, priv = pci_get_drvdata(pdev); - rc = request_irq(pdev->irq, dscc4_irq, SA_SHIRQ, DRV_NAME, priv->root); + rc = request_irq(pdev->irq, dscc4_irq, IRQF_SHARED, DRV_NAME, priv->root); if (rc < 0) { printk(KERN_WARNING "%s: IRQ %d busy\n", DRV_NAME, pdev->irq); goto err_release_4; diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 7981a2c7906..3705db04a34 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c @@ -2519,7 +2519,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) dbg(DBG_PCI, "kernel mem %p, ctlmem %p\n", card->mem, card->ctlmem); /* Register the interrupt handler */ - if (request_irq(pdev->irq, fst_intr, SA_SHIRQ, FST_DEV_NAME, card)) { + if (request_irq(pdev->irq, fst_intr, IRQF_SHARED, FST_DEV_NAME, card)) { printk_err("Unable to register interrupt %d\n", card->irq); pci_release_regions(pdev); pci_disable_device(pdev); diff --git a/drivers/net/wan/hdlc_generic.c b/drivers/net/wan/hdlc_generic.c index 57f9538b8fb..b7da55140fb 100644 --- a/drivers/net/wan/hdlc_generic.c +++ b/drivers/net/wan/hdlc_generic.c @@ -22,7 +22,6 @@ * - proto.start() and stop() are called with spin_lock_irq held. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c index cf5c805452a..a4f735723c4 100644 --- a/drivers/net/wan/hostess_sv11.c +++ b/drivers/net/wan/hostess_sv11.c @@ -264,7 +264,7 @@ static struct sv11_device *sv11_init(int iobase, int irq) /* We want a fast IRQ for this device. Actually we'd like an even faster IRQ ;) - This is one driver RtLinux is made for */ - if(request_irq(irq, &z8530_interrupt, SA_INTERRUPT, "Hostess SV11", dev)<0) + if(request_irq(irq, &z8530_interrupt, IRQF_DISABLED, "Hostess SV11", dev)<0) { printk(KERN_WARNING "hostess: IRQ %d already in use.\n", irq); goto fail1; diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c index 40926d77916..39f44241a72 100644 --- a/drivers/net/wan/lmc/lmc_main.c +++ b/drivers/net/wan/lmc/lmc_main.c @@ -1058,7 +1058,7 @@ static int lmc_open (struct net_device *dev) /*fold00*/ lmc_softreset (sc); /* Since we have to use PCI bus, this should work on x86,alpha,ppc */ - if (request_irq (dev->irq, &lmc_interrupt, SA_SHIRQ, dev->name, dev)){ + if (request_irq (dev->irq, &lmc_interrupt, IRQF_SHARED, dev->name, dev)){ printk(KERN_WARNING "%s: could not get irq: %d\n", dev->name, dev->irq); lmc_trace(dev, "lmc_open irq failed out"); return -EAGAIN; diff --git a/drivers/net/wan/lmc/lmc_media.c b/drivers/net/wan/lmc/lmc_media.c index af8b55fdd9d..ae01555d24c 100644 --- a/drivers/net/wan/lmc/lmc_media.c +++ b/drivers/net/wan/lmc/lmc_media.c @@ -1,6 +1,5 @@ /* $Id: lmc_media.c,v 1.13 2000/04/11 05:25:26 asj Exp $ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/string.h> #include <linux/timer.h> diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c index a3e65d1bc19..567effff4a3 100644 --- a/drivers/net/wan/pc300_drv.c +++ b/drivers/net/wan/pc300_drv.c @@ -3445,9 +3445,9 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) card = (pc300_t *) kmalloc(sizeof(pc300_t), GFP_KERNEL); if (card == NULL) { - printk("PC300 found at RAM 0x%08lx, " + printk("PC300 found at RAM 0x%016llx, " "but could not allocate card structure.\n", - pci_resource_start(pdev, 3)); + (unsigned long long)pci_resource_start(pdev, 3)); err = -ENOMEM; goto err_disable_dev; } @@ -3600,7 +3600,7 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) } /* Allocate IRQ */ - if (request_irq(card->hw.irq, cpc_intr, SA_SHIRQ, "Cyclades-PC300", card)) { + if (request_irq(card->hw.irq, cpc_intr, IRQF_SHARED, "Cyclades-PC300", card)) { printk ("PC300 found at RAM 0x%08x, but could not allocate IRQ%d.\n", card->hw.ramphys, card->hw.irq); goto err_io_unmap; diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c index 24c3c57c13c..4df61fa3214 100644 --- a/drivers/net/wan/pci200syn.c +++ b/drivers/net/wan/pci200syn.c @@ -402,7 +402,7 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, writew(readw(p) | 0x0040, p); /* Allocate IRQ */ - if (request_irq(pdev->irq, sca_intr, SA_SHIRQ, devname, card)) { + if (request_irq(pdev->irq, sca_intr, IRQF_SHARED, devname, card)) { printk(KERN_WARNING "pci200syn: could not allocate IRQ%d.\n", pdev->irq); pci200_pci_remove_one(pdev); diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index 175ba13bce4..fc75bec1902 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c @@ -37,7 +37,6 @@ * Known problem: this driver wasn't tested on multiprocessor machine. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/ptrace.h> @@ -1193,7 +1192,7 @@ sbni_open( struct net_device *dev ) } } - if( request_irq(dev->irq, sbni_interrupt, SA_SHIRQ, dev->name, dev) ) { + if( request_irq(dev->irq, sbni_interrupt, IRQF_SHARED, dev->name, dev) ) { printk( KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, dev->irq ); return -EAGAIN; diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c index 050e854e777..70fb1b98b1d 100644 --- a/drivers/net/wan/sealevel.c +++ b/drivers/net/wan/sealevel.c @@ -322,7 +322,7 @@ static __init struct slvl_board *slvl_init(int iobase, int irq, /* We want a fast IRQ for this device. Actually we'd like an even faster IRQ ;) - This is one driver RtLinux is made for */ - if(request_irq(irq, &z8530_interrupt, SA_INTERRUPT, "SeaLevel", dev)<0) + if(request_irq(irq, &z8530_interrupt, IRQF_DISABLED, "SeaLevel", dev)<0) { printk(KERN_WARNING "sealevel: IRQ %d already in use.\n", irq); goto fail1_1; diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c index 2d1bba06a08..c13b459a013 100644 --- a/drivers/net/wan/syncppp.c +++ b/drivers/net/wan/syncppp.c @@ -37,7 +37,6 @@ */ #undef DEBUG -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c index 437e0e938e3..d564224cdca 100644 --- a/drivers/net/wan/wanxl.c +++ b/drivers/net/wan/wanxl.c @@ -755,7 +755,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, pci_name(pdev), plx_phy, ramsize / 1024, mem_phy, pdev->irq); /* Allocate IRQ */ - if (request_irq(pdev->irq, wanxl_intr, SA_SHIRQ, "wanXL", card)) { + if (request_irq(pdev->irq, wanxl_intr, IRQF_SHARED, "wanXL", card)) { printk(KERN_WARNING "wanXL %s: could not allocate IRQ%i.\n", pci_name(pdev), pdev->irq); wanxl_pci_remove_one(pdev); diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 4069b79d825..a4dd1394271 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -19,7 +19,6 @@ ======================================================================*/ -#include <linux/config.h> #include <linux/init.h> #include <linux/kernel.h> @@ -2849,7 +2848,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, reset_card (dev, 1); msleep(400); - rc = request_irq( dev->irq, airo_interrupt, SA_SHIRQ, dev->name, dev ); + rc = request_irq( dev->irq, airo_interrupt, IRQF_SHARED, dev->name, dev ); if (rc) { airo_print_err(dev->name, "register interrupt %d failed, rc %d", irq, rc); diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index af0cbb6c5c0..ac9437d497f 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -20,7 +20,6 @@ ======================================================================*/ -#include <linux/config.h> #ifdef __IN_PCMCIA_PACKAGE__ #include <pcmcia/k_compat.h> #endif diff --git a/drivers/net/wireless/airport.c b/drivers/net/wireless/airport.c index 7b321f7cf35..38fac3bbcd8 100644 --- a/drivers/net/wireless/airport.c +++ b/drivers/net/wireless/airport.c @@ -14,7 +14,6 @@ #define DRIVER_NAME "airport" #define PFX DRIVER_NAME ": " -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> diff --git a/drivers/net/wireless/arlan-main.c b/drivers/net/wireless/arlan-main.c index bed6823d980..bb6bea4f323 100644 --- a/drivers/net/wireless/arlan-main.c +++ b/drivers/net/wireless/arlan-main.c @@ -5,7 +5,6 @@ * This module provides support for the Arlan 655 card made by Aironet */ -#include <linux/config.h> #include "arlan.h" #if BITS_PER_LONG != 32 diff --git a/drivers/net/wireless/arlan-proc.c b/drivers/net/wireless/arlan-proc.c index a2cca521f44..5fa985435ff 100644 --- a/drivers/net/wireless/arlan-proc.c +++ b/drivers/net/wireless/arlan-proc.c @@ -1,4 +1,3 @@ -#include <linux/config.h> #include "arlan.h" #include <linux/sysctl.h> diff --git a/drivers/net/wireless/arlan.h b/drivers/net/wireless/arlan.h index 70a6d7b83c4..3ed1df75900 100644 --- a/drivers/net/wireless/arlan.h +++ b/drivers/net/wireless/arlan.h @@ -5,7 +5,6 @@ */ #include <linux/module.h> -#include <linux/config.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/skbuff.h> diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 8606c88886f..995c7bea589 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c @@ -39,7 +39,6 @@ ******************************************************************************/ -#include <linux/config.h> #include <linux/init.h> #include <linux/kernel.h> @@ -1578,7 +1577,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, SET_NETDEV_DEV(dev, sys_dev); - if ((rc = request_irq(dev->irq, service_interrupt, SA_SHIRQ, dev->name, dev))) { + if ((rc = request_irq(dev->irq, service_interrupt, IRQF_SHARED, dev->name, dev))) { printk(KERN_ERR "%s: register interrupt %d failed, rc %d\n", dev->name, irq, rc); goto err_out_free; } diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 26bf1127524..785664090bb 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -29,7 +29,6 @@ ******************************************************************************/ -#include <linux/config.h> #ifdef __IN_PCMCIA_PACKAGE__ #include <pcmcia/k_compat.h> #endif diff --git a/drivers/net/wireless/atmel_pci.c b/drivers/net/wireless/atmel_pci.c index a61b3bc6ccc..d425c3cefde 100644 --- a/drivers/net/wireless/atmel_pci.c +++ b/drivers/net/wireless/atmel_pci.c @@ -19,7 +19,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ******************************************************************************/ -#include <linux/config.h> #include <linux/pci.h> #include <linux/kernel.h> #include <linux/module.h> diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index 27bcf47228e..d8f5600578b 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c @@ -2175,7 +2175,7 @@ static int bcm43xx_initialize_irq(struct bcm43xx_private *bcm) } #endif res = request_irq(bcm->irq, bcm43xx_interrupt_handler, - SA_SHIRQ, KBUILD_MODNAME, bcm); + IRQF_SHARED, KBUILD_MODNAME, bcm); if (res) { printk(KERN_ERR PFX "Cannot register IRQ%d\n", bcm->irq); return -ENODEV; diff --git a/drivers/net/wireless/hermes.c b/drivers/net/wireless/hermes.c index 2aa2f389c0d..29d39105f5b 100644 --- a/drivers/net/wireless/hermes.c +++ b/drivers/net/wireless/hermes.c @@ -38,7 +38,6 @@ * under either the MPL or the GPL. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index db03dc2646d..52e6df5c1a9 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -1,6 +1,5 @@ #define PRISM2_PCCARD -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/if.h> @@ -844,7 +843,7 @@ static struct pcmcia_device_id hostap_cs_ids[] = { PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001), PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001), PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), - PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), +/* PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), conflict with pcnet_cs */ PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010), diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index 328e9a1d13b..b764cfda6e8 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c @@ -30,7 +30,6 @@ */ -#include <linux/config.h> #include <asm/delay.h> #include <asm/uaccess.h> diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c index 93786f4218f..53374fcba77 100644 --- a/drivers/net/wireless/hostap/hostap_main.c +++ b/drivers/net/wireless/hostap/hostap_main.c @@ -12,7 +12,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c index 194f0709758..c2fa011be29 100644 --- a/drivers/net/wireless/hostap/hostap_pci.c +++ b/drivers/net/wireless/hostap/hostap_pci.c @@ -4,7 +4,6 @@ * driver patches from Reyk Floeter <reyk@vantronix.net> and * Andy Warner <andyw@pobox.com> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/if.h> @@ -338,7 +337,7 @@ static int prism2_pci_probe(struct pci_dev *pdev, pci_set_drvdata(pdev, dev); - if (request_irq(dev->irq, prism2_interrupt, SA_SHIRQ, dev->name, + if (request_irq(dev->irq, prism2_interrupt, IRQF_SHARED, dev->name, dev)) { printk(KERN_WARNING "%s: request_irq failed\n", dev->name); goto fail; diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c index edaaa943eb8..49860fa61c3 100644 --- a/drivers/net/wireless/hostap/hostap_plx.c +++ b/drivers/net/wireless/hostap/hostap_plx.c @@ -7,7 +7,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/if.h> @@ -551,7 +550,7 @@ static int prism2_plx_probe(struct pci_dev *pdev, pci_set_drvdata(pdev, dev); - if (request_irq(dev->irq, prism2_interrupt, SA_SHIRQ, dev->name, + if (request_irq(dev->irq, prism2_interrupt, IRQF_SHARED, dev->name, dev)) { printk(KERN_WARNING "%s: request_irq failed\n", dev->name); goto fail; diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 94aeb23a772..e955db435b3 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -134,7 +134,6 @@ that only one external action is invoked at a time. */ #include <linux/compiler.h> -#include <linux/config.h> #include <linux/errno.h> #include <linux/if_arp.h> #include <linux/in6.h> @@ -5358,7 +5357,7 @@ static int ipw2100_set_key(struct ipw2100_priv *priv, idx, keylen, len); /* NOTE: We don't check cached values in case the firmware was reset - * or some other problem is occuring. If the user is setting the key, + * or some other problem is occurring. If the user is setting the key, * then we push the change */ wep_key->idx = idx; @@ -6230,7 +6229,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, ipw2100_queues_initialize(priv); err = request_irq(pci_dev->irq, - ipw2100_interrupt, SA_SHIRQ, dev->name, priv); + ipw2100_interrupt, IRQF_SHARED, dev->name, priv); if (err) { printk(KERN_WARNING DRV_NAME "Error calling request_irq: %d.\n", pci_dev->irq); diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index a8a8f975432..b3300ffe4ee 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -11545,7 +11545,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ipw_sw_reset(priv, 1); - err = request_irq(pdev->irq, ipw_isr, SA_SHIRQ, DRV_NAME, priv); + err = request_irq(pdev->irq, ipw_isr, IRQF_SHARED, DRV_NAME, priv); if (err) { IPW_ERROR("Error allocating IRQ %d\n", pdev->irq); goto out_destroy_workqueue; diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index ea12ad66b8e..8b1cd7c749a 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h @@ -31,7 +31,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> -#include <linux/config.h> #include <linux/init.h> #include <linux/mutex.h> diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index 9343d970537..36b5e004305 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c @@ -37,7 +37,6 @@ /* To have statistics (just packets sent) define this */ #undef NETWAVE_STATS -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 8a31b591a90..d6ed5781b93 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c @@ -76,7 +76,6 @@ #define DRIVER_NAME "orinoco" -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index b2aec4d9fbb..bc14689cbf2 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c @@ -13,7 +13,6 @@ #define DRIVER_NAME "orinoco_cs" #define PFX DRIVER_NAME ": " -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> diff --git a/drivers/net/wireless/orinoco_nortel.c b/drivers/net/wireless/orinoco_nortel.c index 74b9d5b2ba9..bf05b907747 100644 --- a/drivers/net/wireless/orinoco_nortel.c +++ b/drivers/net/wireless/orinoco_nortel.c @@ -40,7 +40,6 @@ #define DRIVER_NAME "orinoco_nortel" #define PFX DRIVER_NAME ": " -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> @@ -199,7 +198,7 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev, hermes_struct_init(&priv->hw, hermes_io, HERMES_16BIT_REGSPACING); - err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ, + err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED, dev->name, dev); if (err) { printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); diff --git a/drivers/net/wireless/orinoco_pci.c b/drivers/net/wireless/orinoco_pci.c index 1c105f40f8d..1759c543fbe 100644 --- a/drivers/net/wireless/orinoco_pci.c +++ b/drivers/net/wireless/orinoco_pci.c @@ -44,7 +44,6 @@ #define DRIVER_NAME "orinoco_pci" #define PFX DRIVER_NAME ": " -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> @@ -154,7 +153,7 @@ static int orinoco_pci_init_one(struct pci_dev *pdev, hermes_struct_init(&priv->hw, hermes_io, HERMES_32BIT_REGSPACING); - err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ, + err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED, dev->name, dev); if (err) { printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); diff --git a/drivers/net/wireless/orinoco_pci.h b/drivers/net/wireless/orinoco_pci.h index 7eb1e08113e..be1abea4b64 100644 --- a/drivers/net/wireless/orinoco_pci.h +++ b/drivers/net/wireless/orinoco_pci.h @@ -63,7 +63,7 @@ static int orinoco_pci_resume(struct pci_dev *pdev) pci_enable_device(pdev); pci_restore_state(pdev); - err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ, + err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED, dev->name, dev); if (err) { printk(KERN_ERR "%s: cannot re-allocate IRQ on resume\n", diff --git a/drivers/net/wireless/orinoco_plx.c b/drivers/net/wireless/orinoco_plx.c index 84f696c7755..7f006f62417 100644 --- a/drivers/net/wireless/orinoco_plx.c +++ b/drivers/net/wireless/orinoco_plx.c @@ -86,7 +86,6 @@ #define DRIVER_NAME "orinoco_plx" #define PFX DRIVER_NAME ": " -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> @@ -238,7 +237,7 @@ static int orinoco_plx_init_one(struct pci_dev *pdev, hermes_struct_init(&priv->hw, hermes_io, HERMES_16BIT_REGSPACING); - err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ, + err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED, dev->name, dev); if (err) { printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); diff --git a/drivers/net/wireless/orinoco_tmd.c b/drivers/net/wireless/orinoco_tmd.c index d2b4decb7a7..0831721e4d6 100644 --- a/drivers/net/wireless/orinoco_tmd.c +++ b/drivers/net/wireless/orinoco_tmd.c @@ -40,7 +40,6 @@ #define DRIVER_NAME "orinoco_tmd" #define PFX DRIVER_NAME ": " -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> @@ -140,7 +139,7 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev, hermes_struct_init(&priv->hw, hermes_io, HERMES_16BIT_REGSPACING); - err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ, + err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED, dev->name, dev); if (err) { printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq); diff --git a/drivers/net/wireless/prism54/islpci_hotplug.c b/drivers/net/wireless/prism54/islpci_hotplug.c index bfa0cc319a0..09fc17a0f02 100644 --- a/drivers/net/wireless/prism54/islpci_hotplug.c +++ b/drivers/net/wireless/prism54/islpci_hotplug.c @@ -189,7 +189,7 @@ prism54_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* request for the interrupt before uploading the firmware */ rvalue = request_irq(pdev->irq, &islpci_interrupt, - SA_SHIRQ, ndev->name, priv); + IRQF_SHARED, ndev->name, priv); if (rvalue) { /* error, could not hook the handler to the irq */ diff --git a/drivers/net/wireless/prism54/islpci_mgt.c b/drivers/net/wireless/prism54/islpci_mgt.c index 6a60c5970cb..2e061a80b29 100644 --- a/drivers/net/wireless/prism54/islpci_mgt.c +++ b/drivers/net/wireless/prism54/islpci_mgt.c @@ -18,7 +18,6 @@ * */ -#include <linux/config.h> #include <linux/netdevice.h> #include <linux/module.h> #include <linux/pci.h> diff --git a/drivers/net/wireless/prism54/prismcompat.h b/drivers/net/wireless/prism54/prismcompat.h index 55541c01752..d71eca55a30 100644 --- a/drivers/net/wireless/prism54/prismcompat.h +++ b/drivers/net/wireless/prism54/prismcompat.h @@ -29,7 +29,6 @@ #include <linux/device.h> #include <linux/firmware.h> -#include <linux/config.h> #include <linux/moduleparam.h> #include <linux/workqueue.h> #include <linux/compiler.h> diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index a915fe6c6aa..61b83a5e737 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -30,7 +30,6 @@ * =============================================================================*/ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/proc_fs.h> diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index 7f9aa139c34..15465278c78 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c @@ -21,7 +21,6 @@ #define DRIVER_NAME "spectrum_cs" #define PFX DRIVER_NAME ": " -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c index 18a44580b53..fd31885c684 100644 --- a/drivers/net/wireless/strip.c +++ b/drivers/net/wireless/strip.c @@ -81,7 +81,6 @@ static const char StripVersion[] = "1.3A-STUART.CHESHIRE"; /************************************************************************/ /* Header files */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> diff --git a/drivers/net/wireless/wavelan_cs.p.h b/drivers/net/wireless/wavelan_cs.p.h index c65fe7a391e..f34a36b0c7b 100644 --- a/drivers/net/wireless/wavelan_cs.p.h +++ b/drivers/net/wireless/wavelan_cs.p.h @@ -411,7 +411,6 @@ /***************************** INCLUDES *****************************/ /* Linux headers that we need */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index e52a650f673..c03e400face 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c @@ -28,7 +28,6 @@ */ #undef REALLY_SLOW_IO /* most systems can safely undef this */ -#include <linux/config.h> #include <linux/delay.h> #include <linux/types.h> #include <linux/ethtool.h> diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index 569305f5756..bbbf7e274a2 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c @@ -602,7 +602,7 @@ static int yellowfin_open(struct net_device *dev) /* Reset the chip. */ iowrite32(0x80000000, ioaddr + DMACtrl); - i = request_irq(dev->irq, &yellowfin_interrupt, SA_SHIRQ, dev->name, dev); + i = request_irq(dev->irq, &yellowfin_interrupt, IRQF_SHARED, dev->name, dev); if (i) return i; if (yellowfin_debug > 1) diff --git a/drivers/net/znet.c b/drivers/net/znet.c index a7c089df66e..9f0291f3529 100644 --- a/drivers/net/znet.c +++ b/drivers/net/znet.c @@ -85,7 +85,6 @@ - Understand why some traffic patterns add a 1s latency... */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/string.h> diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c index 8037e5806d0..df04e050c64 100644 --- a/drivers/net/zorro8390.c +++ b/drivers/net/zorro8390.c @@ -201,7 +201,7 @@ static int __devinit zorro8390_init(struct net_device *dev, dev->irq = IRQ_AMIGA_PORTS; /* Install the Interrupt handler */ - i = request_irq(IRQ_AMIGA_PORTS, ei_interrupt, SA_SHIRQ, DRV_NAME, dev); + i = request_irq(IRQ_AMIGA_PORTS, ei_interrupt, IRQF_SHARED, DRV_NAME, dev); if (i) return i; for(i = 0; i < ETHER_ADDR_LEN; i++) { diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c index 14cbe34eb89..3a0a3a73493 100644 --- a/drivers/nubus/nubus.c +++ b/drivers/nubus/nubus.c @@ -7,7 +7,6 @@ * and others. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/string.h> diff --git a/drivers/nubus/nubus_syms.c b/drivers/nubus/nubus_syms.c index 22c1dc9f87b..9204f04fbf0 100644 --- a/drivers/nubus/nubus_syms.c +++ b/drivers/nubus/nubus_syms.c @@ -2,7 +2,6 @@ (c) 1999 David Huggins-Daines <dhd@debian.org> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/nubus.h> diff --git a/drivers/parisc/Kconfig b/drivers/parisc/Kconfig index 3f5de867acd..1d3b84b4af3 100644 --- a/drivers/parisc/Kconfig +++ b/drivers/parisc/Kconfig @@ -140,18 +140,37 @@ config CHASSIS_LCD_LED If unsure, say Y. config PDC_CHASSIS - bool "PDC chassis State Panel support" + bool "PDC chassis state codes support" default y help - Say Y here if you want to enable support for the LED State front - panel as found on E class, and support for the GSP Virtual Front - Panel (LED State and message logging) as found on high end - servers such as A, L and N-class. - - This has nothing to do with Chassis LCD and LED support. + Say Y here if you want to enable support for Chassis codes. + That includes support for LED State front panel as found on E + class, and support for the GSP Virtual Front Panel (LED State and + message logging) as found on high end servers such as A, L and + N-class. + This driver will also display progress messages on LCD display, + such as "INI", "RUN" and "FLT", and might thus clobber messages + shown by the LED/LCD driver. + This driver updates the state panel (LED and/or LCD) upon system + state change (eg: boot, shutdown or panic). If unsure, say Y. + +config PDC_CHASSIS_WARN + bool "PDC chassis warnings support" + depends on PROC_FS + default y + help + Say Y here if you want to enable support for Chassis warnings. + This will add a proc entry '/proc/chassis' giving some information + about the overall health state of the system. + This includes NVRAM battery level, overtemp or failures such as + fans or power units. + + If unsure, say Y. + + config PDC_STABLE tristate "PDC Stable Storage support" depends on SYSFS diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index a5d826237b2..68cb3a08005 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c @@ -31,7 +31,6 @@ ** the coherency design originally worked out. Only PCX-W does. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/init.h> #include <linux/mm.h> diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index 6e8ed0c81a6..0d96c50ffe9 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c @@ -43,7 +43,6 @@ ** for PCI drivers devices which implement/use MMIO registers. */ -#include <linux/config.h> #include <linux/delay.h> #include <linux/types.h> #include <linux/kernel.h> @@ -299,7 +298,7 @@ struct pci_port_ops dino_port_ops = { static void dino_disable_irq(unsigned int irq) { - struct dino_device *dino_dev = irq_desc[irq].handler_data; + struct dino_device *dino_dev = irq_desc[irq].chip_data; int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); DBG(KERN_WARNING "%s(0x%p, %d)\n", __FUNCTION__, dino_dev, irq); @@ -311,7 +310,7 @@ static void dino_disable_irq(unsigned int irq) static void dino_enable_irq(unsigned int irq) { - struct dino_device *dino_dev = irq_desc[irq].handler_data; + struct dino_device *dino_dev = irq_desc[irq].chip_data; int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); u32 tmp; diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c index 9d3bd15bf53..884965cedec 100644 --- a/drivers/parisc/eisa.c +++ b/drivers/parisc/eisa.c @@ -340,7 +340,7 @@ static int __devinit eisa_probe(struct parisc_device *dev) } pcibios_register_hba(&eisa_dev.hba); - result = request_irq(dev->irq, eisa_irq, SA_SHIRQ, "EISA", &eisa_dev); + result = request_irq(dev->irq, eisa_irq, IRQF_SHARED, "EISA", &eisa_dev); if (result) { printk(KERN_ERR "EISA: request_irq failed!\n"); return result; @@ -350,7 +350,7 @@ static int __devinit eisa_probe(struct parisc_device *dev) irq_desc[2].action = &irq2_action; for (i = 0; i < 16; i++) { - irq_desc[i].handler = &eisa_interrupt_type; + irq_desc[i].chip = &eisa_interrupt_type; } EISA_bus = 1; diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c index 16d40f95978..b45aa5c675a 100644 --- a/drivers/parisc/gsc.c +++ b/drivers/parisc/gsc.c @@ -14,7 +14,6 @@ */ #include <linux/bitops.h> -#include <linux/config.h> #include <linux/errno.h> #include <linux/init.h> #include <linux/interrupt.h> @@ -109,7 +108,7 @@ int gsc_find_local_irq(unsigned int irq, int *global_irqs, int limit) static void gsc_asic_disable_irq(unsigned int irq) { - struct gsc_asic *irq_dev = irq_desc[irq].handler_data; + struct gsc_asic *irq_dev = irq_desc[irq].chip_data; int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); u32 imr; @@ -124,7 +123,7 @@ static void gsc_asic_disable_irq(unsigned int irq) static void gsc_asic_enable_irq(unsigned int irq) { - struct gsc_asic *irq_dev = irq_desc[irq].handler_data; + struct gsc_asic *irq_dev = irq_desc[irq].chip_data; int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); u32 imr; @@ -164,8 +163,8 @@ int gsc_assign_irq(struct hw_interrupt_type *type, void *data) if (irq > GSC_IRQ_MAX) return NO_IRQ; - irq_desc[irq].handler = type; - irq_desc[irq].handler_data = data; + irq_desc[irq].chip = type; + irq_desc[irq].chip_data = data; return irq++; } diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index 7a458d5bc75..1fbda77cefc 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c @@ -619,7 +619,7 @@ iosapic_set_irt_data( struct vector_info *vi, u32 *dp0, u32 *dp1) static struct vector_info *iosapic_get_vector(unsigned int irq) { - return irq_desc[irq].handler_data; + return irq_desc[irq].chip_data; } static void iosapic_disable_irq(unsigned int irq) diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index 298f2ddb2c1..bf00fa2537b 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c @@ -23,7 +23,6 @@ * David Pye <dmp@davidmpye.dyndns.org> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/stddef.h> /* for offsetof() */ #include <linux/init.h> @@ -411,16 +410,17 @@ static __inline__ int led_get_net_activity(void) static __inline__ int led_get_diskio_activity(void) { static unsigned long last_pgpgin, last_pgpgout; - struct page_state pgstat; + unsigned long events[NR_VM_EVENT_ITEMS]; int changed; - get_full_page_state(&pgstat); /* get no of sectors in & out */ + all_vm_events(events); /* Just use a very simple calculation here. Do not care about overflow, since we only want to know if there was activity or not. */ - changed = (pgstat.pgpgin != last_pgpgin) || (pgstat.pgpgout != last_pgpgout); - last_pgpgin = pgstat.pgpgin; - last_pgpgout = pgstat.pgpgout; + changed = (events[PGPGIN] != last_pgpgin) || + (events[PGPGOUT] != last_pgpgout); + last_pgpgin = events[PGPGIN]; + last_pgpgout = events[PGPGOUT]; return (changed ? LED_DISK_IO : 0); } diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index bbeabe3fc4c..ea1b7a63598 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c @@ -28,8 +28,15 @@ * following code can deal with just 96 bytes of Stable Storage, and all * sizes between 96 and 192 bytes (provided they are multiple of struct * device_path size, eg: 128, 160 and 192) to provide full information. - * The code makes no use of data above 192 bytes. One last word: there's one - * path we can always count on: the primary path. + * One last word: there's one path we can always count on: the primary path. + * Anything above 224 bytes is used for 'osdep2' OS-dependent storage area. + * + * The first OS-dependent area should always be available. Obviously, this is + * not true for the other one. Also bear in mind that reading/writing from/to + * osdep2 is much more expensive than from/to osdep1. + * NOTE: We do not handle the 2 bytes OS-dep area at 0x5D, nor the first + * 2 bytes of storage available right after OSID. That's a total of 4 bytes + * sacrificed: -ETOOLAZY :P * * The current policy wrt file permissions is: * - write: root only @@ -64,15 +71,18 @@ #include <asm/uaccess.h> #include <asm/hardware.h> -#define PDCS_VERSION "0.22" +#define PDCS_VERSION "0.30" #define PDCS_PREFIX "PDC Stable Storage" #define PDCS_ADDR_PPRI 0x00 #define PDCS_ADDR_OSID 0x40 +#define PDCS_ADDR_OSD1 0x48 +#define PDCS_ADDR_DIAG 0x58 #define PDCS_ADDR_FSIZ 0x5C #define PDCS_ADDR_PCON 0x60 #define PDCS_ADDR_PALT 0x80 #define PDCS_ADDR_PKBD 0xA0 +#define PDCS_ADDR_OSD2 0xE0 MODULE_AUTHOR("Thibaut VARENE <varenet@parisc-linux.org>"); MODULE_DESCRIPTION("sysfs interface to HP PDC Stable Storage data"); @@ -82,6 +92,9 @@ MODULE_VERSION(PDCS_VERSION); /* holds Stable Storage size. Initialized once and for all, no lock needed */ static unsigned long pdcs_size __read_mostly; +/* holds OS ID. Initialized once and for all, hopefully to 0x0006 */ +static u16 pdcs_osid __read_mostly; + /* This struct defines what we need to deal with a parisc pdc path entry */ struct pdcspath_entry { rwlock_t rw_lock; /* to protect path entry access */ @@ -609,27 +622,64 @@ static ssize_t pdcs_osid_read(struct subsystem *entry, char *buf) { char *out = buf; - __u32 result; - char *tmpstr = NULL; if (!entry || !buf) return -EINVAL; - /* get OSID */ - if (pdc_stable_read(PDCS_ADDR_OSID, &result, sizeof(result)) != PDC_OK) + out += sprintf(out, "%s dependent data (0x%.4x)\n", + os_id_to_string(pdcs_osid), pdcs_osid); + + return out - buf; +} + +/** + * pdcs_osdep1_read - Stable Storage OS-Dependent data area 1 output. + * @entry: An allocated and populated subsytem struct. We don't use it tho. + * @buf: The output buffer to write to. + * + * This can hold 16 bytes of OS-Dependent data. + */ +static ssize_t +pdcs_osdep1_read(struct subsystem *entry, char *buf) +{ + char *out = buf; + u32 result[4]; + + if (!entry || !buf) + return -EINVAL; + + if (pdc_stable_read(PDCS_ADDR_OSD1, &result, sizeof(result)) != PDC_OK) return -EIO; - /* the actual result is 16 bits away */ - switch (result >> 16) { - case 0x0000: tmpstr = "No OS-dependent data"; break; - case 0x0001: tmpstr = "HP-UX dependent data"; break; - case 0x0002: tmpstr = "MPE-iX dependent data"; break; - case 0x0003: tmpstr = "OSF dependent data"; break; - case 0x0004: tmpstr = "HP-RT dependent data"; break; - case 0x0005: tmpstr = "Novell Netware dependent data"; break; - default: tmpstr = "Unknown"; break; - } - out += sprintf(out, "%s (0x%.4x)\n", tmpstr, (result >> 16)); + out += sprintf(out, "0x%.8x\n", result[0]); + out += sprintf(out, "0x%.8x\n", result[1]); + out += sprintf(out, "0x%.8x\n", result[2]); + out += sprintf(out, "0x%.8x\n", result[3]); + + return out - buf; +} + +/** + * pdcs_diagnostic_read - Stable Storage Diagnostic register output. + * @entry: An allocated and populated subsytem struct. We don't use it tho. + * @buf: The output buffer to write to. + * + * I have NFC how to interpret the content of that register ;-). + */ +static ssize_t +pdcs_diagnostic_read(struct subsystem *entry, char *buf) +{ + char *out = buf; + u32 result; + + if (!entry || !buf) + return -EINVAL; + + /* get diagnostic */ + if (pdc_stable_read(PDCS_ADDR_DIAG, &result, sizeof(result)) != PDC_OK) + return -EIO; + + out += sprintf(out, "0x%.4x\n", (result >> 16)); return out - buf; } @@ -645,7 +695,7 @@ static ssize_t pdcs_fastsize_read(struct subsystem *entry, char *buf) { char *out = buf; - __u32 result; + u32 result; if (!entry || !buf) return -EINVAL; @@ -664,6 +714,39 @@ pdcs_fastsize_read(struct subsystem *entry, char *buf) } /** + * pdcs_osdep2_read - Stable Storage OS-Dependent data area 2 output. + * @entry: An allocated and populated subsytem struct. We don't use it tho. + * @buf: The output buffer to write to. + * + * This can hold pdcs_size - 224 bytes of OS-Dependent data, when available. + */ +static ssize_t +pdcs_osdep2_read(struct subsystem *entry, char *buf) +{ + char *out = buf; + unsigned long size; + unsigned short i; + u32 result; + + if (unlikely(pdcs_size <= 224)) + return -ENODATA; + + size = pdcs_size - 224; + + if (!entry || !buf) + return -EINVAL; + + for (i=0; i<size; i+=4) { + if (unlikely(pdc_stable_read(PDCS_ADDR_OSD2 + i, &result, + sizeof(result)) != PDC_OK)) + return -EIO; + out += sprintf(out, "0x%.8x\n", result); + } + + return out - buf; +} + +/** * pdcs_auto_write - This function handles autoboot/search flag modifying. * @entry: An allocated and populated subsytem struct. We don't use it tho. * @buf: The input buffer to read from. @@ -770,13 +853,100 @@ pdcs_autosearch_write(struct subsystem *entry, const char *buf, size_t count) return pdcs_auto_write(entry, buf, count, PF_AUTOSEARCH); } +/** + * pdcs_osdep1_write - Stable Storage OS-Dependent data area 1 input. + * @entry: An allocated and populated subsytem struct. We don't use it tho. + * @buf: The input buffer to read from. + * @count: The number of bytes to be read. + * + * This can store 16 bytes of OS-Dependent data. We use a byte-by-byte + * write approach. It's up to userspace to deal with it when constructing + * its input buffer. + */ +static ssize_t +pdcs_osdep1_write(struct subsystem *entry, const char *buf, size_t count) +{ + u8 in[16]; + + if (!capable(CAP_SYS_ADMIN)) + return -EACCES; + + if (!entry || !buf || !count) + return -EINVAL; + + if (unlikely(pdcs_osid != OS_ID_LINUX)) + return -EPERM; + + if (count > 16) + return -EMSGSIZE; + + /* We'll use a local copy of buf */ + memset(in, 0, 16); + memcpy(in, buf, count); + + if (pdc_stable_write(PDCS_ADDR_OSD1, &in, sizeof(in)) != PDC_OK) + return -EIO; + + return count; +} + +/** + * pdcs_osdep2_write - Stable Storage OS-Dependent data area 2 input. + * @entry: An allocated and populated subsytem struct. We don't use it tho. + * @buf: The input buffer to read from. + * @count: The number of bytes to be read. + * + * This can store pdcs_size - 224 bytes of OS-Dependent data. We use a + * byte-by-byte write approach. It's up to userspace to deal with it when + * constructing its input buffer. + */ +static ssize_t +pdcs_osdep2_write(struct subsystem *entry, const char *buf, size_t count) +{ + unsigned long size; + unsigned short i; + u8 in[4]; + + if (!capable(CAP_SYS_ADMIN)) + return -EACCES; + + if (!entry || !buf || !count) + return -EINVAL; + + if (unlikely(pdcs_size <= 224)) + return -ENOSYS; + + if (unlikely(pdcs_osid != OS_ID_LINUX)) + return -EPERM; + + size = pdcs_size - 224; + + if (count > size) + return -EMSGSIZE; + + /* We'll use a local copy of buf */ + + for (i=0; i<count; i+=4) { + memset(in, 0, 4); + memcpy(in, buf+i, (count-i < 4) ? count-i : 4); + if (unlikely(pdc_stable_write(PDCS_ADDR_OSD2 + i, &in, + sizeof(in)) != PDC_OK)) + return -EIO; + } + + return count; +} + /* The remaining attributes. */ static PDCS_ATTR(size, 0444, pdcs_size_read, NULL); static PDCS_ATTR(autoboot, 0644, pdcs_autoboot_read, pdcs_autoboot_write); static PDCS_ATTR(autosearch, 0644, pdcs_autosearch_read, pdcs_autosearch_write); static PDCS_ATTR(timer, 0444, pdcs_timer_read, NULL); -static PDCS_ATTR(osid, 0400, pdcs_osid_read, NULL); +static PDCS_ATTR(osid, 0444, pdcs_osid_read, NULL); +static PDCS_ATTR(osdep1, 0600, pdcs_osdep1_read, pdcs_osdep1_write); +static PDCS_ATTR(diagnostic, 0400, pdcs_diagnostic_read, NULL); static PDCS_ATTR(fastsize, 0400, pdcs_fastsize_read, NULL); +static PDCS_ATTR(osdep2, 0600, pdcs_osdep2_read, pdcs_osdep2_write); static struct subsys_attribute *pdcs_subsys_attrs[] = { &pdcs_attr_size, @@ -784,7 +954,10 @@ static struct subsys_attribute *pdcs_subsys_attrs[] = { &pdcs_attr_autosearch, &pdcs_attr_timer, &pdcs_attr_osid, + &pdcs_attr_osdep1, + &pdcs_attr_diagnostic, &pdcs_attr_fastsize, + &pdcs_attr_osdep2, NULL, }; @@ -865,6 +1038,7 @@ pdc_stable_init(void) { struct subsys_attribute *attr; int i, rc = 0, error = 0; + u32 result; /* find the size of the stable storage */ if (pdc_stable_get_size(&pdcs_size) != PDC_OK) @@ -876,6 +1050,13 @@ pdc_stable_init(void) printk(KERN_INFO PDCS_PREFIX " facility v%s\n", PDCS_VERSION); + /* get OSID */ + if (pdc_stable_read(PDCS_ADDR_OSID, &result, sizeof(result)) != PDC_OK) + return -EIO; + + /* the actual result is 16 bits away */ + pdcs_osid = (u16)(result >> 16); + /* For now we'll register the stable subsys within this driver */ if ((rc = firmware_register(&stable_subsys))) goto fail_firmreg; @@ -887,7 +1068,7 @@ pdc_stable_init(void) /* register the paths subsys as a subsystem of stable subsys */ kset_set_kset_s(&paths_subsys, stable_subsys); - if ((rc= subsystem_register(&paths_subsys))) + if ((rc = subsystem_register(&paths_subsys))) goto fail_subsysreg; /* now we create all "files" for the paths subsys */ diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c index 0bcab83b408..fad5a33bf0f 100644 --- a/drivers/parisc/power.c +++ b/drivers/parisc/power.c @@ -35,7 +35,6 @@ * runtime through the "/proc/sys/kernel/power" procfs entry. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index 278f325021e..8b473281551 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c @@ -19,7 +19,6 @@ ** FIXME: add DMA hint support programming in both sba and lba modules. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/spinlock.h> @@ -316,10 +315,10 @@ static int reserve_sba_gart = 1; ** ** Superdome (in particular, REO) allows only 64-bit CSR accesses. */ -#define READ_REG32(addr) le32_to_cpu(__raw_readl(addr)) -#define READ_REG64(addr) le64_to_cpu(__raw_readq(addr)) -#define WRITE_REG32(val, addr) __raw_writel(cpu_to_le32(val), addr) -#define WRITE_REG64(val, addr) __raw_writeq(cpu_to_le64(val), addr) +#define READ_REG32(addr) readl(addr) +#define READ_REG64(addr) readq(addr) +#define WRITE_REG32(val, addr) writel((val), (addr)) +#define WRITE_REG64(val, addr) writeq((val), (addr)) #ifdef CONFIG_64BIT #define READ_REG(addr) READ_REG64(addr) @@ -1427,7 +1426,7 @@ sba_ioc_init_pluto(struct parisc_device *sba, struct ioc *ioc, int ioc_num) iov_order = get_order(iova_space_size >> (IOVP_SHIFT - PAGE_SHIFT)); ioc->pdir_size = (iova_space_size / IOVP_SIZE) * sizeof(u64); - DBG_INIT("%s() hpa 0x%lx IOV %dMB (%d bits)\n", + DBG_INIT("%s() hpa 0x%p IOV %dMB (%d bits)\n", __FUNCTION__, ioc->ioc_hpa, iova_space_size >> 20, iov_order + PAGE_SHIFT); @@ -1764,7 +1763,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, sba_dev->num_ioc = num_ioc; for (i = 0; i < num_ioc; i++) { - unsigned long ioc_hpa = sba_dev->ioc[i].ioc_hpa; + void __iomem *ioc_hpa = sba_dev->ioc[i].ioc_hpa; unsigned int j; for (j=0; j < sizeof(u64) * ROPES_PER_IOC; j+=sizeof(u64)) { @@ -1776,7 +1775,8 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, * Improves netperf UDP_STREAM by ~10% for bcm5701. */ if (IS_PLUTO(sba_dev->iodc)) { - unsigned long rope_cfg, cfg_val; + void __iomem *rope_cfg; + unsigned long cfg_val; rope_cfg = ioc_hpa + IOC_ROPE0_CFG + j; cfg_val = READ_REG(rope_cfg); @@ -1902,7 +1902,7 @@ sba_common_init(struct sba_device *sba_dev) * (bit #61, big endian), we have to flush and sync every time * IO-PDIR is changed in Ike/Astro. */ - if (boot_cpu_data.pdc.capabilities & PDC_MODEL_IOPDIR_FDC) { + if (ioc_needs_fdc) { printk(KERN_INFO MODULE_NAME " FDC/SYNC required.\n"); } else { printk(KERN_INFO MODULE_NAME " IOC has cache coherent PDIR.\n"); diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index 828eb45062d..4ee26a6d9e2 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c @@ -271,7 +271,7 @@ superio_init(struct pci_dev *pcidev) else printk(KERN_ERR PFX "USB regulator not initialized!\n"); - if (request_irq(pdev->irq, superio_interrupt, SA_INTERRUPT, + if (request_irq(pdev->irq, superio_interrupt, IRQF_DISABLED, SUPERIO, (void *)sio)) { printk(KERN_ERR PFX "could not get irq\n"); @@ -360,7 +360,7 @@ int superio_fixup_irq(struct pci_dev *pcidev) #endif for (i = 0; i < 16; i++) { - irq_desc[i].handler = &superio_interrupt_type; + irq_desc[i].chip = &superio_interrupt_type; } /* diff --git a/drivers/parport/ieee1284.c b/drivers/parport/ieee1284.c index 690b239ad3a..7ff09f0f858 100644 --- a/drivers/parport/ieee1284.c +++ b/drivers/parport/ieee1284.c @@ -16,7 +16,6 @@ * Various hacks, Fred Barnes <frmb2@ukc.ac.uk>, 04/2000 */ -#include <linux/config.h> #include <linux/module.h> #include <linux/threads.h> #include <linux/parport.h> diff --git a/drivers/parport/ieee1284_ops.c b/drivers/parport/ieee1284_ops.c index d6c77658231..525312f2fe9 100644 --- a/drivers/parport/ieee1284_ops.c +++ b/drivers/parport/ieee1284_ops.c @@ -14,7 +14,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/parport.h> #include <linux/delay.h> diff --git a/drivers/parport/parport_ax88796.c b/drivers/parport/parport_ax88796.c index 4baa719439a..1850632590f 100644 --- a/drivers/parport/parport_ax88796.c +++ b/drivers/parport/parport_ax88796.c @@ -345,7 +345,7 @@ static int parport_ax88796_probe(struct platform_device *pdev) if (irq >= 0) { /* request irq */ ret = request_irq(irq, parport_ax88796_interrupt, - SA_TRIGGER_FALLING, pdev->name, pp); + IRQF_TRIGGER_FALLING, pdev->name, pp); if (ret < 0) goto exit_port; diff --git a/drivers/parport/parport_mfc3.c b/drivers/parport/parport_mfc3.c index c85364765ef..b2b8092a2b3 100644 --- a/drivers/parport/parport_mfc3.c +++ b/drivers/parport/parport_mfc3.c @@ -353,7 +353,7 @@ static int __init parport_mfc3_init(void) if (p->irq != PARPORT_IRQ_NONE) { if (use_cnt++ == 0) - if (request_irq(IRQ_AMIGA_PORTS, mfc3_interrupt, SA_SHIRQ, p->name, &pp_mfc3_ops)) + if (request_irq(IRQ_AMIGA_PORTS, mfc3_interrupt, IRQF_SHARED, p->name, &pp_mfc3_ops)) goto out_irq; } diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 7318e4a9e43..fe800dc0be9 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -42,7 +42,6 @@ * but rather will start at port->base_hi. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/sched.h> diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c index 7c43c5392be..fac333b279b 100644 --- a/drivers/parport/parport_sunbpp.c +++ b/drivers/parport/parport_sunbpp.c @@ -322,7 +322,7 @@ static int __devinit init_one_port(struct sbus_dev *sdev) p->size = size; if ((err = request_irq(p->irq, parport_sunbpp_interrupt, - SA_SHIRQ, p->name, p)) != 0) { + IRQF_SHARED, p->name, p)) != 0) { goto out_put_port; } diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c index 8610ae88b92..2e744a27451 100644 --- a/drivers/parport/procfs.c +++ b/drivers/parport/procfs.c @@ -13,7 +13,6 @@ */ #include <linux/string.h> -#include <linux/config.h> #include <linux/init.h> #include <linux/module.h> #include <linux/errno.h> diff --git a/drivers/parport/share.c b/drivers/parport/share.c index 2cb22c8d335..94dc506b83d 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c @@ -17,7 +17,6 @@ #undef PARPORT_DEBUG_SHARING /* undef for production */ -#include <linux/config.h> #include <linux/module.h> #include <linux/string.h> #include <linux/threads.h> diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 72309268202..5f7db9d2436 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -34,11 +34,11 @@ */ int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, - unsigned long size, unsigned long align, unsigned long min, - unsigned int type_mask, - void (*alignf)(void *, struct resource *, - unsigned long, unsigned long), - void *alignf_data) + resource_size_t size, resource_size_t align, + resource_size_t min, unsigned int type_mask, + void (*alignf)(void *, struct resource *, resource_size_t, + resource_size_t), + void *alignf_data) { int i, ret = -ENOMEM; diff --git a/drivers/pci/hotplug/Makefile b/drivers/pci/hotplug/Makefile index 421cfffb175..34a1891191f 100644 --- a/drivers/pci/hotplug/Makefile +++ b/drivers/pci/hotplug/Makefile @@ -40,8 +40,7 @@ ibmphp-objs := ibmphp_core.o \ ibmphp_hpc.o acpiphp-objs := acpiphp_core.o \ - acpiphp_glue.o \ - acpiphp_dock.o + acpiphp_glue.o rpaphp-objs := rpaphp_core.o \ rpaphp_pci.o \ diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index 17a93f890db..be104eced34 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h @@ -130,7 +130,7 @@ struct acpiphp_func { struct list_head sibling; struct pci_dev *pci_dev; - + struct notifier_block nb; acpi_handle handle; u8 function; /* pci function# */ @@ -151,24 +151,6 @@ struct acpiphp_attention_info }; -struct dependent_device { - struct list_head device_list; - struct list_head pci_list; - acpi_handle handle; - struct acpiphp_func *func; -}; - - -struct acpiphp_dock_station { - acpi_handle handle; - u32 last_dock_time; - u32 flags; - struct acpiphp_func *dock_bridge; - struct list_head dependent_devices; - struct list_head pci_dependent_devices; -}; - - /* PCI bus bridge HID */ #define ACPI_PCI_HOST_HID "PNP0A03" @@ -207,11 +189,6 @@ struct acpiphp_dock_station { #define FUNC_HAS_PS2 (0x00000040) #define FUNC_HAS_PS3 (0x00000080) #define FUNC_HAS_DCK (0x00000100) -#define FUNC_IS_DD (0x00000200) - -/* dock station flags */ -#define DOCK_DOCKING (0x00000001) -#define DOCK_HAS_BRIDGE (0x00000002) /* function prototypes */ @@ -226,7 +203,6 @@ extern int acpiphp_glue_init (void); extern void acpiphp_glue_exit (void); extern int acpiphp_get_num_slots (void); typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data); -void handle_hotplug_event_func(acpi_handle, u32, void*); extern int acpiphp_enable_slot (struct acpiphp_slot *slot); extern int acpiphp_disable_slot (struct acpiphp_slot *slot); @@ -236,16 +212,6 @@ extern u8 acpiphp_get_latch_status (struct acpiphp_slot *slot); extern u8 acpiphp_get_adapter_status (struct acpiphp_slot *slot); extern u32 acpiphp_get_address (struct acpiphp_slot *slot); -/* acpiphp_dock.c */ -extern int find_dock_station(void); -extern void remove_dock_station(void); -extern void add_dependent_device(struct dependent_device *new_dd); -extern void add_pci_dependent_device(struct dependent_device *new_dd); -extern struct dependent_device *get_dependent_device(acpi_handle handle); -extern int is_dependent_device(acpi_handle handle); -extern int detect_dependent_devices(acpi_handle *bridge_handle); -extern struct dependent_device *alloc_dependent_device(acpi_handle handle); - /* variables */ extern int acpiphp_debug; diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c index 4f1b0da8e47..34de5697983 100644 --- a/drivers/pci/hotplug/acpiphp_core.c +++ b/drivers/pci/hotplug/acpiphp_core.c @@ -416,27 +416,12 @@ void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *acpiphp_slot) static int __init acpiphp_init(void) { - int retval; - int docking_station; - info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); acpiphp_debug = debug; - docking_station = find_dock_station(); - /* read all the ACPI info from the system */ - retval = init_acpi(); - - /* if we have found a docking station, we should - * go ahead and load even if init_acpi has found - * no slots. This handles the case when the _DCK - * method not defined under the actual dock bridge - */ - if (docking_station) - return 0; - else - return retval; + return init_acpi(); } @@ -444,8 +429,6 @@ static void __exit acpiphp_exit(void) { /* deallocate internal data structures etc. */ acpiphp_glue_exit(); - - remove_dock_station(); } module_init(acpiphp_init); diff --git a/drivers/pci/hotplug/acpiphp_dock.c b/drivers/pci/hotplug/acpiphp_dock.c deleted file mode 100644 index 4f1aaf12831..00000000000 --- a/drivers/pci/hotplug/acpiphp_dock.c +++ /dev/null @@ -1,438 +0,0 @@ -/* - * ACPI PCI HotPlug dock functions to ACPI CA subsystem - * - * Copyright (C) 2006 Kristen Carlson Accardi (kristen.c.accardi@intel.com) - * Copyright (C) 2006 Intel Corporation - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Send feedback to <kristen.c.accardi@intel.com> - * - */ -#include <linux/init.h> -#include <linux/module.h> - -#include <linux/kernel.h> -#include <linux/pci.h> -#include <linux/smp_lock.h> -#include <linux/mutex.h> - -#include "../pci.h" -#include "pci_hotplug.h" -#include "acpiphp.h" - -static struct acpiphp_dock_station *ds; -#define MY_NAME "acpiphp_dock" - - -int is_dependent_device(acpi_handle handle) -{ - return (get_dependent_device(handle) ? 1 : 0); -} - - -static acpi_status -find_dependent_device(acpi_handle handle, u32 lvl, void *context, void **rv) -{ - int *count = (int *)context; - - if (is_dependent_device(handle)) { - (*count)++; - return AE_CTRL_TERMINATE; - } else { - return AE_OK; - } -} - - - - -void add_dependent_device(struct dependent_device *new_dd) -{ - list_add_tail(&new_dd->device_list, &ds->dependent_devices); -} - - -void add_pci_dependent_device(struct dependent_device *new_dd) -{ - list_add_tail(&new_dd->pci_list, &ds->pci_dependent_devices); -} - - - -struct dependent_device * get_dependent_device(acpi_handle handle) -{ - struct dependent_device *dd; - - if (!ds) - return NULL; - - list_for_each_entry(dd, &ds->dependent_devices, device_list) { - if (handle == dd->handle) - return dd; - } - return NULL; -} - - - -struct dependent_device *alloc_dependent_device(acpi_handle handle) -{ - struct dependent_device *dd; - - dd = kzalloc(sizeof(*dd), GFP_KERNEL); - if (dd) { - INIT_LIST_HEAD(&dd->pci_list); - INIT_LIST_HEAD(&dd->device_list); - dd->handle = handle; - } - return dd; -} - - - -static int is_dock(acpi_handle handle) -{ - acpi_status status; - acpi_handle tmp; - - status = acpi_get_handle(handle, "_DCK", &tmp); - if (ACPI_FAILURE(status)) { - return 0; - } - return 1; -} - - - -static int dock_present(void) -{ - unsigned long sta; - acpi_status status; - - if (ds) { - status = acpi_evaluate_integer(ds->handle, "_STA", NULL, &sta); - if (ACPI_SUCCESS(status) && sta) - return 1; - } - return 0; -} - - - -static void eject_dock(void) -{ - struct acpi_object_list arg_list; - union acpi_object arg; - - arg_list.count = 1; - arg_list.pointer = &arg; - arg.type = ACPI_TYPE_INTEGER; - arg.integer.value = 1; - - if (ACPI_FAILURE(acpi_evaluate_object(ds->handle, "_EJ0", - &arg_list, NULL)) || dock_present()) - warn("%s: failed to eject dock!\n", __FUNCTION__); - - return; -} - - - - -static acpi_status handle_dock(int dock) -{ - acpi_status status; - struct acpi_object_list arg_list; - union acpi_object arg; - struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - - dbg("%s: %s\n", __FUNCTION__, dock ? "docking" : "undocking"); - - /* _DCK method has one argument */ - arg_list.count = 1; - arg_list.pointer = &arg; - arg.type = ACPI_TYPE_INTEGER; - arg.integer.value = dock; - status = acpi_evaluate_object(ds->handle, "_DCK", - &arg_list, &buffer); - if (ACPI_FAILURE(status)) - err("%s: failed to execute _DCK\n", __FUNCTION__); - acpi_os_free(buffer.pointer); - - return status; -} - - - -static inline void dock(void) -{ - handle_dock(1); -} - - - -static inline void undock(void) -{ - handle_dock(0); -} - - - -/* - * the _DCK method can do funny things... and sometimes not - * hah-hah funny. - * - * TBD - figure out a way to only call fixups for - * systems that require them. - */ -static void post_dock_fixups(void) -{ - struct pci_bus *bus; - u32 buses; - struct dependent_device *dd; - - list_for_each_entry(dd, &ds->pci_dependent_devices, pci_list) { - bus = dd->func->slot->bridge->pci_bus; - - /* fixup bad _DCK function that rewrites - * secondary bridge on slot - */ - pci_read_config_dword(bus->self, - PCI_PRIMARY_BUS, - &buses); - - if (((buses >> 8) & 0xff) != bus->secondary) { - buses = (buses & 0xff000000) - | ((unsigned int)(bus->primary) << 0) - | ((unsigned int)(bus->secondary) << 8) - | ((unsigned int)(bus->subordinate) << 16); - pci_write_config_dword(bus->self, - PCI_PRIMARY_BUS, - buses); - } - } -} - - - -static void hotplug_pci(u32 type) -{ - struct dependent_device *dd; - - list_for_each_entry(dd, &ds->pci_dependent_devices, pci_list) - handle_hotplug_event_func(dd->handle, type, dd->func); -} - - - -static inline void begin_dock(void) -{ - ds->flags |= DOCK_DOCKING; -} - - -static inline void complete_dock(void) -{ - ds->flags &= ~(DOCK_DOCKING); - ds->last_dock_time = jiffies; -} - - -static int dock_in_progress(void) -{ - if (ds->flags & DOCK_DOCKING || - ds->last_dock_time == jiffies) { - dbg("dock in progress\n"); - return 1; - } - return 0; -} - - - -static void -handle_hotplug_event_dock(acpi_handle handle, u32 type, void *context) -{ - dbg("%s: enter\n", __FUNCTION__); - - switch (type) { - case ACPI_NOTIFY_BUS_CHECK: - dbg("BUS Check\n"); - if (!dock_in_progress() && dock_present()) { - begin_dock(); - dock(); - if (!dock_present()) { - err("Unable to dock!\n"); - break; - } - post_dock_fixups(); - hotplug_pci(type); - complete_dock(); - } - break; - case ACPI_NOTIFY_EJECT_REQUEST: - dbg("EJECT request\n"); - if (!dock_in_progress() && dock_present()) { - hotplug_pci(type); - undock(); - eject_dock(); - if (dock_present()) - err("Unable to undock!\n"); - } - break; - } -} - - - - -static acpi_status -find_dock_ejd(acpi_handle handle, u32 lvl, void *context, void **rv) -{ - acpi_status status; - acpi_handle tmp; - acpi_handle dck_handle = (acpi_handle) context; - char objname[64]; - struct acpi_buffer buffer = { .length = sizeof(objname), - .pointer = objname }; - struct acpi_buffer ejd_buffer = {ACPI_ALLOCATE_BUFFER, NULL}; - union acpi_object *ejd_obj; - - status = acpi_get_handle(handle, "_EJD", &tmp); - if (ACPI_FAILURE(status)) - return AE_OK; - - /* make sure we are dependent on the dock device, - * by executing the _EJD method, then getting a handle - * to the device referenced by that name. If that - * device handle is the same handle as the dock station - * handle, then we are a device dependent on the dock station - */ - acpi_get_name(dck_handle, ACPI_FULL_PATHNAME, &buffer); - status = acpi_evaluate_object(handle, "_EJD", NULL, &ejd_buffer); - if (ACPI_FAILURE(status)) { - err("Unable to execute _EJD!\n"); - goto find_ejd_out; - } - ejd_obj = ejd_buffer.pointer; - status = acpi_get_handle(NULL, ejd_obj->string.pointer, &tmp); - if (ACPI_FAILURE(status)) - goto find_ejd_out; - - if (tmp == dck_handle) { - struct dependent_device *dd; - dbg("%s: found device dependent on dock\n", __FUNCTION__); - dd = alloc_dependent_device(handle); - if (!dd) { - err("Can't allocate memory for dependent device!\n"); - goto find_ejd_out; - } - add_dependent_device(dd); - } - -find_ejd_out: - acpi_os_free(ejd_buffer.pointer); - return AE_OK; -} - - - -int detect_dependent_devices(acpi_handle *bridge_handle) -{ - acpi_status status; - int count; - - count = 0; - - status = acpi_walk_namespace(ACPI_TYPE_DEVICE, bridge_handle, - (u32)1, find_dependent_device, - (void *)&count, NULL); - - return count; -} - - - - - -static acpi_status -find_dock(acpi_handle handle, u32 lvl, void *context, void **rv) -{ - int *count = (int *)context; - - if (is_dock(handle)) { - dbg("%s: found dock\n", __FUNCTION__); - ds = kzalloc(sizeof(*ds), GFP_KERNEL); - ds->handle = handle; - INIT_LIST_HEAD(&ds->dependent_devices); - INIT_LIST_HEAD(&ds->pci_dependent_devices); - - /* look for devices dependent on dock station */ - acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, find_dock_ejd, handle, NULL); - - acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, - handle_hotplug_event_dock, ds); - (*count)++; - } - - return AE_OK; -} - - - - -int find_dock_station(void) -{ - int num = 0; - - ds = NULL; - - /* start from the root object, because some laptops define - * _DCK methods outside the scope of PCI (IBM x-series laptop) - */ - acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, find_dock, &num, NULL); - - return num; -} - - - -void remove_dock_station(void) -{ - struct dependent_device *dd, *tmp; - if (ds) { - if (ACPI_FAILURE(acpi_remove_notify_handler(ds->handle, - ACPI_SYSTEM_NOTIFY, handle_hotplug_event_dock))) - err("failed to remove dock notify handler\n"); - - /* free all dependent devices */ - list_for_each_entry_safe(dd, tmp, &ds->dependent_devices, - device_list) - kfree(dd); - - /* no need to touch the pci_dependent_device list, - * cause all memory was freed above - */ - kfree(ds); - } -} - - diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index d370f999782..ef95d12fb32 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -59,6 +59,7 @@ static LIST_HEAD(bridge_list); static void handle_hotplug_event_bridge (acpi_handle, u32, void *); static void acpiphp_sanitize_bus(struct pci_bus *bus); static void acpiphp_set_hpp_values(acpi_handle handle, struct pci_bus *bus); +static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context); /* @@ -116,6 +117,59 @@ is_ejectable_slot(acpi_handle handle, u32 lvl, void *context, void **rv) } } +/* callback routine to check for the existance of a pci dock device */ +static acpi_status +is_pci_dock_device(acpi_handle handle, u32 lvl, void *context, void **rv) +{ + int *count = (int *)context; + + if (is_dock_device(handle)) { + (*count)++; + return AE_CTRL_TERMINATE; + } else { + return AE_OK; + } +} + + + + +/* + * the _DCK method can do funny things... and sometimes not + * hah-hah funny. + * + * TBD - figure out a way to only call fixups for + * systems that require them. + */ +static int post_dock_fixups(struct notifier_block *nb, unsigned long val, + void *v) +{ + struct acpiphp_func *func = container_of(nb, struct acpiphp_func, nb); + struct pci_bus *bus = func->slot->bridge->pci_bus; + u32 buses; + + if (!bus->self) + return NOTIFY_OK; + + /* fixup bad _DCK function that rewrites + * secondary bridge on slot + */ + pci_read_config_dword(bus->self, + PCI_PRIMARY_BUS, + &buses); + + if (((buses >> 8) & 0xff) != bus->secondary) { + buses = (buses & 0xff000000) + | ((unsigned int)(bus->primary) << 0) + | ((unsigned int)(bus->secondary) << 8) + | ((unsigned int)(bus->subordinate) << 16); + pci_write_config_dword(bus->self, PCI_PRIMARY_BUS, buses); + } + return NOTIFY_OK; +} + + + /* callback routine to register each ACPI PCI slot object */ static acpi_status @@ -124,7 +178,6 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) struct acpiphp_bridge *bridge = (struct acpiphp_bridge *)context; struct acpiphp_slot *slot; struct acpiphp_func *newfunc; - struct dependent_device *dd; acpi_handle tmp; acpi_status status = AE_OK; unsigned long adr, sun; @@ -137,7 +190,7 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) status = acpi_get_handle(handle, "_EJ0", &tmp); - if (ACPI_FAILURE(status) && !(is_dependent_device(handle))) + if (ACPI_FAILURE(status) && !(is_dock_device(handle))) return AE_OK; device = (adr >> 16) & 0xffff; @@ -162,22 +215,17 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) if (ACPI_SUCCESS(acpi_get_handle(handle, "_PS3", &tmp))) newfunc->flags |= FUNC_HAS_PS3; - if (ACPI_SUCCESS(acpi_get_handle(handle, "_DCK", &tmp))) { + if (ACPI_SUCCESS(acpi_get_handle(handle, "_DCK", &tmp))) newfunc->flags |= FUNC_HAS_DCK; - /* add to devices dependent on dock station, - * because this may actually be the dock bridge - */ - dd = alloc_dependent_device(handle); - if (!dd) - err("Can't allocate memory for " - "new dependent device!\n"); - else - add_dependent_device(dd); - } status = acpi_evaluate_integer(handle, "_SUN", NULL, &sun); - if (ACPI_FAILURE(status)) - sun = -1; + if (ACPI_FAILURE(status)) { + /* + * use the count of the number of slots we've found + * for the number of the slot + */ + sun = bridge->nr_slots+1; + } /* search for objects that share the same slot */ for (slot = bridge->slots; slot; slot = slot->next) @@ -225,20 +273,23 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) slot->flags |= (SLOT_ENABLED | SLOT_POWEREDON); } - /* if this is a device dependent on a dock station, - * associate the acpiphp_func to the dependent_device - * struct. - */ - if ((dd = get_dependent_device(handle))) { - newfunc->flags |= FUNC_IS_DD; - /* - * we don't want any devices which is dependent - * on the dock to have it's _EJ0 method executed. - * because we need to run _DCK first. + if (is_dock_device(handle)) { + /* we don't want to call this device's _EJ0 + * because we want the dock notify handler + * to call it after it calls _DCK */ newfunc->flags &= ~FUNC_HAS_EJ0; - dd->func = newfunc; - add_pci_dependent_device(dd); + if (register_hotplug_dock_device(handle, + handle_hotplug_event_func, newfunc)) + dbg("failed to register dock device\n"); + + /* we need to be notified when dock events happen + * outside of the hotplug operation, since we may + * need to do fixups before we can hotplug. + */ + newfunc->nb.notifier_call = post_dock_fixups; + if (register_dock_notifier(&newfunc->nb)) + dbg("failed to register a dock notifier"); } /* install notify handler */ @@ -277,6 +328,15 @@ static int detect_ejectable_slots(acpi_handle *bridge_handle) status = acpi_walk_namespace(ACPI_TYPE_DEVICE, bridge_handle, (u32)1, is_ejectable_slot, (void *)&count, NULL); + /* + * we also need to add this bridge if there is a dock bridge or + * other pci device on a dock station (removable) + */ + if (!count) + status = acpi_walk_namespace(ACPI_TYPE_DEVICE, bridge_handle, + (u32)1, is_pci_dock_device, (void *)&count, + NULL); + return count; } @@ -487,8 +547,7 @@ find_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv) goto out; /* check if this bridge has ejectable slots */ - if ((detect_ejectable_slots(handle) > 0) || - (detect_dependent_devices(handle) > 0)) { + if ((detect_ejectable_slots(handle) > 0)) { dbg("found PCI-to-PCI bridge at PCI %s\n", pci_name(dev)); add_p2p_bridge(handle, dev); } @@ -605,6 +664,10 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge) list_for_each_safe (list, tmp, &slot->funcs) { struct acpiphp_func *func; func = list_entry(list, struct acpiphp_func, sibling); + if (is_dock_device(func->handle)) { + unregister_hotplug_dock_device(func->handle); + unregister_dock_notifier(&func->nb); + } if (!(func->flags & FUNC_HAS_DCK)) { status = acpi_remove_notify_handler(func->handle, ACPI_SYSTEM_NOTIFY, @@ -1440,7 +1503,7 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont * handles ACPI event notification on slots * */ -void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context) +static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context) { struct acpiphp_func *func; char objname[64]; diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c index 037ce4c9168..d5df5871cfa 100644 --- a/drivers/pci/hotplug/cpci_hotplug_core.c +++ b/drivers/pci/hotplug/cpci_hotplug_core.c @@ -25,7 +25,6 @@ * Send feedback to <scottm@somanetworks.com> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> @@ -348,7 +347,7 @@ cpci_hp_intr(int irq, void *data, struct pt_regs *regs) dbg("entered cpci_hp_intr"); /* Check to see if it was our interrupt */ - if ((controller->irq_flags & SA_SHIRQ) && + if ((controller->irq_flags & IRQF_SHARED) && !controller->ops->check_irq(controller->dev_id)) { dbg("exited cpci_hp_intr, not our interrupt"); return IRQ_NONE; diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c index 225b5e551dd..02be74caa89 100644 --- a/drivers/pci/hotplug/cpci_hotplug_pci.c +++ b/drivers/pci/hotplug/cpci_hotplug_pci.c @@ -23,7 +23,6 @@ * Send feedback to <scottm@somanetworks.com> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/pci.h> diff --git a/drivers/pci/hotplug/cpcihp_generic.c b/drivers/pci/hotplug/cpcihp_generic.c index 2d4639d6841..e847f0d6c7f 100644 --- a/drivers/pci/hotplug/cpcihp_generic.c +++ b/drivers/pci/hotplug/cpcihp_generic.c @@ -34,7 +34,6 @@ * Send feedback to <scottm@somanetworks.com> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/errno.h> diff --git a/drivers/pci/hotplug/cpcihp_zt5550.c b/drivers/pci/hotplug/cpcihp_zt5550.c index f7cb00da38d..1c12e917109 100644 --- a/drivers/pci/hotplug/cpcihp_zt5550.c +++ b/drivers/pci/hotplug/cpcihp_zt5550.c @@ -30,13 +30,13 @@ * Send feedback to <scottm@somanetworks.com> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> #include <linux/errno.h> #include <linux/pci.h> -#include <linux/signal.h> /* SA_SHIRQ */ +#include <linux/interrupt.h> +#include <linux/signal.h> /* IRQF_SHARED */ #include "cpci_hotplug.h" #include "cpcihp_zt5550.h" @@ -95,8 +95,8 @@ static int zt5550_hc_config(struct pci_dev *pdev) hc_dev = pdev; dbg("hc_dev = %p", hc_dev); - dbg("pci resource start %lx", pci_resource_start(hc_dev, 1)); - dbg("pci resource len %lx", pci_resource_len(hc_dev, 1)); + dbg("pci resource start %llx", (unsigned long long)pci_resource_start(hc_dev, 1)); + dbg("pci resource len %llx", (unsigned long long)pci_resource_len(hc_dev, 1)); if(!request_mem_region(pci_resource_start(hc_dev, 1), pci_resource_len(hc_dev, 1), MY_NAME)) { @@ -108,8 +108,9 @@ static int zt5550_hc_config(struct pci_dev *pdev) hc_registers = ioremap(pci_resource_start(hc_dev, 1), pci_resource_len(hc_dev, 1)); if(!hc_registers) { - err("cannot remap MMIO region %lx @ %lx", - pci_resource_len(hc_dev, 1), pci_resource_start(hc_dev, 1)); + err("cannot remap MMIO region %llx @ %llx", + (unsigned long long)pci_resource_len(hc_dev, 1), + (unsigned long long)pci_resource_start(hc_dev, 1)); ret = -ENODEV; goto exit_release_region; } @@ -219,7 +220,7 @@ static int zt5550_hc_init_one (struct pci_dev *pdev, const struct pci_device_id zt5550_hpc.ops = &zt5550_hpc_ops; if(!poll) { zt5550_hpc.irq = hc_dev->irq; - zt5550_hpc.irq_flags = SA_SHIRQ; + zt5550_hpc.irq_flags = IRQF_SHARED; zt5550_hpc.dev_id = hc_dev; zt5550_hpc_ops.enable_irq = zt5550_hc_enable_irq; diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index 9bc1deb8df5..1fc259913b6 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c @@ -29,7 +29,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> @@ -1089,8 +1088,8 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } dbg("pdev = %p\n", pdev); - dbg("pci resource start %lx\n", pci_resource_start(pdev, 0)); - dbg("pci resource len %lx\n", pci_resource_len(pdev, 0)); + dbg("pci resource start %llx\n", (unsigned long long)pci_resource_start(pdev, 0)); + dbg("pci resource len %llx\n", (unsigned long long)pci_resource_len(pdev, 0)); if (!request_mem_region(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0), MY_NAME)) { @@ -1102,9 +1101,9 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ctrl->hpc_reg = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); if (!ctrl->hpc_reg) { - err("cannot remap MMIO region %lx @ %lx\n", - pci_resource_len(pdev, 0), - pci_resource_start(pdev, 0)); + err("cannot remap MMIO region %llx @ %llx\n", + (unsigned long long)pci_resource_len(pdev, 0), + (unsigned long long)pci_resource_start(pdev, 0)); rc = -ENODEV; goto err_free_mem_region; } @@ -1189,7 +1188,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* set up the interrupt */ dbg("HPC interrupt = %d \n", ctrl->interrupt); if (request_irq(ctrl->interrupt, cpqhp_ctrl_intr, - SA_SHIRQ, MY_NAME, ctrl)) { + IRQF_SHARED, MY_NAME, ctrl)) { err("Can't get irq %d for the hotplug pci controller\n", ctrl->interrupt); rc = -ENODEV; diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 55d2dc7e39c..ae2dd36efef 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c @@ -26,7 +26,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> diff --git a/drivers/pci/hotplug/cpqphp_nvram.c b/drivers/pci/hotplug/cpqphp_nvram.c index ac98a11bd1e..cf087891753 100644 --- a/drivers/pci/hotplug/cpqphp_nvram.c +++ b/drivers/pci/hotplug/cpqphp_nvram.c @@ -26,7 +26,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> diff --git a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c index 00b81a7bdd2..0d9688952f4 100644 --- a/drivers/pci/hotplug/cpqphp_pci.c +++ b/drivers/pci/hotplug/cpqphp_pci.c @@ -26,7 +26,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> diff --git a/drivers/pci/hotplug/cpqphp_sysfs.c b/drivers/pci/hotplug/cpqphp_sysfs.c index bbfeed767ff..8b3da007e85 100644 --- a/drivers/pci/hotplug/cpqphp_sysfs.c +++ b/drivers/pci/hotplug/cpqphp_sysfs.c @@ -26,7 +26,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c index 71b80c23e8c..dd2b762777c 100644 --- a/drivers/pci/hotplug/fakephp.c +++ b/drivers/pci/hotplug/fakephp.c @@ -32,7 +32,6 @@ * Enabling PCI devices is left as an exercise for the reader... * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index c4282902cb5..b7b378df89e 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c @@ -27,7 +27,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index d77138ecb09..0d8fb6e607a 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -1398,8 +1398,9 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev) for ( rc = 0; rc < DEVICE_COUNT_RESOURCE; rc++) if (pci_resource_len(pdev, rc) > 0) - dbg("pci resource[%d] start=0x%lx(len=0x%lx)\n", rc, - pci_resource_start(pdev, rc), pci_resource_len(pdev, rc)); + dbg("pci resource[%d] start=0x%llx(len=0x%llx)\n", rc, + (unsigned long long)pci_resource_start(pdev, rc), + (unsigned long long)pci_resource_len(pdev, rc)); info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor, pdev->subsystem_device); @@ -1457,7 +1458,7 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev) start_int_poll_timer( php_ctlr, 10 ); /* start with 10 second delay */ } else { /* Installs the interrupt handler */ - rc = request_irq(php_ctlr->irq, pcie_isr, SA_SHIRQ, MY_NAME, (void *) ctrl); + rc = request_irq(php_ctlr->irq, pcie_isr, IRQF_SHARED, MY_NAME, (void *) ctrl); dbg("%s: request_irq %d for hpc%d (returns %d)\n", __FUNCTION__, php_ctlr->irq, ctlr_seq_num, rc); if (rc) { err("Can't get irq %d for the hotplug controller\n", php_ctlr->irq); diff --git a/drivers/pci/hotplug/pcihp_skeleton.c b/drivers/pci/hotplug/pcihp_skeleton.c index 0a46f549676..8ad446605f7 100644 --- a/drivers/pci/hotplug/pcihp_skeleton.c +++ b/drivers/pci/hotplug/pcihp_skeleton.c @@ -28,7 +28,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c index 63800454670..076bd6dcafa 100644 --- a/drivers/pci/hotplug/rpaphp_core.c +++ b/drivers/pci/hotplug/rpaphp_core.c @@ -22,7 +22,6 @@ * Send feedback to <lxie@us.ibm.com> * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/moduleparam.h> diff --git a/drivers/pci/hotplug/shpchp_hpc.c b/drivers/pci/hotplug/shpchp_hpc.c index 45facaad39b..0f9798df470 100644 --- a/drivers/pci/hotplug/shpchp_hpc.c +++ b/drivers/pci/hotplug/shpchp_hpc.c @@ -1246,7 +1246,7 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev) } else php_ctlr->irq = pdev->irq; - rc = request_irq(php_ctlr->irq, shpc_isr, SA_SHIRQ, MY_NAME, (void *) ctrl); + rc = request_irq(php_ctlr->irq, shpc_isr, IRQF_SHARED, MY_NAME, (void *) ctrl); dbg("%s: request_irq %d for hpc%d (returns %d)\n", __FUNCTION__, php_ctlr->irq, ctlr_seq_num, rc); if (rc) { err("Can't get irq %d for the hotplug controller\n", php_ctlr->irq); diff --git a/drivers/pci/hotplug/shpchp_sysfs.c b/drivers/pci/hotplug/shpchp_sysfs.c index f5cfbf2c047..620e1139e60 100644 --- a/drivers/pci/hotplug/shpchp_sysfs.c +++ b/drivers/pci/hotplug/shpchp_sysfs.c @@ -51,8 +51,10 @@ static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, cha res = bus->resource[index]; if (res && (res->flags & IORESOURCE_MEM) && !(res->flags & IORESOURCE_PREFETCH)) { - out += sprintf(out, "start = %8.8lx, length = %8.8lx\n", - res->start, (res->end - res->start)); + out += sprintf(out, "start = %8.8llx, " + "length = %8.8llx\n", + (unsigned long long)res->start, + (unsigned long long)(res->end - res->start)); } } out += sprintf(out, "Free resources: prefetchable memory\n"); @@ -60,16 +62,20 @@ static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, cha res = bus->resource[index]; if (res && (res->flags & IORESOURCE_MEM) && (res->flags & IORESOURCE_PREFETCH)) { - out += sprintf(out, "start = %8.8lx, length = %8.8lx\n", - res->start, (res->end - res->start)); + out += sprintf(out, "start = %8.8llx, " + "length = %8.8llx\n", + (unsigned long long)res->start, + (unsigned long long)(res->end - res->start)); } } out += sprintf(out, "Free resources: IO\n"); for (index = 0; index < PCI_BUS_NUM_RESOURCES; index++) { res = bus->resource[index]; if (res && (res->flags & IORESOURCE_IO)) { - out += sprintf(out, "start = %8.8lx, length = %8.8lx\n", - res->start, (res->end - res->start)); + out += sprintf(out, "start = %8.8llx, " + "length = %8.8llx\n", + (unsigned long long)res->start, + (unsigned long long)(res->end - res->start)); } } out += sprintf(out, "Free resources: bus numbers\n"); diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 7f8429284fa..36bc7c415af 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -10,7 +10,6 @@ #include <linux/irq.h> #include <linux/interrupt.h> #include <linux/init.h> -#include <linux/config.h> #include <linux/ioport.h> #include <linux/smp_lock.h> #include <linux/pci.h> @@ -429,12 +428,12 @@ static void irq_handler_init(int cap_id, int pos, int mask) spin_lock_irqsave(&irq_desc[pos].lock, flags); if (cap_id == PCI_CAP_ID_MSIX) - irq_desc[pos].handler = &msix_irq_type; + irq_desc[pos].chip = &msix_irq_type; else { if (!mask) - irq_desc[pos].handler = &msi_irq_wo_maskbit_type; + irq_desc[pos].chip = &msi_irq_wo_maskbit_type; else - irq_desc[pos].handler = &msi_irq_w_maskbit_type; + irq_desc[pos].chip = &msi_irq_w_maskbit_type; } spin_unlock_irqrestore(&irq_desc[pos].lock, flags); } diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index bc405c035ce..fdefa7dcd15 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -15,7 +15,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/pci.h> #include <linux/stat.h> @@ -87,7 +86,7 @@ resource_show(struct device * dev, struct device_attribute *attr, char * buf) char * str = buf; int i; int max = 7; - u64 start, end; + resource_size_t start, end; if (pci_dev->subordinate) max = DEVICE_COUNT_RESOURCE; @@ -365,7 +364,7 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, struct device, kobj)); struct resource *res = (struct resource *)attr->private; enum pci_mmap_state mmap_type; - u64 start, end; + resource_size_t start, end; int i; for (i = 0; i < PCI_ROM_RESOURCE; i++) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 23d3b17c8ca..cf57d7de376 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -691,10 +691,12 @@ int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name) return 0; err_out: - printk (KERN_WARNING "PCI: Unable to reserve %s region #%d:%lx@%lx for device %s\n", + printk (KERN_WARNING "PCI: Unable to reserve %s region #%d:%llx@%llx " + "for device %s\n", pci_resource_flags(pdev, bar) & IORESOURCE_IO ? "I/O" : "mem", bar + 1, /* PCI BAR # */ - pci_resource_len(pdev, bar), pci_resource_start(pdev, bar), + (unsigned long long)pci_resource_len(pdev, bar), + (unsigned long long)pci_resource_start(pdev, bar), pci_name(pdev)); return -EBUSY; } diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 29bdeca031a..9cc842b666e 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -6,10 +6,10 @@ extern int pci_create_sysfs_dev_files(struct pci_dev *pdev); extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev); extern void pci_cleanup_rom(struct pci_dev *dev); extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, - unsigned long size, unsigned long align, - unsigned long min, unsigned int type_mask, + resource_size_t size, resource_size_t align, + resource_size_t min, unsigned int type_mask, void (*alignf)(void *, struct resource *, - unsigned long, unsigned long), + resource_size_t, resource_size_t), void *alignf_data); /* Firmware callbacks */ extern int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c index 54b2ebc9c91..99cf3337976 100644 --- a/drivers/pci/proc.c +++ b/drivers/pci/proc.c @@ -302,12 +302,6 @@ static struct file_operations proc_bus_pci_operations = { #endif /* HAVE_PCI_MMAP */ }; -#if BITS_PER_LONG == 32 -#define LONG_FORMAT "\t%08lx" -#else -#define LONG_FORMAT "\t%16lx" -#endif - /* iterator */ static void *pci_seq_start(struct seq_file *m, loff_t *pos) { @@ -356,18 +350,18 @@ static int show_device(struct seq_file *m, void *v) dev->irq); /* Here should be 7 and not PCI_NUM_RESOURCES as we need to preserve compatibility */ for (i=0; i<7; i++) { - u64 start, end; + resource_size_t start, end; pci_resource_to_user(dev, i, &dev->resource[i], &start, &end); - seq_printf(m, LONG_FORMAT, - ((unsigned long)start) | - (dev->resource[i].flags & PCI_REGION_FLAG_MASK)); + seq_printf(m, "\t%16llx", + (unsigned long long)(start | + (dev->resource[i].flags & PCI_REGION_FLAG_MASK))); } for (i=0; i<7; i++) { - u64 start, end; + resource_size_t start, end; pci_resource_to_user(dev, i, &dev->resource[i], &start, &end); - seq_printf(m, LONG_FORMAT, + seq_printf(m, "\t%16llx", dev->resource[i].start < dev->resource[i].end ? - (unsigned long)(end - start) + 1 : 0); + (unsigned long long)(end - start) + 1 : 0); } seq_putc(m, '\t'); if (drv) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 4364d793f73..d1d7333bb71 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -15,7 +15,6 @@ * use the PowerTweak utility (see http://powertweak.sourceforge.net). */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/pci.h> diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index 598a115cd00..f5ee7ce16fa 100644 --- a/drivers/pci/rom.c +++ b/drivers/pci/rom.c @@ -6,7 +6,6 @@ * * PCI ROM access routines */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/pci.h> #include <linux/slab.h> @@ -80,8 +79,8 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) } else { if (res->flags & IORESOURCE_ROM_COPY) { *size = pci_resource_len(pdev, PCI_ROM_RESOURCE); - return (void __iomem *)pci_resource_start(pdev, - PCI_ROM_RESOURCE); + return (void __iomem *)(unsigned long) + pci_resource_start(pdev, PCI_ROM_RESOURCE); } else { /* assign the ROM an address if it doesn't have one */ if (res->parent == NULL && @@ -170,11 +169,11 @@ void __iomem *pci_map_rom_copy(struct pci_dev *pdev, size_t *size) return rom; res->end = res->start + *size; - memcpy_fromio((void*)res->start, rom, *size); + memcpy_fromio((void*)(unsigned long)res->start, rom, *size); pci_unmap_rom(pdev, rom); res->flags |= IORESOURCE_ROM_COPY; - return (void __iomem *)res->start; + return (void __iomem *)(unsigned long)res->start; } /** @@ -227,7 +226,7 @@ void pci_cleanup_rom(struct pci_dev *pdev) { struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; if (res->flags & IORESOURCE_ROM_COPY) { - kfree((void*)res->start); + kfree((void*)(unsigned long)res->start); res->flags &= ~IORESOURCE_ROM_COPY; res->start = 0; res->end = 0; diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 35086e80faa..47c1071ad84 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -357,8 +357,10 @@ pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long type) order = __ffs(align) - 20; if (order > 11) { printk(KERN_WARNING "PCI: region %s/%d " - "too large: %lx-%lx\n", - pci_name(dev), i, r->start, r->end); + "too large: %llx-%llx\n", + pci_name(dev), i, + (unsigned long long)r->start, + (unsigned long long)r->end); r->flags = 0; continue; } diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 577f4b55c46..ab78e4bbdd8 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c @@ -40,8 +40,9 @@ pci_update_resource(struct pci_dev *dev, struct resource *res, int resno) pcibios_resource_to_bus(dev, ®ion, res); - pr_debug(" got res [%lx:%lx] bus [%lx:%lx] flags %lx for " - "BAR %d of %s\n", res->start, res->end, + pr_debug(" got res [%llx:%llx] bus [%lx:%lx] flags %lx for " + "BAR %d of %s\n", (unsigned long long)res->start, + (unsigned long long)res->end, region.start, region.end, res->flags, resno, pci_name(dev)); new = region.start | (res->flags & PCI_REGION_FLAG_MASK); @@ -104,10 +105,12 @@ pci_claim_resource(struct pci_dev *dev, int resource) err = insert_resource(root, res); if (err) { - printk(KERN_ERR "PCI: %s region %d of %s %s [%lx:%lx]\n", - root ? "Address space collision on" : - "No parent found for", - resource, dtype, pci_name(dev), res->start, res->end); + printk(KERN_ERR "PCI: %s region %d of %s %s [%llx:%llx]\n", + root ? "Address space collision on" : + "No parent found for", + resource, dtype, pci_name(dev), + (unsigned long long)res->start, + (unsigned long long)res->end); } return err; @@ -118,7 +121,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno) { struct pci_bus *bus = dev->bus; struct resource *res = dev->resource + resno; - unsigned long size, min, align; + resource_size_t size, min, align; int ret; size = res->end - res->start + 1; @@ -145,9 +148,11 @@ int pci_assign_resource(struct pci_dev *dev, int resno) } if (ret) { - printk(KERN_ERR "PCI: Failed to allocate %s resource #%d:%lx@%lx for %s\n", - res->flags & IORESOURCE_IO ? "I/O" : "mem", - resno, size, res->start, pci_name(dev)); + printk(KERN_ERR "PCI: Failed to allocate %s resource " + "#%d:%llx@%llx for %s\n", + res->flags & IORESOURCE_IO ? "I/O" : "mem", + resno, (unsigned long long)size, + (unsigned long long)res->start, pci_name(dev)); } else if (resno < PCI_BRIDGE_RESOURCES) { pci_update_resource(dev, res, resno); } @@ -204,7 +209,7 @@ pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) for (i = 0; i < PCI_NUM_RESOURCES; i++) { struct resource *r; struct resource_list *list, *tmp; - unsigned long r_align; + resource_size_t r_align; r = &dev->resource[i]; r_align = r->end - r->start; @@ -213,13 +218,14 @@ pdev_sort_resources(struct pci_dev *dev, struct resource_list *head) continue; if (!r_align) { printk(KERN_WARNING "PCI: Ignore bogus resource %d " - "[%lx:%lx] of %s\n", - i, r->start, r->end, pci_name(dev)); + "[%llx:%llx] of %s\n", + i, (unsigned long long)r->start, + (unsigned long long)r->end, pci_name(dev)); continue; } r_align = (i < PCI_BRIDGE_RESOURCES) ? r_align + 1 : r->start; for (list = head; ; list = list->next) { - unsigned long align = 0; + resource_size_t align = 0; struct resource_list *ln = list->next; int idx; diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c index a4d50940ebe..40569f40e90 100644 --- a/drivers/pcmcia/at91_cf.c +++ b/drivers/pcmcia/at91_cf.c @@ -214,11 +214,10 @@ static struct pccard_operations at91_cf_ops = { /*--------------------------------------------------------------------------*/ -static int __init at91_cf_probe(struct device *dev) +static int __init at91_cf_probe(struct platform_device *pdev) { struct at91_cf_socket *cf; - struct at91_cf_data *board = dev->platform_data; - struct platform_device *pdev = to_platform_device(dev); + struct at91_cf_data *board = pdev->dev.platform_data; struct resource *io; unsigned int csa; int status; @@ -236,7 +235,7 @@ static int __init at91_cf_probe(struct device *dev) cf->board = board; cf->pdev = pdev; - dev_set_drvdata(dev, cf); + platform_set_drvdata(pdev, cf); /* CF takes over CS4, CS5, CS6 */ csa = at91_sys_read(AT91_EBI_CSA); @@ -268,9 +267,10 @@ static int __init at91_cf_probe(struct device *dev) /* must be a GPIO; ergo must trigger on both edges */ status = request_irq(board->det_pin, at91_cf_irq, - SA_SAMPLE_RANDOM, driver_name, cf); + IRQF_SAMPLE_RANDOM, driver_name, cf); if (status < 0) goto fail0; + device_init_wakeup(&pdev->dev, 1); /* * The card driver will request this irq later as needed. @@ -280,7 +280,7 @@ static int __init at91_cf_probe(struct device *dev) */ if (board->irq_pin) { status = request_irq(board->irq_pin, at91_cf_irq, - SA_SHIRQ, driver_name, cf); + IRQF_SHARED, driver_name, cf); if (status < 0) goto fail0a; cf->socket.pci_irq = board->irq_pin; @@ -301,7 +301,7 @@ static int __init at91_cf_probe(struct device *dev) board->det_pin, board->irq_pin); cf->socket.owner = THIS_MODULE; - cf->socket.dev.dev = dev; + cf->socket.dev.dev = &pdev->dev; cf->socket.ops = &at91_cf_ops; cf->socket.resource_ops = &pccard_static_ops; cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP @@ -323,21 +323,25 @@ fail1: free_irq(board->irq_pin, cf); fail0a: free_irq(board->det_pin, cf); + device_init_wakeup(&pdev->dev, 0); fail0: at91_sys_write(AT91_EBI_CSA, csa); kfree(cf); return status; } -static int __exit at91_cf_remove(struct device *dev) +static int __exit at91_cf_remove(struct platform_device *pdev) { - struct at91_cf_socket *cf = dev_get_drvdata(dev); + struct at91_cf_socket *cf = platform_get_drvdata(pdev); + struct at91_cf_data *board = cf->board; struct resource *io = cf->socket.io[0].res; unsigned int csa; pcmcia_unregister_socket(&cf->socket); - free_irq(cf->board->irq_pin, cf); - free_irq(cf->board->det_pin, cf); + if (board->irq_pin) + free_irq(board->irq_pin, cf); + free_irq(board->det_pin, cf); + device_init_wakeup(&pdev->dev, 0); iounmap((void __iomem *) cf->socket.io_offset); release_mem_region(io->start, io->end + 1 - io->start); @@ -348,26 +352,65 @@ static int __exit at91_cf_remove(struct device *dev) return 0; } -static struct device_driver at91_cf_driver = { - .name = (char *) driver_name, - .bus = &platform_bus_type, +#ifdef CONFIG_PM + +static int at91_cf_suspend(struct platform_device *pdev, pm_message_t mesg) +{ + struct at91_cf_socket *cf = platform_get_drvdata(pdev); + struct at91_cf_data *board = cf->board; + + pcmcia_socket_dev_suspend(&pdev->dev, mesg); + if (device_may_wakeup(&pdev->dev)) + enable_irq_wake(board->det_pin); + else { + disable_irq_wake(board->det_pin); + disable_irq(board->det_pin); + } + if (board->irq_pin) + disable_irq(board->irq_pin); + return 0; +} + +static int at91_cf_resume(struct platform_device *pdev) +{ + struct at91_cf_socket *cf = platform_get_drvdata(pdev); + struct at91_cf_data *board = cf->board; + + if (board->irq_pin) + enable_irq(board->irq_pin); + if (!device_may_wakeup(&pdev->dev)) + enable_irq(board->det_pin); + pcmcia_socket_dev_resume(&pdev->dev); + return 0; +} + +#else +#define at91_cf_suspend NULL +#define at91_cf_resume NULL +#endif + +static struct platform_driver at91_cf_driver = { + .driver = { + .name = (char *) driver_name, + .owner = THIS_MODULE, + }, .probe = at91_cf_probe, .remove = __exit_p(at91_cf_remove), - .suspend = pcmcia_socket_dev_suspend, - .resume = pcmcia_socket_dev_resume, + .suspend = at91_cf_suspend, + .resume = at91_cf_resume, }; /*--------------------------------------------------------------------------*/ static int __init at91_cf_init(void) { - return driver_register(&at91_cf_driver); + return platform_driver_register(&at91_cf_driver); } module_init(at91_cf_init); static void __exit at91_cf_exit(void) { - driver_unregister(&at91_cf_driver); + platform_driver_unregister(&at91_cf_driver); } module_exit(at91_cf_exit); diff --git a/drivers/pcmcia/au1000_db1x00.c b/drivers/pcmcia/au1000_db1x00.c index abc13f28ba3..74e051535d6 100644 --- a/drivers/pcmcia/au1000_db1x00.c +++ b/drivers/pcmcia/au1000_db1x00.c @@ -30,7 +30,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> @@ -296,7 +295,7 @@ struct pcmcia_low_level db1x00_pcmcia_ops = { .socket_suspend = db1x00_socket_suspend }; -int __init au1x_board_init(struct device *dev) +int au1x_board_init(struct device *dev) { int ret = -ENODEV; bcsr->pcmcia = 0; /* turn off power, if it's not already off */ diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c index 971a3528164..d5dd0ce6553 100644 --- a/drivers/pcmcia/au1000_generic.c +++ b/drivers/pcmcia/au1000_generic.c @@ -33,7 +33,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> -#include <linux/config.h> #include <linux/cpufreq.h> #include <linux/ioport.h> #include <linux/kernel.h> diff --git a/drivers/pcmcia/au1000_generic.h b/drivers/pcmcia/au1000_generic.h index f2c970b5f4f..1e467bb5407 100644 --- a/drivers/pcmcia/au1000_generic.h +++ b/drivers/pcmcia/au1000_generic.h @@ -22,7 +22,6 @@ #define __ASM_AU1000_PCMCIA_H /* include the world */ -#include <linux/config.h> #include <pcmcia/cs_types.h> #include <pcmcia/cs.h> diff --git a/drivers/pcmcia/au1000_pb1x00.c b/drivers/pcmcia/au1000_pb1x00.c index fd5522ede86..86c0808d6a0 100644 --- a/drivers/pcmcia/au1000_pb1x00.c +++ b/drivers/pcmcia/au1000_pb1x00.c @@ -21,7 +21,6 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/delay.h> diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 3162998579c..f9cd831a3f3 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -28,6 +28,7 @@ #include <linux/pm.h> #include <linux/pci.h> #include <linux/device.h> +#include <linux/kthread.h> #include <asm/system.h> #include <asm/irq.h> @@ -176,6 +177,7 @@ static int pccardd(void *__skt); */ int pcmcia_register_socket(struct pcmcia_socket *socket) { + struct task_struct *tsk; int ret; if (!socket || !socket->ops || !socket->dev.dev || !socket->resource_ops) @@ -239,15 +241,18 @@ int pcmcia_register_socket(struct pcmcia_socket *socket) mutex_init(&socket->skt_mutex); spin_lock_init(&socket->thread_lock); - ret = kernel_thread(pccardd, socket, CLONE_KERNEL); - if (ret < 0) + tsk = kthread_run(pccardd, socket, "pccardd"); + if (IS_ERR(tsk)) { + ret = PTR_ERR(tsk); goto err; + } wait_for_completion(&socket->thread_done); - if(!socket->thread) { + if (!socket->thread) { printk(KERN_WARNING "PCMCIA: warning: socket thread for socket %p did not start\n", socket); return -EIO; } + pcmcia_parse_events(socket, SS_DETECT); return 0; @@ -272,10 +277,8 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket) cs_dbg(socket, 0, "pcmcia_unregister_socket(0x%p)\n", socket->ops); if (socket->thread) { - init_completion(&socket->thread_done); - socket->thread = NULL; wake_up(&socket->thread_wait); - wait_for_completion(&socket->thread_done); + kthread_stop(socket->thread); } release_cis_mem(socket); @@ -630,8 +633,6 @@ static int pccardd(void *__skt) DECLARE_WAITQUEUE(wait, current); int ret; - daemonize("pccardd"); - skt->thread = current; skt->socket = dead_socket; skt->ops->init(skt); @@ -643,7 +644,8 @@ static int pccardd(void *__skt) printk(KERN_WARNING "PCMCIA: unable to register socket 0x%p\n", skt); skt->thread = NULL; - complete_and_exit(&skt->thread_done, 0); + complete(&skt->thread_done); + return 0; } add_wait_queue(&skt->thread_wait, &wait); @@ -674,7 +676,7 @@ static int pccardd(void *__skt) continue; } - if (!skt->thread) + if (kthread_should_stop()) break; schedule(); @@ -688,7 +690,7 @@ static int pccardd(void *__skt) /* remove from the device core */ class_device_unregister(&skt->dev); - complete_and_exit(&skt->thread_done, 0); + return 0; } /* @@ -697,11 +699,12 @@ static int pccardd(void *__skt) */ void pcmcia_parse_events(struct pcmcia_socket *s, u_int events) { + unsigned long flags; cs_dbg(s, 4, "parse_events: events %08x\n", events); if (s->thread) { - spin_lock(&s->thread_lock); + spin_lock_irqsave(&s->thread_lock, flags); s->thread_events |= events; - spin_unlock(&s->thread_lock); + spin_unlock_irqrestore(&s->thread_lock, flags); wake_up(&s->thread_wait); } diff --git a/drivers/pcmcia/hd64465_ss.c b/drivers/pcmcia/hd64465_ss.c index b39435bbfae..ad02629c8be 100644 --- a/drivers/pcmcia/hd64465_ss.c +++ b/drivers/pcmcia/hd64465_ss.c @@ -244,8 +244,8 @@ static void hs_map_irq(hs_socket_t *sp, unsigned int irq) hs_mapped_irq[irq].sock = sp; /* insert ourselves as the irq controller */ - hs_mapped_irq[irq].old_handler = irq_desc[irq].handler; - irq_desc[irq].handler = &hd64465_ss_irq_type; + hs_mapped_irq[irq].old_handler = irq_desc[irq].chip; + irq_desc[irq].chip = &hd64465_ss_irq_type; } @@ -260,7 +260,7 @@ static void hs_unmap_irq(hs_socket_t *sp, unsigned int irq) return; /* restore the original irq controller */ - irq_desc[irq].handler = hs_mapped_irq[irq].old_handler; + irq_desc[irq].chip = hs_mapped_irq[irq].old_handler; } /*============================================================*/ @@ -761,7 +761,7 @@ static int hs_init_socket(hs_socket_t *sp, int irq, unsigned long mem_base, hd64465_register_irq_demux(sp->irq, hs_irq_demux, sp); - if ((err = request_irq(sp->irq, hs_interrupt, SA_INTERRUPT, MODNAME, sp)) < 0) + if ((err = request_irq(sp->irq, hs_interrupt, IRQF_DISABLED, MODNAME, sp)) < 0) return err; if (request_mem_region(sp->mem_base, sp->mem_length, MODNAME) == 0) { sp->mem_base = 0; diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c index d5f03a338c6..2163aa75a25 100644 --- a/drivers/pcmcia/i82092.c +++ b/drivers/pcmcia/i82092.c @@ -149,7 +149,7 @@ static int __devinit i82092aa_pci_probe(struct pci_dev *dev, const struct pci_de /* Register the interrupt handler */ dprintk(KERN_DEBUG "Requesting interrupt %i \n",dev->irq); - if ((ret = request_irq(dev->irq, i82092aa_interrupt, SA_SHIRQ, "i82092aa", i82092aa_interrupt))) { + if ((ret = request_irq(dev->irq, i82092aa_interrupt, IRQF_SHARED, "i82092aa", i82092aa_interrupt))) { printk(KERN_ERR "i82092aa: Failed to register IRQ %d, aborting\n", dev->irq); goto err_out_free_res; } diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index a2f05f48515..1cc2682394b 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c @@ -509,7 +509,7 @@ static irqreturn_t i365_count_irq(int irq, void *dev, struct pt_regs *regs) static u_int __init test_irq(u_short sock, int irq) { debug(2, " testing ISA irq %d\n", irq); - if (request_irq(irq, i365_count_irq, SA_PROBEIRQ, "scan", + if (request_irq(irq, i365_count_irq, IRQF_PROBE_SHARED, "scan", i365_count_irq) != 0) return 1; irq_hits = 0; irq_sock = sock; @@ -562,7 +562,7 @@ static u_int __init isa_scan(u_short sock, u_int mask0) } else { /* Fallback: just find interrupts that aren't in use */ for (i = 0; i < 16; i++) - if ((mask0 & (1 << i)) && (_check_irq(i, SA_PROBEIRQ) == 0)) + if ((mask0 & (1 << i)) && (_check_irq(i, IRQF_PROBE_SHARED) == 0)) mask1 |= (1 << i); printk("default"); /* If scan failed, default to polled status */ @@ -726,7 +726,7 @@ static void __init add_pcic(int ns, int type) u_int cs_mask = mask & ((cs_irq) ? (1<<cs_irq) : ~(1<<12)); for (cs_irq = 15; cs_irq > 0; cs_irq--) if ((cs_mask & (1 << cs_irq)) && - (_check_irq(cs_irq, SA_PROBEIRQ) == 0)) + (_check_irq(cs_irq, IRQF_PROBE_SHARED) == 0)) break; if (cs_irq) { grab_irq = 1; @@ -1084,9 +1084,10 @@ static int i365_set_mem_map(u_short sock, struct pccard_mem_map *mem) u_short base, i; u_char map; - debug(1, "SetMemMap(%d, %d, %#2.2x, %d ns, %#lx-%#lx, " + debug(1, "SetMemMap(%d, %d, %#2.2x, %d ns, %#llx-%#llx, " "%#x)\n", sock, mem->map, mem->flags, mem->speed, - mem->res->start, mem->res->end, mem->card_start); + (unsigned long long)mem->res->start, + (unsigned long long)mem->res->end, mem->card_start); map = mem->map; if ((map > 4) || (mem->card_start > 0x3ffffff) || diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c index 071cf485e1a..9e768eaef17 100644 --- a/drivers/pcmcia/m32r_cfc.c +++ b/drivers/pcmcia/m32r_cfc.c @@ -10,7 +10,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/fcntl.h> #include <linux/string.h> diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c index 70d5f0748d5..61d50b5620d 100644 --- a/drivers/pcmcia/m32r_pcc.c +++ b/drivers/pcmcia/m32r_pcc.c @@ -10,7 +10,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/fcntl.h> #include <linux/string.h> diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c index 2c23d758439..420e10aec0a 100644 --- a/drivers/pcmcia/omap_cf.c +++ b/drivers/pcmcia/omap_cf.c @@ -232,7 +232,7 @@ static int __init omap_cf_probe(struct device *dev) dev_set_drvdata(dev, cf); /* this primarily just shuts up irq handling noise */ - status = request_irq(irq, omap_cf_irq, SA_SHIRQ, + status = request_irq(irq, omap_cf_irq, IRQF_SHARED, driver_name, cf); if (status < 0) goto fail0; diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 3131bb0a009..7bf25b88ea3 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -788,6 +788,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) struct pcmcia_socket *s = p_dev->socket; config_t *c; int ret = CS_IN_USE, irq = 0; + int type; if (!(s->state & SOCKET_PRESENT)) return CS_NO_CARD; @@ -797,6 +798,13 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) if (c->state & CONFIG_IRQ_REQ) return CS_IN_USE; + /* Decide what type of interrupt we are registering */ + type = 0; + if (s->functions > 1) /* All of this ought to be handled higher up */ + type = IRQF_SHARED; + if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) + type = IRQF_SHARED; + #ifdef CONFIG_PCMCIA_PROBE if (s->irq.AssignedIRQ != 0) { /* If the interrupt is already assigned, it must be the same */ @@ -822,9 +830,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) * marked as used by the kernel resource management core */ ret = request_irq(irq, (req->Attributes & IRQ_HANDLE_PRESENT) ? req->Handler : test_action, - ((req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) || - (s->functions > 1) || - (irq == s->pci_irq)) ? SA_SHIRQ : 0, + type, p_dev->devname, (req->Attributes & IRQ_HANDLE_PRESENT) ? req->Instance : data); if (!ret) { @@ -839,18 +845,21 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) if (ret && !s->irq.AssignedIRQ) { if (!s->pci_irq) return ret; + type = IRQF_SHARED; irq = s->pci_irq; } - if (ret && req->Attributes & IRQ_HANDLE_PRESENT) { - if (request_irq(irq, req->Handler, - ((req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) || - (s->functions > 1) || - (irq == s->pci_irq)) ? SA_SHIRQ : 0, - p_dev->devname, req->Instance)) + if (ret && (req->Attributes & IRQ_HANDLE_PRESENT)) { + if (request_irq(irq, req->Handler, type, p_dev->devname, req->Instance)) return CS_IN_USE; } + /* Make sure the fact the request type was overridden is passed back */ + if (type == IRQF_SHARED && !(req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)) { + req->Attributes |= IRQ_TYPE_DYNAMIC_SHARING; + printk(KERN_WARNING "pcmcia: request for exclusive IRQ could not be fulfilled.\n"); + printk(KERN_WARNING "pcmcia: the driver needs updating to supported shared IRQ lines.\n"); + } c->irq.Attributes = req->Attributes; s->irq.AssignedIRQ = req->AssignedIRQ = irq; s->irq.Config++; diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 247ab837f84..22c5e7427dd 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c @@ -642,7 +642,8 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, goto err_out_free_mem; printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge " - "at 0x%lx on irq %d\n", pci_resource_start(dev, 0), dev->irq); + "at 0x%llx on irq %d\n", + (unsigned long long)pci_resource_start(dev, 0), dev->irq); /* * Since we have no memory BARs some firmware may not * have had PCI_COMMAND_MEMORY enabled, yet the device needs it. @@ -688,7 +689,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, pci_set_drvdata(dev, socket); if (irq_mode == 1) { /* Register the interrupt handler */ - if ((ret = request_irq(dev->irq, pd6729_interrupt, SA_SHIRQ, + if ((ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED, "pd6729", socket))) { printk(KERN_ERR "pd6729: Failed to register irq %d, " "aborting\n", dev->irq); diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 7fa18fb814b..b3518131ea0 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c @@ -18,7 +18,6 @@ #include <linux/module.h> #include <linux/init.h> -#include <linux/config.h> #include <linux/cpufreq.h> #include <linux/ioport.h> #include <linux/kernel.h> diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 0f8b157c971..c3176b16b7b 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -72,7 +72,7 @@ static DEFINE_MUTEX(rsrc_mutex); ======================================================================*/ static struct resource * -make_resource(unsigned long b, unsigned long n, int flags, char *name) +make_resource(resource_size_t b, resource_size_t n, int flags, char *name) { struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL); @@ -86,8 +86,8 @@ make_resource(unsigned long b, unsigned long n, int flags, char *name) } static struct resource * -claim_region(struct pcmcia_socket *s, unsigned long base, unsigned long size, - int type, char *name) +claim_region(struct pcmcia_socket *s, resource_size_t base, + resource_size_t size, int type, char *name) { struct resource *res, *parent; @@ -519,10 +519,10 @@ struct pcmcia_align_data { static void pcmcia_common_align(void *align_data, struct resource *res, - unsigned long size, unsigned long align) + resource_size_t size, resource_size_t align) { struct pcmcia_align_data *data = align_data; - unsigned long start; + resource_size_t start; /* * Ensure that we have the correct start address */ @@ -533,8 +533,8 @@ pcmcia_common_align(void *align_data, struct resource *res, } static void -pcmcia_align(void *align_data, struct resource *res, - unsigned long size, unsigned long align) +pcmcia_align(void *align_data, struct resource *res, resource_size_t size, + resource_size_t align) { struct pcmcia_align_data *data = align_data; struct resource_map *m; @@ -808,8 +808,10 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s) if (res->flags & IORESOURCE_IO) { if (res == &ioport_resource) continue; - printk(KERN_INFO "pcmcia: parent PCI bridge I/O window: 0x%lx - 0x%lx\n", - res->start, res->end); + printk(KERN_INFO "pcmcia: parent PCI bridge I/O " + "window: 0x%llx - 0x%llx\n", + (unsigned long long)res->start, + (unsigned long long)res->end); if (!adjust_io(s, ADD_MANAGED_RESOURCE, res->start, res->end)) done |= IORESOURCE_IO; @@ -818,8 +820,10 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s) if (res->flags & IORESOURCE_MEM) { if (res == &iomem_resource) continue; - printk(KERN_INFO "pcmcia: parent PCI bridge Memory window: 0x%lx - 0x%lx\n", - res->start, res->end); + printk(KERN_INFO "pcmcia: parent PCI bridge Memory " + "window: 0x%llx - 0x%llx\n", + (unsigned long long)res->start, + (unsigned long long)res->end); if (!adjust_memory(s, ADD_MANAGED_RESOURCE, res->start, res->end)) done |= IORESOURCE_MEM; } diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index 6d441ec75c6..c5b2a44b4c3 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c @@ -32,7 +32,6 @@ #include <linux/module.h> #include <linux/init.h> -#include <linux/config.h> #include <linux/platform_device.h> #include <pcmcia/cs_types.h> diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c index 81ded52c895..658cddfbcf2 100644 --- a/drivers/pcmcia/sa1111_generic.c +++ b/drivers/pcmcia/sa1111_generic.c @@ -5,7 +5,6 @@ * basically means we handle everything except controlling the * power. Power is machine specific... */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/ioport.h> diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c index 59c5d968e9f..31a7abc55b2 100644 --- a/drivers/pcmcia/sa11xx_base.c +++ b/drivers/pcmcia/sa11xx_base.c @@ -32,7 +32,6 @@ #include <linux/module.h> #include <linux/init.h> -#include <linux/config.h> #include <linux/cpufreq.h> #include <linux/ioport.h> #include <linux/kernel.h> diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index ea7d9ca160b..888358fac59 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c @@ -31,7 +31,6 @@ ======================================================================*/ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> @@ -524,7 +523,7 @@ int soc_pcmcia_request_irqs(struct soc_pcmcia_socket *skt, if (irqs[i].sock != skt->nr) continue; res = request_irq(irqs[i].irq, soc_common_pcmcia_interrupt, - SA_INTERRUPT, irqs[i].str, skt); + IRQF_DISABLED, irqs[i].str, skt); if (res) break; set_irq_type(irqs[i].irq, IRQT_NOEDGE); diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index 73bad1d5cb2..65a60671659 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c @@ -756,8 +756,9 @@ static int tcic_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *m u_long base, len, mmap; debug(1, "SetMemMap(%d, %d, %#2.2x, %d ns, " - "%#lx-%#lx, %#x)\n", psock, mem->map, mem->flags, - mem->speed, mem->res->start, mem->res->end, mem->card_start); + "%#llx-%#llx, %#x)\n", psock, mem->map, mem->flags, + mem->speed, (unsigned long long)mem->res->start, + (unsigned long long)mem->res->end, mem->card_start); if ((mem->map > 3) || (mem->card_start > 0x3ffffff) || (mem->res->start > 0xffffff) || (mem->res->end > 0xffffff) || (mem->res->start > mem->res->end) || (mem->speed > 1000)) diff --git a/drivers/pcmcia/ti113x.h b/drivers/pcmcia/ti113x.h index 7a3d1b8e16b..62e9ebf967f 100644 --- a/drivers/pcmcia/ti113x.h +++ b/drivers/pcmcia/ti113x.h @@ -647,6 +647,7 @@ static int ti12xx_2nd_slot_empty(struct yenta_socket *socket) */ break; + case PCI_DEVICE_ID_TI_XX12: case PCI_DEVICE_ID_TI_X515: case PCI_DEVICE_ID_TI_X420: case PCI_DEVICE_ID_TI_X620: diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c index 459e6e1946f..e076a13db55 100644 --- a/drivers/pcmcia/vrc4171_card.c +++ b/drivers/pcmcia/vrc4171_card.c @@ -730,7 +730,7 @@ static int __devinit vrc4171_card_init(void) retval = vrc4171_add_sockets(); if (retval == 0) - retval = request_irq(vrc4171_irq, pccard_interrupt, SA_SHIRQ, + retval = request_irq(vrc4171_irq, pccard_interrupt, IRQF_SHARED, vrc4171_card_name, vrc4171_sockets); if (retval < 0) { diff --git a/drivers/pcmcia/vrc4173_cardu.c b/drivers/pcmcia/vrc4173_cardu.c index 6004196f7cc..d19a9138135 100644 --- a/drivers/pcmcia/vrc4173_cardu.c +++ b/drivers/pcmcia/vrc4173_cardu.c @@ -500,7 +500,7 @@ static int __devinit vrc4173_cardu_probe(struct pci_dev *dev, return -ENOMEM; } - if (request_irq(dev->irq, cardu_interrupt, SA_SHIRQ, socket->name, socket) < 0) { + if (request_irq(dev->irq, cardu_interrupt, IRQF_SHARED, socket->name, socket) < 0) { pcmcia_unregister_socket(socket->pcmcia_socket); socket->pcmcia_socket = NULL; iounmap(socket->base); diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 4145eb83b9b..1344746381e 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c @@ -287,7 +287,10 @@ static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state) struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket); u16 bridge; - yenta_set_power(socket, state); + /* if powering down: do it immediately */ + if (state->Vcc == 0) + yenta_set_power(socket, state); + socket->io_irq = state->io_irq; bridge = config_readw(socket, CB_BRIDGE_CONTROL) & ~(CB_BRIDGE_CRST | CB_BRIDGE_INTR); if (cb_readl(socket, CB_SOCKET_STATE) & CB_CBCARD) { @@ -339,6 +342,10 @@ static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state) /* Socket event mask: get card insert/remove events.. */ cb_writel(socket, CB_SOCKET_EVENT, -1); cb_writel(socket, CB_SOCKET_MASK, CB_CDMASK); + + /* if powering up: do it as the last step when the socket is configured */ + if (state->Vcc != 0) + yenta_set_power(socket, state); return 0; } @@ -916,7 +923,7 @@ static int yenta_probe_cb_irq(struct yenta_socket *socket) socket->probe_status = 0; - if (request_irq(socket->cb_irq, yenta_probe_handler, SA_SHIRQ, "yenta", socket)) { + if (request_irq(socket->cb_irq, yenta_probe_handler, IRQF_SHARED, "yenta", socket)) { printk(KERN_WARNING "Yenta: request_irq() in yenta_probe_cb_irq() failed!\n"); return -1; } @@ -998,6 +1005,77 @@ static void yenta_config_init(struct yenta_socket *socket) config_writew(socket, CB_BRIDGE_CONTROL, bridge); } +/** + * yenta_fixup_parent_bridge - Fix subordinate bus# of the parent bridge + * @cardbus_bridge: The PCI bus which the CardBus bridge bridges to + * + * Checks if devices on the bus which the CardBus bridge bridges to would be + * invisible during PCI scans because of a misconfigured subordinate number + * of the parent brige - some BIOSes seem to be too lazy to set it right. + * Does the fixup carefully by checking how far it can go without conflicts. + * See http://bugzilla.kernel.org/show_bug.cgi?id=2944 for more information. + */ +static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge) +{ + struct list_head *tmp; + unsigned char upper_limit; + /* + * We only check and fix the parent bridge: All systems which need + * this fixup that have been reviewed are laptops and the only bridge + * which needed fixing was the parent bridge of the CardBus bridge: + */ + struct pci_bus *bridge_to_fix = cardbus_bridge->parent; + + /* Check bus numbers are already set up correctly: */ + if (bridge_to_fix->subordinate >= cardbus_bridge->subordinate) + return; /* The subordinate number is ok, nothing to do */ + + if (!bridge_to_fix->parent) + return; /* Root bridges are ok */ + + /* stay within the limits of the bus range of the parent: */ + upper_limit = bridge_to_fix->parent->subordinate; + + /* check the bus ranges of all silbling bridges to prevent overlap */ + list_for_each(tmp, &bridge_to_fix->parent->children) { + struct pci_bus * silbling = pci_bus_b(tmp); + /* + * If the silbling has a higher secondary bus number + * and it's secondary is equal or smaller than our + * current upper limit, set the new upper limit to + * the bus number below the silbling's range: + */ + if (silbling->secondary > bridge_to_fix->subordinate + && silbling->secondary <= upper_limit) + upper_limit = silbling->secondary - 1; + } + + /* Show that the wanted subordinate number is not possible: */ + if (cardbus_bridge->subordinate > upper_limit) + printk(KERN_WARNING "Yenta: Upper limit for fixing this " + "bridge's parent bridge: #%02x\n", upper_limit); + + /* If we have room to increase the bridge's subordinate number, */ + if (bridge_to_fix->subordinate < upper_limit) { + + /* use the highest number of the hidden bus, within limits */ + unsigned char subordinate_to_assign = + min(cardbus_bridge->subordinate, upper_limit); + + printk(KERN_INFO "Yenta: Raising subordinate bus# of parent " + "bus (#%02x) from #%02x to #%02x\n", + bridge_to_fix->number, + bridge_to_fix->subordinate, subordinate_to_assign); + + /* Save the new subordinate in the bus struct of the bridge */ + bridge_to_fix->subordinate = subordinate_to_assign; + + /* and update the PCI config space with the new subordinate */ + pci_write_config_byte(bridge_to_fix->self, + PCI_SUBORDINATE_BUS, bridge_to_fix->subordinate); + } +} + /* * Initialize a cardbus controller. Make sure we have a usable * interrupt, and that we can map the cardbus area. Fill in the @@ -1094,7 +1172,7 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i /* We must finish initialization here */ - if (!socket->cb_irq || request_irq(socket->cb_irq, yenta_interrupt, SA_SHIRQ, "yenta", socket)) { + if (!socket->cb_irq || request_irq(socket->cb_irq, yenta_interrupt, IRQF_SHARED, "yenta", socket)) { /* No IRQ or request_irq failed. Poll */ socket->cb_irq = 0; /* But zero is a valid IRQ number. */ init_timer(&socket->poll_timer); @@ -1113,6 +1191,8 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i yenta_get_socket_capabilities(socket, isa_interrupts); printk(KERN_INFO "Socket status: %08x\n", cb_readl(socket, CB_SOCKET_STATE)); + yenta_fixup_parent_bridge(dev->subordinate); + /* Register it with the pcmcia layer.. */ ret = pcmcia_register_socket(&socket->socket); if (ret == 0) { @@ -1232,6 +1312,7 @@ static struct pci_device_id yenta_table [] = { CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_XX21_XX11, TI12XX), CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_X515, TI12XX), + CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_XX12, TI12XX), CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_X420, TI12XX), CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_X620, TI12XX), CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_7410, TI12XX), diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c index 0b4adcb60df..227600cd636 100644 --- a/drivers/pnp/card.c +++ b/drivers/pnp/card.c @@ -5,7 +5,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/pnp.h> diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index e54c1538319..e161423b430 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c @@ -5,7 +5,6 @@ * */ -#include <linux/config.h> #include <linux/string.h> #include <linux/list.h> #include <linux/module.h> diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index a2d8ce7fef9..3163e3d73da 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c @@ -264,7 +264,7 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at if (pnp_port_flags(dev, i) & IORESOURCE_DISABLED) pnp_printf(buffer," disabled\n"); else - pnp_printf(buffer," 0x%lx-0x%lx\n", + pnp_printf(buffer," 0x%llx-0x%llx\n", pnp_port_start(dev, i), pnp_port_end(dev, i)); } @@ -275,7 +275,7 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at if (pnp_mem_flags(dev, i) & IORESOURCE_DISABLED) pnp_printf(buffer," disabled\n"); else - pnp_printf(buffer," 0x%lx-0x%lx\n", + pnp_printf(buffer," 0x%llx-0x%llx\n", pnp_mem_start(dev, i), pnp_mem_end(dev, i)); } @@ -286,7 +286,7 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at if (pnp_irq_flags(dev, i) & IORESOURCE_DISABLED) pnp_printf(buffer," disabled\n"); else - pnp_printf(buffer," %ld\n", + pnp_printf(buffer," %lld\n", pnp_irq(dev, i)); } } @@ -296,7 +296,7 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at if (pnp_dma_flags(dev, i) & IORESOURCE_DISABLED) pnp_printf(buffer," disabled\n"); else - pnp_printf(buffer," %ld\n", + pnp_printf(buffer," %lld\n", pnp_dma(dev, i)); } } diff --git a/drivers/pnp/isapnp/compat.c b/drivers/pnp/isapnp/compat.c index 3ff7e76b33b..0697ab88a9a 100644 --- a/drivers/pnp/isapnp/compat.c +++ b/drivers/pnp/isapnp/compat.c @@ -8,7 +8,6 @@ /* TODO: see if more isapnp functions are needed here */ -#include <linux/config.h> #include <linux/module.h> #include <linux/isapnp.h> #include <linux/string.h> diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index ac7c2bb6c69..f2e0179962e 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c @@ -34,7 +34,6 @@ * 2003-08-11 Resource Management Updates - Adam Belay <ambx1@neo.rr.com> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c index cf54b0a3628..958c11bedd0 100644 --- a/drivers/pnp/isapnp/proc.c +++ b/drivers/pnp/isapnp/proc.c @@ -19,7 +19,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/isapnp.h> #include <linux/proc_fs.h> diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c index 6fff109bdab..5026b345cb3 100644 --- a/drivers/pnp/manager.c +++ b/drivers/pnp/manager.c @@ -6,7 +6,6 @@ * */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/module.h> #include <linux/init.h> @@ -20,7 +19,8 @@ DECLARE_MUTEX(pnp_res_mutex); static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx) { - unsigned long *start, *end, *flags; + resource_size_t *start, *end; + unsigned long *flags; if (!dev || !rule) return -EINVAL; @@ -63,7 +63,8 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx) static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx) { - unsigned long *start, *end, *flags; + resource_size_t *start, *end; + unsigned long *flags; if (!dev || !rule) return -EINVAL; @@ -116,7 +117,8 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx) static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx) { - unsigned long *start, *end, *flags; + resource_size_t *start, *end; + unsigned long *flags; int i; /* IRQ priority: this table is good for i386 */ @@ -168,7 +170,8 @@ static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx) static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) { - unsigned long *start, *end, *flags; + resource_size_t *start, *end; + unsigned long *flags; int i; /* DMA priority: this table is good for i386 */ @@ -582,7 +585,8 @@ int pnp_disable_dev(struct pnp_dev *dev) * @size: size of region * */ -void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) +void pnp_resource_change(struct resource *resource, resource_size_t start, + resource_size_t size) { if (resource == NULL) return; diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index f104577f73e..6cf34a63c79 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c @@ -19,7 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <linux/config.h> #include <linux/acpi.h> #include <linux/pnp.h> #include <acpi/acpi_bus.h> diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index c89c98a2cca..ef508a4de55 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c @@ -3,7 +3,6 @@ * */ -#include <linux/config.h> #include <linux/ctype.h> #include <linux/pnp.h> #include <linux/pnpbios.h> diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c index 8936b0cb2ec..e97ecefe858 100644 --- a/drivers/pnp/quirks.c +++ b/drivers/pnp/quirks.c @@ -11,7 +11,6 @@ * Copyright (c) 1999 Martin Mares <mj@ucw.cz> */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/string.h> diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index 6ded527169f..5c8ec21e108 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c @@ -6,7 +6,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/interrupt.h> @@ -241,7 +240,7 @@ int pnp_check_port(struct pnp_dev * dev, int idx) { int tmp; struct pnp_dev *tdev; - unsigned long *port, *end, *tport, *tend; + resource_size_t *port, *end, *tport, *tend; port = &dev->res.port_resource[idx].start; end = &dev->res.port_resource[idx].end; @@ -297,7 +296,7 @@ int pnp_check_mem(struct pnp_dev * dev, int idx) { int tmp; struct pnp_dev *tdev; - unsigned long *addr, *end, *taddr, *tend; + resource_size_t *addr, *end, *taddr, *tend; addr = &dev->res.mem_resource[idx].start; end = &dev->res.mem_resource[idx].end; @@ -358,7 +357,7 @@ int pnp_check_irq(struct pnp_dev * dev, int idx) { int tmp; struct pnp_dev *tdev; - unsigned long * irq = &dev->res.irq_resource[idx].start; + resource_size_t * irq = &dev->res.irq_resource[idx].start; /* if the resource doesn't exist, don't complain about it */ if (cannot_compare(dev->res.irq_resource[idx].flags)) @@ -396,7 +395,8 @@ int pnp_check_irq(struct pnp_dev * dev, int idx) /* check if the resource is already in use, skip if the * device is active because it itself may be in use */ if(!dev->active) { - if (request_irq(*irq, pnp_test_handler, SA_INTERRUPT, "pnp", NULL)) + if (request_irq(*irq, pnp_test_handler, + IRQF_DISABLED|IRQF_PROBE_SHARED, "pnp", NULL)) return 0; free_irq(*irq, NULL); } @@ -423,7 +423,7 @@ int pnp_check_dma(struct pnp_dev * dev, int idx) #ifndef CONFIG_IA64 int tmp; struct pnp_dev *tdev; - unsigned long * dma = &dev->res.dma_resource[idx].start; + resource_size_t * dma = &dev->res.dma_resource[idx].start; /* if the resource doesn't exist, don't complain about it */ if (cannot_compare(dev->res.dma_resource[idx].flags)) diff --git a/drivers/pnp/support.c b/drivers/pnp/support.c index 61fe998944b..946a0dcd627 100644 --- a/drivers/pnp/support.c +++ b/drivers/pnp/support.c @@ -5,7 +5,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/ctype.h> #include <linux/pnp.h> diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index 94e30fe4b8f..7bf7b2c8824 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c @@ -10,7 +10,6 @@ * option) any later version. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c index bef9316e95d..5687b8fcbf9 100644 --- a/drivers/rapidio/rio-sysfs.c +++ b/drivers/rapidio/rio-sysfs.c @@ -10,7 +10,6 @@ * option) any later version. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/rio.h> #include <linux/rio_drv.h> diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index 5e382470faa..f644807da2f 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c @@ -11,7 +11,6 @@ * option) any later version. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index f2fc81a9074..f5b9f187a93 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -15,7 +15,7 @@ config RTC_CLASS help Generic RTC class support. If you say yes here, you will be allowed to plug one or more RTCs to your system. You will - probably want to enable one of more of the interfaces below. + probably want to enable one or more of the interfaces below. This driver can also be built as a module. If so, the module will be called rtc-class. @@ -182,6 +182,22 @@ config RTC_DRV_RS5C372 This driver can also be built as a module. If so, the module will be called rtc-rs5c372. +config RTC_DRV_S3C + tristate "Samsung S3C series SoC RTC" + depends on RTC_CLASS && ARCH_S3C2410 + help + RTC (Realtime Clock) driver for the clock inbuilt into the + Samsung S3C24XX series of SoCs. This can provide periodic + interrupt rates from 1Hz to 64Hz for user programs, and + wakeup from Alarm. + + The driver currently supports the common features on all the + S3C24XX range, such as the S3C2410, S3C2412, S3C2413, S3C2440 + and S3C2442. + + This driver can also be build as a module. If so, the module + will be called rtc-s3c. + config RTC_DRV_M48T86 tristate "ST M48T86/Dallas DS12887" depends on RTC_CLASS diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index da5e38774e1..54220714ff4 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o +obj-$(CONFIG_RTC_DRV_S3C) += rtc-s3c.o obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o diff --git a/drivers/rtc/rtc-at91.c b/drivers/rtc/rtc-at91.c index b676f443c17..dfd0ce86f6a 100644 --- a/drivers/rtc/rtc-at91.c +++ b/drivers/rtc/rtc-at91.c @@ -293,7 +293,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) AT91_RTC_CALEV); ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, - SA_SHIRQ, "at91_rtc", pdev); + IRQF_SHARED, "at91_rtc", pdev); if (ret) { printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n", AT91_ID_SYS); diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index 762521a1419..20900149547 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c @@ -341,7 +341,7 @@ static int __init ds1553_rtc_probe(struct platform_device *pdev) if (pdata->irq >= 0) { writeb(0, ioaddr + RTC_INTERRUPTS); - if (request_irq(pdata->irq, ds1553_rtc_interrupt, SA_SHIRQ, + if (request_irq(pdata->irq, ds1553_rtc_interrupt, IRQF_SHARED, pdev->name, pdev) < 0) { dev_warn(&pdev->dev, "interrupt not available.\n"); pdata->irq = -1; diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index ee538632660..d6d1c5726b0 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c @@ -173,7 +173,7 @@ static int pl031_probe(struct amba_device *adev, void *id) goto out_no_remap; } - if (request_irq(adev->irq[0], pl031_interrupt, SA_INTERRUPT, + if (request_irq(adev->irq[0], pl031_interrupt, IRQF_DISABLED, "rtc-pl031", ldata->rtc)) { ret = -EIO; goto out_no_irq; diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c new file mode 100644 index 00000000000..d6d1bff52b8 --- /dev/null +++ b/drivers/rtc/rtc-s3c.c @@ -0,0 +1,607 @@ +/* drivers/rtc/rtc-s3c.c + * + * Copyright (c) 2004,2006 Simtec Electronics + * Ben Dooks, <ben@simtec.co.uk> + * http://armlinux.simtec.co.uk/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * S3C2410/S3C2440/S3C24XX Internal RTC Driver +*/ + +#include <linux/module.h> +#include <linux/fs.h> +#include <linux/string.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/interrupt.h> +#include <linux/rtc.h> +#include <linux/bcd.h> +#include <linux/clk.h> + +#include <asm/hardware.h> +#include <asm/uaccess.h> +#include <asm/io.h> +#include <asm/irq.h> +#include <asm/rtc.h> + +#include <asm/mach/time.h> + +#include <asm/arch/regs-rtc.h> + +/* I have yet to find an S3C implementation with more than one + * of these rtc blocks in */ + +static struct resource *s3c_rtc_mem; + +static void __iomem *s3c_rtc_base; +static int s3c_rtc_alarmno = NO_IRQ; +static int s3c_rtc_tickno = NO_IRQ; +static int s3c_rtc_freq = 1; + +static DEFINE_SPINLOCK(s3c_rtc_pie_lock); +static unsigned int tick_count; + +/* IRQ Handlers */ + +static irqreturn_t s3c_rtc_alarmirq(int irq, void *id, struct pt_regs *r) +{ + struct rtc_device *rdev = id; + + rtc_update_irq(&rdev->class_dev, 1, RTC_AF | RTC_IRQF); + return IRQ_HANDLED; +} + +static irqreturn_t s3c_rtc_tickirq(int irq, void *id, struct pt_regs *r) +{ + struct rtc_device *rdev = id; + + rtc_update_irq(&rdev->class_dev, tick_count++, RTC_PF | RTC_IRQF); + return IRQ_HANDLED; +} + +/* Update control registers */ +static void s3c_rtc_setaie(int to) +{ + unsigned int tmp; + + pr_debug("%s: aie=%d\n", __FUNCTION__, to); + + tmp = readb(S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN; + + if (to) + tmp |= S3C2410_RTCALM_ALMEN; + + writeb(tmp, S3C2410_RTCALM); +} + +static void s3c_rtc_setpie(int to) +{ + unsigned int tmp; + + pr_debug("%s: pie=%d\n", __FUNCTION__, to); + + spin_lock_irq(&s3c_rtc_pie_lock); + tmp = readb(S3C2410_TICNT) & ~S3C2410_TICNT_ENABLE; + + if (to) + tmp |= S3C2410_TICNT_ENABLE; + + writeb(tmp, S3C2410_TICNT); + spin_unlock_irq(&s3c_rtc_pie_lock); +} + +static void s3c_rtc_setfreq(int freq) +{ + unsigned int tmp; + + spin_lock_irq(&s3c_rtc_pie_lock); + tmp = readb(S3C2410_TICNT) & S3C2410_TICNT_ENABLE; + + s3c_rtc_freq = freq; + + tmp |= (128 / freq)-1; + + writeb(tmp, S3C2410_TICNT); + spin_unlock_irq(&s3c_rtc_pie_lock); +} + +/* Time read/write */ + +static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) +{ + unsigned int have_retried = 0; + + retry_get_time: + rtc_tm->tm_min = readb(S3C2410_RTCMIN); + rtc_tm->tm_hour = readb(S3C2410_RTCHOUR); + rtc_tm->tm_mday = readb(S3C2410_RTCDATE); + rtc_tm->tm_mon = readb(S3C2410_RTCMON); + rtc_tm->tm_year = readb(S3C2410_RTCYEAR); + rtc_tm->tm_sec = readb(S3C2410_RTCSEC); + + /* the only way to work out wether the system was mid-update + * when we read it is to check the second counter, and if it + * is zero, then we re-try the entire read + */ + + if (rtc_tm->tm_sec == 0 && !have_retried) { + have_retried = 1; + goto retry_get_time; + } + + pr_debug("read time %02x.%02x.%02x %02x/%02x/%02x\n", + rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday, + rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec); + + BCD_TO_BIN(rtc_tm->tm_sec); + BCD_TO_BIN(rtc_tm->tm_min); + BCD_TO_BIN(rtc_tm->tm_hour); + BCD_TO_BIN(rtc_tm->tm_mday); + BCD_TO_BIN(rtc_tm->tm_mon); + BCD_TO_BIN(rtc_tm->tm_year); + + rtc_tm->tm_year += 100; + rtc_tm->tm_mon -= 1; + + return 0; +} + +static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) +{ + /* the rtc gets round the y2k problem by just not supporting it */ + + if (tm->tm_year < 100) + return -EINVAL; + + writeb(BIN2BCD(tm->tm_sec), S3C2410_RTCSEC); + writeb(BIN2BCD(tm->tm_min), S3C2410_RTCMIN); + writeb(BIN2BCD(tm->tm_hour), S3C2410_RTCHOUR); + writeb(BIN2BCD(tm->tm_mday), S3C2410_RTCDATE); + writeb(BIN2BCD(tm->tm_mon + 1), S3C2410_RTCMON); + writeb(BIN2BCD(tm->tm_year - 100), S3C2410_RTCYEAR); + + return 0; +} + +static int s3c_rtc_getalarm(struct device *dev, struct rtc_wkalrm *alrm) +{ + struct rtc_time *alm_tm = &alrm->time; + unsigned int alm_en; + + alm_tm->tm_sec = readb(S3C2410_ALMSEC); + alm_tm->tm_min = readb(S3C2410_ALMMIN); + alm_tm->tm_hour = readb(S3C2410_ALMHOUR); + alm_tm->tm_mon = readb(S3C2410_ALMMON); + alm_tm->tm_mday = readb(S3C2410_ALMDATE); + alm_tm->tm_year = readb(S3C2410_ALMYEAR); + + alm_en = readb(S3C2410_RTCALM); + + pr_debug("read alarm %02x %02x.%02x.%02x %02x/%02x/%02x\n", + alm_en, + alm_tm->tm_year, alm_tm->tm_mon, alm_tm->tm_mday, + alm_tm->tm_hour, alm_tm->tm_min, alm_tm->tm_sec); + + + /* decode the alarm enable field */ + + if (alm_en & S3C2410_RTCALM_SECEN) + BCD_TO_BIN(alm_tm->tm_sec); + else + alm_tm->tm_sec = 0xff; + + if (alm_en & S3C2410_RTCALM_MINEN) + BCD_TO_BIN(alm_tm->tm_min); + else + alm_tm->tm_min = 0xff; + + if (alm_en & S3C2410_RTCALM_HOUREN) + BCD_TO_BIN(alm_tm->tm_hour); + else + alm_tm->tm_hour = 0xff; + + if (alm_en & S3C2410_RTCALM_DAYEN) + BCD_TO_BIN(alm_tm->tm_mday); + else + alm_tm->tm_mday = 0xff; + + if (alm_en & S3C2410_RTCALM_MONEN) { + BCD_TO_BIN(alm_tm->tm_mon); + alm_tm->tm_mon -= 1; + } else { + alm_tm->tm_mon = 0xff; + } + + if (alm_en & S3C2410_RTCALM_YEAREN) + BCD_TO_BIN(alm_tm->tm_year); + else + alm_tm->tm_year = 0xffff; + + return 0; +} + +static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) +{ + struct rtc_time *tm = &alrm->time; + unsigned int alrm_en; + + pr_debug("s3c_rtc_setalarm: %d, %02x/%02x/%02x %02x.%02x.%02x\n", + alrm->enabled, + tm->tm_mday & 0xff, tm->tm_mon & 0xff, tm->tm_year & 0xff, + tm->tm_hour & 0xff, tm->tm_min & 0xff, tm->tm_sec); + + + alrm_en = readb(S3C2410_RTCALM) & S3C2410_RTCALM_ALMEN; + writeb(0x00, S3C2410_RTCALM); + + if (tm->tm_sec < 60 && tm->tm_sec >= 0) { + alrm_en |= S3C2410_RTCALM_SECEN; + writeb(BIN2BCD(tm->tm_sec), S3C2410_ALMSEC); + } + + if (tm->tm_min < 60 && tm->tm_min >= 0) { + alrm_en |= S3C2410_RTCALM_MINEN; + writeb(BIN2BCD(tm->tm_min), S3C2410_ALMMIN); + } + + if (tm->tm_hour < 24 && tm->tm_hour >= 0) { + alrm_en |= S3C2410_RTCALM_HOUREN; + writeb(BIN2BCD(tm->tm_hour), S3C2410_ALMHOUR); + } + + pr_debug("setting S3C2410_RTCALM to %08x\n", alrm_en); + + writeb(alrm_en, S3C2410_RTCALM); + + if (0) { + alrm_en = readb(S3C2410_RTCALM); + alrm_en &= ~S3C2410_RTCALM_ALMEN; + writeb(alrm_en, S3C2410_RTCALM); + disable_irq_wake(s3c_rtc_alarmno); + } + + if (alrm->enabled) + enable_irq_wake(s3c_rtc_alarmno); + else + disable_irq_wake(s3c_rtc_alarmno); + + return 0; +} + +static int s3c_rtc_ioctl(struct device *dev, + unsigned int cmd, unsigned long arg) +{ + unsigned int ret = -ENOIOCTLCMD; + + switch (cmd) { + case RTC_AIE_OFF: + case RTC_AIE_ON: + s3c_rtc_setaie((cmd == RTC_AIE_ON) ? 1 : 0); + ret = 0; + break; + + case RTC_PIE_OFF: + case RTC_PIE_ON: + tick_count = 0; + s3c_rtc_setpie((cmd == RTC_PIE_ON) ? 1 : 0); + ret = 0; + break; + + case RTC_IRQP_READ: + ret = put_user(s3c_rtc_freq, (unsigned long __user *)arg); + break; + + case RTC_IRQP_SET: + /* check for power of 2 */ + + if ((arg & (arg-1)) != 0 || arg < 1) { + ret = -EINVAL; + goto exit; + } + + pr_debug("s3c2410_rtc: setting frequency %ld\n", arg); + + s3c_rtc_setfreq(arg); + ret = 0; + break; + + case RTC_UIE_ON: + case RTC_UIE_OFF: + ret = -EINVAL; + } + + exit: + return ret; +} + +static int s3c_rtc_proc(struct device *dev, struct seq_file *seq) +{ + unsigned int rtcalm = readb(S3C2410_RTCALM); + unsigned int ticnt = readb (S3C2410_TICNT); + + seq_printf(seq, "alarm_IRQ\t: %s\n", + (rtcalm & S3C2410_RTCALM_ALMEN) ? "yes" : "no" ); + + seq_printf(seq, "periodic_IRQ\t: %s\n", + (ticnt & S3C2410_TICNT_ENABLE) ? "yes" : "no" ); + + seq_printf(seq, "periodic_freq\t: %d\n", s3c_rtc_freq); + + return 0; +} + +static int s3c_rtc_open(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct rtc_device *rtc_dev = platform_get_drvdata(pdev); + int ret; + + ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq, + SA_INTERRUPT, "s3c2410-rtc alarm", rtc_dev); + + if (ret) { + dev_err(dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret); + return ret; + } + + ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq, + SA_INTERRUPT, "s3c2410-rtc tick", rtc_dev); + + if (ret) { + dev_err(dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret); + goto tick_err; + } + + return ret; + + tick_err: + free_irq(s3c_rtc_alarmno, rtc_dev); + return ret; +} + +static void s3c_rtc_release(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct rtc_device *rtc_dev = platform_get_drvdata(pdev); + + /* do not clear AIE here, it may be needed for wake */ + + s3c_rtc_setpie(0); + free_irq(s3c_rtc_alarmno, rtc_dev); + free_irq(s3c_rtc_tickno, rtc_dev); +} + +static struct rtc_class_ops s3c_rtcops = { + .open = s3c_rtc_open, + .release = s3c_rtc_release, + .ioctl = s3c_rtc_ioctl, + .read_time = s3c_rtc_gettime, + .set_time = s3c_rtc_settime, + .read_alarm = s3c_rtc_getalarm, + .set_alarm = s3c_rtc_setalarm, + .proc = s3c_rtc_proc, +}; + +static void s3c_rtc_enable(struct platform_device *pdev, int en) +{ + unsigned int tmp; + + if (s3c_rtc_base == NULL) + return; + + if (!en) { + tmp = readb(S3C2410_RTCCON); + writeb(tmp & ~S3C2410_RTCCON_RTCEN, S3C2410_RTCCON); + + tmp = readb(S3C2410_TICNT); + writeb(tmp & ~S3C2410_TICNT_ENABLE, S3C2410_TICNT); + } else { + /* re-enable the device, and check it is ok */ + + if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){ + dev_info(&pdev->dev, "rtc disabled, re-enabling\n"); + + tmp = readb(S3C2410_RTCCON); + writeb(tmp | S3C2410_RTCCON_RTCEN , S3C2410_RTCCON); + } + + if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){ + dev_info(&pdev->dev, "removing RTCCON_CNTSEL\n"); + + tmp = readb(S3C2410_RTCCON); + writeb(tmp& ~S3C2410_RTCCON_CNTSEL , S3C2410_RTCCON); + } + + if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){ + dev_info(&pdev->dev, "removing RTCCON_CLKRST\n"); + + tmp = readb(S3C2410_RTCCON); + writeb(tmp & ~S3C2410_RTCCON_CLKRST, S3C2410_RTCCON); + } + } +} + +static int s3c_rtc_remove(struct platform_device *dev) +{ + struct rtc_device *rtc = platform_get_drvdata(dev); + + platform_set_drvdata(dev, NULL); + rtc_device_unregister(rtc); + + s3c_rtc_setpie(0); + s3c_rtc_setaie(0); + + iounmap(s3c_rtc_base); + release_resource(s3c_rtc_mem); + kfree(s3c_rtc_mem); + + return 0; +} + +static int s3c_rtc_probe(struct platform_device *pdev) +{ + struct rtc_device *rtc; + struct resource *res; + int ret; + + pr_debug("%s: probe=%p\n", __FUNCTION__, pdev); + + /* find the IRQs */ + + s3c_rtc_tickno = platform_get_irq(pdev, 1); + if (s3c_rtc_tickno < 0) { + dev_err(&pdev->dev, "no irq for rtc tick\n"); + return -ENOENT; + } + + s3c_rtc_alarmno = platform_get_irq(pdev, 0); + if (s3c_rtc_alarmno < 0) { + dev_err(&pdev->dev, "no irq for alarm\n"); + return -ENOENT; + } + + pr_debug("s3c2410_rtc: tick irq %d, alarm irq %d\n", + s3c_rtc_tickno, s3c_rtc_alarmno); + + /* get the memory region */ + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (res == NULL) { + dev_err(&pdev->dev, "failed to get memory region resource\n"); + return -ENOENT; + } + + s3c_rtc_mem = request_mem_region(res->start, + res->end-res->start+1, + pdev->name); + + if (s3c_rtc_mem == NULL) { + dev_err(&pdev->dev, "failed to reserve memory region\n"); + ret = -ENOENT; + goto err_nores; + } + + s3c_rtc_base = ioremap(res->start, res->end - res->start + 1); + if (s3c_rtc_base == NULL) { + dev_err(&pdev->dev, "failed ioremap()\n"); + ret = -EINVAL; + goto err_nomap; + } + + /* check to see if everything is setup correctly */ + + s3c_rtc_enable(pdev, 1); + + pr_debug("s3c2410_rtc: RTCCON=%02x\n", readb(S3C2410_RTCCON)); + + s3c_rtc_setfreq(s3c_rtc_freq); + + /* register RTC and exit */ + + rtc = rtc_device_register("s3c", &pdev->dev, &s3c_rtcops, + THIS_MODULE); + + if (IS_ERR(rtc)) { + dev_err(&pdev->dev, "cannot attach rtc\n"); + ret = PTR_ERR(rtc); + goto err_nortc; + } + + rtc->max_user_freq = 128; + + platform_set_drvdata(pdev, rtc); + return 0; + + err_nortc: + s3c_rtc_enable(pdev, 0); + iounmap(s3c_rtc_base); + + err_nomap: + release_resource(s3c_rtc_mem); + + err_nores: + return ret; +} + +#ifdef CONFIG_PM + +/* RTC Power management control */ + +static struct timespec s3c_rtc_delta; + +static int ticnt_save; + +static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state) +{ + struct rtc_time tm; + struct timespec time; + + time.tv_nsec = 0; + + /* save TICNT for anyone using periodic interrupts */ + + ticnt_save = readb(S3C2410_TICNT); + + /* calculate time delta for suspend */ + + s3c_rtc_gettime(&pdev->dev, &tm); + rtc_tm_to_time(&tm, &time.tv_sec); + save_time_delta(&s3c_rtc_delta, &time); + s3c_rtc_enable(pdev, 0); + + return 0; +} + +static int s3c_rtc_resume(struct platform_device *pdev) +{ + struct rtc_time tm; + struct timespec time; + + time.tv_nsec = 0; + + s3c_rtc_enable(pdev, 1); + s3c_rtc_gettime(&pdev->dev, &tm); + rtc_tm_to_time(&tm, &time.tv_sec); + restore_time_delta(&s3c_rtc_delta, &time); + + writeb(ticnt_save, S3C2410_TICNT); + return 0; +} +#else +#define s3c_rtc_suspend NULL +#define s3c_rtc_resume NULL +#endif + +static struct platform_driver s3c2410_rtcdrv = { + .probe = s3c_rtc_probe, + .remove = s3c_rtc_remove, + .suspend = s3c_rtc_suspend, + .resume = s3c_rtc_resume, + .driver = { + .name = "s3c2410-rtc", + .owner = THIS_MODULE, + }, +}; + +static char __initdata banner[] = "S3C24XX RTC, (c) 2004,2006 Simtec Electronics\n"; + +static int __init s3c_rtc_init(void) +{ + printk(banner); + return platform_driver_register(&s3c2410_rtcdrv); +} + +static void __exit s3c_rtc_exit(void) +{ + platform_driver_unregister(&s3c2410_rtcdrv); +} + +module_init(s3c_rtc_init); +module_exit(s3c_rtc_exit); + +MODULE_DESCRIPTION("Samsung S3C RTC Driver"); +MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); +MODULE_LICENSE("GPL"); diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index 9cd1cb304bb..ee4b61ee67b 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c @@ -157,19 +157,19 @@ static int sa1100_rtc_open(struct device *dev) { int ret; - ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, SA_INTERRUPT, + ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, IRQF_DISABLED, "rtc 1Hz", dev); if (ret) { dev_err(dev, "IRQ %d already in use.\n", IRQ_RTC1Hz); goto fail_ui; } - ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, SA_INTERRUPT, + ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, IRQF_DISABLED, "rtc Alrm", dev); if (ret) { dev_err(dev, "IRQ %d already in use.\n", IRQ_RTCAlrm); goto fail_ai; } - ret = request_irq(IRQ_OST1, timer1_interrupt, SA_INTERRUPT, + ret = request_irq(IRQ_OST1, timer1_interrupt, IRQF_DISABLED, "rtc timer", dev); if (ret) { dev_err(dev, "IRQ %d already in use.\n", IRQ_OST1); diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c index 4b9291dd444..bb6d5ff24fd 100644 --- a/drivers/rtc/rtc-vr41xx.c +++ b/drivers/rtc/rtc-vr41xx.c @@ -345,11 +345,11 @@ static int __devinit rtc_probe(struct platform_device *pdev) spin_unlock_irq(&rtc_lock); irq = ELAPSEDTIME_IRQ; - retval = request_irq(irq, elapsedtime_interrupt, SA_INTERRUPT, + retval = request_irq(irq, elapsedtime_interrupt, IRQF_DISABLED, "elapsed_time", pdev); if (retval == 0) { irq = RTCLONG1_IRQ; - retval = request_irq(irq, rtclong1_interrupt, SA_INTERRUPT, + retval = request_irq(irq, rtclong1_interrupt, IRQF_DISABLED, "rtclong1", pdev); } diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index cfb1fff3787..4bf03fb67f8 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/kmod.h> #include <linux/init.h> #include <linux/interrupt.h> @@ -95,7 +94,7 @@ dasd_alloc_device(void) spin_lock_init(&device->mem_lock); spin_lock_init(&device->request_queue_lock); atomic_set (&device->tasklet_scheduled, 0); - tasklet_init(&device->tasklet, + tasklet_init(&device->tasklet, (void (*)(unsigned long)) dasd_tasklet, (unsigned long) device); INIT_LIST_HEAD(&device->ccw_queue); @@ -128,7 +127,7 @@ dasd_state_new_to_known(struct dasd_device *device) int rc; /* - * As long as the device is not in state DASD_STATE_NEW we want to + * As long as the device is not in state DASD_STATE_NEW we want to * keep the reference count > 0. */ dasd_get_device(device); @@ -336,7 +335,7 @@ dasd_decrease_state(struct dasd_device *device) if (device->state == DASD_STATE_ONLINE && device->target <= DASD_STATE_READY) dasd_state_online_to_ready(device); - + if (device->state == DASD_STATE_READY && device->target <= DASD_STATE_BASIC) dasd_state_ready_to_basic(device); @@ -348,7 +347,7 @@ dasd_decrease_state(struct dasd_device *device) if (device->state == DASD_STATE_BASIC && device->target <= DASD_STATE_KNOWN) dasd_state_basic_to_known(device); - + if (device->state == DASD_STATE_KNOWN && device->target <= DASD_STATE_NEW) dasd_state_known_to_new(device); @@ -994,7 +993,7 @@ dasd_int_handler(struct ccw_device *cdev, unsigned long intparm, ((irb->scsw.cstat << 8) | irb->scsw.dstat), cqr); /* Find out the appropriate era_action. */ - if (irb->scsw.fctl & SCSW_FCTL_HALT_FUNC) + if (irb->scsw.fctl & SCSW_FCTL_HALT_FUNC) era = dasd_era_fatal; else if (irb->scsw.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END) && irb->scsw.cstat == 0 && @@ -1004,7 +1003,7 @@ dasd_int_handler(struct ccw_device *cdev, unsigned long intparm, era = dasd_era_fatal; /* don't recover this request */ else if (irb->esw.esw0.erw.cons) era = device->discipline->examine_error(cqr, irb); - else + else era = dasd_era_recover; DBF_DEV_EVENT(DBF_DEBUG, device, "era_code %d", era); @@ -1287,7 +1286,7 @@ __dasd_start_head(struct dasd_device * device) } /* - * Remove requests from the ccw queue. + * Remove requests from the ccw queue. */ static void dasd_flush_ccw_queue(struct dasd_device * device, int all) @@ -1450,23 +1449,23 @@ dasd_sleep_on(struct dasd_ccw_req * cqr) wait_queue_head_t wait_q; struct dasd_device *device; int rc; - + device = cqr->device; spin_lock_irq(get_ccwdev_lock(device->cdev)); - + init_waitqueue_head (&wait_q); cqr->callback = dasd_wakeup_cb; cqr->callback_data = (void *) &wait_q; cqr->status = DASD_CQR_QUEUED; list_add_tail(&cqr->list, &device->ccw_queue); - + /* let the bh start the request to keep them in order */ dasd_schedule_bh(device); - + spin_unlock_irq(get_ccwdev_lock(device->cdev)); wait_event(wait_q, _wait_for_wakeup(cqr)); - + /* Request status is either done or failed. */ rc = (cqr->status == DASD_CQR_FAILED) ? -EIO : 0; return rc; @@ -1568,7 +1567,7 @@ dasd_sleep_on_immediatly(struct dasd_ccw_req * cqr) wait_queue_head_t wait_q; struct dasd_device *device; int rc; - + device = cqr->device; spin_lock_irq(get_ccwdev_lock(device->cdev)); rc = _dasd_term_running_cqr(device); @@ -1576,20 +1575,20 @@ dasd_sleep_on_immediatly(struct dasd_ccw_req * cqr) spin_unlock_irq(get_ccwdev_lock(device->cdev)); return rc; } - + init_waitqueue_head (&wait_q); cqr->callback = dasd_wakeup_cb; cqr->callback_data = (void *) &wait_q; cqr->status = DASD_CQR_QUEUED; list_add(&cqr->list, &device->ccw_queue); - + /* let the bh start the request to keep them in order */ dasd_schedule_bh(device); - + spin_unlock_irq(get_ccwdev_lock(device->cdev)); wait_event(wait_q, _wait_for_wakeup(cqr)); - + /* Request status is either done or failed. */ rc = (cqr->status == DASD_CQR_FAILED) ? -EIO : 0; return rc; @@ -1725,7 +1724,7 @@ dasd_flush_request_queue(struct dasd_device * device) if (!device->request_queue) return; - + spin_lock_irq(&device->request_queue_lock); while (!list_empty(&device->request_queue->queue_head)) { req = elv_next_request(device->request_queue); @@ -1834,7 +1833,6 @@ dasd_exit(void) } dasd_gendisk_exit(); dasd_devmap_exit(); - devfs_remove("dasd"); if (dasd_debug_area != NULL) { debug_unregister(dasd_debug_area); dasd_debug_area = NULL; @@ -1855,15 +1853,34 @@ dasd_generic_probe (struct ccw_device *cdev, { int ret; + ret = ccw_device_set_options(cdev, CCWDEV_DO_PATHGROUP); + if (ret) { + printk(KERN_WARNING + "dasd_generic_probe: could not set ccw-device options " + "for %s\n", cdev->dev.bus_id); + return ret; + } ret = dasd_add_sysfs_files(cdev); if (ret) { printk(KERN_WARNING "dasd_generic_probe: could not add sysfs entries " "for %s\n", cdev->dev.bus_id); - } else { - cdev->handler = &dasd_int_handler; + return ret; } + cdev->handler = &dasd_int_handler; + /* + * Automatically online either all dasd devices (dasd_autodetect) + * or all devices specified with dasd= parameters during + * initial probe. + */ + if ((dasd_get_feature(cdev, DASD_FEATURE_INITIAL_ONLINE) > 0 ) || + (dasd_autodetect && dasd_busid_known(cdev->dev.bus_id) != 0)) + ret = ccw_device_set_online(cdev); + if (ret) + printk(KERN_WARNING + "dasd_generic_probe: could not initially online " + "ccw-device %s\n", cdev->dev.bus_id); return ret; } @@ -1911,6 +1928,8 @@ dasd_generic_set_online (struct ccw_device *cdev, struct dasd_device *device; int rc; + /* first online clears initial online feature flag */ + dasd_set_feature(cdev, DASD_FEATURE_INITIAL_ONLINE, 0); device = dasd_create_device(cdev); if (IS_ERR(device)) return PTR_ERR(device); @@ -2065,31 +2084,6 @@ dasd_generic_notify(struct ccw_device *cdev, int event) return ret; } -/* - * Automatically online either all dasd devices (dasd_autodetect) or - * all devices specified with dasd= parameters. - */ -static int -__dasd_auto_online(struct device *dev, void *data) -{ - struct ccw_device *cdev; - - cdev = to_ccwdev(dev); - if (dasd_autodetect || dasd_busid_known(cdev->dev.bus_id) == 0) - ccw_device_set_online(cdev); - return 0; -} - -void -dasd_generic_auto_online (struct ccw_driver *dasd_discipline_driver) -{ - struct device_driver *drv; - - drv = get_driver(&dasd_discipline_driver->driver); - driver_for_each_device(drv, NULL, NULL, __dasd_auto_online); - put_driver(drv); -} - static int __init dasd_init(void) @@ -2111,9 +2105,6 @@ dasd_init(void) dasd_diag_discipline_pointer = NULL; - rc = devfs_mk_dir("dasd"); - if (rc) - goto failed; rc = dasd_devmap_init(); if (rc) goto failed; @@ -2170,23 +2161,4 @@ EXPORT_SYMBOL_GPL(dasd_generic_remove); EXPORT_SYMBOL_GPL(dasd_generic_notify); EXPORT_SYMBOL_GPL(dasd_generic_set_online); EXPORT_SYMBOL_GPL(dasd_generic_set_offline); -EXPORT_SYMBOL_GPL(dasd_generic_auto_online); -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-indent-level: 4 - * c-brace-imaginary-offset: 0 - * c-brace-offset: -4 - * c-argdecl-indent: 4 - * c-label-offset: -4 - * c-continued-statement-offset: 4 - * c-continued-brace-offset: 0 - * indent-tabs-mode: 1 - * tab-width: 8 - * End: - */ diff --git a/drivers/s390/block/dasd_3370_erp.c b/drivers/s390/block/dasd_3370_erp.c index 1d11c2a9525..1ddab8991d9 100644 --- a/drivers/s390/block/dasd_3370_erp.c +++ b/drivers/s390/block/dasd_3370_erp.c @@ -1,4 +1,4 @@ -/* +/* * File...........: linux/drivers/s390/block/dasd_3370_erp.c * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> * Bugreports.to..: <Linux390@de.ibm.com> @@ -12,10 +12,10 @@ /* - * DASD_3370_ERP_EXAMINE + * DASD_3370_ERP_EXAMINE * * DESCRIPTION - * Checks only for fatal/no/recover error. + * Checks only for fatal/no/recover error. * A detailed examination of the sense data is done later outside * the interrupt handler. * @@ -23,7 +23,7 @@ * 'Chapter 7. 3370 Sense Data'. * * RETURN VALUES - * dasd_era_none no error + * dasd_era_none no error * dasd_era_fatal for all fatal (unrecoverable errors) * dasd_era_recover for all others. */ @@ -82,22 +82,3 @@ dasd_3370_erp_examine(struct dasd_ccw_req * cqr, struct irb * irb) return dasd_era_recover; } /* END dasd_3370_erp_examine */ - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-indent-level: 4 - * c-brace-imaginary-offset: 0 - * c-brace-offset: -4 - * c-argdecl-indent: 4 - * c-label-offset: -4 - * c-continued-statement-offset: 4 - * c-continued-brace-offset: 0 - * indent-tabs-mode: 1 - * tab-width: 8 - * End: - */ diff --git a/drivers/s390/block/dasd_3990_erp.c b/drivers/s390/block/dasd_3990_erp.c index 2ed51562319..669805d4402 100644 --- a/drivers/s390/block/dasd_3990_erp.c +++ b/drivers/s390/block/dasd_3990_erp.c @@ -1,6 +1,6 @@ -/* +/* * File...........: linux/drivers/s390/block/dasd_3990_erp.c - * Author(s)......: Horst Hummel <Horst.Hummel@de.ibm.com> + * Author(s)......: Horst Hummel <Horst.Hummel@de.ibm.com> * Holger Smolinski <Holger.Smolinski@de.ibm.com> * Bugreports.to..: <Linux390@de.ibm.com> * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000, 2001 @@ -25,23 +25,23 @@ struct DCTL_data { } __attribute__ ((packed)); /* - ***************************************************************************** + ***************************************************************************** * SECTION ERP EXAMINATION - ***************************************************************************** + ***************************************************************************** */ /* - * DASD_3990_ERP_EXAMINE_24 + * DASD_3990_ERP_EXAMINE_24 * * DESCRIPTION - * Checks only for fatal (unrecoverable) error. + * Checks only for fatal (unrecoverable) error. * A detailed examination of the sense data is done later outside * the interrupt handler. * * Each bit configuration leading to an action code 2 (Exit with * programming error or unusual condition indication) * are handled as fatal error´s. - * + * * All other configurations are handled as recoverable errors. * * RETURN VALUES @@ -93,15 +93,15 @@ dasd_3990_erp_examine_24(struct dasd_ccw_req * cqr, char *sense) } /* END dasd_3990_erp_examine_24 */ /* - * DASD_3990_ERP_EXAMINE_32 + * DASD_3990_ERP_EXAMINE_32 * * DESCRIPTION - * Checks only for fatal/no/recoverable error. + * Checks only for fatal/no/recoverable error. * A detailed examination of the sense data is done later outside * the interrupt handler. * * RETURN VALUES - * dasd_era_none no error + * dasd_era_none no error * dasd_era_fatal for all fatal (unrecoverable errors) * dasd_era_recover for recoverable others. */ @@ -128,10 +128,10 @@ dasd_3990_erp_examine_32(struct dasd_ccw_req * cqr, char *sense) } /* end dasd_3990_erp_examine_32 */ /* - * DASD_3990_ERP_EXAMINE + * DASD_3990_ERP_EXAMINE * * DESCRIPTION - * Checks only for fatal/no/recover error. + * Checks only for fatal/no/recover error. * A detailed examination of the sense data is done later outside * the interrupt handler. * @@ -139,7 +139,7 @@ dasd_3990_erp_examine_32(struct dasd_ccw_req * cqr, char *sense) * 'Chapter 7. Error Recovery Procedures'. * * RETURN VALUES - * dasd_era_none no error + * dasd_era_none no error * dasd_era_fatal for all fatal (unrecoverable errors) * dasd_era_recover for all others. */ @@ -178,18 +178,18 @@ dasd_3990_erp_examine(struct dasd_ccw_req * cqr, struct irb * irb) } /* END dasd_3990_erp_examine */ /* - ***************************************************************************** + ***************************************************************************** * SECTION ERP HANDLING - ***************************************************************************** + ***************************************************************************** */ /* - ***************************************************************************** + ***************************************************************************** * 24 and 32 byte sense ERP functions - ***************************************************************************** + ***************************************************************************** */ /* - * DASD_3990_ERP_CLEANUP + * DASD_3990_ERP_CLEANUP * * DESCRIPTION * Removes the already build but not necessary ERP request and sets @@ -197,10 +197,10 @@ dasd_3990_erp_examine(struct dasd_ccw_req * cqr, struct irb * irb) * * PARAMETER * erp request to be blocked - * final_status either DASD_CQR_DONE or DASD_CQR_FAILED + * final_status either DASD_CQR_DONE or DASD_CQR_FAILED * * RETURN VALUES - * cqr original cqr + * cqr original cqr */ static struct dasd_ccw_req * dasd_3990_erp_cleanup(struct dasd_ccw_req * erp, char final_status) @@ -214,7 +214,7 @@ dasd_3990_erp_cleanup(struct dasd_ccw_req * erp, char final_status) } /* end dasd_3990_erp_cleanup */ /* - * DASD_3990_ERP_BLOCK_QUEUE + * DASD_3990_ERP_BLOCK_QUEUE * * DESCRIPTION * Block the given device request queue to prevent from further @@ -237,7 +237,7 @@ dasd_3990_erp_block_queue(struct dasd_ccw_req * erp, int expires) } /* - * DASD_3990_ERP_INT_REQ + * DASD_3990_ERP_INT_REQ * * DESCRIPTION * Handles 'Intervention Required' error. @@ -277,7 +277,7 @@ dasd_3990_erp_int_req(struct dasd_ccw_req * erp) } /* end dasd_3990_erp_int_req */ /* - * DASD_3990_ERP_ALTERNATE_PATH + * DASD_3990_ERP_ALTERNATE_PATH * * DESCRIPTION * Repeat the operation on a different channel path. @@ -330,15 +330,15 @@ dasd_3990_erp_alternate_path(struct dasd_ccw_req * erp) * DASD_3990_ERP_DCTL * * DESCRIPTION - * Setup cqr to do the Diagnostic Control (DCTL) command with an + * Setup cqr to do the Diagnostic Control (DCTL) command with an * Inhibit Write subcommand (0x20) and the given modifier. * * PARAMETER * erp pointer to the current (failed) ERP * modifier subcommand modifier - * + * * RETURN VALUES - * dctl_cqr pointer to NEW dctl_cqr + * dctl_cqr pointer to NEW dctl_cqr * */ static struct dasd_ccw_req * @@ -386,7 +386,7 @@ dasd_3990_erp_DCTL(struct dasd_ccw_req * erp, char modifier) } /* end dasd_3990_erp_DCTL */ /* - * DASD_3990_ERP_ACTION_1 + * DASD_3990_ERP_ACTION_1 * * DESCRIPTION * Setup ERP to do the ERP action 1 (see Reference manual). @@ -415,7 +415,7 @@ dasd_3990_erp_action_1(struct dasd_ccw_req * erp) } /* end dasd_3990_erp_action_1 */ /* - * DASD_3990_ERP_ACTION_4 + * DASD_3990_ERP_ACTION_4 * * DESCRIPTION * Setup ERP to do the ERP action 4 (see Reference manual). @@ -453,11 +453,11 @@ dasd_3990_erp_action_4(struct dasd_ccw_req * erp, char *sense) if (sense[25] == 0x1D) { /* state change pending */ - DEV_MESSAGE(KERN_INFO, device, + DEV_MESSAGE(KERN_INFO, device, "waiting for state change pending " "interrupt, %d retries left", erp->retries); - + dasd_3990_erp_block_queue(erp, 30*HZ); } else if (sense[25] == 0x1E) { /* busy */ @@ -469,9 +469,9 @@ dasd_3990_erp_action_4(struct dasd_ccw_req * erp, char *sense) } else { /* no state change pending - retry */ - DEV_MESSAGE (KERN_INFO, device, + DEV_MESSAGE (KERN_INFO, device, "redriving request immediately, " - "%d retries left", + "%d retries left", erp->retries); erp->status = DASD_CQR_QUEUED; } @@ -482,13 +482,13 @@ dasd_3990_erp_action_4(struct dasd_ccw_req * erp, char *sense) } /* end dasd_3990_erp_action_4 */ /* - ***************************************************************************** + ***************************************************************************** * 24 byte sense ERP functions (only) - ***************************************************************************** + ***************************************************************************** */ /* - * DASD_3990_ERP_ACTION_5 + * DASD_3990_ERP_ACTION_5 * * DESCRIPTION * Setup ERP to do the ERP action 5 (see Reference manual). @@ -523,7 +523,7 @@ dasd_3990_erp_action_5(struct dasd_ccw_req * erp) * * PARAMETER * sense current sense data - * + * * RETURN VALUES * void */ @@ -1150,9 +1150,9 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense) * PARAMETER * erp current erp_head * sense current sense data - * + * * RETURN VALUES - * erp 'new' erp_head - pointer to new ERP + * erp 'new' erp_head - pointer to new ERP */ static struct dasd_ccw_req * dasd_3990_erp_com_rej(struct dasd_ccw_req * erp, char *sense) @@ -1185,7 +1185,7 @@ dasd_3990_erp_com_rej(struct dasd_ccw_req * erp, char *sense) } /* end dasd_3990_erp_com_rej */ /* - * DASD_3990_ERP_BUS_OUT + * DASD_3990_ERP_BUS_OUT * * DESCRIPTION * Handles 24 byte 'Bus Out Parity Check' error. @@ -1483,7 +1483,7 @@ dasd_3990_erp_env_data(struct dasd_ccw_req * erp, char *sense) * * PARAMETER * erp already added default ERP - * + * * RETURN VALUES * erp new erp_head - pointer to new ERP */ @@ -1527,11 +1527,11 @@ dasd_3990_erp_file_prot(struct dasd_ccw_req * erp) } /* end dasd_3990_erp_file_prot */ /* - * DASD_3990_ERP_INSPECT_24 + * DASD_3990_ERP_INSPECT_24 * * DESCRIPTION * Does a detailed inspection of the 24 byte sense data - * and sets up a related error recovery action. + * and sets up a related error recovery action. * * PARAMETER * sense sense data of the actual error @@ -1602,13 +1602,13 @@ dasd_3990_erp_inspect_24(struct dasd_ccw_req * erp, char *sense) } /* END dasd_3990_erp_inspect_24 */ /* - ***************************************************************************** + ***************************************************************************** * 32 byte sense ERP functions (only) - ***************************************************************************** + ***************************************************************************** */ /* - * DASD_3990_ERPACTION_10_32 + * DASD_3990_ERPACTION_10_32 * * DESCRIPTION * Handles 32 byte 'Action 10' of Single Program Action Codes. @@ -1616,7 +1616,7 @@ dasd_3990_erp_inspect_24(struct dasd_ccw_req * erp, char *sense) * * PARAMETER * erp current erp_head - * sense current sense data + * sense current sense data * RETURN VALUES * erp modified erp_head */ @@ -1640,18 +1640,18 @@ dasd_3990_erp_action_10_32(struct dasd_ccw_req * erp, char *sense) * * DESCRIPTION * Handles 32 byte 'Action 1B' of Single Program Action Codes. - * A write operation could not be finished because of an unexpected + * A write operation could not be finished because of an unexpected * condition. - * The already created 'default erp' is used to get the link to - * the erp chain, but it can not be used for this recovery + * The already created 'default erp' is used to get the link to + * the erp chain, but it can not be used for this recovery * action because it contains no DE/LO data space. * * PARAMETER * default_erp already added default erp. - * sense current sense data + * sense current sense data * * RETURN VALUES - * erp new erp or + * erp new erp or * default_erp in case of imprecise ending or error */ static struct dasd_ccw_req * @@ -1789,16 +1789,16 @@ dasd_3990_erp_action_1B_32(struct dasd_ccw_req * default_erp, char *sense) * DASD_3990_UPDATE_1B * * DESCRIPTION - * Handles the update to the 32 byte 'Action 1B' of Single Program + * Handles the update to the 32 byte 'Action 1B' of Single Program * Action Codes in case the first action was not successful. * The already created 'previous_erp' is the currently not successful - * ERP. + * ERP. * * PARAMETER * previous_erp already created previous erp. - * sense current sense data + * sense current sense data * RETURN VALUES - * erp modified erp + * erp modified erp */ static struct dasd_ccw_req * dasd_3990_update_1B(struct dasd_ccw_req * previous_erp, char *sense) @@ -1897,7 +1897,7 @@ dasd_3990_update_1B(struct dasd_ccw_req * previous_erp, char *sense) } /* end dasd_3990_update_1B */ /* - * DASD_3990_ERP_COMPOUND_RETRY + * DASD_3990_ERP_COMPOUND_RETRY * * DESCRIPTION * Handles the compound ERP action retry code. @@ -1943,7 +1943,7 @@ dasd_3990_erp_compound_retry(struct dasd_ccw_req * erp, char *sense) } /* end dasd_3990_erp_compound_retry */ /* - * DASD_3990_ERP_COMPOUND_PATH + * DASD_3990_ERP_COMPOUND_PATH * * DESCRIPTION * Handles the compound ERP action for retry on alternate @@ -1965,7 +1965,7 @@ dasd_3990_erp_compound_path(struct dasd_ccw_req * erp, char *sense) dasd_3990_erp_alternate_path(erp); if (erp->status == DASD_CQR_FAILED) { - /* reset the lpm and the status to be able to + /* reset the lpm and the status to be able to * try further actions. */ erp->lpm = 0; @@ -1980,7 +1980,7 @@ dasd_3990_erp_compound_path(struct dasd_ccw_req * erp, char *sense) } /* end dasd_3990_erp_compound_path */ /* - * DASD_3990_ERP_COMPOUND_CODE + * DASD_3990_ERP_COMPOUND_CODE * * DESCRIPTION * Handles the compound ERP action for retry code. @@ -2001,18 +2001,18 @@ dasd_3990_erp_compound_code(struct dasd_ccw_req * erp, char *sense) switch (sense[28]) { case 0x17: - /* issue a Diagnostic Control command with an + /* issue a Diagnostic Control command with an * Inhibit Write subcommand and controler modifier */ erp = dasd_3990_erp_DCTL(erp, 0x20); break; - + case 0x25: /* wait for 5 seconds and retry again */ erp->retries = 1; - + dasd_3990_erp_block_queue (erp, 5*HZ); break; - + default: /* should not happen - continue */ break; @@ -2026,7 +2026,7 @@ dasd_3990_erp_compound_code(struct dasd_ccw_req * erp, char *sense) } /* end dasd_3990_erp_compound_code */ /* - * DASD_3990_ERP_COMPOUND_CONFIG + * DASD_3990_ERP_COMPOUND_CONFIG * * DESCRIPTION * Handles the compound ERP action for configruation @@ -2063,10 +2063,10 @@ dasd_3990_erp_compound_config(struct dasd_ccw_req * erp, char *sense) } /* end dasd_3990_erp_compound_config */ /* - * DASD_3990_ERP_COMPOUND + * DASD_3990_ERP_COMPOUND * * DESCRIPTION - * Does the further compound program action if + * Does the further compound program action if * compound retry was not successful. * * PARAMETER @@ -2110,11 +2110,11 @@ dasd_3990_erp_compound(struct dasd_ccw_req * erp, char *sense) } /* end dasd_3990_erp_compound */ /* - * DASD_3990_ERP_INSPECT_32 + * DASD_3990_ERP_INSPECT_32 * * DESCRIPTION * Does a detailed inspection of the 32 byte sense data - * and sets up a related error recovery action. + * and sets up a related error recovery action. * * PARAMETER * sense sense data of the actual error @@ -2228,9 +2228,9 @@ dasd_3990_erp_inspect_32(struct dasd_ccw_req * erp, char *sense) } /* end dasd_3990_erp_inspect_32 */ /* - ***************************************************************************** + ***************************************************************************** * main ERP control fuctions (24 and 32 byte sense) - ***************************************************************************** + ***************************************************************************** */ /* @@ -2243,7 +2243,7 @@ dasd_3990_erp_inspect_32(struct dasd_ccw_req * erp, char *sense) * PARAMETER * erp pointer to the currently created default ERP * RETURN VALUES - * erp_new contens was possibly modified + * erp_new contens was possibly modified */ static struct dasd_ccw_req * dasd_3990_erp_inspect(struct dasd_ccw_req * erp) @@ -2272,14 +2272,14 @@ dasd_3990_erp_inspect(struct dasd_ccw_req * erp) /* * DASD_3990_ERP_ADD_ERP - * + * * DESCRIPTION * This funtion adds an additional request block (ERP) to the head of * the given cqr (or erp). * This erp is initialized as an default erp (retry TIC) * * PARAMETER - * cqr head of the current ERP-chain (or single cqr if + * cqr head of the current ERP-chain (or single cqr if * first error) * RETURN VALUES * erp pointer to new ERP-chain head @@ -2332,15 +2332,15 @@ dasd_3990_erp_add_erp(struct dasd_ccw_req * cqr) } /* - * DASD_3990_ERP_ADDITIONAL_ERP - * + * DASD_3990_ERP_ADDITIONAL_ERP + * * DESCRIPTION * An additional ERP is needed to handle the current error. * Add ERP to the head of the ERP-chain containing the ERP processing * determined based on the sense data. * * PARAMETER - * cqr head of the current ERP-chain (or single cqr if + * cqr head of the current ERP-chain (or single cqr if * first error) * * RETURN VALUES @@ -2376,7 +2376,7 @@ dasd_3990_erp_additional_erp(struct dasd_ccw_req * cqr) * 24 byte sense byte 25 and 27 is set as well. * * PARAMETER - * cqr1 first cqr, which will be compared with the + * cqr1 first cqr, which will be compared with the * cqr2 second cqr. * * RETURN VALUES @@ -2415,7 +2415,7 @@ dasd_3990_erp_error_match(struct dasd_ccw_req *cqr1, struct dasd_ccw_req *cqr2) * cqr failed cqr (either original cqr or already an erp) * * RETURN VALUES - * erp erp-pointer to the already defined error + * erp erp-pointer to the already defined error * recovery procedure OR * NULL if a 'new' error occurred. */ @@ -2451,10 +2451,10 @@ dasd_3990_erp_in_erp(struct dasd_ccw_req *cqr) * DASD_3990_ERP_FURTHER_ERP (24 & 32 byte sense) * * DESCRIPTION - * No retry is left for the current ERP. Check what has to be done + * No retry is left for the current ERP. Check what has to be done * with the ERP. * - do further defined ERP action or - * - wait for interrupt or + * - wait for interrupt or * - exit with permanent error * * PARAMETER @@ -2485,7 +2485,7 @@ dasd_3990_erp_further_erp(struct dasd_ccw_req *erp) if (!(sense[2] & DASD_SENSE_BIT_0)) { - /* issue a Diagnostic Control command with an + /* issue a Diagnostic Control command with an * Inhibit Write subcommand */ switch (sense[25]) { @@ -2535,14 +2535,14 @@ dasd_3990_erp_further_erp(struct dasd_ccw_req *erp) } /* end dasd_3990_erp_further_erp */ /* - * DASD_3990_ERP_HANDLE_MATCH_ERP + * DASD_3990_ERP_HANDLE_MATCH_ERP * * DESCRIPTION * An error occurred again and an ERP has been detected which is already - * used to handle this error (e.g. retries). + * used to handle this error (e.g. retries). * All prior ERP's are asumed to be successful and therefore removed * from queue. - * If retry counter of matching erp is already 0, it is checked if further + * If retry counter of matching erp is already 0, it is checked if further * action is needed (besides retry) or if the ERP has failed. * * PARAMETER @@ -2631,7 +2631,7 @@ dasd_3990_erp_handle_match_erp(struct dasd_ccw_req *erp_head, * erp erp-pointer to the head of the ERP action chain. * This means: * - either a ptr to an additional ERP cqr or - * - the original given cqr (which's status might + * - the original given cqr (which's status might * be modified) */ struct dasd_ccw_req * @@ -2723,22 +2723,3 @@ dasd_3990_erp_action(struct dasd_ccw_req * cqr) return erp; } /* end dasd_3990_erp_action */ - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-indent-level: 4 - * c-brace-imaginary-offset: 0 - * c-brace-offset: -4 - * c-argdecl-indent: 4 - * c-label-offset: -4 - * c-continued-statement-offset: 4 - * c-continued-brace-offset: 0 - * indent-tabs-mode: 1 - * tab-width: 8 - * End: - */ diff --git a/drivers/s390/block/dasd_9336_erp.c b/drivers/s390/block/dasd_9336_erp.c index dc861446d05..6e082688475 100644 --- a/drivers/s390/block/dasd_9336_erp.c +++ b/drivers/s390/block/dasd_9336_erp.c @@ -1,4 +1,4 @@ -/* +/* * File...........: linux/drivers/s390/block/dasd_9336_erp.c * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> * Bugreports.to..: <Linux390@de.ibm.com> @@ -12,10 +12,10 @@ /* - * DASD_9336_ERP_EXAMINE + * DASD_9336_ERP_EXAMINE * * DESCRIPTION - * Checks only for fatal/no/recover error. + * Checks only for fatal/no/recover error. * A detailed examination of the sense data is done later outside * the interrupt handler. * @@ -23,7 +23,7 @@ * 'Chapter 7. 9336 Sense Data'. * * RETURN VALUES - * dasd_era_none no error + * dasd_era_none no error * dasd_era_fatal for all fatal (unrecoverable errors) * dasd_era_recover for all others. */ @@ -39,22 +39,3 @@ dasd_9336_erp_examine(struct dasd_ccw_req * cqr, struct irb * irb) return dasd_era_recover; } /* END dasd_9336_erp_examine */ - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-indent-level: 4 - * c-brace-imaginary-offset: 0 - * c-brace-offset: -4 - * c-argdecl-indent: 4 - * c-label-offset: -4 - * c-continued-statement-offset: 4 - * c-continued-brace-offset: 0 - * indent-tabs-mode: 1 - * tab-width: 8 - * End: - */ diff --git a/drivers/s390/block/dasd_9343_erp.c b/drivers/s390/block/dasd_9343_erp.c index 4a5b79569aa..ddecb9808ed 100644 --- a/drivers/s390/block/dasd_9343_erp.c +++ b/drivers/s390/block/dasd_9343_erp.c @@ -1,4 +1,4 @@ -/* +/* * File...........: linux/drivers/s390/block/dasd_9345_erp.c * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> * Bugreports.to..: <Linux390@de.ibm.com> diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 216bc4fba19..d7295386821 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c @@ -13,7 +13,6 @@ * */ -#include <linux/config.h> #include <linux/ctype.h> #include <linux/init.h> #include <linux/module.h> @@ -27,7 +26,7 @@ #include "dasd_int.h" kmem_cache_t *dasd_page_cache; -EXPORT_SYMBOL(dasd_page_cache); +EXPORT_SYMBOL_GPL(dasd_page_cache); /* * dasd_devmap_t is used to store the features and the relation @@ -49,6 +48,20 @@ struct dasd_devmap { }; /* + * dasd_servermap is used to store the server_id of all storage servers + * accessed by DASD device driver. + */ +struct dasd_servermap { + struct list_head list; + struct server_id { + char vendor[4]; + char serial[15]; + } sid; +}; + +static struct list_head dasd_serverlist; + +/* * Parameter parsing functions for dasd= parameter. The syntax is: * <devno> : (0x)?[0-9a-fA-F]+ * <busid> : [0-0a-f]\.[0-9a-f]\.(0x)?[0-9a-fA-F]+ @@ -64,6 +77,8 @@ struct dasd_devmap { int dasd_probeonly = 0; /* is true, when probeonly mode is active */ int dasd_autodetect = 0; /* is true, when autodetection is active */ +int dasd_nopav = 0; /* is true, when PAV is disabled */ +EXPORT_SYMBOL_GPL(dasd_nopav); /* * char *dasd[] is intended to hold the ranges supplied by the dasd= statement @@ -123,7 +138,7 @@ static inline int dasd_busid(char **str, int *id0, int *id1, int *devno) { int val, old_style; - + /* check for leading '0x' */ old_style = 0; if ((*str)[0] == '0' && (*str)[1] == 'x') { @@ -179,7 +194,7 @@ dasd_feature_list(char *str, char **endp) features = 0; while (1) { - for (len = 0; + for (len = 0; str[len] && str[len] != ':' && str[len] != ')'; len++); if (len == 2 && !strncmp(str, "ro", 2)) features |= DASD_FEATURE_READONLY; @@ -228,19 +243,24 @@ dasd_parse_keyword( char *parsestring ) { length = strlen(parsestring); residual_str = parsestring + length; } - if (strncmp ("autodetect", parsestring, length) == 0) { + if (strncmp("autodetect", parsestring, length) == 0) { dasd_autodetect = 1; MESSAGE (KERN_INFO, "%s", "turning to autodetection mode"); return residual_str; } - if (strncmp ("probeonly", parsestring, length) == 0) { + if (strncmp("probeonly", parsestring, length) == 0) { dasd_probeonly = 1; MESSAGE(KERN_INFO, "%s", "turning to probeonly mode"); return residual_str; } - if (strncmp ("fixedbuffers", parsestring, length) == 0) { + if (strncmp("nopav", parsestring, length) == 0) { + dasd_nopav = 1; + MESSAGE(KERN_INFO, "%s", "disable PAV mode"); + return residual_str; + } + if (strncmp("fixedbuffers", parsestring, length) == 0) { if (dasd_page_cache) return residual_str; dasd_page_cache = @@ -294,6 +314,8 @@ dasd_parse_range( char *parsestring ) { features = dasd_feature_list(str, &str); if (features < 0) return ERR_PTR(-EINVAL); + /* each device in dasd= parameter should be set initially online */ + features |= DASD_FEATURE_INITIAL_ONLINE; while (from <= to) { sprintf(bus_id, "%01x.%01x.%04x", from_id0, from_id1, from++); @@ -359,7 +381,7 @@ dasd_parse(void) * Add a devmap for the device specified by busid. It is possible that * the devmap already exists (dasd= parameter). The order of the devices * added through this function will define the kdevs for the individual - * devices. + * devices. */ static struct dasd_devmap * dasd_add_busid(char *bus_id, int features) @@ -368,7 +390,7 @@ dasd_add_busid(char *bus_id, int features) int hash; new = (struct dasd_devmap *) - kmalloc(sizeof(struct dasd_devmap), GFP_KERNEL); + kzalloc(sizeof(struct dasd_devmap), GFP_KERNEL); if (!new) return ERR_PTR(-ENOMEM); spin_lock(&dasd_devmap_lock); @@ -630,7 +652,8 @@ dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf) } static ssize_t -dasd_ro_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +dasd_ro_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { struct dasd_devmap *devmap; int ro_flag; @@ -658,7 +681,7 @@ static DEVICE_ATTR(readonly, 0644, dasd_ro_show, dasd_ro_store); * use_diag controls whether the driver should use diag rather than ssch * to talk to the device */ -static ssize_t +static ssize_t dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf) { struct dasd_devmap *devmap; @@ -673,7 +696,8 @@ dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf) } static ssize_t -dasd_use_diag_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) +dasd_use_diag_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { struct dasd_devmap *devmap; ssize_t rc; @@ -697,11 +721,11 @@ dasd_use_diag_store(struct device *dev, struct device_attribute *attr, const cha return rc; } -static -DEVICE_ATTR(use_diag, 0644, dasd_use_diag_show, dasd_use_diag_store); +static DEVICE_ATTR(use_diag, 0644, dasd_use_diag_show, dasd_use_diag_store); static ssize_t -dasd_discipline_show(struct device *dev, struct device_attribute *attr, char *buf) +dasd_discipline_show(struct device *dev, struct device_attribute *attr, + char *buf) { struct dasd_devmap *devmap; char *dname; @@ -834,6 +858,38 @@ static struct attribute_group dasd_attr_group = { .attrs = dasd_attrs, }; +/* + * Check if the related storage server is already contained in the + * dasd_serverlist. If server is not contained, create new entry. + * Return 0 if server was already in serverlist, + * 1 if the server was added successfully + * <0 in case of error. + */ +static int +dasd_add_server(struct dasd_uid *uid) +{ + struct dasd_servermap *new, *tmp; + + /* check if server is already contained */ + list_for_each_entry(tmp, &dasd_serverlist, list) + // normale cmp? + if (strncmp(tmp->sid.vendor, uid->vendor, + sizeof(tmp->sid.vendor)) == 0 + && strncmp(tmp->sid.serial, uid->serial, + sizeof(tmp->sid.serial)) == 0) + return 0; + + new = (struct dasd_servermap *) + kzalloc(sizeof(struct dasd_servermap), GFP_KERNEL); + if (!new) + return -ENOMEM; + + strncpy(new->sid.vendor, uid->vendor, sizeof(new->sid.vendor)); + strncpy(new->sid.serial, uid->serial, sizeof(new->sid.serial)); + list_add(&new->list, &dasd_serverlist); + return 1; +} + /* * Return copy of the device unique identifier. @@ -854,21 +910,26 @@ dasd_get_uid(struct ccw_device *cdev, struct dasd_uid *uid) /* * Register the given device unique identifier into devmap struct. + * Return 0 if server was already in serverlist, + * 1 if the server was added successful + * <0 in case of error. */ int dasd_set_uid(struct ccw_device *cdev, struct dasd_uid *uid) { struct dasd_devmap *devmap; + int rc; devmap = dasd_find_busid(cdev->dev.bus_id); if (IS_ERR(devmap)) return PTR_ERR(devmap); spin_lock(&dasd_devmap_lock); devmap->uid = *uid; + rc = dasd_add_server(uid); spin_unlock(&dasd_devmap_lock); - return 0; + return rc; } -EXPORT_SYMBOL(dasd_set_uid); +EXPORT_SYMBOL_GPL(dasd_set_uid); /* * Return value of the specified feature. @@ -880,7 +941,7 @@ dasd_get_feature(struct ccw_device *cdev, int feature) devmap = dasd_find_busid(cdev->dev.bus_id); if (IS_ERR(devmap)) - return (int) PTR_ERR(devmap); + return PTR_ERR(devmap); return ((devmap->features & feature) != 0); } @@ -896,7 +957,7 @@ dasd_set_feature(struct ccw_device *cdev, int feature, int flag) devmap = dasd_find_busid(cdev->dev.bus_id); if (IS_ERR(devmap)) - return (int) PTR_ERR(devmap); + return PTR_ERR(devmap); spin_lock(&dasd_devmap_lock); if (flag) @@ -932,8 +993,10 @@ dasd_devmap_init(void) dasd_max_devindex = 0; for (i = 0; i < 256; i++) INIT_LIST_HEAD(&dasd_hashlists[i]); - return 0; + /* Initialize servermap structure. */ + INIT_LIST_HEAD(&dasd_serverlist); + return 0; } void diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index 3f9d704d265..23fa0b28917 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c @@ -1,4 +1,4 @@ -/* +/* * File...........: linux/drivers/s390/block/dasd_diag.c * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> * Based on.......: linux/drivers/s390/block/mdisk.c @@ -8,7 +8,6 @@ * */ -#include <linux/config.h> #include <linux/stddef.h> #include <linux/kernel.h> #include <linux/slab.h> @@ -336,7 +335,7 @@ dasd_diag_check_device(struct dasd_device *device) private = (struct dasd_diag_private *) device->private; if (private == NULL) { - private = kmalloc(sizeof(struct dasd_diag_private),GFP_KERNEL); + private = kzalloc(sizeof(struct dasd_diag_private),GFP_KERNEL); if (private == NULL) { DEV_MESSAGE(KERN_WARNING, device, "%s", "memory allocation failed for private data"); @@ -527,7 +526,7 @@ dasd_diag_build_cp(struct dasd_device * device, struct request *req) datasize, device); if (IS_ERR(cqr)) return cqr; - + dreq = (struct dasd_diag_req *) cqr->data; dreq->block_count = count; dbio = dreq->bio; diff --git a/drivers/s390/block/dasd_diag.h b/drivers/s390/block/dasd_diag.h index 38a4e55f895..b8c78267ff3 100644 --- a/drivers/s390/block/dasd_diag.h +++ b/drivers/s390/block/dasd_diag.h @@ -1,4 +1,4 @@ -/* +/* * File...........: linux/drivers/s390/block/dasd_diag.h * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> * Based on.......: linux/drivers/s390/block/mdisk.h diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 7d5a6cee4bd..2e655f46674 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c @@ -1,7 +1,7 @@ -/* +/* * File...........: linux/drivers/s390/block/dasd_eckd.c * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> - * Horst Hummel <Horst.Hummel@de.ibm.com> + * Horst Hummel <Horst.Hummel@de.ibm.com> * Carsten Otte <Cotte@de.ibm.com> * Martin Schwidefsky <schwidefsky@de.ibm.com> * Bugreports.to..: <Linux390@de.ibm.com> @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/stddef.h> #include <linux/kernel.h> #include <linux/slab.h> @@ -24,6 +23,7 @@ #include <asm/io.h> #include <asm/todclk.h> #include <asm/uaccess.h> +#include <asm/cio.h> #include <asm/ccwdev.h> #include "dasd_int.h" @@ -89,17 +89,22 @@ dasd_eckd_probe (struct ccw_device *cdev) { int ret; - ret = dasd_generic_probe (cdev, &dasd_eckd_discipline); - if (ret) + /* set ECKD specific ccw-device options */ + ret = ccw_device_set_options(cdev, CCWDEV_ALLOW_FORCE); + if (ret) { + printk(KERN_WARNING + "dasd_eckd_probe: could not set ccw-device options " + "for %s\n", cdev->dev.bus_id); return ret; - ccw_device_set_options(cdev, CCWDEV_DO_PATHGROUP | CCWDEV_ALLOW_FORCE); - return 0; + } + ret = dasd_generic_probe(cdev, &dasd_eckd_discipline); + return ret; } static int dasd_eckd_set_online(struct ccw_device *cdev) { - return dasd_generic_set_online (cdev, &dasd_eckd_discipline); + return dasd_generic_set_online(cdev, &dasd_eckd_discipline); } static struct ccw_driver dasd_eckd_driver = { @@ -210,14 +215,14 @@ check_XRC (struct ccw1 *de_ccw, /* switch on System Time Stamp - needed for XRC Support */ if (private->rdc_data.facilities.XRC_supported) { - + data->ga_extended |= 0x08; /* switch on 'Time Stamp Valid' */ data->ga_extended |= 0x02; /* switch on 'Extended Parameter' */ - + data->ep_sys_time = get_clock (); - + de_ccw->count = sizeof (struct DE_eckd_data); - de_ccw->flags |= CCW_FLAG_SLI; + de_ccw->flags |= CCW_FLAG_SLI; } return; @@ -296,8 +301,8 @@ define_extent(struct ccw1 * ccw, struct DE_eckd_data * data, int trk, /* check for sequential prestage - enhance cylinder range */ if (data->attributes.operation == DASD_SEQ_PRESTAGE || data->attributes.operation == DASD_SEQ_ACCESS) { - - if (end.cyl + private->attrib.nr_cyl < geo.cyl) + + if (end.cyl + private->attrib.nr_cyl < geo.cyl) end.cyl += private->attrib.nr_cyl; else end.cyl = (geo.cyl - 1); @@ -317,7 +322,7 @@ locate_record(struct ccw1 *ccw, struct LO_eckd_data *data, int trk, struct dasd_eckd_private *private; int sector; int dn, d; - + private = (struct dasd_eckd_private *) device->private; DBF_DEV_EVENT(DBF_INFO, device, @@ -541,6 +546,86 @@ dasd_eckd_read_conf(struct dasd_device *device) } /* + * Build CP for Perform Subsystem Function - SSC. + */ +struct dasd_ccw_req * +dasd_eckd_build_psf_ssc(struct dasd_device *device) +{ + struct dasd_ccw_req *cqr; + struct dasd_psf_ssc_data *psf_ssc_data; + struct ccw1 *ccw; + + cqr = dasd_smalloc_request("ECKD", 1 /* PSF */ , + sizeof(struct dasd_psf_ssc_data), + device); + + if (IS_ERR(cqr)) { + DEV_MESSAGE(KERN_WARNING, device, "%s", + "Could not allocate PSF-SSC request"); + return cqr; + } + psf_ssc_data = (struct dasd_psf_ssc_data *)cqr->data; + psf_ssc_data->order = PSF_ORDER_SSC; + psf_ssc_data->suborder = 0x08; + + ccw = cqr->cpaddr; + ccw->cmd_code = DASD_ECKD_CCW_PSF; + ccw->cda = (__u32)(addr_t)psf_ssc_data; + ccw->count = 66; + + cqr->device = device; + cqr->expires = 10*HZ; + cqr->buildclk = get_clock(); + cqr->status = DASD_CQR_FILLED; + return cqr; +} + +/* + * Perform Subsystem Function. + * It is necessary to trigger CIO for channel revalidation since this + * call might change behaviour of DASD devices. + */ +static int +dasd_eckd_psf_ssc(struct dasd_device *device) +{ + struct dasd_ccw_req *cqr; + int rc; + + cqr = dasd_eckd_build_psf_ssc(device); + if (IS_ERR(cqr)) + return PTR_ERR(cqr); + + rc = dasd_sleep_on(cqr); + if (!rc) + /* trigger CIO to reprobe devices */ + css_schedule_reprobe(); + dasd_sfree_request(cqr, cqr->device); + return rc; +} + +/* + * Valide storage server of current device. + */ +static int +dasd_eckd_validate_server(struct dasd_device *device) +{ + int rc; + + /* Currently PAV is the only reason to 'validate' server on LPAR */ + if (dasd_nopav || MACHINE_IS_VM) + return 0; + + rc = dasd_eckd_psf_ssc(device); + if (rc) + /* may be requested feature is not available on server, + * therefore just report error and go ahead */ + DEV_MESSAGE(KERN_INFO, device, + "Perform Subsystem Function returned rc=%d", rc); + /* RE-Read Configuration Data */ + return dasd_eckd_read_conf(device); +} + +/* * Check device characteristics. * If the device is accessible using ECKD discipline, the device is enabled. */ @@ -554,7 +639,7 @@ dasd_eckd_check_characteristics(struct dasd_device *device) private = (struct dasd_eckd_private *) device->private; if (private == NULL) { - private = kmalloc(sizeof(struct dasd_eckd_private), + private = kzalloc(sizeof(struct dasd_eckd_private), GFP_KERNEL | GFP_DMA); if (private == NULL) { DEV_MESSAGE(KERN_WARNING, device, "%s", @@ -562,7 +647,6 @@ dasd_eckd_check_characteristics(struct dasd_device *device) "data"); return -ENOMEM; } - memset(private, 0, sizeof(struct dasd_eckd_private)); device->private = (void *) private; } /* Invalidate status of initial analysis. */ @@ -571,16 +655,29 @@ dasd_eckd_check_characteristics(struct dasd_device *device) private->attrib.operation = DASD_NORMAL_CACHE; private->attrib.nr_cyl = 0; + /* Read Configuration Data */ + rc = dasd_eckd_read_conf(device); + if (rc) + return rc; + + /* Generate device unique id and register in devmap */ + rc = dasd_eckd_generate_uid(device, &uid); + if (rc) + return rc; + rc = dasd_set_uid(device->cdev, &uid); + if (rc == 1) /* new server found */ + rc = dasd_eckd_validate_server(device); + if (rc) + return rc; + /* Read Device Characteristics */ rdc_data = (void *) &(private->rdc_data); memset(rdc_data, 0, sizeof(rdc_data)); rc = read_dev_chars(device->cdev, &rdc_data, 64); - if (rc) { + if (rc) DEV_MESSAGE(KERN_WARNING, device, - "Read device characteristics returned error %d", - rc); - return rc; - } + "Read device characteristics returned " + "rc=%d", rc); DEV_MESSAGE(KERN_INFO, device, "%04X/%02X(CU:%04X/%02X) Cyl:%d Head:%d Sec:%d", @@ -591,19 +688,6 @@ dasd_eckd_check_characteristics(struct dasd_device *device) private->rdc_data.no_cyl, private->rdc_data.trk_per_cyl, private->rdc_data.sec_per_trk); - - /* Read Configuration Data */ - rc = dasd_eckd_read_conf (device); - if (rc) - return rc; - - /* Generate device unique id and register in devmap */ - rc = dasd_eckd_generate_uid(device, &uid); - if (rc) - return rc; - - rc = dasd_set_uid(device->cdev, &uid); - return rc; } @@ -773,7 +857,7 @@ dasd_eckd_end_analysis(struct dasd_device *device) ((private->rdc_data.no_cyl * private->rdc_data.trk_per_cyl * blk_per_trk * (device->bp_block >> 9)) >> 1), - ((blk_per_trk * device->bp_block) >> 10), + ((blk_per_trk * device->bp_block) >> 10), private->uses_cdl ? "compatible disk layout" : "linux disk layout"); @@ -970,7 +1054,7 @@ dasd_eckd_format_device(struct dasd_device * device, if (i < 3) { ect->kl = 4; ect->dl = sizes_trk0[i] - 4; - } + } } if ((fdata->intensity & 0x08) && fdata->start_unit == 1) { @@ -1270,7 +1354,7 @@ dasd_eckd_fill_info(struct dasd_device * device, /* * Release device ioctl. - * Buils a channel programm to releases a prior reserved + * Buils a channel programm to releases a prior reserved * (see dasd_eckd_reserve) device. */ static int @@ -1310,8 +1394,8 @@ dasd_eckd_release(struct dasd_device *device) /* * Reserve device ioctl. * Options are set to 'synchronous wait for interrupt' and - * 'timeout the request'. This leads to a terminate IO if - * the interrupt is outstanding for a certain time. + * 'timeout the request'. This leads to a terminate IO if + * the interrupt is outstanding for a certain time. */ static int dasd_eckd_reserve(struct dasd_device *device) @@ -1349,7 +1433,7 @@ dasd_eckd_reserve(struct dasd_device *device) /* * Steal lock ioctl - unconditional reserve device. - * Buils a channel programm to break a device's reservation. + * Buils a channel programm to break a device's reservation. * (unconditional reserve) */ static int @@ -1522,6 +1606,40 @@ dasd_eckd_ioctl(struct dasd_device *device, unsigned int cmd, void __user *argp) } /* + * Dump the range of CCWs into 'page' buffer + * and return number of printed chars. + */ +static inline int +dasd_eckd_dump_ccw_range(struct ccw1 *from, struct ccw1 *to, char *page) +{ + int len, count; + char *datap; + + len = 0; + while (from <= to) { + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " CCW %p: %08X %08X DAT:", + from, ((int *) from)[0], ((int *) from)[1]); + + /* get pointer to data (consider IDALs) */ + if (from->flags & CCW_FLAG_IDA) + datap = (char *) *((addr_t *) (addr_t) from->cda); + else + datap = (char *) ((addr_t) from->cda); + + /* dump data (max 32 bytes) */ + for (count = 0; count < from->count && count < 32; count++) { + if (count % 8 == 0) len += sprintf(page + len, " "); + if (count % 4 == 0) len += sprintf(page + len, " "); + len += sprintf(page + len, "%02x", datap[count]); + } + len += sprintf(page + len, "\n"); + from++; + } + return len; +} + +/* * Print sense data and related channel program. * Parts are printed because printk buffer is only 1024 bytes. */ @@ -1530,8 +1648,8 @@ dasd_eckd_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, struct irb *irb) { char *page; - struct ccw1 *act, *end, *last; - int len, sl, sct, count; + struct ccw1 *first, *last, *fail, *from, *to; + int len, sl, sct; page = (char *) get_zeroed_page(GFP_ATOMIC); if (page == NULL) { @@ -1539,7 +1657,8 @@ dasd_eckd_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, "No memory to dump sense data"); return; } - len = sprintf(page, KERN_ERR PRINTK_HEADER + /* dump the sense data */ + len = sprintf(page, KERN_ERR PRINTK_HEADER " I/O status report for device %s:\n", device->cdev->dev.bus_id); len += sprintf(page + len, KERN_ERR PRINTK_HEADER @@ -1564,87 +1683,55 @@ dasd_eckd_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, if (irb->ecw[27] & DASD_SENSE_BIT_0) { /* 24 Byte Sense Data */ - len += sprintf(page + len, KERN_ERR PRINTK_HEADER - " 24 Byte: %x MSG %x, " - "%s MSGb to SYSOP\n", - irb->ecw[7] >> 4, irb->ecw[7] & 0x0f, - irb->ecw[1] & 0x10 ? "" : "no"); + sprintf(page + len, KERN_ERR PRINTK_HEADER + " 24 Byte: %x MSG %x, " + "%s MSGb to SYSOP\n", + irb->ecw[7] >> 4, irb->ecw[7] & 0x0f, + irb->ecw[1] & 0x10 ? "" : "no"); } else { /* 32 Byte Sense Data */ - len += sprintf(page + len, KERN_ERR PRINTK_HEADER - " 32 Byte: Format: %x " - "Exception class %x\n", - irb->ecw[6] & 0x0f, irb->ecw[22] >> 4); + sprintf(page + len, KERN_ERR PRINTK_HEADER + " 32 Byte: Format: %x " + "Exception class %x\n", + irb->ecw[6] & 0x0f, irb->ecw[22] >> 4); } } else { - len += sprintf(page + len, KERN_ERR PRINTK_HEADER - " SORRY - NO VALID SENSE AVAILABLE\n"); + sprintf(page + len, KERN_ERR PRINTK_HEADER + " SORRY - NO VALID SENSE AVAILABLE\n"); } - MESSAGE_LOG(KERN_ERR, "%s", - page + sizeof(KERN_ERR PRINTK_HEADER)); - - /* dump the Channel Program */ - /* print first CCWs (maximum 8) */ - act = req->cpaddr; - for (last = act; last->flags & (CCW_FLAG_CC | CCW_FLAG_DC); last++); - end = min(act + 8, last); - len = sprintf(page, KERN_ERR PRINTK_HEADER + printk("%s", page); + + /* dump the Channel Program (max 140 Bytes per line) */ + /* Count CCW and print first CCWs (maximum 1024 % 140 = 7) */ + first = req->cpaddr; + for (last = first; last->flags & (CCW_FLAG_CC | CCW_FLAG_DC); last++); + to = min(first + 6, last); + len = sprintf(page, KERN_ERR PRINTK_HEADER " Related CP in req: %p\n", req); - while (act <= end) { - len += sprintf(page + len, KERN_ERR PRINTK_HEADER - " CCW %p: %08X %08X DAT:", - act, ((int *) act)[0], ((int *) act)[1]); - for (count = 0; count < 32 && count < act->count; - count += sizeof(int)) - len += sprintf(page + len, " %08X", - ((int *) (addr_t) act->cda) - [(count>>2)]); - len += sprintf(page + len, "\n"); - act++; - } - MESSAGE_LOG(KERN_ERR, "%s", - page + sizeof(KERN_ERR PRINTK_HEADER)); + dasd_eckd_dump_ccw_range(first, to, page + len); + printk("%s", page); - /* print failing CCW area */ + /* print failing CCW area (maximum 4) */ + /* scsw->cda is either valid or zero */ len = 0; - if (act < ((struct ccw1 *)(addr_t) irb->scsw.cpa) - 2) { - act = ((struct ccw1 *)(addr_t) irb->scsw.cpa) - 2; - len += sprintf(page + len, KERN_ERR PRINTK_HEADER "......\n"); - } - end = min((struct ccw1 *)(addr_t) irb->scsw.cpa + 2, last); - while (act <= end) { - len += sprintf(page + len, KERN_ERR PRINTK_HEADER - " CCW %p: %08X %08X DAT:", - act, ((int *) act)[0], ((int *) act)[1]); - for (count = 0; count < 32 && count < act->count; - count += sizeof(int)) - len += sprintf(page + len, " %08X", - ((int *) (addr_t) act->cda) - [(count>>2)]); - len += sprintf(page + len, "\n"); - act++; + from = ++to; + fail = (struct ccw1 *)(addr_t) irb->scsw.cpa; /* failing CCW */ + if (from < fail - 2) { + from = fail - 2; /* there is a gap - print header */ + len += sprintf(page, KERN_ERR PRINTK_HEADER "......\n"); } + to = min(fail + 1, last); + len += dasd_eckd_dump_ccw_range(from, to, page + len); - /* print last CCWs */ - if (act < last - 2) { - act = last - 2; + /* print last CCWs (maximum 2) */ + from = max(from, ++to); + if (from < last - 1) { + from = last - 1; /* there is a gap - print header */ len += sprintf(page + len, KERN_ERR PRINTK_HEADER "......\n"); } - while (act <= last) { - len += sprintf(page + len, KERN_ERR PRINTK_HEADER - " CCW %p: %08X %08X DAT:", - act, ((int *) act)[0], ((int *) act)[1]); - for (count = 0; count < 32 && count < act->count; - count += sizeof(int)) - len += sprintf(page + len, " %08X", - ((int *) (addr_t) act->cda) - [(count>>2)]); - len += sprintf(page + len, "\n"); - act++; - } + len += dasd_eckd_dump_ccw_range(from, last, page + len); if (len > 0) - MESSAGE_LOG(KERN_ERR, "%s", - page + sizeof(KERN_ERR PRINTK_HEADER)); + printk("%s", page); free_page((unsigned long) page); } @@ -1685,14 +1772,8 @@ static struct dasd_discipline dasd_eckd_discipline = { static int __init dasd_eckd_init(void) { - int ret; - ASCEBC(dasd_eckd_discipline.ebcname, 4); - - ret = ccw_driver_register(&dasd_eckd_driver); - if (!ret) - dasd_generic_auto_online(&dasd_eckd_driver); - return ret; + return ccw_driver_register(&dasd_eckd_driver); } static void __exit @@ -1703,22 +1784,3 @@ dasd_eckd_cleanup(void) module_init(dasd_eckd_init); module_exit(dasd_eckd_cleanup); - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-indent-level: 4 - * c-brace-imaginary-offset: 0 - * c-brace-offset: -4 - * c-argdecl-indent: 4 - * c-label-offset: -4 - * c-continued-statement-offset: 4 - * c-continued-brace-offset: 0 - * indent-tabs-mode: 1 - * tab-width: 8 - * End: - */ diff --git a/drivers/s390/block/dasd_eckd.h b/drivers/s390/block/dasd_eckd.h index d5734e976e1..712ff165013 100644 --- a/drivers/s390/block/dasd_eckd.h +++ b/drivers/s390/block/dasd_eckd.h @@ -1,7 +1,7 @@ -/* +/* * File...........: linux/drivers/s390/block/dasd_eckd.h * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> - * Horst Hummel <Horst.Hummel@de.ibm.com> + * Horst Hummel <Horst.Hummel@de.ibm.com> * Bugreports.to..: <Linux390@de.ibm.com> * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 * @@ -41,9 +41,10 @@ #define DASD_ECKD_CCW_RESERVE 0xB4 /* - *Perform Subsystem Function / Sub-Orders + * Perform Subsystem Function / Sub-Orders */ -#define PSF_ORDER_PRSSD 0x18 +#define PSF_ORDER_PRSSD 0x18 +#define PSF_ORDER_SSC 0x1D /***************************************************************************** * SECTION: Type Definitions @@ -155,7 +156,7 @@ struct dasd_eckd_characteristics { unsigned char reserved2:4; unsigned char reserved3:8; unsigned char defect_wr:1; - unsigned char XRC_supported:1; + unsigned char XRC_supported:1; unsigned char reserved4:1; unsigned char striping:1; unsigned char reserved5:4; @@ -343,7 +344,7 @@ struct dasd_eckd_path { }; /* - * Perform Subsystem Function - Prepare for Read Subsystem Data + * Perform Subsystem Function - Prepare for Read Subsystem Data */ struct dasd_psf_prssd_data { unsigned char order; @@ -353,4 +354,15 @@ struct dasd_psf_prssd_data { unsigned char varies[9]; } __attribute__ ((packed)); +/* + * Perform Subsystem Function - Set Subsystem Characteristics + */ +struct dasd_psf_ssc_data { + unsigned char order; + unsigned char flags; + unsigned char cu_type[4]; + unsigned char suborder; + unsigned char reserved[59]; +} __attribute__((packed)); + #endif /* DASD_ECKD_H */ diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c index 2d8af709947..da65f1b032f 100644 --- a/drivers/s390/block/dasd_eer.c +++ b/drivers/s390/block/dasd_eer.c @@ -276,7 +276,7 @@ struct dasd_eer_header { __u64 tv_sec; __u64 tv_usec; char busid[DASD_EER_BUSID_SIZE]; -}; +} __attribute__ ((packed)); /* * The following function can be used for those triggers that have @@ -521,6 +521,8 @@ static int dasd_eer_open(struct inode *inp, struct file *filp) unsigned long flags; eerb = kzalloc(sizeof(struct eerbuffer), GFP_KERNEL); + if (!eerb) + return -ENOMEM; eerb->buffer_page_count = eer_pages; if (eerb->buffer_page_count < 1 || eerb->buffer_page_count > INT_MAX / PAGE_SIZE) { diff --git a/drivers/s390/block/dasd_erp.c b/drivers/s390/block/dasd_erp.c index b842377cb0c..58a65097922 100644 --- a/drivers/s390/block/dasd_erp.c +++ b/drivers/s390/block/dasd_erp.c @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/ctype.h> #include <linux/init.h> @@ -90,7 +89,7 @@ dasd_default_erp_action(struct dasd_ccw_req * cqr) /* just retry - there is nothing to save ... I got no sense data.... */ if (cqr->retries > 0) { - DEV_MESSAGE (KERN_DEBUG, device, + DEV_MESSAGE (KERN_DEBUG, device, "default ERP called (%i retries left)", cqr->retries); cqr->lpm = LPM_ANYPATH; @@ -155,7 +154,7 @@ dasd_default_erp_postaction(struct dasd_ccw_req * cqr) /* * Print the hex dump of the memory used by a request. This includes - * all error recovery ccws that have been chained in from of the + * all error recovery ccws that have been chained in from of the * real request. */ static inline void @@ -227,12 +226,12 @@ dasd_log_ccw(struct dasd_ccw_req * cqr, int caller, __u32 cpa) /* * Log bytes arround failed CCW but only if we did * not log the whole CP of the CCW is outside the - * logged CP. + * logged CP. */ if (cplength > 40 || ((addr_t) cpa < (addr_t) lcqr->cpaddr && (addr_t) cpa > (addr_t) (lcqr->cpaddr + cplength + 4))) { - + DEV_MESSAGE(KERN_ERR, device, "Failed CCW (%p) (area):", (void *) (long) cpa); diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index 91145698f8e..808434d3852 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c @@ -1,4 +1,4 @@ -/* +/* * File...........: linux/drivers/s390/block/dasd_fba.c * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> * Bugreports.to..: <Linux390@de.ibm.com> @@ -6,7 +6,6 @@ * */ -#include <linux/config.h> #include <linux/stddef.h> #include <linux/kernel.h> #include <asm/debug.h> @@ -56,19 +55,13 @@ static struct ccw_driver dasd_fba_driver; /* see below */ static int dasd_fba_probe(struct ccw_device *cdev) { - int ret; - - ret = dasd_generic_probe (cdev, &dasd_fba_discipline); - if (ret) - return ret; - ccw_device_set_options(cdev, CCWDEV_DO_PATHGROUP); - return 0; + return dasd_generic_probe(cdev, &dasd_fba_discipline); } static int dasd_fba_set_online(struct ccw_device *cdev) { - return dasd_generic_set_online (cdev, &dasd_fba_discipline); + return dasd_generic_set_online(cdev, &dasd_fba_discipline); } static struct ccw_driver dasd_fba_driver = { @@ -125,13 +118,13 @@ static int dasd_fba_check_characteristics(struct dasd_device *device) { struct dasd_fba_private *private; - struct ccw_device *cdev = device->cdev; + struct ccw_device *cdev = device->cdev; void *rdc_data; int rc; private = (struct dasd_fba_private *) device->private; if (private == NULL) { - private = kmalloc(sizeof(struct dasd_fba_private), GFP_KERNEL); + private = kzalloc(sizeof(struct dasd_fba_private), GFP_KERNEL); if (private == NULL) { DEV_MESSAGE(KERN_WARNING, device, "%s", "memory allocation failed for private " @@ -204,7 +197,7 @@ dasd_fba_examine_error(struct dasd_ccw_req * cqr, struct irb * irb) if (irb->scsw.cstat == 0x00 && irb->scsw.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END)) return dasd_era_none; - + cdev = device->cdev; switch (cdev->id.dev_type) { case 0x3370: @@ -539,7 +532,7 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, * 8192 bytes (=2 pages). For 64 bit one dasd_mchunkt_t structure has * 24 bytes, the struct dasd_ccw_req has 136 bytes and each block can use * up to 16 bytes (8 for the ccw and 8 for the idal pointer). In - * addition we have one define extent ccw + 16 bytes of data and a + * addition we have one define extent ccw + 16 bytes of data and a * locate record ccw for each block (stupid devices!) + 16 bytes of data. * That makes: * (8192 - 24 - 136 - 8 - 16) / 40 = 200.2 blocks at maximum. @@ -569,16 +562,8 @@ static struct dasd_discipline dasd_fba_discipline = { static int __init dasd_fba_init(void) { - int ret; - ASCEBC(dasd_fba_discipline.ebcname, 4); - - ret = ccw_driver_register(&dasd_fba_driver); - if (ret) - return ret; - - dasd_generic_auto_online(&dasd_fba_driver); - return 0; + return ccw_driver_register(&dasd_fba_driver); } static void __exit @@ -589,22 +574,3 @@ dasd_fba_cleanup(void) module_init(dasd_fba_init); module_exit(dasd_fba_cleanup); - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-indent-level: 4 - * c-brace-imaginary-offset: 0 - * c-brace-offset: -4 - * c-argdecl-indent: 4 - * c-label-offset: -4 - * c-continued-statement-offset: 4 - * c-continued-brace-offset: 0 - * indent-tabs-mode: 1 - * tab-width: 8 - * End: - */ diff --git a/drivers/s390/block/dasd_fba.h b/drivers/s390/block/dasd_fba.h index da1fa91fc01..14c910baa5f 100644 --- a/drivers/s390/block/dasd_fba.h +++ b/drivers/s390/block/dasd_fba.h @@ -1,4 +1,4 @@ -/* +/* * File...........: linux/drivers/s390/block/dasd_fba.h * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> * Bugreports.to..: <Linux390@de.ibm.com> diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c index fce2835e7d1..12c7d296eaa 100644 --- a/drivers/s390/block/dasd_genhd.c +++ b/drivers/s390/block/dasd_genhd.c @@ -11,7 +11,6 @@ * */ -#include <linux/config.h> #include <linux/interrupt.h> #include <linux/fs.h> #include <linux/blkpg.h> @@ -68,8 +67,6 @@ dasd_gendisk_alloc(struct dasd_device *device) } len += sprintf(gdp->disk_name + len, "%c", 'a'+(device->devindex%26)); - sprintf(gdp->devfs_name, "dasd/%s", device->cdev->dev.bus_id); - if (device->features & DASD_FEATURE_READONLY) set_disk_ro(gdp, 1); gdp->private_data = device; diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index d4b13e300a7..3ccf06d28ba 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h @@ -1,7 +1,7 @@ -/* +/* * File...........: linux/drivers/s390/block/dasd_int.h * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> - * Horst Hummel <Horst.Hummel@de.ibm.com> + * Horst Hummel <Horst.Hummel@de.ibm.com> * Martin Schwidefsky <schwidefsky@de.ibm.com> * Bugreports.to..: <Linux390@de.ibm.com> * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 @@ -54,7 +54,6 @@ #include <linux/module.h> #include <linux/wait.h> #include <linux/blkdev.h> -#include <linux/devfs_fs_kernel.h> #include <linux/genhd.h> #include <linux/hdreg.h> #include <linux/interrupt.h> @@ -186,7 +185,7 @@ struct dasd_ccw_req { void *callback_data; }; -/* +/* * dasd_ccw_req -> status can be: */ #define DASD_CQR_FILLED 0x00 /* request is ready to be processed */ @@ -248,7 +247,7 @@ struct dasd_discipline { /* * Error recovery functions. examine_error() returns a value that * indicates what to do for an error condition. If examine_error() - * returns 'dasd_era_recover' erp_action() is called to create a + * returns 'dasd_era_recover' erp_action() is called to create a * special error recovery ccw. erp_postaction() is called after * an error recovery ccw has finished its execution. dump_sense * is called for every error condition to print the sense data @@ -302,11 +301,11 @@ struct dasd_device { spinlock_t request_queue_lock; struct block_device *bdev; unsigned int devindex; - unsigned long blocks; /* size of volume in blocks */ - unsigned int bp_block; /* bytes per block */ - unsigned int s2b_shift; /* log2 (bp_block/512) */ - unsigned long flags; /* per device flags */ - unsigned short features; /* copy of devmap-features (read-only!) */ + unsigned long blocks; /* size of volume in blocks */ + unsigned int bp_block; /* bytes per block */ + unsigned int s2b_shift; /* log2 (bp_block/512) */ + unsigned long flags; /* per device flags */ + unsigned short features; /* copy of devmap-features (read-only!) */ /* extended error reporting stuff (eer) */ struct dasd_ccw_req *eer_cqr; @@ -513,12 +512,12 @@ void dasd_generic_remove (struct ccw_device *cdev); int dasd_generic_set_online(struct ccw_device *, struct dasd_discipline *); int dasd_generic_set_offline (struct ccw_device *cdev); int dasd_generic_notify(struct ccw_device *, int); -void dasd_generic_auto_online (struct ccw_driver *); /* externals in dasd_devmap.c */ extern int dasd_max_devindex; extern int dasd_probeonly; extern int dasd_autodetect; +extern int dasd_nopav; int dasd_devmap_init(void); void dasd_devmap_exit(void); @@ -606,22 +605,3 @@ static inline int dasd_eer_enabled(struct dasd_device *device) #endif /* __KERNEL__ */ #endif /* DASD_H */ - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-indent-level: 4 - * c-brace-imaginary-offset: 0 - * c-brace-offset: -4 - * c-argdecl-indent: 4 - * c-label-offset: -4 - * c-continued-statement-offset: 4 - * c-continued-brace-offset: 0 - * indent-tabs-mode: 1 - * tab-width: 8 - * End: - */ diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index b8c80d28df4..e97f5316ad2 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c @@ -9,7 +9,6 @@ * * i/o controls for the dasd driver. */ -#include <linux/config.h> #include <linux/interrupt.h> #include <linux/major.h> #include <linux/fs.h> @@ -90,10 +89,10 @@ static int dasd_ioctl_quiesce(struct dasd_device *device) { unsigned long flags; - + if (!capable (CAP_SYS_ADMIN)) return -EACCES; - + DEV_MESSAGE (KERN_DEBUG, device, "%s", "Quiesce IO on device"); spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); @@ -110,13 +109,13 @@ static int dasd_ioctl_resume(struct dasd_device *device) { unsigned long flags; - - if (!capable (CAP_SYS_ADMIN)) + + if (!capable (CAP_SYS_ADMIN)) return -EACCES; DEV_MESSAGE (KERN_DEBUG, device, "%s", "resume IO on device"); - + spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); device->stopped &= ~DASD_STOPPED_QUIESCE; spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); @@ -287,7 +286,7 @@ dasd_ioctl_information(struct dasd_device *device, dasd_info->open_count = atomic_read(&device->open_count); if (!device->bdev) dasd_info->open_count++; - + /* * check if device is really formatted * LDL / CDL was returned by 'fill_info' diff --git a/drivers/s390/block/dasd_proc.c b/drivers/s390/block/dasd_proc.c index ad23aede356..bfa010f6dab 100644 --- a/drivers/s390/block/dasd_proc.c +++ b/drivers/s390/block/dasd_proc.c @@ -11,7 +11,6 @@ * */ -#include <linux/config.h> #include <linux/ctype.h> #include <linux/seq_file.h> #include <linux/vmalloc.h> diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c index 54ecd548c31..4c1e56b9b98 100644 --- a/drivers/s390/block/xpram.c +++ b/drivers/s390/block/xpram.c @@ -36,7 +36,6 @@ #include <linux/hdreg.h> /* HDIO_GETGEO */ #include <linux/sysdev.h> #include <linux/bio.h> -#include <linux/devfs_fs_kernel.h> #include <asm/uaccess.h> #define XPRAM_NAME "xpram" @@ -439,8 +438,6 @@ static int __init xpram_setup_blkdev(void) if (rc < 0) goto out; - devfs_mk_dir("slram"); - /* * Assign the other needed values: make request function, sizes and * hardsect size. All the minor devices feature the same value. @@ -469,14 +466,12 @@ static int __init xpram_setup_blkdev(void) disk->private_data = &xpram_devices[i]; disk->queue = xpram_queue; sprintf(disk->disk_name, "slram%d", i); - sprintf(disk->devfs_name, "slram/%d", i); set_capacity(disk, xpram_sizes[i] << 1); add_disk(disk); } return 0; out_unreg: - devfs_remove("slram"); unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME); out: while (i--) @@ -495,7 +490,6 @@ static void __exit xpram_exit(void) put_disk(xpram_disks[i]); } unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME); - devfs_remove("slram"); blk_cleanup_queue(xpram_queue); sysdev_unregister(&xpram_sys_device); sysdev_class_unregister(&xpram_sysclass); diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index 606f6ad285a..f25c6d116f6 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c @@ -11,7 +11,6 @@ * Dan Morrison, IBM Corporation (dmorriso@cse.buffalo.edu) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kdev_t.h> diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c index ef607a1de55..7566be89068 100644 --- a/drivers/s390/char/con3270.c +++ b/drivers/s390/char/con3270.c @@ -8,7 +8,6 @@ * -- Copyright (C) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation */ -#include <linux/config.h> #include <linux/bootmem.h> #include <linux/console.h> #include <linux/init.h> diff --git a/drivers/s390/char/ctrlchar.c b/drivers/s390/char/ctrlchar.c index be463242cf0..0ea6f36a252 100644 --- a/drivers/s390/char/ctrlchar.c +++ b/drivers/s390/char/ctrlchar.c @@ -7,7 +7,6 @@ * */ -#include <linux/config.h> #include <linux/stddef.h> #include <asm/errno.h> #include <linux/sysrq.h> diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index a6415377bc7..6099c14de42 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c @@ -8,7 +8,6 @@ * -- Copyright (C) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation */ -#include <linux/config.h> #include <linux/bootmem.h> #include <linux/console.h> #include <linux/init.h> diff --git a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c index d4d2ff0a9da..547ef906ae2 100644 --- a/drivers/s390/char/keyboard.c +++ b/drivers/s390/char/keyboard.c @@ -7,7 +7,6 @@ * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), */ -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/sysrq.h> diff --git a/drivers/s390/char/monreader.c b/drivers/s390/char/monreader.c index fb7bc9e5eeb..a138b151009 100644 --- a/drivers/s390/char/monreader.c +++ b/drivers/s390/char/monreader.c @@ -586,7 +586,6 @@ static struct file_operations mon_fops = { static struct miscdevice mon_dev = { .name = "monreader", - .devfs_name = "monreader", .fops = &mon_fops, .minor = MISC_DYNAMIC_MINOR, }; diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index eecb2afad5c..e95b56f810d 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c @@ -8,7 +8,6 @@ * -- Copyright (C) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation */ -#include <linux/config.h> #include <linux/bootmem.h> #include <linux/module.h> #include <linux/err.h> @@ -50,6 +49,9 @@ struct raw3270 { unsigned char *ascebc; /* ascii -> ebcdic table */ struct class_device *clttydev; /* 3270-class tty device ptr */ struct class_device *cltubdev; /* 3270-class tub device ptr */ + + struct raw3270_request init_request; + unsigned char init_data[256]; }; /* raw3270->flags */ @@ -484,8 +486,6 @@ struct raw3270_ua { /* Query Reply structure for Usable Area */ } __attribute__ ((packed)) aua; } __attribute__ ((packed)); -static unsigned char raw3270_init_data[256]; -static struct raw3270_request raw3270_init_request; static struct diag210 raw3270_init_diag210; static DECLARE_MUTEX(raw3270_init_sem); @@ -644,17 +644,17 @@ __raw3270_size_device(struct raw3270 *rp) * required (3270 device switched to 'stand-by') and command * rejects (old devices that can't do 'read partition'). */ - memset(&raw3270_init_request, 0, sizeof(raw3270_init_request)); - memset(raw3270_init_data, 0, sizeof(raw3270_init_data)); - /* Store 'read partition' data stream to raw3270_init_data */ - memcpy(raw3270_init_data, wbuf, sizeof(wbuf)); - INIT_LIST_HEAD(&raw3270_init_request.list); - raw3270_init_request.ccw.cmd_code = TC_WRITESF; - raw3270_init_request.ccw.flags = CCW_FLAG_SLI; - raw3270_init_request.ccw.count = sizeof(wbuf); - raw3270_init_request.ccw.cda = (__u32) __pa(raw3270_init_data); - - rc = raw3270_start_init(rp, &raw3270_init_view, &raw3270_init_request); + memset(&rp->init_request, 0, sizeof(rp->init_request)); + memset(&rp->init_data, 0, 256); + /* Store 'read partition' data stream to init_data */ + memcpy(&rp->init_data, wbuf, sizeof(wbuf)); + INIT_LIST_HEAD(&rp->init_request.list); + rp->init_request.ccw.cmd_code = TC_WRITESF; + rp->init_request.ccw.flags = CCW_FLAG_SLI; + rp->init_request.ccw.count = sizeof(wbuf); + rp->init_request.ccw.cda = (__u32) __pa(&rp->init_data); + + rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request); if (rc) /* Check error cases: -ERESTARTSYS, -EIO and -EOPNOTSUPP */ return rc; @@ -679,18 +679,18 @@ __raw3270_size_device(struct raw3270 *rp) * The device accepted the 'read partition' command. Now * set up a read ccw and issue it. */ - raw3270_init_request.ccw.cmd_code = TC_READMOD; - raw3270_init_request.ccw.flags = CCW_FLAG_SLI; - raw3270_init_request.ccw.count = sizeof(raw3270_init_data); - raw3270_init_request.ccw.cda = (__u32) __pa(raw3270_init_data); - rc = raw3270_start_init(rp, &raw3270_init_view, &raw3270_init_request); + rp->init_request.ccw.cmd_code = TC_READMOD; + rp->init_request.ccw.flags = CCW_FLAG_SLI; + rp->init_request.ccw.count = sizeof(rp->init_data); + rp->init_request.ccw.cda = (__u32) __pa(rp->init_data); + rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request); if (rc) return rc; /* Got a Query Reply */ - count = sizeof(raw3270_init_data) - raw3270_init_request.rescnt; - uap = (struct raw3270_ua *) (raw3270_init_data + 1); + count = sizeof(rp->init_data) - rp->init_request.rescnt; + uap = (struct raw3270_ua *) (rp->init_data + 1); /* Paranoia check. */ - if (raw3270_init_data[0] != 0x88 || uap->uab.qcode != 0x81) + if (rp->init_data[0] != 0x88 || uap->uab.qcode != 0x81) return -EOPNOTSUPP; /* Copy rows/columns of default Usable Area */ rp->rows = uap->uab.h; @@ -749,18 +749,18 @@ raw3270_reset_device(struct raw3270 *rp) int rc; down(&raw3270_init_sem); - memset(&raw3270_init_request, 0, sizeof(raw3270_init_request)); - memset(raw3270_init_data, 0, sizeof(raw3270_init_data)); - /* Store reset data stream to raw3270_init_data/raw3270_init_request */ - raw3270_init_data[0] = TW_KR; - INIT_LIST_HEAD(&raw3270_init_request.list); - raw3270_init_request.ccw.cmd_code = TC_EWRITEA; - raw3270_init_request.ccw.flags = CCW_FLAG_SLI; - raw3270_init_request.ccw.count = 1; - raw3270_init_request.ccw.cda = (__u32) __pa(raw3270_init_data); + memset(&rp->init_request, 0, sizeof(rp->init_request)); + memset(&rp->init_data, 0, sizeof(rp->init_data)); + /* Store reset data stream to init_data/init_request */ + rp->init_data[0] = TW_KR; + INIT_LIST_HEAD(&rp->init_request.list); + rp->init_request.ccw.cmd_code = TC_EWRITEA; + rp->init_request.ccw.flags = CCW_FLAG_SLI; + rp->init_request.ccw.count = 1; + rp->init_request.ccw.cda = (__u32) __pa(rp->init_data); rp->view = &raw3270_init_view; raw3270_init_view.dev = rp; - rc = raw3270_start_init(rp, &raw3270_init_view, &raw3270_init_request); + rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request); raw3270_init_view.dev = 0; rp->view = 0; up(&raw3270_init_sem); @@ -854,7 +854,7 @@ raw3270_setup_console(struct ccw_device *cdev) char *ascebc; int rc; - rp = (struct raw3270 *) alloc_bootmem(sizeof(struct raw3270)); + rp = (struct raw3270 *) alloc_bootmem_low(sizeof(struct raw3270)); ascebc = (char *) alloc_bootmem(256); rc = raw3270_setup_device(cdev, rp, ascebc); if (rc) @@ -895,7 +895,7 @@ raw3270_create_device(struct ccw_device *cdev) char *ascebc; int rc; - rp = kmalloc(sizeof(struct raw3270), GFP_KERNEL); + rp = kmalloc(sizeof(struct raw3270), GFP_KERNEL | GFP_DMA); if (!rp) return ERR_PTR(-ENOMEM); ascebc = kmalloc(256, GFP_KERNEL); diff --git a/drivers/s390/char/sclp_con.c b/drivers/s390/char/sclp_con.c index 10ef22f1354..86864f64171 100644 --- a/drivers/s390/char/sclp_con.c +++ b/drivers/s390/char/sclp_con.c @@ -8,7 +8,6 @@ * Martin Schwidefsky <schwidefsky@de.ibm.com> */ -#include <linux/config.h> #include <linux/kmod.h> #include <linux/console.h> #include <linux/init.h> diff --git a/drivers/s390/char/sclp_cpi.c b/drivers/s390/char/sclp_cpi.c index 80f7f31310e..732dfbdb85c 100644 --- a/drivers/s390/char/sclp_cpi.c +++ b/drivers/s390/char/sclp_cpi.c @@ -5,7 +5,6 @@ * SCLP Control-Program Identification. */ -#include <linux/config.h> #include <linux/version.h> #include <linux/kmod.h> #include <linux/module.h> diff --git a/drivers/s390/char/sclp_quiesce.c b/drivers/s390/char/sclp_quiesce.c index a4c53c172db..32004aae95c 100644 --- a/drivers/s390/char/sclp_quiesce.c +++ b/drivers/s390/char/sclp_quiesce.c @@ -7,7 +7,6 @@ * Peter Oberparleiter <peter.oberparleiter@de.ibm.com> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/cpumask.h> diff --git a/drivers/s390/char/sclp_rw.c b/drivers/s390/char/sclp_rw.c index 91e93c78f57..0c92d3909cc 100644 --- a/drivers/s390/char/sclp_rw.c +++ b/drivers/s390/char/sclp_rw.c @@ -8,7 +8,6 @@ * Martin Schwidefsky <schwidefsky@de.ibm.com> */ -#include <linux/config.h> #include <linux/kmod.h> #include <linux/types.h> #include <linux/err.h> diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c index 6cbf067f1a8..f6cf9023039 100644 --- a/drivers/s390/char/sclp_tty.c +++ b/drivers/s390/char/sclp_tty.c @@ -8,7 +8,6 @@ * Martin Schwidefsky <schwidefsky@de.ibm.com> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kmod.h> #include <linux/tty.h> diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index 9e02625c82c..54fba6f1718 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c @@ -7,7 +7,6 @@ * Author(s): Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/spinlock.h> #include <linux/list.h> diff --git a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h index cd51ace8b61..1f4c89967be 100644 --- a/drivers/s390/char/tape.h +++ b/drivers/s390/char/tape.h @@ -16,7 +16,6 @@ #include <asm/ccwdev.h> #include <asm/debug.h> #include <asm/idals.h> -#include <linux/config.h> #include <linux/blkdev.h> #include <linux/kernel.h> #include <linux/module.h> diff --git a/drivers/s390/char/tape_34xx.c b/drivers/s390/char/tape_34xx.c index d4f2da73807..48b4d30a725 100644 --- a/drivers/s390/char/tape_34xx.c +++ b/drivers/s390/char/tape_34xx.c @@ -8,7 +8,6 @@ * Martin Schwidefsky <schwidefsky@de.ibm.com> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/bio.h> diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c index d71ef1adea5..928cbefc49d 100644 --- a/drivers/s390/char/tape_3590.c +++ b/drivers/s390/char/tape_3590.c @@ -8,7 +8,6 @@ * Martin Schwidefsky <schwidefsky@de.ibm.com> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/bio.h> diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index b70d9269024..3225fcd1dcb 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c @@ -11,7 +11,6 @@ */ #include <linux/fs.h> -#include <linux/config.h> #include <linux/module.h> #include <linux/blkdev.h> #include <linux/interrupt.h> diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c index 5ce7ca38ace..97f75237bed 100644 --- a/drivers/s390/char/tape_char.c +++ b/drivers/s390/char/tape_char.c @@ -10,7 +10,6 @@ * Martin Schwidefsky <schwidefsky@de.ibm.com> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/proc_fs.h> diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c index e6e4086d322..122b4d8965c 100644 --- a/drivers/s390/char/tape_core.c +++ b/drivers/s390/char/tape_core.c @@ -11,7 +11,6 @@ * Stefan Bader <shbader@de.ibm.com> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> // for kernel parameters #include <linux/kmod.h> // for requesting modules diff --git a/drivers/s390/char/tape_proc.c b/drivers/s390/char/tape_proc.c index 5fec0a10cc3..655d375ab22 100644 --- a/drivers/s390/char/tape_proc.c +++ b/drivers/s390/char/tape_proc.c @@ -11,7 +11,6 @@ * PROCFS Functions */ -#include <linux/config.h> #include <linux/module.h> #include <linux/vmalloc.h> #include <linux/seq_file.h> diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c index 99cf881f41d..7a76ec413a3 100644 --- a/drivers/s390/char/tape_std.c +++ b/drivers/s390/char/tape_std.c @@ -11,7 +11,6 @@ * Stefan Bader <shbader@de.ibm.com> */ -#include <linux/config.h> #include <linux/stddef.h> #include <linux/kernel.h> #include <linux/bio.h> diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index 9a141776873..f496f236b9c 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c @@ -8,7 +8,6 @@ * -- Copyright (C) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kdev_t.h> @@ -1785,7 +1784,6 @@ tty3270_init(void) * proc_entry, set_termios, flush_buffer, set_ldisc, write_proc */ driver->owner = THIS_MODULE; - driver->devfs_name = "ttyTUB/"; driver->driver_name = "ttyTUB"; driver->name = "ttyTUB"; driver->major = IBM_TTY3270_MAJOR; @@ -1793,7 +1791,7 @@ tty3270_init(void) driver->type = TTY_DRIVER_TYPE_SYSTEM; driver->subtype = SYSTEM_TYPE_TTY; driver->init_termios = tty_std_termios; - driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_NO_DEVFS; + driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_DYNAMIC_DEV; tty_set_operations(driver, &tty3270_ops); ret = tty_register_driver(driver); if (ret) { diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c index 0960bef7b19..12c2d6b746e 100644 --- a/drivers/s390/cio/blacklist.c +++ b/drivers/s390/cio/blacklist.c @@ -9,7 +9,6 @@ * Arnd Bergmann (arndb@de.ibm.com) */ -#include <linux/config.h> #include <linux/init.h> #include <linux/vmalloc.h> #include <linux/slab.h> @@ -224,39 +223,6 @@ is_blacklisted (int ssid, int devno) } #ifdef CONFIG_PROC_FS -static int -__s390_redo_validation(struct subchannel_id schid, void *data) -{ - int ret; - struct subchannel *sch; - - sch = get_subchannel_by_schid(schid); - if (sch) { - /* Already known. */ - put_device(&sch->dev); - return 0; - } - ret = css_probe_device(schid); - if (ret == -ENXIO) - return ret; /* We're through. */ - if (ret == -ENOMEM) - /* Stop validation for now. Bad, but no need for a panic. */ - return ret; - return 0; -} - -/* - * Function: s390_redo_validation - * Look for no longer blacklisted devices - * FIXME: there must be a better way to do this */ -static inline void -s390_redo_validation (void) -{ - CIO_TRACE_EVENT (0, "redoval"); - - for_each_subchannel(__s390_redo_validation, NULL); -} - /* * Function: blacklist_parse_proc_parameters * parse the stuff which is piped to /proc/cio_ignore @@ -281,7 +247,7 @@ blacklist_parse_proc_parameters (char *buf) return; } - s390_redo_validation (); + css_schedule_reprobe(); } /* Iterator struct for all devices. */ diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index bdfee7fbaa2..c7319a07ba3 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c @@ -404,21 +404,24 @@ ccwgroup_driver_register (struct ccwgroup_driver *cdriver) } static int -__ccwgroup_driver_unregister_device(struct device *dev, void *data) +__ccwgroup_match_all(struct device *dev, void *data) { - __ccwgroup_remove_symlinks(to_ccwgroupdev(dev)); - device_unregister(dev); - put_device(dev); - return 0; + return 1; } void ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver) { + struct device *dev; + /* We don't want ccwgroup devices to live longer than their driver. */ get_driver(&cdriver->driver); - driver_for_each_device(&cdriver->driver, NULL, NULL, - __ccwgroup_driver_unregister_device); + while ((dev = driver_find_device(&cdriver->driver, NULL, NULL, + __ccwgroup_match_all))) { + __ccwgroup_remove_symlinks(to_ccwgroupdev(dev)); + device_unregister(dev); + put_device(dev); + } put_driver(&cdriver->driver); driver_unregister(&cdriver->driver); } diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index 72187e54dca..a01f3bba4a7 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c @@ -10,7 +10,6 @@ */ #include <linux/module.h> -#include <linux/config.h> #include <linux/slab.h> #include <linux/init.h> #include <linux/device.h> @@ -244,8 +243,7 @@ s390_subchannel_remove_chpid(struct device *dev, void *data) if ((sch->schib.scsw.actl & SCSW_ACTL_DEVACT) && (sch->schib.scsw.actl & SCSW_ACTL_SCHACT) && - (sch->schib.pmcw.lpum == mask) && - (sch->vpm == 0)) { + (sch->schib.pmcw.lpum == mask)) { int cc; cc = cio_clear(sch); @@ -918,12 +916,13 @@ chp_measurement_read(struct kobject *kobj, char *buf, loff_t off, size_t count) chp = to_channelpath(container_of(kobj, struct device, kobj)); css = to_css(chp->dev.parent); - size = sizeof(struct cmg_chars); + size = sizeof(struct cmg_entry); /* Only allow single reads. */ if (off || count < size) return 0; chp_measurement_copy_block((struct cmg_entry *)buf, css, chp->id); + count = size; return count; } diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index 5b20d8c9c02..a3423267467 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c @@ -11,7 +11,6 @@ */ #include <linux/module.h> -#include <linux/config.h> #include <linux/init.h> #include <linux/slab.h> #include <linux/device.h> diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c index 07ef3f640f4..1c3e8e9012b 100644 --- a/drivers/s390/cio/cmf.c +++ b/drivers/s390/cio/cmf.c @@ -3,9 +3,10 @@ * * Linux on zSeries Channel Measurement Facility support * - * Copyright 2000,2003 IBM Corporation + * Copyright 2000,2006 IBM Corporation * - * Author: Arnd Bergmann <arndb@de.ibm.com> + * Authors: Arnd Bergmann <arndb@de.ibm.com> + * Cornelia Huck <cornelia.huck@de.ibm.com> * * original idea from Natarajan Krishnaswami <nkrishna@us.ibm.com> * @@ -96,9 +97,9 @@ module_param(format, bool, 0444); /** * struct cmb_operations - functions to use depending on cmb_format * - * all these functions operate on a struct cmf_device. There is only - * one instance of struct cmb_operations because all cmf_device - * objects are guaranteed to be of the same type. + * Most of these functions operate on a struct ccw_device. There is only + * one instance of struct cmb_operations because the format of the measurement + * data is guaranteed to be the same for every ccw_device. * * @alloc: allocate memory for a channel measurement block, * either with the help of a special pool or with kmalloc @@ -107,6 +108,7 @@ module_param(format, bool, 0444); * @readall: read a measurement block in a common format * @reset: clear the data in the associated measurement block and * reset its time stamp + * @align: align an allocated block so that the hardware can use it */ struct cmb_operations { int (*alloc) (struct ccw_device*); @@ -115,11 +117,19 @@ struct cmb_operations { u64 (*read) (struct ccw_device*, int); int (*readall)(struct ccw_device*, struct cmbdata *); void (*reset) (struct ccw_device*); + void * (*align) (void *); struct attribute_group *attr_group; }; static struct cmb_operations *cmbops; +struct cmb_data { + void *hw_block; /* Pointer to block updated by hardware */ + void *last_block; /* Last changed block copied from hardware block */ + int size; /* Size of hw_block and last_block */ + unsigned long long last_update; /* when last_block was updated */ +}; + /* our user interface is designed in terms of nanoseconds, * while the hardware measures total times in its own * unit.*/ @@ -226,63 +236,229 @@ struct set_schib_struct { unsigned long address; wait_queue_head_t wait; int ret; + struct kref kref; }; +static void cmf_set_schib_release(struct kref *kref) +{ + struct set_schib_struct *set_data; + + set_data = container_of(kref, struct set_schib_struct, kref); + kfree(set_data); +} + +#define CMF_PENDING 1 + static int set_schib_wait(struct ccw_device *cdev, u32 mme, int mbfc, unsigned long address) { - struct set_schib_struct s = { - .mme = mme, - .mbfc = mbfc, - .address = address, - .wait = __WAIT_QUEUE_HEAD_INITIALIZER(s.wait), - }; + struct set_schib_struct *set_data; + int ret; spin_lock_irq(cdev->ccwlock); - s.ret = set_schib(cdev, mme, mbfc, address); - if (s.ret != -EBUSY) { - goto out_nowait; + if (!cdev->private->cmb) { + ret = -ENODEV; + goto out; } + set_data = kzalloc(sizeof(struct set_schib_struct), GFP_ATOMIC); + if (!set_data) { + ret = -ENOMEM; + goto out; + } + init_waitqueue_head(&set_data->wait); + kref_init(&set_data->kref); + set_data->mme = mme; + set_data->mbfc = mbfc; + set_data->address = address; + + ret = set_schib(cdev, mme, mbfc, address); + if (ret != -EBUSY) + goto out_put; if (cdev->private->state != DEV_STATE_ONLINE) { - s.ret = -EBUSY; /* if the device is not online, don't even try again */ - goto out_nowait; + ret = -EBUSY; + goto out_put; } + cdev->private->state = DEV_STATE_CMFCHANGE; - cdev->private->cmb_wait = &s; - s.ret = 1; + set_data->ret = CMF_PENDING; + cdev->private->cmb_wait = set_data; spin_unlock_irq(cdev->ccwlock); - if (wait_event_interruptible(s.wait, s.ret != 1)) { + if (wait_event_interruptible(set_data->wait, + set_data->ret != CMF_PENDING)) { spin_lock_irq(cdev->ccwlock); - if (s.ret == 1) { - s.ret = -ERESTARTSYS; - cdev->private->cmb_wait = 0; + if (set_data->ret == CMF_PENDING) { + set_data->ret = -ERESTARTSYS; if (cdev->private->state == DEV_STATE_CMFCHANGE) cdev->private->state = DEV_STATE_ONLINE; } spin_unlock_irq(cdev->ccwlock); } - return s.ret; - -out_nowait: + spin_lock_irq(cdev->ccwlock); + cdev->private->cmb_wait = NULL; + ret = set_data->ret; +out_put: + kref_put(&set_data->kref, cmf_set_schib_release); +out: spin_unlock_irq(cdev->ccwlock); - return s.ret; + return ret; } void retry_set_schib(struct ccw_device *cdev) { - struct set_schib_struct *s; + struct set_schib_struct *set_data; + + set_data = cdev->private->cmb_wait; + if (!set_data) { + WARN_ON(1); + return; + } + kref_get(&set_data->kref); + set_data->ret = set_schib(cdev, set_data->mme, set_data->mbfc, + set_data->address); + wake_up(&set_data->wait); + kref_put(&set_data->kref, cmf_set_schib_release); +} + +static int cmf_copy_block(struct ccw_device *cdev) +{ + struct subchannel *sch; + void *reference_buf; + void *hw_block; + struct cmb_data *cmb_data; + + sch = to_subchannel(cdev->dev.parent); + + if (stsch(sch->schid, &sch->schib)) + return -ENODEV; + + if (sch->schib.scsw.fctl & SCSW_FCTL_START_FUNC) { + /* Don't copy if a start function is in progress. */ + if ((!sch->schib.scsw.actl & SCSW_ACTL_SUSPENDED) && + (sch->schib.scsw.actl & + (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)) && + (!sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS)) + return -EBUSY; + } + cmb_data = cdev->private->cmb; + hw_block = cmbops->align(cmb_data->hw_block); + if (!memcmp(cmb_data->last_block, hw_block, cmb_data->size)) + /* No need to copy. */ + return 0; + reference_buf = kzalloc(cmb_data->size, GFP_ATOMIC); + if (!reference_buf) + return -ENOMEM; + /* Ensure consistency of block copied from hardware. */ + do { + memcpy(cmb_data->last_block, hw_block, cmb_data->size); + memcpy(reference_buf, hw_block, cmb_data->size); + } while (memcmp(cmb_data->last_block, reference_buf, cmb_data->size)); + cmb_data->last_update = get_clock(); + kfree(reference_buf); + return 0; +} + +struct copy_block_struct { + wait_queue_head_t wait; + int ret; + struct kref kref; +}; + +static void cmf_copy_block_release(struct kref *kref) +{ + struct copy_block_struct *copy_block; + + copy_block = container_of(kref, struct copy_block_struct, kref); + kfree(copy_block); +} + +static int cmf_cmb_copy_wait(struct ccw_device *cdev) +{ + struct copy_block_struct *copy_block; + int ret; + unsigned long flags; + + spin_lock_irqsave(cdev->ccwlock, flags); + if (!cdev->private->cmb) { + ret = -ENODEV; + goto out; + } + copy_block = kzalloc(sizeof(struct copy_block_struct), GFP_ATOMIC); + if (!copy_block) { + ret = -ENOMEM; + goto out; + } + init_waitqueue_head(©_block->wait); + kref_init(©_block->kref); + + ret = cmf_copy_block(cdev); + if (ret != -EBUSY) + goto out_put; + + if (cdev->private->state != DEV_STATE_ONLINE) { + ret = -EBUSY; + goto out_put; + } + + cdev->private->state = DEV_STATE_CMFUPDATE; + copy_block->ret = CMF_PENDING; + cdev->private->cmb_wait = copy_block; + + spin_unlock_irqrestore(cdev->ccwlock, flags); + if (wait_event_interruptible(copy_block->wait, + copy_block->ret != CMF_PENDING)) { + spin_lock_irqsave(cdev->ccwlock, flags); + if (copy_block->ret == CMF_PENDING) { + copy_block->ret = -ERESTARTSYS; + if (cdev->private->state == DEV_STATE_CMFUPDATE) + cdev->private->state = DEV_STATE_ONLINE; + } + spin_unlock_irqrestore(cdev->ccwlock, flags); + } + spin_lock_irqsave(cdev->ccwlock, flags); + cdev->private->cmb_wait = NULL; + ret = copy_block->ret; +out_put: + kref_put(©_block->kref, cmf_copy_block_release); +out: + spin_unlock_irqrestore(cdev->ccwlock, flags); + return ret; +} + +void cmf_retry_copy_block(struct ccw_device *cdev) +{ + struct copy_block_struct *copy_block; - s = cdev->private->cmb_wait; - cdev->private->cmb_wait = 0; - if (!s) { + copy_block = cdev->private->cmb_wait; + if (!copy_block) { WARN_ON(1); return; } - s->ret = set_schib(cdev, s->mme, s->mbfc, s->address); - wake_up(&s->wait); + kref_get(©_block->kref); + copy_block->ret = cmf_copy_block(cdev); + wake_up(©_block->wait); + kref_put(©_block->kref, cmf_copy_block_release); +} + +static void cmf_generic_reset(struct ccw_device *cdev) +{ + struct cmb_data *cmb_data; + + spin_lock_irq(cdev->ccwlock); + cmb_data = cdev->private->cmb; + if (cmb_data) { + memset(cmb_data->last_block, 0, cmb_data->size); + /* + * Need to reset hw block as well to make the hardware start + * from 0 again. + */ + memset(cmbops->align(cmb_data->hw_block), 0, cmb_data->size); + cmb_data->last_update = 0; + } + cdev->private->cmb_start_time = get_clock(); + spin_unlock_irq(cdev->ccwlock); } /** @@ -343,8 +519,8 @@ struct cmb { /* insert a single device into the cmb_area list * called with cmb_area.lock held from alloc_cmb */ -static inline int -alloc_cmb_single (struct ccw_device *cdev) +static inline int alloc_cmb_single (struct ccw_device *cdev, + struct cmb_data *cmb_data) { struct cmb *cmb; struct ccw_device_private *node; @@ -358,10 +534,12 @@ alloc_cmb_single (struct ccw_device *cdev) /* find first unused cmb in cmb_area.mem. * this is a little tricky: cmb_area.list - * remains sorted by ->cmb pointers */ + * remains sorted by ->cmb->hw_data pointers */ cmb = cmb_area.mem; list_for_each_entry(node, &cmb_area.list, cmb_list) { - if ((struct cmb*)node->cmb > cmb) + struct cmb_data *data; + data = node->cmb; + if ((struct cmb*)data->hw_block > cmb) break; cmb++; } @@ -372,7 +550,8 @@ alloc_cmb_single (struct ccw_device *cdev) /* insert new cmb */ list_add_tail(&cdev->private->cmb_list, &node->cmb_list); - cdev->private->cmb = cmb; + cmb_data->hw_block = cmb; + cdev->private->cmb = cmb_data; ret = 0; out: spin_unlock_irq(cdev->ccwlock); @@ -385,7 +564,19 @@ alloc_cmb (struct ccw_device *cdev) int ret; struct cmb *mem; ssize_t size; + struct cmb_data *cmb_data; + + /* Allocate private cmb_data. */ + cmb_data = kzalloc(sizeof(struct cmb_data), GFP_KERNEL); + if (!cmb_data) + return -ENOMEM; + cmb_data->last_block = kzalloc(sizeof(struct cmb), GFP_KERNEL); + if (!cmb_data->last_block) { + kfree(cmb_data); + return -ENOMEM; + } + cmb_data->size = sizeof(struct cmb); spin_lock(&cmb_area.lock); if (!cmb_area.mem) { @@ -414,29 +605,36 @@ alloc_cmb (struct ccw_device *cdev) } /* do the actual allocation */ - ret = alloc_cmb_single(cdev); + ret = alloc_cmb_single(cdev, cmb_data); out: spin_unlock(&cmb_area.lock); - + if (ret) { + kfree(cmb_data->last_block); + kfree(cmb_data); + } return ret; } -static void -free_cmb(struct ccw_device *cdev) +static void free_cmb(struct ccw_device *cdev) { struct ccw_device_private *priv; - - priv = cdev->private; + struct cmb_data *cmb_data; spin_lock(&cmb_area.lock); spin_lock_irq(cdev->ccwlock); + priv = cdev->private; + if (list_empty(&priv->cmb_list)) { /* already freed */ goto out; } + cmb_data = priv->cmb; priv->cmb = NULL; + if (cmb_data) + kfree(cmb_data->last_block); + kfree(cmb_data); list_del_init(&priv->cmb_list); if (list_empty(&cmb_area.list)) { @@ -451,83 +649,97 @@ out: spin_unlock(&cmb_area.lock); } -static int -set_cmb(struct ccw_device *cdev, u32 mme) +static int set_cmb(struct ccw_device *cdev, u32 mme) { u16 offset; + struct cmb_data *cmb_data; + unsigned long flags; - if (!cdev->private->cmb) + spin_lock_irqsave(cdev->ccwlock, flags); + if (!cdev->private->cmb) { + spin_unlock_irqrestore(cdev->ccwlock, flags); return -EINVAL; - - offset = mme ? (struct cmb *)cdev->private->cmb - cmb_area.mem : 0; + } + cmb_data = cdev->private->cmb; + offset = mme ? (struct cmb *)cmb_data->hw_block - cmb_area.mem : 0; + spin_unlock_irqrestore(cdev->ccwlock, flags); return set_schib_wait(cdev, mme, 0, offset); } -static u64 -read_cmb (struct ccw_device *cdev, int index) +static u64 read_cmb (struct ccw_device *cdev, int index) { - /* yes, we have to put it on the stack - * because the cmb must only be accessed - * atomically, e.g. with mvc */ - struct cmb cmb; - unsigned long flags; + struct cmb *cmb; u32 val; + int ret; + unsigned long flags; + + ret = cmf_cmb_copy_wait(cdev); + if (ret < 0) + return 0; spin_lock_irqsave(cdev->ccwlock, flags); if (!cdev->private->cmb) { - spin_unlock_irqrestore(cdev->ccwlock, flags); - return 0; + ret = 0; + goto out; } - - cmb = *(struct cmb*)cdev->private->cmb; - spin_unlock_irqrestore(cdev->ccwlock, flags); + cmb = ((struct cmb_data *)cdev->private->cmb)->last_block; switch (index) { case cmb_ssch_rsch_count: - return cmb.ssch_rsch_count; + ret = cmb->ssch_rsch_count; + goto out; case cmb_sample_count: - return cmb.sample_count; + ret = cmb->sample_count; + goto out; case cmb_device_connect_time: - val = cmb.device_connect_time; + val = cmb->device_connect_time; break; case cmb_function_pending_time: - val = cmb.function_pending_time; + val = cmb->function_pending_time; break; case cmb_device_disconnect_time: - val = cmb.device_disconnect_time; + val = cmb->device_disconnect_time; break; case cmb_control_unit_queuing_time: - val = cmb.control_unit_queuing_time; + val = cmb->control_unit_queuing_time; break; case cmb_device_active_only_time: - val = cmb.device_active_only_time; + val = cmb->device_active_only_time; break; default: - return 0; + ret = 0; + goto out; } - return time_to_avg_nsec(val, cmb.sample_count); + ret = time_to_avg_nsec(val, cmb->sample_count); +out: + spin_unlock_irqrestore(cdev->ccwlock, flags); + return ret; } -static int -readall_cmb (struct ccw_device *cdev, struct cmbdata *data) +static int readall_cmb (struct ccw_device *cdev, struct cmbdata *data) { - /* yes, we have to put it on the stack - * because the cmb must only be accessed - * atomically, e.g. with mvc */ - struct cmb cmb; - unsigned long flags; + struct cmb *cmb; + struct cmb_data *cmb_data; u64 time; + unsigned long flags; + int ret; + ret = cmf_cmb_copy_wait(cdev); + if (ret < 0) + return ret; spin_lock_irqsave(cdev->ccwlock, flags); - if (!cdev->private->cmb) { - spin_unlock_irqrestore(cdev->ccwlock, flags); - return -ENODEV; + cmb_data = cdev->private->cmb; + if (!cmb_data) { + ret = -ENODEV; + goto out; } - - cmb = *(struct cmb*)cdev->private->cmb; - time = get_clock() - cdev->private->cmb_start_time; - spin_unlock_irqrestore(cdev->ccwlock, flags); + if (cmb_data->last_update == 0) { + ret = -EAGAIN; + goto out; + } + cmb = cmb_data->last_block; + time = cmb_data->last_update - cdev->private->cmb_start_time; memset(data, 0, sizeof(struct cmbdata)); @@ -538,31 +750,32 @@ readall_cmb (struct ccw_device *cdev, struct cmbdata *data) data->elapsed_time = (time * 1000) >> 12; /* copy data to new structure */ - data->ssch_rsch_count = cmb.ssch_rsch_count; - data->sample_count = cmb.sample_count; + data->ssch_rsch_count = cmb->ssch_rsch_count; + data->sample_count = cmb->sample_count; /* time fields are converted to nanoseconds while copying */ - data->device_connect_time = time_to_nsec(cmb.device_connect_time); - data->function_pending_time = time_to_nsec(cmb.function_pending_time); - data->device_disconnect_time = time_to_nsec(cmb.device_disconnect_time); + data->device_connect_time = time_to_nsec(cmb->device_connect_time); + data->function_pending_time = time_to_nsec(cmb->function_pending_time); + data->device_disconnect_time = + time_to_nsec(cmb->device_disconnect_time); data->control_unit_queuing_time - = time_to_nsec(cmb.control_unit_queuing_time); + = time_to_nsec(cmb->control_unit_queuing_time); data->device_active_only_time - = time_to_nsec(cmb.device_active_only_time); + = time_to_nsec(cmb->device_active_only_time); + ret = 0; +out: + spin_unlock_irqrestore(cdev->ccwlock, flags); + return ret; +} - return 0; +static void reset_cmb(struct ccw_device *cdev) +{ + cmf_generic_reset(cdev); } -static void -reset_cmb(struct ccw_device *cdev) +static void * align_cmb(void *area) { - struct cmb *cmb; - spin_lock_irq(cdev->ccwlock); - cmb = cdev->private->cmb; - if (cmb) - memset (cmb, 0, sizeof (*cmb)); - cdev->private->cmb_start_time = get_clock(); - spin_unlock_irq(cdev->ccwlock); + return area; } static struct attribute_group cmf_attr_group; @@ -574,6 +787,7 @@ static struct cmb_operations cmbops_basic = { .read = read_cmb, .readall = readall_cmb, .reset = reset_cmb, + .align = align_cmb, .attr_group = &cmf_attr_group, }; @@ -610,22 +824,34 @@ static inline struct cmbe* cmbe_align(struct cmbe *c) return (struct cmbe*)addr; } -static int -alloc_cmbe (struct ccw_device *cdev) +static int alloc_cmbe (struct ccw_device *cdev) { struct cmbe *cmbe; - cmbe = kmalloc (sizeof (*cmbe) * 2, GFP_KERNEL); + struct cmb_data *cmb_data; + int ret; + + cmbe = kzalloc (sizeof (*cmbe) * 2, GFP_KERNEL); if (!cmbe) return -ENOMEM; - + cmb_data = kzalloc(sizeof(struct cmb_data), GFP_KERNEL); + if (!cmb_data) { + ret = -ENOMEM; + goto out_free; + } + cmb_data->last_block = kzalloc(sizeof(struct cmbe), GFP_KERNEL); + if (!cmb_data->last_block) { + ret = -ENOMEM; + goto out_free; + } + cmb_data->size = sizeof(struct cmbe); spin_lock_irq(cdev->ccwlock); if (cdev->private->cmb) { - kfree(cmbe); spin_unlock_irq(cdev->ccwlock); - return -EBUSY; + ret = -EBUSY; + goto out_free; } - - cdev->private->cmb = cmbe; + cmb_data->hw_block = cmbe; + cdev->private->cmb = cmb_data; spin_unlock_irq(cdev->ccwlock); /* activate global measurement if this is the first channel */ @@ -636,14 +862,24 @@ alloc_cmbe (struct ccw_device *cdev) spin_unlock(&cmb_area.lock); return 0; +out_free: + if (cmb_data) + kfree(cmb_data->last_block); + kfree(cmb_data); + kfree(cmbe); + return ret; } -static void -free_cmbe (struct ccw_device *cdev) +static void free_cmbe (struct ccw_device *cdev) { + struct cmb_data *cmb_data; + spin_lock_irq(cdev->ccwlock); - kfree(cdev->private->cmb); + cmb_data = cdev->private->cmb; cdev->private->cmb = NULL; + if (cmb_data) + kfree(cmb_data->last_block); + kfree(cmb_data); spin_unlock_irq(cdev->ccwlock); /* deactivate global measurement if this is the last channel */ @@ -654,89 +890,105 @@ free_cmbe (struct ccw_device *cdev) spin_unlock(&cmb_area.lock); } -static int -set_cmbe(struct ccw_device *cdev, u32 mme) +static int set_cmbe(struct ccw_device *cdev, u32 mme) { unsigned long mba; + struct cmb_data *cmb_data; + unsigned long flags; - if (!cdev->private->cmb) + spin_lock_irqsave(cdev->ccwlock, flags); + if (!cdev->private->cmb) { + spin_unlock_irqrestore(cdev->ccwlock, flags); return -EINVAL; - mba = mme ? (unsigned long) cmbe_align(cdev->private->cmb) : 0; + } + cmb_data = cdev->private->cmb; + mba = mme ? (unsigned long) cmbe_align(cmb_data->hw_block) : 0; + spin_unlock_irqrestore(cdev->ccwlock, flags); return set_schib_wait(cdev, mme, 1, mba); } -u64 -read_cmbe (struct ccw_device *cdev, int index) +static u64 read_cmbe (struct ccw_device *cdev, int index) { - /* yes, we have to put it on the stack - * because the cmb must only be accessed - * atomically, e.g. with mvc */ - struct cmbe cmb; - unsigned long flags; + struct cmbe *cmb; + struct cmb_data *cmb_data; u32 val; + int ret; + unsigned long flags; - spin_lock_irqsave(cdev->ccwlock, flags); - if (!cdev->private->cmb) { - spin_unlock_irqrestore(cdev->ccwlock, flags); + ret = cmf_cmb_copy_wait(cdev); + if (ret < 0) return 0; - } - cmb = *cmbe_align(cdev->private->cmb); - spin_unlock_irqrestore(cdev->ccwlock, flags); + spin_lock_irqsave(cdev->ccwlock, flags); + cmb_data = cdev->private->cmb; + if (!cmb_data) { + ret = 0; + goto out; + } + cmb = cmb_data->last_block; switch (index) { case cmb_ssch_rsch_count: - return cmb.ssch_rsch_count; + ret = cmb->ssch_rsch_count; + goto out; case cmb_sample_count: - return cmb.sample_count; + ret = cmb->sample_count; + goto out; case cmb_device_connect_time: - val = cmb.device_connect_time; + val = cmb->device_connect_time; break; case cmb_function_pending_time: - val = cmb.function_pending_time; + val = cmb->function_pending_time; break; case cmb_device_disconnect_time: - val = cmb.device_disconnect_time; + val = cmb->device_disconnect_time; break; case cmb_control_unit_queuing_time: - val = cmb.control_unit_queuing_time; + val = cmb->control_unit_queuing_time; break; case cmb_device_active_only_time: - val = cmb.device_active_only_time; + val = cmb->device_active_only_time; break; case cmb_device_busy_time: - val = cmb.device_busy_time; + val = cmb->device_busy_time; break; case cmb_initial_command_response_time: - val = cmb.initial_command_response_time; + val = cmb->initial_command_response_time; break; default: - return 0; + ret = 0; + goto out; } - return time_to_avg_nsec(val, cmb.sample_count); + ret = time_to_avg_nsec(val, cmb->sample_count); +out: + spin_unlock_irqrestore(cdev->ccwlock, flags); + return ret; } -static int -readall_cmbe (struct ccw_device *cdev, struct cmbdata *data) +static int readall_cmbe (struct ccw_device *cdev, struct cmbdata *data) { - /* yes, we have to put it on the stack - * because the cmb must only be accessed - * atomically, e.g. with mvc */ - struct cmbe cmb; - unsigned long flags; + struct cmbe *cmb; + struct cmb_data *cmb_data; u64 time; + unsigned long flags; + int ret; + ret = cmf_cmb_copy_wait(cdev); + if (ret < 0) + return ret; spin_lock_irqsave(cdev->ccwlock, flags); - if (!cdev->private->cmb) { - spin_unlock_irqrestore(cdev->ccwlock, flags); - return -ENODEV; + cmb_data = cdev->private->cmb; + if (!cmb_data) { + ret = -ENODEV; + goto out; } - - cmb = *cmbe_align(cdev->private->cmb); - time = get_clock() - cdev->private->cmb_start_time; - spin_unlock_irqrestore(cdev->ccwlock, flags); + if (cmb_data->last_update == 0) { + ret = -EAGAIN; + goto out; + } + time = cmb_data->last_update - cdev->private->cmb_start_time; memset (data, 0, sizeof(struct cmbdata)); @@ -746,35 +998,38 @@ readall_cmbe (struct ccw_device *cdev, struct cmbdata *data) /* conver to nanoseconds */ data->elapsed_time = (time * 1000) >> 12; + cmb = cmb_data->last_block; /* copy data to new structure */ - data->ssch_rsch_count = cmb.ssch_rsch_count; - data->sample_count = cmb.sample_count; + data->ssch_rsch_count = cmb->ssch_rsch_count; + data->sample_count = cmb->sample_count; /* time fields are converted to nanoseconds while copying */ - data->device_connect_time = time_to_nsec(cmb.device_connect_time); - data->function_pending_time = time_to_nsec(cmb.function_pending_time); - data->device_disconnect_time = time_to_nsec(cmb.device_disconnect_time); + data->device_connect_time = time_to_nsec(cmb->device_connect_time); + data->function_pending_time = time_to_nsec(cmb->function_pending_time); + data->device_disconnect_time = + time_to_nsec(cmb->device_disconnect_time); data->control_unit_queuing_time - = time_to_nsec(cmb.control_unit_queuing_time); + = time_to_nsec(cmb->control_unit_queuing_time); data->device_active_only_time - = time_to_nsec(cmb.device_active_only_time); - data->device_busy_time = time_to_nsec(cmb.device_busy_time); + = time_to_nsec(cmb->device_active_only_time); + data->device_busy_time = time_to_nsec(cmb->device_busy_time); data->initial_command_response_time - = time_to_nsec(cmb.initial_command_response_time); + = time_to_nsec(cmb->initial_command_response_time); - return 0; + ret = 0; +out: + spin_unlock_irqrestore(cdev->ccwlock, flags); + return ret; } -static void -reset_cmbe(struct ccw_device *cdev) +static void reset_cmbe(struct ccw_device *cdev) { - struct cmbe *cmb; - spin_lock_irq(cdev->ccwlock); - cmb = cmbe_align(cdev->private->cmb); - if (cmb) - memset (cmb, 0, sizeof (*cmb)); - cdev->private->cmb_start_time = get_clock(); - spin_unlock_irq(cdev->ccwlock); + cmf_generic_reset(cdev); +} + +static void * align_cmbe(void *area) +{ + return cmbe_align(area); } static struct attribute_group cmf_attr_group_ext; @@ -786,6 +1041,7 @@ static struct cmb_operations cmbops_extended = { .read = read_cmbe, .readall = readall_cmbe, .reset = reset_cmbe, + .align = align_cmbe, .attr_group = &cmf_attr_group_ext, }; @@ -803,14 +1059,19 @@ cmb_show_avg_sample_interval(struct device *dev, struct device_attribute *attr, struct ccw_device *cdev; long interval; unsigned long count; + struct cmb_data *cmb_data; cdev = to_ccwdev(dev); - interval = get_clock() - cdev->private->cmb_start_time; count = cmf_read(cdev, cmb_sample_count); - if (count) + spin_lock_irq(cdev->ccwlock); + cmb_data = cdev->private->cmb; + if (count) { + interval = cmb_data->last_update - + cdev->private->cmb_start_time; interval /= count; - else + } else interval = -1; + spin_unlock_irq(cdev->ccwlock); return sprintf(buf, "%ld\n", interval); } @@ -823,7 +1084,10 @@ cmb_show_avg_utilization(struct device *dev, struct device_attribute *attr, char int ret; ret = cmf_readall(to_ccwdev(dev), &data); - if (ret) + if (ret == -EAGAIN || ret == -ENODEV) + /* No data (yet/currently) available to use for calculation. */ + return sprintf(buf, "n/a\n"); + else if (ret) return ret; utilization = data.device_connect_time + @@ -982,6 +1246,13 @@ cmf_readall(struct ccw_device *cdev, struct cmbdata *data) return cmbops->readall(cdev, data); } +/* Reenable cmf when a disconnected device becomes available again. */ +int cmf_reenable(struct ccw_device *cdev) +{ + cmbops->reset(cdev); + return cmbops->set(cdev, 2); +} + static int __init init_cmf(void) { diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 74ea8aac4b7..1d3be80797f 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c @@ -19,9 +19,11 @@ #include "cio_debug.h" #include "ioasm.h" #include "chsc.h" +#include "device.h" int need_rescan = 0; int css_init_done = 0; +static int need_reprobe = 0; static int max_ssid = 0; struct channel_subsystem *css[__MAX_CSSID + 1]; @@ -339,6 +341,67 @@ typedef void (*workfunc)(void *); DECLARE_WORK(slow_path_work, (workfunc)css_trigger_slow_path, NULL); struct workqueue_struct *slow_path_wq; +/* Reprobe subchannel if unregistered. */ +static int reprobe_subchannel(struct subchannel_id schid, void *data) +{ + struct subchannel *sch; + int ret; + + CIO_DEBUG(KERN_INFO, 6, "cio: reprobe 0.%x.%04x\n", + schid.ssid, schid.sch_no); + if (need_reprobe) + return -EAGAIN; + + sch = get_subchannel_by_schid(schid); + if (sch) { + /* Already known. */ + put_device(&sch->dev); + return 0; + } + + ret = css_probe_device(schid); + switch (ret) { + case 0: + break; + case -ENXIO: + case -ENOMEM: + /* These should abort looping */ + break; + default: + ret = 0; + } + + return ret; +} + +/* Work function used to reprobe all unregistered subchannels. */ +static void reprobe_all(void *data) +{ + int ret; + + CIO_MSG_EVENT(2, "reprobe start\n"); + + need_reprobe = 0; + /* Make sure initial subchannel scan is done. */ + wait_event(ccw_device_init_wq, + atomic_read(&ccw_device_init_count) == 0); + ret = for_each_subchannel(reprobe_subchannel, NULL); + + CIO_MSG_EVENT(2, "reprobe done (rc=%d, need_reprobe=%d)\n", ret, + need_reprobe); +} + +DECLARE_WORK(css_reprobe_work, reprobe_all, NULL); + +/* Schedule reprobing of all unregistered subchannels. */ +void css_schedule_reprobe(void) +{ + need_reprobe = 1; + queue_work(ccw_device_work, &css_reprobe_work); +} + +EXPORT_SYMBOL_GPL(css_schedule_reprobe); + /* * Rescan for new devices. FIXME: This is slow. * This function is called when we have lost CRWs due to overflows and we have diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 8e3053c2a45..67f0de6aed3 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -8,7 +8,6 @@ * Cornelia Huck (cornelia.huck@de.ibm.com) * Martin Schwidefsky (schwidefsky@de.ibm.com) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/spinlock.h> @@ -133,8 +132,8 @@ struct css_driver io_subchannel_driver = { struct workqueue_struct *ccw_device_work; struct workqueue_struct *ccw_device_notify_work; -static wait_queue_head_t ccw_device_init_wq; -static atomic_t ccw_device_init_count; +wait_queue_head_t ccw_device_init_wq; +atomic_t ccw_device_init_count; static int __init init_ccw_bus_type (void) diff --git a/drivers/s390/cio/device.h b/drivers/s390/cio/device.h index 11587ebb728..00be9a5b4ac 100644 --- a/drivers/s390/cio/device.h +++ b/drivers/s390/cio/device.h @@ -1,6 +1,10 @@ #ifndef S390_DEVICE_H #define S390_DEVICE_H +#include <asm/ccwdev.h> +#include <asm/atomic.h> +#include <linux/wait.h> + /* * states of the device statemachine */ @@ -23,6 +27,7 @@ enum dev_state { DEV_STATE_DISCONNECTED, DEV_STATE_DISCONNECTED_SENSE_ID, DEV_STATE_CMFCHANGE, + DEV_STATE_CMFUPDATE, /* last element! */ NR_DEV_STATES }; @@ -67,6 +72,8 @@ dev_fsm_final_state(struct ccw_device *cdev) extern struct workqueue_struct *ccw_device_work; extern struct workqueue_struct *ccw_device_notify_work; +extern wait_queue_head_t ccw_device_init_wq; +extern atomic_t ccw_device_init_count; void io_subchannel_recog_done(struct ccw_device *cdev); @@ -112,5 +119,8 @@ int ccw_device_stlck(struct ccw_device *); void ccw_device_set_timeout(struct ccw_device *, int); extern struct subchannel_id ccw_device_get_subchannel_id(struct ccw_device *); +/* Channel measurement facility related */ void retry_set_schib(struct ccw_device *cdev); +void cmf_retry_copy_block(struct ccw_device *); +int cmf_reenable(struct ccw_device *); #endif diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 49ec562d7f6..cb1af0b6f03 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c @@ -9,7 +9,6 @@ */ #include <linux/module.h> -#include <linux/config.h> #include <linux/init.h> #include <linux/jiffies.h> #include <linux/string.h> @@ -336,8 +335,11 @@ ccw_device_oper_notify(void *data) if (!ret) /* Driver doesn't want device back. */ ccw_device_do_unreg_rereg((void *)cdev); - else + else { + /* Reenable channel measurements, if needed. */ + cmf_reenable(cdev); wake_up(&cdev->private->wait_q); + } } /* @@ -861,6 +863,8 @@ ccw_device_clear_verify(struct ccw_device *cdev, enum dev_event dev_event) irb = (struct irb *) __LC_IRB; /* Accumulate status. We don't do basic sense. */ ccw_device_accumulate_irb(cdev, irb); + /* Remember to clear irb to avoid residuals. */ + memset(&cdev->private->irb, 0, sizeof(struct irb)); /* Try to start delayed device verification. */ ccw_device_online_verify(cdev, 0); /* Note: Don't call handler for cio initiated clear! */ @@ -1093,6 +1097,13 @@ ccw_device_change_cmfstate(struct ccw_device *cdev, enum dev_event dev_event) dev_fsm_event(cdev, dev_event); } +static void ccw_device_update_cmfblock(struct ccw_device *cdev, + enum dev_event dev_event) +{ + cmf_retry_copy_block(cdev); + cdev->private->state = DEV_STATE_ONLINE; + dev_fsm_event(cdev, dev_event); +} static void ccw_device_quiesce_done(struct ccw_device *cdev, enum dev_event dev_event) @@ -1247,6 +1258,12 @@ fsm_func_t *dev_jumptable[NR_DEV_STATES][NR_DEV_EVENTS] = { [DEV_EVENT_TIMEOUT] = ccw_device_change_cmfstate, [DEV_EVENT_VERIFY] = ccw_device_change_cmfstate, }, + [DEV_STATE_CMFUPDATE] = { + [DEV_EVENT_NOTOPER] = ccw_device_update_cmfblock, + [DEV_EVENT_INTERRUPT] = ccw_device_update_cmfblock, + [DEV_EVENT_TIMEOUT] = ccw_device_update_cmfblock, + [DEV_EVENT_VERIFY] = ccw_device_update_cmfblock, + }, }; /* diff --git a/drivers/s390/cio/device_id.c b/drivers/s390/cio/device_id.c index e60b2d8103b..438db483035 100644 --- a/drivers/s390/cio/device_id.c +++ b/drivers/s390/cio/device_id.c @@ -10,7 +10,6 @@ */ #include <linux/module.h> -#include <linux/config.h> #include <linux/init.h> #include <asm/ccwdev.h> diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c index 795abb5a65b..a60124264be 100644 --- a/drivers/s390/cio/device_ops.c +++ b/drivers/s390/cio/device_ops.c @@ -6,7 +6,6 @@ * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com) * Cornelia Huck (cornelia.huck@de.ibm.com) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/errno.h> @@ -78,7 +77,8 @@ ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa, return -ENODEV; if (cdev->private->state == DEV_STATE_NOT_OPER) return -ENODEV; - if (cdev->private->state == DEV_STATE_VERIFY) { + if (cdev->private->state == DEV_STATE_VERIFY || + cdev->private->state == DEV_STATE_CLEAR_VERIFY) { /* Remember to fake irb when finished. */ if (!cdev->private->flags.fake_irb) { cdev->private->flags.fake_irb = 1; @@ -270,7 +270,8 @@ ccw_device_wake_up(struct ccw_device *cdev, unsigned long ip, struct irb *irb) * We didn't get channel end / device end. Check if path * verification has been started; we can retry after it has * finished. We also retry unit checks except for command reject - * or intervention required. + * or intervention required. Also check for long busy + * conditions. */ if (cdev->private->flags.doverify || cdev->private->state == DEV_STATE_VERIFY) @@ -279,6 +280,10 @@ ccw_device_wake_up(struct ccw_device *cdev, unsigned long ip, struct irb *irb) !(irb->ecw[0] & (SNS0_CMD_REJECT | SNS0_INTERVENTION_REQ))) cdev->private->intparm = -EAGAIN; + else if ((irb->scsw.dstat & DEV_STAT_ATTENTION) && + (irb->scsw.dstat & DEV_STAT_DEV_END) && + (irb->scsw.dstat & DEV_STAT_UNIT_EXCEP)) + cdev->private->intparm = -EAGAIN; else cdev->private->intparm = -EIO; diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c index 85b1020a1fc..54cb64ed078 100644 --- a/drivers/s390/cio/device_pgid.c +++ b/drivers/s390/cio/device_pgid.c @@ -9,7 +9,6 @@ * Path Group ID functions. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> diff --git a/drivers/s390/cio/device_status.c b/drivers/s390/cio/device_status.c index 6c762b43f92..14bef2c179b 100644 --- a/drivers/s390/cio/device_status.c +++ b/drivers/s390/cio/device_status.c @@ -9,7 +9,6 @@ * Status accumulation and basic sense functions. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c index 96f519281d9..b70039af70d 100644 --- a/drivers/s390/cio/qdio.c +++ b/drivers/s390/cio/qdio.c @@ -30,7 +30,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> diff --git a/drivers/s390/crypto/z90main.c b/drivers/s390/crypto/z90main.c index 982acc7303e..b2f20ab8431 100644 --- a/drivers/s390/crypto/z90main.c +++ b/drivers/s390/crypto/z90main.c @@ -411,7 +411,6 @@ static struct miscdevice z90crypt_misc_device = { .minor = Z90CRYPT_MINOR, .name = DEV_NAME, .fops = &z90crypt_fops, - .devfs_name = DEV_NAME }; /** diff --git a/drivers/s390/net/fsm.c b/drivers/s390/net/fsm.c index 7145e2134cf..2c1db8036b7 100644 --- a/drivers/s390/net/fsm.c +++ b/drivers/s390/net/fsm.c @@ -4,7 +4,6 @@ */ #include "fsm.h" -#include <linux/config.h> #include <linux/module.h> #include <linux/timer.h> diff --git a/drivers/s390/net/iucv.c b/drivers/s390/net/iucv.c index e0c7deb9883..189a4927543 100644 --- a/drivers/s390/net/iucv.c +++ b/drivers/s390/net/iucv.c @@ -33,7 +33,6 @@ #include <linux/module.h> #include <linux/moduleparam.h> -#include <linux/config.h> #include <linux/spinlock.h> #include <linux/kernel.h> diff --git a/drivers/s390/net/qeth_eddp.c b/drivers/s390/net/qeth_eddp.c index 38aad832145..8491598f914 100644 --- a/drivers/s390/net/qeth_eddp.c +++ b/drivers/s390/net/qeth_eddp.c @@ -8,7 +8,6 @@ * Author(s): Thomas Spatzier <tspat@de.ibm.com> * */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/ip.h> #include <linux/inetdevice.h> diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 56009d76832..36733b9823c 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c @@ -27,7 +27,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/string.h> diff --git a/drivers/s390/s390mach.c b/drivers/s390/s390mach.c index f99e55308b3..432136f96e6 100644 --- a/drivers/s390/s390mach.c +++ b/drivers/s390/s390mach.c @@ -8,12 +8,12 @@ * Martin Schwidefsky (schwidefsky@de.ibm.com) */ -#include <linux/config.h> #include <linux/init.h> #include <linux/sched.h> #include <linux/errno.h> #include <linux/workqueue.h> #include <linux/time.h> +#include <linux/kthread.h> #include <asm/lowcore.h> @@ -56,8 +56,6 @@ s390_collect_crw_info(void *param) unsigned int chain; sem = (struct semaphore *)param; - /* Set a nice name. */ - daemonize("kmcheck"); repeat: down_interruptible(sem); slow = 0; @@ -516,7 +514,7 @@ arch_initcall(machine_check_init); static int __init machine_check_crw_init (void) { - kernel_thread(s390_collect_crw_info, &m_sem, CLONE_FS|CLONE_FILES); + kthread_run(s390_collect_crw_info, &m_sem, "kmcheck"); ctl_set_bit(14, 28); /* enable channel report MCH */ return 0; } diff --git a/drivers/s390/sysinfo.c b/drivers/s390/sysinfo.c index 66da840c931..d1c1e75bfd6 100644 --- a/drivers/s390/sysinfo.c +++ b/drivers/s390/sysinfo.c @@ -5,7 +5,6 @@ * Author(s): Ulrich Weigand (Ulrich.Weigand@de.ibm.com) */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/proc_fs.h> diff --git a/drivers/sbus/char/aurora.c b/drivers/sbus/char/aurora.c index 015db40ad8a..4fdb2c93221 100644 --- a/drivers/sbus/char/aurora.c +++ b/drivers/sbus/char/aurora.c @@ -337,19 +337,19 @@ static int aurora_probe(void) printk("intr pri %d\n", grrr); #endif if ((bp->irq=irqs[bn]) && valid_irq(bp->irq) && - !request_irq(bp->irq|0x30, aurora_interrupt, SA_SHIRQ, "sio16", bp)) { + !request_irq(bp->irq|0x30, aurora_interrupt, IRQF_SHARED, "sio16", bp)) { free_irq(bp->irq|0x30, bp); } else if ((bp->irq=prom_getint(sdev->prom_node, "bintr")) && valid_irq(bp->irq) && - !request_irq(bp->irq|0x30, aurora_interrupt, SA_SHIRQ, "sio16", bp)) { + !request_irq(bp->irq|0x30, aurora_interrupt, IRQF_SHARED, "sio16", bp)) { free_irq(bp->irq|0x30, bp); } else if ((bp->irq=prom_getint(sdev->prom_node, "intr")) && valid_irq(bp->irq) && - !request_irq(bp->irq|0x30, aurora_interrupt, SA_SHIRQ, "sio16", bp)) { + !request_irq(bp->irq|0x30, aurora_interrupt, IRQF_SHARED, "sio16", bp)) { free_irq(bp->irq|0x30, bp); } else for(grrr=0;grrr<TYPE_1_IRQS;grrr++) { - if ((bp->irq=type_1_irq[grrr])&&!request_irq(bp->irq|0x30, aurora_interrupt, SA_SHIRQ, "sio16", bp)) { + if ((bp->irq=type_1_irq[grrr])&&!request_irq(bp->irq|0x30, aurora_interrupt, IRQF_SHARED, "sio16", bp)) { free_irq(bp->irq|0x30, bp); break; } else { @@ -909,14 +909,14 @@ static int aurora_setup_board(struct Aurora_board * bp) #ifdef AURORA_ALLIRQ int i; for (i = 0; i < AURORA_ALLIRQ; i++) { - error = request_irq(allirq[i]|0x30, aurora_interrupt, SA_SHIRQ, + error = request_irq(allirq[i]|0x30, aurora_interrupt, IRQF_SHARED, "sio16", bp); if (error) printk(KERN_ERR "IRQ%d request error %d\n", allirq[i], error); } #else - error = request_irq(bp->irq|0x30, aurora_interrupt, SA_SHIRQ, + error = request_irq(bp->irq|0x30, aurora_interrupt, IRQF_SHARED, "sio16", bp); if (error) { printk(KERN_ERR "IRQ request error %d\n", error); diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c index 73634371393..7186235594f 100644 --- a/drivers/sbus/char/bbc_i2c.c +++ b/drivers/sbus/char/bbc_i2c.c @@ -377,7 +377,7 @@ static int __init attach_one_i2c(struct linux_ebus_device *edev, int index) bp->waiting = 0; init_waitqueue_head(&bp->wq); if (request_irq(edev->irqs[0], bbc_i2c_interrupt, - SA_SHIRQ, "bbc_i2c", bp)) + IRQF_SHARED, "bbc_i2c", bp)) goto fail; bp->index = index; diff --git a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c index ccb20a6f5f3..385f4f76831 100644 --- a/drivers/sbus/char/bpp.c +++ b/drivers/sbus/char/bpp.c @@ -20,7 +20,6 @@ #include <linux/timer.h> #include <linux/ioport.h> #include <linux/major.h> -#include <linux/devfs_fs_kernel.h> #include <asm/uaccess.h> #include <asm/io.h> @@ -1031,11 +1030,6 @@ static int __init bpp_init(void) instances[idx].opened = 0; probeLptPort(idx); } - devfs_mk_dir("bpp"); - for (idx = 0; idx < BPP_NO; idx++) { - devfs_mk_cdev(MKDEV(BPP_MAJOR, idx), - S_IFCHR | S_IRUSR | S_IWUSR, "bpp/%d", idx); - } return 0; } @@ -1044,9 +1038,6 @@ static void __exit bpp_cleanup(void) { unsigned idx; - for (idx = 0; idx < BPP_NO; idx++) - devfs_remove("bpp/%d", idx); - devfs_remove("bpp"); unregister_chrdev(BPP_MAJOR, dev_name); for (idx = 0; idx < BPP_NO; idx++) { diff --git a/drivers/sbus/char/cpwatchdog.c b/drivers/sbus/char/cpwatchdog.c index 21737b7e86a..836a58bb030 100644 --- a/drivers/sbus/char/cpwatchdog.c +++ b/drivers/sbus/char/cpwatchdog.c @@ -301,7 +301,7 @@ static int wd_open(struct inode *inode, struct file *f) { if (request_irq(wd_dev.irq, &wd_interrupt, - SA_SHIRQ, + IRQF_SHARED, WD_OBPNAME, (void *)wd_dev.regs)) { printk("%s: Cannot register IRQ %d\n", diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c index cf97e9efe9b..063e676a3ac 100644 --- a/drivers/sbus/char/envctrl.c +++ b/drivers/sbus/char/envctrl.c @@ -22,7 +22,6 @@ #define __KERNEL_SYSCALLS__ static int errno; -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/kthread.h> diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c index 31b8a5f6116..fa2418f7ad3 100644 --- a/drivers/sbus/char/flash.c +++ b/drivers/sbus/char/flash.c @@ -4,7 +4,6 @@ * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/errno.h> diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c index d7e4bb41bd7..293bb2fdb1d 100644 --- a/drivers/sbus/char/openprom.c +++ b/drivers/sbus/char/openprom.c @@ -29,7 +29,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/drivers/sbus/char/vfc.h b/drivers/sbus/char/vfc.h index 8045cd5e7cb..63941a259b9 100644 --- a/drivers/sbus/char/vfc.h +++ b/drivers/sbus/char/vfc.h @@ -1,8 +1,6 @@ #ifndef _LINUX_VFC_H_ #define _LINUX_VFC_H_ -#include <linux/devfs_fs_kernel.h> - /* * The control register for the vfc is at offset 0x4000 * The first field ram bank is located at offset 0x5000 diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c index ddcd330b9e8..55b2b31bd7a 100644 --- a/drivers/sbus/char/vfc_dev.c +++ b/drivers/sbus/char/vfc_dev.c @@ -164,10 +164,6 @@ int init_vfc_device(struct sbus_dev *sdev,struct vfc_dev *dev, int instance) return -EINVAL; if (init_vfc_hw(dev)) return -EIO; - - devfs_mk_cdev(MKDEV(VFC_MAJOR, instance), - S_IFCHR | S_IRUSR | S_IWUSR, - "vfc/%d", instance); return 0; } @@ -677,7 +673,6 @@ static int vfc_probe(void) kfree(vfc_dev_lst); return -EIO; } - devfs_mk_dir("vfc"); instance = 0; for_all_sbusdev(sdev, sbus) { if (strcmp(sdev->prom_name, "vfc") == 0) { @@ -717,7 +712,6 @@ static void deinit_vfc_device(struct vfc_dev *dev) { if(dev == NULL) return; - devfs_remove("vfc/%d", dev->instance); sbus_iounmap(dev->regs, sizeof(struct vfc_regs)); kfree(dev); } @@ -731,7 +725,6 @@ void cleanup_module(void) for (devp = vfc_dev_lst; *devp; devp++) deinit_vfc_device(*devp); - devfs_remove("vfc"); kfree(vfc_dev_lst); return; } diff --git a/drivers/sbus/dvma.c b/drivers/sbus/dvma.c index 378a1d68024..57e1526746a 100644 --- a/drivers/sbus/dvma.c +++ b/drivers/sbus/dvma.c @@ -3,7 +3,6 @@ * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) */ -#include <linux/config.h> #include <linux/string.h> #include <linux/kernel.h> #include <linux/slab.h> diff --git a/drivers/sbus/sbus.c b/drivers/sbus/sbus.c index 387a6aa8c02..16b59773c0b 100644 --- a/drivers/sbus/sbus.c +++ b/drivers/sbus/sbus.c @@ -5,7 +5,6 @@ #include <linux/kernel.h> #include <linux/slab.h> -#include <linux/config.h> #include <linux/init.h> #include <linux/pci.h> diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index b003baf8d40..5a9475e56d0 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -2122,7 +2122,7 @@ static int __devinit twa_probe(struct pci_dev *pdev, const struct pci_device_id TW_PARAM_PORTCOUNT, TW_PARAM_PORTCOUNT_LENGTH))); /* Now setup the interrupt handler */ - retval = request_irq(pdev->irq, twa_interrupt, SA_SHIRQ, "3w-9xxx", tw_dev); + retval = request_irq(pdev->irq, twa_interrupt, IRQF_SHARED, "3w-9xxx", tw_dev); if (retval) { TW_PRINTK(tw_dev->host, TW_DRIVER, 0x30, "Error requesting IRQ"); goto out_remove_host; diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index 17dbd4ac869..f3a5f422a8e 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c @@ -2397,7 +2397,7 @@ static int __devinit tw_probe(struct pci_dev *pdev, const struct pci_device_id * printk(KERN_WARNING "3w-xxxx: scsi%d: Found a 3ware Storage Controller at 0x%x, IRQ: %d.\n", host->host_no, tw_dev->base_addr, pdev->irq); /* Now setup the interrupt handler */ - retval = request_irq(pdev->irq, tw_interrupt, SA_SHIRQ, "3w-xxxx", tw_dev); + retval = request_irq(pdev->irq, tw_interrupt, IRQF_SHARED, "3w-xxxx", tw_dev); if (retval) { printk(KERN_WARNING "3w-xxxx: Error requesting IRQ."); goto out_remove_host; diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index 3c683dc2354..eb7a6a4ded7 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c @@ -114,7 +114,6 @@ * */ #define NCR_700_VERSION "2.8" -#include <linux/config.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/string.h> diff --git a/drivers/scsi/53c7xx.c b/drivers/scsi/53c7xx.c index 765769a629e..c690c2b89e4 100644 --- a/drivers/scsi/53c7xx.c +++ b/drivers/scsi/53c7xx.c @@ -232,7 +232,6 @@ #include <linux/module.h> -#include <linux/config.h> #include <linux/types.h> #include <asm/setup.h> @@ -1071,7 +1070,7 @@ NCR53c7x0_init (struct Scsi_Host *host) { NCR53c7x0_driver_init (host); - if (request_irq(host->irq, NCR53c7x0_intr, SA_SHIRQ, "53c7xx", host)) + if (request_irq(host->irq, NCR53c7x0_intr, IRQF_SHARED, "53c7xx", host)) { printk("scsi%d : IRQ%d not free, detaching\n", host->host_no, host->irq); @@ -4233,7 +4232,7 @@ restart: * Purpose : handle NCR53c7x0 interrupts for all NCR devices sharing * the same IRQ line. * - * Inputs : Since we're using the SA_INTERRUPT interrupt handler + * Inputs : Since we're using the IRQF_DISABLED interrupt handler * semantics, irq indicates the interrupt which invoked * this handler. * diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c index bde3d5834ad..16a12a3b7b2 100644 --- a/drivers/scsi/BusLogic.c +++ b/drivers/scsi/BusLogic.c @@ -29,7 +29,6 @@ #define BusLogic_DriverVersion "2.1.16" #define BusLogic_DriverDate "18 July 2002" -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/interrupt.h> @@ -1845,7 +1844,7 @@ static boolean __init BusLogic_AcquireResources(struct BusLogic_HostAdapter *Hos /* Acquire shared access to the IRQ Channel. */ - if (request_irq(HostAdapter->IRQ_Channel, BusLogic_InterruptHandler, SA_SHIRQ, HostAdapter->FullModelName, HostAdapter) < 0) { + if (request_irq(HostAdapter->IRQ_Channel, BusLogic_InterruptHandler, IRQF_SHARED, HostAdapter->FullModelName, HostAdapter) < 0) { BusLogic_Error("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n", HostAdapter, HostAdapter->IRQ_Channel); return false; } diff --git a/drivers/scsi/BusLogic.h b/drivers/scsi/BusLogic.h index 1aaa6569eda..9792e5af525 100644 --- a/drivers/scsi/BusLogic.h +++ b/drivers/scsi/BusLogic.h @@ -28,7 +28,6 @@ #ifndef _BUSLOGIC_H #define _BUSLOGIC_H -#include <linux/config.h> #ifndef PACKED #define PACKED __attribute__((packed)) diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c index 8e3d949b711..7c006804958 100644 --- a/drivers/scsi/FlashPoint.c +++ b/drivers/scsi/FlashPoint.c @@ -15,7 +15,6 @@ */ -#include <linux/config.h> #ifndef CONFIG_SCSI_OMIT_FLASHPOINT diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 75f2f7ae2a8..616810ad17d 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c @@ -585,7 +585,7 @@ static int __init NCR5380_probe_irq(struct Scsi_Host *instance, int possible) NCR5380_setup(instance); for (trying_irqs = i = 0, mask = 1; i < 16; ++i, mask <<= 1) - if ((mask & possible) && (request_irq(i, &probe_intr, SA_INTERRUPT, "NCR-probe", NULL) == 0)) + if ((mask & possible) && (request_irq(i, &probe_intr, IRQF_DISABLED, "NCR-probe", NULL) == 0)) trying_irqs |= mask; timeout = jiffies + (250 * HZ / 1000); diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c index c7dd0154d01..8a4659e9410 100644 --- a/drivers/scsi/NCR53C9x.c +++ b/drivers/scsi/NCR53C9x.c @@ -23,7 +23,6 @@ #include <linux/module.h> -#include <linux/config.h> #include <linux/kernel.h> #include <linux/delay.h> #include <linux/types.h> diff --git a/drivers/scsi/NCR53C9x.h b/drivers/scsi/NCR53C9x.h index 65a9b377a41..481653c977c 100644 --- a/drivers/scsi/NCR53C9x.h +++ b/drivers/scsi/NCR53C9x.h @@ -13,7 +13,6 @@ #ifndef NCR53C9X_H #define NCR53C9X_H -#include <linux/config.h> #include <linux/interrupt.h> /* djweis for mac driver */ diff --git a/drivers/scsi/NCR_D700.c b/drivers/scsi/NCR_D700.c index 577e6349977..a06f547e87f 100644 --- a/drivers/scsi/NCR_D700.c +++ b/drivers/scsi/NCR_D700.c @@ -320,7 +320,7 @@ NCR_D700_probe(struct device *dev) memset(p, '\0', sizeof(*p)); p->dev = dev; snprintf(p->name, sizeof(p->name), "D700(%s)", dev->bus_id); - if (request_irq(irq, NCR_D700_intr, SA_SHIRQ, p->name, p)) { + if (request_irq(irq, NCR_D700_intr, IRQF_SHARED, p->name, p)) { printk(KERN_ERR "D700: request_irq failed\n"); kfree(p); return -EBUSY; diff --git a/drivers/scsi/NCR_Q720.c b/drivers/scsi/NCR_Q720.c index 9d18ec90510..c39ffbb86e3 100644 --- a/drivers/scsi/NCR_Q720.c +++ b/drivers/scsi/NCR_Q720.c @@ -265,7 +265,7 @@ NCR_Q720_probe(struct device *dev) p->irq = irq; p->siops = siops; - if (request_irq(irq, NCR_Q720_intr, SA_SHIRQ, "NCR_Q720", p)) { + if (request_irq(irq, NCR_Q720_intr, IRQF_SHARED, "NCR_Q720", p)) { printk(KERN_ERR "NCR_Q720: request irq %d failed\n", irq); goto out_release; } diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c index 3dce21c7873..d7e9fab54c6 100644 --- a/drivers/scsi/a100u2w.c +++ b/drivers/scsi/a100u2w.c @@ -1120,7 +1120,7 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev, shost->sg_tablesize = TOTAL_SG_ENTRY; /* Initial orc chip */ - error = request_irq(pdev->irq, inia100_intr, SA_SHIRQ, + error = request_irq(pdev->irq, inia100_intr, IRQF_SHARED, "inia100", shost); if (error < 0) { printk(KERN_WARNING "inia100: unable to get irq %d\n", diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c index 54996eaae97..fddfa2ebcd7 100644 --- a/drivers/scsi/a2091.c +++ b/drivers/scsi/a2091.c @@ -208,7 +208,7 @@ int __init a2091_detect(struct scsi_host_template *tpnt) regs.SASR = &(DMA(instance)->SASR); regs.SCMD = &(DMA(instance)->SCMD); wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10); - request_irq(IRQ_AMIGA_PORTS, a2091_intr, SA_SHIRQ, "A2091 SCSI", + request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED, "A2091 SCSI", instance); DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN; num_a2091++; diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c index f425d424bf0..ae9ab4b136a 100644 --- a/drivers/scsi/a3000.c +++ b/drivers/scsi/a3000.c @@ -190,7 +190,7 @@ int __init a3000_detect(struct scsi_host_template *tpnt) regs.SASR = &(DMA(a3000_host)->SASR); regs.SCMD = &(DMA(a3000_host)->SCMD); wd33c93_init(a3000_host, regs, dma_setup, dma_stop, WD33C93_FS_12_15); - if (request_irq(IRQ_AMIGA_PORTS, a3000_intr, SA_SHIRQ, "A3000 SCSI", + if (request_irq(IRQ_AMIGA_PORTS, a3000_intr, IRQF_SHARED, "A3000 SCSI", a3000_intr)) goto fail_irq; DMA(a3000_host)->CNTR = CNTR_PDMD | CNTR_INTEN; diff --git a/drivers/scsi/aacraid/rkt.c b/drivers/scsi/aacraid/rkt.c index 5b52966bbbf..458ea897fd7 100644 --- a/drivers/scsi/aacraid/rkt.c +++ b/drivers/scsi/aacraid/rkt.c @@ -453,7 +453,7 @@ int aac_rkt_init(struct aac_dev *dev) } msleep(1); } - if (request_irq(dev->scsi_host_ptr->irq, aac_rkt_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev)<0) + if (request_irq(dev->scsi_host_ptr->irq, aac_rkt_intr, IRQF_SHARED|IRQF_DISABLED, "aacraid", (void *)dev)<0) { printk(KERN_ERR "%s%d: Interrupt unavailable.\n", name, instance); goto error_iounmap; diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c index 9dadfb28b3f..035018db69b 100644 --- a/drivers/scsi/aacraid/rx.c +++ b/drivers/scsi/aacraid/rx.c @@ -453,7 +453,7 @@ int aac_rx_init(struct aac_dev *dev) } msleep(1); } - if (request_irq(dev->scsi_host_ptr->irq, aac_rx_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev)<0) + if (request_irq(dev->scsi_host_ptr->irq, aac_rx_intr, IRQF_SHARED|IRQF_DISABLED, "aacraid", (void *)dev)<0) { printk(KERN_ERR "%s%d: Interrupt unavailable.\n", name, instance); goto error_iounmap; diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c index 88d400fccc9..cd586cc8f9b 100644 --- a/drivers/scsi/aacraid/sa.c +++ b/drivers/scsi/aacraid/sa.c @@ -327,7 +327,7 @@ int aac_sa_init(struct aac_dev *dev) msleep(1); } - if (request_irq(dev->scsi_host_ptr->irq, aac_sa_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev ) < 0) { + if (request_irq(dev->scsi_host_ptr->irq, aac_sa_intr, IRQF_SHARED|IRQF_DISABLED, "aacraid", (void *)dev ) < 0) { printk(KERN_WARNING "%s%d: Interrupt unavailable.\n", name, instance); goto error_iounmap; } diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index dd9fb3d9100..e32b4ab2f8f 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -371,7 +371,7 @@ 1.5 (8/8/96): 1. Add support for ABP-940U (PCI Ultra) adapter. - 2. Add support for IRQ sharing by setting the SA_SHIRQ flag for + 2. Add support for IRQ sharing by setting the IRQF_SHARED flag for request_irq and supplying a dev_id pointer to both request_irq() and free_irq(). 3. In AscSearchIOPortAddr11() restore a call to check_region() which @@ -504,9 +504,9 @@ 3. For v2.1.93 and newer kernels use CONFIG_PCI and new PCI BIOS access functions. 4. Update board serial number printing. - 5. Try allocating an IRQ both with and without the SA_INTERRUPT + 5. Try allocating an IRQ both with and without the IRQF_DISABLED flag set to allow IRQ sharing with drivers that do not set - the SA_INTERRUPT flag. Also display a more descriptive error + the IRQF_DISABLED flag. Also display a more descriptive error message if request_irq() fails. 6. Update to latest Asc and Adv Libraries. @@ -754,7 +754,6 @@ * --- Linux Include Files */ -#include <linux/config.h> #include <linux/module.h> #if defined(CONFIG_X86) && !defined(CONFIG_ISA) @@ -5203,19 +5202,19 @@ advansys_detect(struct scsi_host_template *tpnt) /* Register IRQ Number. */ ASC_DBG1(2, "advansys_detect: request_irq() %d\n", shp->irq); /* - * If request_irq() fails with the SA_INTERRUPT flag set, - * then try again without the SA_INTERRUPT flag set. This + * If request_irq() fails with the IRQF_DISABLED flag set, + * then try again without the IRQF_DISABLED flag set. This * allows IRQ sharing to work even with other drivers that - * do not set the SA_INTERRUPT flag. + * do not set the IRQF_DISABLED flag. * - * If SA_INTERRUPT is not set, then interrupts are enabled + * If IRQF_DISABLED is not set, then interrupts are enabled * before the driver interrupt function is called. */ if (((ret = request_irq(shp->irq, advansys_interrupt, - SA_INTERRUPT | (share_irq == TRUE ? SA_SHIRQ : 0), + IRQF_DISABLED | (share_irq == TRUE ? IRQF_SHARED : 0), "advansys", boardp)) != 0) && ((ret = request_irq(shp->irq, advansys_interrupt, - (share_irq == TRUE ? SA_SHIRQ : 0), + (share_irq == TRUE ? IRQF_SHARED : 0), "advansys", boardp)) != 0)) { if (ret == -EBUSY) { diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index de80cdfb5b9..36e63f82d9f 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c @@ -855,7 +855,7 @@ struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *setup) SETPORT(SIMODE0, 0); SETPORT(SIMODE1, 0); - if( request_irq(shpnt->irq, swintr, SA_INTERRUPT|SA_SHIRQ, "aha152x", shpnt) ) { + if( request_irq(shpnt->irq, swintr, IRQF_DISABLED|IRQF_SHARED, "aha152x", shpnt) ) { printk(KERN_ERR "aha152x%d: irq %d busy.\n", shpnt->host_no, shpnt->irq); goto out_host_put; } @@ -889,7 +889,7 @@ struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *setup) SETPORT(SSTAT0, 0x7f); SETPORT(SSTAT1, 0xef); - if ( request_irq(shpnt->irq, intr, SA_INTERRUPT|SA_SHIRQ, "aha152x", shpnt) ) { + if ( request_irq(shpnt->irq, intr, IRQF_DISABLED|IRQF_SHARED, "aha152x", shpnt) ) { printk(KERN_ERR "aha152x%d: failed to reassign irq %d.\n", shpnt->host_no, shpnt->irq); goto out_host_put; } diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index 86c6bd23459..24f0f546179 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c @@ -25,7 +25,6 @@ * Added proper detection of the AHA-1640 (MCA version of AHA-1540) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/kernel.h> diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c index 4b8c6a54392..0e4a7ebe300 100644 --- a/drivers/scsi/aha1740.c +++ b/drivers/scsi/aha1740.c @@ -634,7 +634,7 @@ static int aha1740_probe (struct device *dev) } DEB(printk("aha1740_probe: enable interrupt channel %d\n",irq_level)); - if (request_irq(irq_level,aha1740_intr_handle,irq_type ? 0 : SA_SHIRQ, + if (request_irq(irq_level,aha1740_intr_handle,irq_type ? 0 : IRQF_SHARED, "aha1740",shpnt)) { printk(KERN_ERR "aha1740_probe: Unable to allocate IRQ %d.\n", irq_level); diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index f0594677771..15f6cd4279b 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c @@ -1371,7 +1371,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) probe_ent->port_ops = ahci_port_info[board_idx].port_ops; probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + probe_ent->irq_flags = IRQF_SHARED; probe_ent->mmio_base = mmio_base; probe_ent->private_data = hpriv; diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c index d754b326786..867cbe23579 100644 --- a/drivers/scsi/aic7xxx/aic7770_osm.c +++ b/drivers/scsi/aic7xxx/aic7770_osm.c @@ -65,7 +65,7 @@ aic7770_map_int(struct ahc_softc *ahc, u_int irq) shared = 0; if ((ahc->flags & AHC_EDGE_INTERRUPT) == 0) - shared = SA_SHIRQ; + shared = IRQF_SHARED; error = request_irq(irq, ahc_linux_isr, shared, "aic7xxx", ahc); if (error == 0) diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h index 2b8331649ee..92c6154575e 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.h +++ b/drivers/scsi/aic7xxx/aic79xx_osm.h @@ -42,7 +42,6 @@ #ifndef _AIC79XX_LINUX_H_ #define _AIC79XX_LINUX_H_ -#include <linux/config.h> #include <linux/types.h> #include <linux/blkdev.h> #include <linux/delay.h> diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c index ebbf7e4ff4c..50a41eda580 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c @@ -342,7 +342,7 @@ ahd_pci_map_int(struct ahd_softc *ahd) int error; error = request_irq(ahd->dev_softc->irq, ahd_linux_isr, - SA_SHIRQ, "aic79xx", ahd); + IRQF_SHARED, "aic79xx", ahd); if (!error) ahd->platform_data->irq = ahd->dev_softc->irq; diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index a20b08c9ff1..d42a71ee076 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h @@ -59,7 +59,6 @@ #ifndef _AIC7XXX_LINUX_H_ #define _AIC7XXX_LINUX_H_ -#include <linux/config.h> #include <linux/types.h> #include <linux/blkdev.h> #include <linux/delay.h> diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c index 0c9c2f400bf..7e42f07a27f 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c @@ -375,7 +375,7 @@ ahc_pci_map_int(struct ahc_softc *ahc) int error; error = request_irq(ahc->dev_softc->irq, ahc_linux_isr, - SA_SHIRQ, "aic7xxx", ahc); + IRQF_SHARED, "aic7xxx", ahc); if (error == 0) ahc->platform_data->irq = ahc->dev_softc->irq; diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c index 5dba1c63122..3f85b5e978f 100644 --- a/drivers/scsi/aic7xxx_old.c +++ b/drivers/scsi/aic7xxx_old.c @@ -8322,11 +8322,11 @@ aic7xxx_register(struct scsi_host_template *template, struct aic7xxx_host *p, } else { - result = (request_irq(p->irq, do_aic7xxx_isr, SA_SHIRQ, + result = (request_irq(p->irq, do_aic7xxx_isr, IRQF_SHARED, "aic7xxx", p)); if (result < 0) { - result = (request_irq(p->irq, do_aic7xxx_isr, SA_INTERRUPT | SA_SHIRQ, + result = (request_irq(p->irq, do_aic7xxx_isr, IRQF_DISABLED | IRQF_SHARED, "aic7xxx", p)); } } diff --git a/drivers/scsi/aic7xxx_old/aic7xxx_proc.c b/drivers/scsi/aic7xxx_old/aic7xxx_proc.c index 3bf334931a8..b07e4f04fd0 100644 --- a/drivers/scsi/aic7xxx_old/aic7xxx_proc.c +++ b/drivers/scsi/aic7xxx_old/aic7xxx_proc.c @@ -29,7 +29,6 @@ * $Id: aic7xxx_proc.c,v 4.1 1997/06/97 08:23:42 deang Exp $ *-M*************************************************************************/ -#include <linux/config.h> #define BLS (&aic7xxx_buffer[size]) #define HDRB \ diff --git a/drivers/scsi/amiga7xx.c b/drivers/scsi/amiga7xx.c index c0844fa32c5..9099d531d5a 100644 --- a/drivers/scsi/amiga7xx.c +++ b/drivers/scsi/amiga7xx.c @@ -11,7 +11,6 @@ #include <linux/mm.h> #include <linux/blkdev.h> #include <linux/sched.h> -#include <linux/config.h> #include <linux/zorro.h> #include <linux/stat.h> diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c index dda5a5f79c5..7621e3fa37b 100644 --- a/drivers/scsi/arm/acornscsi.c +++ b/drivers/scsi/arm/acornscsi.c @@ -129,7 +129,6 @@ #define STRx(x) STRINGIFY(x) #define NO_WRITE_STR STRx(NO_WRITE) -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -3031,7 +3030,7 @@ acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id) if (!request_region(host->io_port, 2048, "acornscsi(ram)")) goto err_5; - ret = request_irq(host->irq, acornscsi_intr, SA_INTERRUPT, "acornscsi", ashost); + ret = request_irq(host->irq, acornscsi_intr, IRQF_DISABLED, "acornscsi", ashost); if (ret) { printk(KERN_CRIT "scsi%d: IRQ%d not free: %d\n", host->host_no, ashost->scsi.irq, ret); diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c index e6c9491dc5c..3bdfc36481a 100644 --- a/drivers/scsi/arm/cumana_1.c +++ b/drivers/scsi/arm/cumana_1.c @@ -277,7 +277,7 @@ cumanascsi1_probe(struct expansion_card *ec, const struct ecard_id *id) ((struct NCR5380_hostdata *)host->hostdata)->ctrl = 0; outb(0x00, host->io_port - 577); - ret = request_irq(host->irq, cumanascsi_intr, SA_INTERRUPT, + ret = request_irq(host->irq, cumanascsi_intr, IRQF_DISABLED, "CumanaSCSI-1", host); if (ret) { printk("scsi%d: IRQ%d not free: %d\n", diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c index fad2109268b..719af0dcc0e 100644 --- a/drivers/scsi/arm/cumana_2.c +++ b/drivers/scsi/arm/cumana_2.c @@ -460,7 +460,7 @@ cumanascsi2_probe(struct expansion_card *ec, const struct ecard_id *id) goto out_free; ret = request_irq(ec->irq, cumanascsi_2_intr, - SA_INTERRUPT, "cumanascsi2", info); + IRQF_DISABLED, "cumanascsi2", info); if (ret) { printk("scsi%d: IRQ%d not free: %d\n", host->host_no, ec->irq, ret); diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c index 3d69f6c45a6..b2c346a4705 100644 --- a/drivers/scsi/arm/powertec.c +++ b/drivers/scsi/arm/powertec.c @@ -373,7 +373,7 @@ powertecscsi_probe(struct expansion_card *ec, const struct ecard_id *id) goto out_free; ret = request_irq(ec->irq, powertecscsi_intr, - SA_INTERRUPT, "powertec", info); + IRQF_DISABLED, "powertec", info); if (ret) { printk("scsi%d: IRQ%d not free: %d\n", host->host_no, ec->irq, ret); diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c index 57295bcea3e..007a14e5c3f 100644 --- a/drivers/scsi/atari_NCR5380.c +++ b/drivers/scsi/atari_NCR5380.c @@ -524,7 +524,6 @@ static __inline__ void initialize_SCp(Scsi_Cmnd *cmd) } } -#include <linux/config.h> #include <linux/delay.h> #if NDEBUG diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c index f677c5a32a6..e1be4a4387c 100644 --- a/drivers/scsi/atari_scsi.c +++ b/drivers/scsi/atari_scsi.c @@ -65,7 +65,6 @@ -#include <linux/config.h> #include <linux/module.h> #define NDEBUG (0) diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index 3ee4d4d3f44..412f8301b75 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c @@ -2751,7 +2751,7 @@ flash_ok_880: goto unregister; } - if (request_irq(pdev->irq, atp870u_intr_handle, SA_SHIRQ, "atp880i", shpnt)) { + if (request_irq(pdev->irq, atp870u_intr_handle, IRQF_SHARED, "atp880i", shpnt)) { printk(KERN_ERR "Unable to allocate IRQ%d for Acard controller.\n", pdev->irq); goto free_tables; } @@ -2822,7 +2822,7 @@ flash_ok_880: #ifdef ED_DBGP printk("request_irq() shpnt %p hostdata %p\n", shpnt, p); #endif - if (request_irq(pdev->irq, atp870u_intr_handle, SA_SHIRQ, "atp870u", shpnt)) { + if (request_irq(pdev->irq, atp870u_intr_handle, IRQF_SHARED, "atp870u", shpnt)) { printk(KERN_ERR "Unable to allocate IRQ for Acard controller.\n"); goto free_tables; } @@ -3004,7 +3004,7 @@ flash_ok_885: if (atp870u_init_tables(shpnt) < 0) goto unregister; - if (request_irq(pdev->irq, atp870u_intr_handle, SA_SHIRQ, "atp870i", shpnt)) { + if (request_irq(pdev->irq, atp870u_intr_handle, IRQF_SHARED, "atp870i", shpnt)) { printk(KERN_ERR "Unable to allocate IRQ%d for Acard controller.\n", pdev->irq); goto free_tables; } diff --git a/drivers/scsi/blz1230.c b/drivers/scsi/blz1230.c index 3867ac2de4c..329a8f297b3 100644 --- a/drivers/scsi/blz1230.c +++ b/drivers/scsi/blz1230.c @@ -172,7 +172,7 @@ int __init blz1230_esp_detect(struct scsi_host_template *tpnt) esp->irq = IRQ_AMIGA_PORTS; esp->slot = board+REAL_BLZ1230_ESP_ADDR; - if (request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, + if (request_irq(IRQ_AMIGA_PORTS, esp_intr, IRQF_SHARED, "Blizzard 1230 SCSI IV", esp->ehost)) goto err_out; diff --git a/drivers/scsi/blz2060.c b/drivers/scsi/blz2060.c index 4ebe69e3275..b6c137b9735 100644 --- a/drivers/scsi/blz2060.c +++ b/drivers/scsi/blz2060.c @@ -146,7 +146,7 @@ int __init blz2060_esp_detect(struct scsi_host_template *tpnt) esp->esp_command_dvma = virt_to_bus((void *)cmd_buffer); esp->irq = IRQ_AMIGA_PORTS; - request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, + request_irq(IRQ_AMIGA_PORTS, esp_intr, IRQF_SHARED, "Blizzard 2060 SCSI", esp->ehost); /* Figure out our scsi ID on the bus */ diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index d9abd1645d1..f6caa430776 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -7,7 +7,6 @@ #define VERSION "0.25" -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/fs.h> diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index d92d5040a9f..dddd2acce76 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -7,7 +7,6 @@ * Additions for SPC-3 T10/1416-D Rev 21 22 Sept 2004, D. Gilbert 20041025 */ -#include <linux/config.h> #include <linux/blkdev.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/scsi/cyberstorm.c b/drivers/scsi/cyberstorm.c index a4a4fac5c0a..7c7cfb54e89 100644 --- a/drivers/scsi/cyberstorm.c +++ b/drivers/scsi/cyberstorm.c @@ -172,7 +172,7 @@ int __init cyber_esp_detect(struct scsi_host_template *tpnt) esp->esp_command_dvma = virt_to_bus((void *)cmd_buffer); esp->irq = IRQ_AMIGA_PORTS; - request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, + request_irq(IRQ_AMIGA_PORTS, esp_intr, IRQF_SHARED, "CyberStorm SCSI", esp->ehost); /* Figure out our scsi ID on the bus */ /* The DMA cond flag contains a hardcoded jumper bit diff --git a/drivers/scsi/cyberstormII.c b/drivers/scsi/cyberstormII.c index 3a803d73bc5..d88cb9cf091 100644 --- a/drivers/scsi/cyberstormII.c +++ b/drivers/scsi/cyberstormII.c @@ -153,7 +153,7 @@ int __init cyberII_esp_detect(struct scsi_host_template *tpnt) esp->esp_command_dvma = virt_to_bus((void *)cmd_buffer); esp->irq = IRQ_AMIGA_PORTS; - request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, + request_irq(IRQ_AMIGA_PORTS, esp_intr, IRQF_SHARED, "CyberStorm SCSI Mk II", esp->ehost); /* Figure out our scsi ID on the bus */ diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index 58b0748045e..ff2b1796fa3 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c @@ -4562,7 +4562,7 @@ static int __devinit adapter_init(struct AdapterCtlBlk *acb, acb->io_port_base = io_port; acb->io_port_len = io_port_len; - if (request_irq(irq, dc395x_interrupt, SA_SHIRQ, DC395X_NAME, acb)) { + if (request_irq(irq, dc395x_interrupt, IRQF_SHARED, DC395X_NAME, acb)) { /* release the region we just claimed */ dprintkl(KERN_INFO, "Failed to register IRQ\n"); goto failed; diff --git a/drivers/scsi/dec_esp.c b/drivers/scsi/dec_esp.c index a35ee43a48d..eb32062f7e6 100644 --- a/drivers/scsi/dec_esp.c +++ b/drivers/scsi/dec_esp.c @@ -202,19 +202,19 @@ static int dec_esp_detect(struct scsi_host_template * tpnt) esp_initialize(esp); - if (request_irq(esp->irq, esp_intr, SA_INTERRUPT, + if (request_irq(esp->irq, esp_intr, IRQF_DISABLED, "ncr53c94", esp->ehost)) goto err_dealloc; if (request_irq(dec_interrupt[DEC_IRQ_ASC_MERR], - scsi_dma_merr_int, SA_INTERRUPT, + scsi_dma_merr_int, IRQF_DISABLED, "ncr53c94 error", esp->ehost)) goto err_free_irq; if (request_irq(dec_interrupt[DEC_IRQ_ASC_ERR], - scsi_dma_err_int, SA_INTERRUPT, + scsi_dma_err_int, IRQF_DISABLED, "ncr53c94 overrun", esp->ehost)) goto err_free_irq_merr; if (request_irq(dec_interrupt[DEC_IRQ_ASC_DMA], - scsi_dma_int, SA_INTERRUPT, + scsi_dma_int, IRQF_DISABLED, "ncr53c94 dma", esp->ehost)) goto err_free_irq_err; @@ -276,7 +276,7 @@ static int dec_esp_detect(struct scsi_host_template * tpnt) esp->dma_mmu_release_scsi_sgl = 0; esp->dma_advance_sg = 0; - if (request_irq(esp->irq, esp_intr, SA_INTERRUPT, + if (request_irq(esp->irq, esp_intr, IRQF_DISABLED, "PMAZ_AA", esp->ehost)) { esp_deallocate(esp); release_tc_card(slot); diff --git a/drivers/scsi/dmx3191d.c b/drivers/scsi/dmx3191d.c index 38e4010eff9..879a2665767 100644 --- a/drivers/scsi/dmx3191d.c +++ b/drivers/scsi/dmx3191d.c @@ -94,7 +94,7 @@ static int __devinit dmx3191d_probe_one(struct pci_dev *pdev, NCR5380_init(shost, FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E); - if (request_irq(pdev->irq, NCR5380_intr, SA_SHIRQ, + if (request_irq(pdev->irq, NCR5380_intr, IRQF_SHARED, DMX3191D_DRIVER_NAME, shost)) { /* * Steam powered scsi controllers run without an IRQ anyway diff --git a/drivers/scsi/dpt/dpti_i2o.h b/drivers/scsi/dpt/dpti_i2o.h index a9585f5235d..d84a281ad94 100644 --- a/drivers/scsi/dpt/dpti_i2o.h +++ b/drivers/scsi/dpt/dpti_i2o.h @@ -23,7 +23,6 @@ #include <asm/semaphore.h> /* Needed for MUTEX init macros */ #include <linux/version.h> -#include <linux/config.h> #include <linux/notifier.h> #include <asm/atomic.h> diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index b1b704a42ef..e1337339cac 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c @@ -1009,7 +1009,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev printk(KERN_INFO" BAR1 %p - size= %x\n",msg_addr_virt,hba_map1_area_size); } - if (request_irq (pDev->irq, adpt_isr, SA_SHIRQ, pHba->name, pHba)) { + if (request_irq (pDev->irq, adpt_isr, IRQF_SHARED, pHba->name, pHba)) { printk(KERN_ERR"%s: Couldn't register IRQ %d\n", pHba->name, pDev->irq); adpt_i2o_delete_hba(pHba); return -EINVAL; diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c index c5108c8c887..0d5713dfa20 100644 --- a/drivers/scsi/dtc.c +++ b/drivers/scsi/dtc.c @@ -280,7 +280,7 @@ found: /* With interrupts enabled, it will sometimes hang when doing heavy * reads. So better not enable them until I finger it out. */ if (instance->irq != SCSI_IRQ_NONE) - if (request_irq(instance->irq, dtc_intr, SA_INTERRUPT, "dtc", instance)) { + if (request_irq(instance->irq, dtc_intr, IRQF_DISABLED, "dtc", instance)) { printk(KERN_ERR "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); instance->irq = SCSI_IRQ_NONE; } diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c index 059eeee4b55..a5ff43b1b26 100644 --- a/drivers/scsi/eata.c +++ b/drivers/scsi/eata.c @@ -477,7 +477,6 @@ * the driver sets host->wish_block = 1 for all ISA boards. */ -#include <linux/config.h> #include <linux/string.h> #include <linux/kernel.h> #include <linux/ioport.h> @@ -1222,7 +1221,7 @@ static int port_detect(unsigned long port_base, unsigned int j, /* Board detected, allocate its IRQ */ if (request_irq(irq, do_interrupt_handler, - SA_INTERRUPT | ((subversion == ESA) ? SA_SHIRQ : 0), + IRQF_DISABLED | ((subversion == ESA) ? IRQF_SHARED : 0), driver_name, (void *)&sha[j])) { printk("%s: unable to allocate IRQ %u, detaching.\n", name, irq); diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c index 23beb48c79c..771b01984cb 100644 --- a/drivers/scsi/eata_pio.c +++ b/drivers/scsi/eata_pio.c @@ -46,7 +46,6 @@ * last change: 2002/11/02 OS: Linux 2.5.45 * ************************************************************/ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -732,7 +731,7 @@ static int register_pio_HBA(long base, struct get_conf *gc) return 0; if (!reg_IRQ[gc->IRQ]) { /* Interrupt already registered ? */ - if (!request_irq(gc->IRQ, do_eata_pio_int_handler, SA_INTERRUPT, "EATA-PIO", sh)) { + if (!request_irq(gc->IRQ, do_eata_pio_int_handler, IRQF_DISABLED, "EATA-PIO", sh)) { reg_IRQ[gc->IRQ]++; if (!gc->IRQ_TR) reg_IRQL[gc->IRQ] = 1; /* IRQ is edge triggered */ @@ -966,7 +965,7 @@ static int eata_pio_detect(struct scsi_host_template *tpnt) for (i = 0; i <= MAXIRQ; i++) if (reg_IRQ[i]) - request_irq(i, do_eata_pio_int_handler, SA_INTERRUPT, "EATA-PIO", NULL); + request_irq(i, do_eata_pio_int_handler, IRQF_DISABLED, "EATA-PIO", NULL); HBA_ptr = first_HBA; diff --git a/drivers/scsi/esp.c b/drivers/scsi/esp.c index ddb512463b4..10573c24a50 100644 --- a/drivers/scsi/esp.c +++ b/drivers/scsi/esp.c @@ -12,7 +12,6 @@ * 3) Add tagged queueing. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/delay.h> #include <linux/types.h> @@ -779,7 +778,7 @@ static int __init esp_register_irq(struct esp *esp) * sanely maintain. */ if (request_irq(esp->ehost->irq, esp_intr, - SA_SHIRQ, "ESP SCSI", esp)) { + IRQF_SHARED, "ESP SCSI", esp)) { printk("esp%d: Cannot acquire irq line\n", esp->esp_id); return -1; diff --git a/drivers/scsi/fastlane.c b/drivers/scsi/fastlane.c index 8ae9c406a83..2a1c5c22b9e 100644 --- a/drivers/scsi/fastlane.c +++ b/drivers/scsi/fastlane.c @@ -210,7 +210,7 @@ int __init fastlane_esp_detect(struct scsi_host_template *tpnt) esp->irq = IRQ_AMIGA_PORTS; esp->slot = board+FASTLANE_ESP_ADDR; - if (request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, + if (request_irq(IRQ_AMIGA_PORTS, esp_intr, IRQF_SHARED, "Fastlane SCSI", esp->ehost)) { printk(KERN_WARNING "Fastlane: Could not get IRQ%d, aborting.\n", IRQ_AMIGA_PORTS); goto err_unmap; diff --git a/drivers/scsi/fcal.c b/drivers/scsi/fcal.c index 03416548f20..7f891023aa1 100644 --- a/drivers/scsi/fcal.c +++ b/drivers/scsi/fcal.c @@ -13,7 +13,6 @@ #include <linux/proc_fs.h> #include <linux/stat.h> #include <linux/init.h> -#include <linux/config.h> #ifdef CONFIG_KMOD #include <linux/kmod.h> #endif diff --git a/drivers/scsi/fd_mcs.c b/drivers/scsi/fd_mcs.c index 70a1606bd58..dde3edf35c0 100644 --- a/drivers/scsi/fd_mcs.c +++ b/drivers/scsi/fd_mcs.c @@ -400,7 +400,7 @@ static int fd_mcs_detect(struct scsi_host_template * tpnt) mca_set_adapter_name(slot - 1, fd_mcs_adapters[loop].name); /* check irq/region */ - if (request_irq(irq, fd_mcs_intr, SA_SHIRQ, "fd_mcs", hosts)) { + if (request_irq(irq, fd_mcs_intr, IRQF_SHARED, "fd_mcs", hosts)) { printk(KERN_ERR "fd_mcs: interrupt is not available, skipping...\n"); continue; } diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c index e16013f0ad6..b0694dcce24 100644 --- a/drivers/scsi/fdomain.c +++ b/drivers/scsi/fdomain.c @@ -266,7 +266,6 @@ **************************************************************************/ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/interrupt.h> @@ -950,7 +949,7 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt ) /* Register the IRQ with the kernel */ retcode = request_irq( interrupt_level, - do_fdomain_16x0_intr, pdev?SA_SHIRQ:0, "fdomain", shpnt); + do_fdomain_16x0_intr, pdev?IRQF_SHARED:0, "fdomain", shpnt); if (retcode < 0) { if (retcode == -EINVAL) { diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index 5f313c93b7a..67f1100f310 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c @@ -91,7 +91,6 @@ #define AUTOPROBE_IRQ #define AUTOSENSE -#include <linux/config.h> #ifdef CONFIG_SCSI_GENERIC_NCR53C400 #define NCR53C400_PSEUDO_DMA 1 @@ -462,7 +461,7 @@ int __init generic_NCR5380_detect(struct scsi_host_template * tpnt) instance->irq = NCR5380_probe_irq(instance, 0xffff); if (instance->irq != SCSI_IRQ_NONE) - if (request_irq(instance->irq, generic_NCR5380_intr, SA_INTERRUPT, "NCR5380", instance)) { + if (request_irq(instance->irq, generic_NCR5380_intr, IRQF_DISABLED, "NCR5380", instance)) { printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); instance->irq = SCSI_IRQ_NONE; } diff --git a/drivers/scsi/g_NCR5380.h b/drivers/scsi/g_NCR5380.h index d60a89cb805..df0b3f69ef6 100644 --- a/drivers/scsi/g_NCR5380.h +++ b/drivers/scsi/g_NCR5380.h @@ -32,7 +32,6 @@ #ifndef GENERIC_NCR5380_H #define GENERIC_NCR5380_H -#include <linux/config.h> #define GENERIC_NCR5380_PUBLIC_RELEASE 1 diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 76071a15830..43afd476e60 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c @@ -4350,7 +4350,7 @@ static int __init gdth_detect(Scsi_Host_Template *shtp) printk("Configuring GDT-ISA HA at BIOS 0x%05X IRQ %u DRQ %u\n", isa_bios,ha->irq,ha->drq); - if (request_irq(ha->irq,gdth_interrupt,SA_INTERRUPT,"gdth",ha)) { + if (request_irq(ha->irq,gdth_interrupt,IRQF_DISABLED,"gdth",ha)) { printk("GDT-ISA: Unable to allocate IRQ\n"); scsi_unregister(shp); continue; @@ -4476,7 +4476,7 @@ static int __init gdth_detect(Scsi_Host_Template *shtp) printk("Configuring GDT-EISA HA at Slot %d IRQ %u\n", eisa_slot>>12,ha->irq); - if (request_irq(ha->irq,gdth_interrupt,SA_INTERRUPT,"gdth",ha)) { + if (request_irq(ha->irq,gdth_interrupt,IRQF_DISABLED,"gdth",ha)) { printk("GDT-EISA: Unable to allocate IRQ\n"); scsi_unregister(shp); continue; @@ -4603,7 +4603,7 @@ static int __init gdth_detect(Scsi_Host_Template *shtp) pcistr[ctr].bus,PCI_SLOT(pcistr[ctr].device_fn),ha->irq); if (request_irq(ha->irq, gdth_interrupt, - SA_INTERRUPT|SA_SHIRQ, "gdth", ha)) + IRQF_DISABLED|IRQF_SHARED, "gdth", ha)) { printk("GDT-PCI: Unable to allocate IRQ\n"); scsi_unregister(shp); diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c index 5b154498056..a0d831b1bad 100644 --- a/drivers/scsi/gvp11.c +++ b/drivers/scsi/gvp11.c @@ -328,7 +328,7 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10 : WD33C93_FS_12_15); - request_irq(IRQ_AMIGA_PORTS, gvp11_intr, SA_SHIRQ, "GVP11 SCSI", + request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED, "GVP11 SCSI", instance); DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE; num_gvp11++; diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index f77808329e7..ab2f8b26790 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c @@ -1304,7 +1304,7 @@ static int __devinit hptiop_probe(struct pci_dev *pcidev, pci_set_drvdata(pcidev, host); - if (request_irq(pcidev->irq, hptiop_intr, SA_SHIRQ, + if (request_irq(pcidev->irq, hptiop_intr, IRQF_SHARED, driver_name, hba)) { printk(KERN_ERR "scsi%d: request irq %d failed\n", hba->host->host_no, pcidev->irq); diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c index 497f6642b2d..2be1dc5d852 100644 --- a/drivers/scsi/ibmmca.c +++ b/drivers/scsi/ibmmca.c @@ -17,7 +17,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> @@ -1511,7 +1510,7 @@ int ibmmca_detect(struct scsi_host_template * scsi_template) #endif /* get interrupt request level */ - if (request_irq(IM_IRQ, interrupt_handler, SA_SHIRQ, "ibmmcascsi", hosts)) { + if (request_irq(IM_IRQ, interrupt_handler, IRQF_SHARED, "ibmmcascsi", hosts)) { printk(KERN_ERR "IBM MCA SCSI: Unable to get shared IRQ %d.\n", IM_IRQ); return 0; } else @@ -1636,7 +1635,7 @@ int ibmmca_detect(struct scsi_host_template * scsi_template) /* IRQ11 is used by SCSI-2 F/W Adapter/A */ printk(KERN_DEBUG "IBM MCA SCSI: SCSI-2 F/W adapter needs IRQ 11.\n"); /* get interrupt request level */ - if (request_irq(IM_IRQ_FW, interrupt_handler, SA_SHIRQ, "ibmmcascsi", hosts)) { + if (request_irq(IM_IRQ_FW, interrupt_handler, IRQF_SHARED, "ibmmcascsi", hosts)) { printk(KERN_ERR "IBM MCA SCSI: Unable to get shared IRQ %d.\n", IM_IRQ_FW); } else IRQ11_registered++; @@ -1697,7 +1696,7 @@ int ibmmca_detect(struct scsi_host_template * scsi_template) /* IRQ11 is used by SCSI-2 F/W Adapter/A */ printk(KERN_DEBUG "IBM MCA SCSI: SCSI-2 F/W adapter needs IRQ 11.\n"); /* get interrupt request level */ - if (request_irq(IM_IRQ_FW, interrupt_handler, SA_SHIRQ, "ibmmcascsi", hosts)) + if (request_irq(IM_IRQ_FW, interrupt_handler, IRQF_SHARED, "ibmmcascsi", hosts)) printk(KERN_ERR "IBM MCA SCSI: Unable to get shared IRQ %d.\n", IM_IRQ_FW); else IRQ11_registered++; diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 988e6f7af01..f7b5d7372d2 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c @@ -34,7 +34,6 @@ #define IDESCSI_VERSION "0.92" #include <linux/module.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/string.h> #include <linux/kernel.h> diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index 681bd18493f..2d95ac9c32c 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c @@ -8,7 +8,6 @@ * future expansion to five letters. */ -#include <linux/config.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h> diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c index 883bc92b4d9..59a4097f125 100644 --- a/drivers/scsi/in2000.c +++ b/drivers/scsi/in2000.c @@ -2015,7 +2015,7 @@ static int __init in2000_detect(struct scsi_host_template * tpnt) write1_io(0, IO_FIFO_READ); /* start fifo out in read mode */ write1_io(0, IO_INTR_MASK); /* allow all ints */ x = int_tab[(switches & (SW_INT0 | SW_INT1)) >> SW_INT_SHIFT]; - if (request_irq(x, in2000_intr, SA_INTERRUPT, "in2000", instance)) { + if (request_irq(x, in2000_intr, IRQF_DISABLED, "in2000", instance)) { printk("in2000_detect: Unable to allocate IRQ.\n"); detect_count--; continue; diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c index 913ba95f85b..9e10dac61cf 100644 --- a/drivers/scsi/initio.c +++ b/drivers/scsi/initio.c @@ -118,7 +118,6 @@ #include <linux/blkdev.h> #include <linux/spinlock.h> #include <linux/stat.h> -#include <linux/config.h> #include <linux/kernel.h> #include <linux/proc_fs.h> #include <linux/string.h> @@ -2868,7 +2867,7 @@ static int i91u_detect(struct scsi_host_template * tpnt) hreg->sg_tablesize = TOTAL_SG_ENTRY; /* Maximun support is 32 */ /* Initial tulip chip */ - ok = request_irq(pHCB->HCS_Intr, i91u_intr, SA_INTERRUPT | SA_SHIRQ, "i91u", hreg); + ok = request_irq(pHCB->HCS_Intr, i91u_intr, IRQF_DISABLED | IRQF_SHARED, "i91u", hreg); if (ok < 0) { printk(KERN_WARNING "i91u: unable to request IRQ %d\n\n", pHCB->HCS_Intr); return 0; diff --git a/drivers/scsi/initio.h b/drivers/scsi/initio.h index 3efb1184fc3..acb67a4af2c 100644 --- a/drivers/scsi/initio.h +++ b/drivers/scsi/initio.h @@ -54,7 +54,6 @@ **************************************************************************/ -#include <linux/config.h> #include <linux/types.h> #define ULONG unsigned long @@ -193,13 +192,13 @@ typedef struct { #define TSC_SEL_ATN_DIRECT_OUT 0x15 /* Select With ATN Sequence */ #define TSC_SEL_ATN3_DIRECT_IN 0xB5 /* Select With ATN3 Sequence */ #define TSC_SEL_ATN3_DIRECT_OUT 0x35 /* Select With ATN3 Sequence */ -#define TSC_XF_DMA_OUT_DIRECT 0x06 /* DMA Xfer Infomation out */ -#define TSC_XF_DMA_IN_DIRECT 0x86 /* DMA Xfer Infomation in */ +#define TSC_XF_DMA_OUT_DIRECT 0x06 /* DMA Xfer Information out */ +#define TSC_XF_DMA_IN_DIRECT 0x86 /* DMA Xfer Information in */ -#define TSC_XF_DMA_OUT 0x43 /* DMA Xfer Infomation out */ -#define TSC_XF_DMA_IN 0xC3 /* DMA Xfer Infomation in */ -#define TSC_XF_FIFO_OUT 0x03 /* FIFO Xfer Infomation out */ -#define TSC_XF_FIFO_IN 0x83 /* FIFO Xfer Infomation in */ +#define TSC_XF_DMA_OUT 0x43 /* DMA Xfer Information out */ +#define TSC_XF_DMA_IN 0xC3 /* DMA Xfer Information in */ +#define TSC_XF_FIFO_OUT 0x03 /* FIFO Xfer Information out */ +#define TSC_XF_FIFO_IN 0x83 /* FIFO Xfer Information in */ #define TSC_MSG_ACCEPT 0x0F /* Message Accept */ diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 96b65b307dd..01080b3acf5 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -54,7 +54,6 @@ * */ -#include <linux/config.h> #include <linux/fs.h> #include <linux/init.h> #include <linux/types.h> @@ -6429,7 +6428,7 @@ static int __devinit ipr_probe_ioa(struct pci_dev *pdev, ioa_cfg->needs_hard_reset = 1; ipr_mask_and_clear_interrupts(ioa_cfg, ~IPR_PCII_IOA_TRANS_TO_OPER); - rc = request_irq(pdev->irq, ipr_isr, SA_SHIRQ, IPR_NAME, ioa_cfg); + rc = request_irq(pdev->irq, ipr_isr, IRQF_SHARED, IPR_NAME, ioa_cfg); if (rc) { dev_err(&pdev->dev, "Couldn't register IRQ %d! rc=%d\n", diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 78f2ff736c3..3c639286ec1 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c @@ -196,7 +196,6 @@ #include <linux/module.h> #include <linux/stat.h> -#include <linux/config.h> #include <linux/spinlock.h> #include <linux/init.h> @@ -7008,7 +7007,7 @@ ips_register_scsi(int index) memcpy(ha, oldha, sizeof (ips_ha_t)); free_irq(oldha->irq, oldha); /* Install the interrupt handler with the new ha */ - if (request_irq(ha->irq, do_ipsintr, SA_SHIRQ, ips_name, ha)) { + if (request_irq(ha->irq, do_ipsintr, IRQF_SHARED, ips_name, ha)) { IPS_PRINTK(KERN_WARNING, ha->pcidev, "Unable to install interrupt handler\n"); scsi_host_put(sh); @@ -7420,7 +7419,7 @@ ips_init_phase2(int index) } /* Install the interrupt handler */ - if (request_irq(ha->irq, do_ipsintr, SA_SHIRQ, ips_name, ha)) { + if (request_irq(ha->irq, do_ipsintr, IRQF_SHARED, ips_name, ha)) { IPS_PRINTK(KERN_WARNING, ha->pcidev, "Unable to install interrupt handler\n"); return ips_abort_init(ha, index); diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c index fc031c76dad..3fd8a96f2af 100644 --- a/drivers/scsi/jazz_esp.c +++ b/drivers/scsi/jazz_esp.c @@ -131,7 +131,7 @@ static int jazz_esp_detect(struct scsi_host_template *tpnt) esp->esp_command_dvma = vdma_alloc(CPHYSADDR(cmd_buffer), sizeof (cmd_buffer)); esp->irq = JAZZ_SCSI_IRQ; - request_irq(JAZZ_SCSI_IRQ, esp_intr, SA_INTERRUPT, "JAZZ SCSI", + request_irq(JAZZ_SCSI_IRQ, esp_intr, IRQF_DISABLED, "JAZZ SCSI", esp->ehost); /* diff --git a/drivers/scsi/lasi700.c b/drivers/scsi/lasi700.c index eb7bd310cc8..f0871c3ac3d 100644 --- a/drivers/scsi/lasi700.c +++ b/drivers/scsi/lasi700.c @@ -131,7 +131,7 @@ lasi700_probe(struct parisc_device *dev) host->this_id = 7; host->base = base; host->irq = dev->irq; - if(request_irq(dev->irq, NCR_700_intr, SA_SHIRQ, "lasi700", host)) { + if(request_irq(dev->irq, NCR_700_intr, IRQF_SHARED, "lasi700", host)) { printk(KERN_ERR "lasi700: request_irq failed!\n"); goto out_put_host; } diff --git a/drivers/scsi/libata-bmdma.c b/drivers/scsi/libata-bmdma.c index 004e1a0d8b7..9ce221f2595 100644 --- a/drivers/scsi/libata-bmdma.c +++ b/drivers/scsi/libata-bmdma.c @@ -32,7 +32,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/pci.h> #include <linux/libata.h> @@ -854,7 +853,7 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int return NULL; probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + probe_ent->irq_flags = IRQF_SHARED; probe_ent->private_data = port[0]->private_data; if (ports & ATA_PORT_PRIMARY) { diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index d1c1c30d123..82caba46429 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -32,7 +32,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 908d0f27706..5a28d9bf8e4 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -1620,7 +1620,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) if (error) goto out_remove_host; - error = request_irq(phba->pcidev->irq, lpfc_intr_handler, SA_SHIRQ, + error = request_irq(phba->pcidev->irq, lpfc_intr_handler, IRQF_SHARED, LPFC_DRIVER_NAME, phba); if (error) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 5d2cefb5e52..76edbb639d3 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -4714,7 +4714,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) if (request_irq(irq, (adapter->flag & BOARD_MEMMAP) ? megaraid_isr_memmapped : megaraid_isr_iomapped, - SA_SHIRQ, "megaraid", adapter)) { + IRQF_SHARED, "megaraid", adapter)) { printk(KERN_WARNING "megaraid: Couldn't register IRQ %d!\n", irq); goto out_free_scb_list; diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index b7caf60638e..92715130ac0 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c @@ -767,7 +767,7 @@ megaraid_init_mbox(adapter_t *adapter) // // request IRQ and register the interrupt service routine - if (request_irq(adapter->irq, megaraid_isr, SA_SHIRQ, "megaraid", + if (request_irq(adapter->irq, megaraid_isr, IRQF_SHARED, "megaraid", adapter)) { con_log(CL_ANN, (KERN_WARNING diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index 0c9516ff636..e5c017ccda5 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c @@ -2191,7 +2191,7 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) /* * Register IRQ */ - if (request_irq(pdev->irq, megasas_isr, SA_SHIRQ, "megasas", instance)) { + if (request_irq(pdev->irq, megasas_isr, IRQF_SHARED, "megasas", instance)) { printk(KERN_DEBUG "megasas: Failed to register IRQ\n"); goto fail_irq; } diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index f852421002e..c88717727be 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c @@ -18,7 +18,6 @@ * - retry arbitration if lost (unless higher levels do this for us) * - power down the chip when no device is detected */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/delay.h> diff --git a/drivers/scsi/ncr53c8xx.h b/drivers/scsi/ncr53c8xx.h index 0e4e46a0133..78818b6684f 100644 --- a/drivers/scsi/ncr53c8xx.h +++ b/drivers/scsi/ncr53c8xx.h @@ -53,10 +53,8 @@ #ifndef NCR53C8XX_H #define NCR53C8XX_H -#include <linux/config.h> #include <scsi/scsi_host.h> -#include <linux/config.h> /* ** If you want a driver as small as possible, donnot define the diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c index 5c55e152e71..bd337a91429 100644 --- a/drivers/scsi/nsp32.c +++ b/drivers/scsi/nsp32.c @@ -2867,7 +2867,7 @@ static int nsp32_detect(struct scsi_host_template *sht) nsp32_do_bus_reset(data); ret = request_irq(host->irq, do_nsp32_isr, - SA_SHIRQ | SA_SAMPLE_RANDOM, "nsp32", data); + IRQF_SHARED | IRQF_SAMPLE_RANDOM, "nsp32", data); if (ret < 0) { nsp32_msg(KERN_ERR, "Unable to allocate IRQ for NinjaSCSI32 " "SCSI PCI controller. Interrupt: %d", host->irq); diff --git a/drivers/scsi/oktagon_esp.c b/drivers/scsi/oktagon_esp.c index dee426f8c07..dd67a68c5c2 100644 --- a/drivers/scsi/oktagon_esp.c +++ b/drivers/scsi/oktagon_esp.c @@ -6,7 +6,6 @@ * Based on cyber_esp.c */ -#include <linux/config.h> #if defined(CONFIG_AMIGA) || defined(CONFIG_APUS) #define USE_BOTTOM_HALF @@ -198,7 +197,7 @@ int oktagon_esp_detect(struct scsi_host_template *tpnt) esp->esp_command_dvma = (__u32) cmd_buffer; esp->irq = IRQ_AMIGA_PORTS; - request_irq(IRQ_AMIGA_PORTS, esp_intr, SA_SHIRQ, + request_irq(IRQ_AMIGA_PORTS, esp_intr, IRQF_SHARED, "BSC Oktagon SCSI", esp->ehost); /* Figure out our scsi ID on the bus */ diff --git a/drivers/scsi/oktagon_io.S b/drivers/scsi/oktagon_io.S index 08ce8d80d8f..8a7340b0270 100644 --- a/drivers/scsi/oktagon_io.S +++ b/drivers/scsi/oktagon_io.S @@ -23,7 +23,6 @@ int oktag_from_io(long *addr,long *paddr,long len) * is moved to/from the IO register. */ -#include <linux/config.h> #ifdef CONFIG_APUS diff --git a/drivers/scsi/osst.h b/drivers/scsi/osst.h index 011d4d6ca9f..1e426f5d0ed 100644 --- a/drivers/scsi/osst.h +++ b/drivers/scsi/osst.h @@ -3,7 +3,6 @@ */ #include <asm/byteorder.h> -#include <linux/config.h> #include <linux/completion.h> /* FIXME - rename and use the following two types or delete them! diff --git a/drivers/scsi/pas16.c b/drivers/scsi/pas16.c index 1bf96ed8f93..1434209a8ac 100644 --- a/drivers/scsi/pas16.c +++ b/drivers/scsi/pas16.c @@ -454,7 +454,7 @@ int __init pas16_detect(struct scsi_host_template * tpnt) instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS); if (instance->irq != SCSI_IRQ_NONE) - if (request_irq(instance->irq, pas16_intr, SA_INTERRUPT, "pas16", instance)) { + if (request_irq(instance->irq, pas16_intr, IRQF_DISABLED, "pas16", instance)) { printk("scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); instance->irq = SCSI_IRQ_NONE; diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 231f9c311c6..7ff5851c040 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1623,7 +1623,7 @@ static int nsp_cs_probe(struct pcmcia_device *link) /* Interrupt handler */ link->irq.Handler = &nspintr; link->irq.Instance = info; - link->irq.Attributes |= (SA_SHIRQ | SA_SAMPLE_RANDOM); + link->irq.Attributes |= (IRQF_SHARED | IRQF_SAMPLE_RANDOM); /* General socket configuration */ link->conf.Attributes = CONF_ENABLE_IRQ; diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 9f59827707f..0b65099acb1 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c @@ -799,7 +799,7 @@ next_entry: data = (struct sym53c500_data *)host->hostdata; if (irq_level > 0) { - if (request_irq(irq_level, SYM53C500_intr, SA_SHIRQ, "SYM53C500", host)) { + if (request_irq(irq_level, SYM53C500_intr, IRQF_SHARED, "SYM53C500", host)) { printk("SYM53C500: unable to allocate IRQ %d\n", irq_level); goto err_free_scsi; } diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c index 7ebe8e03aa9..d1f38c32aa1 100644 --- a/drivers/scsi/pdc_adma.c +++ b/drivers/scsi/pdc_adma.c @@ -690,7 +690,7 @@ static int adma_ata_init_one(struct pci_dev *pdev, probe_ent->port_ops = adma_port_info[board_idx].port_ops; probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + probe_ent->irq_flags = IRQF_SHARED; probe_ent->mmio_base = mmio_base; probe_ent->n_ports = ADMA_PORTS; diff --git a/drivers/scsi/pluto.c b/drivers/scsi/pluto.c index 83a67179993..7abf64d1bfc 100644 --- a/drivers/scsi/pluto.c +++ b/drivers/scsi/pluto.c @@ -13,7 +13,6 @@ #include <linux/proc_fs.h> #include <linux/stat.h> #include <linux/init.h> -#include <linux/config.h> #ifdef CONFIG_KMOD #include <linux/kmod.h> #endif diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index d58ac5ad509..b0eba39f208 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c @@ -8,7 +8,6 @@ * */ -#include <linux/config.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h> diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 680f6063954..b818b9bfe67 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c @@ -192,7 +192,7 @@ - Don't walk the entire list in qla1280_putq_t() just to directly grab the pointer to the last element afterwards Rev 3.23.5 Beta August 9, 2001, Jes Sorensen - - Don't use SA_INTERRUPT, it's use is deprecated for this kinda driver + - Don't use IRQF_DISABLED, it's use is deprecated for this kinda driver Rev 3.23.4 Beta August 8, 2001, Jes Sorensen - Set dev->max_sectors to 1024 Rev 3.23.3 Beta August 6, 2001, Jes Sorensen @@ -331,7 +331,6 @@ *****************************************************************************/ -#include <linux/config.h> #include <linux/module.h> #include <linux/version.h> @@ -4370,7 +4369,7 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) /* Disable ISP interrupts. */ qla1280_disable_intrs(ha); - if (request_irq(pdev->irq, qla1280_intr_handler, SA_SHIRQ, + if (request_irq(pdev->irq, qla1280_intr_handler, IRQF_SHARED, "qla1280", ha)) { printk("qla1280 : Failed to reserve interrupt %d already " "in use\n", pdev->irq); diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index d6f6579cfd2..6734453ea28 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2134,7 +2134,7 @@ typedef struct scsi_qla_host { mempool_t *srb_mempool; /* This spinlock is used to protect "io transactions", you must - * aquire it before doing any IO to the card, eg with RD_REG*() and + * acquire it before doing any IO to the card, eg with RD_REG*() and * WRT_REG*() for the duration of your entire commandtransaction. * * This spinlock is of lower priority than the io request lock. diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index ccaad0b08d3..93062593ebe 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -1541,7 +1541,7 @@ static int qla2x00_probe_one(struct pci_dev *pdev) host->transportt = qla2xxx_transport_template; ret = request_irq(pdev->irq, ha->isp_ops.intr_handler, - SA_INTERRUPT|SA_SHIRQ, QLA2XXX_DRIVER_NAME, ha); + IRQF_DISABLED|IRQF_SHARED, QLA2XXX_DRIVER_NAME, ha); if (ret) { qla_printk(KERN_WARNING, ha, "Failed to reserve interrupt %d already in use.\n", diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 329ead26371..69e0551a81d 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c @@ -718,7 +718,7 @@ static int __init qpti_register_irq(struct qlogicpti *qpti) * sanely maintain. */ if (request_irq(qpti->irq, qpti_intr, - SA_SHIRQ, "Qlogic/PTI", qpti)) + IRQF_SHARED, "Qlogic/PTI", qpti)) goto fail; printk("qpti%d: IRQ %d ", qpti->qpti_id, qpti->irq); diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 4a71578df3c..1053c7c76b7 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -2395,7 +2395,7 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) probe_ent->port_ops = mv_port_info[board_idx].port_ops; probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + probe_ent->irq_flags = IRQF_SHARED; probe_ent->mmio_base = mmio_base; probe_ent->private_data = hpriv; diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c index 5cc42c6054e..56da25581f3 100644 --- a/drivers/scsi/sata_nv.c +++ b/drivers/scsi/sata_nv.c @@ -31,7 +31,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index b2b6ed5216e..64631bd3895 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c @@ -743,7 +743,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e probe_ent->port_ops = pdc_port_info[board_idx].port_ops; probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + probe_ent->irq_flags = IRQF_SHARED; probe_ent->mmio_base = mmio_base; pdc_ata_setup_port(&probe_ent->port[0], base + 0x200); diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index 98ddc25655f..d374c1db0cf 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/scsi/sata_qstor.c @@ -680,7 +680,7 @@ static int qs_ata_init_one(struct pci_dev *pdev, probe_ent->port_ops = qs_port_info[board_idx].port_ops; probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + probe_ent->irq_flags = IRQF_SHARED; probe_ent->mmio_base = mmio_base; probe_ent->n_ports = QS_PORTS; diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c index 51d86d750e8..7aabb45c35e 100644 --- a/drivers/scsi/sata_sil.c +++ b/drivers/scsi/sata_sil.c @@ -608,7 +608,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) probe_ent->mwdma_mask = sil_port_info[ent->driver_data].mwdma_mask; probe_ent->udma_mask = sil_port_info[ent->driver_data].udma_mask; probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + probe_ent->irq_flags = IRQF_SHARED; probe_ent->host_flags = sil_port_info[ent->driver_data].host_flags; mmio_base = pci_iomap(pdev, 5, 0); diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index b5f8fa95567..07a1c6a8a41 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c @@ -1041,7 +1041,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) probe_ent->n_ports = SIL24_FLAG2NPORTS(pinfo->host_flags); probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + probe_ent->irq_flags = IRQF_SHARED; probe_ent->mmio_base = port_base; probe_ent->private_data = hpriv; diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c index 809d337ed64..ee6b5df41d3 100644 --- a/drivers/scsi/sata_sis.c +++ b/drivers/scsi/sata_sis.c @@ -30,7 +30,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index 7566c2cabaf..7d0858095e1 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c @@ -36,7 +36,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> @@ -429,7 +428,7 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e probe_ent->port_ops = &k2_sata_ops; probe_ent->n_ports = 4; probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + probe_ent->irq_flags = IRQF_SHARED; probe_ent->mmio_base = mmio_base; /* We don't care much about the PIO/UDMA masks, but the core won't like us diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index 7f864410f7c..ccc8cad24f7 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c @@ -1436,7 +1436,7 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id * probe_ent->port_ops = pdc_port_info[board_idx].port_ops; probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + probe_ent->irq_flags = IRQF_SHARED; probe_ent->mmio_base = mmio_base; probe_ent->private_data = hpriv; diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c index 64f3c1aeed2..33cdb4867ef 100644 --- a/drivers/scsi/sata_uli.c +++ b/drivers/scsi/sata_uli.c @@ -24,7 +24,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c index 67c3d299977..03baec2191b 100644 --- a/drivers/scsi/sata_via.c +++ b/drivers/scsi/sata_via.c @@ -242,7 +242,7 @@ static struct ata_probe_ent *vt6421_init_probe_ent(struct pci_dev *pdev) probe_ent->port_ops = &svia_sata_ops; probe_ent->n_ports = N_PORTS; probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + probe_ent->irq_flags = IRQF_SHARED; probe_ent->pio_mask = 0x1f; probe_ent->mwdma_mask = 0x07; probe_ent->udma_mask = 0x7f; @@ -335,10 +335,10 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) if ((pci_resource_start(pdev, i) == 0) || (pci_resource_len(pdev, i) < bar_sizes[i])) { dev_printk(KERN_ERR, &pdev->dev, - "invalid PCI BAR %u (sz 0x%lx, val 0x%lx)\n", - i, - pci_resource_start(pdev, i), - pci_resource_len(pdev, i)); + "invalid PCI BAR %u (sz 0x%llx, val 0x%llx)\n", + i, + (unsigned long long)pci_resource_start(pdev, i), + (unsigned long long)pci_resource_len(pdev, i)); rc = -ENODEV; goto err_out_regions; } diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index 616fd9634b4..916fe6fba75 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c @@ -400,7 +400,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d probe_ent->port_ops = &vsc_sata_ops; probe_ent->n_ports = 4; probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + probe_ent->irq_flags = IRQF_SHARED; probe_ent->mmio_base = mmio_base; /* We don't care much about the PIO/UDMA masks, but the core won't like us diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 5a5d2af8ee4..e1168860045 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -24,7 +24,6 @@ * module options to "modprobe scsi_debug num_tgts=2" [20021221] */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/scsi/scsi_logging.h b/drivers/scsi/scsi_logging.h index a3e2af6a846..1f65139e14f 100644 --- a/drivers/scsi/scsi_logging.h +++ b/drivers/scsi/scsi_logging.h @@ -1,7 +1,6 @@ #ifndef _SCSI_LOGGING_H #define _SCSI_LOGGING_H -#include <linux/config.h> /* * This defines the scsi logging feature. It is a means by which the user diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index a1727a0e1bd..015c90cf3ab 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h @@ -1,7 +1,6 @@ #ifndef _SCSI_PRIV_H #define _SCSI_PRIV_H -#include <linux/config.h> #include <linux/device.h> struct request_queue; diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 0f7e6f94d66..1341608e9e3 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -25,7 +25,6 @@ * or a LUN is seen that cannot have a device attached to it. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 5ec7a4fb014..e7fe565b96d 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -6,7 +6,6 @@ * Created to pull SCSI mid layer sysfs routines into one file. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/blkdev.h> diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index ace49d5bd9c..29a9a53cdd1 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -18,7 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <linux/config.h> #include <linux/ctype.h> #include <linux/init.h> #include <linux/module.h> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 35419901124..ea38757d12e 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -32,7 +32,6 @@ * than the level indicated above to trigger output. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/kernel.h> diff --git a/drivers/scsi/seagate.c b/drivers/scsi/seagate.c index 7fa4da4ea64..3f312a84c6a 100644 --- a/drivers/scsi/seagate.c +++ b/drivers/scsi/seagate.c @@ -497,7 +497,7 @@ int __init seagate_st0x_detect (struct scsi_host_template * tpnt) return 0; hostno = instance->host_no; - if (request_irq (irq, do_seagate_reconnect_intr, SA_INTERRUPT, (controller_type == SEAGATE) ? "seagate" : "tmc-8xx", instance)) { + if (request_irq (irq, do_seagate_reconnect_intr, IRQF_DISABLED, (controller_type == SEAGATE) ? "seagate" : "tmc-8xx", instance)) { printk(KERN_ERR "scsi%d : unable to allocate IRQ%d\n", hostno, irq); return 0; } diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 98b9312ba8d..4e607d3065b 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -28,7 +28,6 @@ static int sg_version_num = 30533; /* 2 digits for each component */ * (otherwise the macros compile to empty statements). * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/fs.h> diff --git a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c index 255886a9ac5..b27e85428da 100644 --- a/drivers/scsi/sim710.c +++ b/drivers/scsi/sim710.c @@ -26,7 +26,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/blkdev.h> @@ -134,7 +133,7 @@ sim710_probe_common(struct device *dev, unsigned long base_addr, host->this_id = scsi_id; host->base = base_addr; host->irq = irq; - if (request_irq(irq, NCR_700_intr, SA_SHIRQ, "sim710", host)) { + if (request_irq(irq, NCR_700_intr, IRQF_SHARED, "sim710", host)) { printk(KERN_ERR "sim710: request_irq failed\n"); goto out_put_host; } diff --git a/drivers/scsi/sr_vendor.c b/drivers/scsi/sr_vendor.c index 9dde8df2f5c..a3e9d0f2eb5 100644 --- a/drivers/scsi/sr_vendor.c +++ b/drivers/scsi/sr_vendor.c @@ -34,7 +34,6 @@ * HP 6020 writers now supported. */ -#include <linux/config.h> #include <linux/cdrom.h> #include <linux/errno.h> #include <linux/string.h> diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c index 25cced91c8a..2ebe0d66389 100644 --- a/drivers/scsi/sun3_NCR5380.c +++ b/drivers/scsi/sun3_NCR5380.c @@ -535,7 +535,6 @@ static __inline__ void initialize_SCp(Scsi_Cmnd *cmd) } -#include <linux/config.h> #include <linux/delay.h> #if 1 diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c index 2e2c1eb1563..1f328cae5c0 100644 --- a/drivers/scsi/sun3x_esp.c +++ b/drivers/scsi/sun3x_esp.c @@ -97,7 +97,7 @@ int sun3x_esp_detect(struct scsi_host_template *tpnt) esp->esp_command_dvma = dvma_vtob((unsigned long)esp->esp_command); esp->irq = 2; - if (request_irq(esp->irq, esp_intr, SA_INTERRUPT, + if (request_irq(esp->irq, esp_intr, IRQF_DISABLED, "SUN3X SCSI", esp->ehost)) { esp_deallocate(esp); return 0; diff --git a/drivers/scsi/sym53c8xx_2/sym53c8xx.h b/drivers/scsi/sym53c8xx_2/sym53c8xx.h index 48110376972..7519728dfc3 100644 --- a/drivers/scsi/sym53c8xx_2/sym53c8xx.h +++ b/drivers/scsi/sym53c8xx_2/sym53c8xx.h @@ -40,7 +40,6 @@ #ifndef SYM53C8XX_H #define SYM53C8XX_H -#include <linux/config.h> /* * DMA addressing mode. diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index ea82d3df63a..8c505076c0e 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c @@ -1547,7 +1547,7 @@ static struct Scsi_Host * __devinit sym_attach(struct scsi_host_template *tpnt, * If we synchonize the C code with SCRIPTS on interrupt, * we do not want to share the INTR line at all. */ - if (request_irq(pdev->irq, sym53c8xx_intr, SA_SHIRQ, NAME53C8XX, np)) { + if (request_irq(pdev->irq, sym53c8xx_intr, IRQF_SHARED, NAME53C8XX, np)) { printf_err("%s: request irq %d failure\n", sym_name(np), pdev->irq); goto attach_failed; diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.h b/drivers/scsi/sym53c8xx_2/sym_glue.h index a446cda3f64..e022d3c71b5 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.h +++ b/drivers/scsi/sym53c8xx_2/sym_glue.h @@ -40,7 +40,6 @@ #ifndef SYM_GLUE_H #define SYM_GLUE_H -#include <linux/config.h> #include <linux/delay.h> #include <linux/ioport.h> #include <linux/pci.h> diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index a24f661b027..2df6747cb76 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c @@ -260,7 +260,7 @@ found: instance->irq = NCR5380_probe_irq(instance, T128_IRQS); if (instance->irq != SCSI_IRQ_NONE) - if (request_irq(instance->irq, t128_intr, SA_INTERRUPT, "t128", instance)) { + if (request_irq(instance->irq, t128_intr, IRQF_DISABLED, "t128", instance)) { printk("scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); instance->irq = SCSI_IRQ_NONE; diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c index 91322aff241..9404ff3d4c7 100644 --- a/drivers/scsi/tmscsim.c +++ b/drivers/scsi/tmscsim.c @@ -218,7 +218,6 @@ #endif #define DCBDEBUG1(x) C_NOP -#include <linux/config.h> #include <linux/module.h> #include <linux/delay.h> #include <linux/signal.h> @@ -2585,7 +2584,7 @@ static int __devinit dc390_probe_one(struct pci_dev *pdev, /* Reset Pending INT */ DC390_read8_(INT_Status, io_port); - if (request_irq(pdev->irq, do_DC390_Interrupt, SA_SHIRQ, + if (request_irq(pdev->irq, do_DC390_Interrupt, IRQF_SHARED, "tmscsim", pACB)) { printk(KERN_ERR "DC390: register IRQ error!\n"); goto out_release_region; diff --git a/drivers/scsi/tmscsim.h b/drivers/scsi/tmscsim.h index d4495272fb4..9b66fa8d38d 100644 --- a/drivers/scsi/tmscsim.h +++ b/drivers/scsi/tmscsim.h @@ -9,7 +9,6 @@ #define _TMSCSIM_H #include <linux/types.h> -#include <linux/config.h> #define SCSI_IRQ_NONE 255 diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c index 33cd90fc657..57449611e71 100644 --- a/drivers/scsi/u14-34f.c +++ b/drivers/scsi/u14-34f.c @@ -405,7 +405,6 @@ * the driver sets host->wish_block = TRUE for all ISA boards. */ -#include <linux/config.h> #include <linux/string.h> #include <linux/kernel.h> #include <linux/ioport.h> @@ -873,7 +872,7 @@ static int port_detect \ /* Board detected, allocate its IRQ */ if (request_irq(irq, do_interrupt_handler, - SA_INTERRUPT | ((subversion == ESA) ? SA_SHIRQ : 0), + IRQF_DISABLED | ((subversion == ESA) ? IRQF_SHARED : 0), driver_name, (void *) &sha[j])) { printk("%s: unable to allocate IRQ %u, detaching.\n", name, irq); goto freelock; diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c index 27307fe5a4c..680f38ab60d 100644 --- a/drivers/scsi/wd33c93.c +++ b/drivers/scsi/wd33c93.c @@ -71,7 +71,6 @@ * Richard Hirst <richard@sleepie.demon.co.uk> August 2000 */ -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> diff --git a/drivers/scsi/wd33c93.h b/drivers/scsi/wd33c93.h index 193ec517d25..edcb0365cf0 100644 --- a/drivers/scsi/wd33c93.h +++ b/drivers/scsi/wd33c93.h @@ -22,7 +22,6 @@ #ifndef WD33C93_H #define WD33C93_H -#include <linux/config.h> #define PROC_INTERFACE /* add code for /proc/scsi/wd33c93/xxx interface */ #ifdef PROC_INTERFACE diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c index 574955b78a2..a0b61af48f1 100644 --- a/drivers/scsi/wd7000.c +++ b/drivers/scsi/wd7000.c @@ -1250,7 +1250,7 @@ static int wd7000_init(Adapter * host) return 0; - if (request_irq(host->irq, wd7000_intr, SA_INTERRUPT, "wd7000", host)) { + if (request_irq(host->irq, wd7000_intr, IRQF_DISABLED, "wd7000", host)) { printk("wd7000_init: can't get IRQ %d.\n", host->irq); return (0); } diff --git a/drivers/scsi/zalon.c b/drivers/scsi/zalon.c index a6cfbb3b361..4b5f908d35c 100644 --- a/drivers/scsi/zalon.c +++ b/drivers/scsi/zalon.c @@ -136,7 +136,7 @@ zalon_probe(struct parisc_device *dev) if (!host) goto fail; - if (request_irq(dev->irq, ncr53c8xx_intr, SA_SHIRQ, "zalon", host)) { + if (request_irq(dev->irq, ncr53c8xx_intr, IRQF_SHARED, "zalon", host)) { printk(KERN_ERR "%s: irq problem with %d, detaching\n ", dev->dev.bus_id, dev->irq); goto fail; diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c index 7572665a885..57438326b07 100644 --- a/drivers/serial/21285.c +++ b/drivers/serial/21285.c @@ -7,7 +7,6 @@ * * $Id: 21285.c,v 1.37 2002/07/28 10:03:27 rmk Exp $ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/tty.h> #include <linux/ioport.h> @@ -479,7 +478,6 @@ static struct uart_driver serial21285_reg = { .owner = THIS_MODULE, .driver_name = "ttyFB", .dev_name = "ttyFB", - .devfs_name = "ttyFB", .major = SERIAL_21285_MAJOR, .minor = SERIAL_21285_MINOR, .nr = 1, diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c index bff94541991..993a702422e 100644 --- a/drivers/serial/68328serial.c +++ b/drivers/serial/68328serial.c @@ -23,7 +23,6 @@ #include <linux/interrupt.h> #include <linux/tty.h> #include <linux/tty_flip.h> -#include <linux/config.h> #include <linux/major.h> #include <linux/string.h> #include <linux/fcntl.h> diff --git a/drivers/serial/68328serial.h b/drivers/serial/68328serial.h index 978f8a609f3..58aa2154655 100644 --- a/drivers/serial/68328serial.h +++ b/drivers/serial/68328serial.h @@ -11,7 +11,6 @@ #ifndef _MC683XX_SERIAL_H #define _MC683XX_SERIAL_H -#include <linux/config.h> struct serial_struct { int type; diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c index 9843ae3d420..e80e70e9b12 100644 --- a/drivers/serial/68360serial.c +++ b/drivers/serial/68360serial.c @@ -20,7 +20,6 @@ * int rs_360_init(void); */ -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/signal.h> diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index bbf78aaf9e0..0995430e4cf 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c @@ -19,7 +19,6 @@ * mapbase is the physical address of the IO port. * membase is an 'ioremapped' cookie. */ -#include <linux/config.h> #if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ @@ -49,7 +48,7 @@ /* * Configuration: - * share_irqs - whether we pass SA_SHIRQ to request_irq(). This option + * share_irqs - whether we pass IRQF_SHARED to request_irq(). This option * is unsafe when used on edge-triggered interrupts. */ static unsigned int share_irqs = SERIAL8250_SHARE_IRQS; @@ -1401,7 +1400,7 @@ static void serial_do_unlink(struct irq_info *i, struct uart_8250_port *up) static int serial_link_irq_chain(struct uart_8250_port *up) { struct irq_info *i = irq_lists + up->port.irq; - int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? SA_SHIRQ : 0; + int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0; spin_lock_irq(&i->lock); @@ -2354,7 +2353,6 @@ int __init serial8250_start_console(struct uart_port *port, char *options) static struct uart_driver serial8250_reg = { .owner = THIS_MODULE, .driver_name = "serial", - .devfs_name = "tts/", .dev_name = "ttyS", .major = TTY_MAJOR, .minor = 64, diff --git a/drivers/serial/8250.h b/drivers/serial/8250.h index 490606b8709..91bd28f2bb4 100644 --- a/drivers/serial/8250.h +++ b/drivers/serial/8250.h @@ -15,7 +15,6 @@ * $Id: 8250.h,v 1.8 2002/07/21 21:32:30 rmk Exp $ */ -#include <linux/config.h> #include <linux/serial_8250.h> struct old_serial_port { diff --git a/drivers/serial/8250_mca.c b/drivers/serial/8250_mca.c index ac205256d5f..d10be944ad4 100644 --- a/drivers/serial/8250_mca.c +++ b/drivers/serial/8250_mca.c @@ -8,7 +8,6 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/mca.h> diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 94886c000d2..864ef859be5 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c @@ -594,8 +594,8 @@ pci_default_setup(struct serial_private *priv, struct pciserial_board *board, else offset += idx * board->uart_offset; - maxnr = (pci_resource_len(priv->dev, bar) - board->first_offset) / - (8 << board->reg_shift); + maxnr = (pci_resource_len(priv->dev, bar) - board->first_offset) >> + (board->reg_shift + 3); if (board->flags & FL_REGION_SZ_CAP && idx >= maxnr) return 1; diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c index e920d196d0b..7311d8487c9 100644 --- a/drivers/serial/amba-pl010.c +++ b/drivers/serial/amba-pl010.c @@ -31,7 +31,6 @@ * required, these have to be supplied via some other means (eg, GPIO) * and hooked into this driver. */ -#include <linux/config.h> #if defined(CONFIG_SERIAL_AMBA_PL010_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index 3d966cfc9a3..a8d7124e84a 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c @@ -31,7 +31,6 @@ * required, these have to be supplied via some other means (eg, GPIO) * and hooked into this driver. */ -#include <linux/config.h> #if defined(CONFIG_SERIAL_AMBA_PL011_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ diff --git a/drivers/serial/at91_serial.c b/drivers/serial/at91_serial.c index db5b25fafed..a7d664383da 100644 --- a/drivers/serial/at91_serial.c +++ b/drivers/serial/at91_serial.c @@ -22,7 +22,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/tty.h> #include <linux/ioport.h> @@ -388,7 +387,7 @@ static int at91_startup(struct uart_port *port) /* * Allocate the IRQ */ - retval = request_irq(port->irq, at91_interrupt, SA_SHIRQ, "at91_serial", port); + retval = request_irq(port->irq, at91_interrupt, IRQF_SHARED, "at91_serial", port); if (retval) { printk("at91_serial: at91_startup - Can't get irq\n"); return retval; @@ -863,7 +862,6 @@ static struct uart_driver at91_uart = { .owner = THIS_MODULE, .driver_name = "at91_serial", .dev_name = AT91_DEVICENAME, - .devfs_name = AT91_DEVICENAME, .major = SERIAL_AT91_MAJOR, .minor = MINOR_START, .nr = AT91_NR_UART, diff --git a/drivers/serial/clps711x.c b/drivers/serial/clps711x.c index 2691112c84a..f27d852ce50 100644 --- a/drivers/serial/clps711x.c +++ b/drivers/serial/clps711x.c @@ -25,7 +25,6 @@ * $Id: clps711x.c,v 1.42 2002/07/28 10:03:28 rmk Exp $ * */ -#include <linux/config.h> #if defined(CONFIG_SERIAL_CLPS711X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c index 5cba59ad7dc..90ff96e3339 100644 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c @@ -31,7 +31,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/tty.h> #include <linux/ioport.h> diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c index 17406a05ce1..95afc37297a 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c @@ -27,7 +27,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/tty.h> #include <linux/ioport.h> diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c index cdba128250a..ef3bb476c43 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c @@ -27,7 +27,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/tty.h> #include <linux/ioport.h> diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index 5cacc5e74a9..cabd048c863 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c @@ -415,7 +415,7 @@ * Fixed DEF_TX value that caused the serial transmitter pin (txd) to go to 0 when * closing the last filehandle, NASTY!. * Added break generation, not tested though! - * Use SA_SHIRQ when request_irq() for ser2 and ser3 (shared with) par0 and par1. + * Use IRQF_SHARED when request_irq() for ser2 and ser3 (shared with) par0 and par1. * You can't use them at the same time (yet..), but you can hopefully switch * between ser2/par0, ser3/par1 with the same kernel config. * Replaced some magic constants with defines @@ -425,7 +425,6 @@ static char *serial_version = "$Revision: 1.25 $"; -#include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/signal.h> @@ -4878,7 +4877,7 @@ rs_init(void) driver->init_termios = tty_std_termios; driver->init_termios.c_cflag = B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */ - driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; + driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; driver->termios = serial_termios; driver->termios_locked = serial_termios_locked; @@ -4943,55 +4942,55 @@ rs_init(void) /* Not needed in simulator. May only complicate stuff. */ /* hook the irq's for DMA channel 6 and 7, serial output and input, and some more... */ - if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial ", NULL)) + if (request_irq(SERIAL_IRQ_NBR, ser_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial ", NULL)) panic("irq8"); #ifdef CONFIG_ETRAX_SERIAL_PORT0 #ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT - if (request_irq(SER0_DMA_TX_IRQ_NBR, tr_interrupt, SA_INTERRUPT, "serial 0 dma tr", NULL)) + if (request_irq(SER0_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_DISABLED, "serial 0 dma tr", NULL)) panic("irq22"); #endif #ifdef CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN - if (request_irq(SER0_DMA_RX_IRQ_NBR, rec_interrupt, SA_INTERRUPT, "serial 0 dma rec", NULL)) + if (request_irq(SER0_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_DISABLED, "serial 0 dma rec", NULL)) panic("irq23"); #endif #endif #ifdef CONFIG_ETRAX_SERIAL_PORT1 #ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT - if (request_irq(SER1_DMA_TX_IRQ_NBR, tr_interrupt, SA_INTERRUPT, "serial 1 dma tr", NULL)) + if (request_irq(SER1_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_DISABLED, "serial 1 dma tr", NULL)) panic("irq24"); #endif #ifdef CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN - if (request_irq(SER1_DMA_RX_IRQ_NBR, rec_interrupt, SA_INTERRUPT, "serial 1 dma rec", NULL)) + if (request_irq(SER1_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_DISABLED, "serial 1 dma rec", NULL)) panic("irq25"); #endif #endif #ifdef CONFIG_ETRAX_SERIAL_PORT2 /* DMA Shared with par0 (and SCSI0 and ATA) */ #ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT - if (request_irq(SER2_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 2 dma tr", NULL)) + if (request_irq(SER2_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 2 dma tr", NULL)) panic("irq18"); #endif #ifdef CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN - if (request_irq(SER2_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 2 dma rec", NULL)) + if (request_irq(SER2_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 2 dma rec", NULL)) panic("irq19"); #endif #endif #ifdef CONFIG_ETRAX_SERIAL_PORT3 /* DMA Shared with par1 (and SCSI1 and Extern DMA 0) */ #ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT - if (request_irq(SER3_DMA_TX_IRQ_NBR, tr_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 3 dma tr", NULL)) + if (request_irq(SER3_DMA_TX_IRQ_NBR, tr_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 3 dma tr", NULL)) panic("irq20"); #endif #ifdef CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN - if (request_irq(SER3_DMA_RX_IRQ_NBR, rec_interrupt, SA_SHIRQ | SA_INTERRUPT, "serial 3 dma rec", NULL)) + if (request_irq(SER3_DMA_RX_IRQ_NBR, rec_interrupt, IRQF_SHARED | IRQF_DISABLED, "serial 3 dma rec", NULL)) panic("irq21"); #endif #endif #ifdef CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST - if (request_irq(TIMER1_IRQ_NBR, timeout_interrupt, SA_SHIRQ | SA_INTERRUPT, + if (request_irq(TIMER1_IRQ_NBR, timeout_interrupt, IRQF_SHARED | IRQF_DISABLED, "fast serial dma timeout", NULL)) { printk(KERN_CRIT "err: timer1 irq\n"); } diff --git a/drivers/serial/crisv10.h b/drivers/serial/crisv10.h index 1800c0e7531..f30b93d6ef7 100644 --- a/drivers/serial/crisv10.h +++ b/drivers/serial/crisv10.h @@ -7,7 +7,6 @@ #ifndef _ETRAX_SERIAL_H #define _ETRAX_SERIAL_H -#include <linux/config.h> #include <linux/circ_buf.h> #include <asm/termios.h> diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c index bf71bad5c34..d119c8296a7 100644 --- a/drivers/serial/dz.c +++ b/drivers/serial/dz.c @@ -26,7 +26,6 @@ #undef DEBUG_DZ -#include <linux/config.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/init.h> @@ -768,11 +767,7 @@ void __init dz_serial_console_init(void) static struct uart_driver dz_reg = { .owner = THIS_MODULE, .driver_name = "serial", -#ifdef CONFIG_DEVFS - .dev_name = "tts/%d", -#else .dev_name = "ttyS%d", -#endif .major = TTY_MAJOR, .minor = 64, .nr = DZ_NB_PORT, @@ -802,7 +797,7 @@ int __init dz_init(void) restore_flags(flags); if (request_irq(dz_ports[0].port.irq, dz_interrupt, - SA_INTERRUPT, "DZ", &dz_ports[0])) + IRQF_DISABLED, "DZ", &dz_ports[0])) panic("Unable to register DZ interrupt"); ret = uart_register_driver(&dz_reg); diff --git a/drivers/serial/icom.c b/drivers/serial/icom.c index 144a7a352b2..a3c00a25214 100644 --- a/drivers/serial/icom.c +++ b/drivers/serial/icom.c @@ -24,7 +24,6 @@ */ #define SERIAL_DO_RESTART #include <linux/module.h> -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/signal.h> @@ -1564,7 +1563,7 @@ static int __devinit icom_probe(struct pci_dev *dev, /* save off irq and request irq line */ if ( (retval = request_irq(dev->irq, icom_interrupt, - SA_INTERRUPT | SA_SHIRQ, ICOM_DRIVER_NAME, + IRQF_DISABLED | IRQF_SHARED, ICOM_DRIVER_NAME, (void *) icom_adapter))) { goto probe_exit2; } diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index d202eb4f384..4a142d6b8f3 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c @@ -25,7 +25,6 @@ * [29-Mar-2005] Mike Lee * Added hardware handshake */ -#include <linux/config.h> #if defined(CONFIG_SERIAL_IMX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ @@ -405,7 +404,7 @@ static int imx_startup(struct uart_port *port) if (retval) goto error_out2; retval = request_irq(sport->rtsirq, imx_rtsint, - SA_TRIGGER_FALLING | SA_TRIGGER_RISING, + IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, DRIVER_NAME, sport); if (retval) goto error_out3; @@ -888,7 +887,6 @@ static struct uart_driver imx_reg = { .owner = THIS_MODULE, .driver_name = DRIVER_NAME, .dev_name = "ttySMX", - .devfs_name = "ttsmx/", .major = SERIAL_IMX_MAJOR, .minor = MINOR_START, .nr = ARRAY_SIZE(imx_ports), diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c index 717e47bbd78..576ca1eaa2b 100644 --- a/drivers/serial/ioc4_serial.c +++ b/drivers/serial/ioc4_serial.c @@ -2855,7 +2855,7 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd) control->ic_soft = soft; /* Hook up interrupt handler */ - if (!request_irq(idd->idd_pdev->irq, ioc4_intr, SA_SHIRQ, + if (!request_irq(idd->idd_pdev->irq, ioc4_intr, IRQF_SHARED, "sgi-ioc4serial", soft)) { control->ic_irq = idd->idd_pdev->irq; } else { diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c index 651772474ac..342042889f6 100644 --- a/drivers/serial/ip22zilog.c +++ b/drivers/serial/ip22zilog.c @@ -12,7 +12,6 @@ * Copyright (C) 2002 Ralf Baechle (ralf@linux-mips.org) * Copyright (C) 2002 David S. Miller (davem@redhat.com) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -1085,7 +1084,6 @@ static struct console ip22zilog_console = { static struct uart_driver ip22zilog_reg = { .owner = THIS_MODULE, .driver_name = "serial", - .devfs_name = "tts/", .dev_name = "ttyS", .major = TTY_MAJOR, .minor = 64, diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c index b3e1f71be4d..244f63be3a0 100644 --- a/drivers/serial/jsm/jsm_driver.c +++ b/drivers/serial/jsm/jsm_driver.c @@ -121,7 +121,7 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent) } rc = request_irq(brd->irq, brd->bd_ops->intr, - SA_INTERRUPT|SA_SHIRQ, "JSM", brd); + IRQF_DISABLED|IRQF_SHARED, "JSM", brd); if (rc) { printk(KERN_WARNING "Failed to hook IRQ %d\n",brd->irq); goto out_iounmap; diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c index 321a40f33b5..e7fe4bb46ec 100644 --- a/drivers/serial/m32r_sio.c +++ b/drivers/serial/m32r_sio.c @@ -25,7 +25,6 @@ * membase is an 'ioremapped' cookie. This is compatible with the old * serial.c driver, and is currently the preferred form. */ -#include <linux/config.h> #if defined(CONFIG_SERIAL_M32R_SIO_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ @@ -543,7 +542,7 @@ static void serial_do_unlink(struct irq_info *i, struct uart_sio_port *up) static int serial_link_irq_chain(struct uart_sio_port *up) { struct irq_info *i = irq_lists + up->port.irq; - int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? SA_SHIRQ : 0; + int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0; spin_lock_irq(&i->lock); @@ -1131,7 +1130,6 @@ console_initcall(m32r_sio_console_init); static struct uart_driver m32r_sio_reg = { .owner = THIS_MODULE, .driver_name = "sio", - .devfs_name = "tts/", .dev_name = "ttyS", .major = TTY_MAJOR, .minor = 64, diff --git a/drivers/serial/m32r_sio.h b/drivers/serial/m32r_sio.h index 7c3ec24f7e5..849f1b2c253 100644 --- a/drivers/serial/m32r_sio.h +++ b/drivers/serial/m32r_sio.h @@ -15,7 +15,6 @@ * (at your option) any later version. */ -#include <linux/config.h> struct m32r_sio_probe { struct module *owner; diff --git a/drivers/serial/m32r_sio_reg.h b/drivers/serial/m32r_sio_reg.h index 9c864529451..4671473793e 100644 --- a/drivers/serial/m32r_sio_reg.h +++ b/drivers/serial/m32r_sio_reg.h @@ -15,7 +15,6 @@ #ifndef _M32R_SIO_REG_H #define _M32R_SIO_REG_H -#include <linux/config.h> #ifdef CONFIG_SERIAL_M32R_PLDSIO diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c index 8ad24293436..832abd3c470 100644 --- a/drivers/serial/mcfserial.c +++ b/drivers/serial/mcfserial.c @@ -1596,7 +1596,7 @@ static void mcfrs_irqinit(struct mcf_serial *info) /* Clear mask, so no surprise interrupts. */ uartp[MCFUART_UIMR] = 0; - if (request_irq(info->irq, mcfrs_interrupt, SA_INTERRUPT, + if (request_irq(info->irq, mcfrs_interrupt, IRQF_DISABLED, "ColdFire UART", NULL)) { printk("MCFRS: Unable to attach ColdFire UART %d interrupt " "vector=%d\n", info->line, info->irq); @@ -1713,7 +1713,6 @@ mcfrs_init(void) /* Initialize the tty_driver structure */ mcfrs_serial_driver->owner = THIS_MODULE; mcfrs_serial_driver->name = "ttyS"; - mcfrs_serial_driver->devfs_name = "ttys/"; mcfrs_serial_driver->driver_name = "serial"; mcfrs_serial_driver->major = TTY_MAJOR; mcfrs_serial_driver->minor_start = 64; diff --git a/drivers/serial/mcfserial.h b/drivers/serial/mcfserial.h index a2b28e8629f..56420e2cb11 100644 --- a/drivers/serial/mcfserial.h +++ b/drivers/serial/mcfserial.h @@ -14,7 +14,6 @@ #ifndef _MCF_SERIAL_H #define _MCF_SERIAL_H -#include <linux/config.h> #include <linux/serial.h> #ifdef __KERNEL__ diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 6459edc7f5c..48eb22d3a63 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c @@ -44,7 +44,6 @@ * will be mapped to. */ -#include <linux/config.h> #include <linux/platform_device.h> #include <linux/module.h> #include <linux/tty.h> @@ -191,7 +190,7 @@ mpc52xx_uart_startup(struct uart_port *port) /* Request IRQ */ ret = request_irq(port->irq, mpc52xx_uart_int, - SA_INTERRUPT | SA_SAMPLE_RANDOM, "mpc52xx_psc_uart", port); + IRQF_DISABLED | IRQF_SAMPLE_RANDOM, "mpc52xx_psc_uart", port); if (ret) return ret; @@ -693,7 +692,6 @@ static struct uart_driver mpc52xx_uart_driver = { .owner = THIS_MODULE, .driver_name = "mpc52xx_psc_uart", .dev_name = "ttyPSC", - .devfs_name = "ttyPSC", .major = SERIAL_PSC_MAJOR, .minor = SERIAL_PSC_MINOR, .nr = MPC52xx_PSC_MAXNUM, diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c index 94681922ea0..63d2a66e563 100644 --- a/drivers/serial/mpsc.c +++ b/drivers/serial/mpsc.c @@ -50,7 +50,6 @@ * 4) AFAICT, hardware flow control isn't supported by the controller --MAG. */ -#include <linux/config.h> #if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ @@ -315,7 +314,6 @@ struct mpsc_port_info *mpsc_device_remove(int index); #define MPSC_MAJOR 204 #define MPSC_MINOR_START 44 #define MPSC_DRIVER_NAME "MPSC" -#define MPSC_DEVFS_NAME "ttymm/" #define MPSC_DEV_NAME "ttyMM" #define MPSC_VERSION "1.00" @@ -1414,7 +1412,7 @@ mpsc_startup(struct uart_port *port) /* If irq's are shared, need to set flag */ if (mpsc_ports[0].port.irq == mpsc_ports[1].port.irq) - flag = SA_SHIRQ; + flag = IRQF_SHARED; if (request_irq(pi->port.irq, mpsc_sdma_intr, flag, "mpsc-sdma", pi)) @@ -1863,7 +1861,6 @@ static struct platform_driver mpsc_shared_driver = { static struct uart_driver mpsc_reg = { .owner = THIS_MODULE, .driver_name = MPSC_DRIVER_NAME, - .devfs_name = MPSC_DEVFS_NAME, .dev_name = MPSC_DEV_NAME, .major = MPSC_MAJOR, .minor = MPSC_MINOR_START, diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 64c0e89124c..4a1c9983f38 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c @@ -16,7 +16,6 @@ ** */ -#include <linux/config.h> #include <linux/module.h> #include <linux/tty.h> #include <linux/ioport.h> diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c index 513ff859770..459c0231aef 100644 --- a/drivers/serial/pmac_zilog.c +++ b/drivers/serial/pmac_zilog.c @@ -42,7 +42,6 @@ #undef DEBUG_HARD #undef USE_CTRL_O_SYSRQ -#include <linux/config.h> #include <linux/module.h> #include <linux/tty.h> @@ -101,7 +100,6 @@ static DEFINE_MUTEX(pmz_irq_mutex); static struct uart_driver pmz_uart_reg = { .owner = THIS_MODULE, .driver_name = "ttyS", - .devfs_name = "tts/", .dev_name = "ttyS", .major = TTY_MAJOR, }; @@ -936,7 +934,7 @@ static int pmz_startup(struct uart_port *port) } pmz_get_port_A(uap)->flags |= PMACZILOG_FLAG_IS_IRQ_ON; - if (request_irq(uap->port.irq, pmz_interrupt, SA_SHIRQ, "PowerMac Zilog", uap)) { + if (request_irq(uap->port.irq, pmz_interrupt, IRQF_SHARED, "PowerMac Zilog", uap)) { dev_err(&uap->dev->ofdev.dev, "Unable to register zs interrupt handler.\n"); pmz_set_scc_power(uap, 0); diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index ae364956854..a720953a404 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c @@ -24,7 +24,6 @@ * with the serial core maintainer satisfaction to appear soon. */ -#include <linux/config.h> #if defined(CONFIG_SERIAL_PXA_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ @@ -390,7 +389,7 @@ static int serial_pxa_startup(struct uart_port *port) /* * Finally, enable interrupts. Note: Modem status interrupts - * are set via set_termios(), which will be occuring imminently + * are set via set_termios(), which will be occurring imminently * anyway, so we don't enable them here. */ up->ier = UART_IER_RLSI | UART_IER_RDI | UART_IER_RTOIE | UART_IER_UUE; @@ -780,7 +779,6 @@ static struct uart_pxa_port serial_pxa_ports[] = { static struct uart_driver serial_pxa_reg = { .owner = THIS_MODULE, .driver_name = "PXA serial", - .devfs_name = "tts/", .dev_name = "ttyS", .major = TTY_MAJOR, .minor = 64, diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c index 837b6da520b..392bffcf96e 100644 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c @@ -55,7 +55,6 @@ * BJD, 04-Nov-2004 */ -#include <linux/config.h> #if defined(CONFIG_SERIAL_S3C2410_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ @@ -149,7 +148,6 @@ s3c24xx_serial_dbg(const char *fmt, ...) /* UART name and device definitions */ #define S3C24XX_SERIAL_NAME "ttySAC" -#define S3C24XX_SERIAL_DEVFS "tts/" #define S3C24XX_SERIAL_MAJOR 204 #define S3C24XX_SERIAL_MINOR 64 @@ -952,7 +950,6 @@ static struct uart_driver s3c24xx_uart_drv = { .nr = 3, .cons = S3C24XX_SERIAL_CONSOLE, .driver_name = S3C24XX_SERIAL_NAME, - .devfs_name = S3C24XX_SERIAL_DEVFS, .major = S3C24XX_SERIAL_MAJOR, .minor = S3C24XX_SERIAL_MINOR, }; diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c index c2d9068b491..db3486d3387 100644 --- a/drivers/serial/sa1100.c +++ b/drivers/serial/sa1100.c @@ -24,7 +24,6 @@ * $Id: sa1100.c,v 1.50 2002/07/29 14:41:04 rmk Exp $ * */ -#include <linux/config.h> #if defined(CONFIG_SERIAL_SA1100_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ @@ -816,7 +815,6 @@ static struct uart_driver sa1100_reg = { .owner = THIS_MODULE, .driver_name = "ttySA", .dev_name = "ttySA", - .devfs_name = "ttySA", .major = SERIAL_SA1100_MAJOR, .minor = MINOR_START, .nr = NR_PORTS, diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 17839e753e4..c54af877439 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@ -22,7 +22,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <linux/config.h> #include <linux/module.h> #include <linux/tty.h> #include <linux/slab.h> @@ -2153,7 +2152,6 @@ int uart_register_driver(struct uart_driver *drv) normal->owner = drv->owner; normal->driver_name = drv->driver_name; - normal->devfs_name = drv->devfs_name; normal->name = drv->dev_name; normal->major = drv->major; normal->minor_start = drv->minor; @@ -2161,7 +2159,7 @@ int uart_register_driver(struct uart_driver *drv) normal->subtype = SERIAL_TYPE_NORMAL; normal->init_termios = tty_std_termios; normal->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; - normal->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; + normal->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; normal->driver_state = drv; tty_set_operations(normal, &uart_ops); @@ -2312,7 +2310,7 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port) mutex_unlock(&state->mutex); /* - * Remove the devices from devfs + * Remove the devices from the tty layer */ tty_unregister_device(drv->tty_driver, port->line); diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 2c70773543e..cbf260bc225 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -786,6 +786,7 @@ static struct pcmcia_device_id serial_ids[] = { PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-4", 0x96913a85, 0xcec8f102, "COMpad4.cis"), PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "COMpad2.cis"), PCMCIA_DEVICE_CIS_PROD_ID2("RS-COM 2P", 0xad20b156, "RS-COM-2P.cis"), + PCMCIA_DEVICE_CIS_MANF_CARD(0x0013, 0x0000, "GLOBETROTTER.cis"), /* too generic */ /* PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0160, 0x0002), */ /* PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0160, 0x0002), */ diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c index 776d4ff0608..23ddedbaec0 100644 --- a/drivers/serial/serial_lh7a40x.c +++ b/drivers/serial/serial_lh7a40x.c @@ -27,7 +27,6 @@ * */ -#include <linux/config.h> #if defined(CONFIG_SERIAL_LH7A40X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c index 3bdee64d1a9..b361669f85a 100644 --- a/drivers/serial/serial_txx9.c +++ b/drivers/serial/serial_txx9.c @@ -38,7 +38,6 @@ * Fix some spin_locks. * Do not call uart_add_one_port for absent ports. */ -#include <linux/config.h> #if defined(CONFIG_SERIAL_TXX9_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ @@ -69,12 +68,10 @@ static char *serial_name = "TX39/49 Serial driver"; #if !defined(CONFIG_SERIAL_TXX9_STDSERIAL) /* "ttyS" is used for standard serial driver */ #define TXX9_TTY_NAME "ttyTX" -#define TXX9_TTY_DEVFS_NAME "tttx/" #define TXX9_TTY_MINOR_START (64 + 64) /* ttyTX0(128), ttyTX1(129) */ #else /* acts like standard serial driver */ #define TXX9_TTY_NAME "ttyS" -#define TXX9_TTY_DEVFS_NAME "tts/" #define TXX9_TTY_MINOR_START 64 #endif #define TXX9_TTY_MAJOR TTY_MAJOR @@ -498,7 +495,7 @@ static int serial_txx9_startup(struct uart_port *port) sio_out(up, TXX9_SIDISR, 0); retval = request_irq(up->port.irq, serial_txx9_interrupt, - SA_SHIRQ, "serial_txx9", up); + IRQF_SHARED, "serial_txx9", up); if (retval) return retval; @@ -971,7 +968,6 @@ console_initcall(serial_txx9_console_init); static struct uart_driver serial_txx9_reg = { .owner = THIS_MODULE, .driver_name = "serial_txx9", - .devfs_name = TXX9_TTY_DEVFS_NAME, .dev_name = TXX9_TTY_NAME, .major = TXX9_TTY_MAJOR, .minor = TXX9_TTY_MINOR_START, diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 44f6bf79bbe..301573373c3 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c @@ -20,7 +20,6 @@ #undef DEBUG -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/signal.h> @@ -842,7 +841,7 @@ static int sci_request_irq(struct sci_port *port) printk(KERN_ERR "sci: Cannot allocate irq.(IRQ=0)\n"); return -ENODEV; } - if (request_irq(port->irqs[0], sci_mpxed_interrupt, SA_INTERRUPT, + if (request_irq(port->irqs[0], sci_mpxed_interrupt, IRQF_DISABLED, "sci", port)) { printk(KERN_ERR "sci: Cannot allocate irq.\n"); return -ENODEV; @@ -851,7 +850,7 @@ static int sci_request_irq(struct sci_port *port) for (i = 0; i < ARRAY_SIZE(handlers); i++) { if (!port->irqs[i]) continue; - if (request_irq(port->irqs[i], handlers[i], SA_INTERRUPT, + if (request_irq(port->irqs[i], handlers[i], IRQF_DISABLED, desc[i], port)) { printk(KERN_ERR "sci: Cannot allocate irq.\n"); return -ENODEV; @@ -1699,9 +1698,6 @@ static char banner[] __initdata = static struct uart_driver sci_uart_driver = { .owner = THIS_MODULE, .driver_name = "sci", -#ifdef CONFIG_DEVFS_FS - .devfs_name = "ttsc/", -#endif .dev_name = "ttySC", .major = SCI_MAJOR, .minor = SCI_MINOR_START, diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index 1f14bb4382f..ab320fa3237 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h @@ -10,7 +10,6 @@ * Modified to support SH7300(SH-Mobile) SCIF. Takashi Kusuda (Jun 2003). * Modified to support H8/300 Series Yoshinori Sato (Feb 2004). */ -#include <linux/config.h> #include <linux/serial_core.h> #if defined(__H8300H__) || defined(__H8300S__) diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c index 60ea4a3f071..2f148e5b925 100644 --- a/drivers/serial/sn_console.c +++ b/drivers/serial/sn_console.c @@ -37,7 +37,6 @@ * http://oss.sgi.com/projects/GenInfo/NoticeExplan */ -#include <linux/config.h> #include <linux/interrupt.h> #include <linux/tty.h> #include <linux/serial.h> @@ -649,7 +648,7 @@ static irqreturn_t sn_sal_interrupt(int irq, void *dev_id, struct pt_regs *regs) static int sn_sal_connect_interrupt(struct sn_cons_port *port) { if (request_irq(SGI_UART_VECTOR, sn_sal_interrupt, - SA_INTERRUPT | SA_SHIRQ, + IRQF_DISABLED | IRQF_SHARED, "SAL console driver", port) >= 0) { return SGI_UART_VECTOR; } diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c index fa4ae94243c..e35d9ab359f 100644 --- a/drivers/serial/suncore.c +++ b/drivers/serial/suncore.c @@ -10,7 +10,6 @@ * Copyright (C) 2002 David S. Miller (davem@redhat.com) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/console.h> diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c index ba22e256c6f..f851f0f44f9 100644 --- a/drivers/serial/sunhv.c +++ b/drivers/serial/sunhv.c @@ -20,8 +20,8 @@ #include <asm/hypervisor.h> #include <asm/spitfire.h> -#include <asm/vdev.h> -#include <asm/oplib.h> +#include <asm/prom.h> +#include <asm/of_device.h> #include <asm/irq.h> #if defined(CONFIG_MAGIC_SYSRQ) @@ -353,7 +353,6 @@ static struct uart_ops sunhv_pops = { static struct uart_driver sunhv_reg = { .owner = THIS_MODULE, .driver_name = "serial", - .devfs_name = "tts/", .dev_name = "ttyS", .major = TTY_MAJOR, }; @@ -408,144 +407,120 @@ static inline struct console *SUNHV_CONSOLE(void) return &sunhv_console; } -static int __init hv_console_compatible(char *buf, int len) -{ - while (len) { - int this_len; - - if (!strcmp(buf, "qcn")) - return 1; - - this_len = strlen(buf) + 1; - - buf += this_len; - len -= this_len; - } - - return 0; -} - -static unsigned int __init get_interrupt(void) -{ - struct device_node *dev_node; - - dev_node = sun4v_vdev_root->child; - while (dev_node != NULL) { - struct property *prop; - - if (strcmp(dev_node->name, "console")) - goto next_sibling; - - prop = of_find_property(dev_node, "compatible", NULL); - if (!prop) - goto next_sibling; - - if (hv_console_compatible(prop->value, prop->length)) - break; - - next_sibling: - dev_node = dev_node->sibling; - } - if (!dev_node) - return 0; - - /* Ok, the this is the OBP node for the sun4v hypervisor - * console device. Decode the interrupt. - */ - return sun4v_vdev_device_interrupt(dev_node); -} - -static int __init sunhv_init(void) +static int __devinit hv_probe(struct of_device *op, const struct of_device_id *match) { struct uart_port *port; - int ret; + int err; - if (tlb_type != hypervisor) + if (op->irqs[0] == 0xffffffff) return -ENODEV; - port = kmalloc(sizeof(struct uart_port), GFP_KERNEL); + port = kzalloc(sizeof(struct uart_port), GFP_KERNEL); if (unlikely(!port)) return -ENOMEM; - memset(port, 0, sizeof(struct uart_port)); + sunhv_port = port; port->line = 0; port->ops = &sunhv_pops; port->type = PORT_SUNHV; port->uartclk = ( 29491200 / 16 ); /* arbitrary */ - /* Set this just to make uart_configure_port() happy. */ port->membase = (unsigned char __iomem *) __pa(port); - port->irq = get_interrupt(); - if (!port->irq) { - kfree(port); - return -ENODEV; - } + port->irq = op->irqs[0]; + + port->dev = &op->dev; sunhv_reg.minor = sunserial_current_minor; sunhv_reg.nr = 1; - ret = uart_register_driver(&sunhv_reg); - if (ret < 0) { - printk(KERN_ERR "SUNHV: uart_register_driver() failed %d\n", - ret); - kfree(port); - - return ret; - } + err = uart_register_driver(&sunhv_reg); + if (err) + goto out_free_port; sunhv_reg.tty_driver->name_base = sunhv_reg.minor - 64; sunserial_current_minor += 1; sunhv_reg.cons = SUNHV_CONSOLE(); - sunhv_port = port; + err = uart_add_one_port(&sunhv_reg, port); + if (err) + goto out_unregister_driver; - ret = uart_add_one_port(&sunhv_reg, port); - if (ret < 0) { - printk(KERN_ERR "SUNHV: uart_add_one_port() failed %d\n", ret); - sunserial_current_minor -= 1; - uart_unregister_driver(&sunhv_reg); - kfree(port); - sunhv_port = NULL; - return -ENODEV; - } + err = request_irq(port->irq, sunhv_interrupt, 0, "hvcons", port); + if (err) + goto out_remove_port; - if (request_irq(port->irq, sunhv_interrupt, - SA_SHIRQ, "serial(sunhv)", port)) { - printk(KERN_ERR "sunhv: Cannot register IRQ\n"); - uart_remove_one_port(&sunhv_reg, port); - sunserial_current_minor -= 1; - uart_unregister_driver(&sunhv_reg); - kfree(port); - sunhv_port = NULL; - return -ENODEV; - } + dev_set_drvdata(&op->dev, port); return 0; + +out_remove_port: + uart_remove_one_port(&sunhv_reg, port); + +out_unregister_driver: + sunserial_current_minor -= 1; + uart_unregister_driver(&sunhv_reg); + +out_free_port: + kfree(port); + sunhv_port = NULL; + return err; } -static void __exit sunhv_exit(void) +static int __devexit hv_remove(struct of_device *dev) { - struct uart_port *port = sunhv_port; - - BUG_ON(!port); + struct uart_port *port = dev_get_drvdata(&dev->dev); free_irq(port->irq, port); uart_remove_one_port(&sunhv_reg, port); - sunserial_current_minor -= 1; + sunserial_current_minor -= 1; uart_unregister_driver(&sunhv_reg); - kfree(sunhv_port); + kfree(port); sunhv_port = NULL; + + dev_set_drvdata(&dev->dev, NULL); + + return 0; +} + +static struct of_device_id hv_match[] = { + { + .name = "console", + .compatible = "qcn", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, hv_match); + +static struct of_platform_driver hv_driver = { + .name = "hv", + .match_table = hv_match, + .probe = hv_probe, + .remove = __devexit_p(hv_remove), +}; + +static int __init sunhv_init(void) +{ + if (tlb_type != hypervisor) + return -ENODEV; + + return of_register_driver(&hv_driver, &of_bus_type); +} + +static void __exit sunhv_exit(void) +{ + of_unregister_driver(&hv_driver); } module_init(sunhv_init); module_exit(sunhv_exit); MODULE_AUTHOR("David S. Miller"); -MODULE_DESCRIPTION("SUN4V Hypervisor console driver") +MODULE_DESCRIPTION("SUN4V Hypervisor console driver"); +MODULE_VERSION("2.0"); MODULE_LICENSE("GPL"); diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index e4c0fd2d6a9..0dbd4df44c0 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c @@ -1,7 +1,7 @@ /* sunsab.c: ASYNC Driver for the SIEMENS SAB82532 DUSCC. * * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) - * Copyright (C) 2002 David S. Miller (davem@redhat.com) + * Copyright (C) 2002, 2006 David S. Miller (davem@davemloft.net) * * Rewrote buffer handling to use CIRC(Circular Buffer) macros. * Maxim Krasnyanskiy <maxk@qualcomm.com> @@ -12,10 +12,9 @@ * Theodore Ts'o <tytso@mit.edu>, 2001-Oct-12 * * Ported to new 2.5.x UART layer. - * David S. Miller <davem@redhat.com> + * David S. Miller <davem@davemloft.net> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -37,8 +36,8 @@ #include <asm/io.h> #include <asm/irq.h> -#include <asm/oplib.h> -#include <asm/ebus.h> +#include <asm/prom.h> +#include <asm/of_device.h> #if defined(CONFIG_SERIAL_SUNZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ @@ -851,7 +850,6 @@ static struct uart_ops sunsab_pops = { static struct uart_driver sunsab_reg = { .owner = THIS_MODULE, .driver_name = "serial", - .devfs_name = "tts/", .dev_name = "ttyS", .major = TTY_MAJOR, }; @@ -977,199 +975,188 @@ static inline struct console *SUNSAB_CONSOLE(void) #define sunsab_console_init() do { } while (0) #endif -static void __init for_each_sab_edev(void (*callback)(struct linux_ebus_device *, void *), void *arg) +static int __devinit sunsab_init_one(struct uart_sunsab_port *up, + struct of_device *op, + unsigned long offset, + int line) { - struct linux_ebus *ebus; - struct linux_ebus_device *edev = NULL; - - for_each_ebus(ebus) { - for_each_ebusdev(edev, ebus) { - if (!strcmp(edev->prom_node->name, "se")) { - callback(edev, arg); - continue; - } else if (!strcmp(edev->prom_node->name, "serial")) { - char *compat; - int clen; - - /* On RIO this can be an SE, check it. We could - * just check ebus->is_rio, but this is more portable. - */ - compat = of_get_property(edev->prom_node, - "compatible", &clen); - if (compat && clen > 0) { - if (strncmp(compat, "sab82532", 8) == 0) { - callback(edev, arg); - continue; - } - } - } - } - } -} + up->port.line = line; + up->port.dev = &op->dev; + + up->port.mapbase = op->resource[0].start + offset; + up->port.membase = of_ioremap(&op->resource[0], offset, + sizeof(union sab82532_async_regs), + "sab"); + if (!up->port.membase) + return -ENOMEM; + up->regs = (union sab82532_async_regs __iomem *) up->port.membase; -static void __init sab_count_callback(struct linux_ebus_device *edev, void *arg) -{ - int *count_p = arg; + up->port.irq = op->irqs[0]; - (*count_p)++; -} + up->port.fifosize = SAB82532_XMIT_FIFO_SIZE; + up->port.iotype = UPIO_MEM; -static void __init sab_attach_callback(struct linux_ebus_device *edev, void *arg) -{ - int *instance_p = arg; - struct uart_sunsab_port *up; - unsigned long regs, offset; - int i; + writeb(SAB82532_IPC_IC_ACT_LOW, &up->regs->w.ipc); - /* Note: ports are located in reverse order */ - regs = edev->resource[0].start; - offset = sizeof(union sab82532_async_regs); - for (i = 0; i < 2; i++) { - up = &sunsab_ports[(*instance_p * 2) + 1 - i]; + up->port.ops = &sunsab_pops; + up->port.type = PORT_SUNSAB; + up->port.uartclk = SAB_BASE_BAUD; - memset(up, 0, sizeof(*up)); - up->regs = ioremap(regs + offset, sizeof(union sab82532_async_regs)); - up->port.irq = edev->irqs[0]; - up->port.fifosize = SAB82532_XMIT_FIFO_SIZE; - up->port.mapbase = (unsigned long)up->regs; - up->port.iotype = UPIO_MEM; + up->type = readb(&up->regs->r.vstr) & 0x0f; + writeb(~((1 << 1) | (1 << 2) | (1 << 4)), &up->regs->w.pcr); + writeb(0xff, &up->regs->w.pim); + if ((up->port.line & 0x1) == 0) { + up->pvr_dsr_bit = (1 << 0); + up->pvr_dtr_bit = (1 << 1); + } else { + up->pvr_dsr_bit = (1 << 3); + up->pvr_dtr_bit = (1 << 2); + } + up->cached_pvr = (1 << 1) | (1 << 2) | (1 << 4); + writeb(up->cached_pvr, &up->regs->w.pvr); + up->cached_mode = readb(&up->regs->rw.mode); + up->cached_mode |= SAB82532_MODE_FRTS; + writeb(up->cached_mode, &up->regs->rw.mode); + up->cached_mode |= SAB82532_MODE_RTS; + writeb(up->cached_mode, &up->regs->rw.mode); - writeb(SAB82532_IPC_IC_ACT_LOW, &up->regs->w.ipc); + up->tec_timeout = SAB82532_MAX_TEC_TIMEOUT; + up->cec_timeout = SAB82532_MAX_CEC_TIMEOUT; - offset -= sizeof(union sab82532_async_regs); + if (!(up->port.line & 0x01)) { + int err; + + err = request_irq(up->port.irq, sunsab_interrupt, + IRQF_SHARED, "sab", up); + if (err) { + of_iounmap(up->port.membase, + sizeof(union sab82532_async_regs)); + return err; + } } - - (*instance_p)++; + + return 0; } -static int __init probe_for_sabs(void) +static int __devinit sab_probe(struct of_device *op, const struct of_device_id *match) { - int this_sab = 0; + static int inst; + struct uart_sunsab_port *up; + int err; + + up = &sunsab_ports[inst * 2]; + + err = sunsab_init_one(&up[0], op, + sizeof(union sab82532_async_regs), + (inst * 2) + 0); + if (err) + return err; + + err = sunsab_init_one(&up[0], op, 0, + (inst * 2) + 1); + if (err) { + of_iounmap(up[0].port.membase, + sizeof(union sab82532_async_regs)); + free_irq(up[0].port.irq, &up[0]); + return err; + } - /* Find device instances. */ - for_each_sab_edev(&sab_count_callback, &this_sab); - if (!this_sab) - return -ENODEV; + uart_add_one_port(&sunsab_reg, &up[0].port); + uart_add_one_port(&sunsab_reg, &up[1].port); - /* Allocate tables. */ - sunsab_ports = kmalloc(sizeof(struct uart_sunsab_port) * this_sab * 2, - GFP_KERNEL); - if (!sunsab_ports) - return -ENOMEM; + dev_set_drvdata(&op->dev, &up[0]); - num_channels = this_sab * 2; + inst++; - this_sab = 0; - for_each_sab_edev(&sab_attach_callback, &this_sab); return 0; } -static void __init sunsab_init_hw(void) +static void __devexit sab_remove_one(struct uart_sunsab_port *up) { - int i; - - for (i = 0; i < num_channels; i++) { - struct uart_sunsab_port *up = &sunsab_ports[i]; - - up->port.line = i; - up->port.ops = &sunsab_pops; - up->port.type = PORT_SUNSAB; - up->port.uartclk = SAB_BASE_BAUD; - - up->type = readb(&up->regs->r.vstr) & 0x0f; - writeb(~((1 << 1) | (1 << 2) | (1 << 4)), &up->regs->w.pcr); - writeb(0xff, &up->regs->w.pim); - if (up->port.line == 0) { - up->pvr_dsr_bit = (1 << 0); - up->pvr_dtr_bit = (1 << 1); - } else { - up->pvr_dsr_bit = (1 << 3); - up->pvr_dtr_bit = (1 << 2); - } - up->cached_pvr = (1 << 1) | (1 << 2) | (1 << 4); - writeb(up->cached_pvr, &up->regs->w.pvr); - up->cached_mode = readb(&up->regs->rw.mode); - up->cached_mode |= SAB82532_MODE_FRTS; - writeb(up->cached_mode, &up->regs->rw.mode); - up->cached_mode |= SAB82532_MODE_RTS; - writeb(up->cached_mode, &up->regs->rw.mode); - - up->tec_timeout = SAB82532_MAX_TEC_TIMEOUT; - up->cec_timeout = SAB82532_MAX_CEC_TIMEOUT; - - if (!(up->port.line & 0x01)) { - if (request_irq(up->port.irq, sunsab_interrupt, - SA_SHIRQ, "serial(sab82532)", up)) { - printk("sunsab%d: can't get IRQ %x\n", - i, up->port.irq); - continue; - } - } - } + uart_remove_one_port(&sunsab_reg, &up->port); + if (!(up->port.line & 1)) + free_irq(up->port.irq, up); + of_iounmap(up->port.membase, + sizeof(union sab82532_async_regs)); } -static int __init sunsab_init(void) +static int __devexit sab_remove(struct of_device *op) { - int ret = probe_for_sabs(); - int i; - - if (ret < 0) - return ret; + struct uart_sunsab_port *up = dev_get_drvdata(&op->dev); - sunsab_init_hw(); + sab_remove_one(&up[0]); + sab_remove_one(&up[1]); - sunsab_reg.minor = sunserial_current_minor; - sunsab_reg.nr = num_channels; + dev_set_drvdata(&op->dev, NULL); - ret = uart_register_driver(&sunsab_reg); - if (ret < 0) { - int i; + return 0; +} - for (i = 0; i < num_channels; i++) { - struct uart_sunsab_port *up = &sunsab_ports[i]; +static struct of_device_id sab_match[] = { + { + .name = "se", + }, + { + .name = "serial", + .compatible = "sab82532", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, sab_match); - if (!(up->port.line & 0x01)) - free_irq(up->port.irq, up); - iounmap(up->regs); - } - kfree(sunsab_ports); - sunsab_ports = NULL; +static struct of_platform_driver sab_driver = { + .name = "sab", + .match_table = sab_match, + .probe = sab_probe, + .remove = __devexit_p(sab_remove), +}; - return ret; +static int __init sunsab_init(void) +{ + struct device_node *dp; + int err; + + num_channels = 0; + for_each_node_by_name(dp, "su") + num_channels += 2; + for_each_node_by_name(dp, "serial") { + if (of_device_is_compatible(dp, "sab82532")) + num_channels += 2; } - sunsab_reg.tty_driver->name_base = sunsab_reg.minor - 64; + if (num_channels) { + sunsab_ports = kzalloc(sizeof(struct uart_sunsab_port) * + num_channels, GFP_KERNEL); + if (!sunsab_ports) + return -ENOMEM; - sunsab_reg.cons = SUNSAB_CONSOLE(); + sunsab_reg.minor = sunserial_current_minor; + sunsab_reg.nr = num_channels; - sunserial_current_minor += num_channels; - - for (i = 0; i < num_channels; i++) { - struct uart_sunsab_port *up = &sunsab_ports[i]; + err = uart_register_driver(&sunsab_reg); + if (err) { + kfree(sunsab_ports); + sunsab_ports = NULL; - uart_add_one_port(&sunsab_reg, &up->port); + return err; + } + + sunsab_reg.tty_driver->name_base = sunsab_reg.minor - 64; + sunsab_reg.cons = SUNSAB_CONSOLE(); + sunserial_current_minor += num_channels; } - return 0; + return of_register_driver(&sab_driver, &of_bus_type); } static void __exit sunsab_exit(void) { - int i; - - for (i = 0; i < num_channels; i++) { - struct uart_sunsab_port *up = &sunsab_ports[i]; - - uart_remove_one_port(&sunsab_reg, &up->port); - - if (!(up->port.line & 0x01)) - free_irq(up->port.irq, up); - iounmap(up->regs); + of_unregister_driver(&sab_driver); + if (num_channels) { + sunserial_current_minor -= num_channels; + uart_unregister_driver(&sunsab_reg); } - sunserial_current_minor -= num_channels; - uart_unregister_driver(&sunsab_reg); - kfree(sunsab_ports); sunsab_ports = NULL; } diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index 0268b307c01..f9013baba05 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c @@ -12,10 +12,9 @@ * Theodore Ts'o <tytso@mit.edu>, 2001-Oct-12 * * Converted to new 2.5.x UART layer. - * David S. Miller (davem@redhat.com), 2002-Jul-29 + * David S. Miller (davem@davemloft.net), 2002-Jul-29 */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -40,11 +39,8 @@ #include <asm/io.h> #include <asm/irq.h> -#include <asm/oplib.h> -#include <asm/ebus.h> -#ifdef CONFIG_SPARC64 -#include <asm/isa.h> -#endif +#include <asm/prom.h> +#include <asm/of_device.h> #if defined(CONFIG_SERIAL_SUNSU_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ @@ -94,10 +90,10 @@ struct uart_sunsu_port { /* Probing information. */ enum su_type su_type; unsigned int type_probed; /* XXX Stupid */ - int port_node; + unsigned long reg_size; #ifdef CONFIG_SERIO - struct serio *serio; + struct serio serio; int serio_open; #endif }; @@ -509,7 +505,7 @@ static void receive_kbd_ms_chars(struct uart_sunsu_port *up, struct pt_regs *reg /* Stop-A is handled by drivers/char/keyboard.c now. */ if (up->su_type == SU_PORT_KBD) { #ifdef CONFIG_SERIO - serio_interrupt(up->serio, ch, 0, regs); + serio_interrupt(&up->serio, ch, 0, regs); #endif } else if (up->su_type == SU_PORT_MS) { int ret = suncore_mouse_baud_detection(ch, is_break); @@ -523,7 +519,7 @@ static void receive_kbd_ms_chars(struct uart_sunsu_port *up, struct pt_regs *reg case 0: #ifdef CONFIG_SERIO - serio_interrupt(up->serio, ch, 0, regs); + serio_interrupt(&up->serio, ch, 0, regs); #endif break; }; @@ -671,10 +667,10 @@ static int sunsu_startup(struct uart_port *port) if (up->su_type != SU_PORT_PORT) { retval = request_irq(up->port.irq, sunsu_kbd_ms_interrupt, - SA_SHIRQ, su_typev[up->su_type], up); + IRQF_SHARED, su_typev[up->su_type], up); } else { retval = request_irq(up->port.irq, sunsu_serial_interrupt, - SA_SHIRQ, su_typev[up->su_type], up); + IRQF_SHARED, su_typev[up->su_type], up); } if (retval) { printk("su: Cannot register IRQ %d\n", up->port.irq); @@ -1031,99 +1027,14 @@ static void sunsu_autoconfig(struct uart_sunsu_port *up) { unsigned char status1, status2, scratch, scratch2, scratch3; unsigned char save_lcr, save_mcr; - struct linux_ebus_device *dev = NULL; - struct linux_ebus *ebus; -#ifdef CONFIG_SPARC64 - struct sparc_isa_bridge *isa_br; - struct sparc_isa_device *isa_dev; -#endif -#ifndef CONFIG_SPARC64 - struct linux_prom_registers reg0; -#endif unsigned long flags; - if (!up->port_node || !up->su_type) + if (up->su_type == SU_PORT_NONE) return; up->type_probed = PORT_UNKNOWN; up->port.iotype = UPIO_MEM; - /* - * First we look for Ebus-bases su's - */ - for_each_ebus(ebus) { - for_each_ebusdev(dev, ebus) { - if (dev->prom_node->node == up->port_node) { - /* - * The EBus is broken on sparc; it delivers - * virtual addresses in resources. Oh well... - * This is correct on sparc64, though. - */ - up->port.membase = (char *) dev->resource[0].start; - /* - * This is correct on both architectures. - */ - up->port.mapbase = dev->resource[0].start; - up->port.irq = dev->irqs[0]; - goto ebus_done; - } - } - } - -#ifdef CONFIG_SPARC64 - for_each_isa(isa_br) { - for_each_isadev(isa_dev, isa_br) { - if (isa_dev->prom_node->node == up->port_node) { - /* Same on sparc64. Cool architecure... */ - up->port.membase = (char *) isa_dev->resource.start; - up->port.mapbase = isa_dev->resource.start; - up->port.irq = isa_dev->irq; - goto ebus_done; - } - } - } -#endif - -#ifdef CONFIG_SPARC64 - /* - * Not on Ebus, bailing. - */ - return; -#else - /* - * Not on Ebus, must be OBIO. - */ - if (prom_getproperty(up->port_node, "reg", - (char *)®0, sizeof(reg0)) == -1) { - prom_printf("sunsu: no \"reg\" property\n"); - return; - } - prom_apply_obio_ranges(®0, 1); - if (reg0.which_io != 0) { /* Just in case... */ - prom_printf("sunsu: bus number nonzero: 0x%x:%x\n", - reg0.which_io, reg0.phys_addr); - return; - } - up->port.mapbase = reg0.phys_addr; - if ((up->port.membase = ioremap(reg0.phys_addr, reg0.reg_size)) == 0) { - prom_printf("sunsu: Cannot map registers.\n"); - return; - } - - /* - * 0x20 is sun4m thing, Dave Redman heritage. - * See arch/sparc/kernel/irq.c. - */ -#define IRQ_4M(n) ((n)|0x20) - - /* - * There is no intr property on MrCoffee, so hardwire it. - */ - up->port.irq = IRQ_4M(13); -#endif - -ebus_done: - spin_lock_irqsave(&up->port.lock, flags); if (!(up->port.flags & UPF_BUGGY_UART)) { @@ -1265,23 +1176,17 @@ out: static struct uart_driver sunsu_reg = { .owner = THIS_MODULE, .driver_name = "serial", - .devfs_name = "tts/", .dev_name = "ttyS", .major = TTY_MAJOR, }; -static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up, int channel) +static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up) { int quot, baud; #ifdef CONFIG_SERIO struct serio *serio; #endif - spin_lock_init(&up->port.lock); - up->port.line = channel; - up->port.type = PORT_UNKNOWN; - up->port.uartclk = (SU_BASE_BAUD * 16); - if (up->su_type == SU_PORT_KBD) { up->cflag = B1200 | CS8 | CLOCAL | CREAD; baud = 1200; @@ -1293,41 +1198,31 @@ static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up, int channel) sunsu_autoconfig(up); if (up->port.type == PORT_UNKNOWN) - return -1; - - printk(KERN_INFO "su%d at 0x%p (irq = %d) is a %s\n", - channel, - up->port.membase, up->port.irq, - sunsu_type(&up->port)); + return -ENODEV; #ifdef CONFIG_SERIO - up->serio = serio = kmalloc(sizeof(struct serio), GFP_KERNEL); - if (serio) { - memset(serio, 0, sizeof(*serio)); - - serio->port_data = up; - - serio->id.type = SERIO_RS232; - if (up->su_type == SU_PORT_KBD) { - serio->id.proto = SERIO_SUNKBD; - strlcpy(serio->name, "sukbd", sizeof(serio->name)); - } else { - serio->id.proto = SERIO_SUN; - serio->id.extra = 1; - strlcpy(serio->name, "sums", sizeof(serio->name)); - } - strlcpy(serio->phys, (channel == 0 ? "su/serio0" : "su/serio1"), - sizeof(serio->phys)); - - serio->write = sunsu_serio_write; - serio->open = sunsu_serio_open; - serio->close = sunsu_serio_close; + serio = &up->serio; + serio->port_data = up; - serio_register_port(serio); + serio->id.type = SERIO_RS232; + if (up->su_type == SU_PORT_KBD) { + serio->id.proto = SERIO_SUNKBD; + strlcpy(serio->name, "sukbd", sizeof(serio->name)); } else { - printk(KERN_WARNING "su%d: not enough memory for serio port\n", - channel); + serio->id.proto = SERIO_SUN; + serio->id.extra = 1; + strlcpy(serio->name, "sums", sizeof(serio->name)); } + strlcpy(serio->phys, + (!(up->port.line & 1) ? "su/serio0" : "su/serio1"), + sizeof(serio->phys)); + + serio->write = sunsu_serio_write; + serio->open = sunsu_serio_open; + serio->close = sunsu_serio_close; + serio->dev.parent = up->port.dev; + + serio_register_port(serio); #endif sunsu_change_speed(&up->port, up->cflag, 0, quot); @@ -1459,22 +1354,20 @@ static struct console sunsu_cons = { * Register console. */ -static inline struct console *SUNSU_CONSOLE(void) +static inline struct console *SUNSU_CONSOLE(int num_uart) { int i; if (con_is_present()) return NULL; - for (i = 0; i < UART_NR; i++) { + for (i = 0; i < num_uart; i++) { int this_minor = sunsu_reg.minor + i; if ((this_minor - 64) == (serial_console - 1)) break; } - if (i == UART_NR) - return NULL; - if (sunsu_ports[i].port_node == 0) + if (i == num_uart) return NULL; sunsu_cons.index = i; @@ -1482,252 +1375,186 @@ static inline struct console *SUNSU_CONSOLE(void) return &sunsu_cons; } #else -#define SUNSU_CONSOLE() (NULL) +#define SUNSU_CONSOLE(num_uart) (NULL) #define sunsu_serial_console_init() do { } while (0) #endif -static int __init sunsu_serial_init(void) +static enum su_type __devinit su_get_type(struct device_node *dp) { - int instance, ret, i; + struct device_node *ap = of_find_node_by_path("/aliases"); - /* How many instances do we need? */ - instance = 0; - for (i = 0; i < UART_NR; i++) { - struct uart_sunsu_port *up = &sunsu_ports[i]; + if (ap) { + char *keyb = of_get_property(ap, "keyboard", NULL); + char *ms = of_get_property(ap, "mouse", NULL); - if (up->su_type == SU_PORT_MS || - up->su_type == SU_PORT_KBD) - continue; + if (keyb) { + if (dp == of_find_node_by_path(keyb)) + return SU_PORT_KBD; + } + if (ms) { + if (dp == of_find_node_by_path(ms)) + return SU_PORT_MS; + } + } - spin_lock_init(&up->port.lock); - up->port.flags |= UPF_BOOT_AUTOCONF; - up->port.type = PORT_UNKNOWN; - up->port.uartclk = (SU_BASE_BAUD * 16); + return SU_PORT_PORT; +} - sunsu_autoconfig(up); - if (up->port.type == PORT_UNKNOWN) - continue; +static int __devinit su_probe(struct of_device *op, const struct of_device_id *match) +{ + static int inst; + struct device_node *dp = op->node; + struct uart_sunsu_port *up; + struct resource *rp; + int err; - up->port.line = instance++; - up->port.ops = &sunsu_pops; - } + if (inst >= UART_NR) + return -EINVAL; - sunsu_reg.minor = sunserial_current_minor; + up = &sunsu_ports[inst]; + up->port.line = inst; - sunsu_reg.nr = instance; + spin_lock_init(&up->port.lock); - ret = uart_register_driver(&sunsu_reg); - if (ret < 0) - return ret; + up->su_type = su_get_type(dp); - sunsu_reg.tty_driver->name_base = sunsu_reg.minor - 64; + rp = &op->resource[0]; + up->port.mapbase = op->resource[0].start; - sunserial_current_minor += instance; + up->reg_size = (rp->end - rp->start) + 1; + up->port.membase = of_ioremap(rp, 0, up->reg_size, "su"); + if (!up->port.membase) + return -ENOMEM; - sunsu_reg.cons = SUNSU_CONSOLE(); + up->port.irq = op->irqs[0]; - for (i = 0; i < UART_NR; i++) { - struct uart_sunsu_port *up = &sunsu_ports[i]; + up->port.dev = &op->dev; - /* Do not register Keyboard/Mouse lines with UART - * layer. - */ - if (up->su_type == SU_PORT_MS || - up->su_type == SU_PORT_KBD) - continue; + up->port.type = PORT_UNKNOWN; + up->port.uartclk = (SU_BASE_BAUD * 16); - if (up->port.type == PORT_UNKNOWN) - continue; + err = 0; + if (up->su_type == SU_PORT_KBD || up->su_type == SU_PORT_MS) { + err = sunsu_kbd_ms_init(up); + if (err) + goto out_unmap; - uart_add_one_port(&sunsu_reg, &up->port); + return 0; } - return 0; -} + up->port.flags |= UPF_BOOT_AUTOCONF; -static int su_node_ok(int node, char *name, int namelen) -{ - if (strncmp(name, "su", namelen) == 0 || - strncmp(name, "su_pnp", namelen) == 0) - return 1; - - if (strncmp(name, "serial", namelen) == 0) { - char compat[32]; - int clen; - - /* Is it _really_ a 'su' device? */ - clen = prom_getproperty(node, "compatible", compat, sizeof(compat)); - if (clen > 0) { - if (strncmp(compat, "sab82532", 8) == 0) { - /* Nope, Siemens serial, not for us. */ - return 0; - } - } - return 1; - } + sunsu_autoconfig(up); - return 0; -} + err = -ENODEV; + if (up->port.type == PORT_UNKNOWN) + goto out_unmap; -#define SU_PROPSIZE 128 + up->port.ops = &sunsu_pops; -/* - * Scan status structure. - * "prop" is a local variable but it eats stack to keep it in each - * stack frame of a recursive procedure. - */ -struct su_probe_scan { - int msnode, kbnode; /* PROM nodes for mouse and keyboard */ - int msx, kbx; /* minors for mouse and keyboard */ - int devices; /* scan index */ - char prop[SU_PROPSIZE]; -}; + err = uart_add_one_port(&sunsu_reg, &up->port); + if (err) + goto out_unmap; -/* - * We have several platforms which present 'su' in different parts - * of the device tree. 'su' may be found under obio, ebus, isa and pci. - * We walk over the tree and find them wherever PROM hides them. - */ -static void __init su_probe_any(struct su_probe_scan *t, int sunode) -{ - struct uart_sunsu_port *up; - int len; + dev_set_drvdata(&op->dev, up); - if (t->devices >= UART_NR) - return; + inst++; - for (; sunode != 0; sunode = prom_getsibling(sunode)) { - len = prom_getproperty(sunode, "name", t->prop, SU_PROPSIZE); - if (len <= 1) - continue; /* Broken PROM node */ - - if (su_node_ok(sunode, t->prop, len)) { - up = &sunsu_ports[t->devices]; - if (t->kbnode != 0 && sunode == t->kbnode) { - t->kbx = t->devices; - up->su_type = SU_PORT_KBD; - } else if (t->msnode != 0 && sunode == t->msnode) { - t->msx = t->devices; - up->su_type = SU_PORT_MS; - } else { -#ifdef CONFIG_SPARC64 - /* - * Do not attempt to use the truncated - * keyboard/mouse ports as serial ports - * on Ultras with PC keyboard attached. - */ - if (prom_getbool(sunode, "mouse")) - continue; - if (prom_getbool(sunode, "keyboard")) - continue; -#endif - up->su_type = SU_PORT_PORT; - } - up->port_node = sunode; - ++t->devices; - } else { - su_probe_any(t, prom_getchild(sunode)); - } - } + return 0; + +out_unmap: + of_iounmap(up->port.membase, up->reg_size); + return err; } -static int __init sunsu_probe(void) +static int __devexit su_remove(struct of_device *dev) { - int node; - int len; - struct su_probe_scan scan; + struct uart_sunsu_port *up = dev_get_drvdata(&dev->dev);; - /* - * First, we scan the tree. - */ - scan.devices = 0; - scan.msx = -1; - scan.kbx = -1; - scan.kbnode = 0; - scan.msnode = 0; + if (up->su_type == SU_PORT_MS || + up->su_type == SU_PORT_KBD) { +#ifdef CONFIG_SERIO + serio_unregister_port(&up->serio); +#endif + } else if (up->port.type != PORT_UNKNOWN) + uart_remove_one_port(&sunsu_reg, &up->port); - /* - * Get the nodes for keyboard and mouse from 'aliases'... - */ - node = prom_getchild(prom_root_node); - node = prom_searchsiblings(node, "aliases"); - if (node != 0) { - len = prom_getproperty(node, "keyboard", scan.prop, SU_PROPSIZE); - if (len > 0) { - scan.prop[len] = 0; - scan.kbnode = prom_finddevice(scan.prop); - } + return 0; +} - len = prom_getproperty(node, "mouse", scan.prop, SU_PROPSIZE); - if (len > 0) { - scan.prop[len] = 0; - scan.msnode = prom_finddevice(scan.prop); - } - } +static struct of_device_id su_match[] = { + { + .name = "su", + }, + { + .name = "su_pnp", + }, + { + .name = "serial", + .compatible = "su", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, su_match); - su_probe_any(&scan, prom_getchild(prom_root_node)); +static struct of_platform_driver su_driver = { + .name = "su", + .match_table = su_match, + .probe = su_probe, + .remove = __devexit_p(su_remove), +}; - /* - * Second, we process the special case of keyboard and mouse. - * - * Currently if we got keyboard and mouse hooked to "su" ports - * we do not use any possible remaining "su" as a serial port. - * Thus, we ignore values of .msx and .kbx, then compact ports. - */ - if (scan.msx != -1 && scan.kbx != -1) { - sunsu_ports[0].su_type = SU_PORT_MS; - sunsu_ports[0].port_node = scan.msnode; - sunsu_kbd_ms_init(&sunsu_ports[0], 0); +static int num_uart; - sunsu_ports[1].su_type = SU_PORT_KBD; - sunsu_ports[1].port_node = scan.kbnode; - sunsu_kbd_ms_init(&sunsu_ports[1], 1); +static int __init sunsu_init(void) +{ + struct device_node *dp; + int err; - return 0; + num_uart = 0; + for_each_node_by_name(dp, "su") { + if (su_get_type(dp) == SU_PORT_PORT) + num_uart++; } - - if (scan.msx != -1 || scan.kbx != -1) { - printk("sunsu_probe: cannot match keyboard and mouse, confused\n"); - return -ENODEV; + for_each_node_by_name(dp, "su_pnp") { + if (su_get_type(dp) == SU_PORT_PORT) + num_uart++; + } + for_each_node_by_name(dp, "serial") { + if (of_device_is_compatible(dp, "su")) { + if (su_get_type(dp) == SU_PORT_PORT) + num_uart++; + } } - if (scan.devices == 0) - return -ENODEV; + if (num_uart) { + sunsu_reg.minor = sunserial_current_minor; + sunsu_reg.nr = num_uart; + err = uart_register_driver(&sunsu_reg); + if (err) + return err; + sunsu_reg.tty_driver->name_base = sunsu_reg.minor - 64; + sunserial_current_minor += num_uart; + sunsu_reg.cons = SUNSU_CONSOLE(num_uart); + } - /* - * Console must be initiated after the generic initialization. - */ - sunsu_serial_init(); + err = of_register_driver(&su_driver, &of_bus_type); + if (err && num_uart) + uart_unregister_driver(&sunsu_reg); - return 0; + return err; } static void __exit sunsu_exit(void) { - int i, saw_uart; - - saw_uart = 0; - for (i = 0; i < UART_NR; i++) { - struct uart_sunsu_port *up = &sunsu_ports[i]; - - if (up->su_type == SU_PORT_MS || - up->su_type == SU_PORT_KBD) { -#ifdef CONFIG_SERIO - if (up->serio) { - serio_unregister_port(up->serio); - up->serio = NULL; - } -#endif - } else if (up->port.type != PORT_UNKNOWN) { - uart_remove_one_port(&sunsu_reg, &up->port); - saw_uart++; - } - } - - if (saw_uart) + if (num_uart) uart_unregister_driver(&sunsu_reg); } -module_init(sunsu_probe); +module_init(sunsu_init); module_exit(sunsu_exit); + +MODULE_AUTHOR("Eddie C. Dost, Peter Zaitcev, and David S. Miller"); +MODULE_DESCRIPTION("Sun SU serial port driver"); +MODULE_VERSION("2.0"); MODULE_LICENSE("GPL"); diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index 76c9bac9271..a1456d9352c 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c @@ -1,5 +1,4 @@ -/* - * sunzilog.c +/* sunzilog.c: Zilog serial driver for Sparc systems. * * Driver for Zilog serial chips found on Sun workstations and * servers. This driver could actually be made more generic. @@ -10,10 +9,9 @@ * C. Dost, Pete Zaitcev, Ted Ts'o and Alex Buell for their * work there. * - * Copyright (C) 2002 David S. Miller (davem@redhat.com) + * Copyright (C) 2002, 2006 David S. Miller (davem@davemloft.net) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -38,10 +36,8 @@ #include <asm/io.h> #include <asm/irq.h> -#ifdef CONFIG_SPARC64 -#include <asm/fhc.h> -#endif -#include <asm/sbus.h> +#include <asm/prom.h> +#include <asm/of_device.h> #if defined(CONFIG_SERIAL_SUNZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ @@ -65,7 +61,7 @@ #define ZSDELAY() #define ZSDELAY_LONG() #define ZS_WSYNC(__channel) \ - sbus_readb(&((__channel)->control)) + readb(&((__channel)->control)) #endif static int num_sunzilog; @@ -107,7 +103,7 @@ struct uart_sunzilog_port { unsigned char prev_status; #ifdef CONFIG_SERIO - struct serio *serio; + struct serio serio; int serio_open; #endif }; @@ -138,9 +134,9 @@ static unsigned char read_zsreg(struct zilog_channel __iomem *channel, { unsigned char retval; - sbus_writeb(reg, &channel->control); + writeb(reg, &channel->control); ZSDELAY(); - retval = sbus_readb(&channel->control); + retval = readb(&channel->control); ZSDELAY(); return retval; @@ -149,9 +145,9 @@ static unsigned char read_zsreg(struct zilog_channel __iomem *channel, static void write_zsreg(struct zilog_channel __iomem *channel, unsigned char reg, unsigned char value) { - sbus_writeb(reg, &channel->control); + writeb(reg, &channel->control); ZSDELAY(); - sbus_writeb(value, &channel->control); + writeb(value, &channel->control); ZSDELAY(); } @@ -162,17 +158,17 @@ static void sunzilog_clear_fifo(struct zilog_channel __iomem *channel) for (i = 0; i < 32; i++) { unsigned char regval; - regval = sbus_readb(&channel->control); + regval = readb(&channel->control); ZSDELAY(); if (regval & Rx_CH_AV) break; regval = read_zsreg(channel, R1); - sbus_readb(&channel->data); + readb(&channel->data); ZSDELAY(); if (regval & (PAR_ERR | Rx_OVR | CRC_ERR)) { - sbus_writeb(ERR_RES, &channel->control); + writeb(ERR_RES, &channel->control); ZSDELAY(); ZS_WSYNC(channel); } @@ -194,7 +190,7 @@ static void __load_zsregs(struct zilog_channel __iomem *channel, unsigned char * udelay(100); } - sbus_writeb(ERR_RES, &channel->control); + writeb(ERR_RES, &channel->control); ZSDELAY(); ZS_WSYNC(channel); @@ -291,7 +287,7 @@ static void sunzilog_kbdms_receive_chars(struct uart_sunzilog_port *up, /* Stop-A is handled by drivers/char/keyboard.c now. */ #ifdef CONFIG_SERIO if (up->serio_open) - serio_interrupt(up->serio, ch, 0, regs); + serio_interrupt(&up->serio, ch, 0, regs); #endif } else if (ZS_IS_MOUSE(up)) { int ret = suncore_mouse_baud_detection(ch, is_break); @@ -306,7 +302,7 @@ static void sunzilog_kbdms_receive_chars(struct uart_sunzilog_port *up, case 0: #ifdef CONFIG_SERIO if (up->serio_open) - serio_interrupt(up->serio, ch, 0, regs); + serio_interrupt(&up->serio, ch, 0, regs); #endif break; }; @@ -330,12 +326,12 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up, r1 = read_zsreg(channel, R1); if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) { - sbus_writeb(ERR_RES, &channel->control); + writeb(ERR_RES, &channel->control); ZSDELAY(); ZS_WSYNC(channel); } - ch = sbus_readb(&channel->control); + ch = readb(&channel->control); ZSDELAY(); /* This funny hack depends upon BRK_ABRT not interfering @@ -347,7 +343,7 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up, if (!(ch & Rx_CH_AV)) break; - ch = sbus_readb(&channel->data); + ch = readb(&channel->data); ZSDELAY(); ch &= up->parity_mask; @@ -406,10 +402,10 @@ static void sunzilog_status_handle(struct uart_sunzilog_port *up, { unsigned char status; - status = sbus_readb(&channel->control); + status = readb(&channel->control); ZSDELAY(); - sbus_writeb(RES_EXT_INT, &channel->control); + writeb(RES_EXT_INT, &channel->control); ZSDELAY(); ZS_WSYNC(channel); @@ -421,7 +417,7 @@ static void sunzilog_status_handle(struct uart_sunzilog_port *up, * confusing the PROM. */ while (1) { - status = sbus_readb(&channel->control); + status = readb(&channel->control); ZSDELAY(); if (!(status & BRK_ABRT)) break; @@ -458,7 +454,7 @@ static void sunzilog_transmit_chars(struct uart_sunzilog_port *up, struct circ_buf *xmit; if (ZS_IS_CONS(up)) { - unsigned char status = sbus_readb(&channel->control); + unsigned char status = readb(&channel->control); ZSDELAY(); /* TX still busy? Just wait for the next TX done interrupt. @@ -487,7 +483,7 @@ static void sunzilog_transmit_chars(struct uart_sunzilog_port *up, if (up->port.x_char) { up->flags |= SUNZILOG_FLAG_TX_ACTIVE; - sbus_writeb(up->port.x_char, &channel->data); + writeb(up->port.x_char, &channel->data); ZSDELAY(); ZS_WSYNC(channel); @@ -506,7 +502,7 @@ static void sunzilog_transmit_chars(struct uart_sunzilog_port *up, goto ack_tx_int; up->flags |= SUNZILOG_FLAG_TX_ACTIVE; - sbus_writeb(xmit->buf[xmit->tail], &channel->data); + writeb(xmit->buf[xmit->tail], &channel->data); ZSDELAY(); ZS_WSYNC(channel); @@ -519,7 +515,7 @@ static void sunzilog_transmit_chars(struct uart_sunzilog_port *up, return; ack_tx_int: - sbus_writeb(RES_Tx_P, &channel->control); + writeb(RES_Tx_P, &channel->control); ZSDELAY(); ZS_WSYNC(channel); } @@ -540,7 +536,7 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id, struct pt_regs *reg /* Channel A */ tty = NULL; if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { - sbus_writeb(RES_H_IUS, &channel->control); + writeb(RES_H_IUS, &channel->control); ZSDELAY(); ZS_WSYNC(channel); @@ -563,7 +559,7 @@ static irqreturn_t sunzilog_interrupt(int irq, void *dev_id, struct pt_regs *reg spin_lock(&up->port.lock); tty = NULL; if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { - sbus_writeb(RES_H_IUS, &channel->control); + writeb(RES_H_IUS, &channel->control); ZSDELAY(); ZS_WSYNC(channel); @@ -594,7 +590,7 @@ static __inline__ unsigned char sunzilog_read_channel_status(struct uart_port *p unsigned char status; channel = ZILOG_CHANNEL_FROM_PORT(port); - status = sbus_readb(&channel->control); + status = readb(&channel->control); ZSDELAY(); return status; @@ -682,7 +678,7 @@ static void sunzilog_start_tx(struct uart_port *port) up->flags |= SUNZILOG_FLAG_TX_ACTIVE; up->flags &= ~SUNZILOG_FLAG_TX_STOPPED; - status = sbus_readb(&channel->control); + status = readb(&channel->control); ZSDELAY(); /* TX busy? Just wait for the TX done interrupt. */ @@ -693,7 +689,7 @@ static void sunzilog_start_tx(struct uart_port *port) * IRQ sending engine. */ if (port->x_char) { - sbus_writeb(port->x_char, &channel->data); + writeb(port->x_char, &channel->data); ZSDELAY(); ZS_WSYNC(channel); @@ -702,7 +698,7 @@ static void sunzilog_start_tx(struct uart_port *port) } else { struct circ_buf *xmit = &port->info->xmit; - sbus_writeb(xmit->buf[xmit->tail], &channel->data); + writeb(xmit->buf[xmit->tail], &channel->data); ZSDELAY(); ZS_WSYNC(channel); @@ -779,7 +775,7 @@ static void __sunzilog_startup(struct uart_sunzilog_port *up) struct zilog_channel __iomem *channel; channel = ZILOG_CHANNEL_FROM_PORT(&up->port); - up->prev_status = sbus_readb(&channel->control); + up->prev_status = readb(&channel->control); /* Enable receiver and transmitter. */ up->curregs[R3] |= RxENAB; @@ -963,7 +959,7 @@ sunzilog_set_termios(struct uart_port *port, struct termios *termios, static const char *sunzilog_type(struct uart_port *port) { - return "SunZilog"; + return "zs"; } /* We do not request/release mappings of the registers here, this @@ -1012,242 +1008,55 @@ static struct uart_sunzilog_port *sunzilog_port_table; static struct zilog_layout __iomem **sunzilog_chip_regs; static struct uart_sunzilog_port *sunzilog_irq_chain; -static int zilog_irq = -1; static struct uart_driver sunzilog_reg = { .owner = THIS_MODULE, .driver_name = "ttyS", - .devfs_name = "tts/", .dev_name = "ttyS", .major = TTY_MAJOR, }; -static void * __init alloc_one_table(unsigned long size) -{ - void *ret; - - ret = kmalloc(size, GFP_KERNEL); - if (ret != NULL) - memset(ret, 0, size); - - return ret; -} - -static void __init sunzilog_alloc_tables(void) -{ - sunzilog_port_table = - alloc_one_table(NUM_CHANNELS * sizeof(struct uart_sunzilog_port)); - sunzilog_chip_regs = - alloc_one_table(NUM_SUNZILOG * sizeof(struct zilog_layout __iomem *)); - - if (sunzilog_port_table == NULL || sunzilog_chip_regs == NULL) { - prom_printf("SunZilog: Cannot allocate tables.\n"); - prom_halt(); - } -} - -#ifdef CONFIG_SPARC64 - -/* We used to attempt to use the address property of the Zilog device node - * but that totally is not necessary on sparc64. - */ -static struct zilog_layout __iomem * __init get_zs_sun4u(int chip, int zsnode) +static int __init sunzilog_alloc_tables(void) { - void __iomem *mapped_addr; - unsigned int sun4u_ino; - struct sbus_bus *sbus = NULL; - struct sbus_dev *sdev = NULL; - int err; - - if (central_bus == NULL) { - for_each_sbus(sbus) { - for_each_sbusdev(sdev, sbus) { - if (sdev->prom_node == zsnode) - goto found; - } - } - } - found: - if (sdev == NULL && central_bus == NULL) { - prom_printf("SunZilog: sdev&¢ral == NULL for " - "Zilog %d in get_zs_sun4u.\n", chip); - prom_halt(); - } - if (central_bus == NULL) { - mapped_addr = - sbus_ioremap(&sdev->resource[0], 0, - PAGE_SIZE, - "Zilog Registers"); - } else { - struct linux_prom_registers zsregs[1]; - - err = prom_getproperty(zsnode, "reg", - (char *) &zsregs[0], - sizeof(zsregs)); - if (err == -1) { - prom_printf("SunZilog: Cannot map " - "Zilog %d regs on " - "central bus.\n", chip); - prom_halt(); - } - apply_fhc_ranges(central_bus->child, - &zsregs[0], 1); - apply_central_ranges(central_bus, &zsregs[0], 1); - mapped_addr = (void __iomem *) - ((((u64)zsregs[0].which_io)<<32UL) | - ((u64)zsregs[0].phys_addr)); - } - - if (zilog_irq == -1) { - if (central_bus) { - unsigned long iclr, imap; - - iclr = central_bus->child->fhc_regs.uregs - + FHC_UREGS_ICLR; - imap = central_bus->child->fhc_regs.uregs - + FHC_UREGS_IMAP; - zilog_irq = build_irq(0, iclr, imap); - } else { - err = prom_getproperty(zsnode, "interrupts", - (char *) &sun4u_ino, - sizeof(sun4u_ino)); - zilog_irq = sbus_build_irq(sbus_root, sun4u_ino); - } - } - - return (struct zilog_layout __iomem *) mapped_addr; -} -#else /* CONFIG_SPARC64 */ - -/* - * XXX The sun4d case is utterly screwed: it tries to re-walk the tree - * (for the 3rd time) in order to find bootbus and cpu. Streamline it. - */ -static struct zilog_layout __iomem * __init get_zs_sun4cmd(int chip, int node) -{ - struct linux_prom_irqs irq_info[2]; - void __iomem *mapped_addr = NULL; - int zsnode, cpunode, bbnode; - struct linux_prom_registers zsreg[4]; - struct resource res; - - if (sparc_cpu_model == sun4d) { - int walk; - - zsnode = 0; - bbnode = 0; - cpunode = 0; - for (walk = prom_getchild(prom_root_node); - (walk = prom_searchsiblings(walk, "cpu-unit")) != 0; - walk = prom_getsibling(walk)) { - bbnode = prom_getchild(walk); - if (bbnode && - (bbnode = prom_searchsiblings(bbnode, "bootbus"))) { - if ((zsnode = prom_getchild(bbnode)) == node) { - cpunode = walk; - break; - } - } - } - if (!walk) { - prom_printf("SunZilog: Cannot find the %d'th bootbus on sun4d.\n", - (chip / 2)); - prom_halt(); - } + struct uart_sunzilog_port *up; + unsigned long size; + int i; - if (prom_getproperty(zsnode, "reg", - (char *) zsreg, sizeof(zsreg)) == -1) { - prom_printf("SunZilog: Cannot map Zilog %d\n", chip); - prom_halt(); - } - /* XXX Looks like an off by one? */ - prom_apply_generic_ranges(bbnode, cpunode, zsreg, 1); - res.start = zsreg[0].phys_addr; - res.end = res.start + (8 - 1); - res.flags = zsreg[0].which_io | IORESOURCE_IO; - mapped_addr = sbus_ioremap(&res, 0, 8, "Zilog Serial"); + size = NUM_CHANNELS * sizeof(struct uart_sunzilog_port); + sunzilog_port_table = kzalloc(size, GFP_KERNEL); + if (!sunzilog_port_table) + return -ENOMEM; - } else { - zsnode = node; + for (i = 0; i < NUM_CHANNELS; i++) { + up = &sunzilog_port_table[i]; -#if 0 /* XXX When was this used? */ - if (prom_getintdefault(zsnode, "slave", -1) != chipid) { - zsnode = prom_getsibling(zsnode); - continue; - } -#endif + spin_lock_init(&up->port.lock); - /* - * "address" is only present on ports that OBP opened - * (from Mitch Bradley's "Hitchhiker's Guide to OBP"). - * We do not use it. - */ + if (i == 0) + sunzilog_irq_chain = up; - if (prom_getproperty(zsnode, "reg", - (char *) zsreg, sizeof(zsreg)) == -1) { - prom_printf("SunZilog: Cannot map Zilog %d\n", chip); - prom_halt(); - } - if (sparc_cpu_model == sun4m) /* Crude. Pass parent. XXX */ - prom_apply_obio_ranges(zsreg, 1); - res.start = zsreg[0].phys_addr; - res.end = res.start + (8 - 1); - res.flags = zsreg[0].which_io | IORESOURCE_IO; - mapped_addr = sbus_ioremap(&res, 0, 8, "Zilog Serial"); + if (i < NUM_CHANNELS - 1) + up->next = up + 1; + else + up->next = NULL; } - if (prom_getproperty(zsnode, "intr", - (char *) irq_info, sizeof(irq_info)) - % sizeof(struct linux_prom_irqs)) { - prom_printf("SunZilog: Cannot get IRQ property for Zilog %d.\n", - chip); - prom_halt(); - } - if (zilog_irq == -1) { - zilog_irq = irq_info[0].pri; - } else if (zilog_irq != irq_info[0].pri) { - /* XXX. Dumb. Should handle per-chip IRQ, for add-ons. */ - prom_printf("SunZilog: Inconsistent IRQ layout for Zilog %d.\n", - chip); - prom_halt(); + size = NUM_SUNZILOG * sizeof(struct zilog_layout __iomem *); + sunzilog_chip_regs = kzalloc(size, GFP_KERNEL); + if (!sunzilog_chip_regs) { + kfree(sunzilog_port_table); + sunzilog_irq_chain = NULL; + return -ENOMEM; } - return (struct zilog_layout __iomem *) mapped_addr; + return 0; } -#endif /* !(CONFIG_SPARC64) */ -/* Get the address of the registers for SunZilog instance CHIP. */ -static struct zilog_layout __iomem * __init get_zs(int chip, int node) +static void sunzilog_free_tables(void) { - if (chip < 0 || chip >= NUM_SUNZILOG) { - prom_printf("SunZilog: Illegal chip number %d in get_zs.\n", chip); - prom_halt(); - } - -#ifdef CONFIG_SPARC64 - return get_zs_sun4u(chip, node); -#else - - if (sparc_cpu_model == sun4) { - struct resource res; - - /* Not probe-able, hard code it. */ - switch (chip) { - case 0: - res.start = 0xf1000000; - break; - case 1: - res.start = 0xf0000000; - break; - }; - zilog_irq = 12; - res.end = (res.start + (8 - 1)); - res.flags = IORESOURCE_IO; - return sbus_ioremap(&res, 0, 8, "SunZilog"); - } - - return get_zs_sun4cmd(chip, node); -#endif + kfree(sunzilog_port_table); + sunzilog_irq_chain = NULL; + kfree(sunzilog_chip_regs); } #define ZS_PUT_CHAR_MAX_DELAY 2000 /* 10 ms */ @@ -1261,7 +1070,7 @@ static void sunzilog_putchar(struct uart_port *port, int ch) * udelay with ZSDELAY as that is a NOP on some platforms. -DaveM */ do { - unsigned char val = sbus_readb(&channel->control); + unsigned char val = readb(&channel->control); if (val & Tx_BUF_EMP) { ZSDELAY(); break; @@ -1269,7 +1078,7 @@ static void sunzilog_putchar(struct uart_port *port, int ch) udelay(5); } while (--loops); - sbus_writeb(ch, &channel->data); + writeb(ch, &channel->data); ZSDELAY(); ZS_WSYNC(channel); } @@ -1386,28 +1195,6 @@ static struct console sunzilog_console = { .data = &sunzilog_reg, }; -static int __init sunzilog_console_init(void) -{ - int i; - - if (con_is_present()) - return 0; - - for (i = 0; i < NUM_CHANNELS; i++) { - int this_minor = sunzilog_reg.minor + i; - - if ((this_minor - 64) == (serial_console - 1)) - break; - } - if (i == NUM_CHANNELS) - return 0; - - sunzilog_console.index = i; - sunzilog_port_table[i].flags |= SUNZILOG_FLAG_IS_CONS; - register_console(&sunzilog_console); - return 0; -} - static inline struct console *SUNZILOG_CONSOLE(void) { int i; @@ -1432,101 +1219,8 @@ static inline struct console *SUNZILOG_CONSOLE(void) #else #define SUNZILOG_CONSOLE() (NULL) -#define sunzilog_console_init() do { } while (0) #endif -/* - * We scan the PROM tree recursively. This is the most reliable way - * to find Zilog nodes on various platforms. However, we face an extreme - * shortage of kernel stack, so we must be very careful. To that end, - * we scan only to a certain depth, and we use a common property buffer - * in the scan structure. - */ -#define ZS_PROPSIZE 128 -#define ZS_SCAN_DEPTH 5 - -struct zs_probe_scan { - int depth; - void (*scanner)(struct zs_probe_scan *t, int node); - - int devices; - char prop[ZS_PROPSIZE]; -}; - -static int __inline__ sunzilog_node_ok(int node, const char *name, int len) -{ - if (strncmp(name, "zs", len) == 0) - return 1; - /* Don't fold this procedure just yet. Compare to su_node_ok(). */ - return 0; -} - -static void __init sunzilog_scan(struct zs_probe_scan *t, int node) -{ - int len; - - for (; node != 0; node = prom_getsibling(node)) { - len = prom_getproperty(node, "name", t->prop, ZS_PROPSIZE); - if (len <= 1) - continue; /* Broken PROM node */ - if (sunzilog_node_ok(node, t->prop, len)) { - (*t->scanner)(t, node); - } else { - if (t->depth < ZS_SCAN_DEPTH) { - t->depth++; - sunzilog_scan(t, prom_getchild(node)); - --t->depth; - } - } - } -} - -static void __init sunzilog_prepare(void) -{ - struct uart_sunzilog_port *up; - struct zilog_layout __iomem *rp; - int channel, chip; - - /* - * Temporary fix. - */ - for (channel = 0; channel < NUM_CHANNELS; channel++) - spin_lock_init(&sunzilog_port_table[channel].port.lock); - - sunzilog_irq_chain = up = &sunzilog_port_table[0]; - for (channel = 0; channel < NUM_CHANNELS - 1; channel++) - up[channel].next = &up[channel + 1]; - up[channel].next = NULL; - - for (chip = 0; chip < NUM_SUNZILOG; chip++) { - rp = sunzilog_chip_regs[chip]; - up[(chip * 2) + 0].port.membase = (void __iomem *)&rp->channelA; - up[(chip * 2) + 1].port.membase = (void __iomem *)&rp->channelB; - - /* Channel A */ - up[(chip * 2) + 0].port.iotype = UPIO_MEM; - up[(chip * 2) + 0].port.irq = zilog_irq; - up[(chip * 2) + 0].port.uartclk = ZS_CLOCK; - up[(chip * 2) + 0].port.fifosize = 1; - up[(chip * 2) + 0].port.ops = &sunzilog_pops; - up[(chip * 2) + 0].port.type = PORT_SUNZILOG; - up[(chip * 2) + 0].port.flags = 0; - up[(chip * 2) + 0].port.line = (chip * 2) + 0; - up[(chip * 2) + 0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A; - - /* Channel B */ - up[(chip * 2) + 1].port.iotype = UPIO_MEM; - up[(chip * 2) + 1].port.irq = zilog_irq; - up[(chip * 2) + 1].port.uartclk = ZS_CLOCK; - up[(chip * 2) + 1].port.fifosize = 1; - up[(chip * 2) + 1].port.ops = &sunzilog_pops; - up[(chip * 2) + 1].port.type = PORT_SUNZILOG; - up[(chip * 2) + 1].port.flags = 0; - up[(chip * 2) + 1].port.line = (chip * 2) + 1; - up[(chip * 2) + 1].flags |= 0; - } -} - static void __init sunzilog_init_kbdms(struct uart_sunzilog_port *up, int channel) { int baud, brg; @@ -1540,8 +1234,6 @@ static void __init sunzilog_init_kbdms(struct uart_sunzilog_port *up, int channe up->cflag = B4800 | CS8 | CLOCAL | CREAD; baud = 4800; } - printk(KERN_INFO "zs%d at 0x%p (irq = %d) is a SunZilog\n", - channel, up->port.membase, zilog_irq); up->curregs[R15] = BRKIE; brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR); @@ -1553,216 +1245,268 @@ static void __init sunzilog_init_kbdms(struct uart_sunzilog_port *up, int channe #ifdef CONFIG_SERIO static void __init sunzilog_register_serio(struct uart_sunzilog_port *up, int channel) { - struct serio *serio; - - up->serio = serio = kmalloc(sizeof(struct serio), GFP_KERNEL); - if (serio) { - memset(serio, 0, sizeof(*serio)); - - serio->port_data = up; - - serio->id.type = SERIO_RS232; - if (channel == KEYBOARD_LINE) { - serio->id.proto = SERIO_SUNKBD; - strlcpy(serio->name, "zskbd", sizeof(serio->name)); - } else { - serio->id.proto = SERIO_SUN; - serio->id.extra = 1; - strlcpy(serio->name, "zsms", sizeof(serio->name)); - } - strlcpy(serio->phys, - (channel == KEYBOARD_LINE ? "zs/serio0" : "zs/serio1"), - sizeof(serio->phys)); + struct serio *serio = &up->serio; - serio->write = sunzilog_serio_write; - serio->open = sunzilog_serio_open; - serio->close = sunzilog_serio_close; + serio->port_data = up; - serio_register_port(serio); + serio->id.type = SERIO_RS232; + if (channel == KEYBOARD_LINE) { + serio->id.proto = SERIO_SUNKBD; + strlcpy(serio->name, "zskbd", sizeof(serio->name)); } else { - printk(KERN_WARNING "zs%d: not enough memory for serio port\n", - channel); + serio->id.proto = SERIO_SUN; + serio->id.extra = 1; + strlcpy(serio->name, "zsms", sizeof(serio->name)); } + strlcpy(serio->phys, + (channel == KEYBOARD_LINE ? "zs/serio0" : "zs/serio1"), + sizeof(serio->phys)); + + serio->write = sunzilog_serio_write; + serio->open = sunzilog_serio_open; + serio->close = sunzilog_serio_close; + serio->dev.parent = up->port.dev; + + serio_register_port(serio); } #endif -static void __init sunzilog_init_hw(void) +static void __init sunzilog_init_hw(struct uart_sunzilog_port *up) { - int i; - - for (i = 0; i < NUM_CHANNELS; i++) { - struct uart_sunzilog_port *up = &sunzilog_port_table[i]; - struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(&up->port); - unsigned long flags; - int baud, brg; + struct zilog_channel __iomem *channel; + unsigned long flags; + int baud, brg; - spin_lock_irqsave(&up->port.lock, flags); + channel = ZILOG_CHANNEL_FROM_PORT(&up->port); - if (ZS_IS_CHANNEL_A(up)) { - write_zsreg(channel, R9, FHWRES); - ZSDELAY_LONG(); - (void) read_zsreg(channel, R0); - } + spin_lock_irqsave(&up->port.lock, flags); + if (ZS_IS_CHANNEL_A(up)) { + write_zsreg(channel, R9, FHWRES); + ZSDELAY_LONG(); + (void) read_zsreg(channel, R0); + } - if (i == KEYBOARD_LINE || i == MOUSE_LINE) { - sunzilog_init_kbdms(up, i); - up->curregs[R9] |= (NV | MIE); - write_zsreg(channel, R9, up->curregs[R9]); - } else { - /* Normal serial TTY. */ - up->parity_mask = 0xff; - up->curregs[R1] = EXT_INT_ENAB | INT_ALL_Rx | TxINT_ENAB; - up->curregs[R4] = PAR_EVEN | X16CLK | SB1; - up->curregs[R3] = RxENAB | Rx8; - up->curregs[R5] = TxENAB | Tx8; - up->curregs[R9] = NV | MIE; - up->curregs[R10] = NRZ; - up->curregs[R11] = TCBR | RCBR; - baud = 9600; - brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR); - up->curregs[R12] = (brg & 0xff); - up->curregs[R13] = (brg >> 8) & 0xff; - up->curregs[R14] = BRSRC | BRENAB; - __load_zsregs(channel, up->curregs); - write_zsreg(channel, R9, up->curregs[R9]); - } + if (up->port.line == KEYBOARD_LINE || + up->port.line == MOUSE_LINE) { + sunzilog_init_kbdms(up, up->port.line); + up->curregs[R9] |= (NV | MIE); + write_zsreg(channel, R9, up->curregs[R9]); + } else { + /* Normal serial TTY. */ + up->parity_mask = 0xff; + up->curregs[R1] = EXT_INT_ENAB | INT_ALL_Rx | TxINT_ENAB; + up->curregs[R4] = PAR_EVEN | X16CLK | SB1; + up->curregs[R3] = RxENAB | Rx8; + up->curregs[R5] = TxENAB | Tx8; + up->curregs[R9] = NV | MIE; + up->curregs[R10] = NRZ; + up->curregs[R11] = TCBR | RCBR; + baud = 9600; + brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR); + up->curregs[R12] = (brg & 0xff); + up->curregs[R13] = (brg >> 8) & 0xff; + up->curregs[R14] = BRSRC | BRENAB; + __load_zsregs(channel, up->curregs); + write_zsreg(channel, R9, up->curregs[R9]); + } - spin_unlock_irqrestore(&up->port.lock, flags); + spin_unlock_irqrestore(&up->port.lock, flags); #ifdef CONFIG_SERIO - if (i == KEYBOARD_LINE || i == MOUSE_LINE) - sunzilog_register_serio(up, i); + if (up->port.line == KEYBOARD_LINE || up->port.line == MOUSE_LINE) + sunzilog_register_serio(up, up->port.line); #endif - } -} - -static struct zilog_layout __iomem * __init get_zs(int chip, int node); - -static void __init sunzilog_scan_probe(struct zs_probe_scan *t, int node) -{ - sunzilog_chip_regs[t->devices] = get_zs(t->devices, node); - t->devices++; } -static int __init sunzilog_ports_init(void) +static int __devinit zs_get_instance(struct device_node *dp) { - struct zs_probe_scan scan; int ret; - int uart_count; - int i; - - printk(KERN_DEBUG "SunZilog: %d chips.\n", NUM_SUNZILOG); - - scan.scanner = sunzilog_scan_probe; - scan.depth = 0; - scan.devices = 0; - sunzilog_scan(&scan, prom_getchild(prom_root_node)); - - sunzilog_prepare(); - if (request_irq(zilog_irq, sunzilog_interrupt, SA_SHIRQ, - "SunZilog", sunzilog_irq_chain)) { - prom_printf("SunZilog: Unable to register zs interrupt handler.\n"); - prom_halt(); - } + ret = of_getintprop_default(dp, "slave", -1); + if (ret != -1) + return ret; - sunzilog_init_hw(); + if (of_find_property(dp, "keyboard", NULL)) + ret = 1; + else + ret = 0; - /* We can only init this once we have probed the Zilogs - * in the system. Do not count channels assigned to keyboards - * or mice when we are deciding how many ports to register. - */ - uart_count = 0; - for (i = 0; i < NUM_CHANNELS; i++) { - struct uart_sunzilog_port *up = &sunzilog_port_table[i]; + return ret; +} - if (ZS_IS_KEYB(up) || ZS_IS_MOUSE(up)) - continue; +static int zilog_irq = -1; - uart_count++; - } - - sunzilog_reg.nr = uart_count; - sunzilog_reg.minor = sunserial_current_minor; +static int __devinit zs_probe(struct of_device *dev, const struct of_device_id *match) +{ + struct of_device *op = to_of_device(&dev->dev); + struct uart_sunzilog_port *up; + struct zilog_layout __iomem *rp; + int inst = zs_get_instance(dev->node); + int err; - ret = uart_register_driver(&sunzilog_reg); - if (ret == 0) { - sunzilog_reg.tty_driver->name_base = sunzilog_reg.minor - 64; - sunzilog_reg.cons = SUNZILOG_CONSOLE(); + sunzilog_chip_regs[inst] = of_ioremap(&op->resource[0], 0, + sizeof(struct zilog_layout), + "zs"); + if (!sunzilog_chip_regs[inst]) + return -ENOMEM; - sunserial_current_minor += uart_count; + rp = sunzilog_chip_regs[inst]; - for (i = 0; i < NUM_CHANNELS; i++) { - struct uart_sunzilog_port *up = &sunzilog_port_table[i]; + if (zilog_irq == -1) { + zilog_irq = op->irqs[0]; + err = request_irq(zilog_irq, sunzilog_interrupt, IRQF_SHARED, + "zs", sunzilog_irq_chain); + if (err) { + of_iounmap(rp, sizeof(struct zilog_layout)); - if (ZS_IS_KEYB(up) || ZS_IS_MOUSE(up)) - continue; + return err; + } + } - if (uart_add_one_port(&sunzilog_reg, &up->port)) { - printk(KERN_ERR - "SunZilog: failed to add port zs%d\n", i); - } + up = &sunzilog_port_table[inst * 2]; + + /* Channel A */ + up[0].port.mapbase = op->resource[0].start + 0x00; + up[0].port.membase = (void __iomem *) &rp->channelA; + up[0].port.iotype = UPIO_MEM; + up[0].port.irq = op->irqs[0]; + up[0].port.uartclk = ZS_CLOCK; + up[0].port.fifosize = 1; + up[0].port.ops = &sunzilog_pops; + up[0].port.type = PORT_SUNZILOG; + up[0].port.flags = 0; + up[0].port.line = (inst * 2) + 0; + up[0].port.dev = &op->dev; + up[0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A; + if (inst == 1) + up[0].flags |= SUNZILOG_FLAG_CONS_KEYB; + sunzilog_init_hw(&up[0]); + + /* Channel B */ + up[1].port.mapbase = op->resource[0].start + 0x04; + up[1].port.membase = (void __iomem *) &rp->channelB; + up[1].port.iotype = UPIO_MEM; + up[1].port.irq = op->irqs[0]; + up[1].port.uartclk = ZS_CLOCK; + up[1].port.fifosize = 1; + up[1].port.ops = &sunzilog_pops; + up[1].port.type = PORT_SUNZILOG; + up[1].port.flags = 0; + up[1].port.line = (inst * 2) + 1; + up[1].port.dev = &op->dev; + up[1].flags |= 0; + if (inst == 1) + up[1].flags |= SUNZILOG_FLAG_CONS_MOUSE; + sunzilog_init_hw(&up[1]); + + if (inst != 1) { + err = uart_add_one_port(&sunzilog_reg, &up[0].port); + if (err) { + of_iounmap(rp, sizeof(struct zilog_layout)); + return err; + } + err = uart_add_one_port(&sunzilog_reg, &up[1].port); + if (err) { + uart_remove_one_port(&sunzilog_reg, &up[0].port); + of_iounmap(rp, sizeof(struct zilog_layout)); + return err; } } - return ret; + dev_set_drvdata(&dev->dev, &up[0]); + + return 0; } -static void __init sunzilog_scan_count(struct zs_probe_scan *t, int node) +static void __devexit zs_remove_one(struct uart_sunzilog_port *up) { - t->devices++; + if (ZS_IS_KEYB(up) || ZS_IS_MOUSE(up)) { +#ifdef CONFIG_SERIO + serio_unregister_port(&up->serio); +#endif + } else + uart_remove_one_port(&sunzilog_reg, &up->port); } -static int __init sunzilog_ports_count(void) +static int __devexit zs_remove(struct of_device *dev) { - struct zs_probe_scan scan; + struct uart_sunzilog_port *up = dev_get_drvdata(&dev->dev); + struct zilog_layout __iomem *regs; - /* Sun4 Zilog setup is hard coded, no probing to do. */ - if (sparc_cpu_model == sun4) - return 2; + zs_remove_one(&up[0]); + zs_remove_one(&up[1]); - scan.scanner = sunzilog_scan_count; - scan.depth = 0; - scan.devices = 0; + regs = sunzilog_chip_regs[up[0].port.line / 2]; + of_iounmap(regs, sizeof(struct zilog_layout)); - sunzilog_scan(&scan, prom_getchild(prom_root_node)); + dev_set_drvdata(&dev->dev, NULL); - return scan.devices; + return 0; } +static struct of_device_id zs_match[] = { + { + .name = "zs", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, zs_match); + +static struct of_platform_driver zs_driver = { + .name = "zs", + .match_table = zs_match, + .probe = zs_probe, + .remove = __devexit_p(zs_remove), +}; + static int __init sunzilog_init(void) { + struct device_node *dp; + int err; - NUM_SUNZILOG = sunzilog_ports_count(); - if (NUM_SUNZILOG == 0) - return -ENODEV; + NUM_SUNZILOG = 0; + for_each_node_by_name(dp, "zs") + NUM_SUNZILOG++; - sunzilog_alloc_tables(); + if (NUM_SUNZILOG) { + int uart_count; - sunzilog_ports_init(); + err = sunzilog_alloc_tables(); + if (err) + return err; - return 0; + /* Subtract 1 for keyboard, 1 for mouse. */ + uart_count = (NUM_SUNZILOG * 2) - 2; + + sunzilog_reg.nr = uart_count; + sunzilog_reg.minor = sunserial_current_minor; + err = uart_register_driver(&sunzilog_reg); + if (err) { + sunzilog_free_tables(); + return err; + } + sunzilog_reg.tty_driver->name_base = sunzilog_reg.minor - 64; + sunzilog_reg.cons = SUNZILOG_CONSOLE(); + + sunserial_current_minor += uart_count; + } + + return of_register_driver(&zs_driver, &of_bus_type); } static void __exit sunzilog_exit(void) { - int i; + of_unregister_driver(&zs_driver); - for (i = 0; i < NUM_CHANNELS; i++) { - struct uart_sunzilog_port *up = &sunzilog_port_table[i]; - - if (ZS_IS_KEYB(up) || ZS_IS_MOUSE(up)) { -#ifdef CONFIG_SERIO - if (up->serio) { - serio_unregister_port(up->serio); - up->serio = NULL; - } -#endif - } else - uart_remove_one_port(&sunzilog_reg, &up->port); + if (zilog_irq != -1) { + free_irq(zilog_irq, sunzilog_irq_chain); + zilog_irq = -1; } - uart_unregister_driver(&sunzilog_reg); + if (NUM_SUNZILOG) { + uart_unregister_driver(&sunzilog_reg); + sunzilog_free_tables(); + } } module_init(sunzilog_init); @@ -1770,4 +1514,5 @@ module_exit(sunzilog_exit); MODULE_AUTHOR("David S. Miller"); MODULE_DESCRIPTION("Sun Zilog serial port driver"); +MODULE_VERSION("2.0"); MODULE_LICENSE("GPL"); diff --git a/drivers/serial/v850e_uart.c b/drivers/serial/v850e_uart.c index df705fda424..f802867c95c 100644 --- a/drivers/serial/v850e_uart.c +++ b/drivers/serial/v850e_uart.c @@ -372,13 +372,13 @@ static int v850e_uart_startup (struct uart_port *port) /* Alloc RX irq. */ err = request_irq (V850E_UART_RX_IRQ (port->line), v850e_uart_rx_irq, - SA_INTERRUPT, "v850e_uart", port); + IRQF_DISABLED, "v850e_uart", port); if (err) return err; /* Alloc TX irq. */ err = request_irq (V850E_UART_TX_IRQ (port->line), v850e_uart_tx_irq, - SA_INTERRUPT, "v850e_uart", port); + IRQF_DISABLED, "v850e_uart", port); if (err) { free_irq (V850E_UART_RX_IRQ (port->line), port); return err; @@ -468,7 +468,6 @@ static struct uart_ops v850e_uart_ops = { static struct uart_driver v850e_uart_driver = { .owner = THIS_MODULE, .driver_name = "v850e_uart", - .devfs_name = "tts/", .dev_name = "ttyS", .major = TTY_MAJOR, .minor = V850E_UART_MINOR_BASE, diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c index df5e8713fa3..e93d0edc2e0 100644 --- a/drivers/serial/vr41xx_siu.c +++ b/drivers/serial/vr41xx_siu.c @@ -19,7 +19,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <linux/config.h> #if defined(CONFIG_SERIAL_VR41XX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ @@ -911,7 +910,6 @@ static struct uart_driver siu_uart_driver = { .owner = THIS_MODULE, .driver_name = "SIU", .dev_name = "ttyVR", - .devfs_name = "ttvr/", .major = SIU_MAJOR, .minor = SIU_MINOR_BASE, .cons = SERIAL_VR41XX_CONSOLE, diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c index ed946311d3a..6c7e0352d56 100644 --- a/drivers/sn/ioc3.c +++ b/drivers/sn/ioc3.c @@ -7,7 +7,6 @@ * Pat Gefre <pfg@sgi.com> - IOC3 serial port IRQ demuxer */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/module.h> #include <linux/pci.h> @@ -707,7 +706,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) writel(~0, &idd->vma->eisr); idd->dual_irq = 1; - if (!request_irq(pdev->irq, ioc3_intr_eth, SA_SHIRQ, + if (!request_irq(pdev->irq, ioc3_intr_eth, IRQF_SHARED, "ioc3-eth", (void *)idd)) { idd->irq_eth = pdev->irq; } else { @@ -715,7 +714,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) "%s : request_irq fails for IRQ 0x%x\n ", __FUNCTION__, pdev->irq); } - if (!request_irq(pdev->irq+2, ioc3_intr_io, SA_SHIRQ, + if (!request_irq(pdev->irq+2, ioc3_intr_io, IRQF_SHARED, "ioc3-io", (void *)idd)) { idd->irq_io = pdev->irq+2; } else { @@ -724,7 +723,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) __FUNCTION__, pdev->irq+2); } } else { - if (!request_irq(pdev->irq, ioc3_intr_io, SA_SHIRQ, + if (!request_irq(pdev->irq, ioc3_intr_io, IRQF_SHARED, "ioc3", (void *)idd)) { idd->irq_io = pdev->irq; } else { diff --git a/drivers/sn/ioc4.c b/drivers/sn/ioc4.c index 8256a97eb50..8562821e649 100644 --- a/drivers/sn/ioc4.c +++ b/drivers/sn/ioc4.c @@ -438,7 +438,7 @@ static struct pci_device_id ioc4_id_table[] = { {0} }; -static struct pci_driver __devinitdata ioc4_driver = { +static struct pci_driver ioc4_driver = { .name = "IOC4", .id_table = ioc4_id_table, .probe = ioc4_probe, diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index dd2f950b21a..a23862ef72b 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <linux/config.h> #include <linux/init.h> #include <linux/spinlock.h> #include <linux/workqueue.h> diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c index a006a1ee27a..39d9b20f203 100644 --- a/drivers/spi/spi_butterfly.c +++ b/drivers/spi/spi_butterfly.c @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/delay.h> diff --git a/drivers/tc/lk201.c b/drivers/tc/lk201.c index cf10d5cdfb9..757dec9c7ee 100644 --- a/drivers/tc/lk201.c +++ b/drivers/tc/lk201.c @@ -8,7 +8,6 @@ * Copyright (C) 2001, 2002, 2003, 2004 Maciej W. Rozycki */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/sched.h> diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c index 2dffa8e303b..5e8a27620f6 100644 --- a/drivers/tc/zs.c +++ b/drivers/tc/zs.c @@ -39,7 +39,6 @@ * is shared with DSRS(DTE) at pin 23. */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/signal.h> #include <linux/sched.h> @@ -1745,7 +1744,6 @@ int __init zs_init(void) /* Not all of this is exactly right for us. */ serial_driver->owner = THIS_MODULE; - serial_driver->devfs_name = "tts/"; serial_driver->name = "ttyS"; serial_driver->major = TTY_MAJOR; serial_driver->minor_start = 64; @@ -1754,7 +1752,7 @@ int __init zs_init(void) serial_driver->init_termios = tty_std_termios; serial_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; - serial_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; + serial_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; tty_set_operations(serial_driver, &serial_ops); if (tty_register_driver(serial_driver)) @@ -1793,7 +1791,7 @@ int __init zs_init(void) zs_soft[channel].clk_divisor = 16; zs_soft[channel].zs_baud = get_zsbaud(&zs_soft[channel]); - if (request_irq(zs_soft[channel].irq, rs_interrupt, SA_SHIRQ, + if (request_irq(zs_soft[channel].irq, rs_interrupt, IRQF_SHARED, "scc", &zs_soft[channel])) printk(KERN_ERR "decserial: can't get irq %d\n", zs_soft[channel].irq); diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c index e166fffea86..e41f49afd0f 100644 --- a/drivers/telephony/phonedev.c +++ b/drivers/telephony/phonedev.c @@ -28,7 +28,6 @@ #include <linux/kmod.h> #include <linux/sem.h> -#include <linux/devfs_fs_kernel.h> #include <linux/mutex.h> #define PHONE_NUM_DEVICES 256 @@ -106,8 +105,6 @@ int phone_register_device(struct phone_device *p, int unit) if (phone_device[i] == NULL) { phone_device[i] = p; p->minor = i; - devfs_mk_cdev(MKDEV(PHONE_MAJOR,i), - S_IFCHR|S_IRUSR|S_IWUSR, "phone/%d", i); mutex_unlock(&phone_lock); return 0; } @@ -125,7 +122,6 @@ void phone_unregister_device(struct phone_device *pfd) mutex_lock(&phone_lock); if (phone_device[pfd->minor] != pfd) panic("phone: bad unregister"); - devfs_remove("phone/%d", pfd->minor); phone_device[pfd->minor] = NULL; mutex_unlock(&phone_lock); } diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index d41dc67ba4c..3670d77e912 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -1145,12 +1145,11 @@ static int __init acm_init(void) acm_tty_driver->owner = THIS_MODULE, acm_tty_driver->driver_name = "acm", acm_tty_driver->name = "ttyACM", - acm_tty_driver->devfs_name = "usb/acm/", acm_tty_driver->major = ACM_TTY_MAJOR, acm_tty_driver->minor_start = 0, acm_tty_driver->type = TTY_DRIVER_TYPE_SERIAL, acm_tty_driver->subtype = SERIAL_TYPE_NORMAL, - acm_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS, + acm_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; acm_tty_driver->init_termios = tty_std_termios; acm_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; tty_set_operations(acm_tty_driver, &acm_ops); diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index ad742cec94f..f4f4ef0f377 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c @@ -5,7 +5,6 @@ * and should work with all USB controllers, regardles of bus type. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index a9d89c78cc2..4c9e63e665b 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -1,4 +1,3 @@ -#include <linux/config.h> #include <linux/usb.h> #include <linux/module.h> #include <linux/init.h> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index bcbeaf7101d..f7bdd94b3aa 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -47,6 +47,7 @@ #include <linux/usbdevice_fs.h> #include <linux/cdev.h> #include <linux/notifier.h> +#include <linux/security.h> #include <asm/uaccess.h> #include <asm/byteorder.h> #include <linux/moduleparam.h> @@ -68,6 +69,7 @@ struct async { void __user *userbuffer; void __user *userurb; struct urb *urb; + u32 secid; }; static int usbfs_snoop = 0; @@ -312,7 +314,7 @@ static void async_completed(struct urb *urb, struct pt_regs *regs) sinfo.si_code = SI_ASYNCIO; sinfo.si_addr = as->userurb; kill_proc_info_as_uid(as->signr, &sinfo, as->pid, as->uid, - as->euid); + as->euid, as->secid); } snoop(&urb->dev->dev, "urb complete\n"); snoop_urb(urb, as->userurb); @@ -572,6 +574,7 @@ static int usbdev_open(struct inode *inode, struct file *file) ps->disc_euid = current->euid; ps->disccontext = NULL; ps->ifclaimed = 0; + security_task_getsecid(current, &ps->secid); wmb(); list_add_tail(&ps->list, &dev->filelist); file->private_data = ps; @@ -1053,6 +1056,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, as->pid = current->pid; as->uid = current->uid; as->euid = current->euid; + security_task_getsecid(current, &as->secid); if (!(uurb->endpoint & USB_DIR_IN)) { if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, as->urb->transfer_buffer_length)) { free_async(as); diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index c196f384530..ec890650141 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -21,7 +21,6 @@ * */ -#include <linux/config.h> #include <linux/device.h> #include <linux/usb.h> #include "hcd.h" diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index f65b193cde3..abee0f5b6a6 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c @@ -15,7 +15,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/spinlock.h> #include <linux/errno.h> diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 66b78404ab3..5078fb3375e 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -16,7 +16,6 @@ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> @@ -126,7 +125,7 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id) pci_set_master (dev); - retval = usb_add_hcd (hcd, dev->irq, SA_SHIRQ); + retval = usb_add_hcd (hcd, dev->irq, IRQF_SHARED); if (retval != 0) goto err4; return retval; diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 4bf914d00a1..fb4d058bbde 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -22,7 +22,6 @@ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/version.h> #include <linux/kernel.h> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index e1731ff8af4..875596e98e4 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -8,7 +8,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/module.h> diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index bfc9b28a724..e47e3a8ed6e 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c @@ -27,7 +27,6 @@ /*****************************************************************************/ -#include <linux/config.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/mount.h> @@ -700,7 +699,7 @@ static void usbfs_remove_device(struct usb_device *dev) sinfo.si_errno = EPIPE; sinfo.si_code = SI_ASYNCIO; sinfo.si_addr = ds->disccontext; - kill_proc_info_as_uid(ds->discsignr, &sinfo, ds->disc_pid, ds->disc_uid, ds->disc_euid); + kill_proc_info_as_uid(ds->discsignr, &sinfo, ds->disc_pid, ds->disc_uid, ds->disc_euid, ds->secid); } } } diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 8569600f313..4cc8d3e67db 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -2,7 +2,6 @@ * message.c - synchronous message handling */ -#include <linux/config.h> #include <linux/pci.h> /* for scatterlist macros */ #include <linux/usb.h> #include <linux/module.h> diff --git a/drivers/usb/core/notify.c b/drivers/usb/core/notify.c index fe0ed54fa0a..b042676af0a 100644 --- a/drivers/usb/core/notify.c +++ b/drivers/usb/core/notify.c @@ -9,7 +9,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/notifier.h> #include <linux/usb.h> diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 3f49bf51cff..dec973affb0 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -10,7 +10,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/usb.h> #include "usb.h" diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index dad4d8fd818..9864988377c 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c @@ -1,4 +1,3 @@ -#include <linux/config.h> #include <linux/module.h> #include <linux/string.h> #include <linux/bitops.h> diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index fb488c8a860..184c24660a4 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -21,7 +21,6 @@ * are evil. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/string.h> #include <linux/bitops.h> diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index 7a650c763a6..49f69236b42 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -80,6 +80,7 @@ struct dev_state { uid_t disc_uid, disc_euid; void __user *disccontext; unsigned long ifclaimed; + u32 secid; }; /* internal notify stuff */ diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index b8d0b7825bf..1c459ff037c 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c @@ -25,7 +25,6 @@ #undef VERBOSE #undef PACKET_TRACE -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h> @@ -1654,13 +1653,13 @@ static int __devinit at91udc_probe(struct platform_device *pdev) pullup(udc, 0); /* request UDC and maybe VBUS irqs */ - if (request_irq(AT91_ID_UDP, at91_udc_irq, SA_INTERRUPT, driver_name, udc)) { + if (request_irq(AT91_ID_UDP, at91_udc_irq, IRQF_DISABLED, driver_name, udc)) { DBG("request irq %d failed\n", AT91_ID_UDP); retval = -EBUSY; goto fail1; } if (udc->board.vbus_pin > 0) { - if (request_irq(udc->board.vbus_pin, at91_vbus_irq, SA_INTERRUPT, driver_name, udc)) { + if (request_irq(udc->board.vbus_pin, at91_vbus_irq, IRQF_DISABLED, driver_name, udc)) { DBG("request vbus irq %d failed\n", udc->board.vbus_pin); free_irq(AT91_ID_UDP, udc); retval = -EBUSY; diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 42ce41d71b7..4be47195bd3 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c @@ -36,7 +36,6 @@ #define DEBUG -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/delay.h> diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 078daa02671..8320fcef042 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -23,7 +23,6 @@ // #define DEBUG 1 // #define VERBOSE -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/delay.h> diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index a43dc908ac5..b1a9cf06f3e 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c @@ -221,7 +221,6 @@ #undef VERBOSE #undef DUMP_MSGS -#include <linux/config.h> #include <asm/system.h> #include <asm/uaccess.h> diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index 5378c175729..7cf2999e861 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c @@ -24,7 +24,6 @@ // #define VERBOSE /* extra debug messages (success too) */ // #define USB_TRACE /* packet-level success messages */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/pci.h> @@ -1917,7 +1916,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* init to known state, then setup irqs */ udc_reset(dev); udc_reinit (dev); - if (request_irq(pdev->irq, goku_irq, SA_SHIRQ/*|SA_SAMPLE_RANDOM*/, + if (request_irq(pdev->irq, goku_irq, IRQF_SHARED/*|IRQF_SAMPLE_RANDOM*/, driver_name, dev) != 0) { DBG(dev, "request interrupt %d failed\n", pdev->irq); retval = -EBUSY; diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c index 0d3424eda03..bb22b7e8287 100644 --- a/drivers/usb/gadget/lh7a40x_udc.c +++ b/drivers/usb/gadget/lh7a40x_udc.c @@ -2107,7 +2107,7 @@ static int lh7a40x_udc_probe(struct platform_device *pdev) /* irq setup after old hardware state is cleaned up */ retval = - request_irq(IRQ_USBINTR, lh7a40x_udc_irq, SA_INTERRUPT, driver_name, + request_irq(IRQ_USBINTR, lh7a40x_udc_irq, IRQF_DISABLED, driver_name, dev); if (retval != 0) { DEBUG(KERN_ERR "%s: can't get irq %i, err %d\n", driver_name, diff --git a/drivers/usb/gadget/lh7a40x_udc.h b/drivers/usb/gadget/lh7a40x_udc.h index 9b2e6f7cbb8..e3bb78524c8 100644 --- a/drivers/usb/gadget/lh7a40x_udc.h +++ b/drivers/usb/gadget/lh7a40x_udc.h @@ -24,7 +24,6 @@ #ifndef __LH7A40X_H_ #define __LH7A40X_H_ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/ioport.h> diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 1facdea56a8..09243239d94 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -46,7 +46,6 @@ #undef DEBUG /* messages on error and most fault paths */ #undef VERBOSE /* extra debug messages (success too) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/dma-mapping.h> @@ -2896,7 +2895,7 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id) goto done; } - if (request_irq (pdev->irq, net2280_irq, SA_SHIRQ, driver_name, dev) + if (request_irq (pdev->irq, net2280_irq, IRQF_SHARED, driver_name, dev) != 0) { ERROR (dev, "request interrupt %d failed\n", pdev->irq); retval = -EBUSY; diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 36336486c88..2de9748ee67 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c @@ -22,7 +22,6 @@ #undef DEBUG #undef VERBOSE -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/ioport.h> @@ -2819,7 +2818,7 @@ bad_on_1710: /* USB general purpose IRQ: ep0, state changes, dma, etc */ status = request_irq(pdev->resource[1].start, omap_udc_irq, - SA_SAMPLE_RANDOM, driver_name, udc); + IRQF_SAMPLE_RANDOM, driver_name, udc); if (status != 0) { ERR( "can't get irq %ld, err %d\n", pdev->resource[1].start, status); @@ -2828,7 +2827,7 @@ bad_on_1710: /* USB "non-iso" IRQ (PIO for all but ep0) */ status = request_irq(pdev->resource[2].start, omap_udc_pio_irq, - SA_SAMPLE_RANDOM, "omap_udc pio", udc); + IRQF_SAMPLE_RANDOM, "omap_udc pio", udc); if (status != 0) { ERR( "can't get irq %ld, err %d\n", pdev->resource[2].start, status); @@ -2836,7 +2835,7 @@ bad_on_1710: } #ifdef USE_ISO status = request_irq(pdev->resource[3].start, omap_udc_iso_irq, - SA_INTERRUPT, "omap_udc iso", udc); + IRQF_DISABLED, "omap_udc iso", udc); if (status != 0) { ERR("can't get irq %ld, err %d\n", pdev->resource[3].start, status); diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index 269ce7f4ad6..fff027d30a0 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c @@ -27,7 +27,6 @@ #undef DEBUG // #define VERBOSE DBG_VERBOSE -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/ioport.h> @@ -60,7 +59,7 @@ #include <linux/usb_ch9.h> #include <linux/usb_gadget.h> -#include <asm/arch/hardware/intel_udc.h> +#include <asm/arch/udc.h> /* @@ -2522,7 +2521,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) /* irq setup after old hardware state is cleaned up */ retval = request_irq(IRQ_USB, pxa2xx_udc_irq, - SA_INTERRUPT, driver_name, dev); + IRQF_DISABLED, driver_name, dev); if (retval != 0) { printk(KERN_ERR "%s: can't get irq %i, err %d\n", driver_name, IRQ_USB, retval); @@ -2534,7 +2533,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) if (machine_is_lubbock()) { retval = request_irq(LUBBOCK_USB_DISC_IRQ, lubbock_vbus_irq, - SA_INTERRUPT | SA_SAMPLE_RANDOM, + IRQF_DISABLED | IRQF_SAMPLE_RANDOM, driver_name, dev); if (retval != 0) { printk(KERN_ERR "%s: can't get irq %i, err %d\n", @@ -2545,7 +2544,7 @@ lubbock_fail0: } retval = request_irq(LUBBOCK_USB_IRQ, lubbock_vbus_irq, - SA_INTERRUPT | SA_SAMPLE_RANDOM, + IRQF_DISABLED | IRQF_SAMPLE_RANDOM, driver_name, dev); if (retval != 0) { printk(KERN_ERR "%s: can't get irq %i, err %d\n", diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 3ff6db7828a..354670d1230 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c @@ -23,7 +23,6 @@ * updates to merge with Linux 2.6, better match RNDIS spec */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index 9d6e1d29552..30d7664d449 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c @@ -17,7 +17,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/delay.h> @@ -588,12 +587,11 @@ static int __init gs_module_init(void) gs_tty_driver->owner = THIS_MODULE; gs_tty_driver->driver_name = GS_SHORT_NAME; gs_tty_driver->name = "ttygs"; - gs_tty_driver->devfs_name = "usb/ttygs/"; gs_tty_driver->major = GS_MAJOR; gs_tty_driver->minor_start = GS_MINOR_START; gs_tty_driver->type = TTY_DRIVER_TYPE_SERIAL; gs_tty_driver->subtype = SERIAL_TYPE_NORMAL; - gs_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; + gs_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; gs_tty_driver->init_termios = tty_std_termios; gs_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; tty_set_operations(gs_tty_driver, &gs_tty_ops); diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 68e3d8f5da8..3a08a7ab4ce 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c @@ -62,7 +62,6 @@ #define DEBUG 1 // #define VERBOSE -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/delay.h> diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index 9b4697add31..d66867aa527 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c @@ -148,7 +148,7 @@ int usb_ehci_au1xxx_probe(const struct hc_driver *driver, /* ehci_hcd_init(hcd_to_ehci(hcd)); */ retval = - usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT | SA_SHIRQ); + usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED | IRQF_SHARED); if (retval == 0) return retval; diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index a49a689bf42..d030516edfb 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -121,7 +121,7 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver, temp = in_le32(hcd->regs + 0x1a8); out_le32(hcd->regs + 0x1a8, temp | 0x3); - retval = usb_add_hcd(hcd, irq, SA_SHIRQ); + retval = usb_add_hcd(hcd, irq, IRQF_SHARED); if (retval != 0) goto err4; return retval; diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 9b37e508ada..cee6f538de0 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -16,7 +16,6 @@ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/dmapool.h> diff --git a/drivers/usb/host/hc_crisv10.c b/drivers/usb/host/hc_crisv10.c index 4a22909518f..61e571782cf 100644 --- a/drivers/usb/host/hc_crisv10.c +++ b/drivers/usb/host/hc_crisv10.c @@ -4,7 +4,6 @@ * Copyright (c) 2002, 2003 Axis Communications AB. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/delay.h> #include <linux/ioport.h> diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c index 14386254c87..5147ed4a666 100644 --- a/drivers/usb/host/isp116x-hcd.c +++ b/drivers/usb/host/isp116x-hcd.c @@ -1653,7 +1653,7 @@ static int __init isp116x_probe(struct platform_device *pdev) goto err6; } - ret = usb_add_hcd(hcd, irq, SA_INTERRUPT); + ret = usb_add_hcd(hcd, irq, IRQF_DISABLED); if (ret) goto err6; diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 6b7350b5241..cdbafb71000 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -125,7 +125,7 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device * at91_start_hc(pdev); ohci_hcd_init(hcd_to_ohci(hcd)); - retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT); + retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED); if (retval == 0) return retval; diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index a1c8b3b2fcc..689261e4401 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c @@ -191,7 +191,7 @@ static int usb_ohci_au1xxx_probe(const struct hc_driver *driver, au1xxx_start_ohc(dev); ohci_hcd_init(hcd_to_ohci(hcd)); - retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT | SA_SHIRQ); + retval = usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED | IRQF_SHARED); if (retval == 0) return retval; diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 73f5a379d9b..8fb842ed5f6 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -74,7 +74,6 @@ * This file is licenced under the GPL. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/pci.h> diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c index 0020ed7a39d..5602da9bd52 100644 --- a/drivers/usb/host/ohci-lh7a404.c +++ b/drivers/usb/host/ohci-lh7a404.c @@ -100,7 +100,7 @@ int usb_hcd_lh7a404_probe (const struct hc_driver *driver, lh7a404_start_hc(dev); ohci_hcd_init(hcd_to_ohci(hcd)); - retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); + retval = usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED); if (retval == 0) return retval; diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index ca19abe01c5..c4c4babd476 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c @@ -14,7 +14,7 @@ * This file is licenced under the GPL. */ -#include <linux/signal.h> /* SA_INTERRUPT */ +#include <linux/signal.h> /* IRQF_DISABLED */ #include <linux/jiffies.h> #include <linux/platform_device.h> #include <linux/clk.h> @@ -334,7 +334,7 @@ int usb_hcd_omap_probe (const struct hc_driver *driver, retval = -ENXIO; goto err2; } - retval = usb_add_hcd(hcd, irq, SA_INTERRUPT); + retval = usb_add_hcd(hcd, irq, IRQF_DISABLED); if (retval == 0) return retval; diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c index b2a8dfa4887..9fe56ff1615 100644 --- a/drivers/usb/host/ohci-ppc-soc.c +++ b/drivers/usb/host/ohci-ppc-soc.c @@ -75,7 +75,7 @@ static int usb_hcd_ppc_soc_probe(const struct hc_driver *driver, ohci->flags |= OHCI_BIG_ENDIAN; ohci_hcd_init(ohci); - retval = usb_add_hcd(hcd, irq, SA_INTERRUPT); + retval = usb_add_hcd(hcd, irq, IRQF_DISABLED); if (retval == 0) return retval; diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index fafe7c1265b..6f559e10278 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -190,7 +190,7 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device ohci_hcd_init(hcd_to_ohci(hcd)); - retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT); + retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED); if (retval == 0) return retval; diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 1da5de573a6..d2fc6969a9f 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c @@ -388,7 +388,7 @@ static int usb_hcd_s3c2410_probe (const struct hc_driver *driver, ohci_hcd_init(hcd_to_ohci(hcd)); - retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); + retval = usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED); if (retval != 0) goto err_ioremap; diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c index fb3221ebbb2..ce3de106cad 100644 --- a/drivers/usb/host/ohci-sa1111.c +++ b/drivers/usb/host/ohci-sa1111.c @@ -143,7 +143,7 @@ int usb_hcd_sa1111_probe (const struct hc_driver *driver, sa1111_start_hc(dev); ohci_hcd_init(hcd_to_ohci(hcd)); - retval = usb_add_hcd(hcd, dev->irq[1], SA_INTERRUPT); + retval = usb_add_hcd(hcd, dev->irq[1], IRQF_DISABLED); if (retval == 0) return retval; diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 1045f846fbe..dff60568b4a 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -8,7 +8,6 @@ * (and others) */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/pci.h> diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index 6b4bc3f2bd8..fa34092bbcd 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c @@ -31,7 +31,6 @@ #undef VERBOSE #undef PACKET_TRACE -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> @@ -1684,9 +1683,13 @@ sl811h_probe(struct platform_device *dev) if (!addr || !data) return -ENODEV; ioaddr = 1; - - addr_reg = (void __iomem *) addr->start; - data_reg = (void __iomem *) data->start; + /* + * NOTE: 64-bit resource->start is getting truncated + * to avoid compiler warning, assuming that ->start + * is always 32-bit for this case + */ + addr_reg = (void __iomem *) (unsigned long) addr->start; + data_reg = (void __iomem *) (unsigned long) data->start; } else { addr_reg = ioremap(addr->start, 1); if (addr_reg == NULL) { @@ -1746,7 +1749,7 @@ sl811h_probe(struct platform_device *dev) * was on a system with single edge triggering, so most sorts of * triggering arrangement should work. */ - retval = usb_add_hcd(hcd, irq, SA_INTERRUPT | SA_SHIRQ); + retval = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED); if (retval != 0) goto err6; diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c index 6637a0e4997..dc286a48caf 100644 --- a/drivers/usb/host/uhci-debug.c +++ b/drivers/usb/host/uhci-debug.c @@ -9,7 +9,6 @@ * (C) Copyright 1999-2001 Johannes Erdfelt */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/debugfs.h> #include <linux/smp_lock.h> diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 7b48567622e..4151f618602 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c @@ -22,7 +22,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/kernel.h> diff --git a/drivers/usb/input/appletouch.c b/drivers/usb/input/appletouch.c index 36855062eac..9e3f1390337 100644 --- a/drivers/usb/input/appletouch.c +++ b/drivers/usb/input/appletouch.c @@ -27,7 +27,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c index 07c8c0e665d..05d2d6012eb 100644 --- a/drivers/usb/input/ati_remote.c +++ b/drivers/usb/input/ati_remote.c @@ -85,7 +85,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c index c4670e1d465..70477f02cc2 100644 --- a/drivers/usb/input/hiddev.c +++ b/drivers/usb/input/hiddev.c @@ -25,7 +25,6 @@ * e-mail - mail your message to Paul Stewart <stewart@wetlogic.net> */ -#include <linux/config.h> #include <linux/poll.h> #include <linux/slab.h> #include <linux/module.h> diff --git a/drivers/usb/input/itmtouch.c b/drivers/usb/input/itmtouch.c index 5c570cc703f..86acb5f1907 100644 --- a/drivers/usb/input/itmtouch.c +++ b/drivers/usb/input/itmtouch.c @@ -39,7 +39,6 @@ * *****************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/module.h> diff --git a/drivers/usb/input/keyspan_remote.c b/drivers/usb/input/keyspan_remote.c index 70af985b5db..4723b310f27 100644 --- a/drivers/usb/input/keyspan_remote.c +++ b/drivers/usb/input/keyspan_remote.c @@ -11,7 +11,6 @@ * and Keyspan, Inc the manufacturers of the Keyspan USB DMR product. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c index 4fdee4db072..a9ccda8810e 100644 --- a/drivers/usb/input/mtouchusb.c +++ b/drivers/usb/input/mtouchusb.c @@ -39,7 +39,6 @@ * *****************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/module.h> diff --git a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c index da7b0bf51af..0149043ffb9 100644 --- a/drivers/usb/input/touchkitusb.c +++ b/drivers/usb/input/touchkitusb.c @@ -24,7 +24,6 @@ //#define DEBUG -#include <linux/config.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/module.h> diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c index cfd4a4e0433..9889b1cda05 100644 --- a/drivers/usb/input/xpad.c +++ b/drivers/usb/input/xpad.c @@ -54,7 +54,6 @@ * 2002-07-17 - 0.0.5 : simplified d-pad handling */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/slab.h> diff --git a/drivers/usb/input/yealink.c b/drivers/usb/input/yealink.c index 24aedbb20f0..575a4e672e9 100644 --- a/drivers/usb/input/yealink.c +++ b/drivers/usb/input/yealink.c @@ -46,7 +46,6 @@ * 20050816 henk Merge 2.6.13-rc6 */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/slab.h> diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c index a04204292aa..b20bec44555 100644 --- a/drivers/usb/misc/cytherm.c +++ b/drivers/usb/misc/cytherm.c @@ -14,7 +14,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c index d0b16725669..fcd69c52aea 100644 --- a/drivers/usb/misc/idmouse.c +++ b/drivers/usb/misc/idmouse.c @@ -16,7 +16,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/delay.h> diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index 966acb474f6..f30ab1fbb3c 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c @@ -27,7 +27,6 @@ * V0.13 (mh) Added support for LD X-Ray and Machine Test System */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 779bcf0373a..7699d970e68 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -75,7 +75,6 @@ * - move reset into open to clean out spurious data */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c index 13aeea2026c..bfbbbfbb92b 100644 --- a/drivers/usb/misc/phidgetkit.c +++ b/drivers/usb/misc/phidgetkit.c @@ -13,7 +13,6 @@ * This is a driver for the USB PhidgetInterfaceKit. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c index 5a040c205ee..c0df79c9653 100644 --- a/drivers/usb/misc/phidgetservo.c +++ b/drivers/usb/misc/phidgetservo.c @@ -25,7 +25,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/misc/sisusbvga/sisusb_init.c b/drivers/usb/misc/sisusbvga/sisusb_init.c index 968f0d38cff..9b30f896281 100644 --- a/drivers/usb/misc/sisusbvga/sisusb_init.c +++ b/drivers/usb/misc/sisusbvga/sisusb_init.c @@ -36,7 +36,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index f441964132c..0c5ee0ad6bb 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 81ba14c73dc..786e1dbe88e 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -1,4 +1,3 @@ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c index 37111acec87..2e2bbc003e9 100644 --- a/drivers/usb/net/asix.c +++ b/drivers/usb/net/asix.c @@ -22,7 +22,6 @@ // #define DEBUG // error path messages, extra info // #define VERBOSE // more; success messages -#include <linux/config.h> #include <linux/module.h> #include <linux/kmod.h> #include <linux/sched.h> diff --git a/drivers/usb/net/cdc_ether.c b/drivers/usb/net/cdc_ether.c index efd195b5912..82ce0358d9a 100644 --- a/drivers/usb/net/cdc_ether.c +++ b/drivers/usb/net/cdc_ether.c @@ -20,7 +20,6 @@ // #define DEBUG // error path messages, extra info // #define VERBOSE // more; success messages -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/init.h> diff --git a/drivers/usb/net/cdc_subset.c b/drivers/usb/net/cdc_subset.c index ec801e8bb1b..e2fae85851a 100644 --- a/drivers/usb/net/cdc_subset.c +++ b/drivers/usb/net/cdc_subset.c @@ -17,7 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kmod.h> #include <linux/sched.h> diff --git a/drivers/usb/net/gl620a.c b/drivers/usb/net/gl620a.c index faf1e86be68..3155f25f1d4 100644 --- a/drivers/usb/net/gl620a.c +++ b/drivers/usb/net/gl620a.c @@ -21,7 +21,6 @@ // #define DEBUG // error path messages, extra info // #define VERBOSE // more; success messages -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/init.h> diff --git a/drivers/usb/net/net1080.c b/drivers/usb/net/net1080.c index 78e6a43b108..a9b6eeac3e3 100644 --- a/drivers/usb/net/net1080.c +++ b/drivers/usb/net/net1080.c @@ -20,7 +20,6 @@ // #define DEBUG // error path messages, extra info // #define VERBOSE // more; success messages -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/init.h> diff --git a/drivers/usb/net/plusb.c b/drivers/usb/net/plusb.c index 4fe863389cb..5d17cdfc7ba 100644 --- a/drivers/usb/net/plusb.c +++ b/drivers/usb/net/plusb.c @@ -20,7 +20,6 @@ // #define DEBUG // error path messages, extra info // #define VERBOSE // more; success messages -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/init.h> diff --git a/drivers/usb/net/rndis_host.c b/drivers/usb/net/rndis_host.c index f551546d752..c2a28d88ef3 100644 --- a/drivers/usb/net/rndis_host.c +++ b/drivers/usb/net/rndis_host.c @@ -20,7 +20,6 @@ // #define DEBUG // error path messages, extra info // #define VERBOSE // more; success messages -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/init.h> diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c index 1bbbae283c0..718f8e2b552 100644 --- a/drivers/usb/net/rtl8150.c +++ b/drivers/usb/net/rtl8150.c @@ -6,7 +6,6 @@ * version 2 as published by the Free Software Foundation. */ -#include <linux/config.h> #include <linux/sched.h> #include <linux/init.h> #include <linux/signal.h> diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c index 362d6907c9b..54183e173a6 100644 --- a/drivers/usb/net/usbnet.c +++ b/drivers/usb/net/usbnet.c @@ -33,7 +33,6 @@ // #define DEBUG // error path messages, extra info // #define VERBOSE // more; success messages -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/init.h> diff --git a/drivers/usb/net/zaurus.c b/drivers/usb/net/zaurus.c index 813e470d060..144566bda58 100644 --- a/drivers/usb/net/zaurus.c +++ b/drivers/usb/net/zaurus.c @@ -20,7 +20,6 @@ // #define DEBUG // error path messages, extra info // #define VERBOSE // more; success messages -#include <linux/config.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/init.h> diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index 4144777ea18..3faa7aa0111 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c @@ -63,7 +63,6 @@ * UsbSnoop on Windows2000 and from examining the other USB drivers. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c index e9f9f4bafa1..f2d993b70c1 100644 --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c @@ -8,7 +8,6 @@ * 2 as published by the Free Software Foundation. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/tty.h> diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index f3404e10afb..3d456b32c31 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c @@ -11,7 +11,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/slab.h> diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index f8c0cb28773..df0a4f98b4a 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c @@ -17,7 +17,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/slab.h> diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 1fd5c5a9f2e..49b51ab0d4c 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c @@ -28,7 +28,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 5de76efe1b3..4ff2dfb299b 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -48,7 +48,6 @@ /* Code originates and was built up from ftdi_sio, belkin, pl2303 and others. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index b3f776a90c9..6953d3ef573 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -233,7 +233,6 @@ * $Id: digi_acceleport.c,v 1.80.1.2 2000/11/02 05:45:08 root Exp $ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index afca1eae5fb..1e2b31eeb49 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c @@ -51,7 +51,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/ezusb.c b/drivers/usb/serial/ezusb.c index 1e419c8d739..debc3b0f966 100644 --- a/drivers/usb/serial/ezusb.c +++ b/drivers/usb/serial/ezusb.c @@ -8,7 +8,6 @@ * 2 as published by the Free Software Foundation. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index b2bfea7c815..8a74b19f128 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -245,7 +245,6 @@ /* to talk to the device */ /* Thanx to gkh and the rest of the usb dev group for all code I have assimilated :-) */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 04767759cf8..1f5d1620baa 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c @@ -23,7 +23,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 07a478c59fb..945b8bb38c9 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/slab.h> diff --git a/drivers/usb/serial/hp4x.c b/drivers/usb/serial/hp4x.c index e9719da2aca..7e06358b031 100644 --- a/drivers/usb/serial/hp4x.c +++ b/drivers/usb/serial/hp4x.c @@ -12,7 +12,6 @@ * See Documentation/usb/usb-serial.txt for more information on using this driver */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/tty.h> diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index b85d2156dfd..bd2c05dac2a 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -29,7 +29,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/jiffies.h> #include <linux/errno.h> diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 8e1e2253748..723a12ae87b 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -24,7 +24,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/jiffies.h> #include <linux/errno.h> diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index 9da6d2a8f2b..dbcfe172a5c 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c @@ -44,7 +44,6 @@ * Thanks to info from Heath Robinson and Arieh Davidoff. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index d7f3f736a69..2cf1fed3de4 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c @@ -46,7 +46,6 @@ * initial version released. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 2cf6ade704e..d7c58f1bc96 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c @@ -95,7 +95,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/jiffies.h> #include <linux/errno.h> diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index b0441c35f98..03ab3c0f3cc 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -66,7 +66,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index 65d79f630fa..b45ff3e7ab4 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c @@ -45,7 +45,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 87dfcd89ffa..45773337477 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c @@ -35,7 +35,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index 35bd29b6c40..ca05d3275f3 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c @@ -64,7 +64,6 @@ * (via linux-usb-devel). */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 6dcdb5f598b..cfb711a21a4 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c @@ -35,7 +35,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index b0861b61bba..78ad4b3126a 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -57,7 +57,6 @@ #define DRIVER_AUTHOR "Matthias Urlichs <smurf@smurf.noris.de>" #define DRIVER_DESC "USB Driver for GSM modems" -#include <linux/config.h> #include <linux/kernel.h> #include <linux/jiffies.h> #include <linux/errno.h> diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index d8870438720..de93a2b909e 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -14,7 +14,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c index f0215f850d2..897d8447252 100644 --- a/drivers/usb/serial/safe_serial.c +++ b/drivers/usb/serial/safe_serial.c @@ -60,7 +60,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index c3a2071b802..a9afff31a92 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -68,7 +68,6 @@ * fi */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index a30135c7cfe..b59a0536ea5 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -16,7 +16,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> @@ -1059,13 +1058,12 @@ static int __init usb_serial_init(void) usb_serial_tty_driver->owner = THIS_MODULE; usb_serial_tty_driver->driver_name = "usbserial"; - usb_serial_tty_driver->devfs_name = "usb/tts/"; usb_serial_tty_driver->name = "ttyUSB"; usb_serial_tty_driver->major = SERIAL_TTY_MAJOR; usb_serial_tty_driver->minor_start = 0; usb_serial_tty_driver->type = TTY_DRIVER_TYPE_SERIAL; usb_serial_tty_driver->subtype = SERIAL_TYPE_NORMAL; - usb_serial_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; + usb_serial_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; usb_serial_tty_driver->init_termios = tty_std_termios; usb_serial_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; tty_set_operations(usb_serial_tty_driver, &serial_ops); diff --git a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h index d53ea9b11e8..0f2802a6019 100644 --- a/drivers/usb/serial/usb-serial.h +++ b/drivers/usb/serial/usb-serial.h @@ -14,7 +14,6 @@ #ifndef __LINUX_USB_SERIAL_H #define __LINUX_USB_SERIAL_H -#include <linux/config.h> #include <linux/kref.h> #include <linux/mutex.h> diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 9e89b8d54f7..95a2936e902 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c @@ -13,7 +13,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 56ffc81302f..540438c3f38 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c @@ -65,7 +65,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/usb/storage/debug.h b/drivers/usb/storage/debug.h index cd2096acc72..77e244a8c37 100644 --- a/drivers/usb/storage/debug.h +++ b/drivers/usb/storage/debug.h @@ -44,7 +44,6 @@ #ifndef _DEBUG_H_ #define _DEBUG_H_ -#include <linux/config.h> #include <linux/kernel.h> #define USB_STORAGE "usb-storage: " diff --git a/drivers/usb/storage/dpcm.c b/drivers/usb/storage/dpcm.c index 92b69e4c804..1628cb25856 100644 --- a/drivers/usb/storage/dpcm.c +++ b/drivers/usb/storage/dpcm.c @@ -29,7 +29,6 @@ * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_device.h> diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c index 30e96050fe0..88aa59ab756 100644 --- a/drivers/usb/storage/freecom.c +++ b/drivers/usb/storage/freecom.c @@ -28,7 +28,6 @@ * (http://www.freecom.de/) */ -#include <linux/config.h> #include <linux/hdreg.h> #include <scsi/scsi.h> diff --git a/drivers/usb/storage/initializers.h b/drivers/usb/storage/initializers.h index f9907a5cf12..927f7781080 100644 --- a/drivers/usb/storage/initializers.h +++ b/drivers/usb/storage/initializers.h @@ -37,7 +37,6 @@ * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include "usb.h" #include "transport.h" diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c index 026a587eb8d..313920d980c 100644 --- a/drivers/usb/storage/onetouch.c +++ b/drivers/usb/storage/onetouch.c @@ -28,7 +28,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/input.h> #include <linux/init.h> diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 19b25c5cafd..eb7188b3565 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c @@ -45,7 +45,6 @@ * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/sched.h> #include <linux/errno.h> #include <linux/slab.h> diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 543244d421c..c7e84e653df 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -31,7 +31,6 @@ * the following thing for it to work: * The macro UNUSUAL_DEV() must be defined before this file is included */ -#include <linux/config.h> /* If you edit this file, please try to keep it sorted first by VendorID, * then by ProductID. diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index e232c7c8990..1185acac4b2 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -47,7 +47,6 @@ * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/sched.h> #include <linux/errno.h> #include <linux/suspend.h> diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c index 4de9fb56ebf..b362039792b 100644 --- a/drivers/usb/usb-skeleton.c +++ b/drivers/usb/usb-skeleton.c @@ -13,7 +13,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> diff --git a/drivers/video/S3triofb.c b/drivers/video/S3triofb.c index 455fda990ff..e714e8449c1 100644 --- a/drivers/video/S3triofb.c +++ b/drivers/video/S3triofb.c @@ -23,7 +23,6 @@ */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/errno.h> diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index 98baecccb3f..61a8bf159cb 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c @@ -17,7 +17,6 @@ * - Blanking 8bpp displays with VIDC */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index 3033c72dea2..f9bc9f777e7 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c @@ -48,7 +48,6 @@ #include <linux/tty.h> #include <linux/slab.h> #include <linux/delay.h> -#include <linux/config.h> #include <linux/interrupt.h> #include <linux/fb.h> #include <linux/init.h> diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c index 466042808da..fd95c2dbd4f 100644 --- a/drivers/video/arcfb.c +++ b/drivers/video/arcfb.c @@ -561,7 +561,7 @@ static int __init arcfb_probe(struct platform_device *dev) platform_set_drvdata(dev, info); if (irq) { par->irq = irq; - if (request_irq(par->irq, &arcfb_interrupt, SA_SHIRQ, + if (request_irq(par->irq, &arcfb_interrupt, IRQF_SHARED, "arcfb", info)) { printk(KERN_INFO "arcfb: Failed req IRQ %d\n", par->irq); diff --git a/drivers/video/asiliantfb.c b/drivers/video/asiliantfb.c index 29f9f0dfe3b..eaeaf4d1a09 100644 --- a/drivers/video/asiliantfb.c +++ b/drivers/video/asiliantfb.c @@ -29,7 +29,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index 11cf7fcb1d5..72c58910947 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c @@ -46,7 +46,6 @@ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> diff --git a/drivers/video/aty/atyfb.h b/drivers/video/aty/atyfb.h index 43d2cb58af8..55fb8b04489 100644 --- a/drivers/video/aty/atyfb.h +++ b/drivers/video/aty/atyfb.h @@ -2,7 +2,6 @@ * ATI Frame Buffer Device Driver Core Definitions */ -#include <linux/config.h> #include <linux/spinlock.h> #include <linux/wait.h> /* diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 22e720611bf..0c9706746d7 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c @@ -49,7 +49,6 @@ ******************************************************************************/ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> @@ -1568,7 +1567,7 @@ static int aty_enable_irq(struct atyfb_par *par, int reenable) u32 int_cntl; if (!test_and_set_bit(0, &par->irq_flags)) { - if (request_irq(par->irq, aty_irq, SA_SHIRQ, "atyfb", par)) { + if (request_irq(par->irq, aty_irq, IRQF_SHARED, "atyfb", par)) { clear_bit(0, &par->irq_flags); return -EINVAL; } diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 68b15645b89..51b78f8de94 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c @@ -52,7 +52,6 @@ #define RADEON_VERSION "0.2.0" -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> diff --git a/drivers/video/aty/radeon_i2c.c b/drivers/video/aty/radeon_i2c.c index a9d0414e465..9aaca58c074 100644 --- a/drivers/video/aty/radeon_i2c.c +++ b/drivers/video/aty/radeon_i2c.c @@ -1,4 +1,3 @@ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/drivers/video/aty/radeonfb.h b/drivers/video/aty/radeonfb.h index 1645943b112..38657b2d10e 100644 --- a/drivers/video/aty/radeonfb.h +++ b/drivers/video/aty/radeonfb.h @@ -1,7 +1,6 @@ #ifndef __RADEONFB_H__ #define __RADEONFB_H__ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -382,7 +381,7 @@ struct radeonfb_info { /* Note about this function: we have some rare cases where we must not schedule, * this typically happen with our special "wake up early" hook which allows us to * wake up the graphic chip (and thus get the console back) before everything else - * on some machines that support that mecanism. At this point, interrupts are off + * on some machines that support that mechanism. At this point, interrupts are off * and scheduling is not permitted */ static inline void _radeon_msleep(struct radeonfb_info *rinfo, unsigned long ms) diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index 9ef68cd83bb..a92a91fef16 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c @@ -40,7 +40,6 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c index 600d3e0e08b..c6a5f0ccc10 100644 --- a/drivers/video/au1200fb.c +++ b/drivers/video/au1200fb.c @@ -1694,7 +1694,7 @@ static int au1200fb_drv_probe(struct device *dev) /* Now hook interrupt too */ if ((ret = request_irq(AU1200_LCD_INT, au1200fb_handle_irq, - SA_INTERRUPT | SA_SHIRQ, "lcd", (void *)dev)) < 0) { + IRQF_DISABLED | IRQF_SHARED, "lcd", (void *)dev)) < 0) { print_err("fail to request interrupt line %d (err: %d)", AU1200_LCD_INT, ret); goto failed; diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index bd879b7ec11..caf1eca199b 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c @@ -11,7 +11,6 @@ */ /* LCD power functions */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/delay.h> diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c index 6577fdfdfc1..c66e3d52cbf 100644 --- a/drivers/video/bw2.c +++ b/drivers/video/bw2.c @@ -1,6 +1,6 @@ /* bw2.c: BWTWO frame buffer driver * - * Copyright (C) 2003 David S. Miller (davem@redhat.com) + * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net) * Copyright (C) 1996,1998 Jakub Jelinek (jj@ultra.linux.cz) * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) @@ -19,14 +19,11 @@ #include <linux/mm.h> #include <asm/io.h> -#include <asm/sbus.h> #include <asm/oplib.h> +#include <asm/prom.h> +#include <asm/of_device.h> #include <asm/fbio.h> -#ifdef CONFIG_SPARC32 -#include <asm/sun4paddr.h> -#endif - #include "sbuslib.h" /* @@ -59,30 +56,30 @@ static struct fb_ops bw2_ops = { #define BWTWO_REGISTER_OFFSET 0x400000 struct bt_regs { - volatile u32 addr; - volatile u32 color_map; - volatile u32 control; - volatile u32 cursor; + u32 addr; + u32 color_map; + u32 control; + u32 cursor; }; struct bw2_regs { struct bt_regs cmap; - volatile u8 control; - volatile u8 status; - volatile u8 cursor_start; - volatile u8 cursor_end; - volatile u8 h_blank_start; - volatile u8 h_blank_end; - volatile u8 h_sync_start; - volatile u8 h_sync_end; - volatile u8 comp_sync_end; - volatile u8 v_blank_start_high; - volatile u8 v_blank_start_low; - volatile u8 v_blank_end; - volatile u8 v_sync_start; - volatile u8 v_sync_end; - volatile u8 xfer_holdoff_start; - volatile u8 xfer_holdoff_end; + u8 control; + u8 status; + u8 cursor_start; + u8 cursor_end; + u8 h_blank_start; + u8 h_blank_end; + u8 h_sync_start; + u8 h_sync_end; + u8 comp_sync_end; + u8 v_blank_start_high; + u8 v_blank_start_low; + u8 v_blank_end; + u8 v_sync_start; + u8 v_sync_end; + u8 xfer_holdoff_start; + u8 xfer_holdoff_end; }; /* Status Register Constants */ @@ -117,9 +114,8 @@ struct bw2_par { #define BW2_FLAG_BLANKED 0x00000001 unsigned long physbase; + unsigned long which_io; unsigned long fbsize; - - struct sbus_dev *sdev; }; /** @@ -174,9 +170,7 @@ static int bw2_mmap(struct fb_info *info, struct vm_area_struct *vma) return sbusfb_mmap_helper(bw2_mmap_map, par->physbase, par->fbsize, - (par->sdev ? - par->sdev->reg_addrs[0].which_io : - 0), + par->which_io, vma); } @@ -288,139 +282,124 @@ static void bw2_do_default_mode(struct bw2_par *par, struct fb_info *info, struct all_info { struct fb_info info; struct bw2_par par; - struct list_head list; }; -static LIST_HEAD(bw2_list); -static void bw2_init_one(struct sbus_dev *sdev) +static int __devinit bw2_init_one(struct of_device *op) { + struct device_node *dp = op->node; struct all_info *all; - struct resource *resp; -#ifdef CONFIG_SUN4 - struct resource res; -#endif - int linebytes; + int linebytes, err; - all = kmalloc(sizeof(*all), GFP_KERNEL); - if (!all) { - printk(KERN_ERR "bw2: Cannot allocate memory.\n"); - return; - } - memset(all, 0, sizeof(*all)); - - INIT_LIST_HEAD(&all->list); + all = kzalloc(sizeof(*all), GFP_KERNEL); + if (!all) + return -ENOMEM; spin_lock_init(&all->par.lock); - all->par.sdev = sdev; - -#ifdef CONFIG_SUN4 - if (!sdev) { - all->par.physbase = sun4_bwtwo_physaddr; - res.start = sun4_bwtwo_physaddr; - res.end = res.start + BWTWO_REGISTER_OFFSET + sizeof(struct bw2_regs) - 1; - res.flags = IORESOURCE_IO; - resp = &res; - all->info.var.xres = all->info.var.xres_virtual = 1152; - all->info.var.yres = all->info.var.yres_virtual = 900; - all->info.var.bits_per_pixel = 1; - linebytes = 1152 / 8; - } else -#else - { - BUG_ON(!sdev); - all->par.physbase = sdev->reg_addrs[0].phys_addr; - resp = &sdev->resource[0]; - sbusfb_fill_var(&all->info.var, (sdev ? sdev->prom_node : 0), 1); - linebytes = prom_getintdefault(sdev->prom_node, "linebytes", - all->info.var.xres); - } -#endif + + all->par.physbase = op->resource[0].start; + all->par.which_io = op->resource[0].flags & IORESOURCE_BITS; + + sbusfb_fill_var(&all->info.var, dp->node, 1); + linebytes = of_getintprop_default(dp, "linebytes", + all->info.var.xres); + all->info.var.red.length = all->info.var.green.length = all->info.var.blue.length = all->info.var.bits_per_pixel; all->info.var.red.offset = all->info.var.green.offset = all->info.var.blue.offset = 0; - all->par.regs = sbus_ioremap(resp, BWTWO_REGISTER_OFFSET, - sizeof(struct bw2_regs), "bw2 regs"); + all->par.regs = of_ioremap(&op->resource[0], BWTWO_REGISTER_OFFSET, + sizeof(struct bw2_regs), "bw2 regs"); - if (sdev && !prom_getbool(sdev->prom_node, "width")) + if (!of_find_property(dp, "width", NULL)) bw2_do_default_mode(&all->par, &all->info, &linebytes); all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres); all->info.flags = FBINFO_DEFAULT; all->info.fbops = &bw2_ops; -#if defined(CONFIG_SPARC32) - if (sdev) - all->info.screen_base = (char __iomem *) - prom_getintdefault(sdev->prom_node, "address", 0); -#endif - if (!all->info.screen_base) - all->info.screen_base = - sbus_ioremap(resp, 0, all->par.fbsize, "bw2 ram"); + + all->info.screen_base = + sbus_ioremap(&op->resource[0], 0, all->par.fbsize, "bw2 ram"); all->info.par = &all->par; bw2_blank(0, &all->info); bw2_init_fix(&all->info, linebytes); - if (register_framebuffer(&all->info) < 0) { - printk(KERN_ERR "bw2: Could not register framebuffer.\n"); + err= register_framebuffer(&all->info); + if (err < 0) { + of_iounmap(all->par.regs, sizeof(struct bw2_regs)); + of_iounmap(all->info.screen_base, all->par.fbsize); kfree(all); - return; + return err; } - list_add(&all->list, &bw2_list); + dev_set_drvdata(&op->dev, all); + + printk("%s: bwtwo at %lx:%lx\n", + dp->full_name, + all->par.which_io, all->par.physbase); - printk("bw2: bwtwo at %lx:%lx\n", - (long) (sdev ? sdev->reg_addrs[0].which_io : 0), - (long) all->par.physbase); + return 0; } -int __init bw2_init(void) +static int __devinit bw2_probe(struct of_device *dev, const struct of_device_id *match) { - struct sbus_bus *sbus; - struct sbus_dev *sdev; + struct of_device *op = to_of_device(&dev->dev); - if (fb_get_options("bw2fb", NULL)) - return -ENODEV; + return bw2_init_one(op); +} -#ifdef CONFIG_SUN4 - bw2_init_one(NULL); -#endif - for_all_sbusdev(sdev, sbus) { - if (!strcmp(sdev->prom_name, "bwtwo")) - bw2_init_one(sdev); - } +static int __devexit bw2_remove(struct of_device *dev) +{ + struct all_info *all = dev_get_drvdata(&dev->dev); + + unregister_framebuffer(&all->info); + + of_iounmap(all->par.regs, sizeof(struct bw2_regs)); + of_iounmap(all->info.screen_base, all->par.fbsize); + + kfree(all); + + dev_set_drvdata(&dev->dev, NULL); return 0; } -void __exit bw2_exit(void) -{ - struct list_head *pos, *tmp; +static struct of_device_id bw2_match[] = { + { + .name = "bwtwo", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, bw2_match); - list_for_each_safe(pos, tmp, &bw2_list) { - struct all_info *all = list_entry(pos, typeof(*all), list); +static struct of_platform_driver bw2_driver = { + .name = "bw2", + .match_table = bw2_match, + .probe = bw2_probe, + .remove = __devexit_p(bw2_remove), +}; - unregister_framebuffer(&all->info); - kfree(all); - } +static int __init bw2_init(void) +{ + if (fb_get_options("bw2fb", NULL)) + return -ENODEV; + + return of_register_driver(&bw2_driver, &of_bus_type); } -int __init -bw2_setup(char *arg) +static void __exit bw2_exit(void) { - /* No cmdline options yet... */ - return 0; + return of_unregister_driver(&bw2_driver); } -module_init(bw2_init); -#ifdef MODULE +module_init(bw2_init); module_exit(bw2_exit); -#endif MODULE_DESCRIPTION("framebuffer driver for BWTWO chipsets"); -MODULE_AUTHOR("David S. Miller <davem@redhat.com>"); +MODULE_AUTHOR("David S. Miller <davem@davemloft.net>"); +MODULE_VERSION("2.0"); MODULE_LICENSE("GPL"); diff --git a/drivers/video/cfbcopyarea.c b/drivers/video/cfbcopyarea.c index 74415325b01..6faea4034e3 100644 --- a/drivers/video/cfbcopyarea.c +++ b/drivers/video/cfbcopyarea.c @@ -24,7 +24,6 @@ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/string.h> diff --git a/drivers/video/cfbfillrect.c b/drivers/video/cfbfillrect.c index e5ff62e9cfb..f00b50aab60 100644 --- a/drivers/video/cfbfillrect.c +++ b/drivers/video/cfbfillrect.c @@ -17,7 +17,6 @@ * the native cpu endians. I also need to deal with MSB position in the word. * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/string.h> #include <linux/fb.h> diff --git a/drivers/video/cfbimgblt.c b/drivers/video/cfbimgblt.c index ad8a89bf8ea..51d35386a94 100644 --- a/drivers/video/cfbimgblt.c +++ b/drivers/video/cfbimgblt.c @@ -29,7 +29,6 @@ * Also need to add code to deal with cards endians that are different than * the native cpu endians. I also need to deal with MSB position in the word. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/string.h> #include <linux/fb.h> diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c index 63b6c79c8a0..7f926c619b6 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/cg14.c @@ -1,6 +1,6 @@ /* cg14.c: CGFOURTEEN frame buffer driver * - * Copyright (C) 2003 David S. Miller (davem@redhat.com) + * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net) * Copyright (C) 1996,1998 Jakub Jelinek (jj@ultra.linux.cz) * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx) * @@ -18,8 +18,8 @@ #include <linux/mm.h> #include <asm/io.h> -#include <asm/sbus.h> -#include <asm/oplib.h> +#include <asm/prom.h> +#include <asm/of_device.h> #include <asm/fbio.h> #include "sbuslib.h" @@ -99,73 +99,73 @@ static struct fb_ops cg14_ops = { #define CG14_MCR_PIXMODE_32 3 struct cg14_regs{ - volatile u8 mcr; /* Master Control Reg */ - volatile u8 ppr; /* Packed Pixel Reg */ - volatile u8 tms[2]; /* Test Mode Status Regs */ - volatile u8 msr; /* Master Status Reg */ - volatile u8 fsr; /* Fault Status Reg */ - volatile u8 rev; /* Revision & Impl */ - volatile u8 ccr; /* Clock Control Reg */ - volatile u32 tmr; /* Test Mode Read Back */ - volatile u8 mod; /* Monitor Operation Data Reg */ - volatile u8 acr; /* Aux Control */ + u8 mcr; /* Master Control Reg */ + u8 ppr; /* Packed Pixel Reg */ + u8 tms[2]; /* Test Mode Status Regs */ + u8 msr; /* Master Status Reg */ + u8 fsr; /* Fault Status Reg */ + u8 rev; /* Revision & Impl */ + u8 ccr; /* Clock Control Reg */ + u32 tmr; /* Test Mode Read Back */ + u8 mod; /* Monitor Operation Data Reg */ + u8 acr; /* Aux Control */ u8 xxx0[6]; - volatile u16 hct; /* Hor Counter */ - volatile u16 vct; /* Vert Counter */ - volatile u16 hbs; /* Hor Blank Start */ - volatile u16 hbc; /* Hor Blank Clear */ - volatile u16 hss; /* Hor Sync Start */ - volatile u16 hsc; /* Hor Sync Clear */ - volatile u16 csc; /* Composite Sync Clear */ - volatile u16 vbs; /* Vert Blank Start */ - volatile u16 vbc; /* Vert Blank Clear */ - volatile u16 vss; /* Vert Sync Start */ - volatile u16 vsc; /* Vert Sync Clear */ - volatile u16 xcs; - volatile u16 xcc; - volatile u16 fsa; /* Fault Status Address */ - volatile u16 adr; /* Address Registers */ + u16 hct; /* Hor Counter */ + u16 vct; /* Vert Counter */ + u16 hbs; /* Hor Blank Start */ + u16 hbc; /* Hor Blank Clear */ + u16 hss; /* Hor Sync Start */ + u16 hsc; /* Hor Sync Clear */ + u16 csc; /* Composite Sync Clear */ + u16 vbs; /* Vert Blank Start */ + u16 vbc; /* Vert Blank Clear */ + u16 vss; /* Vert Sync Start */ + u16 vsc; /* Vert Sync Clear */ + u16 xcs; + u16 xcc; + u16 fsa; /* Fault Status Address */ + u16 adr; /* Address Registers */ u8 xxx1[0xce]; - volatile u8 pcg[0x100]; /* Pixel Clock Generator */ - volatile u32 vbr; /* Frame Base Row */ - volatile u32 vmcr; /* VBC Master Control */ - volatile u32 vcr; /* VBC refresh */ - volatile u32 vca; /* VBC Config */ + u8 pcg[0x100]; /* Pixel Clock Generator */ + u32 vbr; /* Frame Base Row */ + u32 vmcr; /* VBC Master Control */ + u32 vcr; /* VBC refresh */ + u32 vca; /* VBC Config */ }; #define CG14_CCR_ENABLE 0x04 #define CG14_CCR_SELECT 0x02 /* HW/Full screen */ struct cg14_cursor { - volatile u32 cpl0[32]; /* Enable plane 0 */ - volatile u32 cpl1[32]; /* Color selection plane */ - volatile u8 ccr; /* Cursor Control Reg */ + u32 cpl0[32]; /* Enable plane 0 */ + u32 cpl1[32]; /* Color selection plane */ + u8 ccr; /* Cursor Control Reg */ u8 xxx0[3]; - volatile u16 cursx; /* Cursor x,y position */ - volatile u16 cursy; /* Cursor x,y position */ - volatile u32 color0; - volatile u32 color1; + u16 cursx; /* Cursor x,y position */ + u16 cursy; /* Cursor x,y position */ + u32 color0; + u32 color1; u32 xxx1[0x1bc]; - volatile u32 cpl0i[32]; /* Enable plane 0 autoinc */ - volatile u32 cpl1i[32]; /* Color selection autoinc */ + u32 cpl0i[32]; /* Enable plane 0 autoinc */ + u32 cpl1i[32]; /* Color selection autoinc */ }; struct cg14_dac { - volatile u8 addr; /* Address Register */ + u8 addr; /* Address Register */ u8 xxx0[255]; - volatile u8 glut; /* Gamma table */ + u8 glut; /* Gamma table */ u8 xxx1[255]; - volatile u8 select; /* Register Select */ + u8 select; /* Register Select */ u8 xxx2[255]; - volatile u8 mode; /* Mode Register */ + u8 mode; /* Mode Register */ }; struct cg14_xlut{ - volatile u8 x_xlut [256]; - volatile u8 x_xlutd [256]; + u8 x_xlut [256]; + u8 x_xlutd [256]; u8 xxx0[0x600]; - volatile u8 x_xlut_inc [256]; - volatile u8 x_xlutd_inc [256]; + u8 x_xlut_inc [256]; + u8 x_xlutd_inc [256]; }; /* Color look up table (clut) */ @@ -204,7 +204,6 @@ struct cg14_par { int mode; int ramsize; - struct sbus_dev *sdev; }; static void __cg14_reset(struct cg14_par *par) @@ -355,14 +354,9 @@ static int cg14_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) * Initialisation */ -static void cg14_init_fix(struct fb_info *info, int linebytes) +static void cg14_init_fix(struct fb_info *info, int linebytes, struct device_node *dp) { - struct cg14_par *par = (struct cg14_par *)info->par; - const char *name; - - name = "cgfourteen"; - if (par->sdev) - name = par->sdev->prom_name; + const char *name = dp->name; strlcpy(info->fix.id, name, sizeof(info->fix.id)); @@ -456,98 +450,81 @@ static struct sbus_mmap_map __cg14_mmap_map[CG14_MMAP_ENTRIES] __initdata = { struct all_info { struct fb_info info; struct cg14_par par; - struct list_head list; }; -static LIST_HEAD(cg14_list); -static void cg14_init_one(struct sbus_dev *sdev, int node, int parent_node) +static void cg14_unmap_regs(struct all_info *all) { - struct all_info *all; - unsigned long phys, rphys; - u32 bases[6]; - int is_8mb, linebytes, i; - - if (!sdev) { - if (prom_getproperty(node, "address", - (char *) &bases[0], sizeof(bases)) <= 0 - || !bases[0]) { - printk(KERN_ERR "cg14: Device is not mapped.\n"); - return; - } - if (__get_iospace(bases[0]) != __get_iospace(bases[1])) { - printk(KERN_ERR "cg14: I/O spaces don't match.\n"); - return; - } - } + if (all->par.regs) + of_iounmap(all->par.regs, sizeof(struct cg14_regs)); + if (all->par.clut) + of_iounmap(all->par.clut, sizeof(struct cg14_clut)); + if (all->par.cursor) + of_iounmap(all->par.cursor, sizeof(struct cg14_cursor)); + if (all->info.screen_base) + of_iounmap(all->info.screen_base, all->par.fbsize); +} - all = kmalloc(sizeof(*all), GFP_KERNEL); - if (!all) { - printk(KERN_ERR "cg14: Cannot allocate memory.\n"); - return; - } - memset(all, 0, sizeof(*all)); +static int __devinit cg14_init_one(struct of_device *op) +{ + struct device_node *dp = op->node; + struct all_info *all; + int is_8mb, linebytes, i, err; - INIT_LIST_HEAD(&all->list); + all = kzalloc(sizeof(*all), GFP_KERNEL); + if (!all) + return -ENOMEM; spin_lock_init(&all->par.lock); - sbusfb_fill_var(&all->info.var, node, 8); + sbusfb_fill_var(&all->info.var, dp->node, 8); all->info.var.red.length = 8; all->info.var.green.length = 8; all->info.var.blue.length = 8; - linebytes = prom_getintdefault(node, "linebytes", - all->info.var.xres); + linebytes = of_getintprop_default(dp, "linebytes", + all->info.var.xres); all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres); - all->par.sdev = sdev; - if (sdev) { - rphys = sdev->reg_addrs[0].phys_addr; - all->par.physbase = phys = sdev->reg_addrs[1].phys_addr; - all->par.iospace = sdev->reg_addrs[0].which_io; - - all->par.regs = sbus_ioremap(&sdev->resource[0], 0, - sizeof(struct cg14_regs), - "cg14 regs"); - all->par.clut = sbus_ioremap(&sdev->resource[0], CG14_CLUT1, - sizeof(struct cg14_clut), - "cg14 clut"); - all->par.cursor = sbus_ioremap(&sdev->resource[0], CG14_CURSORREGS, - sizeof(struct cg14_cursor), - "cg14 cursor"); - all->info.screen_base = sbus_ioremap(&sdev->resource[1], 0, - all->par.fbsize, "cg14 ram"); + if (!strcmp(dp->parent->name, "sbus") || + !strcmp(dp->parent->name, "sbi")) { + all->par.physbase = op->resource[0].start; + all->par.iospace = op->resource[0].flags & IORESOURCE_BITS; } else { - rphys = __get_phys(bases[0]); - all->par.physbase = phys = __get_phys(bases[1]); - all->par.iospace = __get_iospace(bases[0]); - all->par.regs = (struct cg14_regs __iomem *)(unsigned long)bases[0]; - all->par.clut = (struct cg14_clut __iomem *)((unsigned long)bases[0] + - CG14_CLUT1); - all->par.cursor = - (struct cg14_cursor __iomem *)((unsigned long)bases[0] + - CG14_CURSORREGS); - - all->info.screen_base = (char __iomem *)(unsigned long)bases[1]; + all->par.physbase = op->resource[1].start; + all->par.iospace = op->resource[0].flags & IORESOURCE_BITS; } - prom_getproperty(node, "reg", (char *) &bases[0], sizeof(bases)); - is_8mb = (bases[5] == 0x800000); + all->par.regs = of_ioremap(&op->resource[0], 0, + sizeof(struct cg14_regs), "cg14 regs"); + all->par.clut = of_ioremap(&op->resource[0], CG14_CLUT1, + sizeof(struct cg14_clut), "cg14 clut"); + all->par.cursor = of_ioremap(&op->resource[0], CG14_CURSORREGS, + sizeof(struct cg14_cursor), "cg14 cursor"); - if (sizeof(all->par.mmap_map) != sizeof(__cg14_mmap_map)) { - extern void __cg14_mmap_sized_wrongly(void); + all->info.screen_base = of_ioremap(&op->resource[1], 0, + all->par.fbsize, "cg14 ram"); - __cg14_mmap_sized_wrongly(); - } + if (!all->par.regs || !all->par.clut || !all->par.cursor || + !all->info.screen_base) + cg14_unmap_regs(all); + + is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) == + (8 * 1024 * 1024)); + + BUILD_BUG_ON(sizeof(all->par.mmap_map) != sizeof(__cg14_mmap_map)); - memcpy(&all->par.mmap_map, &__cg14_mmap_map, sizeof(all->par.mmap_map)); + memcpy(&all->par.mmap_map, &__cg14_mmap_map, + sizeof(all->par.mmap_map)); + for (i = 0; i < CG14_MMAP_ENTRIES; i++) { struct sbus_mmap_map *map = &all->par.mmap_map[i]; if (!map->size) break; if (map->poff & 0x80000000) - map->poff = (map->poff & 0x7fffffff) + rphys - phys; + map->poff = (map->poff & 0x7fffffff) + + (op->resource[0].start - + op->resource[1].start); if (is_8mb && map->size >= 0x100000 && map->size <= 0x400000) @@ -564,84 +541,87 @@ static void cg14_init_one(struct sbus_dev *sdev, int node, int parent_node) __cg14_reset(&all->par); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - printk(KERN_ERR "cg14: Could not allocate color map.\n"); + cg14_unmap_regs(all); kfree(all); - return; + return -ENOMEM; } fb_set_cmap(&all->info.cmap, &all->info); - cg14_init_fix(&all->info, linebytes); + cg14_init_fix(&all->info, linebytes, dp); - if (register_framebuffer(&all->info) < 0) { - printk(KERN_ERR "cg14: Could not register framebuffer.\n"); + err = register_framebuffer(&all->info); + if (err < 0) { fb_dealloc_cmap(&all->info.cmap); + cg14_unmap_regs(all); kfree(all); - return; + return err; } - list_add(&all->list, &cg14_list); + dev_set_drvdata(&op->dev, all); - printk("cg14: cgfourteen at %lx:%lx, %dMB\n", - all->par.iospace, all->par.physbase, all->par.ramsize >> 20); + printk("%s: cgfourteen at %lx:%lx, %dMB\n", + dp->full_name, + all->par.iospace, all->par.physbase, + all->par.ramsize >> 20); + return 0; } -int __init cg14_init(void) +static int __devinit cg14_probe(struct of_device *dev, const struct of_device_id *match) { - struct sbus_bus *sbus; - struct sbus_dev *sdev; + struct of_device *op = to_of_device(&dev->dev); - if (fb_get_options("cg14fb", NULL)) - return -ENODEV; + return cg14_init_one(op); +} -#ifdef CONFIG_SPARC32 - { - int root, node; - - root = prom_getchild(prom_root_node); - root = prom_searchsiblings(root, "obio"); - if (root) { - node = prom_searchsiblings(prom_getchild(root), - "cgfourteen"); - if (node) - cg14_init_one(NULL, node, root); - } - } -#endif - for_all_sbusdev(sdev, sbus) { - if (!strcmp(sdev->prom_name, "cgfourteen")) - cg14_init_one(sdev, sdev->prom_node, sbus->prom_node); - } +static int __devexit cg14_remove(struct of_device *dev) +{ + struct all_info *all = dev_get_drvdata(&dev->dev); + + unregister_framebuffer(&all->info); + fb_dealloc_cmap(&all->info.cmap); + + cg14_unmap_regs(all); + + kfree(all); + + dev_set_drvdata(&dev->dev, NULL); return 0; } -void __exit cg14_exit(void) -{ - struct list_head *pos, *tmp; +static struct of_device_id cg14_match[] = { + { + .name = "cgfourteen", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, cg14_match); - list_for_each_safe(pos, tmp, &cg14_list) { - struct all_info *all = list_entry(pos, typeof(*all), list); +static struct of_platform_driver cg14_driver = { + .name = "cg14", + .match_table = cg14_match, + .probe = cg14_probe, + .remove = __devexit_p(cg14_remove), +}; - unregister_framebuffer(&all->info); - fb_dealloc_cmap(&all->info.cmap); - kfree(all); - } +int __init cg14_init(void) +{ + if (fb_get_options("cg14fb", NULL)) + return -ENODEV; + + return of_register_driver(&cg14_driver, &of_bus_type); } -int __init -cg14_setup(char *arg) +void __exit cg14_exit(void) { - /* No cmdline options yet... */ - return 0; + of_unregister_driver(&cg14_driver); } module_init(cg14_init); - -#ifdef MODULE module_exit(cg14_exit); -#endif MODULE_DESCRIPTION("framebuffer driver for CGfourteen chipsets"); -MODULE_AUTHOR("David S. Miller <davem@redhat.com>"); +MODULE_AUTHOR("David S. Miller <davem@davemloft.net>"); +MODULE_VERSION("2.0"); MODULE_LICENSE("GPL"); diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c index 3de6e1b5ab2..9c8c753ef45 100644 --- a/drivers/video/cg3.c +++ b/drivers/video/cg3.c @@ -1,6 +1,6 @@ /* cg3.c: CGTHREE frame buffer driver * - * Copyright (C) 2003 David S. Miller (davem@redhat.com) + * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net) * Copyright (C) 1996,1998 Jakub Jelinek (jj@ultra.linux.cz) * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) @@ -19,8 +19,9 @@ #include <linux/mm.h> #include <asm/io.h> -#include <asm/sbus.h> #include <asm/oplib.h> +#include <asm/prom.h> +#include <asm/of_device.h> #include <asm/fbio.h> #include "sbuslib.h" @@ -80,30 +81,30 @@ enum cg3_type { }; struct bt_regs { - volatile u32 addr; - volatile u32 color_map; - volatile u32 control; - volatile u32 cursor; + u32 addr; + u32 color_map; + u32 control; + u32 cursor; }; struct cg3_regs { struct bt_regs cmap; - volatile u8 control; - volatile u8 status; - volatile u8 cursor_start; - volatile u8 cursor_end; - volatile u8 h_blank_start; - volatile u8 h_blank_end; - volatile u8 h_sync_start; - volatile u8 h_sync_end; - volatile u8 comp_sync_end; - volatile u8 v_blank_start_high; - volatile u8 v_blank_start_low; - volatile u8 v_blank_end; - volatile u8 v_sync_start; - volatile u8 v_sync_end; - volatile u8 xfer_holdoff_start; - volatile u8 xfer_holdoff_end; + u8 control; + u8 status; + u8 cursor_start; + u8 cursor_end; + u8 h_blank_start; + u8 h_blank_end; + u8 h_sync_start; + u8 h_sync_end; + u8 comp_sync_end; + u8 v_blank_start_high; + u8 v_blank_start_low; + u8 v_blank_end; + u8 v_sync_start; + u8 v_sync_end; + u8 xfer_holdoff_start; + u8 xfer_holdoff_end; }; /* Offset of interesting structures in the OBIO space */ @@ -120,9 +121,8 @@ struct cg3_par { #define CG3_FLAG_RDI 0x00000002 unsigned long physbase; + unsigned long which_io; unsigned long fbsize; - - struct sbus_dev *sdev; }; /** @@ -235,7 +235,7 @@ static int cg3_mmap(struct fb_info *info, struct vm_area_struct *vma) return sbusfb_mmap_helper(cg3_mmap_map, par->physbase, par->fbsize, - par->sdev->reg_addrs[0].which_io, + par->which_io, vma); } @@ -252,11 +252,9 @@ static int cg3_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) */ static void -cg3_init_fix(struct fb_info *info, int linebytes) +cg3_init_fix(struct fb_info *info, int linebytes, struct device_node *dp) { - struct cg3_par *par = (struct cg3_par *)info->par; - - strlcpy(info->fix.id, par->sdev->prom_name, sizeof(info->fix.id)); + strlcpy(info->fix.id, dp->name, sizeof(info->fix.id)); info->fix.type = FB_TYPE_PACKED_PIXELS; info->fix.visual = FB_VISUAL_PSEUDOCOLOR; @@ -267,16 +265,15 @@ cg3_init_fix(struct fb_info *info, int linebytes) } static void cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var, - struct sbus_dev *sdev) + struct device_node *dp) { - char buffer[40]; + char *params; char *p; int ww, hh; - *buffer = 0; - prom_getstring(sdev->prom_node, "params", buffer, sizeof(buffer)); - if (*buffer) { - ww = simple_strtoul(buffer, &p, 10); + params = of_get_property(dp, "params", NULL); + if (params) { + ww = simple_strtoul(params, &p, 10); if (ww && *p == 'x') { hh = simple_strtoul(p + 1, &p, 10); if (hh && *p == '-') { @@ -348,11 +345,11 @@ static void cg3_do_default_mode(struct cg3_par *par) sbus_writeb(p[1], regp); } for (p = cg3_dacvals; *p; p += 2) { - volatile u8 __iomem *regp; + u8 __iomem *regp; - regp = (volatile u8 __iomem *)&par->regs->cmap.addr; + regp = (u8 __iomem *)&par->regs->cmap.addr; sbus_writeb(p[0], regp); - regp = (volatile u8 __iomem *)&par->regs->cmap.control; + regp = (u8 __iomem *)&par->regs->cmap.control; sbus_writeb(p[1], regp); } } @@ -360,129 +357,137 @@ static void cg3_do_default_mode(struct cg3_par *par) struct all_info { struct fb_info info; struct cg3_par par; - struct list_head list; }; -static LIST_HEAD(cg3_list); -static void cg3_init_one(struct sbus_dev *sdev) +static int __devinit cg3_init_one(struct of_device *op) { + struct device_node *dp = op->node; struct all_info *all; - int linebytes; - - all = kmalloc(sizeof(*all), GFP_KERNEL); - if (!all) { - printk(KERN_ERR "cg3: Cannot allocate memory.\n"); - return; - } - memset(all, 0, sizeof(*all)); + int linebytes, err; - INIT_LIST_HEAD(&all->list); + all = kzalloc(sizeof(*all), GFP_KERNEL); + if (!all) + return -ENOMEM; spin_lock_init(&all->par.lock); - all->par.sdev = sdev; - all->par.physbase = sdev->reg_addrs[0].phys_addr; + all->par.physbase = op->resource[0].start; + all->par.which_io = op->resource[0].flags & IORESOURCE_BITS; - sbusfb_fill_var(&all->info.var, sdev->prom_node, 8); + sbusfb_fill_var(&all->info.var, dp->node, 8); all->info.var.red.length = 8; all->info.var.green.length = 8; all->info.var.blue.length = 8; - if (!strcmp(sdev->prom_name, "cgRDI")) + if (!strcmp(dp->name, "cgRDI")) all->par.flags |= CG3_FLAG_RDI; if (all->par.flags & CG3_FLAG_RDI) - cg3_rdi_maybe_fixup_var(&all->info.var, sdev); + cg3_rdi_maybe_fixup_var(&all->info.var, dp); - linebytes = prom_getintdefault(sdev->prom_node, "linebytes", - all->info.var.xres); + linebytes = of_getintprop_default(dp, "linebytes", + all->info.var.xres); all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres); - all->par.regs = sbus_ioremap(&sdev->resource[0], CG3_REGS_OFFSET, - sizeof(struct cg3_regs), "cg3 regs"); + all->par.regs = of_ioremap(&op->resource[0], CG3_REGS_OFFSET, + sizeof(struct cg3_regs), "cg3 regs"); all->info.flags = FBINFO_DEFAULT; all->info.fbops = &cg3_ops; -#ifdef CONFIG_SPARC32 - all->info.screen_base = (char __iomem *) - prom_getintdefault(sdev->prom_node, "address", 0); -#endif - if (!all->info.screen_base) - all->info.screen_base = - sbus_ioremap(&sdev->resource[0], CG3_RAM_OFFSET, - all->par.fbsize, "cg3 ram"); + all->info.screen_base = + of_ioremap(&op->resource[0], CG3_RAM_OFFSET, + all->par.fbsize, "cg3 ram"); all->info.par = &all->par; cg3_blank(0, &all->info); - if (!prom_getbool(sdev->prom_node, "width")) + if (!of_find_property(dp, "width", NULL)) cg3_do_default_mode(&all->par); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - printk(KERN_ERR "cg3: Could not allocate color map.\n"); + of_iounmap(all->par.regs, sizeof(struct cg3_regs)); + of_iounmap(all->info.screen_base, all->par.fbsize); kfree(all); - return; + return -ENOMEM; } fb_set_cmap(&all->info.cmap, &all->info); - cg3_init_fix(&all->info, linebytes); + cg3_init_fix(&all->info, linebytes, dp); - if (register_framebuffer(&all->info) < 0) { - printk(KERN_ERR "cg3: Could not register framebuffer.\n"); + err = register_framebuffer(&all->info); + if (err < 0) { fb_dealloc_cmap(&all->info.cmap); + of_iounmap(all->par.regs, sizeof(struct cg3_regs)); + of_iounmap(all->info.screen_base, all->par.fbsize); kfree(all); - return; + return err; } - list_add(&all->list, &cg3_list); + dev_set_drvdata(&op->dev, all); + + printk("%s: cg3 at %lx:%lx\n", + dp->full_name, all->par.which_io, all->par.physbase); - printk("cg3: %s at %lx:%lx\n", - sdev->prom_name, - (long) sdev->reg_addrs[0].which_io, - (long) sdev->reg_addrs[0].phys_addr); + return 0; } -int __init cg3_init(void) +static int __devinit cg3_probe(struct of_device *dev, const struct of_device_id *match) { - struct sbus_bus *sbus; - struct sbus_dev *sdev; + struct of_device *op = to_of_device(&dev->dev); - if (fb_get_options("cg3fb", NULL)) - return -ENODEV; + return cg3_init_one(op); +} - for_all_sbusdev(sdev, sbus) { - if (!strcmp(sdev->prom_name, "cgthree") || - !strcmp(sdev->prom_name, "cgRDI")) - cg3_init_one(sdev); - } +static int __devexit cg3_remove(struct of_device *dev) +{ + struct all_info *all = dev_get_drvdata(&dev->dev); + + unregister_framebuffer(&all->info); + fb_dealloc_cmap(&all->info.cmap); + + of_iounmap(all->par.regs, sizeof(struct cg3_regs)); + of_iounmap(all->info.screen_base, all->par.fbsize); + + kfree(all); + + dev_set_drvdata(&dev->dev, NULL); return 0; } -void __exit cg3_exit(void) -{ - struct list_head *pos, *tmp; +static struct of_device_id cg3_match[] = { + { + .name = "cgthree", + }, + { + .name = "cgRDI", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, cg3_match); - list_for_each_safe(pos, tmp, &cg3_list) { - struct all_info *all = list_entry(pos, typeof(*all), list); +static struct of_platform_driver cg3_driver = { + .name = "cg3", + .match_table = cg3_match, + .probe = cg3_probe, + .remove = __devexit_p(cg3_remove), +}; - unregister_framebuffer(&all->info); - fb_dealloc_cmap(&all->info.cmap); - kfree(all); - } +static int __init cg3_init(void) +{ + if (fb_get_options("cg3fb", NULL)) + return -ENODEV; + + return of_register_driver(&cg3_driver, &of_bus_type); } -int __init -cg3_setup(char *arg) +static void __exit cg3_exit(void) { - /* No cmdline options yet... */ - return 0; + of_unregister_driver(&cg3_driver); } module_init(cg3_init); - -#ifdef MODULE module_exit(cg3_exit); -#endif MODULE_DESCRIPTION("framebuffer driver for CGthree chipsets"); -MODULE_AUTHOR("David S. Miller <davem@redhat.com>"); +MODULE_AUTHOR("David S. Miller <davem@davemloft.net>"); +MODULE_VERSION("2.0"); MODULE_LICENSE("GPL"); diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c index 7aab91ead68..64146be2eeb 100644 --- a/drivers/video/cg6.c +++ b/drivers/video/cg6.c @@ -1,6 +1,6 @@ /* cg6.c: CGSIX (GX, GXplus, TGX) frame buffer driver * - * Copyright (C) 2003 David S. Miller (davem@redhat.com) + * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net) * Copyright (C) 1996,1998 Jakub Jelinek (jj@ultra.linux.cz) * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) @@ -19,8 +19,8 @@ #include <linux/mm.h> #include <asm/io.h> -#include <asm/sbus.h> -#include <asm/oplib.h> +#include <asm/prom.h> +#include <asm/of_device.h> #include <asm/fbio.h> #include "sbuslib.h" @@ -164,89 +164,89 @@ static struct fb_ops cg6_ops = { /* The contents are unknown */ struct cg6_tec { - volatile int tec_matrix; - volatile int tec_clip; - volatile int tec_vdc; + int tec_matrix; + int tec_clip; + int tec_vdc; }; struct cg6_thc { - uint thc_pad0[512]; - volatile uint thc_hs; /* hsync timing */ - volatile uint thc_hsdvs; - volatile uint thc_hd; - volatile uint thc_vs; /* vsync timing */ - volatile uint thc_vd; - volatile uint thc_refresh; - volatile uint thc_misc; - uint thc_pad1[56]; - volatile uint thc_cursxy; /* cursor x,y position (16 bits each) */ - volatile uint thc_cursmask[32]; /* cursor mask bits */ - volatile uint thc_cursbits[32]; /* what to show where mask enabled */ + u32 thc_pad0[512]; + u32 thc_hs; /* hsync timing */ + u32 thc_hsdvs; + u32 thc_hd; + u32 thc_vs; /* vsync timing */ + u32 thc_vd; + u32 thc_refresh; + u32 thc_misc; + u32 thc_pad1[56]; + u32 thc_cursxy; /* cursor x,y position (16 bits each) */ + u32 thc_cursmask[32]; /* cursor mask bits */ + u32 thc_cursbits[32]; /* what to show where mask enabled */ }; struct cg6_fbc { - u32 xxx0[1]; - volatile u32 mode; - volatile u32 clip; - u32 xxx1[1]; - volatile u32 s; - volatile u32 draw; - volatile u32 blit; - volatile u32 font; - u32 xxx2[24]; - volatile u32 x0, y0, z0, color0; - volatile u32 x1, y1, z1, color1; - volatile u32 x2, y2, z2, color2; - volatile u32 x3, y3, z3, color3; - volatile u32 offx, offy; - u32 xxx3[2]; - volatile u32 incx, incy; - u32 xxx4[2]; - volatile u32 clipminx, clipminy; - u32 xxx5[2]; - volatile u32 clipmaxx, clipmaxy; - u32 xxx6[2]; - volatile u32 fg; - volatile u32 bg; - volatile u32 alu; - volatile u32 pm; - volatile u32 pixelm; - u32 xxx7[2]; - volatile u32 patalign; - volatile u32 pattern[8]; - u32 xxx8[432]; - volatile u32 apointx, apointy, apointz; - u32 xxx9[1]; - volatile u32 rpointx, rpointy, rpointz; - u32 xxx10[5]; - volatile u32 pointr, pointg, pointb, pointa; - volatile u32 alinex, aliney, alinez; - u32 xxx11[1]; - volatile u32 rlinex, rliney, rlinez; - u32 xxx12[5]; - volatile u32 liner, lineg, lineb, linea; - volatile u32 atrix, atriy, atriz; - u32 xxx13[1]; - volatile u32 rtrix, rtriy, rtriz; - u32 xxx14[5]; - volatile u32 trir, trig, trib, tria; - volatile u32 aquadx, aquady, aquadz; - u32 xxx15[1]; - volatile u32 rquadx, rquady, rquadz; - u32 xxx16[5]; - volatile u32 quadr, quadg, quadb, quada; - volatile u32 arectx, arecty, arectz; - u32 xxx17[1]; - volatile u32 rrectx, rrecty, rrectz; - u32 xxx18[5]; - volatile u32 rectr, rectg, rectb, recta; + u32 xxx0[1]; + u32 mode; + u32 clip; + u32 xxx1[1]; + u32 s; + u32 draw; + u32 blit; + u32 font; + u32 xxx2[24]; + u32 x0, y0, z0, color0; + u32 x1, y1, z1, color1; + u32 x2, y2, z2, color2; + u32 x3, y3, z3, color3; + u32 offx, offy; + u32 xxx3[2]; + u32 incx, incy; + u32 xxx4[2]; + u32 clipminx, clipminy; + u32 xxx5[2]; + u32 clipmaxx, clipmaxy; + u32 xxx6[2]; + u32 fg; + u32 bg; + u32 alu; + u32 pm; + u32 pixelm; + u32 xxx7[2]; + u32 patalign; + u32 pattern[8]; + u32 xxx8[432]; + u32 apointx, apointy, apointz; + u32 xxx9[1]; + u32 rpointx, rpointy, rpointz; + u32 xxx10[5]; + u32 pointr, pointg, pointb, pointa; + u32 alinex, aliney, alinez; + u32 xxx11[1]; + u32 rlinex, rliney, rlinez; + u32 xxx12[5]; + u32 liner, lineg, lineb, linea; + u32 atrix, atriy, atriz; + u32 xxx13[1]; + u32 rtrix, rtriy, rtriz; + u32 xxx14[5]; + u32 trir, trig, trib, tria; + u32 aquadx, aquady, aquadz; + u32 xxx15[1]; + u32 rquadx, rquady, rquadz; + u32 xxx16[5]; + u32 quadr, quadg, quadb, quada; + u32 arectx, arecty, arectz; + u32 xxx17[1]; + u32 rrectx, rrecty, rrectz; + u32 xxx18[5]; + u32 rectr, rectg, rectb, recta; }; struct bt_regs { - volatile u32 addr; - volatile u32 color_map; - volatile u32 control; - volatile u32 cursor; + u32 addr; + u32 color_map; + u32 control; + u32 cursor; }; struct cg6_par { @@ -255,15 +255,14 @@ struct cg6_par { struct cg6_fbc __iomem *fbc; struct cg6_thc __iomem *thc; struct cg6_tec __iomem *tec; - volatile u32 __iomem *fhc; + u32 __iomem *fhc; u32 flags; #define CG6_FLAG_BLANKED 0x00000001 unsigned long physbase; + unsigned long which_io; unsigned long fbsize; - - struct sbus_dev *sdev; }; static int cg6_sync(struct fb_info *info) @@ -529,8 +528,7 @@ static int cg6_mmap(struct fb_info *info, struct vm_area_struct *vma) return sbusfb_mmap_helper(cg6_mmap_map, par->physbase, par->fbsize, - par->sdev->reg_addrs[0].which_io, - vma); + par->which_io, vma); } static int cg6_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) @@ -658,62 +656,75 @@ static void cg6_chip_init(struct fb_info *info) struct all_info { struct fb_info info; struct cg6_par par; - struct list_head list; }; -static LIST_HEAD(cg6_list); -static void cg6_init_one(struct sbus_dev *sdev) +static void cg6_unmap_regs(struct all_info *all) { - struct all_info *all; - int linebytes; + if (all->par.fbc) + of_iounmap(all->par.fbc, 4096); + if (all->par.tec) + of_iounmap(all->par.tec, sizeof(struct cg6_tec)); + if (all->par.thc) + of_iounmap(all->par.thc, sizeof(struct cg6_thc)); + if (all->par.bt) + of_iounmap(all->par.bt, sizeof(struct bt_regs)); + if (all->par.fhc) + of_iounmap(all->par.fhc, sizeof(u32)); + + if (all->info.screen_base) + of_iounmap(all->info.screen_base, all->par.fbsize); +} - all = kmalloc(sizeof(*all), GFP_KERNEL); - if (!all) { - printk(KERN_ERR "cg6: Cannot allocate memory.\n"); - return; - } - memset(all, 0, sizeof(*all)); +static int __devinit cg6_init_one(struct of_device *op) +{ + struct device_node *dp = op->node; + struct all_info *all; + int linebytes, err; - INIT_LIST_HEAD(&all->list); + all = kzalloc(sizeof(*all), GFP_KERNEL); + if (!all) + return -ENOMEM; spin_lock_init(&all->par.lock); - all->par.sdev = sdev; - all->par.physbase = sdev->reg_addrs[0].phys_addr; + all->par.physbase = op->resource[0].start; + all->par.which_io = op->resource[0].flags & IORESOURCE_BITS; - sbusfb_fill_var(&all->info.var, sdev->prom_node, 8); + sbusfb_fill_var(&all->info.var, dp->node, 8); all->info.var.red.length = 8; all->info.var.green.length = 8; all->info.var.blue.length = 8; - linebytes = prom_getintdefault(sdev->prom_node, "linebytes", - all->info.var.xres); + linebytes = of_getintprop_default(dp, "linebytes", + all->info.var.xres); all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres); - if (prom_getbool(sdev->prom_node, "dblbuf")) + if (of_find_property(dp, "dblbuf", NULL)) all->par.fbsize *= 4; - all->par.fbc = sbus_ioremap(&sdev->resource[0], CG6_FBC_OFFSET, - 4096, "cgsix fbc"); - all->par.tec = sbus_ioremap(&sdev->resource[0], CG6_TEC_OFFSET, - sizeof(struct cg6_tec), "cgsix tec"); - all->par.thc = sbus_ioremap(&sdev->resource[0], CG6_THC_OFFSET, - sizeof(struct cg6_thc), "cgsix thc"); - all->par.bt = sbus_ioremap(&sdev->resource[0], CG6_BROOKTREE_OFFSET, - sizeof(struct bt_regs), "cgsix dac"); - all->par.fhc = sbus_ioremap(&sdev->resource[0], CG6_FHC_OFFSET, - sizeof(u32), "cgsix fhc"); + all->par.fbc = of_ioremap(&op->resource[0], CG6_FBC_OFFSET, + 4096, "cgsix fbc"); + all->par.tec = of_ioremap(&op->resource[0], CG6_TEC_OFFSET, + sizeof(struct cg6_tec), "cgsix tec"); + all->par.thc = of_ioremap(&op->resource[0], CG6_THC_OFFSET, + sizeof(struct cg6_thc), "cgsix thc"); + all->par.bt = of_ioremap(&op->resource[0], CG6_BROOKTREE_OFFSET, + sizeof(struct bt_regs), "cgsix dac"); + all->par.fhc = of_ioremap(&op->resource[0], CG6_FHC_OFFSET, + sizeof(u32), "cgsix fhc"); all->info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_IMAGEBLIT | FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT; all->info.fbops = &cg6_ops; -#ifdef CONFIG_SPARC32 - all->info.screen_base = (char __iomem *) - prom_getintdefault(sdev->prom_node, "address", 0); -#endif - if (!all->info.screen_base) - all->info.screen_base = - sbus_ioremap(&sdev->resource[0], CG6_RAM_OFFSET, - all->par.fbsize, "cgsix ram"); + + all->info.screen_base = of_ioremap(&op->resource[0], CG6_RAM_OFFSET, + all->par.fbsize, "cgsix ram"); + if (!all->par.fbc || !all->par.tec || !all->par.thc || + !all->par.bt || !all->par.fhc || !all->info.screen_base) { + cg6_unmap_regs(all); + kfree(all); + return -ENOMEM; + } + all->info.par = &all->par; all->info.var.accel_flags = FB_ACCELF_TEXT; @@ -723,72 +734,90 @@ static void cg6_init_one(struct sbus_dev *sdev) cg6_blank(0, &all->info); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - printk(KERN_ERR "cg6: Could not allocate color map.\n"); + cg6_unmap_regs(all); kfree(all); - return; + return -ENOMEM; } fb_set_cmap(&all->info.cmap, &all->info); cg6_init_fix(&all->info, linebytes); - if (register_framebuffer(&all->info) < 0) { - printk(KERN_ERR "cg6: Could not register framebuffer.\n"); + err = register_framebuffer(&all->info); + if (err < 0) { + cg6_unmap_regs(all); fb_dealloc_cmap(&all->info.cmap); kfree(all); - return; + return err; } - list_add(&all->list, &cg6_list); + dev_set_drvdata(&op->dev, all); - printk("cg6: CGsix [%s] at %lx:%lx\n", + printk("%s: CGsix [%s] at %lx:%lx\n", + dp->full_name, all->info.fix.id, - (long) sdev->reg_addrs[0].which_io, - (long) sdev->reg_addrs[0].phys_addr); + all->par.which_io, all->par.physbase); + + return 0; } -int __init cg6_init(void) +static int __devinit cg6_probe(struct of_device *dev, const struct of_device_id *match) { - struct sbus_bus *sbus; - struct sbus_dev *sdev; + struct of_device *op = to_of_device(&dev->dev); - if (fb_get_options("cg6fb", NULL)) - return -ENODEV; + return cg6_init_one(op); +} - for_all_sbusdev(sdev, sbus) { - if (!strcmp(sdev->prom_name, "cgsix") || - !strcmp(sdev->prom_name, "cgthree+")) - cg6_init_one(sdev); - } +static int __devexit cg6_remove(struct of_device *dev) +{ + struct all_info *all = dev_get_drvdata(&dev->dev); + + unregister_framebuffer(&all->info); + fb_dealloc_cmap(&all->info.cmap); + + cg6_unmap_regs(all); + + kfree(all); + + dev_set_drvdata(&dev->dev, NULL); return 0; } -void __exit cg6_exit(void) -{ - struct list_head *pos, *tmp; +static struct of_device_id cg6_match[] = { + { + .name = "cgsix", + }, + { + .name = "cgthree+", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, cg6_match); - list_for_each_safe(pos, tmp, &cg6_list) { - struct all_info *all = list_entry(pos, typeof(*all), list); +static struct of_platform_driver cg6_driver = { + .name = "cg6", + .match_table = cg6_match, + .probe = cg6_probe, + .remove = __devexit_p(cg6_remove), +}; - unregister_framebuffer(&all->info); - fb_dealloc_cmap(&all->info.cmap); - kfree(all); - } +static int __init cg6_init(void) +{ + if (fb_get_options("cg6fb", NULL)) + return -ENODEV; + + return of_register_driver(&cg6_driver, &of_bus_type); } -int __init -cg6_setup(char *arg) +static void __exit cg6_exit(void) { - /* No cmdline options yet... */ - return 0; + of_unregister_driver(&cg6_driver); } module_init(cg6_init); - -#ifdef MODULE module_exit(cg6_exit); -#endif MODULE_DESCRIPTION("framebuffer driver for CGsix chipsets"); -MODULE_AUTHOR("David S. Miller <davem@redhat.com>"); +MODULE_AUTHOR("David S. Miller <davem@davemloft.net>"); +MODULE_VERSION("2.0"); MODULE_LICENSE("GPL"); diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c index d76bbfac92c..0e465c80ef2 100644 --- a/drivers/video/chipsfb.c +++ b/drivers/video/chipsfb.c @@ -14,7 +14,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index dda240eb736..7355da09c72 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c @@ -36,7 +36,6 @@ #define CIRRUSFB_VERSION "2.0-pre2" -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c index eea422eb1ab..308850df16f 100644 --- a/drivers/video/console/bitblit.c +++ b/drivers/video/console/bitblit.c @@ -10,7 +10,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/string.h> #include <linux/fb.h> diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c index 1ecda91e5a9..878707a0439 100644 --- a/drivers/video/console/dummycon.c +++ b/drivers/video/console/dummycon.c @@ -22,7 +22,6 @@ #define DUMMY_ROWS ORIG_VIDEO_LINES #elif defined(__hppa__) /* set by Kconfig. Use 80x25 for 640x480 and 160x64 for 1280x1024 */ -#include <linux/config.h> #define DUMMY_COLUMNS CONFIG_DUMMY_CONSOLE_COLUMNS #define DUMMY_ROWS CONFIG_DUMMY_CONSOLE_ROWS #else diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 5dc4083552d..94e9f7069be 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c @@ -58,7 +58,6 @@ #undef FBCONDEBUG -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/sched.h> diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h index 3487a636370..f244ad066d6 100644 --- a/drivers/video/console/fbcon.h +++ b/drivers/video/console/fbcon.h @@ -11,7 +11,6 @@ #ifndef _VIDEO_FBCON_H #define _VIDEO_FBCON_H -#include <linux/config.h> #include <linux/types.h> #include <linux/vt_buffer.h> #include <linux/vt_kern.h> diff --git a/drivers/video/console/fbcon_ccw.c b/drivers/video/console/fbcon_ccw.c index 990289a69b7..4481c80b8b2 100644 --- a/drivers/video/console/fbcon_ccw.c +++ b/drivers/video/console/fbcon_ccw.c @@ -8,7 +8,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/string.h> #include <linux/fb.h> diff --git a/drivers/video/console/fbcon_cw.c b/drivers/video/console/fbcon_cw.c index d44c5fa515f..7f92c06afea 100644 --- a/drivers/video/console/fbcon_cw.c +++ b/drivers/video/console/fbcon_cw.c @@ -8,7 +8,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/string.h> #include <linux/fb.h> diff --git a/drivers/video/console/fbcon_rotate.c b/drivers/video/console/fbcon_rotate.c index 2dc091fbd5c..00884e013f0 100644 --- a/drivers/video/console/fbcon_rotate.c +++ b/drivers/video/console/fbcon_rotate.c @@ -8,7 +8,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/string.h> #include <linux/fb.h> diff --git a/drivers/video/console/fbcon_ud.c b/drivers/video/console/fbcon_ud.c index f56ed068a5b..ab91005e64d 100644 --- a/drivers/video/console/fbcon_ud.c +++ b/drivers/video/console/fbcon_ud.c @@ -8,7 +8,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/string.h> #include <linux/fb.h> diff --git a/drivers/video/console/font_acorn_8x8.c b/drivers/video/console/font_acorn_8x8.c index 2d2e39632e2..40f3d4eeb19 100644 --- a/drivers/video/console/font_acorn_8x8.c +++ b/drivers/video/console/font_acorn_8x8.c @@ -1,6 +1,5 @@ /* Acorn-like font definition, with PC graphics characters */ -#include <linux/config.h> #include <linux/font.h> static const unsigned char acorndata_8x8[] = { diff --git a/drivers/video/console/fonts.c b/drivers/video/console/fonts.c index 0cc1bfda76a..c960728b7e8 100644 --- a/drivers/video/console/fonts.c +++ b/drivers/video/console/fonts.c @@ -12,7 +12,6 @@ * for more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/string.h> diff --git a/drivers/video/console/promcon.c b/drivers/video/console/promcon.c index d6e6ad537f9..5cd5e114d1e 100644 --- a/drivers/video/console/promcon.c +++ b/drivers/video/console/promcon.c @@ -5,7 +5,6 @@ * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c index 74ac2acaf72..88e7038eab8 100644 --- a/drivers/video/console/sticore.c +++ b/drivers/video/console/sticore.c @@ -13,7 +13,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/video/console/tileblit.c b/drivers/video/console/tileblit.c index 153352ca946..d981fe4d86c 100644 --- a/drivers/video/console/tileblit.c +++ b/drivers/video/console/tileblit.c @@ -8,7 +8,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/string.h> #include <linux/fb.h> diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index f32b590730f..05735ff4e9c 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -33,7 +33,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/sched.h> @@ -390,7 +389,7 @@ static const char *vgacon_startup(void) vga_video_port_val = VGA_CRT_DM; if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) { static struct resource ega_console_resource = - { "ega", 0x3B0, 0x3BF }; + { .name = "ega", .start = 0x3B0, .end = 0x3BF }; vga_video_type = VIDEO_TYPE_EGAM; vga_vram_size = 0x8000; display_desc = "EGA+"; @@ -398,9 +397,9 @@ static const char *vgacon_startup(void) &ega_console_resource); } else { static struct resource mda1_console_resource = - { "mda", 0x3B0, 0x3BB }; + { .name = "mda", .start = 0x3B0, .end = 0x3BB }; static struct resource mda2_console_resource = - { "mda", 0x3BF, 0x3BF }; + { .name = "mda", .start = 0x3BF, .end = 0x3BF }; vga_video_type = VIDEO_TYPE_MDA; vga_vram_size = 0x2000; display_desc = "*MDA"; @@ -423,14 +422,14 @@ static const char *vgacon_startup(void) if (!ORIG_VIDEO_ISVGA) { static struct resource ega_console_resource - = { "ega", 0x3C0, 0x3DF }; + = { .name = "ega", .start = 0x3C0, .end = 0x3DF }; vga_video_type = VIDEO_TYPE_EGAC; display_desc = "EGA"; request_resource(&ioport_resource, &ega_console_resource); } else { static struct resource vga_console_resource - = { "vga+", 0x3C0, 0x3DF }; + = { .name = "vga+", .start = 0x3C0, .end = 0x3DF }; vga_video_type = VIDEO_TYPE_VGAC; display_desc = "VGA+"; request_resource(&ioport_resource, @@ -474,7 +473,7 @@ static const char *vgacon_startup(void) } } else { static struct resource cga_console_resource = - { "cga", 0x3D4, 0x3D5 }; + { .name = "cga", .start = 0x3D4, .end = 0x3D5 }; vga_video_type = VIDEO_TYPE_CGA; vga_vram_size = 0x2000; display_desc = "*CGA"; diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c index 655301a8671..acdd6a103db 100644 --- a/drivers/video/controlfb.c +++ b/drivers/video/controlfb.c @@ -31,7 +31,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c index 55a3514157e..2e2924957d8 100644 --- a/drivers/video/cyber2000fb.c +++ b/drivers/video/cyber2000fb.c @@ -36,7 +36,6 @@ * (which, incidentally, is about the same saving as a 2.5in hard disk * entering standby mode.) */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/cyber2000fb.h b/drivers/video/cyber2000fb.h index bd7e1c04078..de4fc43e51c 100644 --- a/drivers/video/cyber2000fb.h +++ b/drivers/video/cyber2000fb.h @@ -9,7 +9,6 @@ * * Integraphics Cyber2000 frame buffer device */ -#include <linux/config.h> /* * Internal CyberPro sizes and offsets. diff --git a/drivers/video/cyblafb.c b/drivers/video/cyblafb.c index 0ae0a97b0fe..94a66c2d2cf 100644 --- a/drivers/video/cyblafb.c +++ b/drivers/video/cyblafb.c @@ -14,7 +14,6 @@ #define CYBLAFB_PIXMAPSIZE 8192 -#include <linux/config.h> #include <linux/module.h> #include <linux/string.h> #include <linux/fb.h> diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 31143afe7c9..33034f81114 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -11,7 +11,6 @@ * for more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/compat.h> @@ -32,7 +31,6 @@ #ifdef CONFIG_KMOD #include <linux/kmod.h> #endif -#include <linux/devfs_fs_kernel.h> #include <linux/err.h> #include <linux/device.h> #include <linux/efi.h> @@ -1331,8 +1329,6 @@ register_framebuffer(struct fb_info *fb_info) fb_add_videomode(&mode, &fb_info->modelist); registered_fb[i] = fb_info; - devfs_mk_cdev(MKDEV(FB_MAJOR, i), - S_IFCHR | S_IRUGO | S_IWUGO, "fb/%d", i); event.info = fb_info; blocking_notifier_call_chain(&fb_notifier_list, FB_EVENT_FB_REGISTERED, &event); @@ -1359,7 +1355,6 @@ unregister_framebuffer(struct fb_info *fb_info) i = fb_info->node; if (!registered_fb[i]) return -EINVAL; - devfs_remove("fb/%d", i); if (fb_info->pixmap.addr && (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) @@ -1432,7 +1427,6 @@ fbmem_init(void) { create_proc_read_entry("fb", 0, NULL, fbmem_read_proc, NULL); - devfs_mk_dir("fb"); if (register_chrdev(FB_MAJOR,"fb",&fb_fops)) printk("unable to get major %d for fb devs\n", FB_MAJOR); diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c index 7633e41adda..2a0e8210d39 100644 --- a/drivers/video/ffb.c +++ b/drivers/video/ffb.c @@ -1,6 +1,6 @@ /* ffb.c: Creator/Elite3D frame buffer driver * - * Copyright (C) 2003 David S. Miller (davem@redhat.com) + * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net) * Copyright (C) 1997,1998,1999 Jakub Jelinek (jj@ultra.linux.cz) * * Driver layout based loosely on tgafb.c, see that file for credits. @@ -19,7 +19,8 @@ #include <asm/io.h> #include <asm/upa.h> -#include <asm/oplib.h> +#include <asm/prom.h> +#include <asm/of_device.h> #include <asm/fbio.h> #include "sbuslib.h" @@ -184,161 +185,161 @@ static struct fb_ops ffb_ops = { struct ffb_fbc { /* Next vertex registers */ - u32 xxx1[3]; - volatile u32 alpha; - volatile u32 red; - volatile u32 green; - volatile u32 blue; - volatile u32 depth; - volatile u32 y; - volatile u32 x; - u32 xxx2[2]; - volatile u32 ryf; - volatile u32 rxf; - u32 xxx3[2]; + u32 xxx1[3]; + u32 alpha; + u32 red; + u32 green; + u32 blue; + u32 depth; + u32 y; + u32 x; + u32 xxx2[2]; + u32 ryf; + u32 rxf; + u32 xxx3[2]; - volatile u32 dmyf; - volatile u32 dmxf; - u32 xxx4[2]; - volatile u32 ebyi; - volatile u32 ebxi; - u32 xxx5[2]; - volatile u32 by; - volatile u32 bx; - u32 dy; - u32 dx; - volatile u32 bh; - volatile u32 bw; - u32 xxx6[2]; + u32 dmyf; + u32 dmxf; + u32 xxx4[2]; + u32 ebyi; + u32 ebxi; + u32 xxx5[2]; + u32 by; + u32 bx; + u32 dy; + u32 dx; + u32 bh; + u32 bw; + u32 xxx6[2]; - u32 xxx7[32]; + u32 xxx7[32]; /* Setup unit vertex state register */ - volatile u32 suvtx; - u32 xxx8[63]; + u32 suvtx; + u32 xxx8[63]; /* Control registers */ - volatile u32 ppc; - volatile u32 wid; - volatile u32 fg; - volatile u32 bg; - volatile u32 consty; - volatile u32 constz; - volatile u32 xclip; - volatile u32 dcss; - volatile u32 vclipmin; - volatile u32 vclipmax; - volatile u32 vclipzmin; - volatile u32 vclipzmax; - volatile u32 dcsf; - volatile u32 dcsb; - volatile u32 dczf; - volatile u32 dczb; + u32 ppc; + u32 wid; + u32 fg; + u32 bg; + u32 consty; + u32 constz; + u32 xclip; + u32 dcss; + u32 vclipmin; + u32 vclipmax; + u32 vclipzmin; + u32 vclipzmax; + u32 dcsf; + u32 dcsb; + u32 dczf; + u32 dczb; - u32 xxx9; - volatile u32 blendc; - volatile u32 blendc1; - volatile u32 blendc2; - volatile u32 fbramitc; - volatile u32 fbc; - volatile u32 rop; - volatile u32 cmp; - volatile u32 matchab; - volatile u32 matchc; - volatile u32 magnab; - volatile u32 magnc; - volatile u32 fbcfg0; - volatile u32 fbcfg1; - volatile u32 fbcfg2; - volatile u32 fbcfg3; + u32 xxx9; + u32 blendc; + u32 blendc1; + u32 blendc2; + u32 fbramitc; + u32 fbc; + u32 rop; + u32 cmp; + u32 matchab; + u32 matchc; + u32 magnab; + u32 magnc; + u32 fbcfg0; + u32 fbcfg1; + u32 fbcfg2; + u32 fbcfg3; - u32 ppcfg; - volatile u32 pick; - volatile u32 fillmode; - volatile u32 fbramwac; - volatile u32 pmask; - volatile u32 xpmask; - volatile u32 ypmask; - volatile u32 zpmask; - volatile u32 clip0min; - volatile u32 clip0max; - volatile u32 clip1min; - volatile u32 clip1max; - volatile u32 clip2min; - volatile u32 clip2max; - volatile u32 clip3min; - volatile u32 clip3max; + u32 ppcfg; + u32 pick; + u32 fillmode; + u32 fbramwac; + u32 pmask; + u32 xpmask; + u32 ypmask; + u32 zpmask; + u32 clip0min; + u32 clip0max; + u32 clip1min; + u32 clip1max; + u32 clip2min; + u32 clip2max; + u32 clip3min; + u32 clip3max; /* New 3dRAM III support regs */ - volatile u32 rawblend2; - volatile u32 rawpreblend; - volatile u32 rawstencil; - volatile u32 rawstencilctl; - volatile u32 threedram1; - volatile u32 threedram2; - volatile u32 passin; - volatile u32 rawclrdepth; - volatile u32 rawpmask; - volatile u32 rawcsrc; - volatile u32 rawmatch; - volatile u32 rawmagn; - volatile u32 rawropblend; - volatile u32 rawcmp; - volatile u32 rawwac; - volatile u32 fbramid; + u32 rawblend2; + u32 rawpreblend; + u32 rawstencil; + u32 rawstencilctl; + u32 threedram1; + u32 threedram2; + u32 passin; + u32 rawclrdepth; + u32 rawpmask; + u32 rawcsrc; + u32 rawmatch; + u32 rawmagn; + u32 rawropblend; + u32 rawcmp; + u32 rawwac; + u32 fbramid; - volatile u32 drawop; - u32 xxx10[2]; - volatile u32 fontlpat; - u32 xxx11; - volatile u32 fontxy; - volatile u32 fontw; - volatile u32 fontinc; - volatile u32 font; - u32 xxx12[3]; - volatile u32 blend2; - volatile u32 preblend; - volatile u32 stencil; - volatile u32 stencilctl; - - u32 xxx13[4]; - volatile u32 dcss1; - volatile u32 dcss2; - volatile u32 dcss3; - volatile u32 widpmask; - volatile u32 dcs2; - volatile u32 dcs3; - volatile u32 dcs4; - u32 xxx14; - volatile u32 dcd2; - volatile u32 dcd3; - volatile u32 dcd4; - u32 xxx15; + u32 drawop; + u32 xxx10[2]; + u32 fontlpat; + u32 xxx11; + u32 fontxy; + u32 fontw; + u32 fontinc; + u32 font; + u32 xxx12[3]; + u32 blend2; + u32 preblend; + u32 stencil; + u32 stencilctl; + + u32 xxx13[4]; + u32 dcss1; + u32 dcss2; + u32 dcss3; + u32 widpmask; + u32 dcs2; + u32 dcs3; + u32 dcs4; + u32 xxx14; + u32 dcd2; + u32 dcd3; + u32 dcd4; + u32 xxx15; - volatile u32 pattern[32]; + u32 pattern[32]; - u32 xxx16[256]; + u32 xxx16[256]; - volatile u32 devid; - u32 xxx17[63]; + u32 devid; + u32 xxx17[63]; - volatile u32 ucsr; - u32 xxx18[31]; + u32 ucsr; + u32 xxx18[31]; - volatile u32 mer; + u32 mer; }; struct ffb_dac { - volatile u32 type; - volatile u32 value; - volatile u32 type2; - volatile u32 value2; + u32 type; + u32 value; + u32 type2; + u32 value2; }; struct ffb_par { spinlock_t lock; - struct ffb_fbc *fbc; - struct ffb_dac *dac; + struct ffb_fbc __iomem *fbc; + struct ffb_dac __iomem *dac; u32 flags; #define FFB_FLAG_AFB 0x00000001 @@ -353,16 +354,13 @@ struct ffb_par { unsigned long physbase; unsigned long fbsize; - char name[64]; - int prom_node; - int prom_parent_node; int dac_rev; int board_type; }; static void FFBFifo(struct ffb_par *par, int n) { - struct ffb_fbc *fbc; + struct ffb_fbc __iomem *fbc; int cache = par->fifo_cache; if (cache - n < 0) { @@ -375,7 +373,7 @@ static void FFBFifo(struct ffb_par *par, int n) static void FFBWait(struct ffb_par *par) { - struct ffb_fbc *fbc; + struct ffb_fbc __iomem *fbc; int limit = 10000; fbc = par->fbc; @@ -408,8 +406,8 @@ static __inline__ void ffb_rop(struct ffb_par *par, u32 rop) static void ffb_switch_from_graph(struct ffb_par *par) { - struct ffb_fbc *fbc = par->fbc; - struct ffb_dac *dac = par->dac; + struct ffb_fbc __iomem *fbc = par->fbc; + struct ffb_dac __iomem *dac = par->dac; unsigned long flags; spin_lock_irqsave(&par->lock, flags); @@ -462,7 +460,7 @@ static int ffb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) static void ffb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) { struct ffb_par *par = (struct ffb_par *) info->par; - struct ffb_fbc *fbc = par->fbc; + struct ffb_fbc __iomem *fbc = par->fbc; unsigned long flags; u32 fg; @@ -505,7 +503,7 @@ static void ffb_copyarea(struct fb_info *info, const struct fb_copyarea *area) { struct ffb_par *par = (struct ffb_par *) info->par; - struct ffb_fbc *fbc = par->fbc; + struct ffb_fbc __iomem *fbc = par->fbc; unsigned long flags; if (area->dx != area->sx || @@ -541,7 +539,7 @@ ffb_copyarea(struct fb_info *info, const struct fb_copyarea *area) static void ffb_imageblit(struct fb_info *info, const struct fb_image *image) { struct ffb_par *par = (struct ffb_par *) info->par; - struct ffb_fbc *fbc = par->fbc; + struct ffb_fbc __iomem *fbc = par->fbc; const u8 *data = image->data; unsigned long flags; u32 fg, bg, xy; @@ -664,7 +662,7 @@ static int ffb_blank(int blank, struct fb_info *info) { struct ffb_par *par = (struct ffb_par *) info->par; - struct ffb_dac *dac = par->dac; + struct ffb_dac __iomem *dac = par->dac; unsigned long flags; u32 tmp; @@ -883,78 +881,42 @@ ffb_init_fix(struct fb_info *info) info->fix.accel = FB_ACCEL_SUN_CREATOR; } -static int ffb_apply_upa_parent_ranges(int parent, - struct linux_prom64_registers *regs) -{ - struct linux_prom64_ranges ranges[PROMREG_MAX]; - char name[128]; - int len, i; - - prom_getproperty(parent, "name", name, sizeof(name)); - if (strcmp(name, "upa") != 0) - return 0; - - len = prom_getproperty(parent, "ranges", (void *) ranges, sizeof(ranges)); - if (len <= 0) - return 1; - - len /= sizeof(struct linux_prom64_ranges); - for (i = 0; i < len; i++) { - struct linux_prom64_ranges *rng = &ranges[i]; - u64 phys_addr = regs->phys_addr; - - if (phys_addr >= rng->ot_child_base && - phys_addr < (rng->ot_child_base + rng->or_size)) { - regs->phys_addr -= rng->ot_child_base; - regs->phys_addr += rng->ot_parent_base; - return 0; - } - } - - return 1; -} - struct all_info { struct fb_info info; struct ffb_par par; u32 pseudo_palette[256]; - struct list_head list; }; -static LIST_HEAD(ffb_list); -static void ffb_init_one(int node, int parent) +static int ffb_init_one(struct of_device *op) { - struct linux_prom64_registers regs[2*PROMREG_MAX]; - struct ffb_fbc *fbc; - struct ffb_dac *dac; + struct device_node *dp = op->node; + struct ffb_fbc __iomem *fbc; + struct ffb_dac __iomem *dac; struct all_info *all; + int err; - if (prom_getproperty(node, "reg", (void *) regs, sizeof(regs)) <= 0) { - printk("ffb: Cannot get reg device node property.\n"); - return; - } + all = kzalloc(sizeof(*all), GFP_KERNEL); + if (!all) + return -ENOMEM; - if (ffb_apply_upa_parent_ranges(parent, ®s[0])) { - printk("ffb: Cannot apply parent ranges to regs.\n"); - return; + spin_lock_init(&all->par.lock); + all->par.fbc = of_ioremap(&op->resource[2], 0, + sizeof(struct ffb_fbc), "ffb fbc"); + if (!all->par.fbc) { + kfree(all); + return -ENOMEM; } - all = kmalloc(sizeof(*all), GFP_KERNEL); - if (!all) { - printk(KERN_ERR "ffb: Cannot allocate memory.\n"); - return; + all->par.dac = of_ioremap(&op->resource[1], 0, + sizeof(struct ffb_dac), "ffb dac"); + if (!all->par.dac) { + of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); + kfree(all); + return -ENOMEM; } - memset(all, 0, sizeof(*all)); - - INIT_LIST_HEAD(&all->list); - spin_lock_init(&all->par.lock); - all->par.fbc = (struct ffb_fbc *)(regs[0].phys_addr + FFB_FBC_REGS_POFF); - all->par.dac = (struct ffb_dac *)(regs[0].phys_addr + FFB_DAC_POFF); all->par.rop_cache = FFB_ROP_NEW; - all->par.physbase = regs[0].phys_addr; - all->par.prom_node = node; - all->par.prom_parent_node = parent; + all->par.physbase = op->resource[0].start; /* Don't mention copyarea, so SCROLL_REDRAW is always * used. It is the fastest on this chip. @@ -968,7 +930,7 @@ static void ffb_init_one(int node, int parent) all->info.par = &all->par; all->info.pseudo_palette = all->pseudo_palette; - sbusfb_fill_var(&all->info.var, all->par.prom_node, 32); + sbusfb_fill_var(&all->info.var, dp->node, 32); all->par.fbsize = PAGE_ALIGN(all->info.var.xres * all->info.var.yres * 4); @@ -976,14 +938,13 @@ static void ffb_init_one(int node, int parent) all->info.var.accel_flags = FB_ACCELF_TEXT; - prom_getstring(node, "name", all->par.name, sizeof(all->par.name)); - if (!strcmp(all->par.name, "SUNW,afb")) + if (!strcmp(dp->name, "SUNW,afb")) all->par.flags |= FFB_FLAG_AFB; - all->par.board_type = prom_getintdefault(node, "board_type", 0); + all->par.board_type = of_getintprop_default(dp, "board_type", 0); fbc = all->par.fbc; - if((upa_readl(&fbc->ucsr) & FFB_UCSR_ALL_ERRORS) != 0) + if ((upa_readl(&fbc->ucsr) & FFB_UCSR_ALL_ERRORS) != 0) upa_writel(FFB_UCSR_ALL_ERRORS, &fbc->ucsr); ffb_switch_from_graph(&all->par); @@ -1008,81 +969,88 @@ static void ffb_init_one(int node, int parent) if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { printk(KERN_ERR "ffb: Could not allocate color map.\n"); kfree(all); - return; + return -ENOMEM; } ffb_init_fix(&all->info); - if (register_framebuffer(&all->info) < 0) { + err = register_framebuffer(&all->info); + if (err < 0) { printk(KERN_ERR "ffb: Could not register framebuffer.\n"); fb_dealloc_cmap(&all->info.cmap); kfree(all); - return; + return err; } - list_add(&all->list, &ffb_list); + dev_set_drvdata(&op->dev, all); - printk("ffb: %s at %016lx type %d DAC %d\n", + printk("%s: %s at %016lx, type %d, DAC revision %d\n", + dp->full_name, ((all->par.flags & FFB_FLAG_AFB) ? "AFB" : "FFB"), - regs[0].phys_addr, all->par.board_type, all->par.dac_rev); + all->par.physbase, all->par.board_type, all->par.dac_rev); + + return 0; } -static void ffb_scan_siblings(int root) +static int __devinit ffb_probe(struct of_device *dev, const struct of_device_id *match) { - int node, child; - - child = prom_getchild(root); - for (node = prom_searchsiblings(child, "SUNW,ffb"); node; - node = prom_searchsiblings(prom_getsibling(node), "SUNW,ffb")) - ffb_init_one(node, root); - for (node = prom_searchsiblings(child, "SUNW,afb"); node; - node = prom_searchsiblings(prom_getsibling(node), "SUNW,afb")) - ffb_init_one(node, root); + struct of_device *op = to_of_device(&dev->dev); + + return ffb_init_one(op); } -int __init ffb_init(void) +static int __devexit ffb_remove(struct of_device *dev) { - int root; + struct all_info *all = dev_get_drvdata(&dev->dev); - if (fb_get_options("ffb", NULL)) - return -ENODEV; + unregister_framebuffer(&all->info); + fb_dealloc_cmap(&all->info.cmap); - ffb_scan_siblings(prom_root_node); + of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); + of_iounmap(all->par.dac, sizeof(struct ffb_dac)); - root = prom_getchild(prom_root_node); - for (root = prom_searchsiblings(root, "upa"); root; - root = prom_searchsiblings(prom_getsibling(root), "upa")) - ffb_scan_siblings(root); + kfree(all); + + dev_set_drvdata(&dev->dev, NULL); return 0; } -void __exit ffb_exit(void) -{ - struct list_head *pos, *tmp; +static struct of_device_id ffb_match[] = { + { + .name = "SUNW,ffb", + }, + { + .name = "SUNW,afb", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, ffb_match); + +static struct of_platform_driver ffb_driver = { + .name = "ffb", + .match_table = ffb_match, + .probe = ffb_probe, + .remove = __devexit_p(ffb_remove), +}; - list_for_each_safe(pos, tmp, &ffb_list) { - struct all_info *all = list_entry(pos, typeof(*all), list); +int __init ffb_init(void) +{ + if (fb_get_options("ffb", NULL)) + return -ENODEV; - unregister_framebuffer(&all->info); - fb_dealloc_cmap(&all->info.cmap); - kfree(all); - } + return of_register_driver(&ffb_driver, &of_bus_type); } -int __init -ffb_setup(char *arg) +void __exit ffb_exit(void) { - /* No cmdline options yet... */ - return 0; + of_unregister_driver(&ffb_driver); } module_init(ffb_init); - -#ifdef MODULE module_exit(ffb_exit); -#endif MODULE_DESCRIPTION("framebuffer driver for Creator/Elite3D chipsets"); -MODULE_AUTHOR("David S. Miller <davem@redhat.com>"); +MODULE_AUTHOR("David S. Miller <davem@davemloft.net>"); +MODULE_VERSION("2.0"); MODULE_LICENSE("GPL"); diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c index 5e25b986019..bf0e60b5a3b 100644 --- a/drivers/video/gbefb.c +++ b/drivers/video/gbefb.c @@ -9,7 +9,6 @@ * more details. */ -#include <linux/config.h> #include <linux/delay.h> #include <linux/platform_device.h> #include <linux/dma-mapping.h> diff --git a/drivers/video/hitfb.c b/drivers/video/hitfb.c index f04ca721f94..01864767450 100644 --- a/drivers/video/hitfb.c +++ b/drivers/video/hitfb.c @@ -11,7 +11,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/drivers/video/i810/i810-i2c.c b/drivers/video/i810/i810-i2c.c index 3fe3ae1aff1..c1f7b49975d 100644 --- a/drivers/video/i810/i810-i2c.c +++ b/drivers/video/i810/i810-i2c.c @@ -8,7 +8,6 @@ * License. See the file COPYING in the main directory of this archive for * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index a1f7d80f0ac..fbe8a2c4b04 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c @@ -29,7 +29,6 @@ */ #include <linux/module.h> -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/string.h> diff --git a/drivers/video/imacfb.c b/drivers/video/imacfb.c index 7b1c168c834..cdbae173d69 100644 --- a/drivers/video/imacfb.c +++ b/drivers/video/imacfb.c @@ -207,10 +207,6 @@ static int __init imacfb_probe(struct platform_device *dev) size_remap = size_total; imacfb_fix.smem_len = size_remap; -#ifndef __i386__ - screen_info.imacpm_seg = 0; -#endif - if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) { printk(KERN_WARNING "imacfb: cannot reserve video memory at 0x%lx\n", diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c index f73c642b50c..5f393d985b1 100644 --- a/drivers/video/imsttfb.c +++ b/drivers/video/imsttfb.c @@ -16,7 +16,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 1718baaeed2..0f9b2fdc28b 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c @@ -18,7 +18,6 @@ //#define DEBUG 1 -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index 0a0a8b199ec..3f39d84015f 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c @@ -108,7 +108,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c index 7533b3dd08a..3b78a57924f 100644 --- a/drivers/video/intelfb/intelfbhw.c +++ b/drivers/video/intelfb/intelfbhw.c @@ -19,7 +19,6 @@ /* $DHD: intelfb/intelfbhw.c,v 1.9 2003/06/27 15:06:25 dawes Exp $ */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c index 477ad297de4..2fdbe9b2b04 100644 --- a/drivers/video/kyro/fbdev.c +++ b/drivers/video/kyro/fbdev.c @@ -9,7 +9,6 @@ * for more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/video/leo.c b/drivers/video/leo.c index a23cfdb9d82..f3a24338d9a 100644 --- a/drivers/video/leo.c +++ b/drivers/video/leo.c @@ -1,6 +1,6 @@ /* leo.c: LEO frame buffer driver * - * Copyright (C) 2003 David S. Miller (davem@redhat.com) + * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net) * Copyright (C) 1996-1999 Jakub Jelinek (jj@ultra.linux.cz) * Copyright (C) 1997 Michal Rehacek (Michal.Rehacek@st.mff.cuni.cz) * @@ -18,8 +18,8 @@ #include <linux/mm.h> #include <asm/io.h> -#include <asm/sbus.h> -#include <asm/oplib.h> +#include <asm/prom.h> +#include <asm/of_device.h> #include <asm/fbio.h> #include "sbuslib.h" @@ -80,10 +80,10 @@ static struct fb_ops leo_ops = { struct leo_cursor { u8 xxx0[16]; - volatile u32 cur_type; - volatile u32 cur_misc; - volatile u32 cur_cursxy; - volatile u32 cur_data; + u32 cur_type; + u32 cur_misc; + u32 cur_cursxy; + u32 cur_data; }; #define LEO_KRN_TYPE_CLUT0 0x00001000 @@ -99,27 +99,27 @@ struct leo_cursor { #define LEO_KRN_CSR_UNK2 0x00000001 struct leo_lx_krn { - volatile u32 krn_type; - volatile u32 krn_csr; - volatile u32 krn_value; + u32 krn_type; + u32 krn_csr; + u32 krn_value; }; struct leo_lc_ss0_krn { - volatile u32 misc; + u32 misc; u8 xxx0[0x800-4]; - volatile u32 rev; + u32 rev; }; struct leo_lc_ss0_usr { - volatile u32 csr; - volatile u32 addrspace; - volatile u32 fontmsk; - volatile u32 fontt; - volatile u32 extent; - volatile u32 src; + u32 csr; + u32 addrspace; + u32 fontmsk; + u32 fontt; + u32 extent; + u32 src; u32 dst; - volatile u32 copy; - volatile u32 fill; + u32 copy; + u32 fill; }; struct leo_lc_ss1_krn { @@ -132,47 +132,47 @@ struct leo_lc_ss1_usr { struct leo_ld { u8 xxx0[0xe00]; - volatile u32 csr; - volatile u32 wid; - volatile u32 wmask; - volatile u32 widclip; - volatile u32 vclipmin; - volatile u32 vclipmax; - volatile u32 pickmin; /* SS1 only */ - volatile u32 pickmax; /* SS1 only */ - volatile u32 fg; - volatile u32 bg; - volatile u32 src; /* Copy/Scroll (SS0 only) */ - volatile u32 dst; /* Copy/Scroll/Fill (SS0 only) */ - volatile u32 extent; /* Copy/Scroll/Fill size (SS0 only) */ + u32 csr; + u32 wid; + u32 wmask; + u32 widclip; + u32 vclipmin; + u32 vclipmax; + u32 pickmin; /* SS1 only */ + u32 pickmax; /* SS1 only */ + u32 fg; + u32 bg; + u32 src; /* Copy/Scroll (SS0 only) */ + u32 dst; /* Copy/Scroll/Fill (SS0 only) */ + u32 extent; /* Copy/Scroll/Fill size (SS0 only) */ u32 xxx1[3]; - volatile u32 setsem; /* SS1 only */ - volatile u32 clrsem; /* SS1 only */ - volatile u32 clrpick; /* SS1 only */ - volatile u32 clrdat; /* SS1 only */ - volatile u32 alpha; /* SS1 only */ + u32 setsem; /* SS1 only */ + u32 clrsem; /* SS1 only */ + u32 clrpick; /* SS1 only */ + u32 clrdat; /* SS1 only */ + u32 alpha; /* SS1 only */ u8 xxx2[0x2c]; - volatile u32 winbg; - volatile u32 planemask; - volatile u32 rop; - volatile u32 z; - volatile u32 dczf; /* SS1 only */ - volatile u32 dczb; /* SS1 only */ - volatile u32 dcs; /* SS1 only */ - volatile u32 dczs; /* SS1 only */ - volatile u32 pickfb; /* SS1 only */ - volatile u32 pickbb; /* SS1 only */ - volatile u32 dcfc; /* SS1 only */ - volatile u32 forcecol; /* SS1 only */ - volatile u32 door[8]; /* SS1 only */ - volatile u32 pick[5]; /* SS1 only */ + u32 winbg; + u32 planemask; + u32 rop; + u32 z; + u32 dczf; /* SS1 only */ + u32 dczb; /* SS1 only */ + u32 dcs; /* SS1 only */ + u32 dczs; /* SS1 only */ + u32 pickfb; /* SS1 only */ + u32 pickbb; /* SS1 only */ + u32 dcfc; /* SS1 only */ + u32 forcecol; /* SS1 only */ + u32 door[8]; /* SS1 only */ + u32 pick[5]; /* SS1 only */ }; #define LEO_SS1_MISC_ENABLE 0x00000001 #define LEO_SS1_MISC_STEREO 0x00000002 struct leo_ld_ss1 { - u8 xxx0[0xef4]; - volatile u32 ss1_misc; + u8 xxx0[0xef4]; + u32 ss1_misc; }; struct leo_ld_gbl { @@ -193,9 +193,8 @@ struct leo_par { #define LEO_FLAG_BLANKED 0x00000001 unsigned long physbase; + unsigned long which_io; unsigned long fbsize; - - struct sbus_dev *sdev; }; static void leo_wait(struct leo_lx_krn __iomem *lx_krn) @@ -368,8 +367,7 @@ static int leo_mmap(struct fb_info *info, struct vm_area_struct *vma) return sbusfb_mmap_helper(leo_mmap_map, par->physbase, par->fbsize, - par->sdev->reg_addrs[0].which_io, - vma); + par->which_io, vma); } static int leo_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) @@ -385,11 +383,9 @@ static int leo_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) */ static void -leo_init_fix(struct fb_info *info) +leo_init_fix(struct fb_info *info, struct device_node *dp) { - struct leo_par *par = (struct leo_par *)info->par; - - strlcpy(info->fix.id, par->sdev->prom_name, sizeof(info->fix.id)); + strlcpy(info->fix.id, dp->name, sizeof(info->fix.id)); info->fix.type = FB_TYPE_PACKED_PIXELS; info->fix.visual = FB_VISUAL_TRUECOLOR; @@ -532,60 +528,74 @@ static void leo_fixup_var_rgb(struct fb_var_screeninfo *var) struct all_info { struct fb_info info; struct leo_par par; - struct list_head list; }; -static LIST_HEAD(leo_list); -static void leo_init_one(struct sbus_dev *sdev) +static void leo_unmap_regs(struct all_info *all) { - struct all_info *all; - int linebytes; + if (all->par.lc_ss0_usr) + of_iounmap(all->par.lc_ss0_usr, 0x1000); + if (all->par.ld_ss0) + of_iounmap(all->par.ld_ss0, 0x1000); + if (all->par.ld_ss1) + of_iounmap(all->par.ld_ss1, 0x1000); + if (all->par.lx_krn) + of_iounmap(all->par.lx_krn, 0x1000); + if (all->par.cursor) + of_iounmap(all->par.cursor, sizeof(struct leo_cursor)); + if (all->info.screen_base) + of_iounmap(all->info.screen_base, 0x800000); +} - all = kmalloc(sizeof(*all), GFP_KERNEL); - if (!all) { - printk(KERN_ERR "leo: Cannot allocate memory.\n"); - return; - } - memset(all, 0, sizeof(*all)); +static int __devinit leo_init_one(struct of_device *op) +{ + struct device_node *dp = op->node; + struct all_info *all; + int linebytes, err; - INIT_LIST_HEAD(&all->list); + all = kzalloc(sizeof(*all), GFP_KERNEL); + if (!all) + return -ENOMEM; spin_lock_init(&all->par.lock); - all->par.sdev = sdev; - all->par.physbase = sdev->reg_addrs[0].phys_addr; + all->par.physbase = op->resource[0].start; + all->par.which_io = op->resource[0].flags & IORESOURCE_BITS; - sbusfb_fill_var(&all->info.var, sdev->prom_node, 32); + sbusfb_fill_var(&all->info.var, dp->node, 32); leo_fixup_var_rgb(&all->info.var); - linebytes = prom_getintdefault(sdev->prom_node, "linebytes", - all->info.var.xres); + linebytes = of_getintprop_default(dp, "linebytes", + all->info.var.xres); all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres); -#ifdef CONFIG_SPARC32 - all->info.screen_base = (char __iomem *) - prom_getintdefault(sdev->prom_node, "address", 0); -#endif - if (!all->info.screen_base) - all->info.screen_base = - sbus_ioremap(&sdev->resource[0], LEO_OFF_SS0, - 0x800000, "leo ram"); - all->par.lc_ss0_usr = - sbus_ioremap(&sdev->resource[0], LEO_OFF_LC_SS0_USR, - 0x1000, "leolc ss0usr"); + of_ioremap(&op->resource[0], LEO_OFF_LC_SS0_USR, + 0x1000, "leolc ss0usr"); all->par.ld_ss0 = - sbus_ioremap(&sdev->resource[0], LEO_OFF_LD_SS0, - 0x1000, "leold ss0"); + of_ioremap(&op->resource[0], LEO_OFF_LD_SS0, + 0x1000, "leold ss0"); all->par.ld_ss1 = - sbus_ioremap(&sdev->resource[0], LEO_OFF_LD_SS1, - 0x1000, "leold ss1"); + of_ioremap(&op->resource[0], LEO_OFF_LD_SS1, + 0x1000, "leold ss1"); all->par.lx_krn = - sbus_ioremap(&sdev->resource[0], LEO_OFF_LX_KRN, - 0x1000, "leolx krn"); + of_ioremap(&op->resource[0], LEO_OFF_LX_KRN, + 0x1000, "leolx krn"); all->par.cursor = - sbus_ioremap(&sdev->resource[0], LEO_OFF_LX_CURSOR, - sizeof(struct leo_cursor), "leolx cursor"); + of_ioremap(&op->resource[0], LEO_OFF_LX_CURSOR, + sizeof(struct leo_cursor), "leolx cursor"); + all->info.screen_base = + of_ioremap(&op->resource[0], LEO_OFF_SS0, + 0x800000, "leo ram"); + if (!all->par.lc_ss0_usr || + !all->par.ld_ss0 || + !all->par.ld_ss1 || + !all->par.lx_krn || + !all->par.cursor || + !all->info.screen_base) { + leo_unmap_regs(all); + kfree(all); + return -ENOMEM; + } all->info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; all->info.fbops = &leo_ops; @@ -597,69 +607,85 @@ static void leo_init_one(struct sbus_dev *sdev) leo_blank(0, &all->info); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - printk(KERN_ERR "leo: Could not allocate color map.\n"); + leo_unmap_regs(all); kfree(all); - return; + return -ENOMEM;; } - leo_init_fix(&all->info); + leo_init_fix(&all->info, dp); - if (register_framebuffer(&all->info) < 0) { - printk(KERN_ERR "leo: Could not register framebuffer.\n"); + err = register_framebuffer(&all->info); + if (err < 0) { fb_dealloc_cmap(&all->info.cmap); + leo_unmap_regs(all); kfree(all); - return; + return err; } - list_add(&all->list, &leo_list); + dev_set_drvdata(&op->dev, all); + + printk("%s: leo at %lx:%lx\n", + dp->full_name, + all->par.which_io, all->par.physbase); - printk("leo: %s at %lx:%lx\n", - sdev->prom_name, - (long) sdev->reg_addrs[0].which_io, - (long) sdev->reg_addrs[0].phys_addr); + return 0; } -int __init leo_init(void) +static int __devinit leo_probe(struct of_device *dev, const struct of_device_id *match) { - struct sbus_bus *sbus; - struct sbus_dev *sdev; + struct of_device *op = to_of_device(&dev->dev); - if (fb_get_options("leofb", NULL)) - return -ENODEV; + return leo_init_one(op); +} - for_all_sbusdev(sdev, sbus) { - if (!strcmp(sdev->prom_name, "leo")) - leo_init_one(sdev); - } +static int __devexit leo_remove(struct of_device *dev) +{ + struct all_info *all = dev_get_drvdata(&dev->dev); + + unregister_framebuffer(&all->info); + fb_dealloc_cmap(&all->info.cmap); + + leo_unmap_regs(all); + + kfree(all); + + dev_set_drvdata(&dev->dev, NULL); return 0; } -void __exit leo_exit(void) -{ - struct list_head *pos, *tmp; +static struct of_device_id leo_match[] = { + { + .name = "leo", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, leo_match); + +static struct of_platform_driver leo_driver = { + .name = "leo", + .match_table = leo_match, + .probe = leo_probe, + .remove = __devexit_p(leo_remove), +}; - list_for_each_safe(pos, tmp, &leo_list) { - struct all_info *all = list_entry(pos, typeof(*all), list); +static int __init leo_init(void) +{ + if (fb_get_options("leofb", NULL)) + return -ENODEV; - unregister_framebuffer(&all->info); - fb_dealloc_cmap(&all->info.cmap); - kfree(all); - } + return of_register_driver(&leo_driver, &of_bus_type); } -int __init -leo_setup(char *arg) +static void __exit leo_exit(void) { - /* No cmdline options yet... */ - return 0; + of_unregister_driver(&leo_driver); } module_init(leo_init); -#ifdef MODULE module_exit(leo_exit); -#endif MODULE_DESCRIPTION("framebuffer driver for LEO chipsets"); -MODULE_AUTHOR("David S. Miller <davem@redhat.com>"); +MODULE_AUTHOR("David S. Miller <davem@davemloft.net>"); +MODULE_VERSION("2.0"); MODULE_LICENSE("GPL"); diff --git a/drivers/video/logo/logo.c b/drivers/video/logo/logo.c index 788fa812c87..80c03618eb5 100644 --- a/drivers/video/logo/logo.c +++ b/drivers/video/logo/logo.c @@ -9,7 +9,6 @@ * Copyright (C) 2003 Geert Uytterhoeven <geert@linux-m68k.org> */ -#include <linux/config.h> #include <linux/linux_logo.h> #include <linux/stddef.h> #include <linux/module.h> diff --git a/drivers/video/macmodes.c b/drivers/video/macmodes.c index d21321ca7c3..ab2149531a0 100644 --- a/drivers/video/macmodes.c +++ b/drivers/video/macmodes.c @@ -15,7 +15,6 @@ * more details. */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/fb.h> #include <linux/string.h> diff --git a/drivers/video/matrox/matroxfb_DAC1064.c b/drivers/video/matrox/matroxfb_DAC1064.c index a456e67a5b0..c4b570b4a4d 100644 --- a/drivers/video/matrox/matroxfb_DAC1064.c +++ b/drivers/video/matrox/matroxfb_DAC1064.c @@ -12,7 +12,6 @@ * */ -#include <linux/config.h> #include "matroxfb_DAC1064.h" #include "matroxfb_misc.h" diff --git a/drivers/video/matrox/matroxfb_DAC1064.h b/drivers/video/matrox/matroxfb_DAC1064.h index 56513a5d220..df39c319373 100644 --- a/drivers/video/matrox/matroxfb_DAC1064.h +++ b/drivers/video/matrox/matroxfb_DAC1064.h @@ -1,7 +1,6 @@ #ifndef __MATROXFB_DAC1064_H__ #define __MATROXFB_DAC1064_H__ -#include <linux/config.h> #include "matroxfb_base.h" diff --git a/drivers/video/matrox/matroxfb_Ti3026.c b/drivers/video/matrox/matroxfb_Ti3026.c index 23ebad0a12d..a5690a5f29d 100644 --- a/drivers/video/matrox/matroxfb_Ti3026.c +++ b/drivers/video/matrox/matroxfb_Ti3026.c @@ -78,7 +78,6 @@ * */ -#include <linux/config.h> #include "matroxfb_Ti3026.h" #include "matroxfb_misc.h" diff --git a/drivers/video/matrox/matroxfb_Ti3026.h b/drivers/video/matrox/matroxfb_Ti3026.h index 536e5f69de9..27872aaa0a1 100644 --- a/drivers/video/matrox/matroxfb_Ti3026.h +++ b/drivers/video/matrox/matroxfb_Ti3026.h @@ -1,7 +1,6 @@ #ifndef __MATROXFB_TI3026_H__ #define __MATROXFB_TI3026_H__ -#include <linux/config.h> #include "matroxfb_base.h" diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c index f4ddd3431f1..4a57dabb77d 100644 --- a/drivers/video/matrox/matroxfb_base.c +++ b/drivers/video/matrox/matroxfb_base.c @@ -99,7 +99,6 @@ * */ -#include <linux/config.h> #include <linux/version.h> #define __OLD_VIDIOC_ @@ -234,7 +233,7 @@ int matroxfb_enable_irq(WPMINFO int reenable) { if (!test_and_set_bit(0, &ACCESS_FBINFO(irq_flags))) { if (request_irq(ACCESS_FBINFO(pcidev)->irq, matrox_irq, - SA_SHIRQ, "matroxfb", MINFO)) { + IRQF_SHARED, "matroxfb", MINFO)) { clear_bit(0, &ACCESS_FBINFO(irq_flags)); return -EINVAL; } diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index b71737178d0..b95779b57c0 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h @@ -25,7 +25,6 @@ /* Guard accelerator accesses with spin_lock_irqsave... */ #undef MATROXFB_USE_SPINLOCKS -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/matrox/matroxfb_misc.c b/drivers/video/matrox/matroxfb_misc.c index 263d801ef78..18886b629cb 100644 --- a/drivers/video/matrox/matroxfb_misc.c +++ b/drivers/video/matrox/matroxfb_misc.c @@ -84,7 +84,6 @@ * */ -#include <linux/config.h> #include "matroxfb_misc.h" #include <linux/interrupt.h> diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c index 2f156b724d1..773855a311e 100644 --- a/drivers/video/neofb.c +++ b/drivers/video/neofb.c @@ -54,7 +54,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/nvidia/nv_i2c.c b/drivers/video/nvidia/nv_i2c.c index 1edb1c432b7..19eef3a0902 100644 --- a/drivers/video/nvidia/nv_i2c.c +++ b/drivers/video/nvidia/nv_i2c.c @@ -10,7 +10,6 @@ * for more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/drivers/video/nvidia/nv_of.c b/drivers/video/nvidia/nv_of.c index 7a03d040b1a..8209106e26e 100644 --- a/drivers/video/nvidia/nv_of.c +++ b/drivers/video/nvidia/nv_of.c @@ -10,7 +10,6 @@ * for more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c index 7b5cffb2785..b02d6033cc0 100644 --- a/drivers/video/nvidia/nvidia.c +++ b/drivers/video/nvidia/nvidia.c @@ -9,7 +9,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/offb.c b/drivers/video/offb.c index ad1434e3f22..bfeb11bd471 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c @@ -12,7 +12,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c index 0d195750535..56ac51d6a7f 100644 --- a/drivers/video/p9100.c +++ b/drivers/video/p9100.c @@ -1,6 +1,6 @@ /* p9100.c: P9100 frame buffer driver * - * Copyright (C) 2003 David S. Miller (davem@redhat.com) + * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net) * Copyright 1999 Derrick J Brashear (shadow@dementia.org) * * Driver layout based loosely on tgafb.c, see that file for credits. @@ -17,8 +17,8 @@ #include <linux/mm.h> #include <asm/io.h> -#include <asm/sbus.h> -#include <asm/oplib.h> +#include <asm/prom.h> +#include <asm/of_device.h> #include <asm/fbio.h> #include "sbuslib.h" @@ -72,60 +72,60 @@ static struct fb_ops p9100_ops = { struct p9100_regs { /* Registers for the system control */ - volatile u32 sys_base; - volatile u32 sys_config; - volatile u32 sys_intr; - volatile u32 sys_int_ena; - volatile u32 sys_alt_rd; - volatile u32 sys_alt_wr; - volatile u32 sys_xxx[58]; + u32 sys_base; + u32 sys_config; + u32 sys_intr; + u32 sys_int_ena; + u32 sys_alt_rd; + u32 sys_alt_wr; + u32 sys_xxx[58]; /* Registers for the video control */ - volatile u32 vid_base; - volatile u32 vid_hcnt; - volatile u32 vid_htotal; - volatile u32 vid_hsync_rise; - volatile u32 vid_hblank_rise; - volatile u32 vid_hblank_fall; - volatile u32 vid_hcnt_preload; - volatile u32 vid_vcnt; - volatile u32 vid_vlen; - volatile u32 vid_vsync_rise; - volatile u32 vid_vblank_rise; - volatile u32 vid_vblank_fall; - volatile u32 vid_vcnt_preload; - volatile u32 vid_screenpaint_addr; - volatile u32 vid_screenpaint_timectl1; - volatile u32 vid_screenpaint_qsfcnt; - volatile u32 vid_screenpaint_timectl2; - volatile u32 vid_xxx[15]; + u32 vid_base; + u32 vid_hcnt; + u32 vid_htotal; + u32 vid_hsync_rise; + u32 vid_hblank_rise; + u32 vid_hblank_fall; + u32 vid_hcnt_preload; + u32 vid_vcnt; + u32 vid_vlen; + u32 vid_vsync_rise; + u32 vid_vblank_rise; + u32 vid_vblank_fall; + u32 vid_vcnt_preload; + u32 vid_screenpaint_addr; + u32 vid_screenpaint_timectl1; + u32 vid_screenpaint_qsfcnt; + u32 vid_screenpaint_timectl2; + u32 vid_xxx[15]; /* Registers for the video control */ - volatile u32 vram_base; - volatile u32 vram_memcfg; - volatile u32 vram_refresh_pd; - volatile u32 vram_refresh_cnt; - volatile u32 vram_raslo_max; - volatile u32 vram_raslo_cur; - volatile u32 pwrup_cfg; - volatile u32 vram_xxx[25]; + u32 vram_base; + u32 vram_memcfg; + u32 vram_refresh_pd; + u32 vram_refresh_cnt; + u32 vram_raslo_max; + u32 vram_raslo_cur; + u32 pwrup_cfg; + u32 vram_xxx[25]; /* Registers for IBM RGB528 Palette */ - volatile u32 ramdac_cmap_wridx; - volatile u32 ramdac_palette_data; - volatile u32 ramdac_pixel_mask; - volatile u32 ramdac_palette_rdaddr; - volatile u32 ramdac_idx_lo; - volatile u32 ramdac_idx_hi; - volatile u32 ramdac_idx_data; - volatile u32 ramdac_idx_ctl; - volatile u32 ramdac_xxx[1784]; + u32 ramdac_cmap_wridx; + u32 ramdac_palette_data; + u32 ramdac_pixel_mask; + u32 ramdac_palette_rdaddr; + u32 ramdac_idx_lo; + u32 ramdac_idx_hi; + u32 ramdac_idx_data; + u32 ramdac_idx_ctl; + u32 ramdac_xxx[1784]; }; struct p9100_cmd_parameng { - volatile u32 parameng_status; - volatile u32 parameng_bltcmd; - volatile u32 parameng_quadcmd; + u32 parameng_status; + u32 parameng_bltcmd; + u32 parameng_quadcmd; }; struct p9100_par { @@ -136,9 +136,8 @@ struct p9100_par { #define P9100_FLAG_BLANKED 0x00000001 unsigned long physbase; + unsigned long which_io; unsigned long fbsize; - - struct sbus_dev *sdev; }; /** @@ -227,8 +226,7 @@ static int p9100_mmap(struct fb_info *info, struct vm_area_struct *vma) return sbusfb_mmap_helper(p9100_mmap_map, par->physbase, par->fbsize, - par->sdev->reg_addrs[0].which_io, - vma); + par->which_io, vma); } static int p9100_ioctl(struct fb_info *info, unsigned int cmd, @@ -245,12 +243,9 @@ static int p9100_ioctl(struct fb_info *info, unsigned int cmd, * Initialisation */ -static void -p9100_init_fix(struct fb_info *info, int linebytes) +static void p9100_init_fix(struct fb_info *info, int linebytes, struct device_node *dp) { - struct p9100_par *par = (struct p9100_par *)info->par; - - strlcpy(info->fix.id, par->sdev->prom_name, sizeof(info->fix.id)); + strlcpy(info->fix.id, dp->name, sizeof(info->fix.id)); info->fix.type = FB_TYPE_PACKED_PIXELS; info->fix.visual = FB_VISUAL_PSEUDOCOLOR; @@ -263,121 +258,137 @@ p9100_init_fix(struct fb_info *info, int linebytes) struct all_info { struct fb_info info; struct p9100_par par; - struct list_head list; }; -static LIST_HEAD(p9100_list); -static void p9100_init_one(struct sbus_dev *sdev) +static int __devinit p9100_init_one(struct of_device *op) { + struct device_node *dp = op->node; struct all_info *all; - int linebytes; - - all = kmalloc(sizeof(*all), GFP_KERNEL); - if (!all) { - printk(KERN_ERR "p9100: Cannot allocate memory.\n"); - return; - } - memset(all, 0, sizeof(*all)); + int linebytes, err; - INIT_LIST_HEAD(&all->list); + all = kzalloc(sizeof(*all), GFP_KERNEL); + if (!all) + return -ENOMEM; spin_lock_init(&all->par.lock); - all->par.sdev = sdev; /* This is the framebuffer and the only resource apps can mmap. */ - all->par.physbase = sdev->reg_addrs[2].phys_addr; + all->par.physbase = op->resource[2].start; + all->par.which_io = op->resource[2].flags & IORESOURCE_BITS; - sbusfb_fill_var(&all->info.var, sdev->prom_node, 8); + sbusfb_fill_var(&all->info.var, dp->node, 8); all->info.var.red.length = 8; all->info.var.green.length = 8; all->info.var.blue.length = 8; - linebytes = prom_getintdefault(sdev->prom_node, "linebytes", - all->info.var.xres); + linebytes = of_getintprop_default(dp, "linebytes", + all->info.var.xres); all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres); - all->par.regs = sbus_ioremap(&sdev->resource[0], 0, - sizeof(struct p9100_regs), "p9100 regs"); + all->par.regs = of_ioremap(&op->resource[0], 0, + sizeof(struct p9100_regs), "p9100 regs"); + if (!all->par.regs) { + kfree(all); + return -ENOMEM; + } all->info.flags = FBINFO_DEFAULT; all->info.fbops = &p9100_ops; -#ifdef CONFIG_SPARC32 - all->info.screen_base = (char __iomem *) - prom_getintdefault(sdev->prom_node, "address", 0); -#endif - if (!all->info.screen_base) - all->info.screen_base = sbus_ioremap(&sdev->resource[2], 0, - all->par.fbsize, "p9100 ram"); + all->info.screen_base = of_ioremap(&op->resource[2], 0, + all->par.fbsize, "p9100 ram"); + if (!all->info.screen_base) { + of_iounmap(all->par.regs, sizeof(struct p9100_regs)); + kfree(all); + return -ENOMEM; + } all->info.par = &all->par; p9100_blank(0, &all->info); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - printk(KERN_ERR "p9100: Could not allocate color map.\n"); + of_iounmap(all->par.regs, sizeof(struct p9100_regs)); + of_iounmap(all->info.screen_base, all->par.fbsize); kfree(all); - return; + return -ENOMEM; } - p9100_init_fix(&all->info, linebytes); + p9100_init_fix(&all->info, linebytes, dp); - if (register_framebuffer(&all->info) < 0) { - printk(KERN_ERR "p9100: Could not register framebuffer.\n"); + err = register_framebuffer(&all->info); + if (err < 0) { fb_dealloc_cmap(&all->info.cmap); + of_iounmap(all->par.regs, sizeof(struct p9100_regs)); + of_iounmap(all->info.screen_base, all->par.fbsize); kfree(all); - return; + return err; } fb_set_cmap(&all->info.cmap, &all->info); - list_add(&all->list, &p9100_list); + dev_set_drvdata(&op->dev, all); + + printk("%s: p9100 at %lx:%lx\n", + dp->full_name, + all->par.which_io, all->par.physbase); - printk("p9100: %s at %lx:%lx\n", - sdev->prom_name, - (long) sdev->reg_addrs[0].which_io, - (long) sdev->reg_addrs[0].phys_addr); + return 0; } -int __init p9100_init(void) +static int __devinit p9100_probe(struct of_device *dev, const struct of_device_id *match) { - struct sbus_bus *sbus; - struct sbus_dev *sdev; + struct of_device *op = to_of_device(&dev->dev); - if (fb_get_options("p9100fb", NULL)) - return -ENODEV; + return p9100_init_one(op); +} - for_all_sbusdev(sdev, sbus) { - if (!strcmp(sdev->prom_name, "p9100")) - p9100_init_one(sdev); - } +static int __devexit p9100_remove(struct of_device *dev) +{ + struct all_info *all = dev_get_drvdata(&dev->dev); + + unregister_framebuffer(&all->info); + fb_dealloc_cmap(&all->info.cmap); + + of_iounmap(all->par.regs, sizeof(struct p9100_regs)); + of_iounmap(all->info.screen_base, all->par.fbsize); + + kfree(all); + + dev_set_drvdata(&dev->dev, NULL); return 0; } -void __exit p9100_exit(void) -{ - struct list_head *pos, *tmp; +static struct of_device_id p9100_match[] = { + { + .name = "p9100", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, p9100_match); - list_for_each_safe(pos, tmp, &p9100_list) { - struct all_info *all = list_entry(pos, typeof(*all), list); +static struct of_platform_driver p9100_driver = { + .name = "p9100", + .match_table = p9100_match, + .probe = p9100_probe, + .remove = __devexit_p(p9100_remove), +}; - unregister_framebuffer(&all->info); - fb_dealloc_cmap(&all->info.cmap); - kfree(all); - } +static int __init p9100_init(void) +{ + if (fb_get_options("p9100fb", NULL)) + return -ENODEV; + + return of_register_driver(&p9100_driver, &of_bus_type); } -int __init -p9100_setup(char *arg) +static void __exit p9100_exit(void) { - /* No cmdline options yet... */ - return 0; + of_unregister_driver(&p9100_driver); } module_init(p9100_init); - -#ifdef MODULE module_exit(p9100_exit); -#endif MODULE_DESCRIPTION("framebuffer driver for P9100 chipsets"); -MODULE_AUTHOR("David S. Miller <davem@redhat.com>"); +MODULE_AUTHOR("David S. Miller <davem@davemloft.net>"); +MODULE_VERSION("2.0"); MODULE_LICENSE("GPL"); diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c index 335e3746555..450e802e0aa 100644 --- a/drivers/video/platinumfb.c +++ b/drivers/video/platinumfb.c @@ -17,7 +17,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c index 4e963930b50..49a203e1591 100644 --- a/drivers/video/pm2fb.c +++ b/drivers/video/pm2fb.c @@ -27,7 +27,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c index 52c18a35fb4..0e0f977b05e 100644 --- a/drivers/video/pm3fb.c +++ b/drivers/video/pm3fb.c @@ -52,7 +52,6 @@ * Wed Feb 21 14:47:06 CET 2001, v 1.0.0: First working version */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c index ec4bacf9dd2..4a1e0e85692 100644 --- a/drivers/video/pvr2fb.c +++ b/drivers/video/pvr2fb.c @@ -56,7 +56,6 @@ #include <linux/tty.h> #include <linux/slab.h> #include <linux/delay.h> -#include <linux/config.h> #include <linux/interrupt.h> #include <linux/fb.h> #include <linux/init.h> diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 809fc5eefc1..bbb07106cd5 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c @@ -22,7 +22,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> @@ -1335,7 +1334,7 @@ int __init pxafb_probe(struct platform_device *dev) goto failed; } - ret = request_irq(IRQ_LCD, pxafb_handle_irq, SA_INTERRUPT, "LCD", fbi); + ret = request_irq(IRQ_LCD, pxafb_handle_irq, IRQF_DISABLED, "LCD", fbi); if (ret) { dev_err(&dev->dev, "request_irq failed: %d\n", ret); ret = -EBUSY; diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index 12af58c5cf1..2788655e6e7 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c @@ -29,7 +29,6 @@ * doublescan modes are broken */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/riva/rivafb-i2c.c b/drivers/video/riva/rivafb-i2c.c index 8b1967fc116..9751c37c0bf 100644 --- a/drivers/video/riva/rivafb-i2c.c +++ b/drivers/video/riva/rivafb-i2c.c @@ -12,7 +12,6 @@ * for more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/drivers/video/riva/rivafb.h b/drivers/video/riva/rivafb.h index 440ff445689..7fa13fc9c41 100644 --- a/drivers/video/riva/rivafb.h +++ b/drivers/video/riva/rivafb.h @@ -1,7 +1,6 @@ #ifndef __RIVAFB_H #define __RIVAFB_H -#include <linux/config.h> #include <linux/fb.h> #include <video/vga.h> #include <linux/i2c.h> diff --git a/drivers/video/s1d13xxxfb.c b/drivers/video/s1d13xxxfb.c index feec47bdd47..a5333c19078 100644 --- a/drivers/video/s1d13xxxfb.c +++ b/drivers/video/s1d13xxxfb.c @@ -28,7 +28,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/delay.h> diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index fbc41185068..f461eb10cc7 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c @@ -735,7 +735,7 @@ static int __init s3c2410fb_probe(struct platform_device *pdev) dprintk("got LCD region\n"); - ret = request_irq(irq, s3c2410fb_irq, SA_INTERRUPT, pdev->name, info); + ret = request_irq(irq, s3c2410fb_irq, IRQF_DISABLED, pdev->name, info); if (ret) { dev_err(&pdev->dev, "cannot get irq %d - err %d\n", irq, ret); ret = -EBUSY; diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c index d9831fd4234..a2e6e7205d7 100644 --- a/drivers/video/sa1100fb.c +++ b/drivers/video/sa1100fb.c @@ -160,7 +160,6 @@ * - Add patch 681/1 and clean up stork definitions. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -1473,7 +1472,7 @@ static int __init sa1100fb_probe(struct platform_device *pdev) if (ret) goto failed; - ret = request_irq(irq, sa1100fb_handle_irq, SA_INTERRUPT, + ret = request_irq(irq, sa1100fb_handle_irq, IRQF_DISABLED, "LCD", fbi); if (ret) { printk(KERN_ERR "sa1100fb: request_irq failed: %d\n", ret); diff --git a/drivers/video/savage/savagefb-i2c.c b/drivers/video/savage/savagefb-i2c.c index 21debed863a..e83befd16d6 100644 --- a/drivers/video/savage/savagefb-i2c.c +++ b/drivers/video/savage/savagefb-i2c.c @@ -10,7 +10,6 @@ * for more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index 78883cf66a4..4729af477fb 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c @@ -41,7 +41,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c index 2e6df1fcb2b..ebb6756aea0 100644 --- a/drivers/video/sgivwfb.c +++ b/drivers/video/sgivwfb.c @@ -9,7 +9,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/mm.h> @@ -23,6 +22,8 @@ #include <asm/io.h> #include <asm/mtrr.h> +#include <setup_arch.h> + #define INCLUDE_TIMING_TABLE_DATA #define DBE_REG_BASE par->regs #include <video/sgivw.h> @@ -42,10 +43,6 @@ struct sgivw_par { * The default can be overridden if the driver is compiled as a module */ -/* set by arch/i386/kernel/setup.c */ -extern unsigned long sgivwfb_mem_phys; -extern unsigned long sgivwfb_mem_size; - static int ypan = 0; static int ywrap = 0; diff --git a/drivers/video/sis/init.h b/drivers/video/sis/init.h index 634c0a9d219..7ecab87cef0 100644 --- a/drivers/video/sis/init.h +++ b/drivers/video/sis/init.h @@ -73,7 +73,6 @@ #ifdef SIS_CP #undef SIS_CP #endif -#include <linux/config.h> #include <linux/version.h> #include <linux/types.h> #include <asm/io.h> diff --git a/drivers/video/sis/init301.c b/drivers/video/sis/init301.c index c3e070a6eff..f13faddc618 100644 --- a/drivers/video/sis/init301.c +++ b/drivers/video/sis/init301.c @@ -8043,8 +8043,8 @@ SiS_SetCHTVReg(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short SiS_SetCH700x(SiS_Pr,0x01,0x28); /* Set video bandwidth - High bandwith Luma composite video filter(S0=1) - low bandwith Luma S-video filter (S2-1=00) + High bandwidth Luma composite video filter(S0=1) + low bandwidth Luma S-video filter (S2-1=00) disable peak filter in S-video channel (S3=0) high bandwidth Chroma Filter (S5-4=11) =00110001=0x31 diff --git a/drivers/video/sis/init301.h b/drivers/video/sis/init301.h index f475b21a85c..bc321dc57e9 100644 --- a/drivers/video/sis/init301.h +++ b/drivers/video/sis/init301.h @@ -67,7 +67,6 @@ #ifdef SIS_CP #undef SIS_CP #endif -#include <linux/config.h> #include <linux/version.h> #include <linux/types.h> #include <asm/io.h> diff --git a/drivers/video/sis/initextlfb.c b/drivers/video/sis/initextlfb.c index cc856d90903..09f5d758b6c 100644 --- a/drivers/video/sis/initextlfb.c +++ b/drivers/video/sis/initextlfb.c @@ -30,7 +30,6 @@ #include "vgatypes.h" #include "vstruct.h" -#include <linux/config.h> #include <linux/version.h> #include <linux/types.h> #include <linux/fb.h> diff --git a/drivers/video/sis/osdef.h b/drivers/video/sis/osdef.h index 841ca3190cd..f59568020eb 100644 --- a/drivers/video/sis/osdef.h +++ b/drivers/video/sis/osdef.h @@ -90,7 +90,6 @@ /**********************************************************************/ #ifdef SIS_LINUX_KERNEL -#include <linux/config.h> #include <linux/version.h> #ifdef CONFIG_FB_SIS_300 diff --git a/drivers/video/sis/sis.h b/drivers/video/sis/sis.h index 0b6e625d733..a259446ca7f 100644 --- a/drivers/video/sis/sis.h +++ b/drivers/video/sis/sis.h @@ -24,7 +24,6 @@ #ifndef _SIS_H_ #define _SIS_H_ -#include <linux/config.h> #include <linux/version.h> #include "osdef.h" diff --git a/drivers/video/sis/sis_accel.c b/drivers/video/sis/sis_accel.c index bab933e6c6a..3b7ce032e2e 100644 --- a/drivers/video/sis/sis_accel.c +++ b/drivers/video/sis/sis_accel.c @@ -28,7 +28,6 @@ * for more information and updates) */ -#include <linux/config.h> #include <linux/version.h> #include <linux/module.h> #include <linux/kernel.h> diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index c63c0e721b8..b848ca7db7f 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c @@ -33,7 +33,6 @@ * */ -#include <linux/config.h> #include <linux/version.h> #include <linux/module.h> #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c index c44de90ca12..dad54e73147 100644 --- a/drivers/video/sstfb.c +++ b/drivers/video/sstfb.c @@ -82,7 +82,6 @@ * Includes */ -#include <linux/config.h> #include <linux/string.h> #include <linux/kernel.h> #include <linux/module.h> diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c index 4a292aae6eb..3e16e2d9d55 100644 --- a/drivers/video/stifb.c +++ b/drivers/video/stifb.c @@ -54,7 +54,6 @@ #undef DEBUG_STIFB_REGS /* debug sti register accesses */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/sun3fb.c b/drivers/video/sun3fb.c index 9b36b9df535..e046e20f02b 100644 --- a/drivers/video/sun3fb.c +++ b/drivers/video/sun3fb.c @@ -25,7 +25,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c index 95b918229d9..6990ab11cd0 100644 --- a/drivers/video/tcx.c +++ b/drivers/video/tcx.c @@ -1,6 +1,6 @@ /* tcx.c: TCX frame buffer driver * - * Copyright (C) 2003 David S. Miller (davem@redhat.com) + * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net) * Copyright (C) 1996,1998 Jakub Jelinek (jj@ultra.linux.cz) * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) @@ -19,8 +19,8 @@ #include <linux/mm.h> #include <asm/io.h> -#include <asm/sbus.h> -#include <asm/oplib.h> +#include <asm/prom.h> +#include <asm/of_device.h> #include <asm/fbio.h> #include "sbuslib.h" @@ -77,32 +77,32 @@ static struct fb_ops tcx_ops = { /* The contents are unknown */ struct tcx_tec { - volatile u32 tec_matrix; - volatile u32 tec_clip; - volatile u32 tec_vdc; + u32 tec_matrix; + u32 tec_clip; + u32 tec_vdc; }; struct tcx_thc { - volatile u32 thc_rev; + u32 thc_rev; u32 thc_pad0[511]; - volatile u32 thc_hs; /* hsync timing */ - volatile u32 thc_hsdvs; - volatile u32 thc_hd; - volatile u32 thc_vs; /* vsync timing */ - volatile u32 thc_vd; - volatile u32 thc_refresh; - volatile u32 thc_misc; + u32 thc_hs; /* hsync timing */ + u32 thc_hsdvs; + u32 thc_hd; + u32 thc_vs; /* vsync timing */ + u32 thc_vd; + u32 thc_refresh; + u32 thc_misc; u32 thc_pad1[56]; - volatile u32 thc_cursxy; /* cursor x,y position (16 bits each) */ - volatile u32 thc_cursmask[32]; /* cursor mask bits */ - volatile u32 thc_cursbits[32]; /* what to show where mask enabled */ + u32 thc_cursxy; /* cursor x,y position (16 bits each) */ + u32 thc_cursmask[32]; /* cursor mask bits */ + u32 thc_cursbits[32]; /* what to show where mask enabled */ }; struct bt_regs { - volatile u32 addr; - volatile u32 color_map; - volatile u32 control; - volatile u32 cursor; + u32 addr; + u32 color_map; + u32 control; + u32 cursor; }; #define TCX_MMAP_ENTRIES 14 @@ -112,24 +112,23 @@ struct tcx_par { struct bt_regs __iomem *bt; struct tcx_thc __iomem *thc; struct tcx_tec __iomem *tec; - volatile u32 __iomem *cplane; + u32 __iomem *cplane; u32 flags; #define TCX_FLAG_BLANKED 0x00000001 unsigned long physbase; + unsigned long which_io; unsigned long fbsize; struct sbus_mmap_map mmap_map[TCX_MMAP_ENTRIES]; int lowdepth; - - struct sbus_dev *sdev; }; /* Reset control plane so that WID is 8-bit plane. */ static void __tcx_set_control_plane (struct tcx_par *par) { - volatile u32 __iomem *p, *pend; + u32 __iomem *p, *pend; if (par->lowdepth) return; @@ -307,8 +306,7 @@ static int tcx_mmap(struct fb_info *info, struct vm_area_struct *vma) return sbusfb_mmap_helper(par->mmap_map, par->physbase, par->fbsize, - par->sdev->reg_addrs[0].which_io, - vma); + par->which_io, vma); } static int tcx_ioctl(struct fb_info *info, unsigned int cmd, @@ -350,48 +348,71 @@ tcx_init_fix(struct fb_info *info, int linebytes) struct all_info { struct fb_info info; struct tcx_par par; - struct list_head list; }; -static LIST_HEAD(tcx_list); -static void tcx_init_one(struct sbus_dev *sdev) +static void tcx_unmap_regs(struct all_info *all) { - struct all_info *all; - int linebytes, i; + if (all->par.tec) + of_iounmap(all->par.tec, sizeof(struct tcx_tec)); + if (all->par.thc) + of_iounmap(all->par.thc, sizeof(struct tcx_thc)); + if (all->par.bt) + of_iounmap(all->par.bt, sizeof(struct bt_regs)); + if (all->par.cplane) + of_iounmap(all->par.cplane, all->par.fbsize * sizeof(u32)); + if (all->info.screen_base) + of_iounmap(all->info.screen_base, all->par.fbsize); +} - all = kmalloc(sizeof(*all), GFP_KERNEL); - if (!all) { - printk(KERN_ERR "tcx: Cannot allocate memory.\n"); - return; - } - memset(all, 0, sizeof(*all)); +static int __devinit tcx_init_one(struct of_device *op) +{ + struct device_node *dp = op->node; + struct all_info *all; + int linebytes, i, err; - INIT_LIST_HEAD(&all->list); + all = kzalloc(sizeof(*all), GFP_KERNEL); + if (!all) + return -ENOMEM; spin_lock_init(&all->par.lock); - all->par.sdev = sdev; - all->par.lowdepth = prom_getbool(sdev->prom_node, "tcx-8-bit"); + all->par.lowdepth = + (of_find_property(dp, "tcx-8-bit", NULL) != NULL); - sbusfb_fill_var(&all->info.var, sdev->prom_node, 8); + sbusfb_fill_var(&all->info.var, dp->node, 8); all->info.var.red.length = 8; all->info.var.green.length = 8; all->info.var.blue.length = 8; - linebytes = prom_getintdefault(sdev->prom_node, "linebytes", - all->info.var.xres); + linebytes = of_getintprop_default(dp, "linebytes", + all->info.var.xres); all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres); - all->par.tec = sbus_ioremap(&sdev->resource[7], 0, - sizeof(struct tcx_tec), "tcx tec"); - all->par.thc = sbus_ioremap(&sdev->resource[9], 0, - sizeof(struct tcx_thc), "tcx thc"); - all->par.bt = sbus_ioremap(&sdev->resource[8], 0, - sizeof(struct bt_regs), "tcx dac"); + all->par.tec = of_ioremap(&op->resource[7], 0, + sizeof(struct tcx_tec), "tcx tec"); + all->par.thc = of_ioremap(&op->resource[9], 0, + sizeof(struct tcx_thc), "tcx thc"); + all->par.bt = of_ioremap(&op->resource[8], 0, + sizeof(struct bt_regs), "tcx dac"); + all->info.screen_base = of_ioremap(&op->resource[0], 0, + all->par.fbsize, "tcx ram"); + if (!all->par.tec || !all->par.thc || + !all->par.bt || !all->info.screen_base) { + tcx_unmap_regs(all); + kfree(all); + return -ENOMEM; + } + memcpy(&all->par.mmap_map, &__tcx_mmap_map, sizeof(all->par.mmap_map)); if (!all->par.lowdepth) { - all->par.cplane = sbus_ioremap(&sdev->resource[4], 0, - all->par.fbsize * sizeof(u32), "tcx cplane"); + all->par.cplane = of_ioremap(&op->resource[4], 0, + all->par.fbsize * sizeof(u32), + "tcx cplane"); + if (!all->par.cplane) { + tcx_unmap_regs(all); + kfree(all); + return -ENOMEM; + } } else { all->par.mmap_map[1].size = SBUS_MMAP_EMPTY; all->par.mmap_map[4].size = SBUS_MMAP_EMPTY; @@ -400,6 +421,8 @@ static void tcx_init_one(struct sbus_dev *sdev) } all->par.physbase = 0; + all->par.which_io = op->resource[0].flags & IORESOURCE_BITS; + for (i = 0; i < TCX_MMAP_ENTRIES; i++) { int j; @@ -416,18 +439,11 @@ static void tcx_init_one(struct sbus_dev *sdev) j = i; break; }; - all->par.mmap_map[i].poff = sdev->reg_addrs[j].phys_addr; + all->par.mmap_map[i].poff = op->resource[j].start; } all->info.flags = FBINFO_DEFAULT; all->info.fbops = &tcx_ops; -#ifdef CONFIG_SPARC32 - all->info.screen_base = (char __iomem *) - prom_getintdefault(sdev->prom_node, "address", 0); -#endif - if (!all->info.screen_base) - all->info.screen_base = sbus_ioremap(&sdev->resource[0], 0, - all->par.fbsize, "tcx ram"); all->info.par = &all->par; /* Initialize brooktree DAC. */ @@ -445,72 +461,88 @@ static void tcx_init_one(struct sbus_dev *sdev) tcx_blank(FB_BLANK_UNBLANK, &all->info); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - printk(KERN_ERR "tcx: Could not allocate color map.\n"); + tcx_unmap_regs(all); kfree(all); - return; + return -ENOMEM; } fb_set_cmap(&all->info.cmap, &all->info); tcx_init_fix(&all->info, linebytes); - if (register_framebuffer(&all->info) < 0) { - printk(KERN_ERR "tcx: Could not register framebuffer.\n"); + err = register_framebuffer(&all->info); + if (err < 0) { fb_dealloc_cmap(&all->info.cmap); + tcx_unmap_regs(all); kfree(all); - return; + return err; } - list_add(&all->list, &tcx_list); + dev_set_drvdata(&op->dev, all); - printk("tcx: %s at %lx:%lx, %s\n", - sdev->prom_name, - (long) sdev->reg_addrs[0].which_io, - (long) sdev->reg_addrs[0].phys_addr, + printk("%s: TCX at %lx:%lx, %s\n", + dp->full_name, + all->par.which_io, + op->resource[0].start, all->par.lowdepth ? "8-bit only" : "24-bit depth"); + + return 0; } -int __init tcx_init(void) +static int __devinit tcx_probe(struct of_device *dev, const struct of_device_id *match) { - struct sbus_bus *sbus; - struct sbus_dev *sdev; + struct of_device *op = to_of_device(&dev->dev); - if (fb_get_options("tcxfb", NULL)) - return -ENODEV; + return tcx_init_one(op); +} - for_all_sbusdev(sdev, sbus) { - if (!strcmp(sdev->prom_name, "SUNW,tcx")) - tcx_init_one(sdev); - } +static int __devexit tcx_remove(struct of_device *dev) +{ + struct all_info *all = dev_get_drvdata(&dev->dev); + + unregister_framebuffer(&all->info); + fb_dealloc_cmap(&all->info.cmap); + + tcx_unmap_regs(all); + + kfree(all); + + dev_set_drvdata(&dev->dev, NULL); return 0; } -void __exit tcx_exit(void) -{ - struct list_head *pos, *tmp; +static struct of_device_id tcx_match[] = { + { + .name = "SUNW,tcx", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, tcx_match); - list_for_each_safe(pos, tmp, &tcx_list) { - struct all_info *all = list_entry(pos, typeof(*all), list); +static struct of_platform_driver tcx_driver = { + .name = "tcx", + .match_table = tcx_match, + .probe = tcx_probe, + .remove = __devexit_p(tcx_remove), +}; - unregister_framebuffer(&all->info); - fb_dealloc_cmap(&all->info.cmap); - kfree(all); - } +int __init tcx_init(void) +{ + if (fb_get_options("tcxfb", NULL)) + return -ENODEV; + + return of_register_driver(&tcx_driver, &of_bus_type); } -int __init -tcx_setup(char *arg) +void __exit tcx_exit(void) { - /* No cmdline options yet... */ - return 0; + of_unregister_driver(&tcx_driver); } module_init(tcx_init); - -#ifdef MODULE module_exit(tcx_exit); -#endif MODULE_DESCRIPTION("framebuffer driver for TCX chipsets"); -MODULE_AUTHOR("David S. Miller <davem@redhat.com>"); +MODULE_AUTHOR("David S. Miller <davem@davemloft.net>"); +MODULE_VERSION("2.0"); MODULE_LICENSE("GPL"); diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c index 5e5328d682d..239b1496874 100644 --- a/drivers/video/tdfxfb.c +++ b/drivers/video/tdfxfb.c @@ -58,7 +58,6 @@ * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c index 41f8c2d9389..14175cdb9c9 100644 --- a/drivers/video/tridentfb.c +++ b/drivers/video/tridentfb.c @@ -15,7 +15,6 @@ * TGUI acceleration */ -#include <linux/config.h> #include <linux/module.h> #include <linux/fb.h> #include <linux/init.h> diff --git a/drivers/video/valkyriefb.c b/drivers/video/valkyriefb.c index 2bdeb4baa95..1d76c035050 100644 --- a/drivers/video/valkyriefb.c +++ b/drivers/video/valkyriefb.c @@ -39,7 +39,6 @@ * more details. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> diff --git a/drivers/video/vgastate.c b/drivers/video/vgastate.c index 15179ec6233..d94efafc77b 100644 --- a/drivers/video/vgastate.c +++ b/drivers/video/vgastate.c @@ -13,7 +13,6 @@ * archive for more details. * */ -#include <linux/config.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/fb.h> diff --git a/drivers/zorro/names.c b/drivers/zorro/names.c index 0dd532d3a5d..e8517c3d8e8 100644 --- a/drivers/zorro/names.c +++ b/drivers/zorro/names.c @@ -9,7 +9,6 @@ * David Mosberger-Tang, Martin Mares */ -#include <linux/config.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/types.h> |