Netdev List
 help / color / mirror / Atom feed
* [PATCH 34/34] Remove old DMI & SMBIOS code and make SMBIOS default on
From: Prarit Bhargava @ 2011-07-18 13:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-ia64, linux-pci, dri-devel, platform-driver-x86,
	grant.likely, linux-ide, linux-i2c, device-drivers-devel, abelay,
	Prarit Bhargava, eric.piel, x86, lm-sensors, linux-acpi,
	linux-input, linux-media, johnpol, linux-watchdog, rtc-linux, dz,
	openipmi-developer, evel, netdev, linux-usb, rpurdie,
	linux-crypto
In-Reply-To: <1310994528-26276-1-git-send-email-prarit@redhat.com>

This code has now been completely replaced by the new System Firmware
Interface (SYSFW) and SMBIOS code.  It is no longer needed in the kernel.

Cc: linux-ia64@vger.kernel.org
Cc: x86@kernel.org
Cc: linux-acpi@vger.kernel.org
Cc: linux-ide@vger.kernel.org
Cc: openipmi-developer@lists.sourceforge.net
Cc: platform-driver-x86@vger.kernel.org
Cc: linux-crypto@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: lm-sensors@lm-sensors.org
Cc: linux-i2c@vger.kernel.org
Cc: linux-ide@vger.kernel.org
Cc: linux-input@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-pci@vger.kernel.org
Cc: rtc-linux@googlegroups.com
Cc: evel@driverdev.osuosl.org
Cc: linux-usb@vger.kernel.org
Cc: device-drivers-devel@blackfin.uclinux.org
Cc: linux-watchdog@vger.kernel.org
Cc: grant.likely@secretlab.ca
Cc: dz@debian.org
Cc: rpurdie@rpsys.net
Cc: eric.piel@tremplin-utc.net
Cc: abelay@mit.edu
Cc: johnpol@2ka.mipt.ru
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
 arch/ia64/include/asm/dmi.h     |   12 -
 arch/x86/Kconfig                |    9 -
 arch/x86/include/asm/dmi.h      |   19 -
 drivers/firmware/Kconfig        |   20 -
 drivers/firmware/Makefile       |    3 -
 drivers/firmware/dmi-id.c       |  245 -------------
 drivers/firmware/dmi-sysfs.c    |  696 ------------------------------------
 drivers/firmware/dmi_scan.c     |  751 ---------------------------------------
 include/linux/dmi.h             |  139 -------
 include/linux/mod_devicetable.h |   55 ---
 10 files changed, 0 insertions(+), 1949 deletions(-)
 delete mode 100644 arch/ia64/include/asm/dmi.h
 delete mode 100644 arch/x86/include/asm/dmi.h
 delete mode 100644 drivers/firmware/dmi-id.c
 delete mode 100644 drivers/firmware/dmi-sysfs.c
 delete mode 100644 drivers/firmware/dmi_scan.c
 delete mode 100644 include/linux/dmi.h

diff --git a/arch/ia64/include/asm/dmi.h b/arch/ia64/include/asm/dmi.h
deleted file mode 100644
index 1ed4c8f..0000000
--- a/arch/ia64/include/asm/dmi.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _ASM_DMI_H
-#define _ASM_DMI_H 1
-
-#include <linux/slab.h>
-#include <asm/io.h>
-
-/* Use normal IO mappings for DMI */
-#define dmi_ioremap ioremap
-#define dmi_iounmap(x,l) iounmap(x)
-#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC)
-
-#endif
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index e7cdde8..92ee12b 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -626,15 +626,6 @@ config APB_TIMER
 
 # Mark as expert because too many people got it wrong.
 # The code disables itself when not needed.
-config DMI
-	default y
-	bool "Enable DMI scanning" if EXPERT
-	---help---
-	  Enabled scanning of DMI to identify machine quirks. Say Y
-	  here unless you have verified that your setup is not
-	  affected by entries in the DMI blacklist. Required by PNP
-	  BIOS code.
-
 config SMBIOS
 	depends on SYSTEM_FIRMWARE
 	bool "Enable SMBIOS scanning" if EXPERT
diff --git a/arch/x86/include/asm/dmi.h b/arch/x86/include/asm/dmi.h
deleted file mode 100644
index fd8f9e2..0000000
--- a/arch/x86/include/asm/dmi.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _ASM_X86_DMI_H
-#define _ASM_X86_DMI_H
-
-#include <linux/compiler.h>
-#include <linux/init.h>
-
-#include <asm/io.h>
-#include <asm/setup.h>
-
-static __always_inline __init void *dmi_alloc(unsigned len)
-{
-	return extend_brk(len, sizeof(int));
-}
-
-/* Use early IO mappings for DMI because it's initialized early */
-#define dmi_ioremap early_ioremap
-#define dmi_iounmap early_iounmap
-
-#endif /* _ASM_X86_DMI_H */
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 23066d8..a46c162 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -104,26 +104,6 @@ config DCDBAS
 	  Say Y or M here to enable the driver for use by Dell systems
 	  management software such as Dell OpenManage.
 
-config DMIID
-    bool "Export DMI identification via sysfs to userspace"
-    depends on DMI
-    default y
-	help
-	  Say Y here if you want to query SMBIOS/DMI system identification
-	  information from userspace through /sys/class/dmi/id/ or if you want
-	  DMI-based module auto-loading.
-
-config DMI_SYSFS
-	tristate "DMI table support in sysfs"
-	depends on SYSFS && DMI
-	default n
-	help
-	  Say Y or M here to enable the exporting of the raw DMI table
-	  data via sysfs.  This is useful for consuming the data without
-	  requiring any access to /dev/mem at all.  Tables are found
-	  under /sys/firmware/dmi when this option is enabled and
-	  loaded.
-
 config ISCSI_IBFT_FIND
 	bool "iSCSI Boot Firmware Table Attributes"
 	depends on X86
diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile
index 5c9d81f..f372289 100644
--- a/drivers/firmware/Makefile
+++ b/drivers/firmware/Makefile
@@ -1,14 +1,11 @@
 #
 # Makefile for the linux kernel.
 #
-obj-$(CONFIG_DMI)		+= dmi_scan.o
-obj-$(CONFIG_DMI_SYSFS)		+= dmi-sysfs.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
 obj-$(CONFIG_DCDBAS)		+= dcdbas.o
-obj-$(CONFIG_DMIID)		+= dmi-id.o
 obj-$(CONFIG_ISCSI_IBFT_FIND)	+= iscsi_ibft_find.o
 obj-$(CONFIG_ISCSI_IBFT)	+= iscsi_ibft.o
 obj-$(CONFIG_FIRMWARE_MEMMAP)	+= memmap.o
diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
deleted file mode 100644
index 94a58a0..0000000
--- a/drivers/firmware/dmi-id.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Export SMBIOS/DMI info via sysfs to userspace
- *
- * Copyright 2007, Lennart Poettering
- *
- * Licensed under GPLv2
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/dmi.h>
-#include <linux/device.h>
-#include <linux/slab.h>
-
-struct dmi_device_attribute{
-	struct device_attribute dev_attr;
-	int field;
-};
-#define to_dmi_dev_attr(_dev_attr) \
-	container_of(_dev_attr, struct dmi_device_attribute, dev_attr)
-
-static ssize_t sys_dmi_field_show(struct device *dev,
-				  struct device_attribute *attr,
-				  char *page)
-{
-	int field = to_dmi_dev_attr(attr)->field;
-	ssize_t len;
-	len = scnprintf(page, PAGE_SIZE, "%s\n", dmi_get_system_info(field));
-	page[len-1] = '\n';
-	return len;
-}
-
-#define DMI_ATTR(_name, _mode, _show, _field)			\
-	{ .dev_attr = __ATTR(_name, _mode, _show, NULL),	\
-	  .field = _field }
-
-#define DEFINE_DMI_ATTR_WITH_SHOW(_name, _mode, _field)		\
-static struct dmi_device_attribute sys_dmi_##_name##_attr =	\
-	DMI_ATTR(_name, _mode, sys_dmi_field_show, _field);
-
-DEFINE_DMI_ATTR_WITH_SHOW(bios_vendor,		0444, DMI_BIOS_VENDOR);
-DEFINE_DMI_ATTR_WITH_SHOW(bios_version,		0444, DMI_BIOS_VERSION);
-DEFINE_DMI_ATTR_WITH_SHOW(bios_date,		0444, DMI_BIOS_DATE);
-DEFINE_DMI_ATTR_WITH_SHOW(sys_vendor,		0444, DMI_SYS_VENDOR);
-DEFINE_DMI_ATTR_WITH_SHOW(product_name,		0444, DMI_PRODUCT_NAME);
-DEFINE_DMI_ATTR_WITH_SHOW(product_version,	0444, DMI_PRODUCT_VERSION);
-DEFINE_DMI_ATTR_WITH_SHOW(product_serial,	0400, DMI_PRODUCT_SERIAL);
-DEFINE_DMI_ATTR_WITH_SHOW(product_uuid,		0400, DMI_PRODUCT_UUID);
-DEFINE_DMI_ATTR_WITH_SHOW(board_vendor,		0444, DMI_BOARD_VENDOR);
-DEFINE_DMI_ATTR_WITH_SHOW(board_name,		0444, DMI_BOARD_NAME);
-DEFINE_DMI_ATTR_WITH_SHOW(board_version,	0444, DMI_BOARD_VERSION);
-DEFINE_DMI_ATTR_WITH_SHOW(board_serial,		0400, DMI_BOARD_SERIAL);
-DEFINE_DMI_ATTR_WITH_SHOW(board_asset_tag,	0444, DMI_BOARD_ASSET_TAG);
-DEFINE_DMI_ATTR_WITH_SHOW(chassis_vendor,	0444, DMI_CHASSIS_VENDOR);
-DEFINE_DMI_ATTR_WITH_SHOW(chassis_type,		0444, DMI_CHASSIS_TYPE);
-DEFINE_DMI_ATTR_WITH_SHOW(chassis_version,	0444, DMI_CHASSIS_VERSION);
-DEFINE_DMI_ATTR_WITH_SHOW(chassis_serial,	0400, DMI_CHASSIS_SERIAL);
-DEFINE_DMI_ATTR_WITH_SHOW(chassis_asset_tag,	0444, DMI_CHASSIS_ASSET_TAG);
-
-static void ascii_filter(char *d, const char *s)
-{
-	/* Filter out characters we don't want to see in the modalias string */
-	for (; *s; s++)
-		if (*s > ' ' && *s < 127 && *s != ':')
-			*(d++) = *s;
-
-	*d = 0;
-}
-
-static ssize_t get_modalias(char *buffer, size_t buffer_size)
-{
-	static const struct mafield {
-		const char *prefix;
-		int field;
-	} fields[] = {
-		{ "bvn", DMI_BIOS_VENDOR },
-		{ "bvr", DMI_BIOS_VERSION },
-		{ "bd",  DMI_BIOS_DATE },
-		{ "svn", DMI_SYS_VENDOR },
-		{ "pn",  DMI_PRODUCT_NAME },
-		{ "pvr", DMI_PRODUCT_VERSION },
-		{ "rvn", DMI_BOARD_VENDOR },
-		{ "rn",  DMI_BOARD_NAME },
-		{ "rvr", DMI_BOARD_VERSION },
-		{ "cvn", DMI_CHASSIS_VENDOR },
-		{ "ct",  DMI_CHASSIS_TYPE },
-		{ "cvr", DMI_CHASSIS_VERSION },
-		{ NULL,  DMI_NONE }
-	};
-
-	ssize_t l, left;
-	char *p;
-	const struct mafield *f;
-
-	strcpy(buffer, "dmi");
-	p = buffer + 3; left = buffer_size - 4;
-
-	for (f = fields; f->prefix && left > 0; f++) {
-		const char *c;
-		char *t;
-
-		c = dmi_get_system_info(f->field);
-		if (!c)
-			continue;
-
-		t = kmalloc(strlen(c) + 1, GFP_KERNEL);
-		if (!t)
-			break;
-		ascii_filter(t, c);
-		l = scnprintf(p, left, ":%s%s", f->prefix, t);
-		kfree(t);
-
-		p += l;
-		left -= l;
-	}
-
-	p[0] = ':';
-	p[1] = 0;
-
-	return p - buffer + 1;
-}
-
-static ssize_t sys_dmi_modalias_show(struct device *dev,
-				     struct device_attribute *attr, char *page)
-{
-	ssize_t r;
-	r = get_modalias(page, PAGE_SIZE-1);
-	page[r] = '\n';
-	page[r+1] = 0;
-	return r+1;
-}
-
-static struct device_attribute sys_dmi_modalias_attr =
-	__ATTR(modalias, 0444, sys_dmi_modalias_show, NULL);
-
-static struct attribute *sys_dmi_attributes[DMI_STRING_MAX+2];
-
-static struct attribute_group sys_dmi_attribute_group = {
-	.attrs = sys_dmi_attributes,
-};
-
-static const struct attribute_group* sys_dmi_attribute_groups[] = {
-	&sys_dmi_attribute_group,
-	NULL
-};
-
-static int dmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
-{
-	ssize_t len;
-
-	if (add_uevent_var(env, "MODALIAS="))
-		return -ENOMEM;
-	len = get_modalias(&env->buf[env->buflen - 1],
-			   sizeof(env->buf) - env->buflen);
-	if (len >= (sizeof(env->buf) - env->buflen))
-		return -ENOMEM;
-	env->buflen += len;
-	return 0;
-}
-
-static struct class dmi_class = {
-	.name = "dmi",
-	.dev_release = (void(*)(struct device *)) kfree,
-	.dev_uevent = dmi_dev_uevent,
-};
-
-static struct device *dmi_dev;
-
-/* Initialization */
-
-#define ADD_DMI_ATTR(_name, _field) \
-	if (dmi_get_system_info(_field)) \
-		sys_dmi_attributes[i++] = &sys_dmi_##_name##_attr.dev_attr.attr;
-
-/* In a separate function to keep gcc 3.2 happy - do NOT merge this in
-   dmi_id_init! */
-static void __init dmi_id_init_attr_table(void)
-{
-	int i;
-
-	/* Not necessarily all DMI fields are available on all
-	 * systems, hence let's built an attribute table of just
-	 * what's available */
-	i = 0;
-	ADD_DMI_ATTR(bios_vendor,       DMI_BIOS_VENDOR);
-	ADD_DMI_ATTR(bios_version,      DMI_BIOS_VERSION);
-	ADD_DMI_ATTR(bios_date,         DMI_BIOS_DATE);
-	ADD_DMI_ATTR(sys_vendor,        DMI_SYS_VENDOR);
-	ADD_DMI_ATTR(product_name,      DMI_PRODUCT_NAME);
-	ADD_DMI_ATTR(product_version,   DMI_PRODUCT_VERSION);
-	ADD_DMI_ATTR(product_serial,    DMI_PRODUCT_SERIAL);
-	ADD_DMI_ATTR(product_uuid,      DMI_PRODUCT_UUID);
-	ADD_DMI_ATTR(board_vendor,      DMI_BOARD_VENDOR);
-	ADD_DMI_ATTR(board_name,        DMI_BOARD_NAME);
-	ADD_DMI_ATTR(board_version,     DMI_BOARD_VERSION);
-	ADD_DMI_ATTR(board_serial,      DMI_BOARD_SERIAL);
-	ADD_DMI_ATTR(board_asset_tag,   DMI_BOARD_ASSET_TAG);
-	ADD_DMI_ATTR(chassis_vendor,    DMI_CHASSIS_VENDOR);
-	ADD_DMI_ATTR(chassis_type,      DMI_CHASSIS_TYPE);
-	ADD_DMI_ATTR(chassis_version,   DMI_CHASSIS_VERSION);
-	ADD_DMI_ATTR(chassis_serial,    DMI_CHASSIS_SERIAL);
-	ADD_DMI_ATTR(chassis_asset_tag, DMI_CHASSIS_ASSET_TAG);
-	sys_dmi_attributes[i++] = &sys_dmi_modalias_attr.attr;
-}
-
-static int __init dmi_id_init(void)
-{
-	int ret;
-
-	if (!dmi_available)
-		return -ENODEV;
-
-	dmi_id_init_attr_table();
-
-	ret = class_register(&dmi_class);
-	if (ret)
-		return ret;
-
-	dmi_dev = kzalloc(sizeof(*dmi_dev), GFP_KERNEL);
-	if (!dmi_dev) {
-		ret = -ENOMEM;
-		goto fail_class_unregister;
-	}
-
-	dmi_dev->class = &dmi_class;
-	dev_set_name(dmi_dev, "id");
-	dmi_dev->groups = sys_dmi_attribute_groups;
-
-	ret = device_register(dmi_dev);
-	if (ret)
-		goto fail_free_dmi_dev;
-
-	return 0;
-
-fail_free_dmi_dev:
-	kfree(dmi_dev);
-fail_class_unregister:
-
-	class_unregister(&dmi_class);
-
-	return ret;
-}
-
-arch_initcall(dmi_id_init);
diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c
deleted file mode 100644
index eb26d62..0000000
--- a/drivers/firmware/dmi-sysfs.c
+++ /dev/null
@@ -1,696 +0,0 @@
-/*
- * dmi-sysfs.c
- *
- * This module exports the DMI tables read-only to userspace through the
- * sysfs file system.
- *
- * Data is currently found below
- *    /sys/firmware/dmi/...
- *
- * DMI attributes are presented in attribute files with names
- * formatted using %d-%d, so that the first integer indicates the
- * structure type (0-255), and the second field is the instance of that
- * entry.
- *
- * Copyright 2011 Google, Inc.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/kobject.h>
-#include <linux/dmi.h>
-#include <linux/capability.h>
-#include <linux/slab.h>
-#include <linux/list.h>
-#include <linux/io.h>
-
-#define MAX_ENTRY_TYPE 255 /* Most of these aren't used, but we consider
-			      the top entry type is only 8 bits */
-
-struct dmi_sysfs_entry {
-	struct dmi_header dh;
-	struct kobject kobj;
-	int instance;
-	int position;
-	struct list_head list;
-	struct kobject *child;
-};
-
-/*
- * Global list of dmi_sysfs_entry.  Even though this should only be
- * manipulated at setup and teardown, the lazy nature of the kobject
- * system means we get lazy removes.
- */
-static LIST_HEAD(entry_list);
-static DEFINE_SPINLOCK(entry_list_lock);
-
-/* dmi_sysfs_attribute - Top level attribute. used by all entries. */
-struct dmi_sysfs_attribute {
-	struct attribute attr;
-	ssize_t (*show)(struct dmi_sysfs_entry *entry, char *buf);
-};
-
-#define DMI_SYSFS_ATTR(_entry, _name) \
-struct dmi_sysfs_attribute dmi_sysfs_attr_##_entry##_##_name = { \
-	.attr = {.name = __stringify(_name), .mode = 0400}, \
-	.show = dmi_sysfs_##_entry##_##_name, \
-}
-
-/*
- * dmi_sysfs_mapped_attribute - Attribute where we require the entry be
- * mapped in.  Use in conjunction with dmi_sysfs_specialize_attr_ops.
- */
-struct dmi_sysfs_mapped_attribute {
-	struct attribute attr;
-	ssize_t (*show)(struct dmi_sysfs_entry *entry,
-			const struct dmi_header *dh,
-			char *buf);
-};
-
-#define DMI_SYSFS_MAPPED_ATTR(_entry, _name) \
-struct dmi_sysfs_mapped_attribute dmi_sysfs_attr_##_entry##_##_name = { \
-	.attr = {.name = __stringify(_name), .mode = 0400}, \
-	.show = dmi_sysfs_##_entry##_##_name, \
-}
-
-/*************************************************
- * Generic DMI entry support.
- *************************************************/
-static void dmi_entry_free(struct kobject *kobj)
-{
-	kfree(kobj);
-}
-
-static struct dmi_sysfs_entry *to_entry(struct kobject *kobj)
-{
-	return container_of(kobj, struct dmi_sysfs_entry, kobj);
-}
-
-static struct dmi_sysfs_attribute *to_attr(struct attribute *attr)
-{
-	return container_of(attr, struct dmi_sysfs_attribute, attr);
-}
-
-static ssize_t dmi_sysfs_attr_show(struct kobject *kobj,
-				   struct attribute *_attr, char *buf)
-{
-	struct dmi_sysfs_entry *entry = to_entry(kobj);
-	struct dmi_sysfs_attribute *attr = to_attr(_attr);
-
-	/* DMI stuff is only ever admin visible */
-	if (!capable(CAP_SYS_ADMIN))
-		return -EACCES;
-
-	return attr->show(entry, buf);
-}
-
-static const struct sysfs_ops dmi_sysfs_attr_ops = {
-	.show = dmi_sysfs_attr_show,
-};
-
-typedef ssize_t (*dmi_callback)(struct dmi_sysfs_entry *,
-				const struct dmi_header *dh, void *);
-
-struct find_dmi_data {
-	struct dmi_sysfs_entry	*entry;
-	dmi_callback		callback;
-	void			*private;
-	int			instance_countdown;
-	ssize_t			ret;
-};
-
-static void find_dmi_entry_helper(const struct dmi_header *dh,
-				  void *_data)
-{
-	struct find_dmi_data *data = _data;
-	struct dmi_sysfs_entry *entry = data->entry;
-
-	/* Is this the entry we want? */
-	if (dh->type != entry->dh.type)
-		return;
-
-	if (data->instance_countdown != 0) {
-		/* try the next instance? */
-		data->instance_countdown--;
-		return;
-	}
-
-	/*
-	 * Don't ever revisit the instance.  Short circuit later
-	 * instances by letting the instance_countdown run negative
-	 */
-	data->instance_countdown--;
-
-	/* Found the entry */
-	data->ret = data->callback(entry, dh, data->private);
-}
-
-/* State for passing the read parameters through dmi_find_entry() */
-struct dmi_read_state {
-	char *buf;
-	loff_t pos;
-	size_t count;
-};
-
-static ssize_t find_dmi_entry(struct dmi_sysfs_entry *entry,
-			      dmi_callback callback, void *private)
-{
-	struct find_dmi_data data = {
-		.entry = entry,
-		.callback = callback,
-		.private = private,
-		.instance_countdown = entry->instance,
-		.ret = -EIO,  /* To signal the entry disappeared */
-	};
-	int ret;
-
-	ret = dmi_walk(find_dmi_entry_helper, &data);
-	/* This shouldn't happen, but just in case. */
-	if (ret)
-		return -EINVAL;
-	return data.ret;
-}
-
-/*
- * Calculate and return the byte length of the dmi entry identified by
- * dh.  This includes both the formatted portion as well as the
- * unformatted string space, including the two trailing nul characters.
- */
-static size_t dmi_entry_length(const struct dmi_header *dh)
-{
-	const char *p = (const char *)dh;
-
-	p += dh->length;
-
-	while (p[0] || p[1])
-		p++;
-
-	return 2 + p - (const char *)dh;
-}
-
-/*************************************************
- * Support bits for specialized DMI entry support
- *************************************************/
-struct dmi_entry_attr_show_data {
-	struct attribute *attr;
-	char *buf;
-};
-
-static ssize_t dmi_entry_attr_show_helper(struct dmi_sysfs_entry *entry,
-					  const struct dmi_header *dh,
-					  void *_data)
-{
-	struct dmi_entry_attr_show_data *data = _data;
-	struct dmi_sysfs_mapped_attribute *attr;
-
-	attr = container_of(data->attr,
-			    struct dmi_sysfs_mapped_attribute, attr);
-	return attr->show(entry, dh, data->buf);
-}
-
-static ssize_t dmi_entry_attr_show(struct kobject *kobj,
-				   struct attribute *attr,
-				   char *buf)
-{
-	struct dmi_entry_attr_show_data data = {
-		.attr = attr,
-		.buf  = buf,
-	};
-	/* Find the entry according to our parent and call the
-	 * normalized show method hanging off of the attribute */
-	return find_dmi_entry(to_entry(kobj->parent),
-			      dmi_entry_attr_show_helper, &data);
-}
-
-static const struct sysfs_ops dmi_sysfs_specialize_attr_ops = {
-	.show = dmi_entry_attr_show,
-};
-
-/*************************************************
- * Specialized DMI entry support.
- *************************************************/
-
-/*** Type 15 - System Event Table ***/
-
-#define DMI_SEL_ACCESS_METHOD_IO8	0x00
-#define DMI_SEL_ACCESS_METHOD_IO2x8	0x01
-#define DMI_SEL_ACCESS_METHOD_IO16	0x02
-#define DMI_SEL_ACCESS_METHOD_PHYS32	0x03
-#define DMI_SEL_ACCESS_METHOD_GPNV	0x04
-
-struct dmi_system_event_log {
-	struct dmi_header header;
-	u16	area_length;
-	u16	header_start_offset;
-	u16	data_start_offset;
-	u8	access_method;
-	u8	status;
-	u32	change_token;
-	union {
-		struct {
-			u16 index_addr;
-			u16 data_addr;
-		} io;
-		u32	phys_addr32;
-		u16	gpnv_handle;
-		u32	access_method_address;
-	};
-	u8	header_format;
-	u8	type_descriptors_supported_count;
-	u8	per_log_type_descriptor_length;
-	u8	supported_log_type_descriptos[0];
-} __packed;
-
-#define DMI_SYSFS_SEL_FIELD(_field) \
-static ssize_t dmi_sysfs_sel_##_field(struct dmi_sysfs_entry *entry, \
-				      const struct dmi_header *dh, \
-				      char *buf) \
-{ \
-	struct dmi_system_event_log sel; \
-	if (sizeof(sel) > dmi_entry_length(dh)) \
-		return -EIO; \
-	memcpy(&sel, dh, sizeof(sel)); \
-	return sprintf(buf, "%u\n", sel._field); \
-} \
-static DMI_SYSFS_MAPPED_ATTR(sel, _field)
-
-DMI_SYSFS_SEL_FIELD(area_length);
-DMI_SYSFS_SEL_FIELD(header_start_offset);
-DMI_SYSFS_SEL_FIELD(data_start_offset);
-DMI_SYSFS_SEL_FIELD(access_method);
-DMI_SYSFS_SEL_FIELD(status);
-DMI_SYSFS_SEL_FIELD(change_token);
-DMI_SYSFS_SEL_FIELD(access_method_address);
-DMI_SYSFS_SEL_FIELD(header_format);
-DMI_SYSFS_SEL_FIELD(type_descriptors_supported_count);
-DMI_SYSFS_SEL_FIELD(per_log_type_descriptor_length);
-
-static struct attribute *dmi_sysfs_sel_attrs[] = {
-	&dmi_sysfs_attr_sel_area_length.attr,
-	&dmi_sysfs_attr_sel_header_start_offset.attr,
-	&dmi_sysfs_attr_sel_data_start_offset.attr,
-	&dmi_sysfs_attr_sel_access_method.attr,
-	&dmi_sysfs_attr_sel_status.attr,
-	&dmi_sysfs_attr_sel_change_token.attr,
-	&dmi_sysfs_attr_sel_access_method_address.attr,
-	&dmi_sysfs_attr_sel_header_format.attr,
-	&dmi_sysfs_attr_sel_type_descriptors_supported_count.attr,
-	&dmi_sysfs_attr_sel_per_log_type_descriptor_length.attr,
-	NULL,
-};
-
-
-static struct kobj_type dmi_system_event_log_ktype = {
-	.release = dmi_entry_free,
-	.sysfs_ops = &dmi_sysfs_specialize_attr_ops,
-	.default_attrs = dmi_sysfs_sel_attrs,
-};
-
-typedef u8 (*sel_io_reader)(const struct dmi_system_event_log *sel,
-			    loff_t offset);
-
-static DEFINE_MUTEX(io_port_lock);
-
-static u8 read_sel_8bit_indexed_io(const struct dmi_system_event_log *sel,
-				   loff_t offset)
-{
-	u8 ret;
-
-	mutex_lock(&io_port_lock);
-	outb((u8)offset, sel->io.index_addr);
-	ret = inb(sel->io.data_addr);
-	mutex_unlock(&io_port_lock);
-	return ret;
-}
-
-static u8 read_sel_2x8bit_indexed_io(const struct dmi_system_event_log *sel,
-				     loff_t offset)
-{
-	u8 ret;
-
-	mutex_lock(&io_port_lock);
-	outb((u8)offset, sel->io.index_addr);
-	outb((u8)(offset >> 8), sel->io.index_addr + 1);
-	ret = inb(sel->io.data_addr);
-	mutex_unlock(&io_port_lock);
-	return ret;
-}
-
-static u8 read_sel_16bit_indexed_io(const struct dmi_system_event_log *sel,
-				    loff_t offset)
-{
-	u8 ret;
-
-	mutex_lock(&io_port_lock);
-	outw((u16)offset, sel->io.index_addr);
-	ret = inb(sel->io.data_addr);
-	mutex_unlock(&io_port_lock);
-	return ret;
-}
-
-static sel_io_reader sel_io_readers[] = {
-	[DMI_SEL_ACCESS_METHOD_IO8]	= read_sel_8bit_indexed_io,
-	[DMI_SEL_ACCESS_METHOD_IO2x8]	= read_sel_2x8bit_indexed_io,
-	[DMI_SEL_ACCESS_METHOD_IO16]	= read_sel_16bit_indexed_io,
-};
-
-static ssize_t dmi_sel_raw_read_io(struct dmi_sysfs_entry *entry,
-				   const struct dmi_system_event_log *sel,
-				   char *buf, loff_t pos, size_t count)
-{
-	ssize_t wrote = 0;
-
-	sel_io_reader io_reader = sel_io_readers[sel->access_method];
-
-	while (count && pos < sel->area_length) {
-		count--;
-		*(buf++) = io_reader(sel, pos++);
-		wrote++;
-	}
-
-	return wrote;
-}
-
-static ssize_t dmi_sel_raw_read_phys32(struct dmi_sysfs_entry *entry,
-				       const struct dmi_system_event_log *sel,
-				       char *buf, loff_t pos, size_t count)
-{
-	u8 __iomem *mapped;
-	ssize_t wrote = 0;
-
-	mapped = ioremap(sel->access_method_address, sel->area_length);
-	if (!mapped)
-		return -EIO;
-
-	while (count && pos < sel->area_length) {
-		count--;
-		*(buf++) = readb(mapped + pos++);
-		wrote++;
-	}
-
-	iounmap(mapped);
-	return wrote;
-}
-
-static ssize_t dmi_sel_raw_read_helper(struct dmi_sysfs_entry *entry,
-				       const struct dmi_header *dh,
-				       void *_state)
-{
-	struct dmi_read_state *state = _state;
-	struct dmi_system_event_log sel;
-
-	if (sizeof(sel) > dmi_entry_length(dh))
-		return -EIO;
-
-	memcpy(&sel, dh, sizeof(sel));
-
-	switch (sel.access_method) {
-	case DMI_SEL_ACCESS_METHOD_IO8:
-	case DMI_SEL_ACCESS_METHOD_IO2x8:
-	case DMI_SEL_ACCESS_METHOD_IO16:
-		return dmi_sel_raw_read_io(entry, &sel, state->buf,
-					   state->pos, state->count);
-	case DMI_SEL_ACCESS_METHOD_PHYS32:
-		return dmi_sel_raw_read_phys32(entry, &sel, state->buf,
-					       state->pos, state->count);
-	case DMI_SEL_ACCESS_METHOD_GPNV:
-		pr_info("dmi-sysfs: GPNV support missing.\n");
-		return -EIO;
-	default:
-		pr_info("dmi-sysfs: Unknown access method %02x\n",
-			sel.access_method);
-		return -EIO;
-	}
-}
-
-static ssize_t dmi_sel_raw_read(struct file *filp, struct kobject *kobj,
-				struct bin_attribute *bin_attr,
-				char *buf, loff_t pos, size_t count)
-{
-	struct dmi_sysfs_entry *entry = to_entry(kobj->parent);
-	struct dmi_read_state state = {
-		.buf = buf,
-		.pos = pos,
-		.count = count,
-	};
-
-	return find_dmi_entry(entry, dmi_sel_raw_read_helper, &state);
-}
-
-static struct bin_attribute dmi_sel_raw_attr = {
-	.attr = {.name = "raw_event_log", .mode = 0400},
-	.read = dmi_sel_raw_read,
-};
-
-static int dmi_system_event_log(struct dmi_sysfs_entry *entry)
-{
-	int ret;
-
-	entry->child = kzalloc(sizeof(*entry->child), GFP_KERNEL);
-	if (!entry->child)
-		return -ENOMEM;
-	ret = kobject_init_and_add(entry->child,
-				   &dmi_system_event_log_ktype,
-				   &entry->kobj,
-				   "system_event_log");
-	if (ret)
-		goto out_free;
-
-	ret = sysfs_create_bin_file(entry->child, &dmi_sel_raw_attr);
-	if (ret)
-		goto out_del;
-
-	return 0;
-
-out_del:
-	kobject_del(entry->child);
-out_free:
-	kfree(entry->child);
-	return ret;
-}
-
-/*************************************************
- * Generic DMI entry support.
- *************************************************/
-
-static ssize_t dmi_sysfs_entry_length(struct dmi_sysfs_entry *entry, char *buf)
-{
-	return sprintf(buf, "%d\n", entry->dh.length);
-}
-
-static ssize_t dmi_sysfs_entry_handle(struct dmi_sysfs_entry *entry, char *buf)
-{
-	return sprintf(buf, "%d\n", entry->dh.handle);
-}
-
-static ssize_t dmi_sysfs_entry_type(struct dmi_sysfs_entry *entry, char *buf)
-{
-	return sprintf(buf, "%d\n", entry->dh.type);
-}
-
-static ssize_t dmi_sysfs_entry_instance(struct dmi_sysfs_entry *entry,
-					char *buf)
-{
-	return sprintf(buf, "%d\n", entry->instance);
-}
-
-static ssize_t dmi_sysfs_entry_position(struct dmi_sysfs_entry *entry,
-					char *buf)
-{
-	return sprintf(buf, "%d\n", entry->position);
-}
-
-static DMI_SYSFS_ATTR(entry, length);
-static DMI_SYSFS_ATTR(entry, handle);
-static DMI_SYSFS_ATTR(entry, type);
-static DMI_SYSFS_ATTR(entry, instance);
-static DMI_SYSFS_ATTR(entry, position);
-
-static struct attribute *dmi_sysfs_entry_attrs[] = {
-	&dmi_sysfs_attr_entry_length.attr,
-	&dmi_sysfs_attr_entry_handle.attr,
-	&dmi_sysfs_attr_entry_type.attr,
-	&dmi_sysfs_attr_entry_instance.attr,
-	&dmi_sysfs_attr_entry_position.attr,
-	NULL,
-};
-
-static ssize_t dmi_entry_raw_read_helper(struct dmi_sysfs_entry *entry,
-					 const struct dmi_header *dh,
-					 void *_state)
-{
-	struct dmi_read_state *state = _state;
-	size_t entry_length;
-
-	entry_length = dmi_entry_length(dh);
-
-	return memory_read_from_buffer(state->buf, state->count,
-				       &state->pos, dh, entry_length);
-}
-
-static ssize_t dmi_entry_raw_read(struct file *filp,
-				  struct kobject *kobj,
-				  struct bin_attribute *bin_attr,
-				  char *buf, loff_t pos, size_t count)
-{
-	struct dmi_sysfs_entry *entry = to_entry(kobj);
-	struct dmi_read_state state = {
-		.buf = buf,
-		.pos = pos,
-		.count = count,
-	};
-
-	return find_dmi_entry(entry, dmi_entry_raw_read_helper, &state);
-}
-
-static const struct bin_attribute dmi_entry_raw_attr = {
-	.attr = {.name = "raw", .mode = 0400},
-	.read = dmi_entry_raw_read,
-};
-
-static void dmi_sysfs_entry_release(struct kobject *kobj)
-{
-	struct dmi_sysfs_entry *entry = to_entry(kobj);
-	sysfs_remove_bin_file(&entry->kobj, &dmi_entry_raw_attr);
-	spin_lock(&entry_list_lock);
-	list_del(&entry->list);
-	spin_unlock(&entry_list_lock);
-	kfree(entry);
-}
-
-static struct kobj_type dmi_sysfs_entry_ktype = {
-	.release = dmi_sysfs_entry_release,
-	.sysfs_ops = &dmi_sysfs_attr_ops,
-	.default_attrs = dmi_sysfs_entry_attrs,
-};
-
-static struct kobject *dmi_kobj;
-static struct kset *dmi_kset;
-
-/* Global count of all instances seen.  Only for setup */
-static int __initdata instance_counts[MAX_ENTRY_TYPE + 1];
-
-/* Global positional count of all entries seen.  Only for setup */
-static int __initdata position_count;
-
-static void __init dmi_sysfs_register_handle(const struct dmi_header *dh,
-					     void *_ret)
-{
-	struct dmi_sysfs_entry *entry;
-	int *ret = _ret;
-
-	/* If a previous entry saw an error, short circuit */
-	if (*ret)
-		return;
-
-	/* Allocate and register a new entry into the entries set */
-	entry = kzalloc(sizeof(*entry), GFP_KERNEL);
-	if (!entry) {
-		*ret = -ENOMEM;
-		return;
-	}
-
-	/* Set the key */
-	memcpy(&entry->dh, dh, sizeof(*dh));
-	entry->instance = instance_counts[dh->type]++;
-	entry->position = position_count++;
-
-	entry->kobj.kset = dmi_kset;
-	*ret = kobject_init_and_add(&entry->kobj, &dmi_sysfs_entry_ktype, NULL,
-				    "%d-%d", dh->type, entry->instance);
-
-	if (*ret) {
-		kfree(entry);
-		return;
-	}
-
-	/* Thread on the global list for cleanup */
-	spin_lock(&entry_list_lock);
-	list_add_tail(&entry->list, &entry_list);
-	spin_unlock(&entry_list_lock);
-
-	/* Handle specializations by type */
-	switch (dh->type) {
-	case DMI_ENTRY_SYSTEM_EVENT_LOG:
-		*ret = dmi_system_event_log(entry);
-		break;
-	default:
-		/* No specialization */
-		break;
-	}
-	if (*ret)
-		goto out_err;
-
-	/* Create the raw binary file to access the entry */
-	*ret = sysfs_create_bin_file(&entry->kobj, &dmi_entry_raw_attr);
-	if (*ret)
-		goto out_err;
-
-	return;
-out_err:
-	kobject_put(entry->child);
-	kobject_put(&entry->kobj);
-	return;
-}
-
-static void cleanup_entry_list(void)
-{
-	struct dmi_sysfs_entry *entry, *next;
-
-	/* No locks, we are on our way out */
-	list_for_each_entry_safe(entry, next, &entry_list, list) {
-		kobject_put(entry->child);
-		kobject_put(&entry->kobj);
-	}
-}
-
-static int __init dmi_sysfs_init(void)
-{
-	int error = -ENOMEM;
-	int val;
-
-	/* Set up our directory */
-	dmi_kobj = kobject_create_and_add("dmi", firmware_kobj);
-	if (!dmi_kobj)
-		goto err;
-
-	dmi_kset = kset_create_and_add("entries", NULL, dmi_kobj);
-	if (!dmi_kset)
-		goto err;
-
-	val = 0;
-	error = dmi_walk(dmi_sysfs_register_handle, &val);
-	if (error)
-		goto err;
-	if (val) {
-		error = val;
-		goto err;
-	}
-
-	pr_debug("dmi-sysfs: loaded.\n");
-
-	return 0;
-err:
-	cleanup_entry_list();
-	kset_unregister(dmi_kset);
-	kobject_put(dmi_kobj);
-	return error;
-}
-
-/* clean up everything. */
-static void __exit dmi_sysfs_exit(void)
-{
-	pr_debug("dmi-sysfs: unloading.\n");
-	cleanup_entry_list();
-	kset_unregister(dmi_kset);
-	kobject_put(dmi_kobj);
-}
-
-module_init(dmi_sysfs_init);
-module_exit(dmi_sysfs_exit);
-
-MODULE_AUTHOR("Mike Waychison <mikew@google.com>");
-MODULE_DESCRIPTION("DMI sysfs support");
-MODULE_LICENSE("GPL");
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
deleted file mode 100644
index bcb1126..0000000
--- a/drivers/firmware/dmi_scan.c
+++ /dev/null
@@ -1,751 +0,0 @@
-#include <linux/types.h>
-#include <linux/string.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/ctype.h>
-#include <linux/dmi.h>
-#include <linux/efi.h>
-#include <linux/bootmem.h>
-#include <asm/dmi.h>
-
-/*
- * DMI stands for "Desktop Management Interface".  It is part
- * of and an antecedent to, SMBIOS, which stands for System
- * Management BIOS.  See further: http://www.dmtf.org/standards
- */
-static char dmi_empty_string[] = "        ";
-
-/*
- * Catch too early calls to dmi_check_system():
- */
-static int dmi_initialized;
-
-static const char * __init dmi_string_nosave(const struct dmi_header *dm, u8 s)
-{
-	const u8 *bp = ((u8 *) dm) + dm->length;
-
-	if (s) {
-		s--;
-		while (s > 0 && *bp) {
-			bp += strlen(bp) + 1;
-			s--;
-		}
-
-		if (*bp != 0) {
-			size_t len = strlen(bp)+1;
-			size_t cmp_len = len > 8 ? 8 : len;
-
-			if (!memcmp(bp, dmi_empty_string, cmp_len))
-				return dmi_empty_string;
-			return bp;
-		}
-	}
-
-	return "";
-}
-
-static char * __init dmi_string(const struct dmi_header *dm, u8 s)
-{
-	const char *bp = dmi_string_nosave(dm, s);
-	char *str;
-	size_t len;
-
-	if (bp == dmi_empty_string)
-		return dmi_empty_string;
-
-	len = strlen(bp) + 1;
-	str = dmi_alloc(len);
-	if (str != NULL)
-		strcpy(str, bp);
-	else
-		printk(KERN_ERR "dmi_string: cannot allocate %Zu bytes.\n", len);
-
-	return str;
-}
-
-/*
- *	We have to be cautious here. We have seen BIOSes with DMI pointers
- *	pointing to completely the wrong place for example
- */
-static void dmi_table(u8 *buf, int len, int num,
-		      void (*decode)(const struct dmi_header *, void *),
-		      void *private_data)
-{
-	u8 *data = buf;
-	int i = 0;
-
-	/*
-	 *	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) {
-		const struct dmi_header *dm = (const struct dmi_header *)data;
-
-		/*
-		 *  We want to know the total length (formatted 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, private_data);
-		data += 2;
-		i++;
-	}
-}
-
-static u32 dmi_base;
-static u16 dmi_len;
-static u16 dmi_num;
-
-static int __init dmi_walk_early(void (*decode)(const struct dmi_header *,
-		void *))
-{
-	u8 *buf;
-
-	buf = dmi_ioremap(dmi_base, dmi_len);
-	if (buf == NULL)
-		return -1;
-
-	dmi_table(buf, dmi_len, dmi_num, decode, NULL);
-
-	dmi_iounmap(buf, dmi_len);
-	return 0;
-}
-
-static int __init dmi_checksum(const 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);
-int dmi_available;
-
-/*
- *	Save a DMI string
- */
-static void __init dmi_save_ident(const struct dmi_header *dm, int slot, int string)
-{
-	const char *d = (const char*) dm;
-	char *p;
-
-	if (dmi_ident[slot])
-		return;
-
-	p = dmi_string(dm, d[string]);
-	if (p == NULL)
-		return;
-
-	dmi_ident[slot] = p;
-}
-
-static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int index)
-{
-	const u8 *d = (u8*) dm + index;
-	char *s;
-	int is_ff = 1, is_00 = 1, i;
-
-	if (dmi_ident[slot])
-		return;
-
-	for (i = 0; i < 16 && (is_ff || is_00); i++) {
-		if(d[i] != 0x00) is_ff = 0;
-		if(d[i] != 0xFF) is_00 = 0;
-	}
-
-	if (is_ff || is_00)
-		return;
-
-	s = dmi_alloc(16*2+4+1);
-	if (!s)
-		return;
-
-	sprintf(s, "%pUB", d);
-
-        dmi_ident[slot] = s;
-}
-
-static void __init dmi_save_type(const struct dmi_header *dm, int slot, int index)
-{
-	const u8 *d = (u8*) dm + index;
-	char *s;
-
-	if (dmi_ident[slot])
-		return;
-
-	s = dmi_alloc(4);
-	if (!s)
-		return;
-
-	sprintf(s, "%u", *d & 0x7F);
-	dmi_ident[slot] = s;
-}
-
-static void __init dmi_save_one_device(int type, const char *name)
-{
-	struct dmi_device *dev;
-
-	/* No duplicate device */
-	if (dmi_find_device(type, name, NULL))
-		return;
-
-	dev = dmi_alloc(sizeof(*dev) + strlen(name) + 1);
-	if (!dev) {
-		printk(KERN_ERR "dmi_save_one_device: out of memory.\n");
-		return;
-	}
-
-	dev->type = type;
-	strcpy((char *)(dev + 1), name);
-	dev->name = (char *)(dev + 1);
-	dev->device_data = NULL;
-	list_add(&dev->list, &dmi_devices);
-}
-
-static void __init dmi_save_devices(const struct dmi_header *dm)
-{
-	int i, count = (dm->length - sizeof(struct dmi_header)) / 2;
-
-	for (i = 0; i < count; i++) {
-		const char *d = (char *)(dm + 1) + (i * 2);
-
-		/* Skip disabled device */
-		if ((*d & 0x80) == 0)
-			continue;
-
-		dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d + 1)));
-	}
-}
-
-static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm)
-{
-	int i, count = *(u8 *)(dm + 1);
-	struct dmi_device *dev;
-
-	for (i = 1; i <= count; i++) {
-		char *devname = dmi_string(dm, i);
-
-		if (devname == dmi_empty_string)
-			continue;
-
-		dev = dmi_alloc(sizeof(*dev));
-		if (!dev) {
-			printk(KERN_ERR
-			   "dmi_save_oem_strings_devices: out of memory.\n");
-			break;
-		}
-
-		dev->type = DMI_DEV_TYPE_OEM_STRING;
-		dev->name = devname;
-		dev->device_data = NULL;
-
-		list_add(&dev->list, &dmi_devices);
-	}
-}
-
-static void __init dmi_save_ipmi_device(const 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_tail(&dev->list, &dmi_devices);
-}
-
-static void __init dmi_save_dev_onboard(int instance, int segment, int bus,
-					int devfn, const char *name)
-{
-	struct dmi_dev_onboard *onboard_dev;
-
-	onboard_dev = dmi_alloc(sizeof(*onboard_dev) + strlen(name) + 1);
-	if (!onboard_dev) {
-		printk(KERN_ERR "dmi_save_dev_onboard: out of memory.\n");
-		return;
-	}
-	onboard_dev->instance = instance;
-	onboard_dev->segment = segment;
-	onboard_dev->bus = bus;
-	onboard_dev->devfn = devfn;
-
-	strcpy((char *)&onboard_dev[1], name);
-	onboard_dev->dev.type = DMI_DEV_TYPE_DEV_ONBOARD;
-	onboard_dev->dev.name = (char *)&onboard_dev[1];
-	onboard_dev->dev.device_data = onboard_dev;
-
-	list_add(&onboard_dev->dev.list, &dmi_devices);
-}
-
-static void __init dmi_save_extended_devices(const struct dmi_header *dm)
-{
-	const u8 *d = (u8*) dm + 5;
-
-	/* Skip disabled device */
-	if ((*d & 0x80) == 0)
-		return;
-
-	dmi_save_dev_onboard(*(d+1), *(u16 *)(d+2), *(d+4), *(d+5),
-			     dmi_string_nosave(dm, *(d-1)));
-	dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d - 1)));
-}
-
-/*
- *	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(const struct dmi_header *dm, void *dummy)
-{
-	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);
-		dmi_save_uuid(dm, DMI_PRODUCT_UUID, 8);
-		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);
-		dmi_save_ident(dm, DMI_BOARD_SERIAL, 7);
-		dmi_save_ident(dm, DMI_BOARD_ASSET_TAG, 8);
-		break;
-	case 3:		/* Chassis Information */
-		dmi_save_ident(dm, DMI_CHASSIS_VENDOR, 4);
-		dmi_save_type(dm, DMI_CHASSIS_TYPE, 5);
-		dmi_save_ident(dm, DMI_CHASSIS_VERSION, 6);
-		dmi_save_ident(dm, DMI_CHASSIS_SERIAL, 7);
-		dmi_save_ident(dm, DMI_CHASSIS_ASSET_TAG, 8);
-		break;
-	case 10:	/* Onboard Devices Information */
-		dmi_save_devices(dm);
-		break;
-	case 11:	/* OEM Strings */
-		dmi_save_oem_strings_devices(dm);
-		break;
-	case 38:	/* IPMI Device Information */
-		dmi_save_ipmi_device(dm);
-		break;
-	case 41:	/* Onboard Devices Extended Information */
-		dmi_save_extended_devices(dm);
-	}
-}
-
-static void __init print_filtered(const char *info)
-{
-	const char *p;
-
-	if (!info)
-		return;
-
-	for (p = info; *p; p++)
-		if (isprint(*p))
-			printk(KERN_CONT "%c", *p);
-		else
-			printk(KERN_CONT "\\x%02x", *p & 0xff);
-}
-
-static void __init dmi_dump_ids(void)
-{
-	const char *board;	/* Board Name is optional */
-
-	printk(KERN_DEBUG "DMI: ");
-	print_filtered(dmi_get_system_info(DMI_SYS_VENDOR));
-	printk(KERN_CONT " ");
-	print_filtered(dmi_get_system_info(DMI_PRODUCT_NAME));
-	board = dmi_get_system_info(DMI_BOARD_NAME);
-	if (board) {
-		printk(KERN_CONT "/");
-		print_filtered(board);
-	}
-	printk(KERN_CONT ", BIOS ");
-	print_filtered(dmi_get_system_info(DMI_BIOS_VERSION));
-	printk(KERN_CONT " ");
-	print_filtered(dmi_get_system_info(DMI_BIOS_DATE));
-	printk(KERN_CONT "\n");
-}
-
-static int __init dmi_present(const char __iomem *p)
-{
-	u8 buf[15];
-
-	memcpy_fromio(buf, p, 15);
-	if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) {
-		dmi_num = (buf[13] << 8) | buf[12];
-		dmi_len = (buf[7] << 8) | buf[6];
-		dmi_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_walk_early(dmi_decode) == 0) {
-			dmi_dump_ids();
-			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 error;
-
-		/* 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 error;
-
-		rc = dmi_present(p + 0x10); /* offset of _DMI_ string */
-		dmi_iounmap(p, 32);
-		if (!rc) {
-			dmi_available = 1;
-			goto out;
-		}
-	}
-	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 error;
-
-		for (q = p; q < p + 0x10000; q += 16) {
-			rc = dmi_present(q);
-			if (!rc) {
-				dmi_available = 1;
-				dmi_iounmap(p, 0x10000);
-				goto out;
-			}
-		}
-		dmi_iounmap(p, 0x10000);
-	}
- error:
-	printk(KERN_INFO "DMI not present or invalid.\n");
- out:
-	dmi_initialized = 1;
-}
-
-/**
- *	dmi_matches - check if dmi_system_id structure matches system DMI data
- *	@dmi: pointer to the dmi_system_id structure to check
- */
-static bool dmi_matches(const struct dmi_system_id *dmi)
-{
-	int i;
-
-	WARN(!dmi_initialized, KERN_ERR "dmi check: not initialized yet.\n");
-
-	for (i = 0; i < ARRAY_SIZE(dmi->matches); i++) {
-		int s = dmi->matches[i].slot;
-		if (s == DMI_NONE)
-			break;
-		if (dmi_ident[s]
-		    && strstr(dmi_ident[s], dmi->matches[i].substr))
-			continue;
-		/* No match */
-		return false;
-	}
-	return true;
-}
-
-/**
- *	dmi_is_end_of_table - check for end-of-table marker
- *	@dmi: pointer to the dmi_system_id structure to check
- */
-static bool dmi_is_end_of_table(const struct dmi_system_id *dmi)
-{
-	return dmi->matches[0].slot == DMI_NONE;
-}
-
-/**
- *	dmi_check_system - check system DMI data
- *	@list: array of dmi_system_id structures to match against
- *		All non-null elements of the list must match
- *		their slot's (field index's) data (i.e., each
- *		list string must be a substring of the specified
- *		DMI slot's string data) to be considered a
- *		successful match.
- *
- *	Walk the blacklist table running matching functions until someone
- *	returns non zero or we hit the end. Callback function is called for
- *	each successful match. Returns the number of matches.
- */
-int dmi_check_system(const struct dmi_system_id *list)
-{
-	int count = 0;
-	const struct dmi_system_id *d;
-
-	for (d = list; !dmi_is_end_of_table(d); d++)
-		if (dmi_matches(d)) {
-			count++;
-			if (d->callback && d->callback(d))
-				break;
-		}
-
-	return count;
-}
-EXPORT_SYMBOL(dmi_check_system);
-
-/**
- *	dmi_first_match - find dmi_system_id structure matching system DMI data
- *	@list: array of dmi_system_id structures to match against
- *		All non-null elements of the list must match
- *		their slot's (field index's) data (i.e., each
- *		list string must be a substring of the specified
- *		DMI slot's string data) to be considered a
- *		successful match.
- *
- *	Walk the blacklist table until the first match is found.  Return the
- *	pointer to the matching entry or NULL if there's no match.
- */
-const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list)
-{
-	const struct dmi_system_id *d;
-
-	for (d = list; !dmi_is_end_of_table(d); d++)
-		if (dmi_matches(d))
-			return d;
-
-	return NULL;
-}
-EXPORT_SYMBOL(dmi_first_match);
-
-/**
- *	dmi_get_system_info - return DMI data value
- *	@field: data index (see enum dmi_field)
- *
- *	Returns one DMI data value, can be used to perform
- *	complex DMI data checks.
- */
-const char *dmi_get_system_info(int field)
-{
-	return dmi_ident[field];
-}
-EXPORT_SYMBOL(dmi_get_system_info);
-
-/**
- * dmi_name_in_serial - Check if string is in the DMI product serial information
- * @str: string to check for
- */
-int dmi_name_in_serial(const char *str)
-{
-	int f = DMI_PRODUCT_SERIAL;
-	if (dmi_ident[f] && strstr(dmi_ident[f], str))
-		return 1;
-	return 0;
-}
-
-/**
- *	dmi_name_in_vendors - Check if string is anywhere in the DMI vendor information.
- *	@str: 	Case sensitive Name
- */
-int dmi_name_in_vendors(const char *str)
-{
-	static int fields[] = { DMI_BIOS_VENDOR, DMI_BIOS_VERSION, DMI_SYS_VENDOR,
-				DMI_PRODUCT_NAME, DMI_PRODUCT_VERSION, DMI_BOARD_VENDOR,
-				DMI_BOARD_NAME, DMI_BOARD_VERSION, DMI_NONE };
-	int i;
-	for (i = 0; fields[i] != DMI_NONE; i++) {
-		int f = fields[i];
-		if (dmi_ident[f] && strstr(dmi_ident[f], str))
-			return 1;
-	}
-	return 0;
-}
-EXPORT_SYMBOL(dmi_name_in_vendors);
-
-/**
- *	dmi_find_device - find onboard device by type/name
- *	@type: device type or %DMI_DEV_TYPE_ANY to match all device types
- *	@name: 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 as the @from argument.
- *	If @from is not %NULL, searches continue from next device.
- */
-const struct dmi_device * dmi_find_device(int type, const char *name,
-				    const struct dmi_device *from)
-{
-	const struct list_head *head = from ? &from->list : &dmi_devices;
-	struct list_head *d;
-
-	for(d = head->next; d != &dmi_devices; d = d->next) {
-		const 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_date - parse a DMI date
- *	@field:	data index (see enum dmi_field)
- *	@yearp: optional out parameter for the year
- *	@monthp: optional out parameter for the month
- *	@dayp: optional out parameter for the day
- *
- *	The date field is assumed to be in the form resembling
- *	[mm[/dd]]/yy[yy] and the result is stored in the out
- *	parameters any or all of which can be omitted.
- *
- *	If the field doesn't exist, all out parameters are set to zero
- *	and false is returned.  Otherwise, true is returned with any
- *	invalid part of date set to zero.
- *
- *	On return, year, month and day are guaranteed to be in the
- *	range of [0,9999], [0,12] and [0,31] respectively.
- */
-bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
-{
-	int year = 0, month = 0, day = 0;
-	bool exists;
-	const char *s, *y;
-	char *e;
-
-	s = dmi_get_system_info(field);
-	exists = s;
-	if (!exists)
-		goto out;
-
-	/*
-	 * Determine year first.  We assume the date string resembles
-	 * mm/dd/yy[yy] but the original code extracted only the year
-	 * from the end.  Keep the behavior in the spirit of no
-	 * surprises.
-	 */
-	y = strrchr(s, '/');
-	if (!y)
-		goto out;
-
-	y++;
-	year = simple_strtoul(y, &e, 10);
-	if (y != e && year < 100) {	/* 2-digit year */
-		year += 1900;
-		if (year < 1996)	/* no dates < spec 1.0 */
-			year += 100;
-	}
-	if (year > 9999)		/* year should fit in %04d */
-		year = 0;
-
-	/* parse the mm and dd */
-	month = simple_strtoul(s, &e, 10);
-	if (s == e || *e != '/' || !month || month > 12) {
-		month = 0;
-		goto out;
-	}
-
-	s = e + 1;
-	day = simple_strtoul(s, &e, 10);
-	if (s == y || s == e || *e != '/' || day > 31)
-		day = 0;
-out:
-	if (yearp)
-		*yearp = year;
-	if (monthp)
-		*monthp = month;
-	if (dayp)
-		*dayp = day;
-	return exists;
-}
-EXPORT_SYMBOL(dmi_get_date);
-
-/**
- *	dmi_walk - Walk the DMI table and get called back for every record
- *	@decode: Callback function
- *	@private_data: Private data to be passed to the callback function
- *
- *	Returns -1 when the DMI table can't be reached, 0 on success.
- */
-int dmi_walk(void (*decode)(const struct dmi_header *, void *),
-	     void *private_data)
-{
-	u8 *buf;
-
-	if (!dmi_available)
-		return -1;
-
-	buf = ioremap(dmi_base, dmi_len);
-	if (buf == NULL)
-		return -1;
-
-	dmi_table(buf, dmi_len, dmi_num, decode, private_data);
-
-	iounmap(buf);
-	return 0;
-}
-EXPORT_SYMBOL_GPL(dmi_walk);
-
-/**
- * dmi_match - compare a string to the dmi field (if exists)
- * @f: DMI field identifier
- * @str: string to compare the DMI field to
- *
- * Returns true if the requested field equals to the str (including NULL).
- */
-bool dmi_match(enum dmi_field f, const char *str)
-{
-	const char *info = dmi_get_system_info(f);
-
-	if (info == NULL || str == NULL)
-		return info == str;
-
-	return !strcmp(info, str);
-}
-EXPORT_SYMBOL_GPL(dmi_match);
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
deleted file mode 100644
index f156cca..0000000
--- a/include/linux/dmi.h
+++ /dev/null
@@ -1,139 +0,0 @@
-#ifndef __DMI_H__
-#define __DMI_H__
-
-#include <linux/list.h>
-#include <linux/mod_devicetable.h>
-
-/* enum dmi_field is in mod_devicetable.h */
-
-enum dmi_device_type {
-	DMI_DEV_TYPE_ANY = 0,
-	DMI_DEV_TYPE_OTHER,
-	DMI_DEV_TYPE_UNKNOWN,
-	DMI_DEV_TYPE_VIDEO,
-	DMI_DEV_TYPE_SCSI,
-	DMI_DEV_TYPE_ETHERNET,
-	DMI_DEV_TYPE_TOKENRING,
-	DMI_DEV_TYPE_SOUND,
-	DMI_DEV_TYPE_PATA,
-	DMI_DEV_TYPE_SATA,
-	DMI_DEV_TYPE_SAS,
-	DMI_DEV_TYPE_IPMI = -1,
-	DMI_DEV_TYPE_OEM_STRING = -2,
-	DMI_DEV_TYPE_DEV_ONBOARD = -3,
-};
-
-enum dmi_entry_type {
-	DMI_ENTRY_BIOS = 0,
-	DMI_ENTRY_SYSTEM,
-	DMI_ENTRY_BASEBOARD,
-	DMI_ENTRY_CHASSIS,
-	DMI_ENTRY_PROCESSOR,
-	DMI_ENTRY_MEM_CONTROLLER,
-	DMI_ENTRY_MEM_MODULE,
-	DMI_ENTRY_CACHE,
-	DMI_ENTRY_PORT_CONNECTOR,
-	DMI_ENTRY_SYSTEM_SLOT,
-	DMI_ENTRY_ONBOARD_DEVICE,
-	DMI_ENTRY_OEMSTRINGS,
-	DMI_ENTRY_SYSCONF,
-	DMI_ENTRY_BIOS_LANG,
-	DMI_ENTRY_GROUP_ASSOC,
-	DMI_ENTRY_SYSTEM_EVENT_LOG,
-	DMI_ENTRY_PHYS_MEM_ARRAY,
-	DMI_ENTRY_MEM_DEVICE,
-	DMI_ENTRY_32_MEM_ERROR,
-	DMI_ENTRY_MEM_ARRAY_MAPPED_ADDR,
-	DMI_ENTRY_MEM_DEV_MAPPED_ADDR,
-	DMI_ENTRY_BUILTIN_POINTING_DEV,
-	DMI_ENTRY_PORTABLE_BATTERY,
-	DMI_ENTRY_SYSTEM_RESET,
-	DMI_ENTRY_HW_SECURITY,
-	DMI_ENTRY_SYSTEM_POWER_CONTROLS,
-	DMI_ENTRY_VOLTAGE_PROBE,
-	DMI_ENTRY_COOLING_DEV,
-	DMI_ENTRY_TEMP_PROBE,
-	DMI_ENTRY_ELECTRICAL_CURRENT_PROBE,
-	DMI_ENTRY_OOB_REMOTE_ACCESS,
-	DMI_ENTRY_BIS_ENTRY,
-	DMI_ENTRY_SYSTEM_BOOT,
-	DMI_ENTRY_MGMT_DEV,
-	DMI_ENTRY_MGMT_DEV_COMPONENT,
-	DMI_ENTRY_MGMT_DEV_THRES,
-	DMI_ENTRY_MEM_CHANNEL,
-	DMI_ENTRY_IPMI_DEV,
-	DMI_ENTRY_SYS_POWER_SUPPLY,
-	DMI_ENTRY_ADDITIONAL,
-	DMI_ENTRY_ONBOARD_DEV_EXT,
-	DMI_ENTRY_MGMT_CONTROLLER_HOST,
-	DMI_ENTRY_INACTIVE = 126,
-	DMI_ENTRY_END_OF_TABLE = 127,
-};
-
-struct dmi_header {
-	u8 type;
-	u8 length;
-	u16 handle;
-};
-
-struct dmi_device {
-	struct list_head list;
-	int type;
-	const char *name;
-	void *device_data;	/* Type specific data */
-};
-
-#ifdef CONFIG_DMI
-
-struct dmi_dev_onboard {
-	struct dmi_device dev;
-	int instance;
-	int segment;
-	int bus;
-	int devfn;
-};
-
-extern int dmi_check_system(const struct dmi_system_id *list);
-const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
-extern const char * dmi_get_system_info(int field);
-extern const struct dmi_device * dmi_find_device(int type, const char *name,
-	const struct dmi_device *from);
-extern void dmi_scan_machine(void);
-extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
-extern int dmi_name_in_vendors(const char *str);
-extern int dmi_name_in_serial(const char *str);
-extern int dmi_available;
-extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
-	void *private_data);
-extern bool dmi_match(enum dmi_field f, const char *str);
-
-#else
-
-static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; }
-static inline const char * dmi_get_system_info(int field) { return NULL; }
-static inline const struct dmi_device * dmi_find_device(int type, const char *name,
-	const struct dmi_device *from) { return NULL; }
-static inline void dmi_scan_machine(void) { return; }
-static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
-{
-	if (yearp)
-		*yearp = 0;
-	if (monthp)
-		*monthp = 0;
-	if (dayp)
-		*dayp = 0;
-	return false;
-}
-static inline int dmi_name_in_vendors(const char *s) { return 0; }
-static inline int dmi_name_in_serial(const char *s) { return 0; }
-#define dmi_available 0
-static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *),
-	void *private_data) { return -1; }
-static inline bool dmi_match(enum dmi_field f, const char *str)
-	{ return false; }
-static inline const struct dmi_system_id *
-	dmi_first_match(const struct dmi_system_id *list) { return NULL; }
-
-#endif
-
-#endif	/* __DMI_H__ */
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 89153ad..5e8d1bc 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -427,61 +427,6 @@ struct spi_device_id {
 			__attribute__((aligned(sizeof(kernel_ulong_t))));
 };
 
