static void mtd_notify_add(struct mtd_info *mtd)
{
  if (!mtd)
    return;

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

static void mtd_notify_remove(struct mtd_info *mtd)
{
  if (!mtd)
    return;

  class_device_destroy(mtd_class, MKDEV(MTD_CHAR_MAJOR, mtd->index*2));
  class_device_destroy(mtd_class, MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1));
}

static struct mtd_notifier notifier = {
  .add = mtd_notify_add,
  .remove = mtd_notify_remove,
};