aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/ub.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-03-09 13:54:28 -0500
committerTejun Heo <tj@kernel.org>2011-03-09 13:54:28 -0500
commitaaa7c01546d3dc944f5758f671284177131ccce3 (patch)
treec5632ea8cd538740096db077f52573e3f3b37008 /drivers/block/ub.c
parent4bbde77787270e17418dd32c7eb32e42ad16cfc7 (diff)
ub: Convert to bdops->check_events()
Convert from ->media_changed() to ->check_events(). ub buffers media changed state and clears it on revalidation. It will behave correctly with kernel event polling. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Jens Axboe <axboe@kernel.dk> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Pete Zaitcev <zaitcev@redhat.com>
Diffstat (limited to 'drivers/block/ub.c')
-rw-r--r--drivers/block/ub.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 9ae3bb713286..68b9430c7cfe 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -1788,7 +1788,8 @@ static int ub_bd_revalidate(struct gendisk *disk)
1788 * 1788 *
1789 * The return code is bool! 1789 * The return code is bool!
1790 */ 1790 */
1791static int ub_bd_media_changed(struct gendisk *disk) 1791static unsigned int ub_bd_check_events(struct gendisk *disk,
1792 unsigned int clearing)
1792{ 1793{
1793 struct ub_lun *lun = disk->private_data; 1794 struct ub_lun *lun = disk->private_data;
1794 1795
@@ -1806,10 +1807,10 @@ static int ub_bd_media_changed(struct gendisk *disk)
1806 */ 1807 */
1807 if (ub_sync_tur(lun->udev, lun) != 0) { 1808 if (ub_sync_tur(lun->udev, lun) != 0) {
1808 lun->changed = 1; 1809 lun->changed = 1;
1809 return 1; 1810 return DISK_EVENT_MEDIA_CHANGE;
1810 } 1811 }
1811 1812
1812 return lun->changed; 1813 return lun->changed ? DISK_EVENT_MEDIA_CHANGE : 0;
1813} 1814}
1814 1815
1815static const struct block_device_operations ub_bd_fops = { 1816static const struct block_device_operations ub_bd_fops = {
@@ -1817,7 +1818,7 @@ static const struct block_device_operations ub_bd_fops = {
1817 .open = ub_bd_unlocked_open, 1818 .open = ub_bd_unlocked_open,
1818 .release = ub_bd_release, 1819 .release = ub_bd_release,
1819 .ioctl = ub_bd_ioctl, 1820 .ioctl = ub_bd_ioctl,
1820 .media_changed = ub_bd_media_changed, 1821 .check_events = ub_bd_check_events,
1821 .revalidate_disk = ub_bd_revalidate, 1822 .revalidate_disk = ub_bd_revalidate,
1822}; 1823};
1823 1824
@@ -2333,6 +2334,7 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum)
2333 disk->major = UB_MAJOR; 2334 disk->major = UB_MAJOR;
2334 disk->first_minor = lun->id * UB_PARTS_PER_LUN; 2335 disk->first_minor = lun->id * UB_PARTS_PER_LUN;
2335 disk->fops = &ub_bd_fops; 2336 disk->fops = &ub_bd_fops;
2337 disk->events = DISK_EVENT_MEDIA_CHANGE;
2336 disk->private_data = lun; 2338 disk->private_data = lun;
2337 disk->driverfs_dev = &sc->intf->dev; 2339 disk->driverfs_dev = &sc->intf->dev;
2338 2340