Commit c2ffec65 authored by Dave Jones's avatar Dave Jones Committed by Jaroslav Kysela

[PATCH] get rid of some blk.h cruft

Originally by Christoph Hellwig back in February.
It recieved no objections when posted to l-k & Jens.

o remove DEVICE_REQUEST definitions - never used in blk.h itself.
o remove DEVICE_ON() - never used at all.
o define LOCAL_END_REQUEST when we do not want end_request() instead
  of other hacks.
o remove DEVICE_OFF() - only used in floppy driver, thus one now has
  a private end_request().
o use private end_request() functions for drivers not providing
  randomness.
o remove TIMEOUT_VALUE - only ever used in hd.c
parent 5fa563b1
...@@ -373,6 +373,7 @@ static int fd_test_drive_present(int drive); ...@@ -373,6 +373,7 @@ static int fd_test_drive_present(int drive);
static void config_types(void); static void config_types(void);
static int floppy_open(struct inode *inode, struct file *filp); static int floppy_open(struct inode *inode, struct file *filp);
static int floppy_release(struct inode *inode, struct file *filp); static int floppy_release(struct inode *inode, struct file *filp);
static void do_fd_request(request_queue_t *);
/************************* End of Prototypes **************************/ /************************* End of Prototypes **************************/
...@@ -1302,7 +1303,7 @@ static void fd1772_checkint(void) ...@@ -1302,7 +1303,7 @@ static void fd1772_checkint(void)
} }
} }
void do_fd_request(request_queue_t* q) static void do_fd_request(request_queue_t* q)
{ {
unsigned long flags; unsigned long flags;
...@@ -1614,7 +1615,7 @@ int fd1772_init(void) ...@@ -1614,7 +1615,7 @@ int fd1772_init(void)
blk_size[MAJOR_NR] = floppy_sizes; blk_size[MAJOR_NR] = floppy_sizes;
blksize_size[MAJOR_NR] = floppy_blocksizes; blksize_size[MAJOR_NR] = floppy_blocksizes;
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_fd_request);
config_types(); config_types();
......
...@@ -1427,7 +1427,7 @@ int mfm_init (void) ...@@ -1427,7 +1427,7 @@ int mfm_init (void)
hdc63463_irqpolladdress = mfm_IRQPollLoc; hdc63463_irqpolladdress = mfm_IRQPollLoc;
hdc63463_irqpollmask = irqmask; hdc63463_irqpollmask = irqmask;
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_mfm_request);
add_gendisk(&mfm_gendisk); add_gendisk(&mfm_gendisk);
......
...@@ -1784,7 +1784,7 @@ int acsi_init( void ) ...@@ -1784,7 +1784,7 @@ int acsi_init( void )
phys_acsi_buffer = virt_to_phys( acsi_buffer ); phys_acsi_buffer = virt_to_phys( acsi_buffer );
STramMask = ATARIHW_PRESENT(EXTD_DMA) ? 0x00000000 : 0xff000000; STramMask = ATARIHW_PRESENT(EXTD_DMA) ? 0x00000000 : 0xff000000;
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &acsi_lock); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_acsi_request, &acsi_lock);
add_gendisk(&acsi_gendisk); add_gendisk(&acsi_gendisk);
#ifdef CONFIG_ATARI_SLM #ifdef CONFIG_ATARI_SLM
......
...@@ -1857,7 +1857,7 @@ int __init amiga_floppy_init(void) ...@@ -1857,7 +1857,7 @@ int __init amiga_floppy_init(void)
post_write_timer.data = 0; post_write_timer.data = 0;
post_write_timer.function = post_write; post_write_timer.function = post_write;
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &amiflop_lock); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_fd_request, &amiflop_lock);
blksize_size[MAJOR_NR] = floppy_blocksizes; blksize_size[MAJOR_NR] = floppy_blocksizes;
blk_size[MAJOR_NR] = floppy_sizes; blk_size[MAJOR_NR] = floppy_sizes;
......
...@@ -2013,7 +2013,7 @@ int __init atari_floppy_init (void) ...@@ -2013,7 +2013,7 @@ int __init atari_floppy_init (void)
blk_size[MAJOR_NR] = floppy_sizes; blk_size[MAJOR_NR] = floppy_sizes;
blksize_size[MAJOR_NR] = floppy_blocksizes; blksize_size[MAJOR_NR] = floppy_blocksizes;
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &ataflop_lock); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_fd_request, &ataflop_lock);
printk(KERN_INFO "Atari floppy driver: max. %cD, %strack buffering\n", printk(KERN_INFO "Atari floppy driver: max. %cD, %strack buffering\n",
DriveType == 0 ? 'D' : DriveType == 1 ? 'H' : 'E', DriveType == 0 ? 'D' : DriveType == 1 ? 'H' : 'E',
......
...@@ -52,6 +52,7 @@ MODULE_DESCRIPTION("Driver for Compaq Smart2 Array Controllers"); ...@@ -52,6 +52,7 @@ MODULE_DESCRIPTION("Driver for Compaq Smart2 Array Controllers");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#define MAJOR_NR COMPAQ_SMART2_MAJOR #define MAJOR_NR COMPAQ_SMART2_MAJOR
#define LOCAL_END_REQUEST
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/genhd.h> #include <linux/genhd.h>
......
...@@ -230,6 +230,7 @@ static int allowed_drive_mask = 0x33; ...@@ -230,6 +230,7 @@ static int allowed_drive_mask = 0x33;
static int irqdma_allocated; static int irqdma_allocated;
#define LOCAL_END_REQUEST
#define MAJOR_NR FLOPPY_MAJOR #define MAJOR_NR FLOPPY_MAJOR
#include <linux/blk.h> #include <linux/blk.h>
...@@ -2274,17 +2275,32 @@ static int do_format(kdev_t device, struct format_descr *tmp_format_req) ...@@ -2274,17 +2275,32 @@ static int do_format(kdev_t device, struct format_descr *tmp_format_req)
* ============================= * =============================
*/ */
static inline void end_request(struct request *req, int uptodate)
{
kdev_t dev = req->rq_dev;
if (end_that_request_first(req, uptodate, req->hard_cur_sectors))
return;
add_blkdev_randomness(major(dev));
floppy_off(DEVICE_NR(dev));
blkdev_dequeue_request(req);
end_that_request_last(req);
}
/* new request_done. Can handle physical sectors which are smaller than a /* new request_done. Can handle physical sectors which are smaller than a
* logical buffer */ * logical buffer */
static void request_done(int uptodate) static void request_done(int uptodate)
{ {
struct request_queue *q = QUEUE;
struct request *req = elv_next_request(q);
unsigned long flags; unsigned long flags;
int block; int block;
probing = 0; probing = 0;
reschedule_timeout(MAXTIMEOUT, "request done %d", uptodate); reschedule_timeout(MAXTIMEOUT, "request done %d", uptodate);
if (QUEUE_EMPTY){ if (blk_queue_empty(q)) {
DPRINT("request list destroyed in floppy request done\n"); DPRINT("request list destroyed in floppy request done\n");
return; return;
} }
...@@ -2292,48 +2308,48 @@ static void request_done(int uptodate) ...@@ -2292,48 +2308,48 @@ static void request_done(int uptodate)
if (uptodate){ if (uptodate){
/* maintain values for invalidation on geometry /* maintain values for invalidation on geometry
* change */ * change */
block = current_count_sectors + CURRENT->sector; block = current_count_sectors + req->sector;
INFBOUND(DRS->maxblock, block); INFBOUND(DRS->maxblock, block);
if (block > _floppy->sect) if (block > _floppy->sect)
DRS->maxtrack = 1; DRS->maxtrack = 1;
/* unlock chained buffers */ /* unlock chained buffers */
spin_lock_irqsave(QUEUE->queue_lock, flags); spin_lock_irqsave(q->queue_lock, flags);
while (current_count_sectors && !QUEUE_EMPTY && while (current_count_sectors && !blk_queue_empty(q) &&
current_count_sectors >= CURRENT->current_nr_sectors){ current_count_sectors >= req->current_nr_sectors){
current_count_sectors -= CURRENT->current_nr_sectors; current_count_sectors -= req->current_nr_sectors;
CURRENT->nr_sectors -= CURRENT->current_nr_sectors; req->nr_sectors -= req->current_nr_sectors;
CURRENT->sector += CURRENT->current_nr_sectors; req->sector += req->current_nr_sectors;
end_request(1); end_request(req, 1);
} }
spin_unlock_irqrestore(QUEUE->queue_lock, flags); spin_unlock_irqrestore(q->queue_lock, flags);
if (current_count_sectors && !QUEUE_EMPTY){ if (current_count_sectors && !blk_queue_empty(q)) {
/* "unlock" last subsector */ /* "unlock" last subsector */
CURRENT->buffer += current_count_sectors <<9; req->buffer += current_count_sectors <<9;
CURRENT->current_nr_sectors -= current_count_sectors; req->current_nr_sectors -= current_count_sectors;
CURRENT->nr_sectors -= current_count_sectors; req->nr_sectors -= current_count_sectors;
CURRENT->sector += current_count_sectors; req->sector += current_count_sectors;
return; return;
} }
if (current_count_sectors && QUEUE_EMPTY) if (current_count_sectors && blk_queue_empty(q))
DPRINT("request list destroyed in floppy request done\n"); DPRINT("request list destroyed in floppy request done\n");
} else { } else {
if (rq_data_dir(CURRENT) == WRITE) { if (rq_data_dir(req) == WRITE) {
/* record write error information */ /* record write error information */
DRWE->write_errors++; DRWE->write_errors++;
if (DRWE->write_errors == 1) { if (DRWE->write_errors == 1) {
DRWE->first_error_sector = CURRENT->sector; DRWE->first_error_sector = req->sector;
DRWE->first_error_generation = DRS->generation; DRWE->first_error_generation = DRS->generation;
} }
DRWE->last_error_sector = CURRENT->sector; DRWE->last_error_sector = req->sector;
DRWE->last_error_generation = DRS->generation; DRWE->last_error_generation = DRS->generation;
} }
spin_lock_irqsave(QUEUE->queue_lock, flags); spin_lock_irqsave(q->queue_lock, flags);
end_request(0); end_request(req, 0);
spin_unlock_irqrestore(QUEUE->queue_lock, flags); spin_unlock_irqrestore(q->queue_lock, flags);
} }
} }
...@@ -4168,7 +4184,7 @@ int __init floppy_init(void) ...@@ -4168,7 +4184,7 @@ int __init floppy_init(void)
blk_size[MAJOR_NR] = floppy_sizes; blk_size[MAJOR_NR] = floppy_sizes;
blksize_size[MAJOR_NR] = floppy_blocksizes; blksize_size[MAJOR_NR] = floppy_blocksizes;
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &floppy_lock); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_fd_request, &floppy_lock);
reschedule_timeout(MAXTIMEOUT, "floppy init", MAXTIMEOUT); reschedule_timeout(MAXTIMEOUT, "floppy init", MAXTIMEOUT);
config_types(); config_types();
......
...@@ -181,9 +181,7 @@ MODULE_PARM(drive3,"1-6i"); ...@@ -181,9 +181,7 @@ MODULE_PARM(drive3,"1-6i");
#define MAJOR_NR major #define MAJOR_NR major
#define DEVICE_NAME "PCD" #define DEVICE_NAME "PCD"
#define DEVICE_REQUEST do_pcd_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#define DEVICE_ON(device)
#define DEVICE_OFF(device) #define DEVICE_OFF(device)
#include <linux/blk.h> #include <linux/blk.h>
...@@ -357,7 +355,7 @@ int pcd_init (void) /* preliminary initialisation */ ...@@ -357,7 +355,7 @@ int pcd_init (void) /* preliminary initialisation */
} }
} }
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &pcd_lock); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_pcd_request, &pcd_lock);
for (i=0;i<PCD_UNITS;i++) pcd_blocksizes[i] = 1024; for (i=0;i<PCD_UNITS;i++) pcd_blocksizes[i] = 1024;
blksize_size[MAJOR_NR] = pcd_blocksizes; blksize_size[MAJOR_NR] = pcd_blocksizes;
......
...@@ -205,9 +205,7 @@ MODULE_PARM(drive3,"1-8i"); ...@@ -205,9 +205,7 @@ MODULE_PARM(drive3,"1-8i");
#define MAJOR_NR major #define MAJOR_NR major
#define DEVICE_NAME "PD" #define DEVICE_NAME "PD"
#define DEVICE_REQUEST do_pd_request
#define DEVICE_NR(device) (minor(device)>>PD_BITS) #define DEVICE_NR(device) (minor(device)>>PD_BITS)
#define DEVICE_ON(device)
#define DEVICE_OFF(device) #define DEVICE_OFF(device)
#include <linux/blk.h> #include <linux/blk.h>
...@@ -395,7 +393,7 @@ int pd_init (void) ...@@ -395,7 +393,7 @@ int pd_init (void)
return -1; return -1;
} }
q = BLK_DEFAULT_QUEUE(MAJOR_NR); q = BLK_DEFAULT_QUEUE(MAJOR_NR);
blk_init_queue(q, DEVICE_REQUEST, &pd_lock); blk_init_queue(q, do_pd_request, &pd_lock);
blk_queue_max_sectors(q, cluster); blk_queue_max_sectors(q, cluster);
pd_gendisk.major = major; pd_gendisk.major = major;
......
...@@ -201,9 +201,7 @@ MODULE_PARM(drive3,"1-7i"); ...@@ -201,9 +201,7 @@ MODULE_PARM(drive3,"1-7i");
#define MAJOR_NR major #define MAJOR_NR major
#define DEVICE_NAME "PF" #define DEVICE_NAME "PF"
#define DEVICE_REQUEST do_pf_request
#define DEVICE_NR(device) minor(device) #define DEVICE_NR(device) minor(device)
#define DEVICE_ON(device)
#define DEVICE_OFF(device) #define DEVICE_OFF(device)
#include <linux/blk.h> #include <linux/blk.h>
...@@ -360,7 +358,7 @@ int pf_init (void) /* preliminary initialisation */ ...@@ -360,7 +358,7 @@ int pf_init (void) /* preliminary initialisation */
return -1; return -1;
} }
q = BLK_DEFAULT_QUEUE(MAJOR_NR); q = BLK_DEFAULT_QUEUE(MAJOR_NR);
blk_init_queue(q, DEVICE_REQUEST, &pf_spin_lock); blk_init_queue(q, do_pf_request, &pf_spin_lock);
blk_queue_max_phys_segments(q, cluster); blk_queue_max_phys_segments(q, cluster);
blk_queue_max_hw_segments(q, cluster); blk_queue_max_hw_segments(q, cluster);
......
...@@ -176,7 +176,8 @@ int __init ps2esdi_init(void) ...@@ -176,7 +176,8 @@ int __init ps2esdi_init(void)
return -1; return -1;
} }
/* set up some global information - indicating device specific info */ /* set up some global information - indicating device specific info */
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &ps2esdi_lock); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_ps2esdi_request,
&ps2esdi_lock);
/* some minor housekeeping - setup the global gendisk structure */ /* some minor housekeeping - setup the global gendisk structure */
add_gendisk(&ps2esdi_gendisk); add_gendisk(&ps2esdi_gendisk);
......
...@@ -1032,7 +1032,8 @@ int swim3_init(void) ...@@ -1032,7 +1032,8 @@ int swim3_init(void)
MAJOR_NR); MAJOR_NR);
return -EBUSY; return -EBUSY;
} }
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,&swim3_lock); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_fd_request,
&swim3_lock);
blksize_size[MAJOR_NR] = floppy_blocksizes; blksize_size[MAJOR_NR] = floppy_blocksizes;
blk_size[MAJOR_NR] = floppy_sizes; blk_size[MAJOR_NR] = floppy_sizes;
} }
......
...@@ -149,7 +149,8 @@ int swimiop_init(void) ...@@ -149,7 +149,8 @@ int swimiop_init(void)
MAJOR_NR); MAJOR_NR);
return -EBUSY; return -EBUSY;
} }
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &swim_iop_lock); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_fd_request,
&swim_iop_lock);
blksize_size[MAJOR_NR] = floppy_blocksizes; blksize_size[MAJOR_NR] = floppy_blocksizes;
blk_size[MAJOR_NR] = floppy_sizes; blk_size[MAJOR_NR] = floppy_sizes;
......
...@@ -170,7 +170,7 @@ int __init xd_init (void) ...@@ -170,7 +170,7 @@ int __init xd_init (void)
return -1; return -1;
} }
devfs_handle = devfs_mk_dir (NULL, xd_gendisk.major_name, NULL); devfs_handle = devfs_mk_dir (NULL, xd_gendisk.major_name, NULL);
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &xd_lock); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_xd_request, &xd_lock);
add_gendisk(&xd_gendisk); add_gendisk(&xd_gendisk);
xd_geninit(); xd_geninit();
......
...@@ -1925,7 +1925,7 @@ int __init aztcd_init(void) ...@@ -1925,7 +1925,7 @@ int __init aztcd_init(void)
MAJOR_NR); MAJOR_NR);
return -EIO; return -EIO;
} }
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &aztSpin); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_aztcd_request, &aztSpin);
blksize_size[MAJOR_NR] = aztcd_blocksizes; blksize_size[MAJOR_NR] = aztcd_blocksizes;
register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &azt_fops, 0); register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &azt_fops, 0);
......
...@@ -3440,7 +3440,7 @@ int __init cdu31a_init(void) ...@@ -3440,7 +3440,7 @@ int __init cdu31a_init(void)
strcmp("CD-ROM CDU31A", drive_config.product_id) == 0; strcmp("CD-ROM CDU31A", drive_config.product_id) == 0;
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR),
DEVICE_REQUEST, do_cdu31a_request,
&cdu31a_lock); &cdu31a_lock);
cdu31a_block_size = 1024; /* 1kB default block size */ cdu31a_block_size = 1024; /* 1kB default block size */
/* use 'mount -o block=2048' */ /* use 'mount -o block=2048' */
......
...@@ -1500,7 +1500,7 @@ int __init cm206_init(void) ...@@ -1500,7 +1500,7 @@ int __init cm206_init(void)
return -EIO; return -EIO;
} }
devfs_plain_cdrom(&cm206_info, &cm206_bdops); devfs_plain_cdrom(&cm206_info, &cm206_bdops);
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_cm206_request,
&cm206_lock); &cm206_lock);
blksize_size[MAJOR_NR] = cm206_blocksizes; blksize_size[MAJOR_NR] = cm206_blocksizes;
init_bh(CM206_BH, cm206_bh); init_bh(CM206_BH, cm206_bh);
......
...@@ -1020,7 +1020,7 @@ int __init my_gscd_init(void) ...@@ -1020,7 +1020,7 @@ int __init my_gscd_init(void)
devfs_register(NULL, "gscd", DEVFS_FL_DEFAULT, MAJOR_NR, 0, devfs_register(NULL, "gscd", DEVFS_FL_DEFAULT, MAJOR_NR, 0,
S_IFBLK | S_IRUGO | S_IWUGO, &gscd_fops, NULL); S_IFBLK | S_IRUGO | S_IWUGO, &gscd_fops, NULL);
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &gscd_lock); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_gscd_request, &gscd_lock);
blksize_size[MAJOR_NR] = gscd_blocksizes; blksize_size[MAJOR_NR] = gscd_blocksizes;
disk_state = 0; disk_state = 0;
......
...@@ -1073,7 +1073,7 @@ int __init mcd_init(void) ...@@ -1073,7 +1073,7 @@ int __init mcd_init(void)
} }
blksize_size[MAJOR_NR] = mcd_blocksizes; blksize_size[MAJOR_NR] = mcd_blocksizes;
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_mcd_request,
&mcd_spinlock); &mcd_spinlock);
/* check for card */ /* check for card */
......
...@@ -1182,7 +1182,7 @@ int __init mcdx_init_drive(int drive) ...@@ -1182,7 +1182,7 @@ int __init mcdx_init_drive(int drive)
return 1; return 1;
} }
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_mcdx_request,
&mcdx_lock); &mcdx_lock);
blksize_size[MAJOR_NR] = mcdx_blocksizes; blksize_size[MAJOR_NR] = mcdx_blocksizes;
......
...@@ -2060,7 +2060,7 @@ int __init optcd_init(void) ...@@ -2060,7 +2060,7 @@ int __init optcd_init(void)
devfs_register (NULL, "optcd", DEVFS_FL_DEFAULT, MAJOR_NR, 0, devfs_register (NULL, "optcd", DEVFS_FL_DEFAULT, MAJOR_NR, 0,
S_IFBLK | S_IRUGO | S_IWUGO, &opt_fops, NULL); S_IFBLK | S_IRUGO | S_IWUGO, &opt_fops, NULL);
blksize_size[MAJOR_NR] = &blksize; blksize_size[MAJOR_NR] = &blksize;
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_optcd_request,
&optcd_lock); &optcd_lock);
request_region(optcd_port, 4, "optcd"); request_region(optcd_port, 4, "optcd");
register_disk(NULL, mk_kdev(MAJOR_NR,0), 1, &opt_fops, 0); register_disk(NULL, mk_kdev(MAJOR_NR,0), 1, &opt_fops, 0);
......
...@@ -5858,7 +5858,7 @@ int __init SBPCD_INIT(void) ...@@ -5858,7 +5858,7 @@ int __init SBPCD_INIT(void)
goto init_done; goto init_done;
#endif /* MODULE */ #endif /* MODULE */
} }
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DO_SBPCD_REQUEST, &sbpcd_lock);
#ifdef DONT_MERGE_REQUESTS #ifdef DONT_MERGE_REQUESTS
(BLK_DEFAULT_QUEUE(MAJOR_NR))->back_merge_fn = dont_bh_merge_fn; (BLK_DEFAULT_QUEUE(MAJOR_NR))->back_merge_fn = dont_bh_merge_fn;
(BLK_DEFAULT_QUEUE(MAJOR_NR))->front_merge_fn = dont_bh_merge_fn; (BLK_DEFAULT_QUEUE(MAJOR_NR))->front_merge_fn = dont_bh_merge_fn;
......
...@@ -1694,7 +1694,7 @@ int __init sjcd_init(void) ...@@ -1694,7 +1694,7 @@ int __init sjcd_init(void)
return (-EIO); return (-EIO);
} }
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST,&sjcd_lock); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_sjcd_request, &sjcd_lock);
register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &sjcd_fops, 0); register_disk(NULL, mk_kdev(MAJOR_NR, 0), 1, &sjcd_fops, 0);
if (check_region(sjcd_base, 4)) { if (check_region(sjcd_base, 4)) {
......
...@@ -1596,7 +1596,9 @@ sony535_init(void) ...@@ -1596,7 +1596,9 @@ sony535_init(void)
MAJOR_NR, CDU535_MESSAGE_NAME); MAJOR_NR, CDU535_MESSAGE_NAME);
return -EIO; return -EIO;
} }
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST, &sonycd535_lock); blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR),
do_cdu535_request,
&sonycd535_lock);
blksize_size[MAJOR_NR] = &sonycd535_block_size; blksize_size[MAJOR_NR] = &sonycd535_block_size;
sony_toc = (struct s535_sony_toc *) sony_toc = (struct s535_sony_toc *)
......
...@@ -95,8 +95,6 @@ MODULE_PARM(shuffle_freq, "i"); ...@@ -95,8 +95,6 @@ MODULE_PARM(shuffle_freq, "i");
/* Funky stuff for setting up a block device */ /* Funky stuff for setting up a block device */
#define MAJOR_NR FTL_MAJOR #define MAJOR_NR FTL_MAJOR
#define DEVICE_NAME "ftl" #define DEVICE_NAME "ftl"
#define DEVICE_REQUEST do_ftl_request
#define DEVICE_ON(device)
#define DEVICE_OFF(device) #define DEVICE_OFF(device)
#define DEVICE_NR(minor) ((minor)>>5) #define DEVICE_NR(minor) ((minor)>>5)
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
/* NFTL block device stuff */ /* NFTL block device stuff */
#define MAJOR_NR NFTL_MAJOR #define MAJOR_NR NFTL_MAJOR
#define DEVICE_REQUEST nftl_request
#define DEVICE_OFF(device) #define DEVICE_OFF(device)
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#define MAJOR_NR SCSI_CDROM_MAJOR #define MAJOR_NR SCSI_CDROM_MAJOR
#define LOCAL_END_REQUEST
#include <linux/blk.h> #include <linux/blk.h>
#include "scsi.h" #include "scsi.h"
#include "hosts.h" #include "hosts.h"
......
...@@ -100,9 +100,6 @@ extern inline struct request *elv_next_request(request_queue_t *q) ...@@ -100,9 +100,6 @@ extern inline struct request *elv_next_request(request_queue_t *q)
#if defined(MAJOR_NR) || defined(IDE_DRIVER) #if defined(MAJOR_NR) || defined(IDE_DRIVER)
#undef DEVICE_ON
#undef DEVICE_OFF
/* /*
* Add entries as needed. * Add entries as needed.
*/ */
...@@ -117,13 +114,11 @@ extern inline struct request *elv_next_request(request_queue_t *q) ...@@ -117,13 +114,11 @@ extern inline struct request *elv_next_request(request_queue_t *q)
/* ram disk */ /* ram disk */
#define DEVICE_NAME "ramdisk" #define DEVICE_NAME "ramdisk"
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#define DEVICE_NO_RANDOM
#elif (MAJOR_NR == Z2RAM_MAJOR) #elif (MAJOR_NR == Z2RAM_MAJOR)
/* Zorro II Ram */ /* Zorro II Ram */
#define DEVICE_NAME "Z2RAM" #define DEVICE_NAME "Z2RAM"
#define DEVICE_REQUEST do_z2_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == FLOPPY_MAJOR) #elif (MAJOR_NR == FLOPPY_MAJOR)
...@@ -132,30 +127,24 @@ static void floppy_off(unsigned int nr); ...@@ -132,30 +127,24 @@ static void floppy_off(unsigned int nr);
#define DEVICE_NAME "floppy" #define DEVICE_NAME "floppy"
#define DEVICE_INTR do_floppy #define DEVICE_INTR do_floppy
#define DEVICE_REQUEST do_fd_request
#define DEVICE_NR(device) ( (minor(device) & 3) | ((minor(device) & 0x80 ) >> 5 )) #define DEVICE_NR(device) ( (minor(device) & 3) | ((minor(device) & 0x80 ) >> 5 ))
#define DEVICE_OFF(device) floppy_off(DEVICE_NR(device))
#elif (MAJOR_NR == HD_MAJOR) #elif (MAJOR_NR == HD_MAJOR)
/* Hard disk: timeout is 6 seconds. */ /* Hard disk: timeout is 6 seconds. */
#define DEVICE_NAME "hard disk" #define DEVICE_NAME "hard disk"
#define DEVICE_INTR do_hd #define DEVICE_INTR do_hd
#define TIMEOUT_VALUE (6*HZ)
#define DEVICE_REQUEST do_hd_request
#define DEVICE_NR(device) (minor(device)>>6) #define DEVICE_NR(device) (minor(device)>>6)
#elif (SCSI_DISK_MAJOR(MAJOR_NR)) #elif (SCSI_DISK_MAJOR(MAJOR_NR))
#define DEVICE_NAME "scsidisk" #define DEVICE_NAME "scsidisk"
#define TIMEOUT_VALUE (2*HZ)
#define DEVICE_NR(device) (((major(device) & SD_MAJOR_MASK) << (8 - 4)) + (minor(device) >> 4)) #define DEVICE_NR(device) (((major(device) & SD_MAJOR_MASK) << (8 - 4)) + (minor(device) >> 4))
/* Kludge to use the same number for both char and block major numbers */ /* Kludge to use the same number for both char and block major numbers */
#elif (MAJOR_NR == MD_MAJOR) && defined(MD_DRIVER) #elif (MAJOR_NR == MD_MAJOR) && defined(MD_DRIVER)
#define DEVICE_NAME "Multiple devices driver" #define DEVICE_NAME "Multiple devices driver"
#define DEVICE_REQUEST do_md_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == SCSI_TAPE_MAJOR) #elif (MAJOR_NR == SCSI_TAPE_MAJOR)
...@@ -169,8 +158,6 @@ static void floppy_off(unsigned int nr); ...@@ -169,8 +158,6 @@ static void floppy_off(unsigned int nr);
#define DEVICE_NAME "onstream" #define DEVICE_NAME "onstream"
#define DEVICE_INTR do_osst #define DEVICE_INTR do_osst
#define DEVICE_NR(device) (minor(device) & 0x7f) #define DEVICE_NR(device) (minor(device) & 0x7f)
#define DEVICE_ON(device)
#define DEVICE_OFF(device)
#elif (MAJOR_NR == SCSI_CDROM_MAJOR) #elif (MAJOR_NR == SCSI_CDROM_MAJOR)
...@@ -180,163 +167,129 @@ static void floppy_off(unsigned int nr); ...@@ -180,163 +167,129 @@ static void floppy_off(unsigned int nr);
#elif (MAJOR_NR == XT_DISK_MAJOR) #elif (MAJOR_NR == XT_DISK_MAJOR)
#define DEVICE_NAME "xt disk" #define DEVICE_NAME "xt disk"
#define DEVICE_REQUEST do_xd_request
#define DEVICE_NR(device) (minor(device) >> 6) #define DEVICE_NR(device) (minor(device) >> 6)
#elif (MAJOR_NR == PS2ESDI_MAJOR) #elif (MAJOR_NR == PS2ESDI_MAJOR)
#define DEVICE_NAME "PS/2 ESDI" #define DEVICE_NAME "PS/2 ESDI"
#define DEVICE_REQUEST do_ps2esdi_request
#define DEVICE_NR(device) (minor(device) >> 6) #define DEVICE_NR(device) (minor(device) >> 6)
#elif (MAJOR_NR == CDU31A_CDROM_MAJOR) #elif (MAJOR_NR == CDU31A_CDROM_MAJOR)
#define DEVICE_NAME "CDU31A" #define DEVICE_NAME "CDU31A"
#define DEVICE_REQUEST do_cdu31a_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == ACSI_MAJOR) && (defined(CONFIG_ATARI_ACSI) || defined(CONFIG_ATARI_ACSI_MODULE)) #elif (MAJOR_NR == ACSI_MAJOR) && (defined(CONFIG_ATARI_ACSI) || defined(CONFIG_ATARI_ACSI_MODULE))
#define DEVICE_NAME "ACSI" #define DEVICE_NAME "ACSI"
#define DEVICE_INTR do_acsi #define DEVICE_INTR do_acsi
#define DEVICE_REQUEST do_acsi_request
#define DEVICE_NR(device) (minor(device) >> 4) #define DEVICE_NR(device) (minor(device) >> 4)
#elif (MAJOR_NR == MITSUMI_CDROM_MAJOR) #elif (MAJOR_NR == MITSUMI_CDROM_MAJOR)
#define DEVICE_NAME "Mitsumi CD-ROM" #define DEVICE_NAME "Mitsumi CD-ROM"
/* #define DEVICE_INTR do_mcd */ /* #define DEVICE_INTR do_mcd */
#define DEVICE_REQUEST do_mcd_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MITSUMI_X_CDROM_MAJOR) #elif (MAJOR_NR == MITSUMI_X_CDROM_MAJOR)
#define DEVICE_NAME "Mitsumi CD-ROM" #define DEVICE_NAME "Mitsumi CD-ROM"
/* #define DEVICE_INTR do_mcdx */ /* #define DEVICE_INTR do_mcdx */
#define DEVICE_REQUEST do_mcdx_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MATSUSHITA_CDROM_MAJOR) #elif (MAJOR_NR == MATSUSHITA_CDROM_MAJOR)
#define DEVICE_NAME "Matsushita CD-ROM controller #1" #define DEVICE_NAME "Matsushita CD-ROM controller #1"
#define DEVICE_REQUEST do_sbpcd_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MATSUSHITA_CDROM2_MAJOR) #elif (MAJOR_NR == MATSUSHITA_CDROM2_MAJOR)
#define DEVICE_NAME "Matsushita CD-ROM controller #2" #define DEVICE_NAME "Matsushita CD-ROM controller #2"
#define DEVICE_REQUEST do_sbpcd2_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MATSUSHITA_CDROM3_MAJOR) #elif (MAJOR_NR == MATSUSHITA_CDROM3_MAJOR)
#define DEVICE_NAME "Matsushita CD-ROM controller #3" #define DEVICE_NAME "Matsushita CD-ROM controller #3"
#define DEVICE_REQUEST do_sbpcd3_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MATSUSHITA_CDROM4_MAJOR) #elif (MAJOR_NR == MATSUSHITA_CDROM4_MAJOR)
#define DEVICE_NAME "Matsushita CD-ROM controller #4" #define DEVICE_NAME "Matsushita CD-ROM controller #4"
#define DEVICE_REQUEST do_sbpcd4_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == AZTECH_CDROM_MAJOR) #elif (MAJOR_NR == AZTECH_CDROM_MAJOR)
#define DEVICE_NAME "Aztech CD-ROM" #define DEVICE_NAME "Aztech CD-ROM"
#define DEVICE_REQUEST do_aztcd_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == CDU535_CDROM_MAJOR) #elif (MAJOR_NR == CDU535_CDROM_MAJOR)
#define DEVICE_NAME "SONY-CDU535" #define DEVICE_NAME "SONY-CDU535"
#define DEVICE_INTR do_cdu535 #define DEVICE_INTR do_cdu535
#define DEVICE_REQUEST do_cdu535_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == GOLDSTAR_CDROM_MAJOR) #elif (MAJOR_NR == GOLDSTAR_CDROM_MAJOR)
#define DEVICE_NAME "Goldstar R420" #define DEVICE_NAME "Goldstar R420"
#define DEVICE_REQUEST do_gscd_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == CM206_CDROM_MAJOR) #elif (MAJOR_NR == CM206_CDROM_MAJOR)
#define DEVICE_NAME "Philips/LMS CD-ROM cm206" #define DEVICE_NAME "Philips/LMS CD-ROM cm206"
#define DEVICE_REQUEST do_cm206_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == OPTICS_CDROM_MAJOR) #elif (MAJOR_NR == OPTICS_CDROM_MAJOR)
#define DEVICE_NAME "DOLPHIN 8000AT CD-ROM" #define DEVICE_NAME "DOLPHIN 8000AT CD-ROM"
#define DEVICE_REQUEST do_optcd_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == SANYO_CDROM_MAJOR) #elif (MAJOR_NR == SANYO_CDROM_MAJOR)
#define DEVICE_NAME "Sanyo H94A CD-ROM" #define DEVICE_NAME "Sanyo H94A CD-ROM"
#define DEVICE_REQUEST do_sjcd_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == APBLOCK_MAJOR) #elif (MAJOR_NR == APBLOCK_MAJOR)
#define DEVICE_NAME "apblock" #define DEVICE_NAME "apblock"
#define DEVICE_REQUEST ap_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == DDV_MAJOR) #elif (MAJOR_NR == DDV_MAJOR)
#define DEVICE_NAME "ddv" #define DEVICE_NAME "ddv"
#define DEVICE_REQUEST ddv_request
#define DEVICE_NR(device) (minor(device)>>PARTN_BITS) #define DEVICE_NR(device) (minor(device)>>PARTN_BITS)
#elif (MAJOR_NR == MFM_ACORN_MAJOR) #elif (MAJOR_NR == MFM_ACORN_MAJOR)
#define DEVICE_NAME "mfm disk" #define DEVICE_NAME "mfm disk"
#define DEVICE_INTR do_mfm #define DEVICE_INTR do_mfm
#define DEVICE_REQUEST do_mfm_request
#define DEVICE_NR(device) (minor(device) >> 6) #define DEVICE_NR(device) (minor(device) >> 6)
#elif (MAJOR_NR == NBD_MAJOR) #elif (MAJOR_NR == NBD_MAJOR)
#define DEVICE_NAME "nbd" #define DEVICE_NAME "nbd"
#define DEVICE_REQUEST do_nbd_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MDISK_MAJOR) #elif (MAJOR_NR == MDISK_MAJOR)
#define DEVICE_NAME "mdisk" #define DEVICE_NAME "mdisk"
#define DEVICE_REQUEST mdisk_request
#define DEVICE_NR(device) (minor(device)) #define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == DASD_MAJOR) #elif (MAJOR_NR == DASD_MAJOR)
#define DEVICE_NAME "dasd" #define DEVICE_NAME "dasd"
#define DEVICE_REQUEST do_dasd_request
#define DEVICE_NR(device) (minor(device) >> PARTN_BITS) #define DEVICE_NR(device) (minor(device) >> PARTN_BITS)
#elif (MAJOR_NR == I2O_MAJOR) #elif (MAJOR_NR == I2O_MAJOR)
#define DEVICE_NAME "I2O block" #define DEVICE_NAME "I2O block"
#define DEVICE_REQUEST i2ob_request
#define DEVICE_NR(device) (minor(device)>>4) #define DEVICE_NR(device) (minor(device)>>4)
#elif (MAJOR_NR == COMPAQ_SMART2_MAJOR) #elif (MAJOR_NR == COMPAQ_SMART2_MAJOR)
#define DEVICE_NAME "ida" #define DEVICE_NAME "ida"
#define TIMEOUT_VALUE (25*HZ)
#define DEVICE_REQUEST do_ida_request
#define DEVICE_NR(device) (minor(device) >> 4) #define DEVICE_NR(device) (minor(device) >> 4)
#endif /* MAJOR_NR == whatever */ #endif /* MAJOR_NR == whatever */
/* provide DEVICE_xxx defaults, if not explicitly defined
* above in the MAJOR_NR==xxx if-elif tree */
#ifndef DEVICE_ON
#define DEVICE_ON(device) do {} while (0)
#endif
#ifndef DEVICE_OFF
#define DEVICE_OFF(device) do {} while (0)
#endif
#if (MAJOR_NR != SCSI_TAPE_MAJOR) && (MAJOR_NR != OSST_MAJOR) #if (MAJOR_NR != SCSI_TAPE_MAJOR) && (MAJOR_NR != OSST_MAJOR)
#if !defined(IDE_DRIVER) #if !defined(IDE_DRIVER)
...@@ -349,8 +302,6 @@ static void floppy_off(unsigned int nr); ...@@ -349,8 +302,6 @@ static void floppy_off(unsigned int nr);
#ifndef QUEUE_EMPTY #ifndef QUEUE_EMPTY
#define QUEUE_EMPTY blk_queue_empty(QUEUE) #define QUEUE_EMPTY blk_queue_empty(QUEUE)
#endif #endif
#ifndef DEVICE_NAME #ifndef DEVICE_NAME
#define DEVICE_NAME "unknown" #define DEVICE_NAME "unknown"
#endif #endif
...@@ -363,10 +314,6 @@ static void (*DEVICE_INTR)(void) = NULL; ...@@ -363,10 +314,6 @@ static void (*DEVICE_INTR)(void) = NULL;
#define SET_INTR(x) (DEVICE_INTR = (x)) #define SET_INTR(x) (DEVICE_INTR = (x))
#ifdef DEVICE_REQUEST
static void (DEVICE_REQUEST)(request_queue_t *);
#endif
#ifdef DEVICE_INTR #ifdef DEVICE_INTR
#define CLEAR_INTR SET_INTR(NULL) #define CLEAR_INTR SET_INTR(NULL)
#else #else
...@@ -385,11 +332,10 @@ static void (DEVICE_REQUEST)(request_queue_t *); ...@@ -385,11 +332,10 @@ static void (DEVICE_REQUEST)(request_queue_t *);
#endif /* !defined(IDE_DRIVER) */ #endif /* !defined(IDE_DRIVER) */
/*
#ifndef LOCAL_END_REQUEST /* If we have our own end_request, we do not want to include this mess */ * If we have our own end_request, we do not want to include this mess
*/
#if ! SCSI_BLK_MAJOR(MAJOR_NR) && (MAJOR_NR != COMPAQ_SMART2_MAJOR) #ifndef LOCAL_END_REQUEST
static inline void end_request(int uptodate) static inline void end_request(int uptodate)
{ {
struct request *req = CURRENT; struct request *req = CURRENT;
...@@ -397,17 +343,11 @@ static inline void end_request(int uptodate) ...@@ -397,17 +343,11 @@ static inline void end_request(int uptodate)
if (end_that_request_first(req, uptodate, CURRENT->hard_cur_sectors)) if (end_that_request_first(req, uptodate, CURRENT->hard_cur_sectors))
return; return;
#ifndef DEVICE_NO_RANDOM
add_blkdev_randomness(major(req->rq_dev)); add_blkdev_randomness(major(req->rq_dev));
#endif
DEVICE_OFF(req->rq_dev);
blkdev_dequeue_request(req); blkdev_dequeue_request(req);
end_that_request_last(req); end_that_request_last(req);
} }
#endif /* !LOCAL_END_REQUEST */
#endif /* ! SCSI_BLK_MAJOR(MAJOR_NR) */
#endif /* LOCAL_END_REQUEST */
#endif /* (MAJOR_NR != SCSI_TAPE_MAJOR) */ #endif /* (MAJOR_NR != SCSI_TAPE_MAJOR) */
#endif /* defined(MAJOR_NR) || defined(IDE_DRIVER) */ #endif /* defined(MAJOR_NR) || defined(IDE_DRIVER) */
......
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