public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] MTD + 2.6.13/2.6.14 OOPS in class_device_create() fix
@ 2005-12-09 15:46 Artem B. Bityutskiy
  2005-12-09 15:53 ` Artem B. Bityutskiy
  0 siblings, 1 reply; 3+ messages in thread
From: Artem B. Bityutskiy @ 2005-12-09 15:46 UTC (permalink / raw)
  To: Linux MTD

Hello,

Current MTD CVS head oopses in class_device_create().

This are because there is 2 calls in mtdchar.c which look like this:

class_device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, 
mtd->index*2), NULL, "mtd%d", mtd->index);

This is perfectly fine with 2.6.15-rc5, where class_device_create() has 
the following prototype:

struct class_device *class_device_create(struct class *cls, struct 
class_device *parent, dev_t devt, struct device *device, char *fmt, ...)

But it causes oops in 2.6.14.3, where class_device_create() has the 
following (different) prototype:

struct class_device *class_device_create(struct class *cls, dev_t devt, 
struct device *device, char *fmt, ...)

I.e., one more argument 'parent' was introduced in 2.6.15-rc5. And since 
the function accepts any number of arguments, it compiles well, but 
doesn't work.

Usually problems like this are solved by means of 
include/linux/mtd/compatmac.h, but in this case I have no idea how to 
solve this gracefully there.

As 2.6.15 is not yet out and 2.6.14 is still used, I offer the attached 
hotfix for now.

-- 
Best Regards,
Artem B. Bityutskiy,
St.-Petersburg, Russia.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] MTD + 2.6.13/2.6.14 OOPS in class_device_create() fix
  2005-12-09 15:46 [PATCH] MTD + 2.6.13/2.6.14 OOPS in class_device_create() fix Artem B. Bityutskiy
@ 2005-12-09 15:53 ` Artem B. Bityutskiy
  0 siblings, 0 replies; 3+ messages in thread
From: Artem B. Bityutskiy @ 2005-12-09 15:53 UTC (permalink / raw)
  To: Linux MTD

Artem B. Bityutskiy wrote:
> As 2.6.15 is not yet out and 2.6.14 is still used, I offer the attached 
> hotfix for now.
Pardon, here is the hotfix.

==================================================================
diff --exclude=CVS -auNr mtd-cvs/drivers/mtd/mtdchar.c 
mtd-fix/drivers/mtd/mtdchar.c
--- mtd-cvs/drivers/mtd/mtdchar.c       2005-12-09 18:36:24.000000000 +0300
+++ mtd-fix/drivers/mtd/mtdchar.c       2005-12-09 18:34:43.000000000 +0300
@@ -21,15 +21,28 @@

  static struct class *mtd_class;

+/*
+ * In 2.6.13 and 2.6.14 kernels class_device_create() had different 
prototype.
+ * No idea how to fix it in compatmac.h, so this is a hotfix. Must go 
sometime.
+ */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) && \
+    LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
+#define mtd_class_device_create(cls, parent, devt, device, fmt, num) \
+               class_device_create(cls, devt, device, fmt, num)
+#else
+#define mtd_class_device_create(cls, parent, devt, device, fmt, num) \
+               class_device_create(cls, parent, devt, device, fmt, num)
+#endif
+
  static void mtd_notify_add(struct mtd_info* mtd)
  {
         if (!mtd)
                 return;

-       class_device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, 
mtd->index*2),
+       mtd_class_device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, 
mtd->index*2),
                             NULL, "mtd%d", mtd->index);

-       class_device_create(mtd_class, NULL,
+       mtd_class_device_create(mtd_class, NULL,
                             MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1),
                             NULL, "mtd%dro", mtd->index);
  }
==================================================================

-- 
Best Regards,
Artem B. Bityutskiy,
St.-Petersburg, Russia.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] MTD + 2.6.13/2.6.14 OOPS in class_device_create() fix
       [not found] <520AB2AD990DC04082102F77CA17263801F612A9@dlee03.ent.ti.com>
@ 2005-12-11 11:49 ` Artem B. Bityutskiy
  0 siblings, 0 replies; 3+ messages in thread
From: Artem B. Bityutskiy @ 2005-12-11 11:49 UTC (permalink / raw)
  To: Menon, Nishanth; +Cc: Linux MTD

Menon, Nishanth wrote:
> Does the 
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) && \
> +    LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
> Belong to include/linux/mtd/compatmac.h ?
No, I don't think it is a good idea to hid this there.

-- 
Best Regards,
Artem B. Bityutskiy,
St.-Petersburg, Russia.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-12-11 11:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-09 15:46 [PATCH] MTD + 2.6.13/2.6.14 OOPS in class_device_create() fix Artem B. Bityutskiy
2005-12-09 15:53 ` Artem B. Bityutskiy
     [not found] <520AB2AD990DC04082102F77CA17263801F612A9@dlee03.ent.ti.com>
2005-12-11 11:49 ` Artem B. Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox