From: John Whitney <john.whitney@timesys.com>
To: <linux-mtd@lists.infradead.org>
Subject: Suggested patch for mtdchar.c
Date: Wed, 19 Nov 2003 10:06:45 -0500 [thread overview]
Message-ID: <BBE0F135.26DA%john.whitney@timesys.com> (raw)
Hello,
I've checked out the latest MTD source, and when I added it to my 2.6.0-pre9
LinuxPPC kernel tree, encountered devfs issues with mtdchar.c. Listed below
is a patch created from my updated file. Sorry if something about this has
been posted before, but I didn't find any mention of it in the archives.
--- mtdchar.c.orig 2003-11-19 10:00:54.000000000 -0500
+++ mtdchar.c 2003-11-18 09:37:16.000000000 -0500
@@ -24,10 +24,6 @@
.add = mtd_notify_add,
.remove = mtd_notify_remove,
};
-
-static devfs_handle_t devfs_dir_handle;
-static devfs_handle_t devfs_rw_handle[MAX_MTD_DEVICES];
-static devfs_handle_t devfs_ro_handle[MAX_MTD_DEVICES];
#endif
static loff_t mtd_lseek (struct file *file, loff_t offset, int orig)
@@ -477,22 +473,15 @@
static void mtd_notify_add(struct mtd_info* mtd)
{
- char name[8];
-
if (!mtd)
return;
- sprintf(name, "%d", mtd->index);
- devfs_rw_handle[mtd->index] = devfs_register(devfs_dir_handle, name,
- DEVFS_FL_DEFAULT, MTD_CHAR_MAJOR, mtd->index*2,
- S_IFCHR | S_IRUGO | S_IWUGO,
- &mtd_fops, NULL);
-
- sprintf(name, "%dro", mtd->index);
- devfs_ro_handle[mtd->index] = devfs_register(devfs_dir_handle, name,
- DEVFS_FL_DEFAULT, MTD_CHAR_MAJOR, mtd->index*2+1,
- S_IFCHR | S_IRUGO,
- &mtd_fops, NULL);
+ devfs_mk_cdev (MKDEV(MTD_CHAR_MAJOR, mtd->index*2),
+ S_IFCHR | S_IRUGO | S_IWUGO,
+ "mtd/%d", mtd->index);
+ devfs_mk_cdev (MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1),
+ S_IFCHR | S_IRUGO | S_IWUGO,
+ "mtd/%dro", mtd->index);
}
static void mtd_notify_remove(struct mtd_info* mtd)
@@ -500,8 +489,8 @@
if (!mtd)
return;
- devfs_unregister(devfs_rw_handle[mtd->index]);
- devfs_unregister(devfs_ro_handle[mtd->index]);
+ devfs_remove ("mtd/%d", mtd->index*2);
+ devfs_remove ("mtd/%dro", mtd->index*2);
}
#endif
@@ -515,7 +504,7 @@
}
#ifdef CONFIG_DEVFS_FS
- devfs_dir_handle = devfs_mk_dir(NULL, "mtd", NULL);
+ devfs_mk_dir("mtd");
register_mtd_user(¬ifier);
#endif
@@ -526,7 +515,7 @@
{
#ifdef CONFIG_DEVFS_FS
unregister_mtd_user(¬ifier);
- devfs_unregister(devfs_dir_handle);
+ devfs_remove ("mtd");
#endif
unregister_chrdev(MTD_CHAR_MAJOR, "mtd");
}
reply other threads:[~2003-11-19 15:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BBE0F135.26DA%john.whitney@timesys.com \
--to=john.whitney@timesys.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox