Commit 61320eeb authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] aztcd.c

	* switched to private queue
	* set ->queue
	* switched to new methods
parent bee3b2c5
...@@ -168,8 +168,7 @@ ...@@ -168,8 +168,7 @@
#include <linux/version.h> #include <linux/version.h>
#define MAJOR_NR AZTECH_CDROM_MAJOR #define MAJOR_NR AZTECH_CDROM_MAJOR
#define DEVICE_NR(device) (minor(device)) #define QUEUE (&azt_queue)
#include <linux/blk.h> #include <linux/blk.h>
#include "aztcd.h" #include "aztcd.h"
...@@ -227,10 +226,11 @@ ...@@ -227,10 +226,11 @@
#define AZT_DEBUG_MULTISESSION #define AZT_DEBUG_MULTISESSION
#endif #endif
static struct request_queue azt_queue;
static int current_valid(void) static int current_valid(void)
{ {
return !blk_queue_empty(QUEUE) && return !blk_queue_empty(QUEUE) &&
major(CURRENT->rq_dev) == MAJOR_NR &&
CURRENT->cmd == READ && CURRENT->cmd == READ &&
CURRENT->sector != -1; CURRENT->sector != -1;
} }
...@@ -329,18 +329,18 @@ static int aztGetMultiDiskInfo(void); ...@@ -329,18 +329,18 @@ static int aztGetMultiDiskInfo(void);
static int aztGetToc(int multi); static int aztGetToc(int multi);
/* Kernel Interface Functions */ /* Kernel Interface Functions */
static int check_aztcd_media_change(kdev_t full_dev); static int check_aztcd_media_change(struct gendisk *disk);
static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
unsigned long arg); unsigned long arg);
static int aztcd_open(struct inode *ip, struct file *fp); static int aztcd_open(struct inode *ip, struct file *fp);
static int aztcd_release(struct inode *inode, struct file *file); static int aztcd_release(struct inode *inode, struct file *file);
static struct block_device_operations azt_fops = { static struct block_device_operations azt_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = aztcd_open, .open = aztcd_open,
.release = aztcd_release, .release = aztcd_release,
.ioctl = aztcd_ioctl, .ioctl = aztcd_ioctl,
.check_media_change = check_aztcd_media_change, .media_changed = check_aztcd_media_change,
}; };
/* Aztcd State Machine: Controls Drive Operating State */ /* Aztcd State Machine: Controls Drive Operating State */
...@@ -790,7 +790,7 @@ static int aztGetQChannelInfo(struct azt_Toc *qp) ...@@ -790,7 +790,7 @@ static int aztGetQChannelInfo(struct azt_Toc *qp)
/* /*
* Read the table of contents (TOC) and TOC header if necessary * Read the table of contents (TOC) and TOC header if necessary
*/ */
static int aztUpdateToc() static int aztUpdateToc(void)
{ {
int st; int st;
...@@ -1141,7 +1141,7 @@ __setup("aztcd=", aztcd_setup); ...@@ -1141,7 +1141,7 @@ __setup("aztcd=", aztcd_setup);
/* /*
* Checking if the media has been changed * Checking if the media has been changed
*/ */
static int check_aztcd_media_change(kdev_t full_dev) static int check_aztcd_media_change(struct gendisk *disk)
{ {
if (aztDiskChanged) { /* disk changed */ if (aztDiskChanged) { /* disk changed */
aztDiskChanged = 0; aztDiskChanged = 0;
...@@ -1677,8 +1677,8 @@ static int aztcd_release(struct inode *inode, struct file *file) ...@@ -1677,8 +1677,8 @@ static int aztcd_release(struct inode *inode, struct file *file)
{ {
#ifdef AZT_DEBUG #ifdef AZT_DEBUG
printk("aztcd: executing aztcd_release\n"); printk("aztcd: executing aztcd_release\n");
printk("inode: %p, inode->i_rdev: %x file: %p\n", inode, printk("inode: %p, device: %s file: %p\n", inode,
inode->i_rdev, file); inode->i_bdev->bd_disk->disk_name, file);
#endif #endif
if (!--azt_open_count) { if (!--azt_open_count) {
azt_invalidate_buffers(); azt_invalidate_buffers();
...@@ -1917,12 +1917,13 @@ static int __init aztcd_init(void) ...@@ -1917,12 +1917,13 @@ static int __init aztcd_init(void)
ret = -EIO; ret = -EIO;
goto err_out3; goto err_out3;
} }
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_aztcd_request, &aztSpin); blk_init_queue(&azt_queue, do_aztcd_request, &aztSpin);
blk_queue_hardsect_size(BLK_DEFAULT_QUEUE(MAJOR_NR), 2048); blk_queue_hardsect_size(&azt_queue, 2048);
azt_disk->major = MAJOR_NR; azt_disk->major = MAJOR_NR;
azt_disk->first_minor = 0; azt_disk->first_minor = 0;
azt_disk->fops = &azt_fops; azt_disk->fops = &azt_fops;
sprintf(azt_disk->disk_name, "aztcd"); sprintf(azt_disk->disk_name, "aztcd");
azt_disk->queue = &azt_queue;
add_disk(azt_disk); add_disk(azt_disk);
azt_invalidate_buffers(); azt_invalidate_buffers();
...@@ -1952,7 +1953,7 @@ static void __exit aztcd_exit(void) ...@@ -1952,7 +1953,7 @@ static void __exit aztcd_exit(void)
printk("What's that: can't unregister aztcd\n"); printk("What's that: can't unregister aztcd\n");
return; return;
} }
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR)); blk_cleanup_queue(&azt_queue);
if ((azt_port == 0x1f0) || (azt_port == 0x170)) { if ((azt_port == 0x1f0) || (azt_port == 0x170)) {
SWITCH_IDE_MASTER; SWITCH_IDE_MASTER;
release_region(azt_port, 8); /*IDE-interface */ release_region(azt_port, 8); /*IDE-interface */
......
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