[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1212120984-15274-2-git-send-email-gregkh@suse.de>
Date: Thu, 29 May 2008 21:16:24 -0700
From: Greg Kroah-Hartman <gregkh@...e.de>
To: linux-kernel@...r.kernel.org
Cc: Stephen Rothwell <sfr@...b.auug.org.au>,
Kay Sievers <kay.sievers@...y.org>,
Greg Kroah-Hartman <gregkh@...e.de>
Subject: driver-core: prepare for 2.6.27 api change by adding dev_set_name
From: Stephen Rothwell <sfr@...b.auug.org.au>
Create the dev_set_name function now so that various subsystems can
start changing over to it before other changes in 2.6.27 will make it
compulsory.
Cc: Kay Sievers <kay.sievers@...y.org>
Signed-off-by: Stephen Rothwell <sfr@...b.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@...e.de>
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -760,6 +760,21 @@ static void device_remove_class_symlinks(struct device *dev)
}
/**
+ * 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.
*
diff --git a/include/linux/device.h b/include/linux/device.h
index 14616e8..6a2d04c 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -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)
{
--
1.5.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-next" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists