From bc963d9233f135b5276a0e82183ac11db510f929 Mon Sep 17 00:00:00 2001 From: Rene Herman Date: Mon, 17 May 2004 03:28:58 -0700 Subject: [PATCH] missing closing \n in printk --- drivers/firmware/smbios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/firmware/smbios.c b/drivers/firmware/smbios.c index 583ab0939c08..cce49ea55398 100644 --- a/drivers/firmware/smbios.c +++ b/drivers/firmware/smbios.c @@ -126,7 +126,7 @@ find_table_max_address(struct smbios_device *sdev) if(keep_going != 0) printk(KERN_INFO "Warning: SMBIOS table does not end with a" " structure type 127. This may indicate a" - " truncated table."); + " truncated table.\n"); if(sdev->smbios_table_real_length != max_length) printk(KERN_INFO "Warning: BIOS specified SMBIOS table length" -- cgit v1.2.3 From 8714c381a31d9123a197c7eb624348df23917be3 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 27 May 2004 01:48:10 -0700 Subject: Remove the smbios driver as it is not needed. You can do the same from userspace, and the author requests that the driver be deleted from the kernel tree before people start using it. --- drivers/firmware/Kconfig | 8 -- drivers/firmware/Makefile | 1 - drivers/firmware/smbios.c | 248 ---------------------------------------------- drivers/firmware/smbios.h | 53 ---------- 4 files changed, 310 deletions(-) delete mode 100644 drivers/firmware/smbios.c delete mode 100644 drivers/firmware/smbios.h (limited to 'drivers') diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index 83575861bd21..597bf5f04e6d 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -34,12 +34,4 @@ config EFI_VARS Subsequent efibootmgr releases may be found at: http://linux.dell.com/efibootmgr -config SMBIOS - tristate "BIOS SMBIOS table access driver." - help - Say Y or M here if you want to enable access to the SMBIOS table - via driverfs. It exposes /sys/firmware/smbios/ subdirectory tree - containing a binary dump of the SMBIOS table header as well as the SMBIOS - table. - endmenu diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile index 694725046da7..ca7745addd5c 100644 --- a/drivers/firmware/Makefile +++ b/drivers/firmware/Makefile @@ -3,4 +3,3 @@ # obj-$(CONFIG_EDD) += edd.o obj-$(CONFIG_EFI_VARS) += efivars.o -obj-$(CONFIG_SMBIOS) += smbios.o diff --git a/drivers/firmware/smbios.c b/drivers/firmware/smbios.c deleted file mode 100644 index cce49ea55398..000000000000 --- a/drivers/firmware/smbios.c +++ /dev/null @@ -1,248 +0,0 @@ -/* - * linux/drivers/firmware/smbios.c - * Copyright (C) 2004 Dell Inc. - * by Michael Brown - * vim:noet:ts=8:sw=8:filetype=c:textwidth=80: - * - * BIOS SMBIOS Table access - * conformant to DMTF SMBIOS definition - * at http://www.dmtf.org/standards/smbios - * - * This code takes information provided by SMBIOS tables - * and presents it in sysfs as: - * /sys/firmware/smbios - * |--> /table_entry_point - * |--> /table - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License v2.0 as published by - * the Free Software Foundation - * - * 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. - * - */ - - -#include -#include -#include -#include -#include -#include "smbios.h" - -MODULE_AUTHOR("Michael Brown "); -MODULE_DESCRIPTION("sysfs interface to SMBIOS information"); -MODULE_LICENSE("GPL"); - -#define SMBIOS_VERSION "1.0 2004-04-19" - -struct smbios_device { - struct smbios_table_entry_point table_eps; - unsigned int smbios_table_real_length; -}; - -/* there shall be only one */ -static struct smbios_device the_smbios_device; - -#define to_smbios_device(obj) container_of(obj,struct smbios_device,kobj) - -/* don't currently have any "normal" attributes, so we don't need a way to - * show them. */ -static struct sysfs_ops smbios_attr_ops = { }; - -static __init int -checksum_eps(struct smbios_table_entry_point *table_eps) -{ - u8 *p = (u8 *)table_eps; - u8 checksum = 0; - int i=0; - for (i=0; i < table_eps->eps_length && i < sizeof(*table_eps); ++i) { - checksum += p[i]; - } - return( checksum == 0 ); -} - -static __init int -find_table_entry_point(struct smbios_device *sdev) -{ - struct smbios_table_entry_point *table_eps = &(sdev->table_eps); - u32 fp = 0xF0000; - while (fp < 0xFFFFF) { - isa_memcpy_fromio(table_eps, fp, sizeof(*table_eps)); - if (memcmp(table_eps->anchor, "_SM_", 4)==0 && - checksum_eps(table_eps)) { - return 0; - } - fp += 16; - } - - printk(KERN_INFO "SMBIOS table entry point not found in " - "0xF0000 - 0xFFFFF\n"); - return -ENODEV; -} - -static __init int -find_table_max_address(struct smbios_device *sdev) -{ - /* break out on one of three conditions: - * -- hit table_eps.table_length - * -- hit number of items that table claims we have - * -- hit structure type 127 - */ - - u8 *buf = ioremap(sdev->table_eps.table_address, - sdev->table_eps.table_length); - u8 *ptr = buf; - int count = 0, keep_going = 1; - int max_count = sdev->table_eps.table_num_structs; - int max_length = sdev->table_eps.table_length; - while(keep_going && ((ptr - buf) <= max_length) && count < max_count){ - if( ptr[0] == 0x7F ) /* ptr[0] is type */ - keep_going = 0; - - ptr += ptr[1]; /* ptr[1] is length, skip structure */ - /* skip strings at end of structure */ - while((ptr-buf) < max_length && (ptr[0] || ptr[1])) - ++ptr; - - /* string area ends in double-null. skip it. */ - ptr += 2; - ++count; - } - sdev->smbios_table_real_length = (ptr - buf); - iounmap(buf); - - if( count != max_count ) - printk(KERN_INFO "Warning: SMBIOS table structure count" - " does not match count specified in the" - " table entry point.\n" - " Table entry point count: %d\n" - " Actual count: %d\n", - max_count, count ); - - if(keep_going != 0) - printk(KERN_INFO "Warning: SMBIOS table does not end with a" - " structure type 127. This may indicate a" - " truncated table.\n"); - - if(sdev->smbios_table_real_length != max_length) - printk(KERN_INFO "Warning: BIOS specified SMBIOS table length" - " does not match calculated length.\n" - " BIOS specified: %d\n" - " calculated length: %d\n", - max_length, sdev->smbios_table_real_length); - - return sdev->smbios_table_real_length; -} - -static ssize_t -smbios_read_table_entry_point(struct kobject *kobj, char *buffer, - loff_t pos, size_t size) -{ - struct smbios_device *sdev = &the_smbios_device; - const char *p = (const char *)&(sdev->table_eps); - unsigned int count = - size > sizeof(sdev->table_eps) ? - sizeof(sdev->table_eps) : size; - memcpy( buffer, p, count ); - return count; -} - -static ssize_t -smbios_read_table(struct kobject *kobj, char *buffer, - loff_t pos, size_t size) -{ - struct smbios_device *sdev = &the_smbios_device; - u8 *buf; - unsigned int count = sdev->smbios_table_real_length - pos; - int i = 0; - count = count < size ? count : size; - - if (pos > sdev->smbios_table_real_length) - return 0; - - buf = ioremap(sdev->table_eps.table_address, sdev->smbios_table_real_length); - if (buf == NULL) - return -ENXIO; - - /* memcpy( buffer, buf+pos, count ); */ - for (i = 0; i < count; ++i) { - buffer[i] = readb( buf+pos+i ); - } - - iounmap(buf); - - return count; -} - -static struct bin_attribute tep_attr = { - .attr = {.name = "table_entry_point", .owner = THIS_MODULE, .mode = 0444}, - .size = sizeof(struct smbios_table_entry_point), - .read = smbios_read_table_entry_point, - /* not writeable */ -}; - -static struct bin_attribute table_attr = { - .attr = { .name = "table", .owner = THIS_MODULE, .mode = 0444 }, - /* size set later, we don't know it here. */ - .read = smbios_read_table, - /* not writeable */ -}; - -/* no default attributes yet. */ -static struct attribute * def_attrs[] = { NULL, }; - -static struct kobj_type ktype_smbios = { - .sysfs_ops = &smbios_attr_ops, - .default_attrs = def_attrs, - /* statically allocated, no release method necessary */ -}; - -static decl_subsys(smbios,&ktype_smbios,NULL); - -static void smbios_device_unregister(void) -{ - sysfs_remove_bin_file(&smbios_subsys.kset.kobj, &tep_attr ); - sysfs_remove_bin_file(&smbios_subsys.kset.kobj, &table_attr ); -} - -static void __init smbios_device_register(void) -{ - sysfs_create_bin_file(&smbios_subsys.kset.kobj, &tep_attr ); - sysfs_create_bin_file(&smbios_subsys.kset.kobj, &table_attr ); -} - -static int __init -smbios_init(void) -{ - int rc=0; - - printk(KERN_INFO "SMBIOS facility v%s\n", SMBIOS_VERSION ); - - rc = find_table_entry_point(&the_smbios_device); - if (rc) - return rc; - - table_attr.size = find_table_max_address(&the_smbios_device); - - rc = firmware_register(&smbios_subsys); - if (rc) - return rc; - - smbios_device_register(); - - return rc; -} - -static void __exit -smbios_exit(void) -{ - smbios_device_unregister(); - firmware_unregister(&smbios_subsys); -} - -late_initcall(smbios_init); -module_exit(smbios_exit); diff --git a/drivers/firmware/smbios.h b/drivers/firmware/smbios.h deleted file mode 100644 index 7d56a0a2f4cf..000000000000 --- a/drivers/firmware/smbios.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * linux/drivers/firmware/smbios.c - * Copyright (C) 2002, 2003, 2004 Dell Inc. - * by Michael Brown - * vim:noet:ts=8:sw=8:filetype=c:textwidth=80: - * - * BIOS SMBIOS Table access - * conformant to DMTF SMBIOS definition - * at http://www.dmtf.org/standards/smbios - * - * This code takes information provided by SMBIOS tables - * and presents it in sysfs. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License v2.0 as published by - * the Free Software Foundation - * - * 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. - * - */ - -#ifndef _LINUX_SMBIOS_H -#define _LINUX_SMBIOS_H - -#include - -struct smbios_table_entry_point { - u8 anchor[4]; - u8 checksum; - u8 eps_length; - u8 major_ver; - u8 minor_ver; - u16 max_struct_size; - u8 revision; - u8 formatted_area[5]; - u8 dmi_anchor[5]; - u8 intermediate_checksum; - u16 table_length; - u32 table_address; - u16 table_num_structs; - u8 smbios_bcd_revision; -} __attribute__ ((packed)); - -struct smbios_structure_header { - u8 type; - u8 length; - u16 handle; -} __attribute__ ((packed)); - -#endif /* _LINUX_SMBIOS_H */ -- cgit v1.2.3 From 98e1a74e3f5033aea114e6facd95cc31c69acee7 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Thu, 27 May 2004 20:04:18 -0700 Subject: [PATCH] Device runtime suspend/resume fixes (1) Set device power state at runtime resume (as is done for runtime suspend) so that a later suspend does not think the device is still suspended (refusing to suspend it again). (2) Move devices from the active list to the off list only when suspending all devices as part of a system suspend, not for runtime suspend. This matches the resume code, which only moves devices from off to active during system resume, such that runtime resume currently doesn't move the suspended device back to the active list. (This also avoids reordering the device list for runtime suspends; the list is in order of registration and suspend/resume works best that way -- granted, more sweeping improvements in how device dependencies are accounted for in the suspend/resume order are also needed someday.) Runtime device suspend/resume is in some cases used frequently on battery-powered embedded devices, to save additional power and to handle device power state interactions with overall system power state on certain platforms. Signed-off-by: Greg Kroah-Hartman --- drivers/base/power/runtime.c | 5 ++++- drivers/base/power/suspend.c | 23 ++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers') diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index d901a6fd6dc4..be4fb53c1fa8 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -14,7 +14,10 @@ static void runtime_resume(struct device * dev) { if (!dev->power.power_state) return; - resume_device(dev); + if (! resume_device(dev)) + dev->power.power_state = 0; + + return; } diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c index 19e660a21ecf..77224ce22240 100644 --- a/drivers/base/power/suspend.c +++ b/drivers/base/power/suspend.c @@ -42,13 +42,6 @@ int suspend_device(struct device * dev, u32 state) if (dev->bus && dev->bus->suspend) error = dev->bus->suspend(dev,state); - if (!error) { - list_del(&dev->power.entry); - list_add(&dev->power.entry,&dpm_off); - } else if (error == -EAGAIN) { - list_del(&dev->power.entry); - list_add(&dev->power.entry,&dpm_off_irq); - } return error; } @@ -81,12 +74,16 @@ int device_suspend(u32 state) while(!list_empty(&dpm_active)) { struct list_head * entry = dpm_active.prev; struct device * dev = to_device(entry); - if ((error = suspend_device(dev,state))) { - if (error != -EAGAIN) - goto Error; - else - error = 0; - } + error = suspend_device(dev,state); + + if (!error) { + list_del(&dev->power.entry); + list_add(&dev->power.entry,&dpm_off); + } else if (error == -EAGAIN) { + list_del(&dev->power.entry); + list_add(&dev->power.entry,&dpm_off_irq); + } else + goto Error; } Done: up(&dpm_sem); -- cgit v1.2.3 From b8ff3f6bdbb479619209c20b1c9c0d0d175d0bf6 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Thu, 27 May 2004 20:04:44 -0700 Subject: [PATCH] Leave runtime suspended devices off at system resume Currently all devices are resumed at system resume time, including any that were individually powered off ("at runtime") prior to the system suspend. In certain cases it can be nice to force back on individually suspended devices, such as the display, but hopefully this policy can be left up to userspace power managers; the kernel should probably honor the settings previously made by userspace/drivers. This seems preferable to requiring a power-conscious system to re-suspend devices after a system resume; furthermore, for certain platforms (such as XScale PXA27X) there can be disastrous consequences of powering up devices when the system is in a state incompatible with operation of the device. Suggested patch does this: (1) At system resume, checks power_state to see if the device was suspended prior to system suspend, and skips powering on the device if so. (2) Does not re-suspend an already-suspended device at system suspend (using a different method than is currently employed, which reorders the list, see #3). (3) Preserves the active/off device list order despite the above changes to suspend/resume behavior, to avoid dependency problems that tend to occur when the list is reordered. Signed-off-by: Greg Kroah-Hartman --- drivers/base/power/resume.c | 5 ++++- drivers/base/power/suspend.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/base/power/resume.c b/drivers/base/power/resume.c index 637c52ad6ec6..90632b9ea95f 100644 --- a/drivers/base/power/resume.c +++ b/drivers/base/power/resume.c @@ -35,7 +35,10 @@ void dpm_resume(void) struct list_head * entry = dpm_off.next; struct device * dev = to_device(entry); list_del_init(entry); - resume_device(dev); + + if (!dev->power.power_state) + resume_device(dev); + list_add_tail(entry,&dpm_active); } } diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c index 77224ce22240..4e93793ad220 100644 --- a/drivers/base/power/suspend.c +++ b/drivers/base/power/suspend.c @@ -39,7 +39,7 @@ int suspend_device(struct device * dev, u32 state) { int error = 0; - if (dev->bus && dev->bus->suspend) + if (dev->bus && dev->bus->suspend && !dev->power.power_state) error = dev->bus->suspend(dev,state); return error; -- cgit v1.2.3 From 5ca5b409b65c243c912621a2aa3264aa07370724 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 27 May 2004 20:05:31 -0700 Subject: [PATCH] Report which device failed to suspend Based on a patch from Nickolai Zeldovich but put into the proper place by me. Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/base/power/suspend.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c index 4e93793ad220..b48016dc5737 100644 --- a/drivers/base/power/suspend.c +++ b/drivers/base/power/suspend.c @@ -39,6 +39,8 @@ int suspend_device(struct device * dev, u32 state) { int error = 0; + dev_dbg(dev, "suspending\n"); + if (dev->bus && dev->bus->suspend && !dev->power.power_state) error = dev->bus->suspend(dev,state); @@ -82,8 +84,11 @@ int device_suspend(u32 state) } else if (error == -EAGAIN) { list_del(&dev->power.entry); list_add(&dev->power.entry,&dpm_off_irq); - } else + } else { + printk(KERN_ERR "Could not suspend device %s: " + "error %d\n", kobject_name(&dev->kobj), error); goto Error; + } } Done: up(&dpm_sem); -- cgit v1.2.3 From 3eb68d243b32d27362d63fe9a0ce4c1a03a73f7c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 27 May 2004 20:31:37 -0700 Subject: Minor coding style fixups in resume code and added a bit of debugging help. Signed-off-by: Greg Kroah-Hartman --- drivers/base/power/runtime.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index be4fb53c1fa8..4ff5340e90fb 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -12,12 +12,11 @@ static void runtime_resume(struct device * dev) { + dev_dbg(dev, "resuming\n"); if (!dev->power.power_state) return; - if (! resume_device(dev)) + if (!resume_device(dev)) dev->power.power_state = 0; - - return; } -- cgit v1.2.3