Message ID | 4D44BF64.4060205@simon.arlott.org.uk |
---|---|
State | Not Applicable |
Delegated to: | David Miller |
Headers | show |
Hello, On Sun, Jan 30, 2011 at 01:31:16AM +0000, Simon Arlott wrote: > 93aae17af1172c40c6f74b7294e93a90c3cfaa5d replaced the media_changed op > with the check_events op in drivers/scsi/sr.c > > All users that check for the CDC_MEDIA_CHANGED capability try both > the check_events op and the media_changed op, but register_cdrom() > was requiring media_changed. > > This patch fixes the capability checking and removes a redundant > check that media_changed != NULL. > > The cdrom_select_disc ioctl is also using the two operations, so > they should be required for CDC_SELECT_DISC too. First of all, thanks a lot for fixing this. Just minor nits below. > diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c > index 14033a3..4716d76 100644 > --- a/drivers/cdrom/cdrom.c > +++ b/drivers/cdrom/cdrom.c > @@ -409,7 +409,9 @@ int register_cdrom(struct cdrom_device_info *cdi) > } > > ENSURE(drive_status, CDC_DRIVE_STATUS ); > - ENSURE(media_changed, CDC_MEDIA_CHANGED); > + if (cdo->check_events == NULL && cdo->media_changed == NULL) { > + *change_capability = ~(CDC_MEDIA_CHANGED | CDC_SELECT_DISC); > + } Can we lose the unnecessary {}? > ENSURE(tray_move, CDC_CLOSE_TRAY | CDC_OPEN_TRAY); > ENSURE(lock_door, CDC_LOCK); > ENSURE(select_speed, CDC_SELECT_SPEED); > @@ -1471,7 +1473,7 @@ int cdrom_media_changed(struct cdrom_device_info *cdi) > /* This talks to the VFS, which doesn't like errors - just 1 or 0. > * Returning "0" is always safe (media hasn't been changed). Do that > * if the low-level cdrom driver dosn't support media changed. */ > - if (cdi == NULL || cdi->ops->media_changed == NULL) > + if (cdi == NULL) This change is probably not necessary as cdrom_media_changed() is only called from drivers which implement media_changed. I don't think it's gonna break anything but the whole media_changed stuff is scheduled for removal anyway, so I think it would be better to keep the changes minimal. Thank you.
Hello. On 30-01-2011 4:31, Simon Arlott wrote: > 93aae17af1172c40c6f74b7294e93a90c3cfaa5d replaced the media_changed op Please specify the commit summary in parens, as asked by Linus. > with the check_events op in drivers/scsi/sr.c > All users that check for the CDC_MEDIA_CHANGED capability try both > the check_events op and the media_changed op, but register_cdrom() > was requiring media_changed. > This patch fixes the capability checking and removes a redundant > check that media_changed != NULL. > The cdrom_select_disc ioctl is also using the two operations, so > they should be required for CDC_SELECT_DISC too. > Signed-off-by: Simon Arlott<simon@fire.lp0.eu> > Cc: Jens Axboe<axboe@kernel.dk> > Cc: Tejun Heo<tj@kernel.org> > Cc: Kay Sievers<kay.sievers@vrfy.org> [...] > diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c > index 14033a3..4716d76 100644 > --- a/drivers/cdrom/cdrom.c > +++ b/drivers/cdrom/cdrom.c > @@ -409,7 +409,9 @@ int register_cdrom(struct cdrom_device_info *cdi) > } > > ENSURE(drive_status, CDC_DRIVE_STATUS ); > - ENSURE(media_changed, CDC_MEDIA_CHANGED); > + if (cdo->check_events == NULL && cdo->media_changed == NULL) { > + *change_capability = ~(CDC_MEDIA_CHANGED | CDC_SELECT_DISC); > + } {} are not needed here. I think checkstatus.pl should detect this... WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 14033a3..4716d76 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -409,7 +409,9 @@ int register_cdrom(struct cdrom_device_info *cdi) } ENSURE(drive_status, CDC_DRIVE_STATUS ); - ENSURE(media_changed, CDC_MEDIA_CHANGED); + if (cdo->check_events == NULL && cdo->media_changed == NULL) { + *change_capability = ~(CDC_MEDIA_CHANGED | CDC_SELECT_DISC); + } ENSURE(tray_move, CDC_CLOSE_TRAY | CDC_OPEN_TRAY); ENSURE(lock_door, CDC_LOCK); ENSURE(select_speed, CDC_SELECT_SPEED); @@ -1471,7 +1473,7 @@ int cdrom_media_changed(struct cdrom_device_info *cdi) /* This talks to the VFS, which doesn't like errors - just 1 or 0. * Returning "0" is always safe (media hasn't been changed). Do that * if the low-level cdrom driver dosn't support media changed. */ - if (cdi == NULL || cdi->ops->media_changed == NULL) + if (cdi == NULL) return 0; if (!CDROM_CAN(CDC_MEDIA_CHANGED)) return 0;
93aae17af1172c40c6f74b7294e93a90c3cfaa5d replaced the media_changed op with the check_events op in drivers/scsi/sr.c All users that check for the CDC_MEDIA_CHANGED capability try both the check_events op and the media_changed op, but register_cdrom() was requiring media_changed. This patch fixes the capability checking and removes a redundant check that media_changed != NULL. The cdrom_select_disc ioctl is also using the two operations, so they should be required for CDC_SELECT_DISC too. Signed-off-by: Simon Arlott <simon@fire.lp0.eu> Cc: Jens Axboe <axboe@kernel.dk> Cc: Tejun Heo <tj@kernel.org> Cc: Kay Sievers <kay.sievers@vrfy.org> --- drivers/cdrom/cdrom.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)