git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
parisc: advertise PCI devs after "assign_resources"
[safe/jmp/linux-2.6]
/
drivers
/
block
/
ataflop.c
diff --git
a/drivers/block/ataflop.c
b/drivers/block/ataflop.c
index
e1db285
..
f5e7180
100644
(file)
--- a/
drivers/block/ataflop.c
+++ b/
drivers/block/ataflop.c
@@
-79,9
+79,7
@@
#undef DEBUG
static struct request_queue *floppy_queue;
#undef DEBUG
static struct request_queue *floppy_queue;
-
-#define QUEUE (floppy_queue)
-#define CURRENT elv_next_request(floppy_queue)
+static struct request *fd_request;
/* Disk types: DD, HD, ED */
static struct atari_disk_type {
/* Disk types: DD, HD, ED */
static struct atari_disk_type {
@@
-361,13
+359,13
@@
static void finish_fdc( void );
static void finish_fdc_done( int dummy );
static void setup_req_params( int drive );
static void redo_fd_request( void);
static void finish_fdc_done( int dummy );
static void setup_req_params( int drive );
static void redo_fd_request( void);
-static int fd_ioctl(
struct inode *inode, struct file *filp
, unsigned int
+static int fd_ioctl(
struct block_device *bdev, fmode_t mode
, unsigned int
cmd, unsigned long param);
static void fd_probe( int drive );
static int fd_test_drive_present( int drive );
static void config_types( void );
cmd, unsigned long param);
static void fd_probe( int drive );
static int fd_test_drive_present( int drive );
static void config_types( void );
-static int floppy_open(
struct inode *inode, struct file *filp
);
-static int floppy_release(
struct inode * inode, struct file * filp
);
+static int floppy_open(
struct block_device *bdev, fmode_t mode
);
+static int floppy_release(
struct gendisk *disk, fmode_t mode
);
/************************* End of Prototypes **************************/
/************************* End of Prototypes **************************/
@@
-376,6
+374,12
@@
static DEFINE_TIMER(readtrack_timer, fd_readtrack_check, 0, 0);
static DEFINE_TIMER(timeout_timer, fd_times_out, 0, 0);
static DEFINE_TIMER(fd_timer, check_change, 0, 0);
static DEFINE_TIMER(timeout_timer, fd_times_out, 0, 0);
static DEFINE_TIMER(fd_timer, check_change, 0, 0);
+static void fd_end_request_cur(int err)
+{
+ if (!__blk_end_request_cur(fd_request, err))
+ fd_request = NULL;
+}
+
static inline void start_motor_off_timer(void)
{
mod_timer(&motor_off_timer, jiffies + FD_MOTOR_OFF_DELAY);
static inline void start_motor_off_timer(void)
{
mod_timer(&motor_off_timer, jiffies + FD_MOTOR_OFF_DELAY);
@@
-606,15
+610,15
@@
static void fd_error( void )
return;
}
return;
}
- if (!
CURRENT
)
+ if (!
fd_request
)
return;
return;
-
CURRENT
->errors++;
- if (
CURRENT
->errors >= MAX_ERRORS) {
+
fd_request
->errors++;
+ if (
fd_request
->errors >= MAX_ERRORS) {
printk(KERN_ERR "fd%d: too many errors.\n", SelectedDrive );
printk(KERN_ERR "fd%d: too many errors.\n", SelectedDrive );
-
end_request(CURRENT, 0
);
+
fd_end_request_cur(-EIO
);
}
}
- else if (
CURRENT
->errors == RECALIBRATE_ERRORS) {
+ else if (
fd_request
->errors == RECALIBRATE_ERRORS) {
printk(KERN_WARNING "fd%d: recalibrating\n", SelectedDrive );
if (SelectedDrive != -1)
SUD.track = -1;
printk(KERN_WARNING "fd%d: recalibrating\n", SelectedDrive );
if (SelectedDrive != -1)
SUD.track = -1;
@@
-725,16
+729,14
@@
static void do_fd_action( int drive )
if (IS_BUFFERED( drive, ReqSide, ReqTrack )) {
if (ReqCmd == READ) {
copy_buffer( SECTOR_BUFFER(ReqSector), ReqData );
if (IS_BUFFERED( drive, ReqSide, ReqTrack )) {
if (ReqCmd == READ) {
copy_buffer( SECTOR_BUFFER(ReqSector), ReqData );
- if (++ReqCnt <
CURRENT->current_nr_sectors
) {
+ if (++ReqCnt <
blk_rq_cur_sectors(fd_request)
) {
/* read next sector */
setup_req_params( drive );
goto repeat;
}
else {
/* all sectors finished */
/* read next sector */
setup_req_params( drive );
goto repeat;
}
else {
/* all sectors finished */
- CURRENT->nr_sectors -= CURRENT->current_nr_sectors;
- CURRENT->sector += CURRENT->current_nr_sectors;
- end_request(CURRENT, 1);
+ fd_end_request_cur(0);
redo_fd_request();
return;
}
redo_fd_request();
return;
}
@@
-1132,16
+1134,14
@@
static void fd_rwsec_done1(int status)
}
}
}
}
- if (++ReqCnt <
CURRENT->current_nr_sectors
) {
+ if (++ReqCnt <
blk_rq_cur_sectors(fd_request)
) {
/* read next sector */
setup_req_params( SelectedDrive );
do_fd_action( SelectedDrive );
}
else {
/* all sectors finished */
/* read next sector */
setup_req_params( SelectedDrive );
do_fd_action( SelectedDrive );
}
else {
/* all sectors finished */
- CURRENT->nr_sectors -= CURRENT->current_nr_sectors;
- CURRENT->sector += CURRENT->current_nr_sectors;
- end_request(CURRENT, 1);
+ fd_end_request_cur(0);
redo_fd_request();
}
return;
redo_fd_request();
}
return;
@@
-1382,7
+1382,7
@@
static void setup_req_params( int drive )
ReqData = ReqBuffer + 512 * ReqCnt;
if (UseTrackbuffer)
ReqData = ReqBuffer + 512 * ReqCnt;
if (UseTrackbuffer)
- read_track = (ReqCmd == READ &&
CURRENT
->errors == 0);
+ read_track = (ReqCmd == READ &&
fd_request
->errors == 0);
else
read_track = 0;
else
read_track = 0;
@@
-1396,25
+1396,27
@@
static void redo_fd_request(void)
int drive, type;
struct atari_floppy_struct *floppy;
int drive, type;
struct atari_floppy_struct *floppy;
- DPRINT(("redo_fd_request:
CURRENT=%p dev=%s CURRENT
->sector=%ld\n",
-
CURRENT, CURRENT ? CURRENT
->rq_disk->disk_name : "",
-
CURRENT ? CURRENT->sector
: 0 ));
+ DPRINT(("redo_fd_request:
fd_request=%p dev=%s fd_request
->sector=%ld\n",
+
fd_request, fd_request ? fd_request
->rq_disk->disk_name : "",
+
fd_request ? blk_rq_pos(fd_request)
: 0 ));
IsFormatting = 0;
repeat:
IsFormatting = 0;
repeat:
+ if (!fd_request) {
+ fd_request = blk_fetch_request(floppy_queue);
+ if (!fd_request)
+ goto the_end;
+ }
- if (!CURRENT)
- goto the_end;
-
- floppy = CURRENT->rq_disk->private_data;
+ floppy = fd_request->rq_disk->private_data;
drive = floppy - unit;
type = floppy->type;
if (!UD.connected) {
/* drive not connected */
printk(KERN_ERR "Unknown Device: fd%d\n", drive );
drive = floppy - unit;
type = floppy->type;
if (!UD.connected) {
/* drive not connected */
printk(KERN_ERR "Unknown Device: fd%d\n", drive );
-
end_request(CURRENT, 0
);
+
fd_end_request_cur(-EIO
);
goto repeat;
}
goto repeat;
}
@@
-1430,12
+1432,12
@@
repeat:
/* user supplied disk type */
if (--type >= NUM_DISK_MINORS) {
printk(KERN_WARNING "fd%d: invalid disk format", drive );
/* user supplied disk type */
if (--type >= NUM_DISK_MINORS) {
printk(KERN_WARNING "fd%d: invalid disk format", drive );
-
end_request(CURRENT, 0
);
+
fd_end_request_cur(-EIO
);
goto repeat;
}
if (minor2disktype[type].drive_types > DriveType) {
printk(KERN_WARNING "fd%d: unsupported disk format", drive );
goto repeat;
}
if (minor2disktype[type].drive_types > DriveType) {
printk(KERN_WARNING "fd%d: unsupported disk format", drive );
-
end_request(CURRENT, 0
);
+
fd_end_request_cur(-EIO
);
goto repeat;
}
type = minor2disktype[type].index;
goto repeat;
}
type = minor2disktype[type].index;
@@
-1444,8
+1446,8
@@
repeat:
UD.autoprobe = 0;
}
UD.autoprobe = 0;
}
- if (
CURRENT->sector
+ 1 > UDT->blocks) {
-
end_request(CURRENT, 0
);
+ if (
blk_rq_pos(fd_request)
+ 1 > UDT->blocks) {
+
fd_end_request_cur(-EIO
);
goto repeat;
}
goto repeat;
}
@@
-1453,9
+1455,9
@@
repeat:
del_timer( &motor_off_timer );
ReqCnt = 0;
del_timer( &motor_off_timer );
ReqCnt = 0;
- ReqCmd = rq_data_dir(
CURRENT
);
- ReqBlock =
CURRENT->sector
;
- ReqBuffer =
CURRENT
->buffer;
+ ReqCmd = rq_data_dir(
fd_request
);
+ ReqBlock =
blk_rq_pos(fd_request)
;
+ ReqBuffer =
fd_request
->buffer;
setup_req_params( drive );
do_fd_action( drive );
setup_req_params( drive );
do_fd_action( drive );
@@
-1483,10
+1485,10
@@
void do_fd_request(struct request_queue * q)
atari_enable_irq( IRQ_MFP_FDC );
}
atari_enable_irq( IRQ_MFP_FDC );
}
-static int fd_ioctl(struct
inode *inode, struct file *filp
,
+static int fd_ioctl(struct
block_device *bdev, fmode_t mode
,
unsigned int cmd, unsigned long param)
{
unsigned int cmd, unsigned long param)
{
- struct gendisk *disk =
inode->i_
bdev->bd_disk;
+ struct gendisk *disk = bdev->bd_disk;
struct atari_floppy_struct *floppy = disk->private_data;
int drive = floppy - unit;
int type = floppy->type;
struct atari_floppy_struct *floppy = disk->private_data;
int drive = floppy - unit;
int type = floppy->type;
@@
-1661,7
+1663,7
@@
static int fd_ioctl(struct inode *inode, struct file *filp,
/* invalidate the buffer track to force a reread */
BufferDrive = -1;
set_bit(drive, &fake_change);
/* invalidate the buffer track to force a reread */
BufferDrive = -1;
set_bit(drive, &fake_change);
- check_disk_change(
inode->i_
bdev);
+ check_disk_change(bdev);
return 0;
default:
return -EINVAL;
return 0;
default:
return -EINVAL;
@@
-1730,7
+1732,7
@@
static int __init fd_test_drive_present( int drive )
timeout = jiffies + 2*HZ+HZ/2;
while (time_before(jiffies, timeout))
timeout = jiffies + 2*HZ+HZ/2;
while (time_before(jiffies, timeout))
- if (!(mfp.par_dt_reg & 0x20))
+ if (!(
st_
mfp.par_dt_reg & 0x20))
break;
status = FDC_READ( FDCREG_STATUS );
break;
status = FDC_READ( FDCREG_STATUS );
@@
-1747,7
+1749,7
@@
static int __init fd_test_drive_present( int drive )
/* dummy seek command to make WP bit accessible */
FDC_WRITE( FDCREG_DATA, 0 );
FDC_WRITE( FDCREG_CMD, FDCCMD_SEEK );
/* dummy seek command to make WP bit accessible */
FDC_WRITE( FDCREG_DATA, 0 );
FDC_WRITE( FDCREG_CMD, FDCCMD_SEEK );
- while( mfp.par_dt_reg & 0x20 )
+ while(
st_
mfp.par_dt_reg & 0x20 )
;
status = FDC_READ( FDCREG_STATUS );
}
;
status = FDC_READ( FDCREG_STATUS );
}
@@
-1804,37
+1806,36
@@
static void __init config_types( void )
* drive with different device numbers.
*/
* drive with different device numbers.
*/
-static int floppy_open(
struct inode *inode, struct file *filp
)
+static int floppy_open(
struct block_device *bdev, fmode_t mode
)
{
{
- struct atari_floppy_struct *p =
inode->i_
bdev->bd_disk->private_data;
- int type =
iminor(inode
) >> 2;
+ struct atari_floppy_struct *p = bdev->bd_disk->private_data;
+ int type =
MINOR(bdev->bd_dev
) >> 2;
DPRINT(("fd_open: type=%d\n",type));
if (p->ref && p->type != type)
return -EBUSY;
DPRINT(("fd_open: type=%d\n",type));
if (p->ref && p->type != type)
return -EBUSY;
- if (p->ref == -1 || (p->ref &&
filp->f_flags & O
_EXCL))
+ if (p->ref == -1 || (p->ref &&
mode & FMODE
_EXCL))
return -EBUSY;
return -EBUSY;
- if (
filp->f_flags & O
_EXCL)
+ if (
mode & FMODE
_EXCL)
p->ref = -1;
else
p->ref++;
p->type = type;
p->ref = -1;
else
p->ref++;
p->type = type;
- if (
filp->f_flags & O
_NDELAY)
+ if (
mode & FMODE
_NDELAY)
return 0;
return 0;
- if (
filp->f_
mode & (FMODE_READ|FMODE_WRITE)) {
- check_disk_change(
inode->i_
bdev);
- if (
filp->f_
mode & FMODE_WRITE) {
+ if (mode & (FMODE_READ|FMODE_WRITE)) {
+ check_disk_change(bdev);
+ if (mode & FMODE_WRITE) {
if (p->wpstat) {
if (p->ref < 0)
p->ref = 0;
else
p->ref--;
if (p->wpstat) {
if (p->ref < 0)
p->ref = 0;
else
p->ref--;
- floppy_release(inode, filp);
return -EROFS;
}
}
return -EROFS;
}
}
@@
-1843,9
+1844,9
@@
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 gendisk *disk, fmode_t mode
)
{
{
- struct atari_floppy_struct *p =
inode->i_bdev->bd_
disk->private_data;
+ struct atari_floppy_struct *p = disk->private_data;
if (p->ref < 0)
p->ref = 0;
else if (!p->ref--) {
if (p->ref < 0)
p->ref = 0;
else if (!p->ref--) {
@@
-1859,7
+1860,7
@@
static struct block_device_operations floppy_fops = {
.owner = THIS_MODULE,
.open = floppy_open,
.release = floppy_release,
.owner = THIS_MODULE,
.open = floppy_open,
.release = floppy_release,
- .
ioctl
= fd_ioctl,
+ .
locked_ioctl
= fd_ioctl,
.media_changed = check_floppy_change,
.revalidate_disk= floppy_revalidate,
};
.media_changed = check_floppy_change,
.revalidate_disk= floppy_revalidate,
};