Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
c7dac7a9
Commit
c7dac7a9
authored
Dec 03, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Dec 03, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] mtd cleanup
switched to devfs_remove(), killed gratitious devfs_handle_t arrays.
parent
94fa0261
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
27 deletions
+16
-27
drivers/mtd/mtdblock.c
drivers/mtd/mtdblock.c
+7
-14
drivers/mtd/mtdchar.c
drivers/mtd/mtdchar.c
+9
-13
No files found.
drivers/mtd/mtdblock.c
View file @
c7dac7a9
...
...
@@ -21,12 +21,7 @@
#define DEVICE_NR(device) (device)
#define LOCAL_END_REQUEST
#include <linux/blk.h>
#ifdef CONFIG_DEVFS_FS
#include <linux/devfs_fs_kernel.h>
static
devfs_handle_t
devfs_dir_handle
=
NULL
;
static
devfs_handle_t
devfs_rw_handle
[
MAX_MTD_DEVICES
];
#endif
static
void
mtd_notify_add
(
struct
mtd_info
*
mtd
);
static
void
mtd_notify_remove
(
struct
mtd_info
*
mtd
);
...
...
@@ -533,15 +528,15 @@ static struct block_device_operations mtd_fops =
static
void
mtd_notify_add
(
struct
mtd_info
*
mtd
)
{
struct
gendisk
*
disk
;
char
name
[
8
];
char
name
[
16
];
if
(
!
mtd
||
mtd
->
type
==
MTD_ABSENT
)
return
;
#ifdef CONFIG_DEVFS_FS
sprintf
(
name
,
"
%d"
,
mtd
->
index
);
devfs_r
w_handle
[
mtd
->
index
]
=
devfs_register
(
devfs_dir_handle
,
name
,
DEVFS_FL_DEFAULT
,
MTD_BLOCK_MAJOR
,
mtd
->
index
,
sprintf
(
name
,
DEVICE_NAME
"/
%d"
,
mtd
->
index
);
devfs_r
egister
(
NULL
,
name
,
DEVFS_FL_DEFAULT
,
MTD_BLOCK_MAJOR
,
mtd
->
index
,
S_IFBLK
|
S_IRUGO
|
S_IWUGO
,
&
mtd_fops
,
NULL
);
#endif
...
...
@@ -566,9 +561,7 @@ static void mtd_notify_remove(struct mtd_info* mtd)
if
(
!
mtd
||
mtd
->
type
==
MTD_ABSENT
)
return
;
#ifdef CONFIG_DEVFS_FS
devfs_unregister
(
devfs_rw_handle
[
mtd
->
index
]);
#endif
devfs_remove
(
DEVICE_NAME
"/%d"
,
mtd
->
index
);
if
(
mtddisk
[
mtd
->
index
])
{
del_gendisk
(
mtddisk
[
mtd
->
index
]);
...
...
@@ -588,7 +581,7 @@ int __init init_mtdblock(void)
return
-
EAGAIN
;
}
#ifdef CONFIG_DEVFS_FS
devfs_
dir_handle
=
devfs_
mk_dir
(
NULL
,
DEVICE_NAME
,
NULL
);
devfs_mk_dir
(
NULL
,
DEVICE_NAME
,
NULL
);
#endif
register_mtd_user
(
&
notifier
);
...
...
@@ -605,7 +598,7 @@ static void __exit cleanup_mtdblock(void)
down
(
&
thread_sem
);
unregister_mtd_user
(
&
notifier
);
#ifdef CONFIG_DEVFS_FS
devfs_
unregister
(
devfs_dir_handle
);
devfs_
remove
(
DEVICE_NAME
);
#endif
unregister_blkdev
(
MAJOR_NR
,
DEVICE_NAME
);
blk_cleanup_queue
(
&
mtd_queue
);
...
...
drivers/mtd/mtdchar.c
View file @
c7dac7a9
...
...
@@ -23,9 +23,6 @@ static struct mtd_notifier notifier = {
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
)
...
...
@@ -464,19 +461,19 @@ static struct file_operations mtd_fops = {
static
void
mtd_notify_add
(
struct
mtd_info
*
mtd
)
{
char
name
[
8
];
char
name
[
16
];
if
(
!
mtd
)
return
;
sprintf
(
name
,
"%d"
,
mtd
->
index
);
devfs_r
w_handle
[
mtd
->
index
]
=
devfs_register
(
devfs_dir_handle
,
name
,
sprintf
(
name
,
"
mtd/
%d"
,
mtd
->
index
);
devfs_r
egister
(
NULL
,
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_r
o_handle
[
mtd
->
index
]
=
devfs_register
(
devfs_dir_handle
,
name
,
sprintf
(
name
,
"
mtd/
%dro"
,
mtd
->
index
);
devfs_r
egister
(
NULL
,
name
,
DEVFS_FL_DEFAULT
,
MTD_CHAR_MAJOR
,
mtd
->
index
*
2
+
1
,
S_IFCHR
|
S_IRUGO
|
S_IWUGO
,
&
mtd_fops
,
NULL
);
...
...
@@ -486,9 +483,8 @@ static void mtd_notify_remove(struct mtd_info* mtd)
{
if
(
!
mtd
)
return
;
devfs_unregister
(
devfs_rw_handle
[
mtd
->
index
]);
devfs_unregister
(
devfs_ro_handle
[
mtd
->
index
]);
devfs_remove
(
"mtd/%d"
,
mtd
->
index
);
devfs_remove
(
"mtd/%dro"
,
mtd
->
index
);
}
#endif
...
...
@@ -501,7 +497,7 @@ static int __init init_mtdchar(void)
}
#ifdef CONFIG_DEVFS_FS
devfs_
dir_handle
=
devfs_
mk_dir
(
NULL
,
"mtd"
,
NULL
);
devfs_mk_dir
(
NULL
,
"mtd"
,
NULL
);
register_mtd_user
(
&
notifier
);
#endif
...
...
@@ -512,7 +508,7 @@ static void __exit cleanup_mtdchar(void)
{
#ifdef CONFIG_DEVFS_FS
unregister_mtd_user
(
&
notifier
);
devfs_
unregister
(
devfs_dir_handle
);
devfs_
remove
(
"mtd"
);
#endif
unregister_chrdev
(
MTD_CHAR_MAJOR
,
"mtd"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment