diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-04-17 14:22:18 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-04-17 14:22:18 -0700 |
commit | 56ddc5ed12cfed7d9186c39722e67383ad80e714 (patch) | |
tree | 93bf2f3e3613931177c748b71735b7030996c76f /driver | |
parent | cc207335e8f292cfa2c5a07dc061d70cf9e208e4 (diff) | |
download | patches-56ddc5ed12cfed7d9186c39722e67383ad80e714.tar.gz |
more patches removed that made it into 2.6.17-rc1-git12
Diffstat (limited to 'driver')
8 files changed, 0 insertions, 1497 deletions
diff --git a/driver/block-delay-all-uevents-until-partition-table-is-scanned.patch b/driver/block-delay-all-uevents-until-partition-table-is-scanned.patch deleted file mode 100644 index 944230fc55ffb..0000000000000 --- a/driver/block-delay-all-uevents-until-partition-table-is-scanned.patch +++ /dev/null @@ -1,130 +0,0 @@ -From kay.sievers@vrfy.org Fri Mar 24 11:45:43 2006 -Date: Fri, 24 Mar 2006 20:45:35 +0100 -From: Kay Sievers <kay.sievers@vrfy.org> -To: "Randy.Dunlap" <rdunlap@xenotime.net> -Cc: greg@kroah.com, <viro@ftp.linux.org.uk> -Subject: BLOCK: delay all uevents until partition table is scanned -Message-ID: <20060324194535.GA13905@vrfy.org> -Content-Disposition: inline - -From: Kay Sievers <kay.sievers@suse.de> - -[BLOCK] delay all uevents until partition table is scanned - -Here we delay the annoucement of all block device events until the -disk's partition table is scanned and all partition devices are already -created and sysfs is populated. - -We have a bunch of old bugs for removable storage handling where we -probe successfully for a filesystem on the raw disk, but at the -same time the kernel recognizes a partition table and creates partition -devices. -Currently there is no sane way to tell if partitions will show up or not -at the time the disk device is announced to userspace. With the delayed -events we can simply skip any probe for a filesystem on the raw disk when -we find already present partitions. - -Signed-off-by: Kay Sievers <kay.sievers@suse.de> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - fs/partitions/check.c | 38 ++++++++++++++++++++++++++++++-------- - include/linux/genhd.h | 1 + - 2 files changed, 31 insertions(+), 8 deletions(-) - ---- gregkh-2.6.orig/fs/partitions/check.c -+++ gregkh-2.6/fs/partitions/check.c -@@ -331,7 +331,9 @@ void delete_partition(struct gendisk *di - devfs_remove("%s/part%d", disk->devfs_name, part); - if (p->holder_dir) - kobject_unregister(p->holder_dir); -- kobject_unregister(&p->kobj); -+ kobject_uevent(&p->kobj, KOBJ_REMOVE); -+ kobject_del(&p->kobj); -+ kobject_put(&p->kobj); - } - - void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len) -@@ -357,7 +359,10 @@ void add_partition(struct gendisk *disk, - snprintf(p->kobj.name,KOBJ_NAME_LEN,"%s%d",disk->kobj.name,part); - p->kobj.parent = &disk->kobj; - p->kobj.ktype = &ktype_part; -- kobject_register(&p->kobj); -+ kobject_init(&p->kobj); -+ kobject_add(&p->kobj); -+ if (!disk->part_uevent_suppress) -+ kobject_uevent(&p->kobj, KOBJ_ADD); - partition_sysfs_add_subdir(p); - disk->part[part-1] = p; - } -@@ -395,6 +400,8 @@ void register_disk(struct gendisk *disk) - { - struct block_device *bdev; - char *s; -+ int i; -+ struct hd_struct *p; - int err; - - strlcpy(disk->kobj.name,disk->disk_name,KOBJ_NAME_LEN); -@@ -406,13 +413,12 @@ void register_disk(struct gendisk *disk) - return; - disk_sysfs_symlinks(disk); - disk_sysfs_add_subdirs(disk); -- kobject_uevent(&disk->kobj, KOBJ_ADD); - - /* No minors to use for partitions */ - if (disk->minors == 1) { - if (disk->devfs_name[0] != '\0') - devfs_add_disk(disk); -- return; -+ goto exit; - } - - /* always add handle for the whole disk */ -@@ -420,16 +426,32 @@ void register_disk(struct gendisk *disk) - - /* No such device (e.g., media were just removed) */ - if (!get_capacity(disk)) -- return; -+ goto exit; - - bdev = bdget_disk(disk, 0); - if (!bdev) -- return; -+ goto exit; - -+ /* scan partition table, but suppress uevents */ - bdev->bd_invalidated = 1; -- if (blkdev_get(bdev, FMODE_READ, 0) < 0) -- return; -+ disk->part_uevent_suppress = 1; -+ err = blkdev_get(bdev, FMODE_READ, 0); -+ disk->part_uevent_suppress = 0; -+ if (err < 0) -+ goto exit; - blkdev_put(bdev); -+ -+exit: -+ /* announce disk after possible partitions are already created */ -+ kobject_uevent(&disk->kobj, KOBJ_ADD); -+ -+ /* announce possible partitions */ -+ for (i = 1; i < disk->minors; i++) { -+ p = disk->part[i-1]; -+ if (!p || !p->nr_sects) -+ continue; -+ kobject_uevent(&p->kobj, KOBJ_ADD); -+ } - } - - int rescan_partitions(struct gendisk *disk, struct block_device *bdev) ---- gregkh-2.6.orig/include/linux/genhd.h -+++ gregkh-2.6/include/linux/genhd.h -@@ -105,6 +105,7 @@ struct gendisk { - * disks that can't be partitioned. */ - char disk_name[32]; /* name of major driver */ - struct hd_struct **part; /* [indexed by minor] */ -+ int part_uevent_suppress; - struct block_device_operations *fops; - struct request_queue *queue; - void *private_data; diff --git a/driver/dmi-move-dmi_scan.c-from-arch-i386-to-drivers-firmware.patch b/driver/dmi-move-dmi_scan.c-from-arch-i386-to-drivers-firmware.patch deleted file mode 100644 index 86317d9df9d3a..0000000000000 --- a/driver/dmi-move-dmi_scan.c-from-arch-i386-to-drivers-firmware.patch +++ /dev/null @@ -1,815 +0,0 @@ -From akpm@osdl.org Thu Apr 6 10:21:36 2006 -Message-Id: <200604040006.k3406v9c006915@shell0.pdx.osdl.net> -Subject: DMI: move dmi_scan.c from arch/i386 to drivers/firmware/ -To: bjorn.helgaas@hp.com, ak@muc.de, greg@kroah.com, pazke@orbita1.ru, tony.luck@intel.com, mm-commits@vger.kernel.org -From: Bjorn Helgaas <bjorn.helgaas@hp.com> -Date: Mon, 3 Apr 2006 17:09:22 -0700 - -From: Bjorn Helgaas <bjorn.helgaas@hp.com> - -dmi_scan.c is arch-independent and is used by i386, x86_64, and ia64. -Currently all three arches compile it from arch/i386, which means that ia64 -and x86_64 depend on things in arch/i386 that they wouldn't otherwise care -about. - -This is simply "mv arch/i386/kernel/dmi_scan.c drivers/firmware/" (removing -trailing whitespace) and the associated Makefile changes. All three -architectures already set CONFIG_DMI in their top-level Kconfig files. - -Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> -Cc: Andi Kleen <ak@muc.de> -Cc: "Luck, Tony" <tony.luck@intel.com> -Cc: Andrey Panin <pazke@orbita1.ru> -Signed-off-by: Andrew Morton <akpm@osdl.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - arch/i386/kernel/Makefile | 2 - arch/i386/kernel/dmi_scan.c | 358 -------------------------------------------- - arch/ia64/kernel/Makefile | 3 - arch/x86_64/kernel/Makefile | 4 - drivers/firmware/Makefile | 3 - drivers/firmware/dmi_scan.c | 358 ++++++++++++++++++++++++++++++++++++++++++++ - 6 files changed, 363 insertions(+), 365 deletions(-) - ---- gregkh-2.6.orig/arch/i386/kernel/Makefile -+++ gregkh-2.6/arch/i386/kernel/Makefile -@@ -6,7 +6,7 @@ extra-y := head.o init_task.o vmlinux.ld - - obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ - ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \ -- pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \ -+ pci-dma.o i386_ksyms.o i387.o bootflag.o \ - quirks.o i8237.o topology.o alternative.o - - obj-y += cpu/ ---- gregkh-2.6.orig/arch/i386/kernel/dmi_scan.c -+++ /dev/null -@@ -1,358 +0,0 @@ --#include <linux/types.h> --#include <linux/string.h> --#include <linux/init.h> --#include <linux/module.h> --#include <linux/dmi.h> --#include <linux/efi.h> --#include <linux/bootmem.h> --#include <linux/slab.h> --#include <asm/dmi.h> -- --static char * __init dmi_string(struct dmi_header *dm, u8 s) --{ -- u8 *bp = ((u8 *) dm) + dm->length; -- char *str = ""; -- -- if (s) { -- s--; -- while (s > 0 && *bp) { -- bp += strlen(bp) + 1; -- s--; -- } -- -- if (*bp != 0) { -- str = dmi_alloc(strlen(bp) + 1); -- if (str != NULL) -- strcpy(str, bp); -- else -- printk(KERN_ERR "dmi_string: out of memory.\n"); -- } -- } -- -- return str; --} -- --/* -- * We have to be cautious here. We have seen BIOSes with DMI pointers -- * pointing to completely the wrong place for example -- */ --static int __init dmi_table(u32 base, int len, int num, -- void (*decode)(struct dmi_header *)) --{ -- u8 *buf, *data; -- int i = 0; -- -- buf = dmi_ioremap(base, len); -- if (buf == NULL) -- return -1; -- -- data = buf; -- -- /* -- * Stop when we see all the items the table claimed to have -- * OR we run off the end of the table (also happens) -- */ -- while ((i < num) && (data - buf + sizeof(struct dmi_header)) <= len) { -- struct dmi_header *dm = (struct dmi_header *)data; -- /* -- * We want to know the total length (formated area and strings) -- * before decoding to make sure we won't run off the table in -- * dmi_decode or dmi_string -- */ -- data += dm->length; -- while ((data - buf < len - 1) && (data[0] || data[1])) -- data++; -- if (data - buf < len - 1) -- decode(dm); -- data += 2; -- i++; -- } -- dmi_iounmap(buf, len); -- return 0; --} -- --static int __init dmi_checksum(u8 *buf) --{ -- u8 sum = 0; -- int a; -- -- for (a = 0; a < 15; a++) -- sum += buf[a]; -- -- return sum == 0; --} -- --static char *dmi_ident[DMI_STRING_MAX]; --static LIST_HEAD(dmi_devices); -- --/* -- * Save a DMI string -- */ --static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string) --{ -- char *p, *d = (char*) dm; -- -- if (dmi_ident[slot]) -- return; -- -- p = dmi_string(dm, d[string]); -- if (p == NULL) -- return; -- -- dmi_ident[slot] = p; --} -- --static void __init dmi_save_devices(struct dmi_header *dm) --{ -- int i, count = (dm->length - sizeof(struct dmi_header)) / 2; -- struct dmi_device *dev; -- -- for (i = 0; i < count; i++) { -- char *d = (char *)(dm + 1) + (i * 2); -- -- /* Skip disabled device */ -- if ((*d & 0x80) == 0) -- continue; -- -- dev = dmi_alloc(sizeof(*dev)); -- if (!dev) { -- printk(KERN_ERR "dmi_save_devices: out of memory.\n"); -- break; -- } -- -- dev->type = *d++ & 0x7f; -- dev->name = dmi_string(dm, *d); -- dev->device_data = NULL; -- -- list_add(&dev->list, &dmi_devices); -- } --} -- --static void __init dmi_save_ipmi_device(struct dmi_header *dm) --{ -- struct dmi_device *dev; -- void * data; -- -- data = dmi_alloc(dm->length); -- if (data == NULL) { -- printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); -- return; -- } -- -- memcpy(data, dm, dm->length); -- -- dev = dmi_alloc(sizeof(*dev)); -- if (!dev) { -- printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); -- return; -- } -- -- dev->type = DMI_DEV_TYPE_IPMI; -- dev->name = "IPMI controller"; -- dev->device_data = data; -- -- list_add(&dev->list, &dmi_devices); --} -- --/* -- * Process a DMI table entry. Right now all we care about are the BIOS -- * and machine entries. For 2.5 we should pull the smbus controller info -- * out of here. -- */ --static void __init dmi_decode(struct dmi_header *dm) --{ -- switch(dm->type) { -- case 0: /* BIOS Information */ -- dmi_save_ident(dm, DMI_BIOS_VENDOR, 4); -- dmi_save_ident(dm, DMI_BIOS_VERSION, 5); -- dmi_save_ident(dm, DMI_BIOS_DATE, 8); -- break; -- case 1: /* System Information */ -- dmi_save_ident(dm, DMI_SYS_VENDOR, 4); -- dmi_save_ident(dm, DMI_PRODUCT_NAME, 5); -- dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6); -- dmi_save_ident(dm, DMI_PRODUCT_SERIAL, 7); -- break; -- case 2: /* Base Board Information */ -- dmi_save_ident(dm, DMI_BOARD_VENDOR, 4); -- dmi_save_ident(dm, DMI_BOARD_NAME, 5); -- dmi_save_ident(dm, DMI_BOARD_VERSION, 6); -- break; -- case 10: /* Onboard Devices Information */ -- dmi_save_devices(dm); -- break; -- case 38: /* IPMI Device Information */ -- dmi_save_ipmi_device(dm); -- } --} -- --static int __init dmi_present(char __iomem *p) --{ -- u8 buf[15]; -- memcpy_fromio(buf, p, 15); -- if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) { -- u16 num = (buf[13] << 8) | buf[12]; -- u16 len = (buf[7] << 8) | buf[6]; -- u32 base = (buf[11] << 24) | (buf[10] << 16) | -- (buf[9] << 8) | buf[8]; -- -- /* -- * DMI version 0.0 means that the real version is taken from -- * the SMBIOS version, which we don't know at this point. -- */ -- if (buf[14] != 0) -- printk(KERN_INFO "DMI %d.%d present.\n", -- buf[14] >> 4, buf[14] & 0xF); -- else -- printk(KERN_INFO "DMI present.\n"); -- if (dmi_table(base,len, num, dmi_decode) == 0) -- return 0; -- } -- return 1; --} -- --void __init dmi_scan_machine(void) --{ -- char __iomem *p, *q; -- int rc; -- -- if (efi_enabled) { -- if (efi.smbios == EFI_INVALID_TABLE_ADDR) -- goto out; -- -- /* This is called as a core_initcall() because it isn't -- * needed during early boot. This also means we can -- * iounmap the space when we're done with it. -- */ -- p = dmi_ioremap(efi.smbios, 32); -- if (p == NULL) -- goto out; -- -- rc = dmi_present(p + 0x10); /* offset of _DMI_ string */ -- dmi_iounmap(p, 32); -- if (!rc) -- return; -- } -- else { -- /* -- * no iounmap() for that ioremap(); it would be a no-op, but -- * it's so early in setup that sucker gets confused into doing -- * what it shouldn't if we actually call it. -- */ -- p = dmi_ioremap(0xF0000, 0x10000); -- if (p == NULL) -- goto out; -- -- for (q = p; q < p + 0x10000; q += 16) { -- rc = dmi_present(q); -- if (!rc) -- return; -- } -- } -- out: printk(KERN_INFO "DMI not present or invalid.\n"); --} -- --/** -- * dmi_check_system - check system DMI data -- * @list: array of dmi_system_id structures to match against -- * -- * Walk the blacklist table running matching functions until someone -- * returns non zero or we hit the end. Callback function is called for -- * each successfull match. Returns the number of matches. -- */ --int dmi_check_system(struct dmi_system_id *list) --{ -- int i, count = 0; -- struct dmi_system_id *d = list; -- -- while (d->ident) { -- for (i = 0; i < ARRAY_SIZE(d->matches); i++) { -- int s = d->matches[i].slot; -- if (s == DMI_NONE) -- continue; -- if (dmi_ident[s] && strstr(dmi_ident[s], d->matches[i].substr)) -- continue; -- /* No match */ -- goto fail; -- } -- count++; -- if (d->callback && d->callback(d)) -- break; --fail: d++; -- } -- -- return count; --} --EXPORT_SYMBOL(dmi_check_system); -- --/** -- * dmi_get_system_info - return DMI data value -- * @field: data index (see enum dmi_filed) -- * -- * Returns one DMI data value, can be used to perform -- * complex DMI data checks. -- */ --char *dmi_get_system_info(int field) --{ -- return dmi_ident[field]; --} --EXPORT_SYMBOL(dmi_get_system_info); -- --/** -- * dmi_find_device - find onboard device by type/name -- * @type: device type or %DMI_DEV_TYPE_ANY to match all device types -- * @desc: device name string or %NULL to match all -- * @from: previous device found in search, or %NULL for new search. -- * -- * Iterates through the list of known onboard devices. If a device is -- * found with a matching @vendor and @device, a pointer to its device -- * structure is returned. Otherwise, %NULL is returned. -- * A new search is initiated by passing %NULL to the @from argument. -- * If @from is not %NULL, searches continue from next device. -- */ --struct dmi_device * dmi_find_device(int type, const char *name, -- struct dmi_device *from) --{ -- struct list_head *d, *head = from ? &from->list : &dmi_devices; -- -- for(d = head->next; d != &dmi_devices; d = d->next) { -- struct dmi_device *dev = list_entry(d, struct dmi_device, list); -- -- if (((type == DMI_DEV_TYPE_ANY) || (dev->type == type)) && -- ((name == NULL) || (strcmp(dev->name, name) == 0))) -- return dev; -- } -- -- return NULL; --} --EXPORT_SYMBOL(dmi_find_device); -- --/** -- * dmi_get_year - Return year of a DMI date -- * @field: data index (like dmi_get_system_info) -- * -- * Returns -1 when the field doesn't exist. 0 when it is broken. -- */ --int dmi_get_year(int field) --{ -- int year; -- char *s = dmi_get_system_info(field); -- -- if (!s) -- return -1; -- if (*s == '\0') -- return 0; -- s = strrchr(s, '/'); -- if (!s) -- return 0; -- -- s += 1; -- year = simple_strtoul(s, NULL, 0); -- if (year && year < 100) { /* 2-digit year */ -- year += 1900; -- if (year < 1996) /* no dates < spec 1.0 */ -- year += 100; -- } -- -- return year; --} ---- gregkh-2.6.orig/arch/ia64/kernel/Makefile -+++ gregkh-2.6/arch/ia64/kernel/Makefile -@@ -7,7 +7,7 @@ extra-y := head.o init_task.o vmlinux.ld - obj-y := acpi.o entry.o efi.o efi_stub.o gate-data.o fsys.o ia64_ksyms.o irq.o irq_ia64.o \ - irq_lsapic.o ivt.o machvec.o pal.o patch.o process.o perfmon.o ptrace.o sal.o \ - salinfo.o semaphore.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o \ -- unwind.o mca.o mca_asm.o topology.o dmi_scan.o -+ unwind.o mca.o mca_asm.o topology.o - - obj-$(CONFIG_IA64_BRL_EMU) += brl_emu.o - obj-$(CONFIG_IA64_GENERIC) += acpi-ext.o -@@ -30,7 +30,6 @@ obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_r - obj-$(CONFIG_KPROBES) += kprobes.o jprobes.o - obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR) += uncached.o - mca_recovery-y += mca_drv.o mca_drv_asm.o --dmi_scan-y += ../../i386/kernel/dmi_scan.o - - # The gate DSO image is built using a special linker script. - targets += gate.so gate-syms.o ---- gregkh-2.6.orig/arch/x86_64/kernel/Makefile -+++ gregkh-2.6/arch/x86_64/kernel/Makefile -@@ -8,7 +8,7 @@ obj-y := process.o signal.o entry.o trap - ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \ - x8664_ksyms.o i387.o syscall.o vsyscall.o \ - setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o \ -- dmi_scan.o pci-dma.o pci-nommu.o -+ pci-dma.o pci-nommu.o - - obj-$(CONFIG_X86_MCE) += mce.o - obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o -@@ -49,5 +49,3 @@ intel_cacheinfo-y += ../../i386/kernel/ - quirks-y += ../../i386/kernel/quirks.o - i8237-y += ../../i386/kernel/i8237.o - msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o --dmi_scan-y += ../../i386/kernel/dmi_scan.o -- ---- gregkh-2.6.orig/drivers/firmware/Makefile -+++ gregkh-2.6/drivers/firmware/Makefile -@@ -1,7 +1,8 @@ - # - # Makefile for the linux kernel. - # --obj-$(CONFIG_EDD) += edd.o -+obj-$(CONFIG_DMI) += dmi_scan.o -+obj-$(CONFIG_EDD) += edd.o - obj-$(CONFIG_EFI_VARS) += efivars.o - obj-$(CONFIG_EFI_PCDP) += pcdp.o - obj-$(CONFIG_DELL_RBU) += dell_rbu.o ---- /dev/null -+++ gregkh-2.6/drivers/firmware/dmi_scan.c -@@ -0,0 +1,358 @@ -+#include <linux/types.h> -+#include <linux/string.h> -+#include <linux/init.h> -+#include <linux/module.h> -+#include <linux/dmi.h> -+#include <linux/efi.h> -+#include <linux/bootmem.h> -+#include <linux/slab.h> -+#include <asm/dmi.h> -+ -+static char * __init dmi_string(struct dmi_header *dm, u8 s) -+{ -+ u8 *bp = ((u8 *) dm) + dm->length; -+ char *str = ""; -+ -+ if (s) { -+ s--; -+ while (s > 0 && *bp) { -+ bp += strlen(bp) + 1; -+ s--; -+ } -+ -+ if (*bp != 0) { -+ str = dmi_alloc(strlen(bp) + 1); -+ if (str != NULL) -+ strcpy(str, bp); -+ else -+ printk(KERN_ERR "dmi_string: out of memory.\n"); -+ } -+ } -+ -+ return str; -+} -+ -+/* -+ * We have to be cautious here. We have seen BIOSes with DMI pointers -+ * pointing to completely the wrong place for example -+ */ -+static int __init dmi_table(u32 base, int len, int num, -+ void (*decode)(struct dmi_header *)) -+{ -+ u8 *buf, *data; -+ int i = 0; -+ -+ buf = dmi_ioremap(base, len); -+ if (buf == NULL) -+ return -1; -+ -+ data = buf; -+ -+ /* -+ * Stop when we see all the items the table claimed to have -+ * OR we run off the end of the table (also happens) -+ */ -+ while ((i < num) && (data - buf + sizeof(struct dmi_header)) <= len) { -+ struct dmi_header *dm = (struct dmi_header *)data; -+ /* -+ * We want to know the total length (formated area and strings) -+ * before decoding to make sure we won't run off the table in -+ * dmi_decode or dmi_string -+ */ -+ data += dm->length; -+ while ((data - buf < len - 1) && (data[0] || data[1])) -+ data++; -+ if (data - buf < len - 1) -+ decode(dm); -+ data += 2; -+ i++; -+ } -+ dmi_iounmap(buf, len); -+ return 0; -+} -+ -+static int __init dmi_checksum(u8 *buf) -+{ -+ u8 sum = 0; -+ int a; -+ -+ for (a = 0; a < 15; a++) -+ sum += buf[a]; -+ -+ return sum == 0; -+} -+ -+static char *dmi_ident[DMI_STRING_MAX]; -+static LIST_HEAD(dmi_devices); -+ -+/* -+ * Save a DMI string -+ */ -+static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string) -+{ -+ char *p, *d = (char*) dm; -+ -+ if (dmi_ident[slot]) -+ return; -+ -+ p = dmi_string(dm, d[string]); -+ if (p == NULL) -+ return; -+ -+ dmi_ident[slot] = p; -+} -+ -+static void __init dmi_save_devices(struct dmi_header *dm) -+{ -+ int i, count = (dm->length - sizeof(struct dmi_header)) / 2; -+ struct dmi_device *dev; -+ -+ for (i = 0; i < count; i++) { -+ char *d = (char *)(dm + 1) + (i * 2); -+ -+ /* Skip disabled device */ -+ if ((*d & 0x80) == 0) -+ continue; -+ -+ dev = dmi_alloc(sizeof(*dev)); -+ if (!dev) { -+ printk(KERN_ERR "dmi_save_devices: out of memory.\n"); -+ break; -+ } -+ -+ dev->type = *d++ & 0x7f; -+ dev->name = dmi_string(dm, *d); -+ dev->device_data = NULL; -+ -+ list_add(&dev->list, &dmi_devices); -+ } -+} -+ -+static void __init dmi_save_ipmi_device(struct dmi_header *dm) -+{ -+ struct dmi_device *dev; -+ void * data; -+ -+ data = dmi_alloc(dm->length); -+ if (data == NULL) { -+ printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); -+ return; -+ } -+ -+ memcpy(data, dm, dm->length); -+ -+ dev = dmi_alloc(sizeof(*dev)); -+ if (!dev) { -+ printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); -+ return; -+ } -+ -+ dev->type = DMI_DEV_TYPE_IPMI; -+ dev->name = "IPMI controller"; -+ dev->device_data = data; -+ -+ list_add(&dev->list, &dmi_devices); -+} -+ -+/* -+ * Process a DMI table entry. Right now all we care about are the BIOS -+ * and machine entries. For 2.5 we should pull the smbus controller info -+ * out of here. -+ */ -+static void __init dmi_decode(struct dmi_header *dm) -+{ -+ switch(dm->type) { -+ case 0: /* BIOS Information */ -+ dmi_save_ident(dm, DMI_BIOS_VENDOR, 4); -+ dmi_save_ident(dm, DMI_BIOS_VERSION, 5); -+ dmi_save_ident(dm, DMI_BIOS_DATE, 8); -+ break; -+ case 1: /* System Information */ -+ dmi_save_ident(dm, DMI_SYS_VENDOR, 4); -+ dmi_save_ident(dm, DMI_PRODUCT_NAME, 5); -+ dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6); -+ dmi_save_ident(dm, DMI_PRODUCT_SERIAL, 7); -+ break; -+ case 2: /* Base Board Information */ -+ dmi_save_ident(dm, DMI_BOARD_VENDOR, 4); -+ dmi_save_ident(dm, DMI_BOARD_NAME, 5); -+ dmi_save_ident(dm, DMI_BOARD_VERSION, 6); -+ break; -+ case 10: /* Onboard Devices Information */ -+ dmi_save_devices(dm); -+ break; -+ case 38: /* IPMI Device Information */ -+ dmi_save_ipmi_device(dm); -+ } -+} -+ -+static int __init dmi_present(char __iomem *p) -+{ -+ u8 buf[15]; -+ memcpy_fromio(buf, p, 15); -+ if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) { -+ u16 num = (buf[13] << 8) | buf[12]; -+ u16 len = (buf[7] << 8) | buf[6]; -+ u32 base = (buf[11] << 24) | (buf[10] << 16) | -+ (buf[9] << 8) | buf[8]; -+ -+ /* -+ * DMI version 0.0 means that the real version is taken from -+ * the SMBIOS version, which we don't know at this point. -+ */ -+ if (buf[14] != 0) -+ printk(KERN_INFO "DMI %d.%d present.\n", -+ buf[14] >> 4, buf[14] & 0xF); -+ else -+ printk(KERN_INFO "DMI present.\n"); -+ if (dmi_table(base,len, num, dmi_decode) == 0) -+ return 0; -+ } -+ return 1; -+} -+ -+void __init dmi_scan_machine(void) -+{ -+ char __iomem *p, *q; -+ int rc; -+ -+ if (efi_enabled) { -+ if (efi.smbios == EFI_INVALID_TABLE_ADDR) -+ goto out; -+ -+ /* This is called as a core_initcall() because it isn't -+ * needed during early boot. This also means we can -+ * iounmap the space when we're done with it. -+ */ -+ p = dmi_ioremap(efi.smbios, 32); -+ if (p == NULL) -+ goto out; -+ -+ rc = dmi_present(p + 0x10); /* offset of _DMI_ string */ -+ dmi_iounmap(p, 32); -+ if (!rc) -+ return; -+ } -+ else { -+ /* -+ * no iounmap() for that ioremap(); it would be a no-op, but -+ * it's so early in setup that sucker gets confused into doing -+ * what it shouldn't if we actually call it. -+ */ -+ p = dmi_ioremap(0xF0000, 0x10000); -+ if (p == NULL) -+ goto out; -+ -+ for (q = p; q < p + 0x10000; q += 16) { -+ rc = dmi_present(q); -+ if (!rc) -+ return; -+ } -+ } -+ out: printk(KERN_INFO "DMI not present or invalid.\n"); -+} -+ -+/** -+ * dmi_check_system - check system DMI data -+ * @list: array of dmi_system_id structures to match against -+ * -+ * Walk the blacklist table running matching functions until someone -+ * returns non zero or we hit the end. Callback function is called for -+ * each successfull match. Returns the number of matches. -+ */ -+int dmi_check_system(struct dmi_system_id *list) -+{ -+ int i, count = 0; -+ struct dmi_system_id *d = list; -+ -+ while (d->ident) { -+ for (i = 0; i < ARRAY_SIZE(d->matches); i++) { -+ int s = d->matches[i].slot; -+ if (s == DMI_NONE) -+ continue; -+ if (dmi_ident[s] && strstr(dmi_ident[s], d->matches[i].substr)) -+ continue; -+ /* No match */ -+ goto fail; -+ } -+ count++; -+ if (d->callback && d->callback(d)) -+ break; -+fail: d++; -+ } -+ -+ return count; -+} -+EXPORT_SYMBOL(dmi_check_system); -+ -+/** -+ * dmi_get_system_info - return DMI data value -+ * @field: data index (see enum dmi_filed) -+ * -+ * Returns one DMI data value, can be used to perform -+ * complex DMI data checks. -+ */ -+char *dmi_get_system_info(int field) -+{ -+ return dmi_ident[field]; -+} -+EXPORT_SYMBOL(dmi_get_system_info); -+ -+/** -+ * dmi_find_device - find onboard device by type/name -+ * @type: device type or %DMI_DEV_TYPE_ANY to match all device types -+ * @desc: device name string or %NULL to match all -+ * @from: previous device found in search, or %NULL for new search. -+ * -+ * Iterates through the list of known onboard devices. If a device is -+ * found with a matching @vendor and @device, a pointer to its device -+ * structure is returned. Otherwise, %NULL is returned. -+ * A new search is initiated by passing %NULL to the @from argument. -+ * If @from is not %NULL, searches continue from next device. -+ */ -+struct dmi_device * dmi_find_device(int type, const char *name, -+ struct dmi_device *from) -+{ -+ struct list_head *d, *head = from ? &from->list : &dmi_devices; -+ -+ for(d = head->next; d != &dmi_devices; d = d->next) { -+ struct dmi_device *dev = list_entry(d, struct dmi_device, list); -+ -+ if (((type == DMI_DEV_TYPE_ANY) || (dev->type == type)) && -+ ((name == NULL) || (strcmp(dev->name, name) == 0))) -+ return dev; -+ } -+ -+ return NULL; -+} -+EXPORT_SYMBOL(dmi_find_device); -+ -+/** -+ * dmi_get_year - Return year of a DMI date -+ * @field: data index (like dmi_get_system_info) -+ * -+ * Returns -1 when the field doesn't exist. 0 when it is broken. -+ */ -+int dmi_get_year(int field) -+{ -+ int year; -+ char *s = dmi_get_system_info(field); -+ -+ if (!s) -+ return -1; -+ if (*s == '\0') -+ return 0; -+ s = strrchr(s, '/'); -+ if (!s) -+ return 0; -+ -+ s += 1; -+ year = simple_strtoul(s, NULL, 0); -+ if (year && year < 100) { /* 2-digit year */ -+ year += 1900; -+ if (year < 1996) /* no dates < spec 1.0 */ -+ year += 100; -+ } -+ -+ return year; -+} diff --git a/driver/driver-core-driver_bind-attribute-returns-incorrect-value.patch b/driver/driver-core-driver_bind-attribute-returns-incorrect-value.patch deleted file mode 100644 index 1a5c27db72caf..0000000000000 --- a/driver/driver-core-driver_bind-attribute-returns-incorrect-value.patch +++ /dev/null @@ -1,45 +0,0 @@ -From hap9@epoch.ncsc.mil Wed Mar 22 13:26:14 2006 -From: Ryan Wilson <hap9@epoch.ncsc.mil> -Subject: driver core: driver_bind attribute returns incorrect value -To: gregkh@suse.de -Cc: linux-kernel@vger.kernel.org -Date: Wed, 22 Mar 2006 16:26:25 -0500 -Message-Id: <1143062785.22254.15.camel@moss-tarheels.epoch.ncsc.mil> - -The manual driver <-> device binding attribute in sysfs doesn't return -the correct value on failure or success of driver_probe_device. -driver_probe_device returns 1 on success (the driver accepted the -device) or 0 on probe failure (when the driver didn't accept the -device but no real error occured). However, the attribute can't just -return 0 or 1, it must return the number of bytes consumed from buf -or an error value. Returning 0 indicates to userspace that nothing -was written (even though the kernel has tried to do the bind/probe and -failed). Returning 1 indicates that only one character was accepted in -which case userspace will re-try the write with a partial string. - -A more correct version of driver_bind would return count (to indicate -the entire string was consumed) when driver_probe_device returns 1 -and -ENODEV when driver_probe_device returns 0. This patch makes that -change. - -Signed-off-by: Ryan Wilson <hap9@epoch.ncsc.mil> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/base/bus.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- gregkh-2.6.orig/drivers/base/bus.c -+++ gregkh-2.6/drivers/base/bus.c -@@ -524,6 +524,11 @@ static int bus_rescan_devices_helper(str - device_attach(dev); - if (dev->parent) - up(&dev->parent->sem); -+ -+ if (err > 0) /* success */ -+ err = count; -+ else if (err == 0) /* driver didn't accept device */ -+ err = -ENODEV; - } - return 0; - } diff --git a/driver/driver-core-fix-unnecessary-null-check-in-drivers-base-class.c.patch b/driver/driver-core-fix-unnecessary-null-check-in-drivers-base-class.c.patch deleted file mode 100644 index 9ddc54fbd05c3..0000000000000 --- a/driver/driver-core-fix-unnecessary-null-check-in-drivers-base-class.c.patch +++ /dev/null @@ -1,46 +0,0 @@ -From Jayachandran.Nair@digeo.com Mon Apr 3 12:32:20 2006 -From: "Jayachandran C" <jchandra@digeo.com> -Date: Mon, 3 Apr 2006 12:31:53 -0700 -To: gregkh@suse.de -Cc: <akpm@osdl.org> -Subject: driver core: fix unnecessary NULL check in drivers/base/class.c -Message-ID: <20060403193153.GB10314@random.pao.digeo.com> -Content-Disposition: inline - -This patch tries to fix an issue in drivers/base/class.c, please -review and apply if correct. - -Patch Description: - "parent_class" is checked for NULL already, so removed the unnecessary - check. - -Signed-off-by: Jayachandran C. <c.jayachandran@gmail.com> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/base/class.c | 13 ++++++------- - 1 file changed, 6 insertions(+), 7 deletions(-) - ---- gregkh-2.6.orig/drivers/base/class.c -+++ gregkh-2.6/drivers/base/class.c -@@ -562,14 +562,13 @@ int class_device_add(struct class_device - kobject_uevent(&class_dev->kobj, KOBJ_ADD); - - /* notify any interfaces this device is now here */ -- if (parent_class) { -- down(&parent_class->sem); -- list_add_tail(&class_dev->node, &parent_class->children); -- list_for_each_entry(class_intf, &parent_class->interfaces, node) -- if (class_intf->add) -- class_intf->add(class_dev, class_intf); -- up(&parent_class->sem); -+ down(&parent_class->sem); -+ list_add_tail(&class_dev->node, &parent_class->children); -+ list_for_each_entry(class_intf, &parent_class->interfaces, node) { -+ if (class_intf->add) -+ class_intf->add(class_dev, class_intf); - } -+ up(&parent_class->sem); - - register_done: - if (error) { diff --git a/driver/driver-core-safely-unbind-drivers-for-devices-not-on-a-bus.patch b/driver/driver-core-safely-unbind-drivers-for-devices-not-on-a-bus.patch deleted file mode 100644 index ecf169c8dd357..0000000000000 --- a/driver/driver-core-safely-unbind-drivers-for-devices-not-on-a-bus.patch +++ /dev/null @@ -1,30 +0,0 @@ -From stern@rowland.harvard.edu Fri Mar 31 08:52:32 2006 -Date: Fri, 31 Mar 2006 11:52:25 -0500 (EST) -From: Alan Stern <stern@rowland.harvard.edu> -To: Greg KH <greg@kroah.com> -Subject: driver core: safely unbind drivers for devices not on a bus -Message-ID: <Pine.LNX.4.44L0.0603311146430.5091-100000@iolanthe.rowland.org> - -This patch (as667) changes the __device_release_driver() routine to -prevent it from crashing when it runs across a device not on any bus. -This seems logical, inasmuch as the corresponding bus_add_device() -routine has an explicit check allowing it to accept such devices. - -Signed-off-by: Alan Stern <stern@rowland.harvard.edu> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/base/dd.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- gregkh-2.6.orig/drivers/base/dd.c -+++ gregkh-2.6/drivers/base/dd.c -@@ -209,7 +209,7 @@ static void __device_release_driver(stru - sysfs_remove_link(&dev->kobj, "driver"); - klist_remove(&dev->knode_driver); - -- if (dev->bus->remove) -+ if (dev->bus && dev->bus->remove) - dev->bus->remove(dev); - else if (drv->remove) - drv->remove(dev); diff --git a/driver/pm-print-name-of-failed-suspend-function.patch b/driver/pm-print-name-of-failed-suspend-function.patch deleted file mode 100644 index 5a2b02033dce0..0000000000000 --- a/driver/pm-print-name-of-failed-suspend-function.patch +++ /dev/null @@ -1,149 +0,0 @@ -From akpm@osdl.org Thu Mar 23 01:42:07 2006 -Message-Id: <200603230941.k2N9ft97019269@shell0.pdx.osdl.net> -Subject: pm: print name of failed suspend function -To: greg@kroah.com -Cc: akpm@osdl.org, mochel@digitalimplant.org, nigel@suspend2.net, pavel@ucw.cz -From: akpm@osdl.org -Date: Thu, 23 Mar 2006 01:38:34 -0800 - -From: Andrew Morton <akpm@osdl.org> - -Print more diagnostic info to help identify the source of power management -suspend failures. - -Example: - -usb_hcd_pci_suspend(): pci_set_power_state+0x0/0x1af() returns -22 -pci_device_suspend(): usb_hcd_pci_suspend+0x0/0x11b() returns -22 -suspend_device(): pci_device_suspend+0x0/0x34() returns -22 - -Work-in-progress. It needs lots more suspend_report_result() calls sprinkled -everywhere. - -Cc: Patrick Mochel <mochel@digitalimplant.org> -Cc: Pavel Machek <pavel@ucw.cz> -Cc: Nigel Cunningham <nigel@suspend2.net> -Signed-off-by: Andrew Morton <akpm@osdl.org> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - drivers/base/power/suspend.c | 12 ++++++++++++ - drivers/pci/pci-driver.c | 6 ++++-- - drivers/pci/pci.c | 6 ++++-- - drivers/usb/core/hcd-pci.c | 7 +++---- - include/linux/pm.h | 8 ++++++++ - 5 files changed, 31 insertions(+), 8 deletions(-) - ---- gregkh-2.6.orig/drivers/base/power/suspend.c -+++ gregkh-2.6/drivers/base/power/suspend.c -@@ -10,6 +10,8 @@ - - #include <linux/vt_kern.h> - #include <linux/device.h> -+#include <linux/kallsyms.h> -+#include <linux/pm.h> - #include "../base.h" - #include "power.h" - -@@ -58,6 +60,7 @@ int suspend_device(struct device * dev, - if (dev->bus && dev->bus->suspend && !dev->power.power_state.event) { - dev_dbg(dev, "suspending\n"); - error = dev->bus->suspend(dev, state); -+ suspend_report_result(dev->bus->suspend, error); - } - up(&dev->sem); - return error; -@@ -169,3 +172,12 @@ int device_power_down(pm_message_t state - - EXPORT_SYMBOL_GPL(device_power_down); - -+void __suspend_report_result(const char *function, void *fn, int ret) -+{ -+ if (ret) { -+ printk(KERN_ERR "%s(): ", function); -+ print_fn_descriptor_symbol("%s() returns ", (unsigned long)fn); -+ printk("%d\n", ret); -+ } -+} -+EXPORT_SYMBOL_GPL(__suspend_report_result); ---- gregkh-2.6.orig/drivers/pci/pci-driver.c -+++ gregkh-2.6/drivers/pci/pci-driver.c -@@ -271,10 +271,12 @@ static int pci_device_suspend(struct dev - struct pci_driver * drv = pci_dev->driver; - int i = 0; - -- if (drv && drv->suspend) -+ if (drv && drv->suspend) { - i = drv->suspend(pci_dev, state); -- else -+ suspend_report_result(drv->suspend, i); -+ } else { - pci_save_state(pci_dev); -+ } - return i; - } - ---- gregkh-2.6.orig/drivers/pci/pci.c -+++ gregkh-2.6/drivers/pci/pci.c -@@ -307,9 +307,11 @@ pci_set_power_state(struct pci_dev *dev, - * Can enter D0 from any state, but if we can only go deeper - * to sleep if we're already in a low power state - */ -- if (state != PCI_D0 && dev->current_state > state) -+ if (state != PCI_D0 && dev->current_state > state) { -+ printk(KERN_ERR "%s(): %s: state=%d, current state=%d\n", -+ __FUNCTION__, pci_name(dev), state, dev->current_state); - return -EINVAL; -- else if (dev->current_state == state) -+ } else if (dev->current_state == state) - return 0; /* we're already there */ - - /* find PCI PM capability in list */ ---- gregkh-2.6.orig/drivers/usb/core/hcd-pci.c -+++ gregkh-2.6/drivers/usb/core/hcd-pci.c -@@ -213,11 +213,9 @@ int usb_hcd_pci_suspend (struct pci_dev - - if (hcd->driver->suspend) { - retval = hcd->driver->suspend(hcd, message); -- if (retval) { -- dev_dbg (&dev->dev, "PCI pre-suspend fail, %d\n", -- retval); -+ suspend_report_result(hcd->driver->suspend, retval); -+ if (retval) - goto done; -- } - } - synchronize_irq(dev->irq); - -@@ -263,6 +261,7 @@ int usb_hcd_pci_suspend (struct pci_dev - * some device state (e.g. as part of clock reinit). - */ - retval = pci_set_power_state (dev, PCI_D3hot); -+ suspend_report_result(pci_set_power_state, retval); - if (retval == 0) { - int wake = device_can_wakeup(&hcd->self.root_hub->dev); - ---- gregkh-2.6.orig/include/linux/pm.h -+++ gregkh-2.6/include/linux/pm.h -@@ -199,6 +199,12 @@ extern int device_suspend(pm_message_t s - - extern int dpm_runtime_suspend(struct device *, pm_message_t); - extern void dpm_runtime_resume(struct device *); -+extern void __suspend_report_result(const char *function, void *fn, int ret); -+ -+#define suspend_report_result(fn, ret) \ -+ do { \ -+ __suspend_report_result(__FUNCTION__, fn, ret); \ -+ } while (0) - - #else /* !CONFIG_PM */ - -@@ -219,6 +225,8 @@ static inline void dpm_runtime_resume(st - { - } - -+#define suspend_report_result(fn, ret) do { } while (0) -+ - #endif - - /* changes to device_may_wakeup take effect on the next pm state change. diff --git a/driver/sysfs-allow-sysfs-attribute-files-to-be-pollable.patch b/driver/sysfs-allow-sysfs-attribute-files-to-be-pollable.patch deleted file mode 100644 index 19d57618725f8..0000000000000 --- a/driver/sysfs-allow-sysfs-attribute-files-to-be-pollable.patch +++ /dev/null @@ -1,253 +0,0 @@ -From neilb@suse.de Wed Mar 22 15:03:35 2006 -From: NeilBrown <neilb@suse.de> -To: Andrew Morton <akpm@osdl.org>, Greg KH <greg@kroah.com> -Date: Mon, 20 Mar 2006 17:53:53 +1100 -Message-Id: <1060320065353.30933@suse.de> -Cc: linux-kernel@vger.kernel.org -Subject: sysfs: Allow sysfs attribute files to be pollable - - -It works like this: - Open the file - Read all the contents. - Call poll requesting POLLERR or POLLPRI (so select/exceptfds works) - When poll returns, - close the file and go to top of loop. - or lseek to start of file and go back to the 'read'. - -Events are signaled by an object manager calling - sysfs_notify(kobj, dir, attr); - -If the dir is non-NULL, it is used to find a subdirectory which -contains the attribute (presumably created by sysfs_create_group). - -This has a cost of one int per attribute, one wait_queuehead per kobject, -one int per open file. - -The name "sysfs_notify" may be confused with the inotify -functionality. Maybe it would be nice to support inotify for sysfs -attributes as well? - -This patch also uses sysfs_notify to allow /sys/block/md*/md/sync_action -to be pollable - -Signed-off-by: Neil Brown <neilb@suse.de> -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - - ---- - drivers/md/md.c | 1 - fs/sysfs/dir.c | 1 - fs/sysfs/file.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ - fs/sysfs/sysfs.h | 1 - include/linux/kobject.h | 2 + - include/linux/sysfs.h | 6 +++ - lib/kobject.c | 1 - 7 files changed, 88 insertions(+) - ---- gregkh-2.6.orig/drivers/md/md.c -+++ gregkh-2.6/drivers/md/md.c -@@ -163,6 +163,7 @@ void md_new_event(mddev_t *mddev) - { - atomic_inc(&md_event_count); - wake_up(&md_event_waiters); -+ sysfs_notify(&mddev->kobj, NULL, "sync_action"); - } - EXPORT_SYMBOL_GPL(md_new_event); - ---- gregkh-2.6.orig/fs/sysfs/dir.c -+++ gregkh-2.6/fs/sysfs/dir.c -@@ -43,6 +43,7 @@ static struct sysfs_dirent * sysfs_new_d - - memset(sd, 0, sizeof(*sd)); - atomic_set(&sd->s_count, 1); -+ atomic_set(&sd->s_event, 0); - INIT_LIST_HEAD(&sd->s_children); - list_add(&sd->s_sibling, &parent_sd->s_children); - sd->s_element = element; ---- gregkh-2.6.orig/fs/sysfs/file.c -+++ gregkh-2.6/fs/sysfs/file.c -@@ -6,6 +6,7 @@ - #include <linux/fsnotify.h> - #include <linux/kobject.h> - #include <linux/namei.h> -+#include <linux/poll.h> - #include <asm/uaccess.h> - #include <asm/semaphore.h> - -@@ -57,6 +58,7 @@ struct sysfs_buffer { - struct sysfs_ops * ops; - struct semaphore sem; - int needs_read_fill; -+ int event; - }; - - -@@ -72,6 +74,7 @@ struct sysfs_buffer { - */ - static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer) - { -+ struct sysfs_dirent * sd = dentry->d_fsdata; - struct attribute * attr = to_attr(dentry); - struct kobject * kobj = to_kobj(dentry->d_parent); - struct sysfs_ops * ops = buffer->ops; -@@ -83,6 +86,7 @@ static int fill_read_buffer(struct dentr - if (!buffer->page) - return -ENOMEM; - -+ buffer->event = atomic_read(&sd->s_event); - count = ops->show(kobj,attr,buffer->page); - buffer->needs_read_fill = 0; - BUG_ON(count > (ssize_t)PAGE_SIZE); -@@ -348,12 +352,84 @@ static int sysfs_release(struct inode * - return 0; - } - -+/* Sysfs attribute files are pollable. The idea is that you read -+ * the content and then you use 'poll' or 'select' to wait for -+ * the content to change. When the content changes (assuming the -+ * manager for the kobject supports notification), poll will -+ * return POLLERR|POLLPRI, and select will return the fd whether -+ * it is waiting for read, write, or exceptions. -+ * Once poll/select indicates that the value has changed, you -+ * need to close and re-open the file, as simply seeking and reading -+ * again will not get new data, or reset the state of 'poll'. -+ * Reminder: this only works for attributes which actively support -+ * it, and it is not possible to test an attribute from userspace -+ * to see if it supports poll (Nether 'poll' or 'select' return -+ * an appropriate error code). When in doubt, set a suitable timeout value. -+ */ -+static unsigned int sysfs_poll(struct file *filp, poll_table *wait) -+{ -+ struct sysfs_buffer * buffer = filp->private_data; -+ struct kobject * kobj = to_kobj(filp->f_dentry->d_parent); -+ struct sysfs_dirent * sd = filp->f_dentry->d_fsdata; -+ int res = 0; -+ -+ poll_wait(filp, &kobj->poll, wait); -+ -+ if (buffer->event != atomic_read(&sd->s_event)) { -+ res = POLLERR|POLLPRI; -+ buffer->needs_read_fill = 1; -+ } -+ -+ return res; -+} -+ -+ -+static struct dentry *step_down(struct dentry *dir, const char * name) -+{ -+ struct dentry * de; -+ -+ if (dir == NULL || dir->d_inode == NULL) -+ return NULL; -+ -+ mutex_lock(&dir->d_inode->i_mutex); -+ de = lookup_one_len(name, dir, strlen(name)); -+ mutex_unlock(&dir->d_inode->i_mutex); -+ dput(dir); -+ if (IS_ERR(de)) -+ return NULL; -+ if (de->d_inode == NULL) { -+ dput(de); -+ return NULL; -+ } -+ return de; -+} -+ -+void sysfs_notify(struct kobject * k, char *dir, char *attr) -+{ -+ struct dentry *de = k->dentry; -+ if (de) -+ dget(de); -+ if (de && dir) -+ de = step_down(de, dir); -+ if (de && attr) -+ de = step_down(de, attr); -+ if (de) { -+ struct sysfs_dirent * sd = de->d_fsdata; -+ if (sd) -+ atomic_inc(&sd->s_event); -+ wake_up_interruptible(&k->poll); -+ dput(de); -+ } -+} -+EXPORT_SYMBOL_GPL(sysfs_notify); -+ - const struct file_operations sysfs_file_operations = { - .read = sysfs_read_file, - .write = sysfs_write_file, - .llseek = generic_file_llseek, - .open = sysfs_open_file, - .release = sysfs_release, -+ .poll = sysfs_poll, - }; - - ---- gregkh-2.6.orig/fs/sysfs/sysfs.h -+++ gregkh-2.6/fs/sysfs/sysfs.h -@@ -11,6 +11,7 @@ extern int sysfs_make_dirent(struct sysf - - extern int sysfs_add_file(struct dentry *, const struct attribute *, int); - extern void sysfs_hash_and_remove(struct dentry * dir, const char * name); -+extern struct sysfs_dirent *sysfs_find(struct sysfs_dirent *dir, const char * name); - - extern int sysfs_create_subdir(struct kobject *, const char *, struct dentry **); - extern void sysfs_remove_subdir(struct dentry *); ---- gregkh-2.6.orig/include/linux/kobject.h -+++ gregkh-2.6/include/linux/kobject.h -@@ -24,6 +24,7 @@ - #include <linux/rwsem.h> - #include <linux/kref.h> - #include <linux/kernel.h> -+#include <linux/wait.h> - #include <asm/atomic.h> - - #define KOBJ_NAME_LEN 20 -@@ -56,6 +57,7 @@ struct kobject { - struct kset * kset; - struct kobj_type * ktype; - struct dentry * dentry; -+ wait_queue_head_t poll; - }; - - extern int kobject_set_name(struct kobject *, const char *, ...) ---- gregkh-2.6.orig/include/linux/sysfs.h -+++ gregkh-2.6/include/linux/sysfs.h -@@ -74,6 +74,7 @@ struct sysfs_dirent { - umode_t s_mode; - struct dentry * s_dentry; - struct iattr * s_iattr; -+ atomic_t s_event; - }; - - #define SYSFS_ROOT 0x0001 -@@ -117,6 +118,7 @@ int sysfs_remove_bin_file(struct kobject - - int sysfs_create_group(struct kobject *, const struct attribute_group *); - void sysfs_remove_group(struct kobject *, const struct attribute_group *); -+void sysfs_notify(struct kobject * k, char *dir, char *attr); - - #else /* CONFIG_SYSFS */ - -@@ -185,6 +187,10 @@ static inline void sysfs_remove_group(st - ; - } - -+static inline void sysfs_notify(struct kobject * k, char *dir, char *attr) -+{ -+} -+ - #endif /* CONFIG_SYSFS */ - - #endif /* _SYSFS_H_ */ ---- gregkh-2.6.orig/lib/kobject.c -+++ gregkh-2.6/lib/kobject.c -@@ -129,6 +129,7 @@ void kobject_init(struct kobject * kobj) - WARN_ON(atomic_read(&kobj->kref.refcount)); - kref_init(&kobj->kref); - INIT_LIST_HEAD(&kobj->entry); -+ init_waitqueue_head(&kobj->poll); - kobj->kset = kset_get(kobj->kset); - } - diff --git a/driver/sysfs-off-by-one.patch b/driver/sysfs-off-by-one.patch deleted file mode 100644 index 4aa90597cb340..0000000000000 --- a/driver/sysfs-off-by-one.patch +++ /dev/null @@ -1,29 +0,0 @@ -From foo@baz Tue Apr 9 12:12:43 2002 -Date: Fri, 31 Mar 2006 15:37:06 -0800 -From: Greg Kroah-Hartman <gregkh@suse.de> -Subject: sysfs: zero terminate sysfs write buffers (CVE-2006-1055) - -No one should be writing a PAGE_SIZE worth of data to a normal sysfs -file, so properly terminate the buffer. - -Thanks to Al Viro for pointing out my stupidity here. - -CVE-2006-1055 has been assigned for this. - -Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> - ---- - fs/sysfs/file.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- gregkh-2.6.orig/fs/sysfs/file.c -+++ gregkh-2.6/fs/sysfs/file.c -@@ -183,7 +183,7 @@ fill_write_buffer(struct sysfs_buffer * - return -ENOMEM; - - if (count >= PAGE_SIZE) -- count = PAGE_SIZE; -+ count = PAGE_SIZE - 1; - error = copy_from_user(buffer->page,buf,count); - buffer->needs_read_fill = 1; - return error ? -EFAULT : count; |