-/* dmi */
-enum dmi_field {
-	DMI_NONE,
-	DMI_BIOS_VENDOR,
-	DMI_BIOS_VERSION,
-	DMI_BIOS_DATE,
-	DMI_SYS_VENDOR,
-	DMI_PRODUCT_NAME,
-	DMI_PRODUCT_VERSION,
-	DMI_PRODUCT_SERIAL,
-	DMI_PRODUCT_UUID,
-	DMI_BOARD_VENDOR,
-	DMI_BOARD_NAME,
-	DMI_BOARD_VERSION,
-	DMI_BOARD_SERIAL,
-	DMI_BOARD_ASSET_TAG,
-	DMI_CHASSIS_VENDOR,
-	DMI_CHASSIS_TYPE,
-	DMI_CHASSIS_VERSION,
-	DMI_CHASSIS_SERIAL,
-	DMI_CHASSIS_ASSET_TAG,
-	DMI_STRING_MAX,
-};
-
-struct dmi_strmatch {
-	unsigned char slot;
-	char substr[79];
-};
-
-#ifndef __KERNEL__
-struct dmi_system_id {
-	kernel_ulong_t callback;
-	kernel_ulong_t ident;
-	struct dmi_strmatch matches[4];
-	kernel_ulong_t driver_data
-			__attribute__((aligned(sizeof(kernel_ulong_t))));
-};
-#else
-struct dmi_system_id {
-	int (*callback)(const struct dmi_system_id *);
-	const char *ident;
-	struct dmi_strmatch matches[4];
-	void *driver_data;
-};
-/*
- * struct dmi_device_id appears during expansion of
- * "MODULE_DEVICE_TABLE(dmi, x)". Compiler doesn't look inside it
- * but this is enough for gcc 3.4.6 to error out:
- *	error: storage size of '__mod_dmi_device_table' isn't known
- */
-#define dmi_device_id dmi_system_id
-#endif
-
-#define DMI_MATCH(a, b)	{ a, b }
-
 /*
  * sysfw field - right now these are based on x86/ia64's SMBIOS fields.  But
  * other arches are certainly welcome to add additional fields.  The
-- 
1.6.5.2

^ permalink raw reply related

* [PATCH net-next-2.6] ipv4: save cpu cycles from check_leaf()
From: Eric Dumazet @ 2011-07-18 13:16 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20110717.122949.1167434585296050332.davem@davemloft.net>

Le dimanche 17 juillet 2011 à 12:29 -0700, David Miller a écrit :

> I guess the indirection removal is a non-trivial improvement because
> these changes knock a full 2 seconds off of my udpflood tests. :-)

Excellent !

One other improvement is to get rid of ntohl(inet_make_mask(plen)) stuff
in check_leaf(), this saves 0.5 second on udpflood on my machine (27.25
second -> 26.75)

[PATCH net-next-2.6] ipv4: save cpu cycles from check_leaf()

Compiler is not smart enough to avoid double BSWAP instructions in
ntohl(inet_make_mask(plen)).

Lets cache this value in struct leaf_info, (fill a hole on 64bit arches)

With route cache disabled, this saves ~2% of cpu in udpflood bench on
x86_64 machine.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/ipv4/fib_trie.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 58c25ea..de9e297 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -110,9 +110,10 @@ struct leaf {
 
 struct leaf_info {
 	struct hlist_node hlist;
-	struct rcu_head rcu;
 	int plen;
+	u32 mask_plen; /* ntohl(inet_make_mask(plen)) */
 	struct list_head falh;
+	struct rcu_head rcu;
 };
 
 struct tnode {
@@ -451,6 +452,7 @@ static struct leaf_info *leaf_info_new(int plen)
 	struct leaf_info *li = kmalloc(sizeof(struct leaf_info),  GFP_KERNEL);
 	if (li) {
 		li->plen = plen;
+		li->mask_plen = ntohl(inet_make_mask(plen));
 		INIT_LIST_HEAD(&li->falh);
 	}
 	return li;
@@ -1359,10 +1361,8 @@ static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l,
 
 	hlist_for_each_entry_rcu(li, node, hhead, hlist) {
 		struct fib_alias *fa;
-		int plen = li->plen;
-		__be32 mask = inet_make_mask(plen);
 
-		if (l->key != (key & ntohl(mask)))
+		if (l->key != (key & li->mask_plen))
 			continue;
 
 		list_for_each_entry_rcu(fa, &li->falh, fa_list) {
@@ -1394,7 +1394,7 @@ static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l,
 #ifdef CONFIG_IP_FIB_TRIE_STATS
 				t->stats.semantic_match_passed++;
 #endif
-				res->prefixlen = plen;
+				res->prefixlen = li->plen;
 				res->nh_sel = nhsel;
 				res->type = fa->fa_type;
 				res->scope = fa->fa_info->fib_scope;
@@ -1402,7 +1402,7 @@ static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l,
 				res->table = tb;
 				res->fa_head = &li->falh;
 				if (!(fib_flags & FIB_LOOKUP_NOREF))
-					atomic_inc(&res->fi->fib_clntref);
+					atomic_inc(&fi->fib_clntref);
 				return 0;
 			}
 		}



^ permalink raw reply related

* [PATCHv11] vhost: vhost TX zero-copy support
From: Michael S. Tsirkin @ 2011-07-18 13:48 UTC (permalink / raw)
  To: Shirley Ma; +Cc: kvm, virtualization, netdev, linux-kernel, jj

>From: Shirley Ma <mashirle@us.ibm.com>

This adds experimental zero copy support in vhost-net,
disabled by default. To enable, set
experimental_zcopytx module option to 1.

This patch maintains the outstanding userspace buffers in the
sequence it is delivered to vhost. The outstanding userspace buffers
will be marked as done once the lower device buffers DMA has finished.
This is monitored through last reference of kfree_skb callback. Two
buffer indices are used for this purpose.

The vhost-net device passes the userspace buffers info to lower device
skb through message control. DMA done status check and guest
notification are handled by handle_tx: in the worst case is all buffers
in the vq are in pending/done status, so we need to notify guest to
release DMA done buffers first before we get any new buffers from the
vq.

One known problem is that if the guest stops submitting
buffers, buffers might never get used until some
further action, e.g. device reset. This does not
seem to affect linux guests.

Signed-off-by: Shirley <xma@us.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

I run some light tests and this seems to work fine for me.  Given that
the new functionality is disabled by default, it seems a pretty safe
patch to merge for 3.1.

Changes from v10:
	don't leak ubuf_info
	don't allocate ubuf_info for non zero copy vqs
Changes from v9:
	coding style prettification suggested by Jesper Juhl

 drivers/vhost/net.c   |   77 +++++++++++++++++++++++++++++-
 drivers/vhost/vhost.c |  128 +++++++++++++++++++++++++++++++++++++++++++------
 drivers/vhost/vhost.h |   31 ++++++++++++
 3 files changed, 220 insertions(+), 16 deletions(-)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index e224a92..f0fd52c 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -12,6 +12,7 @@
 #include <linux/virtio_net.h>
 #include <linux/miscdevice.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/mutex.h>
 #include <linux/workqueue.h>
 #include <linux/rcupdate.h>
@@ -28,10 +29,18 @@
 
 #include "vhost.h"
 
+static int experimental_zcopytx;
+module_param(experimental_zcopytx, int, 0444);
+MODULE_PARM_DESC(experimental_zcopytx, "Enable Experimental Zero Copy TX");
+
 /* Max number of bytes transferred before requeueing the job.
  * Using this limit prevents one virtqueue from starving others. */
 #define VHOST_NET_WEIGHT 0x80000
 
+/* MAX number of TX used buffers for outstanding zerocopy */
+#define VHOST_MAX_PEND 128
+#define VHOST_GOODCOPY_LEN 256
+
 enum {
 	VHOST_NET_VQ_RX = 0,
 	VHOST_NET_VQ_TX = 1,
@@ -54,6 +63,12 @@ struct vhost_net {
 	enum vhost_net_poll_state tx_poll_state;
 };
 
+static bool vhost_sock_zcopy(struct socket *sock)
+{
+	return unlikely(experimental_zcopytx) &&
+		sock_flag(sock->sk, SOCK_ZEROCOPY);
+}
+
 /* Pop first len bytes from iovec. Return number of segments used. */
 static int move_iovec_hdr(struct iovec *from, struct iovec *to,
 			  size_t len, int iov_count)
@@ -129,6 +144,8 @@ static void handle_tx(struct vhost_net *net)
 	int err, wmem;
 	size_t hdr_size;
 	struct socket *sock;
+	struct vhost_ubuf_ref *uninitialized_var(ubufs);
+	bool zcopy;
 
 	/* TODO: check that we are running from vhost_worker? */
 	sock = rcu_dereference_check(vq->private_data, 1);
@@ -149,8 +166,13 @@ static void handle_tx(struct vhost_net *net)
 	if (wmem < sock->sk->sk_sndbuf / 2)
 		tx_poll_stop(net);
 	hdr_size = vq->vhost_hlen;
+	zcopy = vhost_sock_zcopy(sock);
 
 	for (;;) {
+		/* Release DMAs done buffers first */
+		if (zcopy)
+			vhost_zerocopy_signal_used(vq);
+
 		head = vhost_get_vq_desc(&net->dev, vq, vq->iov,
 					 ARRAY_SIZE(vq->iov),
 					 &out, &in,
@@ -166,6 +188,13 @@ static void handle_tx(struct vhost_net *net)
 				set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
 				break;
 			}
+			/* If more outstanding DMAs, queue the work */
+			if (unlikely(vq->upend_idx - vq->done_idx >
+				     VHOST_MAX_PEND)) {
+				tx_poll_start(net, sock);
+				set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
+				break;
+			}
 			if (unlikely(vhost_enable_notify(&net->dev, vq))) {
 				vhost_disable_notify(&net->dev, vq);
 				continue;
@@ -188,9 +217,39 @@ static void handle_tx(struct vhost_net *net)
 			       iov_length(vq->hdr, s), hdr_size);
 			break;
 		}
+		/* use msg_control to pass vhost zerocopy ubuf info to skb */
+		if (zcopy) {
+			vq->heads[vq->upend_idx].id = head;
+			if (len < VHOST_GOODCOPY_LEN) {
+				/* copy don't need to wait for DMA done */
+				vq->heads[vq->upend_idx].len =
+							VHOST_DMA_DONE_LEN;
+				msg.msg_control = NULL;
+				msg.msg_controllen = 0;
+				ubufs = NULL;
+			} else {
+				struct ubuf_info *ubuf = &vq->ubuf_info[head];
+
+				vq->heads[vq->upend_idx].len = len;
+				ubuf->callback = vhost_zerocopy_callback;
+				ubuf->arg = vq->ubufs;
+				ubuf->desc = vq->upend_idx;
+				msg.msg_control = ubuf;
+				msg.msg_controllen = sizeof(ubuf);
+				ubufs = vq->ubufs;
+				kref_get(&ubufs->kref);
+			}
+			vq->upend_idx = (vq->upend_idx + 1) % UIO_MAXIOV;
+		}
 		/* TODO: Check specific error and bomb out unless ENOBUFS? */
 		err = sock->ops->sendmsg(NULL, sock, &msg, len);
 		if (unlikely(err < 0)) {
+			if (zcopy) {
+				if (ubufs)
+					vhost_ubuf_put(ubufs);
+				vq->upend_idx = ((unsigned)vq->upend_idx - 1) %
+					UIO_MAXIOV;
+			}
 			vhost_discard_vq_desc(vq, 1);
 			tx_poll_start(net, sock);
 			break;
@@ -198,7 +257,8 @@ static void handle_tx(struct vhost_net *net)
 		if (err != len)
 			pr_debug("Truncated TX packet: "
 				 " len %d != %zd\n", err, len);
-		vhost_add_used_and_signal(&net->dev, vq, head, 0);
+		if (!zcopy)
+			vhost_add_used_and_signal(&net->dev, vq, head, 0);
 		total_len += len;
 		if (unlikely(total_len >= VHOST_NET_WEIGHT)) {
 			vhost_poll_queue(&vq->poll);
@@ -603,6 +663,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
 {
 	struct socket *sock, *oldsock;
 	struct vhost_virtqueue *vq;
+	struct vhost_ubuf_ref *ubufs, *oldubufs = NULL;
 	int r;
 
 	mutex_lock(&n->dev.mutex);
@@ -632,6 +693,13 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
 	oldsock = rcu_dereference_protected(vq->private_data,
 					    lockdep_is_held(&vq->mutex));
 	if (sock != oldsock) {
+		ubufs = vhost_ubuf_alloc(vq, sock && vhost_sock_zcopy(sock));
+		if (IS_ERR(ubufs)) {
+			r = PTR_ERR(ubufs);
+			goto err_ubufs;
+		}
+		oldubufs = vq->ubufs;
+		vq->ubufs = ubufs;
 		vhost_net_disable_vq(n, vq);
 		rcu_assign_pointer(vq->private_data, sock);
 		vhost_net_enable_vq(n, vq);
@@ -639,6 +707,9 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
 
 	mutex_unlock(&vq->mutex);
 
+	if (oldubufs)
+		vhost_ubuf_put_and_wait(oldubufs);
+
 	if (oldsock) {
 		vhost_net_flush_vq(n, index);
 		fput(oldsock->file);
@@ -647,6 +718,8 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
 	mutex_unlock(&n->dev.mutex);
 	return 0;
 
+err_ubufs:
+	fput(sock->file);
 err_vq:
 	mutex_unlock(&vq->mutex);
 err:
@@ -776,6 +849,8 @@ static struct miscdevice vhost_net_misc = {
 
 static int vhost_net_init(void)
 {
+	if (experimental_zcopytx)
+		vhost_enable_zcopy(VHOST_NET_VQ_TX);
 	return misc_register(&vhost_net_misc);
 }
 module_init(vhost_net_init);
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index ea966b3..5ef2f62 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -37,6 +37,8 @@ enum {
 	VHOST_MEMORY_F_LOG = 0x1,
 };
 
+static unsigned vhost_zcopy_mask __read_mostly;
+
 #define vhost_used_event(vq) ((u16 __user *)&vq->avail->ring[vq->num])
 #define vhost_avail_event(vq) ((u16 __user *)&vq->used->ring[vq->num])
 
@@ -179,6 +181,9 @@ static void vhost_vq_reset(struct vhost_dev *dev,
 	vq->call_ctx = NULL;
 	vq->call = NULL;
 	vq->log_ctx = NULL;
+	vq->upend_idx = 0;
+	vq->done_idx = 0;
+	vq->ubufs = NULL;
 }
 
 static int vhost_worker(void *data)
@@ -225,10 +230,28 @@ static int vhost_worker(void *data)
 	return 0;
 }
 
+static void vhost_vq_free_iovecs(struct vhost_virtqueue *vq)
+{
+	kfree(vq->indirect);
+	vq->indirect = NULL;
+	kfree(vq->log);
+	vq->log = NULL;
+	kfree(vq->heads);
+	vq->heads = NULL;
+	kfree(vq->ubuf_info);
+	vq->ubuf_info = NULL;
+}
+
+void vhost_enable_zcopy(int vq)
+{
+	vhost_zcopy_mask |= 0x1 << vq;
+}
+
 /* Helper to allocate iovec buffers for all vqs. */
 static long vhost_dev_alloc_iovecs(struct vhost_dev *dev)
 {
 	int i;
+	bool zcopy;
 
 	for (i = 0; i < dev->nvqs; ++i) {
 		dev->vqs[i].indirect = kmalloc(sizeof *dev->vqs[i].indirect *
@@ -237,19 +260,21 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev)
 					  GFP_KERNEL);
 		dev->vqs[i].heads = kmalloc(sizeof *dev->vqs[i].heads *
 					    UIO_MAXIOV, GFP_KERNEL);
-
+		zcopy = vhost_zcopy_mask & (0x1 << i);
+		if (zcopy)
+			dev->vqs[i].ubuf_info =
+				kmalloc(sizeof *dev->vqs[i].ubuf_info *
+					UIO_MAXIOV, GFP_KERNEL);
 		if (!dev->vqs[i].indirect || !dev->vqs[i].log ||
-			!dev->vqs[i].heads)
+			!dev->vqs[i].heads ||
+			(zcopy && !dev->vqs[i].ubuf_info))
 			goto err_nomem;
 	}
 	return 0;
 
 err_nomem:
-	for (; i >= 0; --i) {
-		kfree(dev->vqs[i].indirect);
-		kfree(dev->vqs[i].log);
-		kfree(dev->vqs[i].heads);
-	}
+	for (; i >= 0; --i)
+		vhost_vq_free_iovecs(&dev->vqs[i]);
 	return -ENOMEM;
 }
 
@@ -257,14 +282,8 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev)
 {
 	int i;
 
-	for (i = 0; i < dev->nvqs; ++i) {
-		kfree(dev->vqs[i].indirect);
-		dev->vqs[i].indirect = NULL;
-		kfree(dev->vqs[i].log);
-		dev->vqs[i].log = NULL;
-		kfree(dev->vqs[i].heads);
-		dev->vqs[i].heads = NULL;
-	}
+	for (i = 0; i < dev->nvqs; ++i)
+		vhost_vq_free_iovecs(&dev->vqs[i]);
 }
 
 long vhost_dev_init(struct vhost_dev *dev,
@@ -287,6 +306,7 @@ long vhost_dev_init(struct vhost_dev *dev,
 		dev->vqs[i].log = NULL;
 		dev->vqs[i].indirect = NULL;
 		dev->vqs[i].heads = NULL;
+		dev->vqs[i].ubuf_info = NULL;
 		dev->vqs[i].dev = dev;
 		mutex_init(&dev->vqs[i].mutex);
 		vhost_vq_reset(dev, dev->vqs + i);
@@ -390,6 +410,30 @@ long vhost_dev_reset_owner(struct vhost_dev *dev)
 	return 0;
 }
 
+/* In case of DMA done not in order in lower device driver for some reason.
+ * upend_idx is used to track end of used idx, done_idx is used to track head
+ * of used idx. Once lower device DMA done contiguously, we will signal KVM
+ * guest used idx.
+ */
+int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq)
+{
+	int i;
+	int j = 0;
+
+	for (i = vq->done_idx; i != vq->upend_idx; i = (i + 1) % UIO_MAXIOV) {
+		if ((vq->heads[i].len == VHOST_DMA_DONE_LEN)) {
+			vq->heads[i].len = VHOST_DMA_CLEAR_LEN;
+			vhost_add_used_and_signal(vq->dev, vq,
+						  vq->heads[i].id, 0);
+			++j;
+		} else
+			break;
+	}
+	if (j)
+		vq->done_idx = i;
+	return j;
+}
+
 /* Caller should have device mutex */
 void vhost_dev_cleanup(struct vhost_dev *dev)
 {
@@ -400,6 +444,13 @@ void vhost_dev_cleanup(struct vhost_dev *dev)
 			vhost_poll_stop(&dev->vqs[i].poll);
 			vhost_poll_flush(&dev->vqs[i].poll);
 		}
+		/* Wait for all lower device DMAs done. */
+		if (dev->vqs[i].ubufs)
+			vhost_ubuf_put_and_wait(dev->vqs[i].ubufs);
+
+		/* Signal guest as appropriate. */
+		vhost_zerocopy_signal_used(&dev->vqs[i]);
+
 		if (dev->vqs[i].error_ctx)
 			eventfd_ctx_put(dev->vqs[i].error_ctx);
 		if (dev->vqs[i].error)
@@ -1486,3 +1537,50 @@ void vhost_disable_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq)
 			       &vq->used->flags, r);
 	}
 }
