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 d591eb0a18c06b424b38788693155456b37d000f..668d658e0084c04dc1bded6fa14ff2a7799a886d 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