Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242259
b: refs/heads/master
c: 5b03a1b
h: refs/heads/master
i:
  242257: 7669947
  242255: 9ad85d6
v: v3
  • Loading branch information
Tejun Heo committed Mar 9, 2011
1 parent a0bc7e2 commit be9811b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 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: 69e02c59a7d962dced8047401b81a8d897e1702e
refs/heads/master: 5b03a1b140e13a28ff6be1526892a9dc538ddef6
10 changes: 6 additions & 4 deletions trunk/drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ static struct cdrom_device_ops ide_cdrom_dops = {
.open = ide_cdrom_open_real,
.release = ide_cdrom_release_real,
.drive_status = ide_cdrom_drive_status,
.media_changed = ide_cdrom_check_media_change_real,
.check_events = ide_cdrom_check_events_real,
.tray_move = ide_cdrom_tray_move,
.lock_door = ide_cdrom_lock_door,
.select_speed = ide_cdrom_select_speed,
Expand Down Expand Up @@ -1702,10 +1702,11 @@ static int idecd_ioctl(struct block_device *bdev, fmode_t mode,
}


static int idecd_media_changed(struct gendisk *disk)
static unsigned int idecd_check_events(struct gendisk *disk,
unsigned int clearing)
{
struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
return cdrom_media_changed(&info->devinfo);
return cdrom_check_events(&info->devinfo, clearing);
}

static int idecd_revalidate_disk(struct gendisk *disk)
Expand All @@ -1723,7 +1724,7 @@ static const struct block_device_operations idecd_ops = {
.open = idecd_open,
.release = idecd_release,
.ioctl = idecd_ioctl,
.media_changed = idecd_media_changed,
.check_events = idecd_check_events,
.revalidate_disk = idecd_revalidate_disk
};

Expand Down Expand Up @@ -1790,6 +1791,7 @@ static int ide_cd_probe(ide_drive_t *drive)
ide_cd_read_toc(drive, &sense);
g->fops = &idecd_ops;
g->flags |= GENHD_FL_REMOVABLE;
g->events = DISK_EVENT_MEDIA_CHANGE;
add_disk(g);
return 0;

Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/ide/ide-cd.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ int cdrom_check_status(ide_drive_t *, struct request_sense *);
int ide_cdrom_open_real(struct cdrom_device_info *, int);
void ide_cdrom_release_real(struct cdrom_device_info *);
int ide_cdrom_drive_status(struct cdrom_device_info *, int);
int ide_cdrom_check_media_change_real(struct cdrom_device_info *, int);
unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *,
unsigned int clearing, int slot_nr);
int ide_cdrom_tray_move(struct cdrom_device_info *, int);
int ide_cdrom_lock_door(struct cdrom_device_info *, int);
int ide_cdrom_select_speed(struct cdrom_device_info *, int);
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/ide/ide-cd_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ int ide_cdrom_drive_status(struct cdrom_device_info *cdi, int slot_nr)
return CDS_DRIVE_NOT_READY;
}

int ide_cdrom_check_media_change_real(struct cdrom_device_info *cdi,
int slot_nr)
unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *cdi,
unsigned int clearing, int slot_nr)
{
ide_drive_t *drive = cdi->handle;
int retval;
Expand All @@ -89,9 +89,9 @@ int ide_cdrom_check_media_change_real(struct cdrom_device_info *cdi,
(void) cdrom_check_status(drive, NULL);
retval = (drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED) ? 1 : 0;
drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED;
return retval;
return retval ? DISK_EVENT_MEDIA_CHANGE : 0;
} else {
return -EINVAL;
return 0;
}
}

Expand Down
14 changes: 8 additions & 6 deletions trunk/drivers/ide/ide-gd.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,22 +285,23 @@ static int ide_gd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
return 0;
}

static int ide_gd_media_changed(struct gendisk *disk)
static unsigned int ide_gd_check_events(struct gendisk *disk,
unsigned int clearing)
{
struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
ide_drive_t *drive = idkp->drive;
int ret;
bool ret;

/* do not scan partitions twice if this is a removable device */
if (drive->dev_flags & IDE_DFLAG_ATTACH) {
drive->dev_flags &= ~IDE_DFLAG_ATTACH;
return 0;
}

ret = !!(drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED);
ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED;
drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED;

return ret;
return ret ? DISK_EVENT_MEDIA_CHANGE : 0;
}

static void ide_gd_unlock_native_capacity(struct gendisk *disk)
Expand All @@ -318,7 +319,7 @@ static int ide_gd_revalidate_disk(struct gendisk *disk)
struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
ide_drive_t *drive = idkp->drive;

if (ide_gd_media_changed(disk))
if (ide_gd_check_events(disk, 0))
drive->disk_ops->get_capacity(drive);

set_capacity(disk, ide_gd_capacity(drive));
Expand All @@ -340,7 +341,7 @@ static const struct block_device_operations ide_gd_ops = {
.release = ide_gd_release,
.ioctl = ide_gd_ioctl,
.getgeo = ide_gd_getgeo,
.media_changed = ide_gd_media_changed,
.check_events = ide_gd_check_events,
.unlock_native_capacity = ide_gd_unlock_native_capacity,
.revalidate_disk = ide_gd_revalidate_disk
};
Expand Down Expand Up @@ -412,6 +413,7 @@ static int ide_gd_probe(ide_drive_t *drive)
if (drive->dev_flags & IDE_DFLAG_REMOVABLE)
g->flags = GENHD_FL_REMOVABLE;
g->fops = &ide_gd_ops;
g->events = DISK_EVENT_MEDIA_CHANGE;
add_disk(g);
return 0;

Expand Down

0 comments on commit be9811b

Please sign in to comment.