When ODD is runtime suspended and if it can be powered off(reflected by the can_power_off flag), we will block events checking for it so that it can stay in powered off state until resumed by: 1 user pressing the eject button or inserting a disc; 2 software opening the block device. But not by events checking that normally occurs every 2 seconds. Old versions of udisk will poll the ODD periodically, so it is advised to inhibit the polling: $ udisks --inhibit-polling /dev/sr0 Signed-off-by: Aaron Lu <aaron.lu@xxxxxxxxx> --- drivers/scsi/sr.c | 10 ++++++++++ drivers/scsi/sr.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 04a658b..1acfe0e 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -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; } diff --git a/drivers/scsi/sr.h b/drivers/scsi/sr.h index 37c8f6b..9d9a76f 100644 --- a/drivers/scsi/sr.h +++ b/drivers/scsi/sr.h @@ -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 */ -- 1.7.11.5 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html