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);
......
......@@ -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;
......@@ -1748,7 +1750,7 @@ void floppy_interrupt(int irq, void *dev_id, struct pt_regs * regs)
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));
}
......@@ -1824,7 +1826,7 @@ static void reset_fdc(void)
{
unsigned long flags;
SET_INTR(reset_interrupt);
do_floppy = reset_interrupt;
FDCS->reset = 0;
reset_fdc_info(0);
......@@ -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;
}
......
/*
* sbpcd.c CD-ROM device driver for the whole family of traditional,
* non-ATAPI IDE-style Matsushita/Panasonic CR-5xx drives.
......@@ -345,12 +343,16 @@
* driver for a horribly slow double speed CD on a hideous interface
* designed for polled operation, I won't loose any sleep in simply
* disallowing merging. Paul G. 02/2001
*
* Thu May 30 14:14:47 CEST 2002:
*
* I have presumably found the reson for the above - there was a bogous
* end_request substitute, which was manipulating the request queues
* incorrectly. If someone has access to the actual hardware, and it's
* still operations - well please free to test it.
*
* Marcin Dalecki
*/
#define DONT_MERGE_REQUESTS
#ifndef SBPCD_ISSUE
#define SBPCD_ISSUE 1
#endif /* SBPCD_ISSUE */
#include <linux/module.h>
......@@ -377,50 +379,19 @@
#include <linux/config.h>
#include "sbpcd.h"
#if !(SBPCD_ISSUE-1)
#define MAJOR_NR MATSUSHITA_CDROM_MAJOR
#endif
#if !(SBPCD_ISSUE-2)
#define MAJOR_NR MATSUSHITA_CDROM2_MAJOR /* second driver issue */
#endif
#if !(SBPCD_ISSUE-3)
#define MAJOR_NR MATSUSHITA_CDROM3_MAJOR /* third driver issue */
#endif
#if !(SBPCD_ISSUE-4)
#define MAJOR_NR MATSUSHITA_CDROM4_MAJOR /* fourth driver issue */
#endif
#include <linux/blk.h>
/*==========================================================================*/
/*
* provisions for more than 1 driver issues
* currently up to 4 drivers, expandable
*/
#if !(SBPCD_ISSUE-1)
#define DO_SBPCD_REQUEST(a) do_sbpcd_request(a)
#define SBPCD_INIT(a) sbpcd_init(a)
#endif
#if !(SBPCD_ISSUE-2)
#define DO_SBPCD_REQUEST(a) do_sbpcd2_request(a)
#define SBPCD_INIT(a) sbpcd2_init(a)
#endif
#if !(SBPCD_ISSUE-3)
#define DO_SBPCD_REQUEST(a) do_sbpcd3_request(a)
#define SBPCD_INIT(a) sbpcd3_init(a)
#endif
#if !(SBPCD_ISSUE-4)
#define DO_SBPCD_REQUEST(a) do_sbpcd4_request(a)
#define SBPCD_INIT(a) sbpcd4_init(a)
#endif
/*==========================================================================*/
#if SBPCD_DIS_IRQ
#define SBPCD_CLI cli()
#define SBPCD_STI sti()
# define SBPCD_CLI cli()
# define SBPCD_STI sti()
#else
#define SBPCD_CLI
#define SBPCD_STI
#endif /* SBPCD_DIS_IRQ */
# define SBPCD_CLI
# define SBPCD_STI
#endif
/*==========================================================================*/
/*
* auto-probing address list
......@@ -438,7 +409,6 @@
* send mail to emoenke@gwdg.de if your interface card is not FULLY
* represented here.
*/
#if !(SBPCD_ISSUE-1)
static int sbpcd[] =
{
CDROM_PORT, SBPRO, /* probe with user's setup first */
......@@ -482,30 +452,17 @@ static int sbpcd[] =
#endif
#endif /* DISTRIBUTION */
};
#else
static int sbpcd[] = {CDROM_PORT, SBPRO}; /* probe with user's setup only */
#endif
/*
* Protects access to global structures etc.
*/
static spinlock_t sbpcd_lock __cacheline_aligned = SPIN_LOCK_UNLOCKED;
MODULE_PARM(sbpcd, "2i");
MODULE_PARM(max_drives, "i");
#define NUM_PROBE (sizeof(sbpcd) / sizeof(int))
/*==========================================================================*/
/*
* the external references:
*/
#if !(SBPCD_ISSUE-1)
#ifdef CONFIG_SBPCD2
extern int sbpcd2_init(void);
#endif
#ifdef CONFIG_SBPCD3
extern int sbpcd3_init(void);
#endif
#ifdef CONFIG_SBPCD4
extern int sbpcd4_init(void);
#endif
#endif
/*==========================================================================*/
#define INLINE inline
......@@ -604,19 +561,7 @@ static const char *str_lm = "LaserMate";
static const char *str_sp = "SPEA";
static const char *str_t16 = "Teac16bit";
static const char *type;
#if !(SBPCD_ISSUE-1)
static const char *major_name="sbpcd";
#endif
#if !(SBPCD_ISSUE-2)
static const char *major_name="sbpcd2";
#endif
#if !(SBPCD_ISSUE-3)
static const char *major_name="sbpcd3";
#endif
#if !(SBPCD_ISSUE-4)
static const char *major_name="sbpcd4";
#endif
/*==========================================================================*/
......@@ -4879,15 +4824,12 @@ static void sbp_transfer(struct request *req)
*
*/
#undef DEBUG_GTL
static inline void sbpcd_end_request(struct request *req, int uptodate) {
list_add(&req->queue, &req->q->queue_head);
end_request(uptodate);
}
/*==========================================================================*/
/*
* I/O request routine, called from Linux kernel.
*/
static void DO_SBPCD_REQUEST(request_queue_t * q)
static void do_sbpcd_request(request_queue_t * q)
{
u_int block;
u_int nsect;
......@@ -4921,11 +4863,11 @@ static void DO_SBPCD_REQUEST(request_queue_t * q)
return;
}
req=CURRENT; /* take out our request so no other */
req = CURRENT; /* take out our request so no other */
blkdev_dequeue_request(req); /* task can fuck it up GTL */
if (req -> sector == -1)
sbpcd_end_request(req, 0);
end_request(0);
spin_unlock_irq(q->queue_lock);
down(&ioctl_read_sem);
......@@ -4967,7 +4909,7 @@ static void DO_SBPCD_REQUEST(request_queue_t * q)
#endif
up(&ioctl_read_sem);
spin_lock_irq(q->queue_lock);
sbpcd_end_request(req, 1);
end_request(1);
goto request_loop;
}
......@@ -5008,7 +4950,7 @@ static void DO_SBPCD_REQUEST(request_queue_t * q)
#endif
up(&ioctl_read_sem);
spin_lock_irq(q->queue_lock);
sbpcd_end_request(req, 1);
end_request(1);
goto request_loop;
}
}
......@@ -5024,7 +4966,7 @@ static void DO_SBPCD_REQUEST(request_queue_t * q)
up(&ioctl_read_sem);
sbp_sleep(0); /* wait a bit, try again */
spin_lock_irq(q->queue_lock);
sbpcd_end_request(req, 0);
end_request(0);
goto request_loop;
}
/*==========================================================================*/
......@@ -5488,7 +5430,6 @@ static void sbpcd_release(struct cdrom_device_info * cdi)
if (--D_S[d].open_count<=0)
{
D_S[d].sbp_first_frame=D_S[d].sbp_last_frame=-1;
invalidate_buffers(cdi->dev);
if (D_S[d].audio_state!=audio_playing)
if (D_S[d].f_eject) cc_SpinDown();
D_S[d].diskstate_flags &= ~cd_size_bit;
......@@ -5559,11 +5500,7 @@ static struct cdrom_device_info sbpcd_info = {
*
*/
#if (SBPCD_ISSUE-1)
static int sbpcd_setup(char *s)
#else
int sbpcd_setup(char *s)
#endif
{
#ifndef MODULE
int p[4];
......@@ -5680,20 +5617,6 @@ static int __init config_spea(void)
return (0);
}
#ifdef DONT_MERGE_REQUESTS
static int dont_merge_requests_fn(request_queue_t *q, struct request *req,
struct request *next, int max_segments)
{
return 0;
}
static int dont_bh_merge_fn(request_queue_t *q, struct request *req,
struct buffer_head *bh, int max_segments)
{
return 0;
}
#endif
/*==========================================================================*/
/*
* Test for presence of drive and initialize it.
......@@ -5703,10 +5626,10 @@ static int dont_bh_merge_fn(request_queue_t *q, struct request *req,
static devfs_handle_t devfs_handle;
#ifdef MODULE
int __init __SBPCD_INIT(void)
int __init __sbpcd_init(void)
#else
int __init SBPCD_INIT(void)
#endif /* MODULE */
int __init sbpcd_init(void)
#endif
{
char nbuff[16];
int i=0, j=0;
......@@ -5860,13 +5783,7 @@ int __init SBPCD_INIT(void)
goto init_done;
#endif /* MODULE */
}
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DO_SBPCD_REQUEST, &sbpcd_lock);
#ifdef DONT_MERGE_REQUESTS
(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))->merge_requests_fn = dont_merge_requests_fn;
#endif
read_ahead[MAJOR_NR] = buffers * (CD_FRAMESIZE / 512);
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), do_sbpcd_request, &sbpcd_lock);
request_region(CDo_command,4,major_name);
......@@ -5918,10 +5835,10 @@ int __init SBPCD_INIT(void)
}
D_S[j].sbpcd_infop = sbpcd_infop;
memcpy (sbpcd_infop, &sbpcd_info, sizeof(struct cdrom_device_info));
sbpcd_infop->dev = MKDEV(MAJOR_NR, j);
sbpcd_infop->dev = mk_kdev(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);
sprintf (nbuff, "c0t%d/cd", D_S[j].drv_id);
sbpcd_infop->de =
devfs_register (devfs_handle, nbuff, DEVFS_FL_DEFAULT,
MAJOR_NR, j, S_IFBLK | S_IRUGO | S_IWUGO,
......@@ -5935,18 +5852,7 @@ int __init SBPCD_INIT(void)
#ifndef MODULE
init_done:
#if !(SBPCD_ISSUE-1)
#ifdef CONFIG_SBPCD2
sbpcd2_init();
#endif /* CONFIG_SBPCD2 */
#ifdef CONFIG_SBPCD3
sbpcd3_init();
#endif /* CONFIG_SBPCD3 */
#ifdef CONFIG_SBPCD4
sbpcd4_init();
#endif /* CONFIG_SBPCD4 */
#endif /* !(SBPCD_ISSUE-1) */
#endif /* MODULE */
#endif
return 0;
}
/*==========================================================================*/
......@@ -5978,10 +5884,7 @@ void sbpcd_exit(void)
msg(DBG_INF, "%s module released.\n", major_name);
}
#ifdef MODULE
module_init(__SBPCD_INIT) /*HACK!*/;
#endif
module_init(__sbpcd_init) /*HACK!*/;
module_exit(sbpcd_exit);
......@@ -6003,7 +5906,7 @@ static int sbpcd_chk_disk_change(kdev_t full_dev)
D_S[i].CD_changed=0;
msg(DBG_CHK,"medium changed (drive %d)\n", i);
/* BUG! Should invalidate buffers! --AJK */
invalidate_buffers(full_dev);
/* Why should it do the above at all?! --mdcki */
D_S[d].diskstate_flags &= ~toc_bit;
D_S[d].diskstate_flags &= ~cd_size_bit;
#if SAFE_MIXED
......
......@@ -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,7 +1664,6 @@ sony535_init(void)
devfs_unregister(sony_devfs_handle);
if (sony535_irq_used)
free_irq(sony535_irq_used, NULL);
}
return -EIO;
}
......
......@@ -116,15 +116,11 @@ static struct timer_list device_timer;
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 {
......
......@@ -62,22 +62,12 @@
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:
......@@ -135,25 +123,6 @@ __setup("xpram_parts=", xpram_setup);
#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 */
/*
* Non-prefixed symbols are static. They are meant to be assigned at
* load time. Prefixed symbols are not static, so they can be used in
......@@ -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,9 +689,7 @@ 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);
/* Check if the minor number is in range */
if ( dev_no > xpram_devs ) {
......@@ -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 ) {
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,23 +899,17 @@ 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 */
......@@ -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)
......@@ -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