git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
drivers
/
block
/
paride
/
pg.c
diff --git
a/drivers/block/paride/pg.c
b/drivers/block/paride/pg.c
index
dbeb107
..
9970aed
100644
(file)
--- a/
drivers/block/paride/pg.c
+++ b/
drivers/block/paride/pg.c
@@
-156,12
+156,13
@@
enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
-#include <linux/devfs_fs_kernel.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/mtio.h>
#include <linux/pg.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/mtio.h>
#include <linux/pg.h>
#include <linux/device.h>
+#include <linux/sched.h> /* current, TASK_* */
+#include <linux/jiffies.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
@@
-222,7
+223,7
@@
static int pg_identify(struct pg *dev, int log);
static char pg_scratch[512]; /* scratch block buffer */
static char pg_scratch[512]; /* scratch block buffer */
-static struct class
_simple
*pg_class;
+static struct class *pg_class;
/* kernel glue structures */
/* kernel glue structures */
@@
-276,8
+277,7
@@
static inline u8 DRIVE(struct pg *dev)
static void pg_sleep(int cs)
{
static void pg_sleep(int cs)
{
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(cs);
+ schedule_timeout_interruptible(cs);
}
static int pg_wait(struct pg *dev, int go, int stop, unsigned long tmo, char *msg)
}
static int pg_wait(struct pg *dev, int go, int stop, unsigned long tmo, char *msg)
@@
-642,54
+642,46
@@
static ssize_t pg_read(struct file *filp, char __user *buf, size_t count, loff_t
static int __init pg_init(void)
{
static int __init pg_init(void)
{
- int unit, err = 0;
+ int unit;
+ int err;
if (disable){
if (disable){
- err = -
1
;
+ err = -
EINVAL
;
goto out;
}
pg_init_units();
if (pg_detect()) {
goto out;
}
pg_init_units();
if (pg_detect()) {
- err = -
1
;
+ err = -
ENODEV
;
goto out;
}
goto out;
}
- if (register_chrdev(major, name, &pg_fops)) {
+ err = register_chrdev(major, name, &pg_fops);
+ if (err < 0) {
printk("pg_init: unable to get major number %d\n", major);
for (unit = 0; unit < PG_UNITS; unit++) {
struct pg *dev = &devices[unit];
if (dev->present)
pi_release(dev->pi);
}
printk("pg_init: unable to get major number %d\n", major);
for (unit = 0; unit < PG_UNITS; unit++) {
struct pg *dev = &devices[unit];
if (dev->present)
pi_release(dev->pi);
}
- err = -1;
goto out;
}
goto out;
}
- pg_class = class_simple_create(THIS_MODULE, "pg");
+ major = err; /* In case the user specified `major=0' (dynamic) */
+ pg_class = class_create(THIS_MODULE, "pg");
if (IS_ERR(pg_class)) {
err = PTR_ERR(pg_class);
goto out_chrdev;
}
if (IS_ERR(pg_class)) {
err = PTR_ERR(pg_class);
goto out_chrdev;
}
- devfs_mk_dir("pg");
for (unit = 0; unit < PG_UNITS; unit++) {
struct pg *dev = &devices[unit];
for (unit = 0; unit < PG_UNITS; unit++) {
struct pg *dev = &devices[unit];
- if (dev->present)
{
- class_
simple_device_add(pg_class, MKDEV(major, unit),
+ if (dev->present)
+ class_
device_create(pg_class, NULL, MKDEV(major, unit),
NULL, "pg%u", unit);
NULL, "pg%u", unit);
- err = devfs_mk_cdev(MKDEV(major, unit),
- S_IFCHR | S_IRUSR | S_IWUSR, "pg/%u",
- unit);
- if (err)
- goto out_class;
- }
}
err = 0;
goto out;
}
err = 0;
goto out;
-out_class:
- class_simple_device_remove(MKDEV(major, unit));
- class_simple_destroy(pg_class);
out_chrdev:
unregister_chrdev(major, "pg");
out:
out_chrdev:
unregister_chrdev(major, "pg");
out:
@@
-702,13
+694,10
@@
static void __exit pg_exit(void)
for (unit = 0; unit < PG_UNITS; unit++) {
struct pg *dev = &devices[unit];
for (unit = 0; unit < PG_UNITS; unit++) {
struct pg *dev = &devices[unit];
- if (dev->present) {
- class_simple_device_remove(MKDEV(major, unit));
- devfs_remove("pg/%u", unit);
- }
+ if (dev->present)
+ class_device_destroy(pg_class, MKDEV(major, unit));
}
}
- class_simple_destroy(pg_class);
- devfs_remove("pg");
+ class_destroy(pg_class);
unregister_chrdev(major, name);
for (unit = 0; unit < PG_UNITS; unit++) {
unregister_chrdev(major, name);
for (unit = 0; unit < PG_UNITS; unit++) {