Fix dev_set_name() for kernel 2.6.23
authorSenthil Balasubramanian <senthilkumar@atheros.com>
Tue, 12 Jan 2010 10:51:02 +0000 (16:21 +0530)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Wed, 13 Jan 2010 00:59:29 +0000 (16:59 -0800)
Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
compat/compat-2.6.26.c

index d591eb0..668d658 100644 (file)
@@ -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