Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6:
  driver-core: prepare for 2.6.27 api change by adding dev_set_name
  • Loading branch information
Linus Torvalds committed May 30, 2008
2 parents fbf4d7f + 413c239 commit 916941b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,21 @@ static void device_remove_class_symlinks(struct device *dev)
sysfs_remove_link(&dev->kobj, "subsystem");
}

/**
* dev_set_name - set a device name
* @dev: device
*/
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.
Expand Down
3 changes: 3 additions & 0 deletions include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,9 @@ static inline const char *dev_name(struct device *dev)
return dev->bus_id;
}

extern int dev_set_name(struct device *dev, const char *name, ...)
__attribute__((format(printf, 2, 3)));

#ifdef CONFIG_NUMA
static inline int dev_to_node(struct device *dev)
{
Expand Down

0 comments on commit 916941b

Please sign in to comment.