#include <scsi/scsi_ioctl.h>
#include <linux/hdreg.h> /* for HDIO_GETGEO */
#include <linux/blkpg.h>
+#include <linux/buffer_head.h>
#include <asm/setup.h>
#include <asm/pgtable.h>
static int acsi_change_blk_size( int target, int lun);
static int acsi_mode_sense( int target, int lun, SENSE_DATA *sd );
static void acsi_geninit(void);
-static int revalidate_acsidisk( int dev, int maxusage );
-static int acsi_revalidate (dev_t);
+static int revalidate_acsidisk( kdev_t dev, int maxusage );
+static int acsi_revalidate (kdev_t);
/************************* End of Prototypes **************************/
-struct timer_list acsi_timer = { NULL, NULL, 0, 0, acsi_times_out };
+struct timer_list acsi_timer = { function: acsi_times_out };
#ifdef CONFIG_ATARI_SLM
status = acsi_getstatus();
if (status != 0) {
- int dev = DEVICE_NR(minor(CURRENT->rq_dev));
+ int dev = minor(CURRENT->rq_dev);
printk( KERN_ERR "ad%c: ", dev+'a' );
if (!acsi_reqsense( acsi_buffer, acsi_info[dev].target,
acsi_info[dev].lun))
status = acsi_getstatus();
if (status != 0) {
- int dev = DEVICE_NR(minor(CURRENT->rq_dev));
+ int dev = minor(CURRENT->rq_dev);
printk( KERN_ERR "ad%c: ", dev+'a' );
if (!acsi_reqsense( acsi_buffer, acsi_info[dev].target,
acsi_info[dev].lun))
return;
}
- if (MAJOR(CURRENT->rq_dev) != MAJOR_NR)
+ if (major(CURRENT->rq_dev) != MAJOR_NR)
panic(DEVICE_NAME ": request list destroyed");
if (CURRENT->bh) {
if (!CURRENT->bh && !buffer_locked(CURRENT->bh))
dev = minor(CURRENT->rq_dev);
block = CURRENT->sector;
- if (DEVICE_NR(dev) >= NDevices ||
+ if (dev >= NDevices ||
block+CURRENT->nr_sectors >= acsi_part[dev].nr_sects) {
#ifdef DEBUG
printk( "ad%c: attempted access for blocks %d...%ld past end of device at block %ld.\n",
- DEVICE_NR(dev)+'a',
+ dev+'a',
block, block + CURRENT->nr_sectors - 1,
acsi_part[dev].nr_sects);
#endif
end_request(CURRENT, 0);
goto repeat;
}
- if (acsi_info[DEVICE_NR(dev)].changed) {
+ if (acsi_info[dev].changed) {
printk( KERN_NOTICE "ad%c: request denied because cartridge has "
- "been changed.\n", DEVICE_NR(dev)+'a' );
+ "been changed.\n", dev+'a' );
end_request(CURRENT, 0);
goto repeat;
}
- target = acsi_info[DEVICE_NR(dev)].target;
- lun = acsi_info[DEVICE_NR(dev)].lun;
+ target = acsi_info[dev].target;
+ lun = acsi_info[dev].lun;
/* Find out how many sectors should be transferred from/to
* consecutive buffers and thus can be done with a single command.
CurrentBuffer = buffer;
CurrentNSect = nsect;
- if (CURRENT->cmd == WRITE) {
+ if (rq_data_dir(CURRENT) == WRITE) {
CMDSET_TARG_LUN( write_cmd, target, lun );
CMDSET_BLOCK( write_cmd, block );
CMDSET_LEN( write_cmd, nsect );
SET_TIMER();
return;
}
- if (CURRENT->cmd == READ) {
+ if (rq_data_dir(CURRENT) == READ) {
CMDSET_TARG_LUN( read_cmd, target, lun );
CMDSET_BLOCK( read_cmd, block );
CMDSET_LEN( read_cmd, nsect );
static int acsi_ioctl( struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg )
-{ int dev;
+{
+ dev_t dev;
if (!inode)
return -EINVAL;
- dev = DEVICE_NR(minor(inode->i_rdev));
+ dev = minor(inode->i_rdev);
if (dev >= NDevices)
return -EINVAL;
switch (cmd) {
int device;
struct acsi_info_struct *aip;
- device = DEVICE_NR(minor(inode->i_rdev));
+ device = minor(inode->i_rdev);
if (device >= NDevices)
return -ENXIO;
aip = &acsi_info[device];
static int acsi_release( struct inode * inode, struct file * file )
{
- int device = DEVICE_NR(minor(inode->i_rdev));
+ int device = minor(inode->i_rdev);
if (--access_count[device] == 0 && acsi_info[device].removable)
acsi_prevent_removal(device, 0);
return( 0 );
stdma_release();
}
-static int acsi_media_change (dev_t dev)
+static int acsi_media_change (kdev_t dev)
{
- int device = DEVICE_NR(minor(dev));
+ int device = minor(dev);
struct acsi_info_struct *aip;
aip = &acsi_info[device];
*
*/
-static int revalidate_acsidisk( int dev, int maxusage )
+static int revalidate_acsidisk(kdev_t dev, int maxusage )
{
int device;
struct gendisk * gdev;
int res;
struct acsi_info_struct *aip;
- device = DEVICE_NR(minor(dev));
+ device = minor(dev);
aip = &acsi_info[device];
gdev = &GENDISK_STRUCT;
}
-static int acsi_revalidate (dev_t dev)
+static int acsi_revalidate (kdev_t dev)
{
return revalidate_acsidisk (dev, 0);
}
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/init.h>
+#include <linux/buffer_head.h> /* for invalidate_buffers() */
#include <asm/setup.h>
#include <asm/system.h>
static void fd_select_drive( int drive );
static void fd_deselect( void );
static void fd_motor_off_timer( unsigned long dummy );
-static void check_change( void );
+static void check_change( unsigned long dummy );
static __inline__ void set_head_settle_flag( void );
static __inline__ int get_head_settle_flag( void );
static void floppy_irq (int irq, void *dummy, struct pt_regs *fp);
static void fd_times_out( unsigned long dummy );
static void finish_fdc( void );
static void finish_fdc_done( int dummy );
-static void floppy_off( unsigned int nr);
static __inline__ void copy_buffer( void *from, void *to);
static void setup_req_params( int drive );
static void redo_fd_request( void);
* as possible) and keep track of the current state of the write protection.
*/
-static void check_change( void )
+static void check_change( unsigned long dummy )
{
static int drive = 0;
static int fd_ref[4] = { 0,0,0,0 };
static int fd_device[4] = { 0,0,0,0 };
-/* dummy for blk.h */
-static void floppy_off( unsigned int nr) {}
-
/* The detection of disk changes is a dark chapter in Atari history :-(
* Because the "Drive ready" signal isn't present in the Atari
if (major(CURRENT->rq_dev) != MAJOR_NR)
panic(DEVICE_NAME ": request list destroyed");
- if (CURRENT->bh && !buffer_locked(CURRENT->bh))
- panic(DEVICE_NAME ": block not locked");
-
device = minor(CURRENT->rq_dev);
drive = device & 3;
type = device >> 2;
del_timer( &motor_off_timer );
ReqCnt = 0;
- ReqCmd = CURRENT->cmd;
+ ReqCmd = rq_data_dir(CURRENT);
ReqBlock = CURRENT->sector;
ReqBuffer = CURRENT->buffer;
setup_req_params( drive );
UseTrackbuffer ? "" : "no ");
config_types();
- (void)do_floppy; /* avoid warning about unused variable */
return 0;
}