From 60cd75a310b0e9815b942581ba515a5cacf5596f Mon Sep 17 00:00:00 2001 From: Senthil Balasubramanian Date: Tue, 12 Jan 2010 16:21:02 +0530 Subject: [PATCH] Fix dev_set_name() for kernel 2.6.23 Signed-off-by: Senthil Balasubramanian --- compat/compat-2.6.26.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/compat/compat-2.6.26.c b/compat/compat-2.6.26.c index d591eb0a18c0..668d658e0084 100644 --- a/compat/compat-2.6.26.c +++ b/compat/compat-2.6.26.c @@ -55,6 +55,19 @@ static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list vargs) { + struct device *dev; + unsigned int len; + va_list aq; + + dev = container_of(kobj, struct device, kobj); + + va_copy(aq, vargs); + len = vsnprintf(NULL, 0, fmt, aq); + va_end(aq); + + len = len < BUS_ID_SIZE ? (len + 1) : BUS_ID_SIZE; + + vsnprintf(dev->bus_id, len, fmt, vargs); return 0; } #endif -- 2.30.2