diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-02-24 00:12:35 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-02-24 00:12:35 +0000 |
commit | 482368b1a8e45430672c58c9a42e7d2004367126 (patch) | |
tree | ce2a1a567d4d62dee7c2e71a46a99cf72cf1d606 /drivers/cdrom | |
parent | e4d0251c6f56ab2e191afb70f80f382793e23f74 (diff) |
Merge with 2.3.47. Guys, this is buggy as shit. You've been warned.
Diffstat (limited to 'drivers/cdrom')
-rw-r--r-- | drivers/cdrom/aztcd.c | 11 | ||||
-rw-r--r-- | drivers/cdrom/cdrom.c | 33 | ||||
-rw-r--r-- | drivers/cdrom/cdu31a.c | 11 | ||||
-rw-r--r-- | drivers/cdrom/cm206.c | 7 | ||||
-rw-r--r-- | drivers/cdrom/gscd.c | 14 | ||||
-rw-r--r-- | drivers/cdrom/mcd.c | 7 | ||||
-rw-r--r-- | drivers/cdrom/mcdx.c | 11 | ||||
-rw-r--r-- | drivers/cdrom/optcd.c | 13 | ||||
-rw-r--r-- | drivers/cdrom/sbpcd.c | 43 | ||||
-rw-r--r-- | drivers/cdrom/sjcd.c | 11 | ||||
-rw-r--r-- | drivers/cdrom/sonycd535.c | 14 |
11 files changed, 125 insertions, 50 deletions
diff --git a/drivers/cdrom/aztcd.c b/drivers/cdrom/aztcd.c index ef9cbd398..e7df93ac6 100644 --- a/drivers/cdrom/aztcd.c +++ b/drivers/cdrom/aztcd.c @@ -183,6 +183,7 @@ #include <linux/ioport.h> #include <linux/string.h> #include <linux/major.h> +#include <linux/devfs_fs_kernel.h> #ifndef AZT_KERNEL_PRIOR_2_1 #include <linux/init.h> @@ -234,7 +235,7 @@ static int aztcd_blocksizes[1] = {2048}; #endif #define CURRENT_VALID \ - (CURRENT && MAJOR(CURRENT -> rq_dev) == MAJOR_NR && CURRENT -> cmd == READ \ + (!QUEUE_EMPTY && MAJOR(CURRENT -> rq_dev) == MAJOR_NR && CURRENT -> cmd == READ \ && CURRENT -> sector != -1) #define AFL_STATUSorDATA (AFL_STATUS | AFL_DATA) @@ -1785,7 +1786,9 @@ int __init aztcd_init(void) return -EIO; } } - if (register_blkdev(MAJOR_NR, "aztcd", &azt_fops) != 0) + devfs_register (NULL, "aztcd", 0, DEVFS_FL_DEFAULT, MAJOR_NR, 0, + S_IFBLK | S_IRUGO | S_IWUGO, 0, 0, &azt_fops, NULL); + if (devfs_register_blkdev(MAJOR_NR, "aztcd", &azt_fops) != 0) { printk("aztcd: Unable to get major %d for Aztech CD-ROM\n", MAJOR_NR); @@ -1811,7 +1814,9 @@ int __init aztcd_init(void) void __exit aztcd_exit(void) { - if ((unregister_blkdev(MAJOR_NR, "aztcd") == -EINVAL)) + devfs_unregister(devfs_find_handle(NULL, "aztcd", 0, 0, 0, DEVFS_SPECIAL_BLK, + 0)); + if ((devfs_unregister_blkdev(MAJOR_NR, "aztcd") == -EINVAL)) { printk("What's that: can't unregister aztcd\n"); return; } diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index c40e0ae28..c20ce1b93 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -291,6 +291,7 @@ int cdrom_get_next_writable(kdev_t dev, long *next_writable); static void cdrom_sysctl_register(void); #endif /* CONFIG_SYSCTL */ static struct cdrom_device_info *topCdromPtr = NULL; +static devfs_handle_t devfs_handle = NULL; struct block_device_operations cdrom_fops = { @@ -313,6 +314,8 @@ int register_cdrom(struct cdrom_device_info *cdi) int major = MAJOR(cdi->dev); struct cdrom_device_ops *cdo = cdi->ops; int *change_capability = (int *)&cdo->capability; /* hack */ + char vname[16]; + static unsigned int cdrom_counter = 0; cdinfo(CD_OPEN, "entering register_cdrom\n"); @@ -351,6 +354,31 @@ int register_cdrom(struct cdrom_device_info *cdi) if (check_media_type==1) cdi->options |= (int) CDO_CHECK_TYPE; + if (!devfs_handle) + devfs_handle = devfs_mk_dir (NULL, "cdroms", 6, NULL); + sprintf (vname, "cdrom%u", cdrom_counter++); + if (cdi->de) { + int pos; + devfs_handle_t slave; + char rname[64]; + + pos = devfs_generate_path (cdi->de, rname + 3, + sizeof rname - 3); + if (pos >= 0) { + strncpy (rname + pos, "../", 3); + devfs_mk_symlink (devfs_handle, vname, 0, + DEVFS_FL_DEFAULT, + rname + pos, 0, &slave, NULL); + devfs_auto_unregister (cdi->de, slave); + } + } + else { + cdi->de = + devfs_register (devfs_handle, vname, 0, DEVFS_FL_DEFAULT, + MAJOR (cdi->dev), MINOR (cdi->dev), + S_IFBLK | S_IRUGO | S_IWUGO, 0, 0, + &cdrom_fops, NULL); + } cdinfo(CD_REG_UNREG, "drive \"/dev/%s\" registered\n", cdi->name); cdi->next = topCdromPtr; topCdromPtr = cdi; @@ -382,6 +410,7 @@ int unregister_cdrom(struct cdrom_device_info *unreg) else topCdromPtr = cdi->next; cdi->ops->n_minors--; + devfs_unregister (cdi->de); cdinfo(CD_REG_UNREG, "drive \"/dev/%s\" unregistered\n", cdi->name); return 0; } @@ -2483,6 +2512,7 @@ int init_module(void) #ifdef CONFIG_SYSCTL cdrom_sysctl_register(); #endif + devfs_handle = devfs_mk_dir (NULL, "cdroms", 6, NULL); return 0; } @@ -2491,7 +2521,8 @@ void cleanup_module(void) printk(KERN_INFO "Uniform CD-ROM driver unloaded\n"); #ifdef CONFIG_SYSCTL cdrom_sysctl_unregister(); -#endif /* CONFIG_SYSCTL */ +#endif /* CONFIG_SYSCTL */ + devfs_unregister (devfs_handle); } #endif /* endif MODULE */ diff --git a/drivers/cdrom/cdu31a.c b/drivers/cdrom/cdu31a.c index 24e7a5c26..0b8d942b4 100644 --- a/drivers/cdrom/cdu31a.c +++ b/drivers/cdrom/cdu31a.c @@ -162,6 +162,7 @@ #include <linux/hdreg.h> #include <linux/genhd.h> #include <linux/ioport.h> +#include <linux/devfs_fs_kernel.h> #include <linux/string.h> #include <linux/malloc.h> #include <linux/init.h> @@ -1672,7 +1673,7 @@ do_cdu31a_request(request_queue_t * q) if (signal_pending(current)) { restore_flags(flags); - if (CURRENT && CURRENT->rq_status != RQ_INACTIVE) + if (!QUEUE_EMPTY && CURRENT->rq_status != RQ_INACTIVE) { end_request(0); } @@ -1705,7 +1706,7 @@ cdu31a_request_startover: * The beginning here is stolen from the hard disk driver. I hope * it's right. */ - if (!(CURRENT) || CURRENT->rq_status == RQ_INACTIVE) + if (QUEUE_EMPTY || CURRENT->rq_status == RQ_INACTIVE) { goto end_do_cdu31a_request; } @@ -3441,7 +3442,7 @@ cdu31a_init(void) request_region(cdu31a_port, 4,"cdu31a"); - if (register_blkdev(MAJOR_NR,"cdu31a",&cdrom_fops)) + if (devfs_register_blkdev(MAJOR_NR,"cdu31a",&cdrom_fops)) { printk("Unable to get major %d for CDU-31a\n", MAJOR_NR); goto errout2; @@ -3543,7 +3544,7 @@ cdu31a_init(void) } errout0: printk("Unable to register CDU-31a with Uniform cdrom driver\n"); - if (unregister_blkdev(MAJOR_NR, "cdu31a")) + if (devfs_unregister_blkdev(MAJOR_NR, "cdu31a")) { printk("Can't unregister block device for cdu31a\n"); } @@ -3562,7 +3563,7 @@ cdu31a_exit(void) printk("Can't unregister cdu31a from Uniform cdrom driver\n"); return; } - if ((unregister_blkdev(MAJOR_NR, "cdu31a") == -EINVAL)) + if ((devfs_unregister_blkdev(MAJOR_NR, "cdu31a") == -EINVAL)) { printk("Can't unregister cdu31a\n"); return; diff --git a/drivers/cdrom/cm206.c b/drivers/cdrom/cm206.c index e600d81d0..05aff4b59 100644 --- a/drivers/cdrom/cm206.c +++ b/drivers/cdrom/cm206.c @@ -187,6 +187,7 @@ History: #include <linux/interrupt.h> #include <linux/timer.h> #include <linux/cdrom.h> +#include <linux/devfs_fs_kernel.h> #include <linux/ioport.h> #include <linux/mm.h> #include <linux/malloc.h> @@ -816,7 +817,7 @@ static void do_cm206_request(request_queue_t * q) while(1) { /* repeat until all requests have been satisfied */ INIT_REQUEST; - if (CURRENT == NULL || CURRENT->rq_status == RQ_INACTIVE) + if (QUEUE_EMPTY || CURRENT->rq_status == RQ_INACTIVE) return; if (CURRENT->cmd != READ) { debug(("Non-read command %d on cdrom\n", CURRENT->cmd)); @@ -1277,7 +1278,7 @@ static void cleanup(int level) printk("Can't unregister cdrom cm206\n"); return; } - if (unregister_blkdev(MAJOR_NR, "cm206")) { + if (devfs_unregister_blkdev(MAJOR_NR, "cm206")) { printk("Can't unregister major cm206\n"); return; } @@ -1390,7 +1391,7 @@ int __init cm206_init(void) return -EIO; } printk(".\n"); - if (register_blkdev(MAJOR_NR, "cm206", &cdrom_fops) != 0) { + if (devfs_register_blkdev(MAJOR_NR, "cm206", &cdrom_fops) != 0) { printk(KERN_INFO "Cannot register for major %d!\n", MAJOR_NR); cleanup(3); return -EIO; diff --git a/drivers/cdrom/gscd.c b/drivers/cdrom/gscd.c index 6047df0c7..f563a16c0 100644 --- a/drivers/cdrom/gscd.c +++ b/drivers/cdrom/gscd.c @@ -63,6 +63,7 @@ #include <linux/major.h> #include <linux/string.h> #include <linux/init.h> +#include <linux/devfs_fs_kernel.h> #include <asm/system.h> #include <asm/io.h> @@ -279,13 +280,13 @@ unsigned int block,dev; unsigned int nsect; repeat: - if (!(CURRENT) || CURRENT->rq_status == RQ_INACTIVE) return; + if (QUEUE_EMPTY || CURRENT->rq_status == RQ_INACTIVE) return; INIT_REQUEST; dev = MINOR(CURRENT->rq_dev); block = CURRENT->sector; nsect = CURRENT->nr_sectors; - if (CURRENT == NULL || CURRENT -> sector == -1) + if (QUEUE_EMPTY || CURRENT -> sector == -1) return; if (CURRENT -> cmd != READ) @@ -991,12 +992,13 @@ long err; void __exit exit_gscd(void) { - if ((unregister_blkdev(MAJOR_NR, "gscd" ) == -EINVAL)) + devfs_unregister(devfs_find_handle(NULL, "gscd", 0, 0, 0, DEVFS_SPECIAL_BLK, + 0)); + if ((devfs_unregister_blkdev(MAJOR_NR, "gscd" ) == -EINVAL)) { printk("What's that: can't unregister GoldStar-module\n" ); return; } - release_region (gscd_port,4); printk(KERN_INFO "GoldStar-module released.\n" ); } @@ -1067,12 +1069,14 @@ int result; i++; } - if (register_blkdev(MAJOR_NR, "gscd", &gscd_fops) != 0) + if (devfs_register_blkdev(MAJOR_NR, "gscd", &gscd_fops) != 0) { printk("GSCD: Unable to get major %d for GoldStar CD-ROM\n", MAJOR_NR); return -EIO; } + devfs_register (NULL, "gscd", 0, DEVFS_FL_DEFAULT, MAJOR_NR, 0, + S_IFBLK | S_IRUGO | S_IWUGO, 0, 0, &gscd_fops, NULL); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST); blksize_size[MAJOR_NR] = gscd_blocksizes; diff --git a/drivers/cdrom/mcd.c b/drivers/cdrom/mcd.c index c882ae30a..44cde3738 100644 --- a/drivers/cdrom/mcd.c +++ b/drivers/cdrom/mcd.c @@ -86,6 +86,7 @@ #include <linux/timer.h> #include <linux/fs.h> #include <linux/kernel.h> +#include <linux/devfs_fs_kernel.h> #include <linux/cdrom.h> #include <linux/ioport.h> #include <linux/string.h> @@ -134,7 +135,7 @@ static int mcdPresent = 0; /* #define DOUBLE_QUICK_ONLY */ #define CURRENT_VALID \ -(CURRENT && MAJOR(CURRENT -> rq_dev) == MAJOR_NR && CURRENT -> cmd == READ \ +(!QUEUE_EMPTY && MAJOR(CURRENT -> rq_dev) == MAJOR_NR && CURRENT -> cmd == READ \ && CURRENT -> sector != -1) #define MFL_STATUSorDATA (MFL_STATUS | MFL_DATA) @@ -1156,7 +1157,7 @@ static void cleanup(int level) case 2: release_region(mcd_port,4); case 1: - if (unregister_blkdev(MAJOR_NR, "mcd")) { + if (devfs_unregister_blkdev(MAJOR_NR, "mcd")) { printk(KERN_WARNING "Can't unregister major mcd\n"); return; } @@ -1181,7 +1182,7 @@ int __init mcd_init(void) return -EIO; } - if (register_blkdev(MAJOR_NR, "mcd", &cdrom_fops) != 0) + if (devfs_register_blkdev(MAJOR_NR, "mcd", &cdrom_fops) != 0) { printk("Unable to get major %d for Mitsumi CD-ROM\n", MAJOR_NR); diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c index 32ae52497..805044841 100644 --- a/drivers/cdrom/mcdx.c +++ b/drivers/cdrom/mcdx.c @@ -74,6 +74,7 @@ static const char *mcdx_c_version #include <linux/major.h> #define MAJOR_NR MITSUMI_X_CDROM_MAJOR #include <linux/blk.h> +#include <linux/devfs_fs_kernel.h> /* for compatible parameter passing with "insmod" */ #define mcdx_drive_map mcdx @@ -530,7 +531,7 @@ void do_mcdx_request(request_queue_t * q) again: - if (CURRENT == NULL) { + if (QUEUE_EMPTY) { xtrace(REQUEST, "end_request(0): CURRENT == NULL\n"); return; } @@ -995,7 +996,7 @@ void __exit mcdx_exit(void) for (i = 0; i < MCDX_NDRIVES; i++) { struct s_drive_stuff *stuffp; - if (unregister_cdrom(&mcdx_info)) { + if (unregister_cdrom(&mcdx_info)) { printk(KERN_WARNING "Can't unregister cdrom mcdx\n"); return; } @@ -1012,7 +1013,7 @@ void __exit mcdx_exit(void) kfree(stuffp); } - if (unregister_blkdev(MAJOR_NR, "mcdx") != 0) { + if (devfs_unregister_blkdev(MAJOR_NR, "mcdx") != 0) { xwarn("cleanup() unregister_blkdev() failed\n"); } #if !MCDX_QUIET @@ -1123,7 +1124,7 @@ int __init mcdx_init_drive(int drive) } xtrace(INIT, "init() register blkdev\n"); - if (register_blkdev(MAJOR_NR, "mcdx", &cdrom_fops) != 0) { + if (devfs_register_blkdev(MAJOR_NR, "mcdx", &cdrom_fops) != 0) { xwarn("%s=0x%3p,%d: Init failed. Can't get major %d.\n", MCDX, stuffp->wreg_data, stuffp->irq, MAJOR_NR); @@ -1181,7 +1182,7 @@ int __init mcdx_init_drive(int drive) MCDX_IO_SIZE); free_irq(stuffp->irq, NULL); kfree(stuffp); - if (unregister_blkdev(MAJOR_NR, "mcdx") != 0) + if (devfs_unregister_blkdev(MAJOR_NR, "mcdx") != 0) xwarn("cleanup() unregister_blkdev() failed\n"); return 2; } diff --git a/drivers/cdrom/optcd.c b/drivers/cdrom/optcd.c index b0bdc833a..9a1672037 100644 --- a/drivers/cdrom/optcd.c +++ b/drivers/cdrom/optcd.c @@ -71,6 +71,8 @@ #include <linux/mm.h> #include <linux/ioport.h> #include <linux/init.h> +#include <linux/devfs_fs_kernel.h> + #include <asm/io.h> #define MAJOR_NR OPTICS_CDROM_MAJOR @@ -980,7 +982,7 @@ static int update_toc(void) #define CURRENT_VALID \ - (CURRENT && MAJOR(CURRENT -> rq_dev) == MAJOR_NR \ + (!QUEUE_EMPTY && MAJOR(CURRENT -> rq_dev) == MAJOR_NR \ && CURRENT -> cmd == READ && CURRENT -> sector != -1) @@ -2061,12 +2063,13 @@ int __init optcd_init(void) DEBUG((DEBUG_VFS, "exec_cmd COMINITDOUBLE: %02x", -status)); return -EIO; } - if (register_blkdev(MAJOR_NR, "optcd", &opt_fops) != 0) + if (devfs_register_blkdev(MAJOR_NR, "optcd", &opt_fops) != 0) { printk(KERN_ERR "optcd: unable to get major %d\n", MAJOR_NR); return -EIO; } - + devfs_register (NULL, "optcd", 0, DEVFS_FL_DEFAULT, MAJOR_NR, 0, + S_IFBLK | S_IRUGO | S_IWUGO, 0, 0, &opt_fops, NULL); hardsect_size[MAJOR_NR] = &hsecsize; blksize_size[MAJOR_NR] = &blksize; blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST); @@ -2081,7 +2084,9 @@ int __init optcd_init(void) void __exit optcd_exit(void) { - if (unregister_blkdev(MAJOR_NR, "optcd") == -EINVAL) { + devfs_unregister(devfs_find_handle(NULL, "optcd", 0, 0, 0, + DEVFS_SPECIAL_BLK, 0)); + if (devfs_unregister_blkdev(MAJOR_NR, "optcd") == -EINVAL) { printk(KERN_ERR "optcd: what's that: can't unregister\n"); return; } diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c index 42fa4d62b..4c88dacc2 100644 --- a/drivers/cdrom/sbpcd.c +++ b/drivers/cdrom/sbpcd.c @@ -338,6 +338,7 @@ #include <linux/kernel.h> #include <linux/cdrom.h> #include <linux/ioport.h> +#include <linux/devfs_fs_kernel.h> #include <linux/major.h> #include <linux/string.h> #include <linux/vmalloc.h> @@ -4791,9 +4792,7 @@ static void sbp_transfer(struct request *req) */ #undef DEBUG_GTL static inline void sbpcd_end_request(struct request *req, int uptodate) { - req->next=CURRENT; - CURRENT=req; - up(&ioctl_read_sem); + list_add(&req->queue, &req->q->queue_head); end_request(uptodate); } /*==========================================================================*/ @@ -4815,7 +4814,7 @@ static void DO_SBPCD_REQUEST(request_queue_t * q) #ifdef DEBUG_GTL xnr=++xx_nr; - if(!CURRENT) + if(QUEUE_EMPTY) { printk( "do_sbpcd_request[%di](NULL), Pid:%d, Time:%li\n", xnr, current->pid, jiffies); @@ -4830,15 +4829,15 @@ static void DO_SBPCD_REQUEST(request_queue_t * q) #endif INIT_REQUEST; req=CURRENT; /* take out our request so no other */ - CURRENT=req->next; /* task can fuck it up GTL */ - spin_unlock_irq(&io_request_lock); /* FIXME!!!! */ + blkdev_dequeue_request(req); /* task can fuck it up GTL */ - down(&ioctl_read_sem); if (req->rq_status == RQ_INACTIVE) sbpcd_end_request(req, 0); if (req -> sector == -1) sbpcd_end_request(req, 0); + spin_unlock_irq(&io_request_lock); + down(&ioctl_read_sem); if (req->cmd != READ) { msg(DBG_INF, "bad cmd %d\n", req->cmd); @@ -4875,8 +4874,9 @@ static void DO_SBPCD_REQUEST(request_queue_t * q) printk(" do_sbpcd_request[%do](%p:%ld+%ld) end 2, Time:%li\n", xnr, req, req->sector, req->nr_sectors, jiffies); #endif + up(&ioctl_read_sem); + spin_lock_irq(&io_request_lock); sbpcd_end_request(req, 1); - spin_lock_irq(&io_request_lock); /* FIXME!!!! */ goto request_loop; } @@ -4915,8 +4915,9 @@ static void DO_SBPCD_REQUEST(request_queue_t * q) printk(" do_sbpcd_request[%do](%p:%ld+%ld) end 3, Time:%li\n", xnr, req, req->sector, req->nr_sectors, jiffies); #endif + up(&ioctl_read_sem); + spin_lock_irq(&io_request_lock); sbpcd_end_request(req, 1); - spin_lock_irq(&io_request_lock); /* FIXME!!!! */ goto request_loop; } } @@ -4929,9 +4930,10 @@ static void DO_SBPCD_REQUEST(request_queue_t * q) printk(" do_sbpcd_request[%do](%p:%ld+%ld) end 4 (error), Time:%li\n", xnr, req, req->sector, req->nr_sectors, jiffies); #endif - sbpcd_end_request(req, 0); + up(&ioctl_read_sem); sbp_sleep(0); /* wait a bit, try again */ - spin_lock_irq(&io_request_lock); /* FIXME!!!! */ + spin_lock_irq(&io_request_lock); + sbpcd_end_request(req, 0); goto request_loop; } /*==========================================================================*/ @@ -5583,12 +5585,16 @@ static int __init config_spea(void) * Test for presence of drive and initialize it. * Called once at boot or load time. */ + +static devfs_handle_t devfs_handle = NULL; + #ifdef MODULE int __init __SBPCD_INIT(void) #else int __init SBPCD_INIT(void) #endif MODULE { + char nbuff[16]; int i=0, j=0; int addr[2]={1, CDROM_PORT}; int port_index; @@ -5731,7 +5737,7 @@ int __init SBPCD_INIT(void) OUT(MIXER_data,0xCC); /* one nibble per channel, max. value: 0xFF */ #endif SOUND_BASE - if (register_blkdev(MAJOR_NR, major_name, &cdrom_fops) != 0) + if (devfs_register_blkdev(MAJOR_NR, major_name, &cdrom_fops) != 0) { msg(DBG_INF, "Can't get MAJOR %d for Matsushita CDROM\n", MAJOR_NR); #ifdef MODULE @@ -5741,10 +5747,12 @@ int __init SBPCD_INIT(void) #endif MODULE } blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST); + blk_queue_headactive(BLK_DEFAULT_QUEUE(MAJOR_NR), 0); read_ahead[MAJOR_NR] = buffers * (CD_FRAMESIZE / 512); request_region(CDo_command,4,major_name); + devfs_handle = devfs_mk_dir (NULL, "sbp", 0, NULL); for (j=0;j<NR_SBPCD;j++) { struct cdrom_device_info * sbpcd_infop; @@ -5766,7 +5774,7 @@ int __init SBPCD_INIT(void) if (D_S[j].sbp_buf==NULL) { msg(DBG_INF,"data buffer (%d frames) not available.\n",D_S[j].sbp_bufsiz); - if ((unregister_blkdev(MAJOR_NR, major_name) == -EINVAL)) + if ((devfs_unregister_blkdev(MAJOR_NR, major_name) == -EINVAL)) { printk("Can't unregister %s\n", major_name); } @@ -5793,11 +5801,15 @@ int __init SBPCD_INIT(void) sbpcd_infop->dev = MKDEV(MAJOR_NR, j); strncpy(sbpcd_infop->name,major_name, sizeof(sbpcd_infop->name)); + sprintf (nbuff, "c%dt%d/cd", SBPCD_ISSUE - 1, D_S[j].drv_id); + sbpcd_infop->de = + devfs_register (devfs_handle, nbuff, 0, DEVFS_FL_DEFAULT, + MAJOR_NR, j, S_IFBLK | S_IRUGO | S_IWUGO, + 0, 0, &cdrom_fops, NULL); if (register_cdrom(sbpcd_infop)) { printk(" sbpcd: Unable to register with Uniform CD-ROm driver\n"); } - /* * set the block size */ @@ -5827,13 +5839,14 @@ void sbpcd_exit(void) { int j; - if ((unregister_blkdev(MAJOR_NR, major_name) == -EINVAL)) + if ((devfs_unregister_blkdev(MAJOR_NR, major_name) == -EINVAL)) { msg(DBG_INF, "What's that: can't unregister %s.\n", major_name); return; } release_region(CDo_command,4); + devfs_unregister (devfs_handle); for (j=0;j<NR_SBPCD;j++) { if (D_S[j].drv_id==-1) continue; diff --git a/drivers/cdrom/sjcd.c b/drivers/cdrom/sjcd.c index f13deeac8..5182d415d 100644 --- a/drivers/cdrom/sjcd.c +++ b/drivers/cdrom/sjcd.c @@ -73,6 +73,7 @@ #include <linux/string.h> #include <linux/major.h> #include <linux/init.h> +#include <linux/devfs_fs_kernel.h> #include <asm/system.h> #include <asm/io.h> @@ -938,7 +939,7 @@ static void sjcd_invalidate_buffers( void ){ */ #define CURRENT_IS_VALID \ - ( CURRENT != NULL && MAJOR( CURRENT->rq_dev ) == MAJOR_NR && \ + ( !QUEUE_EMPTY && MAJOR( CURRENT->rq_dev ) == MAJOR_NR && \ CURRENT->cmd == READ && CURRENT->sector != -1 ) static void sjcd_transfer( void ){ @@ -1471,7 +1472,7 @@ int __init sjcd_init( void ){ hardsect_size[MAJOR_NR] = &secsize; blksize_size[MAJOR_NR] = &blksize; - if( register_blkdev( MAJOR_NR, "sjcd", &sjcd_fops ) != 0 ){ + if( devfs_register_blkdev( MAJOR_NR, "sjcd", &sjcd_fops ) != 0 ){ printk( "SJCD: Unable to get major %d for Sanyo CD-ROM\n", MAJOR_NR ); return( -EIO ); } @@ -1563,6 +1564,8 @@ int __init sjcd_init( void ){ } printk(KERN_INFO "SJCD: Status: port=0x%x.\n", sjcd_base); + devfs_register (NULL, "sjcd", 0, DEVFS_FL_DEFAULT, MAJOR_NR, 0, + S_IFBLK | S_IRUGO | S_IWUGO, 0, 0, &sjcd_fops, NULL); sjcd_present++; return( 0 ); @@ -1571,7 +1574,7 @@ int __init sjcd_init( void ){ static int sjcd_cleanup(void) { - if( (unregister_blkdev(MAJOR_NR, "sjcd") == -EINVAL) ) + if( (devfs_unregister_blkdev(MAJOR_NR, "sjcd") == -EINVAL) ) printk( "SJCD: cannot unregister device.\n" ); else release_region( sjcd_base, 4 ); @@ -1582,6 +1585,8 @@ sjcd_cleanup(void) void __exit sjcd_exit(void) { + devfs_unregister(devfs_find_handle(NULL, "sjcd", 0, 0, 0, DEVFS_SPECIAL_BLK, + 0)); if ( sjcd_cleanup() ) printk( "SJCD: module: cannot be removed.\n" ); else diff --git a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c index a9b82571e..1f5fea7b9 100644 --- a/drivers/cdrom/sonycd535.c +++ b/drivers/cdrom/sonycd535.c @@ -124,6 +124,7 @@ #include <linux/mm.h> #include <linux/malloc.h> #include <linux/init.h> +#include <linux/devfs_fs_kernel.h> #define REALLY_SLOW_IO #include <asm/system.h> @@ -803,7 +804,7 @@ do_cdu535_request(request_queue_t * q) * The beginning here is stolen from the hard disk driver. I hope * it's right. */ - if (!(CURRENT) || CURRENT->rq_status == RQ_INACTIVE) { + if (QUEUE_EMPTY || CURRENT->rq_status == RQ_INACTIVE) { return; } INIT_REQUEST; @@ -1586,7 +1587,12 @@ sony535_init(void) printk("IRQ%d, ", tmp_irq); printk("using %d byte buffer\n", sony_buffer_size); - if (register_blkdev(MAJOR_NR, CDU535_HANDLE, &cdu_fops)) { + devfs_register (NULL, CDU535_HANDLE, 0, + DEVFS_FL_DEFAULT, + MAJOR_NR, 0, + S_IFBLK | S_IRUGO | S_IWUGO, + 0, 0, &cdu_fops, NULL); + if (devfs_register_blkdev(MAJOR_NR, CDU535_HANDLE, &cdu_fops)) { printk("Unable to get major %d for %s\n", MAJOR_NR, CDU535_MESSAGE_NAME); return -EIO; @@ -1684,7 +1690,9 @@ sony535_exit(void) kfree_s(sony_buffer, 4 * sony_buffer_sectors); kfree_s(last_sony_subcode, sizeof *last_sony_subcode); kfree_s(sony_toc, sizeof *sony_toc); - if (unregister_blkdev(MAJOR_NR, CDU535_HANDLE) == -EINVAL) + devfs_unregister(devfs_find_handle(NULL, CDU535_HANDLE, 0, 0, 0, + DEVFS_SPECIAL_BLK, 0)); + if (devfs_unregister_blkdev(MAJOR_NR, CDU535_HANDLE) == -EINVAL) printk("Uh oh, couldn't unregister " CDU535_HANDLE "\n"); else printk(KERN_INFO CDU535_HANDLE " module released\n"); |