From 70134e1e47981a45c0ac1c788ea0cba514b4c731 Mon Sep 17 00:00:00 2001 From: Zhang Wei Date: Thu, 13 Mar 2008 10:45:27 -0700 Subject: [PATCH] --- yaml --- r: 87352 b: refs/heads/master c: 56822843ff99c88c778a614851328fcbb1503d10 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Documentation/00-INDEX | 6 + trunk/Documentation/filesystems/proc.txt | 4 +- trunk/Documentation/kernel-parameters.txt | 2 +- .../{laptops => }/laptop-mode.txt | 0 trunk/Documentation/laptops/00-INDEX | 2 - trunk/Documentation/laptops/acer-wmi.txt | 4 +- trunk/Documentation/{power => }/pm.txt | 2 +- .../{power => }/pm_qos_interface.txt | 0 trunk/Documentation/power/00-INDEX | 6 - .../{power => }/power_supply_class.txt | 0 trunk/Documentation/thermal/sysfs-api.txt | 22 +-- trunk/arch/alpha/Kconfig | 3 - trunk/arch/alpha/kernel/pci_iommu.c | 12 +- trunk/arch/x86/Kconfig | 2 +- trunk/drivers/acpi/Kconfig | 19 +- trunk/drivers/acpi/bus.c | 2 +- trunk/drivers/acpi/button.c | 1 - trunk/drivers/acpi/ec.c | 17 +- trunk/drivers/acpi/osl.c | 2 +- trunk/drivers/acpi/pci_irq.c | 98 ---------- trunk/drivers/acpi/pci_root.c | 2 +- trunk/drivers/acpi/processor_core.c | 25 ++- trunk/drivers/acpi/scan.c | 5 +- trunk/drivers/acpi/sleep/main.c | 2 +- trunk/drivers/acpi/system.c | 2 +- trunk/drivers/acpi/thermal.c | 12 +- trunk/drivers/acpi/toshiba_acpi.c | 7 - trunk/drivers/acpi/utilities/utdebug.c | 2 +- trunk/drivers/acpi/utilities/utobject.c | 2 +- trunk/drivers/acpi/utils.c | 6 - trunk/drivers/acpi/video.c | 4 +- trunk/drivers/acpi/wmi.c | 10 +- trunk/drivers/block/floppy.c | 5 + trunk/drivers/char/riscom8.c | 2 +- trunk/drivers/dma/fsldma.c | 29 +-- trunk/drivers/misc/Kconfig | 1 - trunk/drivers/misc/acer-wmi.c | 44 ++--- trunk/drivers/misc/sony-laptop.c | 2 +- trunk/drivers/pci/bus.c | 6 +- trunk/drivers/pci/pci-acpi.c | 24 +-- trunk/drivers/spi/au1550_spi.c | 4 +- trunk/drivers/spi/spi_bitbang.c | 8 +- trunk/drivers/thermal/Kconfig | 1 - trunk/drivers/thermal/thermal.c | 169 +++--------------- trunk/fs/proc/task_mmu.c | 18 +- trunk/include/asm-h8300/uaccess.h | 11 +- trunk/include/linux/pci.h | 1 - trunk/kernel/power/Kconfig | 2 +- trunk/kernel/power/snapshot.c | 41 +---- trunk/lib/swiotlb.c | 30 ++-- trunk/scripts/kernel-doc | 4 - trunk/security/smack/smack.h | 8 + trunk/security/smack/smackfs.c | 31 ++-- 54 files changed, 210 insertions(+), 516 deletions(-) rename trunk/Documentation/{laptops => }/laptop-mode.txt (100%) rename trunk/Documentation/{power => }/pm.txt (99%) rename trunk/Documentation/{power => }/pm_qos_interface.txt (100%) rename trunk/Documentation/{power => }/power_supply_class.txt (100%) diff --git a/[refs] b/[refs] index b2dbcad3f3d7..7438de068452 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ebe168d52c6255cfaf701b488e9e9ed0f548da19 +refs/heads/master: 56822843ff99c88c778a614851328fcbb1503d10 diff --git a/trunk/Documentation/00-INDEX b/trunk/Documentation/00-INDEX index fc8e7c7d182f..042073f656e5 100644 --- a/trunk/Documentation/00-INDEX +++ b/trunk/Documentation/00-INDEX @@ -225,6 +225,8 @@ kprobes.txt - documents the kernel probes debugging feature. kref.txt - docs on adding reference counters (krefs) to kernel objects. +laptop-mode.txt + - how to conserve battery power using laptop-mode. laptops/ - directory with laptop related info and laptop driver documentation. ldm.txt @@ -299,8 +301,12 @@ pcmcia/ - info on the Linux PCMCIA driver. pi-futex.txt - documentation on lightweight PI-futexes. +pm.txt + - info on Linux power management support. pnp.txt - Linux Plug and Play documentation. +power_supply_class.txt + - Tells userspace about battery, UPS, AC or DC power supply properties power/ - directory with info on Linux PCI power management. powerpc/ diff --git a/trunk/Documentation/filesystems/proc.txt b/trunk/Documentation/filesystems/proc.txt index 518ebe609e2b..5681e2fa1496 100644 --- a/trunk/Documentation/filesystems/proc.txt +++ b/trunk/Documentation/filesystems/proc.txt @@ -1506,13 +1506,13 @@ laptop_mode ----------- laptop_mode is a knob that controls "laptop mode". All the things that are -controlled by this knob are discussed in Documentation/laptops/laptop-mode.txt. +controlled by this knob are discussed in Documentation/laptop-mode.txt. block_dump ---------- block_dump enables block I/O debugging when set to a nonzero value. More -information on block I/O debugging is in Documentation/laptops/laptop-mode.txt. +information on block I/O debugging is in Documentation/laptop-mode.txt. swap_token_timeout ------------------ diff --git a/trunk/Documentation/kernel-parameters.txt b/trunk/Documentation/kernel-parameters.txt index 49318b99e581..533e67febf81 100644 --- a/trunk/Documentation/kernel-parameters.txt +++ b/trunk/Documentation/kernel-parameters.txt @@ -138,7 +138,7 @@ and is between 256 and 4096 characters. It is defined in the file strict -- Be less tolerant of platforms that are not strictly ACPI specification compliant. - See also Documentation/power/pm.txt, pci=noacpi + See also Documentation/pm.txt, pci=noacpi acpi_apic_instance= [ACPI, IOAPIC] Format: diff --git a/trunk/Documentation/laptops/laptop-mode.txt b/trunk/Documentation/laptop-mode.txt similarity index 100% rename from trunk/Documentation/laptops/laptop-mode.txt rename to trunk/Documentation/laptop-mode.txt diff --git a/trunk/Documentation/laptops/00-INDEX b/trunk/Documentation/laptops/00-INDEX index ee5692b26dd4..729c2c062e10 100644 --- a/trunk/Documentation/laptops/00-INDEX +++ b/trunk/Documentation/laptops/00-INDEX @@ -2,8 +2,6 @@ - This file acer-wmi.txt - information on the Acer Laptop WMI Extras driver. -laptop-mode.txt - - how to conserve battery power using laptop-mode. sony-laptop.txt - Sony Notebook Control Driver (SNC) Readme. sonypi.txt diff --git a/trunk/Documentation/laptops/acer-wmi.txt b/trunk/Documentation/laptops/acer-wmi.txt index 23df051dbf69..b06696329cff 100644 --- a/trunk/Documentation/laptops/acer-wmi.txt +++ b/trunk/Documentation/laptops/acer-wmi.txt @@ -48,7 +48,7 @@ DSDT. To send me the DSDT, as root/sudo: -cat /sys/firmware/acpi/tables/DSDT > dsdt +cat /sys/firmware/acpi/DSDT > dsdt And send me the resulting 'dsdt' file. @@ -169,7 +169,7 @@ can be added to acer-wmi. The LED is exposed through the LED subsystem, and can be found in: -/sys/devices/platform/acer-wmi/leds/acer-wmi::mail/ +/sys/devices/platform/acer-wmi/leds/acer-mail:green/ The mail LED is autodetected, so if you don't have one, the LED device won't be registered. diff --git a/trunk/Documentation/power/pm.txt b/trunk/Documentation/pm.txt similarity index 99% rename from trunk/Documentation/power/pm.txt rename to trunk/Documentation/pm.txt index be841507e43f..da8589a0e07d 100644 --- a/trunk/Documentation/power/pm.txt +++ b/trunk/Documentation/pm.txt @@ -108,7 +108,7 @@ void pm_unregister_all(pm_callback cback); * EINVAL if the request is not supported * EBUSY if the device is now busy and cannot handle the request * ENOMEM if the device was unable to handle the request due to memory - * + * * Details: The device request callback will be called before the * device/system enters a suspend state (ACPI D1-D3) or * or after the device/system resumes from suspend (ACPI D0). diff --git a/trunk/Documentation/power/pm_qos_interface.txt b/trunk/Documentation/pm_qos_interface.txt similarity index 100% rename from trunk/Documentation/power/pm_qos_interface.txt rename to trunk/Documentation/pm_qos_interface.txt diff --git a/trunk/Documentation/power/00-INDEX b/trunk/Documentation/power/00-INDEX index a55d7f1c836d..8db4e41a052d 100644 --- a/trunk/Documentation/power/00-INDEX +++ b/trunk/Documentation/power/00-INDEX @@ -14,12 +14,6 @@ notifiers.txt - Registering suspend notifiers in device drivers pci.txt - How the PCI Subsystem Does Power Management -pm.txt - - info on Linux power management support. -pm_qos_interface.txt - - info on Linux PM Quality of Service interface -power_supply_class.txt - - Tells userspace about battery, UPS, AC or DC power supply properties s2ram.txt - How to get suspend to ram working (and debug it when it isn't) states.txt diff --git a/trunk/Documentation/power/power_supply_class.txt b/trunk/Documentation/power_supply_class.txt similarity index 100% rename from trunk/Documentation/power/power_supply_class.txt rename to trunk/Documentation/power_supply_class.txt diff --git a/trunk/Documentation/thermal/sysfs-api.txt b/trunk/Documentation/thermal/sysfs-api.txt index d9f28be75403..ba9c2da5a8c2 100644 --- a/trunk/Documentation/thermal/sysfs-api.txt +++ b/trunk/Documentation/thermal/sysfs-api.txt @@ -143,10 +143,10 @@ type Strings which represent the thermal zone type. This is given by thermal zone driver as part of registration. Eg: "ACPI thermal zone" indicates it's a ACPI thermal device RO - Required + Optional temp Current temperature as reported by thermal zone (sensor) - Unit: millidegree Celsius + Unit: degree Celsius RO Required @@ -163,7 +163,7 @@ mode One of the predefined values in [kernel, user] charge of the thermal management. trip_point_[0-*]_temp The temperature above which trip point will be fired - Unit: millidegree Celsius + Unit: degree Celsius RO Optional @@ -193,7 +193,7 @@ type String which represents the type of device eg. For memory controller device on intel_menlow platform: this should be "Memory controller" RO - Required + Optional max_state The maximum permissible cooling state of this cooling device. RO @@ -219,16 +219,16 @@ the sys I/F structure will be built like this: |thermal_zone1: |-----type: ACPI thermal zone - |-----temp: 37000 + |-----temp: 37 |-----mode: kernel - |-----trip_point_0_temp: 100000 + |-----trip_point_0_temp: 100 |-----trip_point_0_type: critical - |-----trip_point_1_temp: 80000 + |-----trip_point_1_temp: 80 |-----trip_point_1_type: passive - |-----trip_point_2_temp: 70000 - |-----trip_point_2_type: active0 - |-----trip_point_3_temp: 60000 - |-----trip_point_3_type: active1 + |-----trip_point_2_temp: 70 + |-----trip_point_2_type: active[0] + |-----trip_point_3_temp: 60 + |-----trip_point_3_type: active[1] |-----cdev0: --->/sys/class/thermal/cooling_device0 |-----cdev0_trip_point: 1 /* cdev0 can be used for passive */ |-----cdev1: --->/sys/class/thermal/cooling_device3 diff --git a/trunk/arch/alpha/Kconfig b/trunk/arch/alpha/Kconfig index 729cdbdf8036..002703b8c0b0 100644 --- a/trunk/arch/alpha/Kconfig +++ b/trunk/arch/alpha/Kconfig @@ -330,9 +330,6 @@ config PCI_DOMAINS config PCI_SYSCALL def_bool PCI -config IOMMU_HELPER - def_bool PCI - config ALPHA_CORE_AGP bool depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL diff --git a/trunk/arch/alpha/kernel/pci_iommu.c b/trunk/arch/alpha/kernel/pci_iommu.c index 4e1c08636edd..e07a23fc5b74 100644 --- a/trunk/arch/alpha/kernel/pci_iommu.c +++ b/trunk/arch/alpha/kernel/pci_iommu.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -126,6 +125,14 @@ iommu_arena_new(struct pci_controller *hose, dma_addr_t base, return iommu_arena_new_node(0, hose, base, window_size, align); } +static inline int is_span_boundary(unsigned int index, unsigned int nr, + unsigned long shift, + unsigned long boundary_size) +{ + shift = (shift + index) & (boundary_size - 1); + return shift + nr > boundary_size; +} + /* Must be called with the arena lock held */ static long iommu_arena_find_pages(struct device *dev, struct pci_iommu_arena *arena, @@ -140,6 +147,7 @@ iommu_arena_find_pages(struct device *dev, struct pci_iommu_arena *arena, base = arena->dma_base >> PAGE_SHIFT; if (dev) { boundary_size = dma_get_seg_boundary(dev) + 1; + BUG_ON(!is_power_of_2(boundary_size)); boundary_size >>= PAGE_SHIFT; } else { boundary_size = 1UL << (32 - PAGE_SHIFT); @@ -153,7 +161,7 @@ iommu_arena_find_pages(struct device *dev, struct pci_iommu_arena *arena, again: while (i < n && p+i < nent) { - if (!i && iommu_is_span_boundary(p, n, base, boundary_size)) { + if (!i && is_span_boundary(p, n, base, boundary_size)) { p = ALIGN(p + 1, mask + 1); goto again; } diff --git a/trunk/arch/x86/Kconfig b/trunk/arch/x86/Kconfig index 6c70fed0f9a0..237fc128143d 100644 --- a/trunk/arch/x86/Kconfig +++ b/trunk/arch/x86/Kconfig @@ -1259,7 +1259,7 @@ menuconfig APM machines with more than one CPU. In order to use APM, you will need supporting software. For location - and more information, read and the + and more information, read and the Battery Powered Linux mini-HOWTO, available from . diff --git a/trunk/drivers/acpi/Kconfig b/trunk/drivers/acpi/Kconfig index fbcaa069be86..f688c214be0c 100644 --- a/trunk/drivers/acpi/Kconfig +++ b/trunk/drivers/acpi/Kconfig @@ -283,23 +283,24 @@ config ACPI_TOSHIBA If you have a legacy free Toshiba laptop (such as the Libretto L1 series), say Y. -config ACPI_CUSTOM_DSDT_FILE - string "Custom DSDT Table file to include" - default "" +config ACPI_CUSTOM_DSDT + bool "Include Custom DSDT" depends on !STANDALONE + default n help This option supports a custom DSDT by linking it into the kernel. See Documentation/acpi/dsdt-override.txt + If unsure, say N. + +config ACPI_CUSTOM_DSDT_FILE + string "Custom DSDT Table file to include" + depends on ACPI_CUSTOM_DSDT + default "" + help Enter the full path name to the file which includes the AmlCode declaration. - If unsure, don't enter a file name. - -config ACPI_CUSTOM_DSDT - bool - default ACPI_CUSTOM_DSDT_FILE != "" - config ACPI_CUSTOM_DSDT_INITRD bool "Read Custom DSDT from initramfs" depends on BLK_DEV_INITRD diff --git a/trunk/drivers/acpi/bus.c b/trunk/drivers/acpi/bus.c index 5b6760e0f957..ce3c0a2cbac4 100644 --- a/trunk/drivers/acpi/bus.c +++ b/trunk/drivers/acpi/bus.c @@ -776,7 +776,7 @@ static int __init acpi_init(void) acpi_kobj = kobject_create_and_add("acpi", firmware_kobj); if (!acpi_kobj) { - printk(KERN_WARNING "%s: kset create error\n", __func__); + printk(KERN_WARNING "%s: kset create error\n", __FUNCTION__); acpi_kobj = NULL; } diff --git a/trunk/drivers/acpi/button.c b/trunk/drivers/acpi/button.c index 6c5da83cdb68..24a7865a57cb 100644 --- a/trunk/drivers/acpi/button.c +++ b/trunk/drivers/acpi/button.c @@ -449,7 +449,6 @@ static int acpi_button_add(struct acpi_device *device) input->phys = button->phys; input->id.bustype = BUS_HOST; input->id.product = button->type; - input->dev.parent = &device->dev; switch (button->type) { case ACPI_BUTTON_TYPE_POWER: diff --git a/trunk/drivers/acpi/ec.c b/trunk/drivers/acpi/ec.c index e7e197e3a4ff..caf873c14bfb 100644 --- a/trunk/drivers/acpi/ec.c +++ b/trunk/drivers/acpi/ec.c @@ -129,7 +129,6 @@ static struct acpi_ec { struct mutex lock; wait_queue_head_t wait; struct list_head list; - atomic_t irq_count; u8 handlers_installed; } *boot_ec, *first_ec; @@ -182,8 +181,6 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) { int ret = 0; - atomic_set(&ec->irq_count, 0); - if (unlikely(event == ACPI_EC_EVENT_OBF_1 && test_bit(EC_FLAGS_NO_OBF1_GPE, &ec->flags))) force_poll = 1; @@ -230,7 +227,6 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) while (time_before(jiffies, delay)) { if (acpi_ec_check_status(ec, event)) goto end; - msleep(5); } } pr_err(PREFIX "acpi_ec_wait timeout," @@ -533,13 +529,6 @@ static u32 acpi_ec_gpe_handler(void *data) struct acpi_ec *ec = data; pr_debug(PREFIX "~~~> interrupt\n"); - atomic_inc(&ec->irq_count); - if (atomic_read(&ec->irq_count) > 5) { - pr_err(PREFIX "GPE storm detected, disabling EC GPE\n"); - acpi_disable_gpe(NULL, ec->gpe, ACPI_ISR); - clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); - return ACPI_INTERRUPT_HANDLED; - } clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) wake_up(&ec->wait); @@ -954,7 +943,11 @@ int __init acpi_ec_ecdt_probe(void) boot_ec->command_addr = ecdt_ptr->control.address; boot_ec->data_addr = ecdt_ptr->data.address; boot_ec->gpe = ecdt_ptr->gpe; - boot_ec->handle = ACPI_ROOT_OBJECT; + if (ACPI_FAILURE(acpi_get_handle(NULL, ecdt_ptr->id, + &boot_ec->handle))) { + pr_info("Failed to locate handle for boot EC\n"); + boot_ec->handle = ACPI_ROOT_OBJECT; + } } else { /* This workaround is needed only on some broken machines, * which require early EC, but fail to provide ECDT */ diff --git a/trunk/drivers/acpi/osl.c b/trunk/drivers/acpi/osl.c index 065819ba87c7..8edba7b678eb 100644 --- a/trunk/drivers/acpi/osl.c +++ b/trunk/drivers/acpi/osl.c @@ -1237,7 +1237,7 @@ int acpi_check_resource_conflict(struct resource *res) if (clash) { if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) { - printk("%sACPI: %s resource %s [0x%llx-0x%llx]" + printk(KERN_INFO "%sACPI: %s resource %s [0x%llx-0x%llx]" " conflicts with ACPI region %s" " [0x%llx-0x%llx]\n", acpi_enforce_resources == ENFORCE_RESOURCES_LAX diff --git a/trunk/drivers/acpi/pci_irq.c b/trunk/drivers/acpi/pci_irq.c index 7af414a3c63e..7f19859580c7 100644 --- a/trunk/drivers/acpi/pci_irq.c +++ b/trunk/drivers/acpi/pci_irq.c @@ -25,7 +25,6 @@ */ -#include #include #include #include @@ -77,101 +76,6 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, return NULL; } -/* http://bugzilla.kernel.org/show_bug.cgi?id=4773 */ -static struct dmi_system_id medion_md9580[] = { - { - .ident = "Medion MD9580-F laptop", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"), - DMI_MATCH(DMI_PRODUCT_NAME, "A555"), - }, - }, - { } -}; - -/* http://bugzilla.kernel.org/show_bug.cgi?id=5044 */ -static struct dmi_system_id dell_optiplex[] = { - { - .ident = "Dell Optiplex GX1", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"), - DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex GX1 600S+"), - }, - }, - { } -}; - -/* http://bugzilla.kernel.org/show_bug.cgi?id=10138 */ -static struct dmi_system_id hp_t5710[] = { - { - .ident = "HP t5710", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), - DMI_MATCH(DMI_PRODUCT_NAME, "hp t5000 series"), - DMI_MATCH(DMI_BOARD_NAME, "098Ch"), - }, - }, - { } -}; - -struct prt_quirk { - struct dmi_system_id *system; - unsigned int segment; - unsigned int bus; - unsigned int device; - unsigned char pin; - char *source; /* according to BIOS */ - char *actual_source; -}; - -/* - * These systems have incorrect _PRT entries. The BIOS claims the PCI - * interrupt at the listed segment/bus/device/pin is connected to the first - * link device, but it is actually connected to the second. - */ -static struct prt_quirk prt_quirks[] = { - { medion_md9580, 0, 0, 9, 'A', - "\\_SB_.PCI0.ISA.LNKA", - "\\_SB_.PCI0.ISA.LNKB"}, - { dell_optiplex, 0, 0, 0xd, 'A', - "\\_SB_.LNKB", - "\\_SB_.LNKA"}, - { hp_t5710, 0, 0, 1, 'A', - "\\_SB_.PCI0.LNK1", - "\\_SB_.PCI0.LNK3"}, -}; - -static void -do_prt_fixups(struct acpi_prt_entry *entry, struct acpi_pci_routing_table *prt) -{ - int i; - struct prt_quirk *quirk; - - for (i = 0; i < ARRAY_SIZE(prt_quirks); i++) { - quirk = &prt_quirks[i]; - - /* All current quirks involve link devices, not GSIs */ - if (!prt->source) - continue; - - if (dmi_check_system(quirk->system) && - entry->id.segment == quirk->segment && - entry->id.bus == quirk->bus && - entry->id.device == quirk->device && - entry->pin + 'A' == quirk->pin && - !strcmp(prt->source, quirk->source) && - strlen(prt->source) >= strlen(quirk->actual_source)) { - printk(KERN_WARNING PREFIX "firmware reports " - "%04x:%02x:%02x[%c] connected to %s; " - "changing to %s\n", - entry->id.segment, entry->id.bus, - entry->id.device, 'A' + entry->pin, - prt->source, quirk->actual_source); - strcpy(prt->source, quirk->actual_source); - } - } -} - static int acpi_pci_irq_add_entry(acpi_handle handle, int segment, int bus, struct acpi_pci_routing_table *prt) @@ -192,8 +96,6 @@ acpi_pci_irq_add_entry(acpi_handle handle, entry->id.function = prt->address & 0xFFFF; entry->pin = prt->pin; - do_prt_fixups(entry, prt); - /* * Type 1: Dynamic * --------------- diff --git a/trunk/drivers/acpi/pci_root.c b/trunk/drivers/acpi/pci_root.c index c3fed31166b5..f14ff1ffab29 100644 --- a/trunk/drivers/acpi/pci_root.c +++ b/trunk/drivers/acpi/pci_root.c @@ -184,7 +184,7 @@ static void acpi_pci_bridge_scan(struct acpi_device *device) } } -static int __devinit acpi_pci_root_add(struct acpi_device *device) +static int acpi_pci_root_add(struct acpi_device *device) { int result = 0; struct acpi_pci_root *root = NULL; diff --git a/trunk/drivers/acpi/processor_core.c b/trunk/drivers/acpi/processor_core.c index 36a68fa114e3..a3cc8a98255c 100644 --- a/trunk/drivers/acpi/processor_core.c +++ b/trunk/drivers/acpi/processor_core.c @@ -840,19 +840,17 @@ static int is_processor_present(acpi_handle handle) status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); + /* + * if a processor object does not have an _STA object, + * OSPM assumes that the processor is present. + */ + if (status == AE_NOT_FOUND) + return 1; if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_PRESENT)) return 1; - /* - * _STA is mandatory for a processor that supports hot plug - */ - if (status == AE_NOT_FOUND) - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Processor does not support hot plug\n")); - else - ACPI_EXCEPTION((AE_INFO, status, - "Processor Device is not present")); + ACPI_EXCEPTION((AE_INFO, status, "Processor Device is not present")); return 0; } @@ -888,8 +886,8 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) return 0; } -static void __ref acpi_processor_hotplug_notify(acpi_handle handle, - u32 event, void *data) +static void +acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) { struct acpi_processor *pr; struct acpi_device *device = NULL; @@ -899,10 +897,9 @@ static void __ref acpi_processor_hotplug_notify(acpi_handle handle, switch (event) { case ACPI_NOTIFY_BUS_CHECK: case ACPI_NOTIFY_DEVICE_CHECK: - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Processor driver received %s event\n", + printk("Processor driver received %s event\n", (event == ACPI_NOTIFY_BUS_CHECK) ? - "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK")); + "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); if (!is_processor_present(handle)) break; diff --git a/trunk/drivers/acpi/scan.c b/trunk/drivers/acpi/scan.c index 57570ac47803..3fac011f9cf9 100644 --- a/trunk/drivers/acpi/scan.c +++ b/trunk/drivers/acpi/scan.c @@ -609,8 +609,7 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd) status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer); if (ACPI_SUCCESS(status)) { obj = buffer.pointer; - status = acpi_get_handle(ACPI_ROOT_OBJECT, obj->string.pointer, - ejd); + status = acpi_get_handle(NULL, obj->string.pointer, ejd); kfree(buffer.pointer); } return status; @@ -967,7 +966,7 @@ static void acpi_device_set_id(struct acpi_device *device, case ACPI_BUS_TYPE_DEVICE: status = acpi_get_object_info(handle, &buffer); if (ACPI_FAILURE(status)) { - printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__); + printk(KERN_ERR PREFIX "%s: Error reading device info\n", __FUNCTION__); return; } diff --git a/trunk/drivers/acpi/sleep/main.c b/trunk/drivers/acpi/sleep/main.c index d2f71a54726c..293a1cbb47c0 100644 --- a/trunk/drivers/acpi/sleep/main.c +++ b/trunk/drivers/acpi/sleep/main.c @@ -504,7 +504,7 @@ static void acpi_power_off_prepare(void) static void acpi_power_off(void) { /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ - printk("%s called\n", __func__); + printk("%s called\n", __FUNCTION__); local_irq_disable(); acpi_enable_wakeup_device(ACPI_STATE_S5); acpi_enter_sleep_state(ACPI_STATE_S5); diff --git a/trunk/drivers/acpi/system.c b/trunk/drivers/acpi/system.c index 4749f379a915..55cf4c05bb74 100644 --- a/trunk/drivers/acpi/system.c +++ b/trunk/drivers/acpi/system.c @@ -319,7 +319,7 @@ void acpi_irq_stats_init(void) goto fail; for (i = 0; i < num_counters; ++i) { - char buffer[12]; + char buffer[10]; char *name; if (i < num_gpes) diff --git a/trunk/drivers/acpi/thermal.c b/trunk/drivers/acpi/thermal.c index c4e00ac8ea85..8d4b79b4f933 100644 --- a/trunk/drivers/acpi/thermal.c +++ b/trunk/drivers/acpi/thermal.c @@ -879,8 +879,6 @@ static void acpi_thermal_check(void *data) } /* sys I/F for generic thermal sysfs support */ -#define KELVIN_TO_MILLICELSIUS(t) (t * 100 - 273200) - static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) { struct acpi_thermal *tz = thermal->devdata; @@ -888,7 +886,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) if (!tz) return -EINVAL; - return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature)); + return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS(tz->temperature)); } static const char enabled[] = "kernel"; @@ -982,21 +980,21 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, if (tz->trips.critical.flags.valid) { if (!trip) - return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS( + return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( tz->trips.critical.temperature)); trip--; } if (tz->trips.hot.flags.valid) { if (!trip) - return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS( + return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( tz->trips.hot.temperature)); trip--; } if (tz->trips.passive.flags.valid) { if (!trip) - return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS( + return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( tz->trips.passive.temperature)); trip--; } @@ -1004,7 +1002,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && tz->trips.active[i].flags.valid; i++) { if (!trip) - return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS( + return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( tz->trips.active[i].temperature)); trip--; } diff --git a/trunk/drivers/acpi/toshiba_acpi.c b/trunk/drivers/acpi/toshiba_acpi.c index 0a43c8e0eff3..9e8c20c6a0b7 100644 --- a/trunk/drivers/acpi/toshiba_acpi.c +++ b/trunk/drivers/acpi/toshiba_acpi.c @@ -99,13 +99,6 @@ MODULE_LICENSE("GPL"); #define HCI_VIDEO_OUT_CRT 0x2 #define HCI_VIDEO_OUT_TV 0x4 -static const struct acpi_device_id toshiba_device_ids[] = { - {"TOS6200", 0}, - {"TOS1900", 0}, - {"", 0}, -}; -MODULE_DEVICE_TABLE(acpi, toshiba_device_ids); - /* utility */ diff --git a/trunk/drivers/acpi/utilities/utdebug.c b/trunk/drivers/acpi/utilities/utdebug.c index 7361204b1eef..c7e128e5369b 100644 --- a/trunk/drivers/acpi/utilities/utdebug.c +++ b/trunk/drivers/acpi/utilities/utdebug.c @@ -109,7 +109,7 @@ void acpi_ut_track_stack_ptr(void) * RETURN: Updated pointer to the function name * * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. - * This allows compiler macros such as __func__ to be used + * This allows compiler macros such as __FUNCTION__ to be used * with no change to the debug output. * ******************************************************************************/ diff --git a/trunk/drivers/acpi/utilities/utobject.c b/trunk/drivers/acpi/utilities/utobject.c index e08b3fa6639f..76ee766c84f9 100644 --- a/trunk/drivers/acpi/utilities/utobject.c +++ b/trunk/drivers/acpi/utilities/utobject.c @@ -432,7 +432,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, * element -- which is legal) */ if (!internal_object) { - *obj_length = sizeof(union acpi_object); + *obj_length = 0; return_ACPI_STATUS(AE_OK); } diff --git a/trunk/drivers/acpi/utils.c b/trunk/drivers/acpi/utils.c index 44ea60cf21c0..eba55b7d6c95 100644 --- a/trunk/drivers/acpi/utils.c +++ b/trunk/drivers/acpi/utils.c @@ -407,12 +407,6 @@ acpi_evaluate_reference(acpi_handle handle, break; } - if (!element->reference.handle) { - printk(KERN_WARNING PREFIX "Invalid reference in" - " package %s\n", pathname); - status = AE_NULL_ENTRY; - break; - } /* Get the acpi_handle. */ list->handles[i] = element->reference.handle; diff --git a/trunk/drivers/acpi/video.c b/trunk/drivers/acpi/video.c index 1bc0c74f2755..12cce69b5441 100644 --- a/trunk/drivers/acpi/video.c +++ b/trunk/drivers/acpi/video.c @@ -713,7 +713,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) kfree(obj); - if (device->cap._BCL && device->cap._BCM && max_level > 0) { + if (device->cap._BCL && device->cap._BCM && device->cap._BQC && max_level > 0){ int result; static int count = 0; char *name; @@ -1201,7 +1201,7 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset) if (!video) goto end; - printk(KERN_INFO PREFIX "Please implement %s\n", __func__); + printk(KERN_INFO PREFIX "Please implement %s\n", __FUNCTION__); seq_printf(seq, "\n"); end: diff --git a/trunk/drivers/acpi/wmi.c b/trunk/drivers/acpi/wmi.c index c33b1c6e93b1..efacc9f8bfe3 100644 --- a/trunk/drivers/acpi/wmi.c +++ b/trunk/drivers/acpi/wmi.c @@ -293,7 +293,7 @@ struct acpi_buffer *out) { struct guid_block *block = NULL; struct wmi_block *wblock = NULL; - acpi_handle handle, wc_handle; + acpi_handle handle; acpi_status status, wc_status = AE_ERROR; struct acpi_object_list input, wc_input; union acpi_object wc_params[1], wq_params[1]; @@ -338,10 +338,8 @@ struct acpi_buffer *out) * expensive, but have no corresponding WCxx method. So we * should not fail if this happens. */ - wc_status = acpi_get_handle(handle, wc_method, &wc_handle); - if (ACPI_SUCCESS(wc_status)) - wc_status = acpi_evaluate_object(handle, wc_method, - &wc_input, NULL); + wc_status = acpi_evaluate_object(handle, wc_method, + &wc_input, NULL); } strcpy(method, "WQ"); @@ -353,7 +351,7 @@ struct acpi_buffer *out) * If ACPI_WMI_EXPENSIVE, call the relevant WCxx method, even if * the WQxx method failed - we should disable collection anyway. */ - if ((block->flags & ACPI_WMI_EXPENSIVE) && ACPI_SUCCESS(wc_status)) { + if ((block->flags & ACPI_WMI_EXPENSIVE) && wc_status) { wc_params[0].integer.value = 0; status = acpi_evaluate_object(handle, wc_method, &wc_input, NULL); diff --git a/trunk/drivers/block/floppy.c b/trunk/drivers/block/floppy.c index 7652e87d60c5..32c79a55511b 100644 --- a/trunk/drivers/block/floppy.c +++ b/trunk/drivers/block/floppy.c @@ -217,6 +217,7 @@ static int use_virtual_dma; */ static DEFINE_SPINLOCK(floppy_lock); +static struct completion device_release; static unsigned short virtual_dma_port = 0x3f0; irqreturn_t floppy_interrupt(int irq, void *dev_id); @@ -4143,6 +4144,7 @@ DEVICE_ATTR(cmos,S_IRUGO,floppy_cmos_show,NULL); static void floppy_device_release(struct device *dev) { + complete(&device_release); } static struct platform_device floppy_device[N_DRIVE]; @@ -4537,6 +4539,7 @@ void cleanup_module(void) { int drive; + init_completion(&device_release); blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); unregister_blkdev(FLOPPY_MAJOR, "fd"); @@ -4561,6 +4564,8 @@ void cleanup_module(void) /* eject disk, if any */ fd_eject(0); + + wait_for_completion(&device_release); } module_param(floppy, charp, 0); diff --git a/trunk/drivers/char/riscom8.c b/trunk/drivers/char/riscom8.c index 3f9d0a9ac36d..589ac6f65b9a 100644 --- a/trunk/drivers/char/riscom8.c +++ b/trunk/drivers/char/riscom8.c @@ -1709,7 +1709,7 @@ static int __init riscom8_init_module (void) if (iobase || iobase1 || iobase2 || iobase3) { for(i = 0; i < RC_NBOARD; i++) - rc_board[i].base = 0; + rc_board[0].base = 0; } if (iobase) diff --git a/trunk/drivers/dma/fsldma.c b/trunk/drivers/dma/fsldma.c index cc9a68158d99..5dfedf326573 100644 --- a/trunk/drivers/dma/fsldma.c +++ b/trunk/drivers/dma/fsldma.c @@ -57,12 +57,12 @@ static void dma_init(struct fsl_dma_chan *fsl_chan) } -static void set_sr(struct fsl_dma_chan *fsl_chan, dma_addr_t val) +static void set_sr(struct fsl_dma_chan *fsl_chan, u32 val) { DMA_OUT(fsl_chan, &fsl_chan->reg_base->sr, val, 32); } -static dma_addr_t get_sr(struct fsl_dma_chan *fsl_chan) +static u32 get_sr(struct fsl_dma_chan *fsl_chan) { return DMA_IN(fsl_chan, &fsl_chan->reg_base->sr, 32); } @@ -436,7 +436,7 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy( dev_dbg(fsl_chan->dev, "new link desc alloc %p\n", new); #endif - copy = min(len, FSL_DMA_BCR_MAX_CNT); + copy = min(len, (size_t)FSL_DMA_BCR_MAX_CNT); set_desc_cnt(fsl_chan, &new->hw, copy); set_desc_src(fsl_chan, &new->hw, dma_src); @@ -581,8 +581,8 @@ static void fsl_chan_xfer_ld_queue(struct fsl_dma_chan *fsl_chan) if (ld_node != &fsl_chan->ld_queue) { /* Get the ld start address from ld_queue */ next_dest_addr = to_fsl_desc(ld_node)->async_tx.phys; - dev_dbg(fsl_chan->dev, "xfer LDs staring from 0x%016llx\n", - (u64)next_dest_addr); + dev_dbg(fsl_chan->dev, "xfer LDs staring from %p\n", + (void *)next_dest_addr); set_cdar(fsl_chan, next_dest_addr); dma_start(fsl_chan); } else { @@ -662,7 +662,7 @@ static enum dma_status fsl_dma_is_complete(struct dma_chan *chan, static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data) { struct fsl_dma_chan *fsl_chan = (struct fsl_dma_chan *)data; - dma_addr_t stat; + u32 stat; stat = get_sr(fsl_chan); dev_dbg(fsl_chan->dev, "event: channel %d, stat = 0x%x\n", @@ -681,9 +681,8 @@ static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data) */ if (stat & FSL_DMA_SR_EOSI) { dev_dbg(fsl_chan->dev, "event: End-of-segments INT\n"); - dev_dbg(fsl_chan->dev, "event: clndar 0x%016llx, " - "nlndar 0x%016llx\n", (u64)get_cdar(fsl_chan), - (u64)get_ndar(fsl_chan)); + dev_dbg(fsl_chan->dev, "event: clndar %p, nlndar %p\n", + (void *)get_cdar(fsl_chan), (void *)get_ndar(fsl_chan)); stat &= ~FSL_DMA_SR_EOSI; } @@ -726,12 +725,15 @@ static void dma_do_tasklet(unsigned long data) fsl_chan_ld_cleanup(fsl_chan); } +#ifdef FSL_DMA_CALLBACKTEST static void fsl_dma_callback_test(struct fsl_dma_chan *fsl_chan) { if (fsl_chan) dev_info(fsl_chan->dev, "selftest: callback is ok!\n"); } +#endif +#ifdef CONFIG_FSL_DMA_SELFTEST static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan) { struct dma_chan *chan; @@ -837,9 +839,9 @@ static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan) if (err) { for (i = 0; (*(src + i) == *(dest + i)) && (i < test_size); i++); - dev_err(fsl_chan->dev, "selftest: Test failed, data %d/%d is " + dev_err(fsl_chan->dev, "selftest: Test failed, data %d/%ld is " "error! src 0x%x, dest 0x%x\n", - i, test_size, *(src + i), *(dest + i)); + i, (long)test_size, *(src + i), *(dest + i)); } free_resources: @@ -848,6 +850,7 @@ static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan) kfree(src); return err; } +#endif static int __devinit of_fsl_dma_chan_probe(struct of_device *dev, const struct of_device_id *match) @@ -1008,8 +1011,8 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev, } dev_info(&dev->dev, "Probe the Freescale DMA driver for %s " - "controller at 0x%08x...\n", - match->compatible, fdev->reg.start); + "controller at %p...\n", + match->compatible, (void *)fdev->reg.start); fdev->reg_base = ioremap(fdev->reg.start, fdev->reg.end - fdev->reg.start + 1); diff --git a/trunk/drivers/misc/Kconfig b/trunk/drivers/misc/Kconfig index 962817e49fba..982e27b86d10 100644 --- a/trunk/drivers/misc/Kconfig +++ b/trunk/drivers/misc/Kconfig @@ -108,7 +108,6 @@ config ACER_WMI depends on ACPI depends on LEDS_CLASS depends on BACKLIGHT_CLASS_DEVICE - depends on SERIO_I8042 select ACPI_WMI ---help--- This is a driver for newer Acer (and Wistron) laptops. It adds diff --git a/trunk/drivers/misc/acer-wmi.c b/trunk/drivers/misc/acer-wmi.c index dd13a3749927..74d12b4a3abd 100644 --- a/trunk/drivers/misc/acer-wmi.c +++ b/trunk/drivers/misc/acer-wmi.c @@ -217,15 +217,6 @@ static struct dmi_system_id acer_quirks[] = { }, .driver_data = &quirk_acer_travelmate_2490, }, - { - .callback = dmi_matched, - .ident = "Acer Aspire 3610", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Acer"), - DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 3610"), - }, - .driver_data = &quirk_acer_travelmate_2490, - }, { .callback = dmi_matched, .ident = "Acer Aspire 5100", @@ -235,15 +226,6 @@ static struct dmi_system_id acer_quirks[] = { }, .driver_data = &quirk_acer_travelmate_2490, }, - { - .callback = dmi_matched, - .ident = "Acer Aspire 5610", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Acer"), - DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"), - }, - .driver_data = &quirk_acer_travelmate_2490, - }, { .callback = dmi_matched, .ident = "Acer Aspire 5630", @@ -779,11 +761,11 @@ enum led_brightness value) } static struct led_classdev mail_led = { - .name = "acer-wmi::mail", + .name = "acer-mail:green", .brightness_set = mail_led_set, }; -static int __devinit acer_led_init(struct device *dev) +static int __init acer_led_init(struct device *dev) { return led_classdev_register(dev, &mail_led); } @@ -816,7 +798,7 @@ static struct backlight_ops acer_bl_ops = { .update_status = update_bl_status, }; -static int __devinit acer_backlight_init(struct device *dev) +static int __init acer_backlight_init(struct device *dev) { struct backlight_device *bd; @@ -835,7 +817,7 @@ static int __devinit acer_backlight_init(struct device *dev) return 0; } -static void acer_backlight_exit(void) +static void __exit acer_backlight_exit(void) { backlight_device_unregister(acer_backlight_device); } @@ -1070,12 +1052,11 @@ static int __init acer_wmi_init(void) if (wmi_has_guid(WMID_GUID2) && interface) { if (ACPI_FAILURE(WMID_set_capabilities())) { - printk(ACER_ERR "Unable to detect available WMID " - "devices\n"); + printk(ACER_ERR "Unable to detect available devices\n"); return -ENODEV; } } else if (!wmi_has_guid(WMID_GUID2) && interface) { - printk(ACER_ERR "No WMID device detection method found\n"); + printk(ACER_ERR "Unable to detect available devices\n"); return -ENODEV; } @@ -1083,20 +1064,21 @@ static int __init acer_wmi_init(void) interface = &AMW0_interface; if (ACPI_FAILURE(AMW0_set_capabilities())) { - printk(ACER_ERR "Unable to detect available AMW0 " - "devices\n"); + printk(ACER_ERR "Unable to detect available devices\n"); return -ENODEV; } } - if (wmi_has_guid(AMW0_GUID1)) - AMW0_find_mailled(); + if (wmi_has_guid(AMW0_GUID1)) { + if (ACPI_FAILURE(AMW0_find_mailled())) + printk(ACER_ERR "Unable to detect mail LED\n"); + } find_quirks(); if (!interface) { - printk(ACER_ERR "No or unsupported WMI interface, unable to " - "load\n"); + printk(ACER_ERR "No or unsupported WMI interface, unable to "); + printk(KERN_CONT "load.\n"); return -ENODEV; } diff --git a/trunk/drivers/misc/sony-laptop.c b/trunk/drivers/misc/sony-laptop.c index 02ff3d19b1cc..899e3f75f288 100644 --- a/trunk/drivers/misc/sony-laptop.c +++ b/trunk/drivers/misc/sony-laptop.c @@ -315,7 +315,7 @@ static void sony_laptop_report_input_event(u8 event) break; default: - if (event >= ARRAY_SIZE(sony_laptop_input_index)) { + if (event > ARRAY_SIZE(sony_laptop_input_index)) { dprintk("sony_laptop_report_input_event, event not known: %d\n", event); break; } diff --git a/trunk/drivers/pci/bus.c b/trunk/drivers/pci/bus.c index d708358326e5..6a9403d79e0c 100644 --- a/trunk/drivers/pci/bus.c +++ b/trunk/drivers/pci/bus.c @@ -143,18 +143,14 @@ void pci_bus_add_devices(struct pci_bus *bus) /* register the bus with sysfs as the parent is now * properly registered. */ child_bus = dev->subordinate; - if (child_bus->is_added) - continue; child_bus->dev.parent = child_bus->bridge; retval = device_register(&child_bus->dev); if (retval) dev_err(&dev->dev, "Error registering pci_bus," " continuing...\n"); - else { - child_bus->is_added = 1; + else retval = device_create_file(&child_bus->dev, &dev_attr_cpuaffinity); - } if (retval) dev_err(&dev->dev, "Error creating cpuaffinity" " file, continuing...\n"); diff --git a/trunk/drivers/pci/pci-acpi.c b/trunk/drivers/pci/pci-acpi.c index 72f7476930c8..4a23654184fc 100644 --- a/trunk/drivers/pci/pci-acpi.c +++ b/trunk/drivers/pci/pci-acpi.c @@ -272,29 +272,21 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) { acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); acpi_handle tmp; - static const u8 state_conv[] = { - [PCI_D0] = ACPI_STATE_D0, - [PCI_D1] = ACPI_STATE_D1, - [PCI_D2] = ACPI_STATE_D2, - [PCI_D3hot] = ACPI_STATE_D3, - [PCI_D3cold] = ACPI_STATE_D3 + static int state_conv[] = { + [0] = 0, + [1] = 1, + [2] = 2, + [3] = 3, + [4] = 3 }; + int acpi_state = state_conv[(int __force) state]; if (!handle) return -ENODEV; /* If the ACPI device has _EJ0, ignore the device */ if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) return 0; - - switch (state) { - case PCI_D0: - case PCI_D1: - case PCI_D2: - case PCI_D3hot: - case PCI_D3cold: - return acpi_bus_set_power(handle, state_conv[state]); - } - return -EINVAL; + return acpi_bus_set_power(handle, acpi_state); } diff --git a/trunk/drivers/spi/au1550_spi.c b/trunk/drivers/spi/au1550_spi.c index 41a3d00c4515..c47a650183a1 100644 --- a/trunk/drivers/spi/au1550_spi.c +++ b/trunk/drivers/spi/au1550_spi.c @@ -99,7 +99,7 @@ static dbdev_tab_t au1550_spi_mem_dbdev = static void au1550_spi_bits_handlers_set(struct au1550_spi *hw, int bpw); -/* +/** * compute BRG and DIV bits to setup spi clock based on main input clock rate * that was specified in platform data structure * according to au1550 datasheet: @@ -650,7 +650,7 @@ static int au1550_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) return hw->txrx_bufs(spi, t); } -static irqreturn_t au1550_spi_irq(int irq, void *dev) +static irqreturn_t au1550_spi_irq(int irq, void *dev, struct pt_regs *regs) { struct au1550_spi *hw = dev; return hw->irq_callback(hw); diff --git a/trunk/drivers/spi/spi_bitbang.c b/trunk/drivers/spi/spi_bitbang.c index 71e881419cdd..f7f8580edad8 100644 --- a/trunk/drivers/spi/spi_bitbang.c +++ b/trunk/drivers/spi/spi_bitbang.c @@ -344,14 +344,12 @@ static void bitbang_work(struct work_struct *work) t->rx_dma = t->tx_dma = 0; status = bitbang->txrx_bufs(spi, t); } - if (status > 0) - m->actual_length += status; if (status != t->len) { - /* always report some kind of error */ - if (status >= 0) - status = -EREMOTEIO; + if (status > 0) + status = -EMSGSIZE; break; } + m->actual_length += status; status = 0; /* protocol tweaks before next transfer */ diff --git a/trunk/drivers/thermal/Kconfig b/trunk/drivers/thermal/Kconfig index 3ab313ed441c..69f19f224875 100644 --- a/trunk/drivers/thermal/Kconfig +++ b/trunk/drivers/thermal/Kconfig @@ -4,7 +4,6 @@ menuconfig THERMAL bool "Generic Thermal sysfs driver" - select HWMON default y help Generic Thermal Sysfs driver offers a generic mechanism for diff --git a/trunk/drivers/thermal/thermal.c b/trunk/drivers/thermal/thermal.c index 41bd4c805ace..8b86e53ccf7a 100644 --- a/trunk/drivers/thermal/thermal.c +++ b/trunk/drivers/thermal/thermal.c @@ -30,10 +30,8 @@ #include #include #include -#include -#include -MODULE_AUTHOR("Zhang Rui"); +MODULE_AUTHOR("Zhang Rui") MODULE_DESCRIPTION("Generic thermal management sysfs support"); MODULE_LICENSE("GPL"); @@ -58,9 +56,6 @@ static LIST_HEAD(thermal_tz_list); static LIST_HEAD(thermal_cdev_list); static DEFINE_MUTEX(thermal_list_lock); -static struct device *thermal_hwmon; -#define MAX_THERMAL_ZONES 10 - static int get_idr(struct idr *idr, struct mutex *lock, int *id) { int err; @@ -92,67 +87,7 @@ static void release_idr(struct idr *idr, struct mutex *lock, int id) mutex_unlock(lock); } -/* hwmon sys I/F*/ -static ssize_t -name_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - return sprintf(buf, "thermal_sys_class\n"); -} - -static ssize_t -temp_input_show(struct device *dev, struct device_attribute *attr, char *buf) -{ - struct thermal_zone_device *tz; - struct sensor_device_attribute *sensor_attr - = to_sensor_dev_attr(attr); - - list_for_each_entry(tz, &thermal_tz_list, node) - if (tz->id == sensor_attr->index) - return tz->ops->get_temp(tz, buf); - - return -ENODEV; -} - -static ssize_t -temp_crit_show(struct device *dev, struct device_attribute *attr, - char *buf) -{ - struct thermal_zone_device *tz; - struct sensor_device_attribute *sensor_attr - = to_sensor_dev_attr(attr); - - list_for_each_entry(tz, &thermal_tz_list, node) - if (tz->id == sensor_attr->index) - return tz->ops->get_trip_temp(tz, 0, buf); - - return -ENODEV; -} - -static DEVICE_ATTR(name, 0444, name_show, NULL); -static struct sensor_device_attribute sensor_attrs[] = { - SENSOR_ATTR(temp1_input, 0444, temp_input_show, NULL, 0), - SENSOR_ATTR(temp1_crit, 0444, temp_crit_show, NULL, 0), - SENSOR_ATTR(temp2_input, 0444, temp_input_show, NULL, 1), - SENSOR_ATTR(temp2_crit, 0444, temp_crit_show, NULL, 1), - SENSOR_ATTR(temp3_input, 0444, temp_input_show, NULL, 2), - SENSOR_ATTR(temp3_crit, 0444, temp_crit_show, NULL, 2), - SENSOR_ATTR(temp4_input, 0444, temp_input_show, NULL, 3), - SENSOR_ATTR(temp4_crit, 0444, temp_crit_show, NULL, 3), - SENSOR_ATTR(temp5_input, 0444, temp_input_show, NULL, 4), - SENSOR_ATTR(temp5_crit, 0444, temp_crit_show, NULL, 4), - SENSOR_ATTR(temp6_input, 0444, temp_input_show, NULL, 5), - SENSOR_ATTR(temp6_crit, 0444, temp_crit_show, NULL, 5), - SENSOR_ATTR(temp7_input, 0444, temp_input_show, NULL, 6), - SENSOR_ATTR(temp7_crit, 0444, temp_crit_show, NULL, 6), - SENSOR_ATTR(temp8_input, 0444, temp_input_show, NULL, 7), - SENSOR_ATTR(temp8_crit, 0444, temp_crit_show, NULL, 7), - SENSOR_ATTR(temp9_input, 0444, temp_input_show, NULL, 8), - SENSOR_ATTR(temp9_crit, 0444, temp_crit_show, NULL, 8), - SENSOR_ATTR(temp10_input, 0444, temp_input_show, NULL, 9), - SENSOR_ATTR(temp10_crit, 0444, temp_crit_show, NULL, 9), -}; - -/* thermal zone sys I/F */ +/* sys I/F for thermal zone */ #define to_thermal_zone(_dev) \ container_of(_dev, struct thermal_zone_device, device) @@ -279,7 +214,7 @@ do { \ device_remove_file(_dev, &trip_point_attrs[_index * 2 + 1]); \ } while (0) -/* cooling device sys I/F */ +/* sys I/F for cooling device */ #define to_cooling_device(_dev) \ container_of(_dev, struct thermal_cooling_device, device) @@ -512,9 +447,6 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type, struct thermal_zone_device *pos; int result; - if (!type) - return ERR_PTR(-EINVAL); - if (strlen(type) >= THERMAL_NAME_LENGTH) return ERR_PTR(-EINVAL); @@ -545,9 +477,11 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type, } /* sys I/F */ - result = device_create_file(&cdev->device, &dev_attr_cdev_type); - if (result) - goto unregister; + if (type) { + result = device_create_file(&cdev->device, &dev_attr_cdev_type); + if (result) + goto unregister; + } result = device_create_file(&cdev->device, &dev_attr_max_state); if (result) @@ -613,8 +547,8 @@ void thermal_cooling_device_unregister(struct tz->ops->unbind(tz, cdev); } mutex_unlock(&thermal_list_lock); - - device_remove_file(&cdev->device, &dev_attr_cdev_type); + if (cdev->type[0]) + device_remove_file(&cdev->device, &dev_attr_cdev_type); device_remove_file(&cdev->device, &dev_attr_max_state); device_remove_file(&cdev->device, &dev_attr_cur_state); @@ -646,9 +580,6 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, int result; int count; - if (!type) - return ERR_PTR(-EINVAL); - if (strlen(type) >= THERMAL_NAME_LENGTH) return ERR_PTR(-EINVAL); @@ -670,13 +601,6 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, kfree(tz); return ERR_PTR(result); } - if (tz->id >= MAX_THERMAL_ZONES) { - printk(KERN_ERR PREFIX - "Too many thermal zones\n"); - release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); - kfree(tz); - return ERR_PTR(-EINVAL); - } strcpy(tz->type, type); tz->ops = ops; @@ -691,27 +615,12 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, return ERR_PTR(result); } - /* hwmon sys I/F */ - result = device_create_file(thermal_hwmon, - &sensor_attrs[tz->id * 2].dev_attr); - if (result) - goto unregister; - - if (trips > 0) { - char buf[40]; - result = tz->ops->get_trip_type(tz, 0, buf); - if (result > 0 && !strcmp(buf, "critical\n")) { - result = device_create_file(thermal_hwmon, - &sensor_attrs[tz->id * 2 + 1].dev_attr); - if (result) - goto unregister; - } - } - /* sys I/F */ - result = device_create_file(&tz->device, &dev_attr_type); - if (result) - goto unregister; + if (type) { + result = device_create_file(&tz->device, &dev_attr_type); + if (result) + goto unregister; + } result = device_create_file(&tz->device, &dev_attr_temp); if (result) @@ -778,17 +687,8 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) tz->ops->unbind(tz, cdev); mutex_unlock(&thermal_list_lock); - device_remove_file(thermal_hwmon, - &sensor_attrs[tz->id * 2].dev_attr); - if (tz->trips > 0) { - char buf[40]; - if (tz->ops->get_trip_type(tz, 0, buf) > 0) - if (!strcmp(buf, "critical\n")) - device_remove_file(thermal_hwmon, - &sensor_attrs[tz->id * 2 + 1].dev_attr); - } - - device_remove_file(&tz->device, &dev_attr_type); + if (tz->type[0]) + device_remove_file(&tz->device, &dev_attr_type); device_remove_file(&tz->device, &dev_attr_temp); if (tz->ops->get_mode) device_remove_file(&tz->device, &dev_attr_mode); @@ -805,19 +705,6 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) EXPORT_SYMBOL(thermal_zone_device_unregister); -static void thermal_exit(void) -{ - if (thermal_hwmon) { - device_remove_file(thermal_hwmon, &dev_attr_name); - hwmon_device_unregister(thermal_hwmon); - } - class_unregister(&thermal_class); - idr_destroy(&thermal_tz_idr); - idr_destroy(&thermal_cdev_idr); - mutex_destroy(&thermal_idr_lock); - mutex_destroy(&thermal_list_lock); -} - static int __init thermal_init(void) { int result = 0; @@ -829,21 +716,17 @@ static int __init thermal_init(void) mutex_destroy(&thermal_idr_lock); mutex_destroy(&thermal_list_lock); } - - thermal_hwmon = hwmon_device_register(NULL); - if (IS_ERR(thermal_hwmon)) { - result = PTR_ERR(thermal_hwmon); - thermal_hwmon = NULL; - printk(KERN_ERR PREFIX - "unable to register hwmon device\n"); - thermal_exit(); - return result; - } - - result = device_create_file(thermal_hwmon, &dev_attr_name); - return result; } +static void __exit thermal_exit(void) +{ + class_unregister(&thermal_class); + idr_destroy(&thermal_tz_idr); + idr_destroy(&thermal_cdev_idr); + mutex_destroy(&thermal_idr_lock); + mutex_destroy(&thermal_list_lock); +} + subsys_initcall(thermal_init); module_exit(thermal_exit); diff --git a/trunk/fs/proc/task_mmu.c b/trunk/fs/proc/task_mmu.c index 4206454734e0..6dc0334815f7 100644 --- a/trunk/fs/proc/task_mmu.c +++ b/trunk/fs/proc/task_mmu.c @@ -640,17 +640,17 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, ret = -EACCES; if (!ptrace_may_attach(task)) - goto out_task; + goto out; ret = -EINVAL; /* file position must be aligned */ if (*ppos % PM_ENTRY_BYTES) - goto out_task; + goto out; ret = 0; mm = get_task_mm(task); if (!mm) - goto out_task; + goto out; ret = -ENOMEM; uaddr = (unsigned long)buf & PAGE_MASK; @@ -658,7 +658,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, pagecount = (PAGE_ALIGN(uend) - uaddr) / PAGE_SIZE; pages = kmalloc(pagecount * sizeof(struct page *), GFP_KERNEL); if (!pages) - goto out_mm; + goto out_task; down_read(¤t->mm->mmap_sem); ret = get_user_pages(current, current->mm, uaddr, pagecount, @@ -668,12 +668,6 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, if (ret < 0) goto out_free; - if (ret != pagecount) { - pagecount = ret; - ret = -EFAULT; - goto out_pages; - } - pm.out = buf; pm.end = buf + count; @@ -705,17 +699,15 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, ret = pm.out - buf; } -out_pages: for (; pagecount; pagecount--) { page = pages[pagecount-1]; if (!PageReserved(page)) SetPageDirty(page); page_cache_release(page); } + mmput(mm); out_free: kfree(pages); -out_mm: - mmput(mm); out_task: put_task_struct(task); out: diff --git a/trunk/include/asm-h8300/uaccess.h b/trunk/include/asm-h8300/uaccess.h index 356068cd0879..a22350ec271a 100644 --- a/trunk/include/asm-h8300/uaccess.h +++ b/trunk/include/asm-h8300/uaccess.h @@ -91,19 +91,22 @@ extern int __put_user_bad(void); #define get_user(x, ptr) \ ({ \ int __gu_err = 0; \ - typeof(*(ptr)) __gu_val = *ptr; \ + uint32_t __gu_val = 0; \ switch (sizeof(*(ptr))) { \ case 1: \ case 2: \ case 4: \ - case 8: \ + __gu_val = *(ptr); \ + break; \ + case 8: \ + memcpy(&__gu_val, ptr, sizeof (*(ptr))); \ break; \ default: \ - __gu_err = __get_user_bad(); \ __gu_val = 0; \ + __gu_err = __get_user_bad(); \ break; \ } \ - (x) = __gu_val; \ + (x) = (typeof(*(ptr)))__gu_val; \ __gu_err; \ }) #define __get_user(x, ptr) get_user(x, ptr) diff --git a/trunk/include/linux/pci.h b/trunk/include/linux/pci.h index 9010f5458767..38eff1947750 100644 --- a/trunk/include/linux/pci.h +++ b/trunk/include/linux/pci.h @@ -278,7 +278,6 @@ struct pci_bus { struct device dev; struct bin_attribute *legacy_io; /* legacy I/O for this bus */ struct bin_attribute *legacy_mem; /* legacy mem */ - unsigned int is_added:1; }; #define pci_bus_b(n) list_entry(n, struct pci_bus, node) diff --git a/trunk/kernel/power/Kconfig b/trunk/kernel/power/Kconfig index 6233f3b4ae66..79833170bb9c 100644 --- a/trunk/kernel/power/Kconfig +++ b/trunk/kernel/power/Kconfig @@ -190,7 +190,7 @@ config APM_EMULATION notification of APM "events" (e.g. battery status change). In order to use APM, you will need supporting software. For location - and more information, read and the + and more information, read and the Battery Powered Linux mini-HOWTO, available from . diff --git a/trunk/kernel/power/snapshot.c b/trunk/kernel/power/snapshot.c index 5f91a07c4eac..72a020cabb4c 100644 --- a/trunk/kernel/power/snapshot.c +++ b/trunk/kernel/power/snapshot.c @@ -447,7 +447,7 @@ static void memory_bm_free(struct memory_bitmap *bm, int clear_nosave_free) * of @bm->cur_zone_bm are updated. */ -static int memory_bm_find_bit(struct memory_bitmap *bm, unsigned long pfn, +static void memory_bm_find_bit(struct memory_bitmap *bm, unsigned long pfn, void **addr, unsigned int *bit_nr) { struct zone_bitmap *zone_bm; @@ -461,8 +461,7 @@ static int memory_bm_find_bit(struct memory_bitmap *bm, unsigned long pfn, while (pfn < zone_bm->start_pfn || pfn >= zone_bm->end_pfn) { zone_bm = zone_bm->next; - if (!zone_bm) - return -EFAULT; + BUG_ON(!zone_bm); } bm->cur.zone_bm = zone_bm; } @@ -480,40 +479,23 @@ static int memory_bm_find_bit(struct memory_bitmap *bm, unsigned long pfn, pfn -= bb->start_pfn; *bit_nr = pfn % BM_BITS_PER_CHUNK; *addr = bb->data + pfn / BM_BITS_PER_CHUNK; - return 0; } static void memory_bm_set_bit(struct memory_bitmap *bm, unsigned long pfn) { void *addr; unsigned int bit; - int error; - error = memory_bm_find_bit(bm, pfn, &addr, &bit); - BUG_ON(error); + memory_bm_find_bit(bm, pfn, &addr, &bit); set_bit(bit, addr); } -static int mem_bm_set_bit_check(struct memory_bitmap *bm, unsigned long pfn) -{ - void *addr; - unsigned int bit; - int error; - - error = memory_bm_find_bit(bm, pfn, &addr, &bit); - if (!error) - set_bit(bit, addr); - return error; -} - static void memory_bm_clear_bit(struct memory_bitmap *bm, unsigned long pfn) { void *addr; unsigned int bit; - int error; - error = memory_bm_find_bit(bm, pfn, &addr, &bit); - BUG_ON(error); + memory_bm_find_bit(bm, pfn, &addr, &bit); clear_bit(bit, addr); } @@ -521,10 +503,8 @@ static int memory_bm_test_bit(struct memory_bitmap *bm, unsigned long pfn) { void *addr; unsigned int bit; - int error; - error = memory_bm_find_bit(bm, pfn, &addr, &bit); - BUG_ON(error); + memory_bm_find_bit(bm, pfn, &addr, &bit); return test_bit(bit, addr); } @@ -729,15 +709,8 @@ static void mark_nosave_pages(struct memory_bitmap *bm) region->end_pfn << PAGE_SHIFT); for (pfn = region->start_pfn; pfn < region->end_pfn; pfn++) - if (pfn_valid(pfn)) { - /* - * It is safe to ignore the result of - * mem_bm_set_bit_check() here, since we won't - * touch the PFNs for which the error is - * returned anyway. - */ - mem_bm_set_bit_check(bm, pfn); - } + if (pfn_valid(pfn)) + memory_bm_set_bit(bm, pfn); } } diff --git a/trunk/lib/swiotlb.c b/trunk/lib/swiotlb.c index 025922807e6e..4bb5a11e18a2 100644 --- a/trunk/lib/swiotlb.c +++ b/trunk/lib/swiotlb.c @@ -310,9 +310,7 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir) start_dma_addr = virt_to_bus(io_tlb_start) & mask; offset_slots = ALIGN(start_dma_addr, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT; - max_slots = mask + 1 - ? ALIGN(mask + 1, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT - : 1UL << (BITS_PER_LONG - IO_TLB_SHIFT); + max_slots = ALIGN(mask + 1, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT; /* * For mappings greater than a page, we limit the stride (and @@ -335,18 +333,16 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir) index = ALIGN(io_tlb_index, stride); if (index >= io_tlb_nslabs) index = 0; + + while (is_span_boundary(index, nslots, offset_slots, + max_slots)) { + index += stride; + if (index >= io_tlb_nslabs) + index = 0; + } wrap = index; do { - while (is_span_boundary(index, nslots, offset_slots, - max_slots)) { - index += stride; - if (index >= io_tlb_nslabs) - index = 0; - if (index == wrap) - goto not_found; - } - /* * If we find a slot that indicates we have 'nslots' * number of contiguous buffers, we allocate the @@ -371,12 +367,14 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir) goto found; } - index += stride; - if (index >= io_tlb_nslabs) - index = 0; + do { + index += stride; + if (index >= io_tlb_nslabs) + index = 0; + } while (is_span_boundary(index, nslots, offset_slots, + max_slots)); } while (index != wrap); - not_found: spin_unlock_irqrestore(&io_tlb_lock, flags); return NULL; } diff --git a/trunk/scripts/kernel-doc b/trunk/scripts/kernel-doc index 263d04ab2d94..74c2f9db2aac 100755 --- a/trunk/scripts/kernel-doc +++ b/trunk/scripts/kernel-doc @@ -247,10 +247,6 @@ my ($function, %function_table,%parametertypes,$declaration_purpose); my ($type,$declaration_name,$return_type); my ($newsection,$newcontents,$prototype,$filelist, $brcount, %source_map); -if (defined($ENV{'KBUILD_VERBOSE'})) { - $verbose = "$ENV{'KBUILD_VERBOSE'}"; -} - # Generated docbook code is inserted in a template at a point where # docbook v3.1 requires a non-zero sequence of RefEntry's; see: # http://www.oasis-open.org/docbook/documentation/reference/html/refentry.html diff --git a/trunk/security/smack/smack.h b/trunk/security/smack/smack.h index 62c1e982849d..a21a0e907ab3 100644 --- a/trunk/security/smack/smack.h +++ b/trunk/security/smack/smack.h @@ -26,6 +26,14 @@ #define SMK_MAXLEN 23 #define SMK_LABELLEN (SMK_MAXLEN+1) +/* + * How many kinds of access are there? + * Here's your answer. + */ +#define SMK_ACCESSDASH '-' +#define SMK_ACCESSLOW "rwxa" +#define SMK_ACCESSKINDS (sizeof(SMK_ACCESSLOW) - 1) + struct superblock_smack { char *smk_root; char *smk_floor; diff --git a/trunk/security/smack/smackfs.c b/trunk/security/smack/smackfs.c index afe7c9b0732a..358c92c1a153 100644 --- a/trunk/security/smack/smackfs.c +++ b/trunk/security/smack/smackfs.c @@ -81,23 +81,10 @@ static struct semaphore smack_write_sem; /* * Values for parsing cipso rules * SMK_DIGITLEN: Length of a digit field in a rule. - * SMK_CIPSOMIN: Minimum possible cipso rule length. - * SMK_CIPSOMAX: Maximum possible cipso rule length. + * SMK_CIPSOMEN: Minimum possible cipso rule length. */ #define SMK_DIGITLEN 4 -#define SMK_CIPSOMIN (SMK_LABELLEN + 2 * SMK_DIGITLEN) -#define SMK_CIPSOMAX (SMK_CIPSOMIN + SMACK_CIPSO_MAXCATNUM * SMK_DIGITLEN) - -/* - * Values for parsing MAC rules - * SMK_ACCESS: Maximum possible combination of access permissions - * SMK_ACCESSLEN: Maximum length for a rule access field - * SMK_LOADLEN: Smack rule length - */ -#define SMK_ACCESS "rwxa" -#define SMK_ACCESSLEN (sizeof(SMK_ACCESS) - 1) -#define SMK_LOADLEN (SMK_LABELLEN + SMK_LABELLEN + SMK_ACCESSLEN) - +#define SMK_CIPSOMIN (SMK_MAXLEN + 2 * SMK_DIGITLEN) /* * Seq_file read operations for /smack/load @@ -242,10 +229,14 @@ static void smk_set_access(struct smack_rule *srp) * The format is exactly: * char subject[SMK_LABELLEN] * char object[SMK_LABELLEN] - * char access[SMK_ACCESSLEN] + * char access[SMK_ACCESSKINDS] + * + * Anything following is commentary and ignored. * - * writes must be SMK_LABELLEN+SMK_LABELLEN+SMK_ACCESSLEN bytes. + * writes must be SMK_LABELLEN+SMK_LABELLEN+4 bytes. */ +#define MINIMUM_LOAD (SMK_LABELLEN + SMK_LABELLEN + SMK_ACCESSKINDS) + static ssize_t smk_write_load(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { @@ -262,7 +253,7 @@ static ssize_t smk_write_load(struct file *file, const char __user *buf, return -EPERM; if (*ppos != 0) return -EINVAL; - if (count != SMK_LOADLEN) + if (count < MINIMUM_LOAD) return -EINVAL; data = kzalloc(count, GFP_KERNEL); @@ -522,7 +513,7 @@ static ssize_t smk_write_cipso(struct file *file, const char __user *buf, return -EPERM; if (*ppos != 0) return -EINVAL; - if (count < SMK_CIPSOMIN || count > SMK_CIPSOMAX) + if (count <= SMK_CIPSOMIN) return -EINVAL; data = kzalloc(count + 1, GFP_KERNEL); @@ -556,7 +547,7 @@ static ssize_t smk_write_cipso(struct file *file, const char __user *buf, if (ret != 1 || catlen > SMACK_CIPSO_MAXCATNUM) goto out; - if (count != (SMK_CIPSOMIN + catlen * SMK_DIGITLEN)) + if (count <= (SMK_CIPSOMIN + catlen * SMK_DIGITLEN)) goto out; memset(mapcatset, 0, sizeof(mapcatset));