+
+static void vhost_zerocopy_done_signal(struct kref *kref)
+{
+	struct vhost_ubuf_ref *ubufs = container_of(kref, struct vhost_ubuf_ref,
+						    kref);
+	wake_up(&ubufs->wait);
+}
+
+struct vhost_ubuf_ref *vhost_ubuf_alloc(struct vhost_virtqueue *vq,
+					bool zcopy)
+{
+	struct vhost_ubuf_ref *ubufs;
+	/* No zero copy backend? Nothing to count. */
+	if (!zcopy)
+		return NULL;
+	ubufs = kmalloc(sizeof *ubufs, GFP_KERNEL);
+	if (!ubufs)
+		return ERR_PTR(-ENOMEM);
+	kref_init(&ubufs->kref);
+	kref_get(&ubufs->kref);
+	init_waitqueue_head(&ubufs->wait);
+	ubufs->vq = vq;
+	return ubufs;
+}
+
+void vhost_ubuf_put(struct vhost_ubuf_ref *ubufs)
+{
+	kref_put(&ubufs->kref, vhost_zerocopy_done_signal);
+}
+
+void vhost_ubuf_put_and_wait(struct vhost_ubuf_ref *ubufs)
+{
+	kref_put(&ubufs->kref, vhost_zerocopy_done_signal);
+	wait_event(ubufs->wait, !atomic_read(&ubufs->kref.refcount));
+	kfree(ubufs);
+}
+
+void vhost_zerocopy_callback(void *arg)
+{
+	struct ubuf_info *ubuf = arg;
+	struct vhost_ubuf_ref *ubufs = ubuf->arg;
+	struct vhost_virtqueue *vq = ubufs->vq;
+
+	/* set len = 1 to mark this desc buffers done DMA */
+	vq->heads[ubuf->desc].len = VHOST_DMA_DONE_LEN;
+	kref_put(&ubufs->kref, vhost_zerocopy_done_signal);
+}
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 8e03379..1544b78 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -13,6 +13,11 @@
 #include <linux/virtio_ring.h>
 #include <asm/atomic.h>
 
+/* This is for zerocopy, used buffer len is set to 1 when lower device DMA
+ * done */
+#define VHOST_DMA_DONE_LEN	1
+#define VHOST_DMA_CLEAR_LEN	0
+
 struct vhost_device;
 
 struct vhost_work;
@@ -50,6 +55,18 @@ struct vhost_log {
 	u64 len;
 };
 
+struct vhost_virtqueue;
+
+struct vhost_ubuf_ref {
+	struct kref kref;
+	wait_queue_head_t wait;
+	struct vhost_virtqueue *vq;
+};
+
+struct vhost_ubuf_ref *vhost_ubuf_alloc(struct vhost_virtqueue *, bool zcopy);
+void vhost_ubuf_put(struct vhost_ubuf_ref *);
+void vhost_ubuf_put_and_wait(struct vhost_ubuf_ref *);
+
 /* The virtqueue structure describes a queue attached to a device. */
 struct vhost_virtqueue {
 	struct vhost_dev *dev;
@@ -114,6 +131,16 @@ struct vhost_virtqueue {
 	/* Log write descriptors */
 	void __user *log_base;
 	struct vhost_log *log;
+	/* vhost zerocopy support fields below: */
+	/* last used idx for outstanding DMA zerocopy buffers */
+	int upend_idx;
+	/* first used idx for DMA done zerocopy buffers */
+	int done_idx;
+	/* an array of userspace buffers info */
+	struct ubuf_info *ubuf_info;
+	/* Reference counting for outstanding ubufs.
+	 * Protected by vq mutex. Writers must also take device mutex. */
+	struct vhost_ubuf_ref *ubufs;
 };
 
 struct vhost_dev {
@@ -160,6 +187,8 @@ bool vhost_enable_notify(struct vhost_dev *, struct vhost_virtqueue *);
 
 int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log,
 		    unsigned int log_num, u64 len);
+void vhost_zerocopy_callback(void *arg);
+int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq);
 
 #define vq_err(vq, fmt, ...) do {                                  \
 		pr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \
@@ -186,4 +215,6 @@ static inline int vhost_has_feature(struct vhost_dev *dev, int bit)
 	return acked_features & (1 << bit);
 }
 
+void vhost_enable_zcopy(int vq);
+
 #endif
-- 
1.7.5.53.gc233e

^ permalink raw reply related

* Re: [PATCH] net: can: remove custom hex_to_bin()
From: Oliver Hartkopp @ 2011-07-18 14:02 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: netdev, linux-kernel, Wolfgang Grandegger
In-Reply-To: <1310977597-9666-1-git-send-email-andriy.shevchenko@linux.intel.com>

On 18.07.2011 10:26, Andy Shevchenko wrote:
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Wolfgang Grandegger <wg@grandegger.com>

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>

