#define IDEFLOPPY_VERSION "0.99.newide"
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/cdrom.h>
#include <linux/ide.h>
#include <linux/bitops.h>
-#include <linux/mutex.h>
#include <asm/byteorder.h>
#include <asm/irq.h>
u8 reserved[4];
} idefloppy_mode_parameter_header_t;
-static DEFINE_MUTEX(idefloppy_ref_mutex);
+static DECLARE_MUTEX(idefloppy_ref_sem);
#define to_ide_floppy(obj) container_of(obj, struct ide_floppy_obj, kref)
{
struct ide_floppy_obj *floppy = NULL;
- mutex_lock(&idefloppy_ref_mutex);
+ down(&idefloppy_ref_sem);
floppy = ide_floppy_g(disk);
if (floppy)
kref_get(&floppy->kref);
- mutex_unlock(&idefloppy_ref_mutex);
+ up(&idefloppy_ref_sem);
return floppy;
}
static void ide_floppy_put(struct ide_floppy_obj *floppy)
{
- mutex_lock(&idefloppy_ref_mutex);
+ down(&idefloppy_ref_sem);
kref_put(&floppy->kref, ide_floppy_release);
- mutex_unlock(&idefloppy_ref_mutex);
+ up(&idefloppy_ref_sem);
}
/*
"transferred\n", pc->actually_transferred);
clear_bit(PC_DMA_IN_PROGRESS, &pc->flags);
- local_irq_enable_in_hardirq();
+ local_irq_enable();
if (status.b.check || test_bit(PC_DMA_ERROR, &pc->flags)) {
/* Error detected */
"to send us more data than expected "
"- discarding data\n");
idefloppy_discard_data(drive,bcount.all);
- BUG_ON(HWGROUP(drive)->handler != NULL);
+ if (HWGROUP(drive)->handler != NULL)
+ BUG();
ide_set_handler(drive,
&idefloppy_pc_intr,
IDEFLOPPY_WAIT_CMD,
pc->actually_transferred += bcount.all;
pc->current_position += bcount.all;
- BUG_ON(HWGROUP(drive)->handler != NULL);
+ if (HWGROUP(drive)->handler != NULL)
+ BUG();
ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */
return ide_started;
}
"issuing a packet command\n");
return ide_do_reset(drive);
}
- BUG_ON(HWGROUP(drive)->handler != NULL);
+ if (HWGROUP(drive)->handler != NULL)
+ BUG();
/* Set the interrupt routine */
ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL);
/* Send the actual packet */
* 40 and 50msec work well. idefloppy_pc_intr will not be actually
* used until after the packet is moved in about 50 msec.
*/
- BUG_ON(HWGROUP(drive)->handler != NULL);
+ if (HWGROUP(drive)->handler != NULL)
+ BUG();
ide_set_handler(drive,
&idefloppy_pc_intr, /* service routine for packet command */
floppy->ticks, /* wait this long before "failing" */
debug_log(KERN_INFO "rq_status: %d, dev: %s, flags: %lx, errors: %d\n",
rq->rq_status,
- rq->rq_disk ? rq->rq_disk->disk_name : "?",
+ rq->rq_disk ? rq->rq_disk->disk_name ? "?",
rq->flags, rq->errors);
debug_log(KERN_INFO "sector: %ld, nr_sectors: %ld, "
"current_nr_sectors: %d\n", (long)rq->sector,
g->minors = 1 << PARTN_BITS;
g->driverfs_dev = &drive->gendev;
+ strcpy(g->devfs_name, drive->devfs_name);
g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0;
g->fops = &idefloppy_ops;
drive->attach = 1;