Merge branches 'x86/numa-fixes', 'x86/apic', 'x86/apm', 'x86/bitops', 'x86/build', 'x86/cleanups', 'x86/cpa', 'x86/cpu', 'x86/defconfig', 'x86/gart', 'x86/i8259', 'x86/intel', 'x86/irqstats', 'x86/kconfig', 'x86/ldt', 'x86/mce', 'x86/memtest', 'x86/pat', 'x86/ptemask', 'x86/resumetrace', 'x86/threadinfo', 'x86/timers', 'x86/vdso' and 'x86/xen' into x86/devel
This commit is contained in:

@@ -759,6 +759,22 @@ static void device_remove_class_symlinks(struct device *dev)
|
||||
sysfs_remove_link(&dev->kobj, "subsystem");
|
||||
}
|
||||
|
||||
/**
|
||||
* dev_set_name - set a device name
|
||||
* @dev: device
|
||||
* @fmt: format string for the device's name
|
||||
*/
|
||||
int dev_set_name(struct device *dev, const char *fmt, ...)
|
||||
{
|
||||
va_list vargs;
|
||||
|
||||
va_start(vargs, fmt);
|
||||
vsnprintf(dev->bus_id, sizeof(dev->bus_id), fmt, vargs);
|
||||
va_end(vargs);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dev_set_name);
|
||||
|
||||
/**
|
||||
* device_add - add device to device hierarchy.
|
||||
* @dev: device.
|
||||
@@ -1083,6 +1099,102 @@ static void device_create_release(struct device *dev)
|
||||
kfree(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* device_create_vargs - creates a device and registers it with sysfs
|
||||
* @class: pointer to the struct class that this device should be registered to
|
||||
* @parent: pointer to the parent struct device of this new device, if any
|
||||
* @devt: the dev_t for the char device to be added
|
||||
* @drvdata: the data to be added to the device for callbacks
|
||||
* @fmt: string for the device's name
|
||||
* @args: va_list for the device's name
|
||||
*
|
||||
* This function can be used by char device classes. A struct device
|
||||
* will be created in sysfs, registered to the specified class.
|
||||
*
|
||||
* A "dev" file will be created, showing the dev_t for the device, if
|
||||
* the dev_t is not 0,0.
|
||||
* If a pointer to a parent struct device is passed in, the newly created
|
||||
* struct device will be a child of that device in sysfs.
|
||||
* The pointer to the struct device will be returned from the call.
|
||||
* Any further sysfs files that might be required can be created using this
|
||||
* pointer.
|
||||
*
|
||||
* Note: the struct class passed to this function must have previously
|
||||
* been created with a call to class_create().
|
||||
*/
|
||||
struct device *device_create_vargs(struct class *class, struct device *parent,
|
||||
dev_t devt, void *drvdata, const char *fmt,
|
||||
va_list args)
|
||||
{
|
||||
struct device *dev = NULL;
|
||||
int retval = -ENODEV;
|
||||
|
||||
if (class == NULL || IS_ERR(class))
|
||||
goto error;
|
||||
|
||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||
if (!dev) {
|
||||
retval = -ENOMEM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
dev->devt = devt;
|
||||
dev->class = class;
|
||||
dev->parent = parent;
|
||||
dev->release = device_create_release;
|
||||
dev_set_drvdata(dev, drvdata);
|
||||
|
||||
vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args);
|
||||
retval = device_register(dev);
|
||||
if (retval)
|
||||
goto error;
|
||||
|
||||
return dev;
|
||||
|
||||
error:
|
||||
kfree(dev);
|
||||
return ERR_PTR(retval);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_create_vargs);
|
||||
|
||||
/**
|
||||
* device_create_drvdata - creates a device and registers it with sysfs
|
||||
* @class: pointer to the struct class that this device should be registered to
|
||||
* @parent: pointer to the parent struct device of this new device, if any
|
||||
* @devt: the dev_t for the char device to be added
|
||||
* @drvdata: the data to be added to the device for callbacks
|
||||
* @fmt: string for the device's name
|
||||
*
|
||||
* This function can be used by char device classes. A struct device
|
||||
* will be created in sysfs, registered to the specified class.
|
||||
*
|
||||
* A "dev" file will be created, showing the dev_t for the device, if
|
||||
* the dev_t is not 0,0.
|
||||
* If a pointer to a parent struct device is passed in, the newly created
|
||||
* struct device will be a child of that device in sysfs.
|
||||
* The pointer to the struct device will be returned from the call.
|
||||
* Any further sysfs files that might be required can be created using this
|
||||
* pointer.
|
||||
*
|
||||
* Note: the struct class passed to this function must have previously
|
||||
* been created with a call to class_create().
|
||||
*/
|
||||
struct device *device_create_drvdata(struct class *class,
|
||||
struct device *parent,
|
||||
dev_t devt,
|
||||
void *drvdata,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
va_list vargs;
|
||||
struct device *dev;
|
||||
|
||||
va_start(vargs, fmt);
|
||||
dev = device_create_vargs(class, parent, devt, drvdata, fmt, vargs);
|
||||
va_end(vargs);
|
||||
return dev;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_create_drvdata);
|
||||
|
||||
/**
|
||||
* device_create - creates a device and registers it with sysfs
|
||||
* @class: pointer to the struct class that this device should be registered to
|
||||
@@ -1107,36 +1219,13 @@ static void device_create_release(struct device *dev)
|
||||
struct device *device_create(struct class *class, struct device *parent,
|
||||
dev_t devt, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
struct device *dev = NULL;
|
||||
int retval = -ENODEV;
|
||||
|
||||
if (class == NULL || IS_ERR(class))
|
||||
goto error;
|
||||
|
||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||
if (!dev) {
|
||||
retval = -ENOMEM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
dev->devt = devt;
|
||||
dev->class = class;
|
||||
dev->parent = parent;
|
||||
dev->release = device_create_release;
|
||||
|
||||
va_start(args, fmt);
|
||||
vsnprintf(dev->bus_id, BUS_ID_SIZE, fmt, args);
|
||||
va_end(args);
|
||||
retval = device_register(dev);
|
||||
if (retval)
|
||||
goto error;
|
||||
va_list vargs;
|
||||
struct device *dev;
|
||||
|
||||
va_start(vargs, fmt);
|
||||
dev = device_create_vargs(class, parent, devt, NULL, fmt, vargs);
|
||||
va_end(vargs);
|
||||
return dev;
|
||||
|
||||
error:
|
||||
kfree(dev);
|
||||
return ERR_PTR(retval);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_create);
|
||||
|
||||
@@ -1218,13 +1307,11 @@ int device_rename(struct device *dev, char *new_name)
|
||||
}
|
||||
#else
|
||||
if (dev->class) {
|
||||
sysfs_remove_link(&dev->class->subsys.kobj, old_device_name);
|
||||
error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj,
|
||||
dev->bus_id);
|
||||
if (error) {
|
||||
dev_err(dev, "%s: sysfs_create_symlink failed (%d)\n",
|
||||
__func__, error);
|
||||
}
|
||||
if (error)
|
||||
goto out;
|
||||
sysfs_remove_link(&dev->class->subsys.kobj, old_device_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -84,8 +84,8 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf)
|
||||
nid, K(i.totalram),
|
||||
nid, K(i.freeram),
|
||||
nid, K(i.totalram - i.freeram),
|
||||
nid, node_page_state(nid, NR_ACTIVE),
|
||||
nid, node_page_state(nid, NR_INACTIVE),
|
||||
nid, K(node_page_state(nid, NR_ACTIVE)),
|
||||
nid, K(node_page_state(nid, NR_INACTIVE)),
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
nid, K(i.totalhigh),
|
||||
nid, K(i.freehigh),
|
||||
|
@@ -153,7 +153,7 @@ EXPORT_SYMBOL(set_trace_device);
|
||||
* it's not any guarantee, but it's a high _likelihood_ that
|
||||
* the match is valid).
|
||||
*/
|
||||
void generate_resume_trace(void *tracedata, unsigned int user)
|
||||
void generate_resume_trace(const void *tracedata, unsigned int user)
|
||||
{
|
||||
unsigned short lineno = *(unsigned short *)tracedata;
|
||||
const char *file = *(const char **)(tracedata + 2);
|
||||
|
Reference in New Issue
Block a user