diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/ide/ide-cd.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r-- | drivers/ide/ide-cd.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 31fc76960a8f..04b09564bfa9 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/timer.h> | 32 | #include <linux/timer.h> |
33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
36 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
37 | #include <linux/errno.h> | 36 | #include <linux/errno.h> |
@@ -52,6 +51,7 @@ | |||
52 | 51 | ||
53 | #include "ide-cd.h" | 52 | #include "ide-cd.h" |
54 | 53 | ||
54 | static DEFINE_MUTEX(ide_cd_mutex); | ||
55 | static DEFINE_MUTEX(idecd_ref_mutex); | 55 | static DEFINE_MUTEX(idecd_ref_mutex); |
56 | 56 | ||
57 | static void ide_cd_release(struct device *); | 57 | static void ide_cd_release(struct device *); |
@@ -258,17 +258,10 @@ static int ide_cd_breathe(ide_drive_t *drive, struct request *rq) | |||
258 | if (time_after(jiffies, info->write_timeout)) | 258 | if (time_after(jiffies, info->write_timeout)) |
259 | return 0; | 259 | return 0; |
260 | else { | 260 | else { |
261 | struct request_queue *q = drive->queue; | ||
262 | unsigned long flags; | ||
263 | |||
264 | /* | 261 | /* |
265 | * take a breather relying on the unplug timer to kick us again | 262 | * take a breather |
266 | */ | 263 | */ |
267 | 264 | blk_delay_queue(drive->queue, 1); | |
268 | spin_lock_irqsave(q->queue_lock, flags); | ||
269 | blk_plug_device(q); | ||
270 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
271 | |||
272 | return 1; | 265 | return 1; |
273 | } | 266 | } |
274 | } | 267 | } |
@@ -785,7 +778,8 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
785 | sector_t block) | 778 | sector_t block) |
786 | { | 779 | { |
787 | struct ide_cmd cmd; | 780 | struct ide_cmd cmd; |
788 | int uptodate = 0, nsectors; | 781 | int uptodate = 0; |
782 | unsigned int nsectors; | ||
789 | 783 | ||
790 | ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu", | 784 | ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu", |
791 | rq->cmd[0], (unsigned long long)block); | 785 | rq->cmd[0], (unsigned long long)block); |
@@ -1177,7 +1171,7 @@ static struct cdrom_device_ops ide_cdrom_dops = { | |||
1177 | .open = ide_cdrom_open_real, | 1171 | .open = ide_cdrom_open_real, |
1178 | .release = ide_cdrom_release_real, | 1172 | .release = ide_cdrom_release_real, |
1179 | .drive_status = ide_cdrom_drive_status, | 1173 | .drive_status = ide_cdrom_drive_status, |
1180 | .media_changed = ide_cdrom_check_media_change_real, | 1174 | .check_events = ide_cdrom_check_events_real, |
1181 | .tray_move = ide_cdrom_tray_move, | 1175 | .tray_move = ide_cdrom_tray_move, |
1182 | .lock_door = ide_cdrom_lock_door, | 1176 | .lock_door = ide_cdrom_lock_door, |
1183 | .select_speed = ide_cdrom_select_speed, | 1177 | .select_speed = ide_cdrom_select_speed, |
@@ -1514,8 +1508,6 @@ static int ide_cdrom_setup(ide_drive_t *drive) | |||
1514 | blk_queue_dma_alignment(q, 31); | 1508 | blk_queue_dma_alignment(q, 31); |
1515 | blk_queue_update_dma_pad(q, 15); | 1509 | blk_queue_update_dma_pad(q, 15); |
1516 | 1510 | ||
1517 | q->unplug_delay = max((1 * HZ) / 1000, 1); | ||
1518 | |||
1519 | drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED; | 1511 | drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED; |
1520 | drive->atapi_flags = IDE_AFLAG_NO_EJECT | ide_cd_flags(id); | 1512 | drive->atapi_flags = IDE_AFLAG_NO_EJECT | ide_cd_flags(id); |
1521 | 1513 | ||
@@ -1602,7 +1594,7 @@ static int idecd_open(struct block_device *bdev, fmode_t mode) | |||
1602 | struct cdrom_info *info; | 1594 | struct cdrom_info *info; |
1603 | int rc = -ENXIO; | 1595 | int rc = -ENXIO; |
1604 | 1596 | ||
1605 | lock_kernel(); | 1597 | mutex_lock(&ide_cd_mutex); |
1606 | info = ide_cd_get(bdev->bd_disk); | 1598 | info = ide_cd_get(bdev->bd_disk); |
1607 | if (!info) | 1599 | if (!info) |
1608 | goto out; | 1600 | goto out; |
@@ -1611,7 +1603,7 @@ static int idecd_open(struct block_device *bdev, fmode_t mode) | |||
1611 | if (rc < 0) | 1603 | if (rc < 0) |
1612 | ide_cd_put(info); | 1604 | ide_cd_put(info); |
1613 | out: | 1605 | out: |
1614 | unlock_kernel(); | 1606 | mutex_unlock(&ide_cd_mutex); |
1615 | return rc; | 1607 | return rc; |
1616 | } | 1608 | } |
1617 | 1609 | ||
@@ -1619,11 +1611,11 @@ static int idecd_release(struct gendisk *disk, fmode_t mode) | |||
1619 | { | 1611 | { |
1620 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); | 1612 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); |
1621 | 1613 | ||
1622 | lock_kernel(); | 1614 | mutex_lock(&ide_cd_mutex); |
1623 | cdrom_release(&info->devinfo, mode); | 1615 | cdrom_release(&info->devinfo, mode); |
1624 | 1616 | ||
1625 | ide_cd_put(info); | 1617 | ide_cd_put(info); |
1626 | unlock_kernel(); | 1618 | mutex_unlock(&ide_cd_mutex); |
1627 | 1619 | ||
1628 | return 0; | 1620 | return 0; |
1629 | } | 1621 | } |
@@ -1694,18 +1686,19 @@ static int idecd_ioctl(struct block_device *bdev, fmode_t mode, | |||
1694 | { | 1686 | { |
1695 | int ret; | 1687 | int ret; |
1696 | 1688 | ||
1697 | lock_kernel(); | 1689 | mutex_lock(&ide_cd_mutex); |
1698 | ret = idecd_locked_ioctl(bdev, mode, cmd, arg); | 1690 | ret = idecd_locked_ioctl(bdev, mode, cmd, arg); |
1699 | unlock_kernel(); | 1691 | mutex_unlock(&ide_cd_mutex); |
1700 | 1692 | ||
1701 | return ret; | 1693 | return ret; |
1702 | } | 1694 | } |
1703 | 1695 | ||
1704 | 1696 | ||
1705 | static int idecd_media_changed(struct gendisk *disk) | 1697 | static unsigned int idecd_check_events(struct gendisk *disk, |
1698 | unsigned int clearing) | ||
1706 | { | 1699 | { |
1707 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); | 1700 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); |
1708 | return cdrom_media_changed(&info->devinfo); | 1701 | return cdrom_check_events(&info->devinfo, clearing); |
1709 | } | 1702 | } |
1710 | 1703 | ||
1711 | static int idecd_revalidate_disk(struct gendisk *disk) | 1704 | static int idecd_revalidate_disk(struct gendisk *disk) |
@@ -1723,7 +1716,7 @@ static const struct block_device_operations idecd_ops = { | |||
1723 | .open = idecd_open, | 1716 | .open = idecd_open, |
1724 | .release = idecd_release, | 1717 | .release = idecd_release, |
1725 | .ioctl = idecd_ioctl, | 1718 | .ioctl = idecd_ioctl, |
1726 | .media_changed = idecd_media_changed, | 1719 | .check_events = idecd_check_events, |
1727 | .revalidate_disk = idecd_revalidate_disk | 1720 | .revalidate_disk = idecd_revalidate_disk |
1728 | }; | 1721 | }; |
1729 | 1722 | ||
@@ -1789,7 +1782,7 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
1789 | 1782 | ||
1790 | ide_cd_read_toc(drive, &sense); | 1783 | ide_cd_read_toc(drive, &sense); |
1791 | g->fops = &idecd_ops; | 1784 | g->fops = &idecd_ops; |
1792 | g->flags |= GENHD_FL_REMOVABLE; | 1785 | g->flags |= GENHD_FL_REMOVABLE | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; |
1793 | add_disk(g); | 1786 | add_disk(g); |
1794 | return 0; | 1787 | return 0; |
1795 | 1788 | ||