Commit 8795dba6 authored by Martin Dalecki's avatar Martin Dalecki Committed by Linus Torvalds

[PATCH] 2.5.19 blk.h and more about the ugly kids.

 - Remove DEVICE_INTR and associated code from floppy driver.

 - Savlage s390 xpram code from kernel version dependant compilation disease.

 - Eliminate SET_INTR code from the places where it was used.

 - Eliminate bogous support for multiple sbpcd controllers. The driver didn't
   even compile right now before we could think about further supporting it at
   all we have to get rid of this hack first.
   Don't call invalidate_buffers in the release method there.
   Why should it be necessary?

 - Resurrect sonycd535 compilation.

 - Let CURRENT request macro use the same primitive at the remaining QUEUE macro
   in blk.h, which is still not quite right, but first things first :-).
parent 58f3fa97
......@@ -570,7 +570,7 @@ static void mfm_rw_intr(void)
DBG("mfm_rw_intr: returned from cont->done\n");
} else {
/* Its going to generate another interrupt */
SET_INTR(mfm_rw_intr);
DEVICE_INTR = mfm_rw_intr;
};
}
......@@ -578,7 +578,7 @@ static void mfm_setup_rw(void)
{
DBG("setting up for rw...\n");
SET_INTR(mfm_rw_intr);
DEVICE_INTR = mfm_rw_intr;
issue_command(raw_cmd.cmdcode, raw_cmd.cmddata, raw_cmd.cmdlen);
}
......@@ -608,7 +608,7 @@ static void mfm_recal_intr(void)
/* Command end without seek end (see data sheet p.20) for parallel seek
- we have to send a POL command to wait for the seek */
if (mfm_status & STAT_CED) {
SET_INTR(mfm_recal_intr);
DEVICE_INTR = mfm_recal_intr;
issue_command(CMD_POL, NULL, 0);
return;
}
......@@ -638,7 +638,7 @@ static void mfm_seek_intr(void)
return;
}
if (mfm_status & STAT_CED) {
SET_INTR(mfm_seek_intr);
DEVICE_INTR = mfm_seek_intr;
issue_command(CMD_POL, NULL, 0);
return;
}
......@@ -696,7 +696,7 @@ static void mfm_seek(void)
DBG("seeking...\n");
if (MFM_DRV_INFO.cylinder < 0) {
SET_INTR(mfm_recal_intr);
DEVICE_INTR = mfm_recal_intr;
DBG("mfm_seek: about to call specify\n");
mfm_specify (); /* DAG added this */
......@@ -712,7 +712,7 @@ static void mfm_seek(void)
cmdb[2] = raw_cmd.cylinder >> 8;
cmdb[3] = raw_cmd.cylinder;
SET_INTR(mfm_seek_intr);
DEVICE_INTR = mfm_seek_intr;
issue_command(CMD_SEK, cmdb, 4);
} else
mfm_setup_rw();
......@@ -907,7 +907,7 @@ static void mfm_request(void)
if (blk_queue_empty(QUEUE)) {
printk("mfm_request: Exiting due to empty queue (pre)\n");
CLEAR_INTR;
DEVICE_INTR = NULL;
Busy = 0;
return;
}
......@@ -971,7 +971,7 @@ static void mfm_interrupt_handler(int unused, void *dev_id, struct pt_regs *regs
{
void (*handler) (void) = DEVICE_INTR;
CLEAR_INTR;
DEVICE_INTR = NULL;
DBG("mfm_interrupt_handler (handler=0x%p)\n", handler);
......
......@@ -1041,7 +1041,7 @@ static void redo_acsi_request( void )
}
CurrentBuffer = buffer;
CurrentNSect = nsect;
if (CURRENT->cmd == WRITE) {
CMDSET_TARG_LUN( write_cmd, target, lun );
CMDSET_BLOCK( write_cmd, block );
......@@ -1049,7 +1049,7 @@ static void redo_acsi_request( void )
if (buffer == acsi_buffer)
copy_to_acsibuffer();
dma_cache_maintenance( pbuffer, nsect*512, 1 );
SET_INTR(write_intr);
DEVICE_INTR = write_intr;
if (!acsicmd_dma( write_cmd, buffer, nsect, 1, 1)) {
CLEAR_INTR;
printk( KERN_ERR "ACSI (write): Timeout in command block\n" );
......@@ -1063,7 +1063,7 @@ static void redo_acsi_request( void )
CMDSET_TARG_LUN( read_cmd, target, lun );
CMDSET_BLOCK( read_cmd, block );
CMDSET_LEN( read_cmd, nsect );
SET_INTR(read_intr);
DEVICE_INTR = read_intr;
if (!acsicmd_dma( read_cmd, buffer, nsect, 0, 1)) {
CLEAR_INTR;
printk( KERN_ERR "ACSI (read): Timeout in command block\n" );
......
......@@ -633,6 +633,8 @@ static void is_alive(const char *message)
}
#endif
static void (*do_floppy)(void) = NULL;
#ifdef FLOPPY_SANITY_CHECK
#define OLOGSIZE 20
......@@ -920,9 +922,9 @@ static inline void unlock_fdc(void)
if (!fdc_busy)
DPRINT("FDC access conflict!\n");
if (DEVICE_INTR)
if (do_floppy)
DPRINT("device interrupt still active at FDC release: %p!\n",
DEVICE_INTR);
do_floppy);
command_status = FD_COMMAND_NONE;
del_timer(&fd_timeout);
cont = NULL;
......@@ -1005,7 +1007,7 @@ static struct timer_list fd_timer;
static void cancel_activity(void)
{
CLEAR_INTR;
do_floppy = NULL;
floppy_tq.routine = (void *)(void *) empty;
del_timer(&fd_timer);
}
......@@ -1524,7 +1526,7 @@ static void setup_rw_floppy(void)
setup_DMA();
if (flags & FD_RAW_INTR)
SET_INTR(main_command_interrupt);
do_floppy = main_command_interrupt;
r=0;
for (i=0; i< raw_cmd->cmd_count; i++)
......@@ -1656,7 +1658,7 @@ static void seek_floppy(void)
}
}
SET_INTR(seek_interrupt);
do_floppy = seek_interrupt;
output_byte(FD_SEEK);
output_byte(UNIT(current_drive));
LAST_OUT(track);
......@@ -1736,7 +1738,7 @@ static void print_result(char *message, int inr)
/* interrupt handler. Note that this can be called externally on the Sparc */
void floppy_interrupt(int irq, void *dev_id, struct pt_regs * regs)
{
void (*handler)(void) = DEVICE_INTR;
void (*handler)(void) = do_floppy;
int do_print;
unsigned long f;
......@@ -1746,9 +1748,9 @@ void floppy_interrupt(int irq, void *dev_id, struct pt_regs * regs)
f=claim_dma_lock();
fd_disable_dma();
release_dma_lock(f);
floppy_enable_hlt();
CLEAR_INTR;
do_floppy = NULL;
if (fdc >= N_FDC || FDCS->address == -1){
/* we don't even know which FDC is the culprit */
printk("DOR0=%x\n", fdc_state[0].dor);
......@@ -1795,7 +1797,7 @@ static void recalibrate_floppy(void)
#ifdef DEBUGT
debugt("recalibrate floppy:");
#endif
SET_INTR(recal_interrupt);
do_floppy = recal_interrupt;
output_byte(FD_RECALIBRATE);
LAST_OUT(UNIT(current_drive));
}
......@@ -1823,14 +1825,14 @@ static void reset_interrupt(void)
static void reset_fdc(void)
{
unsigned long flags;
SET_INTR(reset_interrupt);
do_floppy = reset_interrupt;
FDCS->reset = 0;
reset_fdc_info(0);
/* Pseudo-DMA may intercept 'reset finished' interrupt. */
/* Irrelevant for systems with true DMA (i386). */
flags=claim_dma_lock();
fd_disable_dma();
release_dma_lock(flags);
......@@ -1873,8 +1875,8 @@ static void show_floppy(void)
printk("status=%x\n", fd_inb(FD_STATUS));
printk("fdc_busy=%lu\n", fdc_busy);
if (DEVICE_INTR)
printk("DEVICE_INTR=%p\n", DEVICE_INTR);
if (do_floppy)
printk("do_floppy=%p\n", do_floppy);
if (floppy_tq.sync)
printk("floppy_tq.routine=%p\n", floppy_tq.routine);
if (timer_pending(&fd_timer))
......@@ -2920,7 +2922,7 @@ static void redo_fd_request(void)
for (;;) {
if (blk_queue_empty(QUEUE)) {
CLEAR_INTR;
do_floppy = NULL;
unlock_fdc();
return;
}
......
......@@ -106,27 +106,6 @@ CONFIG_SBPCD
The module will be called sbpcd.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
CONFIG_SBPCD2
Say Y here only if you have two CD-ROM controller cards of this type
(usually only if you have more than four drives). You should enter
the parameters for the second, third and fourth interface card into
<file:drivers/cdrom/sbpcd.h> before compiling the new kernel. Read
the file <file:Documentation/cdrom/sbpcd>.
CONFIG_SBPCD3
Say Y here only if you have three CD-ROM controller cards of this
type (usually only if you have more than six drives). You should
enter the parameters for the second, third and fourth interface card
into <file:include/linux/sbpcd.h> before compiling the new kernel.
Read the file <file:Documentation/cdrom/sbpcd>.
CONFIG_SBPCD4
Say Y here only if you have four CD-ROM controller cards of this
type (usually only if you have more than eight drives). You should
enter the parameters for the second, third and fourth interface card
into <file:include/linux/sbpcd.h> before compiling the new kernel.
Read the file <file:Documentation/cdrom/sbpcd>.
CONFIG_AZTCD
This is your driver if you have an Aztech CDA268-01A, Orchid
CD-3110, Okano or Wearnes CDD110, Conrad TXC, or CyCD-ROM CR520 or
......
......@@ -4,15 +4,6 @@
tristate ' Aztech/Orchid/Okano/Wearnes/TXC/CyDROM CDROM support' CONFIG_AZTCD
tristate ' Goldstar R420 CDROM support' CONFIG_GSCD
tristate ' Matsushita/Panasonic/Creative, Longshine, TEAC CDROM support' CONFIG_SBPCD
if [ "$CONFIG_SBPCD" = "y" ]; then
bool ' Matsushita/Panasonic, ... second CDROM controller support' CONFIG_SBPCD2
if [ "$CONFIG_SBPCD2" = "y" ]; then
bool ' Matsushita/Panasonic, ... third CDROM controller support' CONFIG_SBPCD3
if [ "$CONFIG_SBPCD3" = "y" ]; then
bool ' Matsushita/Panasonic, ... fourth CDROM controller support' CONFIG_SBPCD4
fi
fi
fi
tristate ' Mitsumi (standard) [no XA/Multisession] CDROM support' CONFIG_MCD
if [ "$CONFIG_MCD" != "n" ]; then
int 'MCD IRQ' CONFIG_MCD_IRQ 11
......
......@@ -34,9 +34,6 @@ obj-$(CONFIG_MCD) += mcd.o cdrom.o
obj-$(CONFIG_MCDX) += mcdx.o cdrom.o
obj-$(CONFIG_OPTCD) += optcd.o
obj-$(CONFIG_SBPCD) += sbpcd.o cdrom.o
obj-$(CONFIG_SBPCD2) += sbpcd2.o cdrom.o
obj-$(CONFIG_SBPCD3) += sbpcd3.o cdrom.o
obj-$(CONFIG_SBPCD4) += sbpcd4.o cdrom.o
obj-$(CONFIG_SJCD) += sjcd.o
obj-$(CONFIG_CDU535) += sonycd535.o
......
......@@ -292,7 +292,7 @@ static void __do_gscd_request(unsigned long dummy)
goto out;
if (CURRENT->cmd != READ) {
printk("GSCD: bad cmd %d\n", CURRENT->cmd);
printk("GSCD: bad cmd %p\n", CURRENT->cmd);
end_request(0);
goto repeat;
}
......
This diff is collapsed.
......@@ -74,30 +74,10 @@
* Example: #define SOUND_BASE 0x220 enables the sound card's CD channels
* #define SOUND_BASE 0 leaves the soundcard untouched
*/
#if !(SBPCD_ISSUE-1) /* first (or if you have only one) interface board: */
#define CDROM_PORT 0x340 /* <-----------<< port address */
#define SBPRO 0 /* <-----------<< interface type */
#define MAX_DRIVES 4 /* set to 1 if the card does not use "drive select" */
#define SOUND_BASE 0x220 /* <-----------<< sound address of this card or 0 */
#endif
#if !(SBPCD_ISSUE-2) /* ==================== second interface board: === */
#define CDROM_PORT 0x344 /* <-----------<< port address */
#define SBPRO 0 /* <-----------<< interface type */
#define MAX_DRIVES 4 /* set to 1 if the card does not use "drive select" */
#define SOUND_BASE 0x000 /* <-----------<< sound address of this card or 0 */
#endif
#if !(SBPCD_ISSUE-3) /* ===================== third interface board: === */
#define CDROM_PORT 0x630 /* <-----------<< port address */
#define SBPRO 1 /* <-----------<< interface type */
#define MAX_DRIVES 4 /* set to 1 if the card does not use "drive select" */
#define SOUND_BASE 0x240 /* <-----------<< sound address of this card or 0 */
#endif
#if !(SBPCD_ISSUE-4) /* ==================== fourth interface board: === */
#define CDROM_PORT 0x634 /* <-----------<< port address */
#define SBPRO 0 /* <-----------<< interface type */
#define MAX_DRIVES 4 /* set to 1 if the card does not use "drive select" */
#define SOUND_BASE 0x000 /* <-----------<< sound address of this card or 0 */
#endif
/*
* some more or less user dependent definitions - service them!
......
/*
* duplication of sbpcd.c for multiple interfaces
*/
#define SBPCD_ISSUE 2
#include "sbpcd.c"
/*
* duplication of sbpcd.c for multiple interfaces
*/
#define SBPCD_ISSUE 3
#include "sbpcd.c"
/*
* duplication of sbpcd.c for multiple interfaces
*/
#define SBPCD_ISSUE 4
#include "sbpcd.c"
......@@ -118,6 +118,7 @@
#include <linux/timer.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/hdreg.h>
#include <linux/genhd.h>
......@@ -134,7 +135,8 @@
#include <linux/cdrom.h>
#define MAJOR_NR CDU535_CDROM_MAJOR
# include <linux/blk.h>
#include <linux/blk.h>
#define sony535_cd_base_io sonycd535 /* for compatible parameter passing with "insmod" */
#include "sonycd535.h"
......@@ -1589,7 +1591,6 @@ sony535_init(void)
&cdu_fops, NULL);
if (devfs_register_blkdev(MAJOR_NR, CDU535_HANDLE, &cdu_fops)) {
printk("Unable to get major %d for %s\n",
devfs_unregister(sony_devfs_handle);
MAJOR_NR, CDU535_MESSAGE_NAME);
return -EIO;
}
......@@ -1663,8 +1664,7 @@ sony535_init(void)
devfs_unregister(sony_devfs_handle);
if (sony535_irq_used)
free_irq(sony535_irq_used, NULL);
}
return -EIO;
}
register_disk(NULL, mk_kdev(MAJOR_NR,0), 1, &cdu_fops, 0);
......
......@@ -111,20 +111,16 @@ static int hd_sizes[MAX_HD<<6];
static struct timer_list device_timer;
#define SET_TIMER \
#define SET_TIMER \
do { \
mod_timer(&device_timer, jiffies + TIMEOUT_VALUE); \
} while (0)
#define CLEAR_TIMER del_timer(&device_timer);
#undef SET_INTR
#define SET_INTR(x) \
#define SET_HANDLER(x) \
if ((DEVICE_INTR = (x)) != NULL) \
SET_TIMER; \
else \
CLEAR_TIMER;
del_timer(&device_timer);
#if (HD_DELAY > 0)
......@@ -280,7 +276,7 @@ static void hd_out(unsigned int drive,unsigned int nsect,unsigned int sect,
reset = 1;
return;
}
SET_INTR(intr_addr);
SET_HANDLER(intr_addr);
outb_p(hd_info[drive].ctl,HD_CMD);
port=HD_DATA;
outb_p(hd_info[drive].wpcom>>2,++port);
......@@ -430,7 +426,7 @@ static void read_intr(void)
if (CURRENT->current_nr_sectors <= 0)
end_request(1);
if (i > 0) {
SET_INTR(&read_intr);
SET_HANDLER(&read_intr);
return;
}
(void) inb_p(HD_STATUS);
......@@ -468,7 +464,7 @@ static void write_intr(void)
if (!i || (CURRENT->bio && !SUBSECTOR(i)))
end_request(1);
if (i > 0) {
SET_INTR(&write_intr);
SET_HANDLER(&write_intr);
outsw(HD_DATA,CURRENT->buffer,256);
sti();
} else {
......
......@@ -59,25 +59,15 @@
#include <linux/version.h>
#ifdef MODULE
char kernel_version [] = UTS_RELEASE;
char kernel_version [] = UTS_RELEASE;
#endif
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,3,98))
# define XPRAM_VERSION 24
#else
# define XPRAM_VERSION 22
#endif
#if (XPRAM_VERSION == 24)
# include <linux/config.h>
# include <linux/init.h>
#endif /* V24 */
#include <linux/config.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/kernel.h> /* printk() */
#include <linux/slab.h> /* kmalloc() */
#if (XPRAM_VERSION == 24)
# include <linux/devfs_fs_kernel.h>
#endif /* V24 */
#include <linux/devfs_fs_kernel.h>
#include <linux/fs.h> /* everything... */
#include <linux/errno.h> /* error codes */
#include <linux/timer.h>
......@@ -89,7 +79,6 @@ char kernel_version [] = UTS_RELEASE;
#include <asm/system.h> /* cli(), *_flags */
#include <asm/uaccess.h> /* put_user */
#if (XPRAM_VERSION == 24)
#define MAJOR_NR xpram_major /* force definitions on in blk.h */
int xpram_major; /* must be declared before including blk.h */
devfs_handle_t xpram_devfs_handle;
......@@ -105,7 +94,6 @@ devfs_handle_t xpram_devfs_handle;
#include "xpram.h" /* local definitions */
__setup("xpram_parts=", xpram_setup);
#endif /* V24 */
/*
define the debug levels:
......@@ -133,26 +121,7 @@ __setup("xpram_parts=", xpram_setup);
#define PRINT_WARN(x...) printk ( KERN_DEBUG PRINTK_HEADER "warning:" x )
#define PRINT_ERR(x...) printk ( KERN_DEBUG PRINTK_HEADER "error:" x )
#define PRINT_FATAL(x...) printk ( KERN_DEBUG PRINTK_HEADER "panic:" x )
#endif
#if (XPRAM_VERSION == 22)
#define MAJOR_NR xpram_major /* force definitions on in blk.h */
int xpram_major; /* must be declared before including blk.h */
#define DEVICE_NR(device) MINOR(device) /* xpram has no partition bits */
#define DEVICE_NAME "xpram" /* name for messaging */
#define DEVICE_INTR xpram_intrptr /* pointer to the bottom half */
#define DEVICE_NO_RANDOM /* no entropy to contribute */
#define DEVICE_OFF(d) /* do-nothing */
#define DEVICE_REQUEST *xpram_dummy_device_request /* dummy function variable
* to prevent warnings
*/#include <linux/blk.h>
#include "xpram.h" /* local definitions */
#endif /* V22 */
#endif
/*
* Non-prefixed symbols are static. They are meant to be assigned at
......@@ -659,13 +628,6 @@ int xpram_ioctl (struct inode *inode, struct file *filp,
case BLKRRPART: /* re-read partition table: can't do it, 0x1259 */
return -EINVAL;
#if (XPRAM_VERSION == 22)
RO_IOCTLS(inode->i_rdev, arg); /* the default RO operations
* BLKROSET
* BLKROGET
*/
#endif /* V22 */
case HDIO_GETGEO:
/*
* get geometry: we have to fake one... trim the size to a
......@@ -695,27 +657,6 @@ int xpram_ioctl (struct inode *inode, struct file *filp,
/*
* The file operations
*/
#if (XPRAM_VERSION == 22)
struct file_operations xpram_fops = {
NULL, /* lseek: default */
block_read,
block_write,
NULL, /* xpram_readdir */
NULL, /* xpram_select */
xpram_ioctl,
NULL, /* xpram_mmap */
xpram_open,
NULL, /* flush */
xpram_release,
block_fsync,
NULL, /* xpram_fasync */
NULL,
NULL
};
#endif /* V22 */
#if (XPRAM_VERSION == 24)
struct block_device_operations xpram_devops =
{
owner: THIS_MODULE,
......@@ -723,7 +664,6 @@ struct block_device_operations xpram_devops =
open: xpram_open,
release: xpram_release,
};
#endif /* V24 */
/*
* Block-driver specific functions
......@@ -740,11 +680,7 @@ void xpram_request(request_queue_t * queue)
char * buffer; /* local pointer into buffer cache */
int dev_no; /* device number of request */
int fault; /* faulty access to expanded memory */
#if ( XPRAM_VERSION == 24 )
struct request * current_req; /* working request */
#else
# define current_req CURRENT
#endif /* V24 */
while(1) {
if (blk_queue_empty(QUEUE)) {
......@@ -753,10 +689,8 @@ void xpram_request(request_queue_t * queue)
}
fault=0;
#if ( XPRAM_VERSION == 24 )
current_req = CURRENT;
#endif /* V24 */
dev_no = DEVICE_NR(current_req->rq_dev);
dev_no = DEVICE_NR(current_req->rq_dev);
/* Check if the minor number is in range */
if ( dev_no > xpram_devs ) {
static int count = 0;
......@@ -872,26 +806,18 @@ void xpram_request(request_queue_t * queue)
* partition size (if provided). A parsing error of a value
* results in this value being set to -EINVAL.
*/
#if (XPRAM_VERSION == 22)
void xpram_setup (char *str, int *ints)
#else
int xpram_setup (char *str)
#endif /* V22 */
{
devs = xpram_read_int(&str);
if ( devs != -EINVAL )
if ( xpram_read_size_list_tail(&str,devs,sizes) < 0 ) {
if ( devs != -EINVAL )
if ( xpram_read_size_list_tail(&str,devs,sizes) < 0 ) {
PRINT_ERR("error while reading xpram parameters.\n");
#if (XPRAM_VERSION == 24)
return -EINVAL;
#endif /* V24 */
}
#if (XPRAM_VERSION == 24)
else return 0;
else return -EINVAL;
#elif (XPRAM_VERSION == 22)
return;
#endif /* V24/V22 */
}
else
return 0;
else
return -EINVAL;
}
/*
......@@ -911,12 +837,10 @@ int xpram_init(void)
int mem_auto_no=0; /* number of (implicit) zero parameters in sizes */
int mem_auto; /* automatically determined device size */
#if (XPRAM_VERSION == 24)
int minor_length; /* store the length of a minor (w/o '\0') */
int minor_thresh; /* threshhold for minor lenght */
request_queue_t *q; /* request queue */
#endif /* V24 */
/*
* Copy the (static) cfg variables to public prefixed ones to allow
......@@ -975,29 +899,23 @@ int xpram_init(void)
/*
* Register your major, and accept a dynamic number
*/
#if (XPRAM_VERSION == 22)
result = register_blkdev(xpram_major, "xpram", &xpram_fops);
#elif (XPRAM_VERSION == 24)
result = devfs_register_blkdev(xpram_major, "xpram", &xpram_devops);
#endif /* V22/V24 */
if (result < 0) {
PRINT_ERR("Can't get major %d\n",xpram_major);
PRINT_ERR("Giving up xpram\n");
return result;
}
#if (XPRAM_VERSION == 24)
xpram_devfs_handle = devfs_mk_dir (NULL, "slram", NULL);
devfs_register_series (xpram_devfs_handle, "%u", XPRAM_MAX_DEVS,
DEVFS_FL_DEFAULT, XPRAM_MAJOR, 0,
S_IFBLK | S_IRUSR | S_IWUSR,
&xpram_devops, NULL);
#endif /* V22/V24 */
if (xpram_major == 0) xpram_major = result; /* dynamic */
major = xpram_major; /* Use `major' later on to save typing */
result = -ENOMEM; /* for the possible errors */
/*
/*
* measure expanded memory
*/
......@@ -1018,13 +936,9 @@ int xpram_init(void)
* arrays if it uses the default values.
*/
#if (XPRAM_VERSION == 22)
blk_dev[major].request_fn = xpram_request;
#elif (XPRAM_VERSION == 24)
q = BLK_DEFAULT_QUEUE (major);
q = BLK_DEFAULT_QUEUE(major);
blk_init_queue (q, xpram_request);
blk_queue_hardsect_size(q, xpram_hardsect);
#endif /* V22/V24 */
/* we want to have XPRAM_UNUSED blocks security buffer between devices */
mem_usable=xpram_mem_avail-(XPRAM_UNUSED*(xpram_devs-1));
......@@ -1076,15 +990,12 @@ int xpram_init(void)
goto fail_malloc_devices;
}
memset(xpram_devices, 0, xpram_devs * sizeof (Xpram_Dev));
#if (XPRAM_VERSION == 24)
minor_length = 1;
minor_thresh = 10;
#endif /* V24 */
for (i=0; i < xpram_devs; i++) {
/* data and usage remain zeroed */
xpram_devices[i].size = xpram_sizes[i]; /* size in kB not in bytes */
atomic_set(&(xpram_devices[i].usage),0);
#if (XPRAM_VERSION == 24)
if (i == minor_thresh) {
minor_length++;
minor_thresh *= 10;
......@@ -1119,27 +1030,20 @@ int xpram_init(void)
goto fail_devfs_register;
}
#endif /* WHY? */
#endif /* V24 */
}
return 0; /* succeed */
/* clean up memory in case of failures */
#if (XPRAM_VERSION == 24)
fail_devfs_register:
for (i=0; i < xpram_devs; i++) {
if ( xpram_devices[i].device_name )
kfree(xpram_devices[i].device_name);
}
kfree(xpram_devices);
#endif /* V24 */
kfree (xpram_offsets);
fail_malloc_devices:
fail_malloc:
#if (XPRAM_VERSION == 22)
blk_dev[major].request_fn = NULL;
#endif /* V22 */
/* ??? unregister_chrdev(major, "xpram"); */
unregister_blkdev(major, "xpram");
return result;
......@@ -1168,20 +1072,12 @@ void cleanup_module(void)
int i;
/* first of all, reset all the data structures */
#if (XPRAM_VERSION == 22)
blk_dev[major].request_fn = NULL;
#endif /* V22 */
kfree(xpram_offsets);
blk_clear(major);
/* finally, the usual cleanup */
#if (XPRAM_VERSION == 22)
unregister_blkdev(major, "xpram");
#elif (XPRAM_VERSION == 24)
devfs_unregister(xpram_devfs_handle);
if (devfs_unregister_blkdev(MAJOR_NR, "xpram"))
printk(KERN_WARNING "xpram: cannot unregister blkdev\n");
#endif /* V22/V24 */
kfree(xpram_devices);
}
......@@ -125,7 +125,6 @@ extern inline struct request *elv_next_request(request_queue_t *q)
static void floppy_off(unsigned int nr);
#define DEVICE_NAME "floppy"
#define DEVICE_INTR do_floppy
#define DEVICE_NR(device) ( (minor(device) & 3) | ((minor(device) & 0x80 ) >> 5 ))
#elif (MAJOR_NR == HD_MAJOR)
......@@ -149,14 +148,14 @@ static void floppy_off(unsigned int nr);
#elif (MAJOR_NR == SCSI_TAPE_MAJOR)
#define DEVICE_NAME "scsitape"
#define DEVICE_INTR do_st
#define DEVICE_INTR do_st
#define DEVICE_NR(device) (minor(device) & 0x7f)
#elif (MAJOR_NR == OSST_MAJOR)
#define DEVICE_NAME "onstream"
#define DEVICE_NAME "onstream"
#define DEVICE_INTR do_osst
#define DEVICE_NR(device) (minor(device) & 0x7f)
#define DEVICE_NR(device) (minor(device) & 0x7f)
#elif (MAJOR_NR == SCSI_CDROM_MAJOR)
......@@ -187,33 +186,16 @@ static void floppy_off(unsigned int nr);
#elif (MAJOR_NR == MITSUMI_CDROM_MAJOR)
#define DEVICE_NAME "Mitsumi CD-ROM"
/* #define DEVICE_INTR do_mcd */
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MITSUMI_X_CDROM_MAJOR)
#define DEVICE_NAME "Mitsumi CD-ROM"
/* #define DEVICE_INTR do_mcdx */
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MATSUSHITA_CDROM_MAJOR)
#define DEVICE_NAME "Matsushita CD-ROM controller #1"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MATSUSHITA_CDROM2_MAJOR)
#define DEVICE_NAME "Matsushita CD-ROM controller #2"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MATSUSHITA_CDROM3_MAJOR)
#define DEVICE_NAME "Matsushita CD-ROM controller #3"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == MATSUSHITA_CDROM4_MAJOR)
#define DEVICE_NAME "Matsushita CD-ROM controller #4"
#define DEVICE_NAME "Matsushita CD-ROM controller"
#define DEVICE_NR(device) (minor(device))
#elif (MAJOR_NR == AZTECH_CDROM_MAJOR)
......@@ -292,27 +274,23 @@ static void floppy_off(unsigned int nr);
#if (MAJOR_NR != SCSI_TAPE_MAJOR) && (MAJOR_NR != OSST_MAJOR)
#if !defined(IDE_DRIVER)
#ifndef CURRENT
# define CURRENT elv_next_request(&blk_dev[MAJOR_NR].request_queue)
#endif
#ifndef QUEUE
# define QUEUE (&blk_dev[MAJOR_NR].request_queue)
#endif
#ifndef CURRENT
# define CURRENT elv_next_request(QUEUE)
#endif
#ifndef DEVICE_NAME
# define DEVICE_NAME "unknown"
#endif
#ifdef DEVICE_INTR
static void (*DEVICE_INTR)(void) = NULL;
#endif
#define SET_INTR(x) (DEVICE_INTR = (x))
# ifdef DEVICE_INTR
# define CLEAR_INTR SET_INTR(NULL)
# define CLEAR_INTR DEVICE_INTR = NULL
# else
# define CLEAR_INTR
# endif
#endif /* !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