Commit fb5d30ed authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] paride cleanup

	switched to explicit devfs_register()/devfs_remove(), killed gratitious
devfs_handle_t variables.
parent e4c12b0e
...@@ -281,8 +281,6 @@ void pg_init_units( void ) ...@@ -281,8 +281,6 @@ void pg_init_units( void )
} }
} }
static devfs_handle_t devfs_handle;
#define WR(c,r,v) pi_write_regr(PI,c,r,v) #define WR(c,r,v) pi_write_regr(PI,c,r,v)
#define RR(c,r) (pi_read_regr(PI,c,r)) #define RR(c,r) (pi_read_regr(PI,c,r))
...@@ -644,10 +642,15 @@ static int __init pg_init(void) ...@@ -644,10 +642,15 @@ static int __init pg_init(void)
if (PG.present) pi_release(PI); if (PG.present) pi_release(PI);
return -1; return -1;
} }
devfs_handle = devfs_mk_dir (NULL, "pg", NULL); devfs_mk_dir (NULL, "pg", NULL);
devfs_register_series (devfs_handle, "%u", 4, DEVFS_FL_DEFAULT, for (unit=0; unit<PG_UNITS; unit++)
major, 0, S_IFCHR | S_IRUSR | S_IWUSR, if (PG.present) {
char name[16];
sprintf(name, "pg/%u", unit);
devfs_register(NULL, name, DEVFS_FL_DEFAULT,
major, unit, S_IFCHR | S_IRUSR | S_IWUSR,
&pg_fops, NULL); &pg_fops, NULL);
}
return 0; return 0;
} }
...@@ -655,7 +658,11 @@ static void __exit pg_exit(void) ...@@ -655,7 +658,11 @@ static void __exit pg_exit(void)
{ {
int unit; int unit;
devfs_unregister (devfs_handle); for (unit=0; unit<PG_UNITS; unit++)
if (PG.present)
devfs_remove("pg/%u", unit);
devfs_remove ("pg");
unregister_chrdev(major,name); unregister_chrdev(major,name);
for (unit=0;unit<PG_UNITS;unit++) for (unit=0;unit<PG_UNITS;unit++)
......
...@@ -285,8 +285,6 @@ void pt_init_units( void ) ...@@ -285,8 +285,6 @@ void pt_init_units( void )
} }
} }
static devfs_handle_t devfs_handle;
#define WR(c,r,v) pi_write_regr(PI,c,r,v) #define WR(c,r,v) pi_write_regr(PI,c,r,v)
#define RR(c,r) (pi_read_regr(PI,c,r)) #define RR(c,r) (pi_read_regr(PI,c,r))
...@@ -915,20 +913,31 @@ static int __init pt_init(void) ...@@ -915,20 +913,31 @@ static int __init pt_init(void)
return -1; return -1;
} }
devfs_handle = devfs_mk_dir (NULL, "pt", NULL); devfs_mk_dir (NULL, "pt", NULL);
devfs_register_series (devfs_handle, "%u", 4, DEVFS_FL_DEFAULT, for (unit=0;unit<PT_UNITS;unit++)
major, 0, S_IFCHR | S_IRUSR | S_IWUSR, if (PT.present) {
char name[16];
sprintf(name, "pt/%d", unit);
devfs_register(NULL, name, DEVFS_FL_DEFAULT,
major, unit, S_IFCHR | S_IRUSR | S_IWUSR,
&pt_fops, NULL); &pt_fops, NULL);
devfs_register_series (devfs_handle, "%un", 4, DEVFS_FL_DEFAULT, sprintf(name, "pt/%dn", unit);
major, 128, S_IFCHR | S_IRUSR | S_IWUSR, devfs_register(NULL, name, DEVFS_FL_DEFAULT,
major, 128 + unit, S_IFCHR | S_IRUSR | S_IWUSR,
&pt_fops, NULL); &pt_fops, NULL);
}
return 0; return 0;
} }
static void __exit pt_exit(void) static void __exit pt_exit(void)
{ {
int unit; int unit;
devfs_unregister (devfs_handle); for (unit=0;unit<PT_UNITS;unit++)
if (PT.present) {
devfs_remove("pt/%d", unit);
devfs_remove("pt/%dn", unit);
}
devfs_remove("pt");
unregister_chrdev(major,name); unregister_chrdev(major,name);
for (unit=0;unit<PT_UNITS;unit++) for (unit=0;unit<PT_UNITS;unit++)
if (PT.present) if (PT.present)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment