aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/paride
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
commitb1b56b93f331bd61492fdb99e7986f7a528ca730 (patch)
treee3740806510666f11d62befd0d7d917be1bc573d /drivers/block/paride
parent1c27030bd21e7e2c68ef5be9f28c63778cf4b27f (diff)
paride: Convert to bdops->check_events()
Convert paride drivers from ->media_changed() to ->check_events(). pcd and pd buffer and clear events after reporting; however, pf unconditionally reports MEDIA_CHANGE and will generate spurious events when polled. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Jens Axboe <axboe@kernel.dk> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Tim Waugh <tim@cyberelk.net>
Diffstat (limited to 'drivers/block/paride')
-rw-r--r--drivers/block/paride/pcd.c18
-rw-r--r--drivers/block/paride/pd.c7
-rw-r--r--drivers/block/paride/pf.c10
3 files changed, 21 insertions, 14 deletions
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 62cec6afd7ad..2f2ccf686251 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -172,7 +172,8 @@ module_param_array(drive3, int, NULL, 0);
172static int pcd_open(struct cdrom_device_info *cdi, int purpose); 172static int pcd_open(struct cdrom_device_info *cdi, int purpose);
173static void pcd_release(struct cdrom_device_info *cdi); 173static void pcd_release(struct cdrom_device_info *cdi);
174static int pcd_drive_status(struct cdrom_device_info *cdi, int slot_nr); 174static int pcd_drive_status(struct cdrom_device_info *cdi, int slot_nr);
175static int pcd_media_changed(struct cdrom_device_info *cdi, int slot_nr); 175static unsigned int pcd_check_events(struct cdrom_device_info *cdi,
176 unsigned int clearing, int slot_nr);
176static int pcd_tray_move(struct cdrom_device_info *cdi, int position); 177static int pcd_tray_move(struct cdrom_device_info *cdi, int position);
177static int pcd_lock_door(struct cdrom_device_info *cdi, int lock); 178static int pcd_lock_door(struct cdrom_device_info *cdi, int lock);
178static int pcd_drive_reset(struct cdrom_device_info *cdi); 179static int pcd_drive_reset(struct cdrom_device_info *cdi);
@@ -257,10 +258,11 @@ static int pcd_block_ioctl(struct block_device *bdev, fmode_t mode,
257 return ret; 258 return ret;
258} 259}
259 260
260static int pcd_block_media_changed(struct gendisk *disk) 261static unsigned int pcd_block_check_events(struct gendisk *disk,
262 unsigned int clearing)
261{ 263{
262 struct pcd_unit *cd = disk->private_data; 264 struct pcd_unit *cd = disk->private_data;
263 return cdrom_media_changed(&cd->info); 265 return cdrom_check_events(&cd->info, clearing);
264} 266}
265 267
266static const struct block_device_operations pcd_bdops = { 268static const struct block_device_operations pcd_bdops = {
@@ -268,14 +270,14 @@ static const struct block_device_operations pcd_bdops = {
268 .open = pcd_block_open, 270 .open = pcd_block_open,
269 .release = pcd_block_release, 271 .release = pcd_block_release,
270 .ioctl = pcd_block_ioctl, 272 .ioctl = pcd_block_ioctl,
271 .media_changed = pcd_block_media_changed, 273 .check_events = pcd_block_check_events,
272}; 274};
273 275
274static struct cdrom_device_ops pcd_dops = { 276static struct cdrom_device_ops pcd_dops = {
275 .open = pcd_open, 277 .open = pcd_open,
276 .release = pcd_release, 278 .release = pcd_release,
277 .drive_status = pcd_drive_status, 279 .drive_status = pcd_drive_status,
278 .media_changed = pcd_media_changed, 280 .check_events = pcd_check_events,
279 .tray_move = pcd_tray_move, 281 .tray_move = pcd_tray_move,
280 .lock_door = pcd_lock_door, 282 .lock_door = pcd_lock_door,
281 .get_mcn = pcd_get_mcn, 283 .get_mcn = pcd_get_mcn,
@@ -318,6 +320,7 @@ static void pcd_init_units(void)
318 disk->first_minor = unit; 320 disk->first_minor = unit;
319 strcpy(disk->disk_name, cd->name); /* umm... */ 321 strcpy(disk->disk_name, cd->name); /* umm... */
320 disk->fops = &pcd_bdops; 322 disk->fops = &pcd_bdops;
323 disk->events = DISK_EVENT_MEDIA_CHANGE;
321 } 324 }
322} 325}
323 326
@@ -502,13 +505,14 @@ static int pcd_packet(struct cdrom_device_info *cdi, struct packet_command *cgc)
502 505
503#define DBMSG(msg) ((verbose>1)?(msg):NULL) 506#define DBMSG(msg) ((verbose>1)?(msg):NULL)
504 507
505static int pcd_media_changed(struct cdrom_device_info *cdi, int slot_nr) 508static unsigned int pcd_check_events(struct cdrom_device_info *cdi,
509 unsigned int clearing, int slot_nr)
506{ 510{
507 struct pcd_unit *cd = cdi->handle; 511 struct pcd_unit *cd = cdi->handle;
508 int res = cd->changed; 512 int res = cd->changed;
509 if (res) 513 if (res)
510 cd->changed = 0; 514 cd->changed = 0;
511 return res; 515 return res ? DISK_EVENT_MEDIA_CHANGE : 0;
512} 516}
513 517
514static int pcd_lock_door(struct cdrom_device_info *cdi, int lock) 518static int pcd_lock_door(struct cdrom_device_info *cdi, int lock)
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index c0ee1558b9bb..21dfdb776869 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -794,7 +794,7 @@ static int pd_release(struct gendisk *p, fmode_t mode)
794 return 0; 794 return 0;
795} 795}
796 796
797static int pd_check_media(struct gendisk *p) 797static unsigned int pd_check_events(struct gendisk *p, unsigned int clearing)
798{ 798{
799 struct pd_unit *disk = p->private_data; 799 struct pd_unit *disk = p->private_data;
800 int r; 800 int r;
@@ -803,7 +803,7 @@ static int pd_check_media(struct gendisk *p)
803 pd_special_command(disk, pd_media_check); 803 pd_special_command(disk, pd_media_check);
804 r = disk->changed; 804 r = disk->changed;
805 disk->changed = 0; 805 disk->changed = 0;
806 return r; 806 return r ? DISK_EVENT_MEDIA_CHANGE : 0;
807} 807}
808 808
809static int pd_revalidate(struct gendisk *p) 809static int pd_revalidate(struct gendisk *p)
@@ -822,7 +822,7 @@ static const struct block_device_operations pd_fops = {
822 .release = pd_release, 822 .release = pd_release,
823 .ioctl = pd_ioctl, 823 .ioctl = pd_ioctl,
824 .getgeo = pd_getgeo, 824 .getgeo = pd_getgeo,
825 .media_changed = pd_check_media, 825 .check_events = pd_check_events,
826 .revalidate_disk= pd_revalidate 826 .revalidate_disk= pd_revalidate
827}; 827};
828 828
@@ -837,6 +837,7 @@ static void pd_probe_drive(struct pd_unit *disk)
837 p->fops = &pd_fops; 837 p->fops = &pd_fops;
838 p->major = major; 838 p->major = major;
839 p->first_minor = (disk - pd) << PD_BITS; 839 p->first_minor = (disk - pd) << PD_BITS;
840 p->events = DISK_EVENT_MEDIA_CHANGE;
840 disk->gd = p; 841 disk->gd = p;
841 p->private_data = disk; 842 p->private_data = disk;
842 p->queue = pd_queue; 843 p->queue = pd_queue;
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index 635f25dd9e10..7adeb1edbf43 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -243,7 +243,8 @@ static struct pf_unit units[PF_UNITS];
243static int pf_identify(struct pf_unit *pf); 243static int pf_identify(struct pf_unit *pf);
244static void pf_lock(struct pf_unit *pf, int func); 244static void pf_lock(struct pf_unit *pf, int func);
245static void pf_eject(struct pf_unit *pf); 245static void pf_eject(struct pf_unit *pf);
246static int pf_check_media(struct gendisk *disk); 246static unsigned int pf_check_events(struct gendisk *disk,
247 unsigned int clearing);
247 248
248static char pf_scratch[512]; /* scratch block buffer */ 249static char pf_scratch[512]; /* scratch block buffer */
249 250
@@ -270,7 +271,7 @@ static const struct block_device_operations pf_fops = {
270 .release = pf_release, 271 .release = pf_release,
271 .ioctl = pf_ioctl, 272 .ioctl = pf_ioctl,
272 .getgeo = pf_getgeo, 273 .getgeo = pf_getgeo,
273 .media_changed = pf_check_media, 274 .check_events = pf_check_events,
274}; 275};
275 276
276static void __init pf_init_units(void) 277static void __init pf_init_units(void)
@@ -293,6 +294,7 @@ static void __init pf_init_units(void)
293 disk->first_minor = unit; 294 disk->first_minor = unit;
294 strcpy(disk->disk_name, pf->name); 295 strcpy(disk->disk_name, pf->name);
295 disk->fops = &pf_fops; 296 disk->fops = &pf_fops;
297 disk->events = DISK_EVENT_MEDIA_CHANGE;
296 if (!(*drives[unit])[D_PRT]) 298 if (!(*drives[unit])[D_PRT])
297 pf_drive_count++; 299 pf_drive_count++;
298 } 300 }
@@ -377,9 +379,9 @@ static int pf_release(struct gendisk *disk, fmode_t mode)
377 379
378} 380}
379 381
380static int pf_check_media(struct gendisk *disk) 382static unsigned int pf_check_events(struct gendisk *disk, unsigned int clearing)
381{ 383{
382 return 1; 384 return DISK_EVENT_MEDIA_CHANGE;
383} 385}
384 386
385static inline int status_reg(struct pf_unit *pf) 387static inline int status_reg(struct pf_unit *pf)