\f
/* ---------- Headers, macros, data structures ---------- */
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/fs.h>
-#include <linux/devfs_fs_kernel.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/errno.h>
static int irq[MAX_CARDS+1] = { -1, -1, -1, -1, -1, -1, 0, };
/* for class stuff*/
-static struct class_simple *cosa_class;
+static struct class *cosa_class;
#ifdef MODULE
module_param_array(io, int, NULL, 0);
err = -ENODEV;
goto out;
}
- devfs_mk_dir("cosa");
- cosa_class = class_simple_create(THIS_MODULE, "cosa");
+ cosa_class = class_create(THIS_MODULE, "cosa");
if (IS_ERR(cosa_class)) {
err = PTR_ERR(cosa_class);
goto out_chrdev;
}
for (i=0; i<nr_cards; i++) {
- class_simple_device_add(cosa_class, MKDEV(cosa_major, i),
+ class_device_create(cosa_class, NULL, MKDEV(cosa_major, i),
NULL, "cosa%d", i);
- err = devfs_mk_cdev(MKDEV(cosa_major, i),
- S_IFCHR|S_IRUSR|S_IWUSR,
- "cosa/%d", i);
- if (err) {
- class_simple_device_remove(MKDEV(cosa_major, i));
- goto out_chrdev;
- }
}
err = 0;
goto out;
int i;
printk(KERN_INFO "Unloading the cosa module\n");
- for (i=0; i<nr_cards; i++) {
- class_simple_device_remove(MKDEV(cosa_major, i));
- devfs_remove("cosa/%d", i);
- }
- class_simple_destroy(cosa_class);
- devfs_remove("cosa");
+ for (i=0; i<nr_cards; i++)
+ class_device_destroy(cosa_class, MKDEV(cosa_major, i));
+ class_destroy(cosa_class);
for (cosa=cosa_cards; nr_cards--; cosa++) {
/* Clean up the per-channel data */
for (i=0; i<cosa->nchannels; i++) {
* FIXME: When this code is not used as module, we should
* probably call udelay() instead of the interruptible sleep.
*/
- current->state = TASK_INTERRUPTIBLE;
+ set_current_state(TASK_INTERRUPTIBLE);
cosa_putstatus(cosa, SR_TX_INT_ENA);
schedule_timeout(30);
irq = probe_irq_off(irqs);
cosa_getdata8(cosa);
cosa_putstatus(cosa, SR_RST);
#ifdef MODULE
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(HZ/2);
+ msleep(500);
#else
udelay(5*100000);
#endif
return r;
}
/* sleep if not ready to read */
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(1);
+ schedule_timeout_interruptible(1);
}
printk(KERN_INFO "cosa: timeout in get_wait_data (status 0x%x)\n",
cosa_getstatus(cosa));
}
#if 0
/* sleep if not ready to read */
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(1);
+ schedule_timeout_interruptible(1);
#endif
}
printk(KERN_INFO "cosa%d: timeout in put_wait_data (status 0x%x)\n",