@@ -204,6 +204,11 @@ static int sr_suspend(struct device *dev, pm_message_t msg)
if (!suspend)
return -EBUSY;
+ if (cd->device->can_power_off) {
+ cd->disk_events_blocked = 1;
+ disk_block_events(cd->disk);
+ }
+
return 0;
}
@@ -224,6 +229,11 @@ static int sr_resume(struct device *dev)
sr_tray_move(&cd->cdi, 1);
}
+ if (cd->disk_events_blocked) {
+ cd->disk_events_blocked = 0;
+ disk_unblock_events(cd->disk);
+ }
+
return 0;
}
@@ -41,6 +41,7 @@ typedef struct scsi_cd {
unsigned readcd_known:1; /* drive supports READ_CD (0xbe) */
unsigned readcd_cdda:1; /* reading audio data using READ_CD */
unsigned media_present:1; /* media is present */
+ unsigned disk_events_blocked:1; /* disk events is blocked */
/* GET_EVENT spurious event handling, blk layer guarantees exclusion */
int tur_mismatch; /* nr of get_event TUR mismatches */