Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242260
b: refs/heads/master
c: 1a8a74f
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo committed Mar 9, 2011
1 parent be9811b commit 5cbebcb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5b03a1b140e13a28ff6be1526892a9dc538ddef6
refs/heads/master: 1a8a74f03fcde1725ff26520220f3d21dbd8faa1
9 changes: 5 additions & 4 deletions trunk/drivers/block/amiflop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1658,12 +1658,12 @@ static int floppy_release(struct gendisk *disk, fmode_t mode)
}

/*
* floppy-change is never called from an interrupt, so we can relax a bit
* check_events is never called from an interrupt, so we can relax a bit
* here, sleep etc. Note that floppy-on tries to set current_DOR to point
* to the desired drive, but it will probably not survive the sleep if
* several floppies are used at the same time: thus the loop.
*/
static int amiga_floppy_change(struct gendisk *disk)
static unsigned amiga_check_events(struct gendisk *disk, unsigned int clearing)
{
struct amiga_floppy_struct *p = disk->private_data;
int drive = p - unit;
Expand All @@ -1686,7 +1686,7 @@ static int amiga_floppy_change(struct gendisk *disk)
p->dirty = 0;
writepending = 0; /* if this was true before, too bad! */
writefromint = 0;
return 1;
return DISK_EVENT_MEDIA_CHANGE;
}
return 0;
}
Expand All @@ -1697,7 +1697,7 @@ static const struct block_device_operations floppy_fops = {
.release = floppy_release,
.ioctl = fd_ioctl,
.getgeo = fd_getgeo,
.media_changed = amiga_floppy_change,
.check_events = amiga_check_events,
};

static int __init fd_probe_drives(void)
Expand Down Expand Up @@ -1736,6 +1736,7 @@ static int __init fd_probe_drives(void)
disk->major = FLOPPY_MAJOR;
disk->first_minor = drive;
disk->fops = &floppy_fops;
disk->events = DISK_EVENT_MEDIA_CHANGE;
sprintf(disk->disk_name, "fd%d", drive);
disk->private_data = &unit[drive];
set_capacity(disk, 880*2);
Expand Down
14 changes: 8 additions & 6 deletions trunk/drivers/block/ataflop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1324,23 +1324,24 @@ static void finish_fdc_done( int dummy )
* due to unrecognised disk changes.
*/

static int check_floppy_change(struct gendisk *disk)
static unsigned int floppy_check_events(struct gendisk *disk,
unsigned int clearing)
{
struct atari_floppy_struct *p = disk->private_data;
unsigned int drive = p - unit;
if (test_bit (drive, &fake_change)) {
/* simulated change (e.g. after formatting) */
return 1;
return DISK_EVENT_MEDIA_CHANGE;
}
if (test_bit (drive, &changed_floppies)) {
/* surely changed (the WP signal changed at least once) */
return 1;
return DISK_EVENT_MEDIA_CHANGE;
}
if (UD.wpstat) {
/* WP is on -> could be changed: to be sure, buffers should be
* invalidated...
*/
return 1;
return DISK_EVENT_MEDIA_CHANGE;
}

return 0;
Expand Down Expand Up @@ -1570,7 +1571,7 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode,
* or the next access will revalidate - and clear UDT :-(
*/

if (check_floppy_change(disk))
if (floppy_check_events(disk, 0))
floppy_revalidate(disk);

if (UD.flags & FTD_MSG)
Expand Down Expand Up @@ -1904,7 +1905,7 @@ static const struct block_device_operations floppy_fops = {
.open = floppy_unlocked_open,
.release = floppy_release,
.ioctl = fd_ioctl,
.media_changed = check_floppy_change,
.check_events = floppy_check_events,
.revalidate_disk= floppy_revalidate,
};

Expand Down Expand Up @@ -1963,6 +1964,7 @@ static int __init atari_floppy_init (void)
unit[i].disk->first_minor = i;
sprintf(unit[i].disk->disk_name, "fd%d", i);
unit[i].disk->fops = &floppy_fops;
unit[i].disk->events = DISK_EVENT_MEDIA_CHANGE;
unit[i].disk->private_data = &unit[i];
unit[i].disk->queue = blk_init_queue(do_fd_request,
&ataflop_lock);
Expand Down
10 changes: 6 additions & 4 deletions trunk/drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -3770,13 +3770,14 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
/*
* Check if the disk has been changed or if a change has been faked.
*/
static int check_floppy_change(struct gendisk *disk)
static unsigned int floppy_check_events(struct gendisk *disk,
unsigned int clearing)
{
int drive = (long)disk->private_data;

if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
test_bit(FD_VERIFY_BIT, &UDRS->flags))
return 1;
return DISK_EVENT_MEDIA_CHANGE;

if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
lock_fdc(drive, false);
Expand All @@ -3788,7 +3789,7 @@ static int check_floppy_change(struct gendisk *disk)
test_bit(FD_VERIFY_BIT, &UDRS->flags) ||
test_bit(drive, &fake_change) ||
drive_no_geom(drive))
return 1;
return DISK_EVENT_MEDIA_CHANGE;
return 0;
}

Expand Down Expand Up @@ -3898,7 +3899,7 @@ static const struct block_device_operations floppy_fops = {
.release = floppy_release,
.ioctl = fd_ioctl,
.getgeo = fd_getgeo,
.media_changed = check_floppy_change,
.check_events = floppy_check_events,
.revalidate_disk = floppy_revalidate,
};

Expand Down Expand Up @@ -4205,6 +4206,7 @@ static int __init floppy_init(void)
disks[dr]->major = FLOPPY_MAJOR;
disks[dr]->first_minor = TOMINOR(dr);
disks[dr]->fops = &floppy_fops;
disks[dr]->events = DISK_EVENT_MEDIA_CHANGE;
sprintf(disks[dr]->disk_name, "fd%d", dr);

init_timer(&motor_off_timer[dr]);
Expand Down

0 comments on commit 5cbebcb

Please sign in to comment.