> ---
>  drivers/net/can/slcan.c |   26 +++++---------------------
>  1 files changed, 5 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
> index aa8ad73..65e54fd 100644
> --- a/drivers/net/can/slcan.c
> +++ b/drivers/net/can/slcan.c
> @@ -56,6 +56,7 @@
>  #include <linux/sched.h>
>  #include <linux/delay.h>
>  #include <linux/init.h>
> +#include <linux/kernel.h>
>  #include <linux/can.h>
>  
>  static __initdata const char banner[] =
> @@ -142,21 +143,6 @@ static struct net_device **slcan_devs;
>    *			STANDARD SLCAN DECAPSULATION			 *
>    ************************************************************************/
>  
> -static int asc2nibble(char c)
> -{
> -
> -	if ((c >= '0') && (c <= '9'))
> -		return c - '0';
> -
> -	if ((c >= 'A') && (c <= 'F'))
> -		return c - 'A' + 10;
> -
> -	if ((c >= 'a') && (c <= 'f'))
> -		return c - 'a' + 10;
> -
> -	return 16; /* error */
> -}
> -
>  /* Send one completely decapsulated can_frame to the network layer */
>  static void slc_bump(struct slcan *sl)
>  {
> @@ -195,18 +181,16 @@ static void slc_bump(struct slcan *sl)
>  	*(u64 *) (&cf.data) = 0; /* clear payload */
>  
>  	for (i = 0, dlc_pos++; i < cf.can_dlc; i++) {
> -
> -		tmp = asc2nibble(sl->rbuff[dlc_pos++]);
> -		if (tmp > 0x0F)
> +		tmp = hex_to_bin(sl->rbuff[dlc_pos++]);
> +		if (tmp < 0)
>  			return;
>  		cf.data[i] = (tmp << 4);
> -		tmp = asc2nibble(sl->rbuff[dlc_pos++]);
> -		if (tmp > 0x0F)
> +		tmp = hex_to_bin(sl->rbuff[dlc_pos++]);
> +		if (tmp < 0)
>  			return;
>  		cf.data[i] |= tmp;
>  	}
>  
> -
>  	skb = dev_alloc_skb(sizeof(struct can_frame));
>  	if (!skb)
>  		return;


^ permalink raw reply

* Re: [PATCH 1/2] nfnetlink: add RCU in nfnetlink_rcv_msg()
From: Patrick McHardy @ 2011-07-18 14:06 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Florian Westphal, Eric Leblond, sclark46, Kuzin Andrey,
	Anders Nilsson Plymoth, netfilter-devel, netdev
In-Reply-To: <1309534078.2599.25.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

On 01.07.2011 17:27, Eric Dumazet wrote:
> [PATCH 1/2] nfnetlink: add RCU in nfnetlink_rcv_msg()
> 
> Goal of this patch is to permit nfnetlink providers not mandate
> nfnl_mutex being held while nfnetlink_rcv_msg() calls them.
> 
> If struct nfnl_callback contains a non NULL call_rcu(), then
> nfnetlink_rcv_msg() will use it instead of call() field, holding
> rcu_read_lock instead of nfnl_mutex
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> CC: Florian Westphal <fw@strlen.de>
> CC: Eric Leblond <eric@regit.org>
> CC: Patrick McHardy <kaber@trash.net>

Applied, thanks Eric.

^ permalink raw reply

* Re: [PATCH 2/2] nfnetlink_queue: provide rcu enabled callbacks
From: Patrick McHardy @ 2011-07-18 14:09 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Florian Westphal, sclark46, Eric Leblond, Kuzin Andrey,
	Anders Nilsson Plymoth, netfilter-devel, netdev
In-Reply-To: <1309534142.2599.26.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

On 01.07.2011 17:29, Eric Dumazet wrote:
> nenetlink_queue operations on SMP are not efficent if several queues are
> used, because of nfnl_mutex contention when applications give packet
> verdict.
> 
> Use new call_rcu field in struct nfnl_callback to advertize a callback
> that is called under rcu_read_lock instead of nfnl_mutex.
> 
> On my 2x4x2 machine, I was able to reach 2.000.000 pps going through
> user land returning NF_ACCEPT verdicts without losses, instead of less
> than 500.000 pps before patch.

Applied, nice work.

^ permalink raw reply

* [PATCH] tulip: dmfe: Remove old log spamming pr_debugs
From: Joe Perches @ 2011-07-18 14:50 UTC (permalink / raw)
  To: Jean Delvare, Grant Grundler; +Cc: netdev, linux-kernel
In-Reply-To: <201107181440.35886.jdelvare@suse.de>

Commit 726b65ad444d ("tulip: Convert uses of KERN_DEBUG") enabled
some old previously inactive uses of pr_debug converted by
commit dde7c8ef1679 ("tulip/dmfe.c: Use dev_<level> and pr_<level>").

Remove these pr_debugs.

Signed-off-by: Joe Perches <joe@perches.com>
---

On Mon, 2011-07-18 at 14:40 +0200, Jean Delvare wrote:
With debugging messages enabled by default, one user complained [1]
> that his log was spammed with these messages:
> [ 6233.528227] dmfe: tdes0=7fff0000
 
I do not mind at all disabling the default
debugging logging from tulip.

It looks as if some pr_debugs could be
removed as these were commented out at one
time and brought back by commit dde7c8ef.

 drivers/net/tulip/dmfe.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index 4685127..9a21ca3 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -879,7 +879,6 @@ static void dmfe_free_tx_pkt(struct DEVICE *dev, struct dmfe_board_info * db)
 	txptr = db->tx_remove_ptr;
 	while(db->tx_packet_cnt) {
 		tdes0 = le32_to_cpu(txptr->tdes0);
-		pr_debug("tdes0=%x\n", tdes0);
 		if (tdes0 & 0x80000000)
 			break;
 
@@ -889,7 +888,6 @@ static void dmfe_free_tx_pkt(struct DEVICE *dev, struct dmfe_board_info * db)
 
 		/* Transmit statistic counter */
 		if ( tdes0 != 0x7fffffff ) {
-			pr_debug("tdes0=%x\n", tdes0);
 			dev->stats.collisions += (tdes0 >> 3) & 0xf;
 			dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
 			if (tdes0 & TDES0_ERR_MASK) {
@@ -986,7 +984,6 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
 			/* error summary bit check */
 			if (rdes0 & 0x8000) {
 				/* This is a error packet */
-				pr_debug("rdes0: %x\n", rdes0);
 				dev->stats.rx_errors++;
 				if (rdes0 & 1)
 					dev->stats.rx_fifo_errors++;
@@ -1638,7 +1635,6 @@ static u8 dmfe_sense_speed(struct dmfe_board_info * db)
 		else 				/* DM9102/DM9102A */
 			phy_mode = phy_read(db->ioaddr,
 				    db->phy_addr, 17, db->chip_id) & 0xf000;
-		pr_debug("Phy_mode %x\n", phy_mode);
 		switch (phy_mode) {
 		case 0x1000: db->op_mode = DMFE_10MHF; break;
 		case 0x2000: db->op_mode = DMFE_10MFD; break;
-- 
1.7.6.131.g99019


^ permalink raw reply related

* Re: [PATCH net-next v3 af-packet 2/2] Enhance af-packet to provide (near zero)lossless packet capture functionality.
From: chetan loke @ 2011-07-18 14:55 UTC (permalink / raw)
  To: Joe Perches; +Cc: davem, netdev
In-Reply-To: <1310960790.2286.39.camel@Joe-Laptop>

On Sun, Jul 17, 2011 at 11:46 PM, Joe Perches <joe@perches.com> wrote:
>
> Maybe just use the kernel.h macro ALIGN()?

Ok. Actually, I was going to use ALIGN but then to have similar
look&feel as that of V1[2], I defined the V3_ALIGNMENT macro.

Chetan Loke

^ permalink raw reply

* Re: [PATCH v2] connector: add an event for monitoring process tracers
From: Evgeniy Polyakov @ 2011-07-18 16:15 UTC (permalink / raw)
  To: Vladimir Zapolskiy; +Cc: Oleg Nesterov, netdev, David S. Miller
In-Reply-To: <1310751918-31579-1-git-send-email-vzapolskiy@gmail.com>

Hi.

On Fri, Jul 15, 2011 at 08:45:18PM +0300, Vladimir Zapolskiy (vzapolskiy@gmail.com) wrote:
> This version of the change extends proc_ptrace_connector() argument
> list, so it becomes possible to specify a ptrace request eliminating
> process attach/detach race.
> 
> Also tracehook_tracer_task() function was renamed to ptrace_parent(),
> but as far as proc_ptrace_connector(task, PTRACE_ATTACH) is called
> from a tracer process itself, it becomes possible to get rid of that
> call usage completely.
> 
> Oleg, I've rebased the change, and if you don't have objections, I'd
> be glad, if you can apply this change upon your ptrace branch, thank
> you in advance.

I still ack this one :)
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>

-- 
	Evgeniy Polyakov

^ permalink raw reply

* [PATCH -next] asm-generic/iomap.h: add stubs for pci iomap/iounmap
From: Randy Dunlap @ 2011-07-18 16:55 UTC (permalink / raw)
  To: Stephen Rothwell, netdev
  Cc: linux-next, LKML, davem, Jonas Bonn, Arnd Bergmann
In-Reply-To: <20110718203501.232bd176e83ff65f056366e6@canb.auug.org.au>

From: Randy Dunlap <rdunlap@xenotime.net>

When CONFIG_PCI is not enabled, CONFIG_EISA=y, and CONFIG_GENERIC_IOMAP=y,
drivers/net/3c59x.c build fails due to a recent small change to
<asm-generic/iomap.h> that surrounds pci_iomap() and pci_iounmap()
with #ifdef CONFIG_PCI/#endif.  Since that patch to iomap.h looks
correct, add stubs for pci_iomap() and pci_iounmap() with CONFIG_PCI
is not enabled to fix the build errors.

drivers/net/3c59x.c:1026: error: implicit declaration of function 'pci_iomap'
drivers/net/3c59x.c:1038: error: implicit declaration of function 'pci_iounmap'

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 include/asm-generic/iomap.h |    8 ++++++++
 1 file changed, 8 insertions(+)

--- linux-next-20110718.orig/include/asm-generic/iomap.h
+++ linux-next-20110718/include/asm-generic/iomap.h
@@ -71,6 +71,14 @@ extern void ioport_unmap(void __iomem *)
 struct pci_dev;
 extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
 extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
+#else
+struct pci_dev;
+static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
+{
+	return NULL;
+}
+static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
+{ }
 #endif
 
 #endif

^ permalink raw reply

* Re: [PATCH net-next v3 af-packet 1/2] Enhance af-packet to provide (near zero)lossless packet capture functionality.
From: David Miller @ 2011-07-18 16:56 UTC (permalink / raw)
  To: loke.chetan; +Cc: eric.dumazet, netdev
In-Reply-To: <CAAsGZS5b9X5HW=_JjfahbXpi9f4H5iYGeY9-+wBjP+=c-MDj4w@mail.gmail.com>

From: chetan loke <loke.chetan@gmail.com>
Date: Mon, 18 Jul 2011 08:49:30 -0400

> Will wait for a day to gather some more comments and then re-send the patch.

I'm not reviewing a patch that doesn't even compile.

^ permalink raw reply

* Re: [PATCH v2] connector: add an event for monitoring process tracers
From: Oleg Nesterov @ 2011-07-18 17:14 UTC (permalink / raw)
  To: Evgeniy Polyakov; +Cc: Vladimir Zapolskiy, netdev, David S. Miller
In-Reply-To: <20110718161558.GA366@ioremap.net>

On 07/18, Evgeniy Polyakov wrote:
>
> Acked-by: Evgeniy Polyakov <zbr@ioremap.net>

OK, thanks, I am going to apply it then...


While we are here, a couple of questions. I've looked at connector
briefly, and some things do not look exactly right to me.

proc_fork_connector() reads task->real_parent lockless. In theory
this is not safe with CLONE_PTHREAD or CLONE_PARENT. Yes, this is
only theoretical, but afaics we need something like

	--- x/drivers/connector/cn_proc.c
	+++ x/drivers/connector/cn_proc.c
	@@ -55,6 +55,7 @@ void proc_fork_connector(struct task_str
		struct proc_event *ev;
		__u8 buffer[CN_PROC_MSG_SIZE];
		struct timespec ts;
	+	struct task_struct *parent;
	 
		if (atomic_read(&proc_event_num_listeners) < 1)
			return;
	@@ -65,8 +66,11 @@ void proc_fork_connector(struct task_str
		ktime_get_ts(&ts); /* get high res monotonic timestamp */
		put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
		ev->what = PROC_EVENT_FORK;
	-	ev->event_data.fork.parent_pid = task->real_parent->pid;
	-	ev->event_data.fork.parent_tgid = task->real_parent->tgid;
	+	rcu_read_lock();
	+	parent = rcu_dereference(task->real_parent);
	+	ev->event_data.fork.parent_pid = parent->pid;
	+	ev->event_data.fork.parent_tgid = parent->tgid;
	+	rcu_read_unlock();
		ev->event_data.fork.child_pid = task->pid;
		ev->event_data.fork.child_tgid = task->tgid;

Otherwise ->real_parent can point to the freed/reused and may be
unmapped memory.


But the actual question is, the usage of proc_exec_connector()
looks "obviously wrong", no? Don't we need

	--- x/fs/exec.c
	+++ x/fs/exec.c
	@@ -1380,15 +1380,16 @@ int search_binary_handler(struct linux_b
				 */
				bprm->recursion_depth = depth;
				if (retval >= 0) {
	-				if (depth == 0)
	+				if (depth == 0) {
						tracehook_report_exec(fmt, bprm, regs);
	+					proc_exec_connector(current);
	+				}
					put_binfmt(fmt);
					allow_write_access(bprm->file);
					if (bprm->file)
						fput(bprm->file);
					bprm->file = NULL;
					current->did_exec = 1;
	-				proc_exec_connector(current);
					return retval;
				}
				read_lock(&binfmt_lock);


? Or do we really want to call proc_exec_connector() twice or
more in "#!whatever" case?

Oleg.


^ permalink raw reply

* Re: [PATCH net-next-2.6] ipv4: save cpu cycles from check_leaf()
From: David Miller @ 2011-07-18 17:42 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <1310994993.5756.27.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 18 Jul 2011 15:16:33 +0200

> [PATCH net-next-2.6] ipv4: save cpu cycles from check_leaf()
> 
> Compiler is not smart enough to avoid double BSWAP instructions in
> ntohl(inet_make_mask(plen)).
> 
> Lets cache this value in struct leaf_info, (fill a hole on 64bit arches)
> 
> With route cache disabled, this saves ~2% of cpu in udpflood bench on
> x86_64 machine.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks Eric.

^ permalink raw reply

* Re: [PATCHv11] vhost: vhost TX zero-copy support
From: David Miller @ 2011-07-18 17:43 UTC (permalink / raw)
  To: mst; +Cc: mashirle, kvm, virtualization, netdev, linux-kernel, jj
In-Reply-To: <20110718134846.GA7107@redhat.com>

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Mon, 18 Jul 2011 16:48:46 +0300

>>From: Shirley Ma <mashirle@us.ibm.com>
> 
> This adds experimental zero copy support in vhost-net,
> disabled by default. To enable, set
> experimental_zcopytx module option to 1.
> 
> This patch maintains the outstanding userspace buffers in the
> sequence it is delivered to vhost. The outstanding userspace buffers
> will be marked as done once the lower device buffers DMA has finished.
> This is monitored through last reference of kfree_skb callback. Two
> buffer indices are used for this purpose.
> 
> The vhost-net device passes the userspace buffers info to lower device
> skb through message control. DMA done status check and guest
> notification are handled by handle_tx: in the worst case is all buffers
> in the vq are in pending/done status, so we need to notify guest to
> release DMA done buffers first before we get any new buffers from the
> vq.
> 
> One known problem is that if the guest stops submitting
> buffers, buffers might never get used until some
> further action, e.g. device reset. This does not
> seem to affect linux guests.
> 
> Signed-off-by: Shirley <xma@us.ibm.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Applied, thanks!

^ permalink raw reply

* Re: [PATCH] tulip: dmfe: Remove old log spamming pr_debugs
From: David Miller @ 2011-07-18 17:45 UTC (permalink / raw)
  To: joe; +Cc: jdelvare, grundler, netdev, linux-kernel
In-Reply-To: <0a5f6c4c4c948dd5ff827bb5c5517294c9410bfc.1311000440.git.joe@perches.com>

From: Joe Perches <joe@perches.com>
Date: Mon, 18 Jul 2011 07:50:33 -0700

> Commit 726b65ad444d ("tulip: Convert uses of KERN_DEBUG") enabled
> some old previously inactive uses of pr_debug converted by
> commit dde7c8ef1679 ("tulip/dmfe.c: Use dev_<level> and pr_<level>").
> 
> Remove these pr_debugs.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied.

^ permalink raw reply

* Re: [PATCH 1/2] stmmac: add memory barriers at appropriate places
From: David Miller @ 2011-07-18 17:47 UTC (permalink / raw)
  To: peppe.cavallaro; +Cc: netdev, shiraz.hashim
In-Reply-To: <1310972049-827-1-git-send-email-peppe.cavallaro@st.com>

From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Mon, 18 Jul 2011 08:54:08 +0200

> From: Shiraz Hashim <shiraz.hashim@st.com>
> 
> This patch, provided by ST SPEAr developers,
> has fixed a problem raised on ARM CA9 where
> happened that the dma_transmission was enabled before
> the dma descriptors were properly filled. To guarantee this
> data memory barriers have been explicity used in the driver.
> 
> Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

Applied.

^ permalink raw reply

* Re: [PATCH 2/2] stmmac: Allow SOCs to use Store forward mode eventhough tx_coe is 0. (V2)
From: David Miller @ 2011-07-18 17:47 UTC (permalink / raw)
  To: peppe.cavallaro; +Cc: netdev, srinivas.kandagatla
In-Reply-To: <1310972049-827-2-git-send-email-peppe.cavallaro@st.com>

From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Mon, 18 Jul 2011 08:54:09 +0200

> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
> 
> This patch adds new field 'force_sf_dma_mode' to plat_stmmacenet_data
> struct to allow users to specify if they want to use force store forward
> eventhough tx_coe is not available in hw.
> without this flag stmmac driver will use cut-thru mode not use
> store-forward mode.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

Applied.

^ permalink raw reply

* Re: [PATCH v2] connector: add an event for monitoring process tracers
From: Oleg Nesterov @ 2011-07-18 17:54 UTC (permalink / raw)
  To: Vladimir Zapolskiy; +Cc: netdev, Evgeniy Polyakov, David S. Miller
In-Reply-To: <1310751918-31579-1-git-send-email-vzapolskiy@gmail.com>

On 07/15, Vladimir Zapolskiy wrote:
>
> Such an event allows to create a simple automated userspace mechanism
> to be aware about processes connecting to others, therefore predefined
> process policies can be applied to them if needed.

I'd wish I could understand this ;) IOW, I still do not understand why
this is useful, but this doesn't matter. Since Evgeniy acked this patch,
I'll apply it to ptrace tree.



Can't resist, a couple of very minor/cosmetics nits. Just because I am
blighter ;)

> +void proc_ptrace_connector(struct task_struct *task, int which_id);

"which_id" doesn't match "ptrace_id" used elsewhere. And PTRACE_ATTACH
instead of simple boolean looks as if you are going to add more ptrace
events, but I guess this won't happen.

> -	if (!retval)
> +	if (!retval) {
>  		wait_on_bit(&task->jobctl, JOBCTL_TRAPPING_BIT,
>  			    ptrace_trapping_sleep_fn, TASK_UNINTERRUPTIBLE);
> +		proc_ptrace_connector(task, PTRACE_ATTACH);
> +	}

OK, but it is a bit strange we are waiting for STOPPED/TRACED transition
before we report PROC_EVENT_PTRACE. Perhaps it makes more sense to
call proc_ptrace_connector() first, this also decreases the probability
PTRACE_ATTACH will be reported after PROC_EVENT_EXIT.


But once again, this is very minor and cosmetic. I am going to apply
the patch as is unless you send v3 quickly.

Oleg.


^ permalink raw reply

* Re: [PATCH] Add error check to hex2bin().
From: Mimi Zohar @ 2011-07-18 18:03 UTC (permalink / raw)
  To: Tetsuo Handa
  Cc: linux-security-module, andriy.shevchenko, netdev, linux-kernel
In-Reply-To: <201107182148.AGD21306.FOLtJVMSOOFQHF@I-love.SAKURA.ne.jp>

On Mon, 2011-07-18 at 21:48 +0900, Tetsuo Handa wrote:
> Currently, security/keys/ is the only user of hex2bin().
> Should I keep hex2bin() unmodified in case of bad input?
> If so, I'd like to make it as hex2bin_safe().

> ----------------------------------------
> [PATCH] Add error check to hex2bin().
> 
> Since converting 2 hexadecimal letters into a byte with error checks is
> commonly used, we can replace multiple hex_to_bin() calls with single hex2bin()
> call by changing hex2bin() to do error checks.
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@I=love.SAKURA.ne.jp>
> ---
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 953352a..186e9fc 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -374,7 +374,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
>  }
> 
>  extern int hex_to_bin(char ch);
> -extern void hex2bin(u8 *dst, const char *src, size_t count);
> +extern bool hex2bin(u8 *dst, const char *src, size_t count);
> 
>  /*
>   * General tracing related utility functions - trace_printk(),
> diff --git a/lib/hexdump.c b/lib/hexdump.c
> index f5fe6ba..1524002 100644
> --- a/lib/hexdump.c
> +++ b/lib/hexdump.c
> @@ -38,14 +38,22 @@ EXPORT_SYMBOL(hex_to_bin);
>   * @dst: binary result
>   * @src: ascii hexadecimal string
>   * @count: result length
> + *
> + * Returns true on success, false in case of bad input.
>   */
> -void hex2bin(u8 *dst, const char *src, size_t count)
> +bool hex2bin(u8 *dst, const char *src, size_t count)
>  {
>  	while (count--) {
> -		*dst = hex_to_bin(*src++) << 4;
> -		*dst += hex_to_bin(*src++);
> -		dst++;
> +		int c = hex_to_bin(*src++);
> +		int d;

Missing blank line here.

> +		if (c < 0)
> +			return false;
> +		d = hex_to_bin(*src++);
> +		if (d < 0)
> +			return false;
> +		*dst++ = (c << 4) | d;
>  	}
> +	return true;
>  }
>  EXPORT_SYMBOL(hex2bin);

We probably don't need to define a separate 'safe' function.

Instead of changing the existing code to short circuit out and return a
value, does only adding the return value work?  Something like:

        bool ret = true;
        int c, d;

        while (count--) {
                c = hex_to_bin(*src++);
                d = hex_to_bin(*src++);
                *dst++ = (c << 4) | d;

                if (c < 0 || d < 0)
                        ret = false;
        }
        return ret;

thanks,

Mimi

> In message "Re: [PATCH] net: can: remove custom hex_to_bin()",
> Andy Shevchenko wrote:
> > On Mon, 2011-07-18 at 20:41 +0900, Tetsuo Handa wrote: 
> > > Andy Shevchenko wrote:
> > > >  	for (i = 0, dlc_pos++; i < cf.can_dlc; i++) {
> > > > -
> > > > -		tmp = asc2nibble(sl->rbuff[dlc_pos++]);
> > > > -		if (tmp > 0x0F)
> > > > +		tmp = hex_to_bin(sl->rbuff[dlc_pos++]);
> > > > +		if (tmp < 0)
> > > >  			return;
> > > >  		cf.data[i] = (tmp << 4);
> > > > -		tmp = asc2nibble(sl->rbuff[dlc_pos++]);
> > > > -		if (tmp > 0x0F)
> > > > +		tmp = hex_to_bin(sl->rbuff[dlc_pos++]);
> > > > +		if (tmp < 0)
> > > >  			return;
> > > >  		cf.data[i] |= tmp;
> > > >  	}
> > > 
> > > What about changing
> > > 
> > >   void hex2bin(u8 *dst, const char *src, size_t count)
> > > 
> > > to
> > > 
> > >   bool hex2bin(u8 *dst, const char *src, size_t count)
> > > 
> > > in order to do error checks like
> > > 
> > > bool hex2bin_with_validation(u8 *dst, const char *src, size_t count)
> > > {
> > > 	while (count--) {
> > > 		int c = hex_to_bin(*src++);
> > > 		int d;
> > > 		if (c < 0)
> > > 			return false;
> > > 		d = hex_to_bin(*src++)
> > > 		if (d < 0)
> > > 			return false;
> > > 		*dst++ = (c << 4) | d;
> > > 	}
> > > 	return true;
> > > }
> > > 
> > > and use hex2bin() rather than hex_to_bin()?
> > Perhaps, good idea. Could you submit a patch?
> > 
> > -- 
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Intel Finland Oy
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 



^ permalink raw reply

* Re: [PATCH] tulip: dmfe: Remove old log spamming pr_debugs
From: Joe Perches @ 2011-07-18 18:05 UTC (permalink / raw)
  To: David Miller; +Cc: jdelvare, grundler, netdev, linux-kernel
In-Reply-To: <20110718.104537.546991191560526229.davem@davemloft.net>

On Mon, 2011-07-18 at 10:45 -0700, David Miller wrote:
> From: Joe Perches <joe@perches.com>
> Date: Mon, 18 Jul 2011 07:50:33 -0700
> > Commit 726b65ad444d ("tulip: Convert uses of KERN_DEBUG") enabled
> > some old previously inactive uses of pr_debug converted by
> > commit dde7c8ef1679 ("tulip/dmfe.c: Use dev_<level> and pr_<level>").
> > Remove these pr_debugs.
> > Signed-off-by: Joe Perches <joe@perches.com>
> Applied.

I believe this should go into current if you push
one more to Linus or maybe stable for 3.0.

cheers, Joe

^ permalink raw reply

* Re: [Patch] include/linux/sdla.h: remove the prototype of sdla()
From: David Miller @ 2011-07-18 18:06 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: mmarek, akpm, linux-kernel, netdev
In-Reply-To: <CAM_iQpWDrhHw8-Hf4q1miHR+rT33wQb=ZSb=ffsxaSak=UHPMw@mail.gmail.com>

From: Américo Wang <xiyou.wangcong@gmail.com>
Date: Sun, 17 Jul 2011 16:22:20 +0800

> `make headers_check` complains that
> 
> linux-2.6/usr/include/linux/sdla.h:116: userspace cannot reference
> function or variable defined in the kernel
> 
> this is due to that there is no such a kernel function,
> 
> void sdla(void *cfg_info, char *dev, struct frad_conf *conf, int quiet);
> 
> I don't know why we have it in a kernel header, so remove it.
> 
> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH] tulip: dmfe: Remove old log spamming pr_debugs
From: David Miller @ 2011-07-18 18:11 UTC (permalink / raw)
  To: joe; +Cc: jdelvare, grundler, netdev, linux-kernel
In-Reply-To: <1311012332.2286.110.camel@Joe-Laptop>

From: Joe Perches <joe@perches.com>
Date: Mon, 18 Jul 2011 11:05:32 -0700

> On Mon, 2011-07-18 at 10:45 -0700, David Miller wrote:
>> From: Joe Perches <joe@perches.com>
>> Date: Mon, 18 Jul 2011 07:50:33 -0700
>> > Commit 726b65ad444d ("tulip: Convert uses of KERN_DEBUG") enabled
>> > some old previously inactive uses of pr_debug converted by
>> > commit dde7c8ef1679 ("tulip/dmfe.c: Use dev_<level> and pr_<level>").
>> > Remove these pr_debugs.
>> > Signed-off-by: Joe Perches <joe@perches.com>
>> Applied.
> 
> I believe this should go into current if you push
> one more to Linus or maybe stable for 3.0.

I know, that's why I added it to net-2.6

^ permalink raw reply

* Re: [PATCH] net: can: remove custom hex_to_bin()
From: David Miller @ 2011-07-18 18:33 UTC (permalink / raw)
  To: socketcan; +Cc: andriy.shevchenko, netdev, linux-kernel, wg
In-Reply-To: <4E243D09.9020800@hartkopp.net>

From: Oliver Hartkopp <socketcan@hartkopp.net>
Date: Mon, 18 Jul 2011 16:02:49 +0200

> On 18.07.2011 10:26, Andy Shevchenko wrote:
>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>> Cc: Wolfgang Grandegger <wg@grandegger.com>
> 
> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>

Applied.

^ permalink raw reply

* Re: [RFC PATCH] net: vlan: 802.1ad S-VLAN support
From: David Miller @ 2011-07-18 18:37 UTC (permalink / raw)
  To: equinox; +Cc: netdev, kaber
In-Reply-To: <1310936105-3494206-1-git-send-email-equinox@diac24.net>

From: David Lamparter <equinox@diac24.net>
Date: Sun, 17 Jul 2011 22:55:05 +0200

>  - int vlan_pidx(u16 protocol)
>    do i do this with a table? that wastes a cacheline... as code it's
>    around 32 bytes on x86_64. it's not called for regular 802.1Q frames
>    from any hot paths btw, so maybe i shouldn't care?

Don't worry about something you haven't seen on profiling output yet,
unless it's something painfully obvious (f.e. using linked list of
thousands of entries for lookups)

FWIW, the counter argument for your concern is that the function
version takes up an I-cache line.

Anyways, like I said, I'd just leave it alone and get rid of all of
that #if 0 stuff.

^ permalink raw reply

* Re: [Bugme-new] [Bug 39252] New: [r8169] PPPoE connections don't work if a custom MAC address is assigned
From: David Miller @ 2011-07-18 18:50 UTC (permalink / raw)
  To: akpm; +Cc: netdev, bugme-daemon, t.artem, mostrows
In-Reply-To: <20110713161345.82e254de.akpm@linux-foundation.org>

From: Andrew Morton <akpm@linux-foundation.org>
Date: Wed, 13 Jul 2011 16:13:45 -0700

>> https://bugzilla.kernel.org/show_bug.cgi?id=39252
>> 
>>            Summary: [r8169] PPPoE connections don't work if a custom MAC
>>                     address is assigned
 ...
>> Description of problem: if I assign a custom MAC address to my onboard NIC,
>> then I cannot establish PPPoE connections, and even `pppoe -A` command doesn't
>> return any PPPoE access concentrators.

Since you seem to be creating your PPPoE connections _after_ changing
the MAC, the following shouldn't matter, but for the cases where
PPPoE connections already exist we do need this kind of change.

Again, I don't expect this to fix the bug, and I believe that it's
some r8169 specific issue.  Although, it might.

--------------------
pppoe: Must flush connections when MAC address changes too.

Kernel bugzilla: 39252

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/pppoe.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 718879b..bc9a4bb 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -348,8 +348,9 @@ static int pppoe_device_event(struct notifier_block *this,
 
 	/* Only look at sockets that are using this specific device. */
 	switch (event) {
+	case NETDEV_CHANGEADDR:
 	case NETDEV_CHANGEMTU:
-		/* A change in mtu is a bad thing, requiring
+		/* A change in mtu or address is a bad thing, requiring
 		 * LCP re-negotiation.
 		 */
 
-- 
1.7.6


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox