Skip to content

Commit

Permalink
scsi: Change SCSI device boolean fields to single bit flags
Browse files Browse the repository at this point in the history
Commit 3cc2ffe ("scsi: sd: Differentiate system and runtime start/stop
management") changed the single bit manage_start_stop flag into 2 boolean
fields of the SCSI device structure. Commit 24eca2d ("scsi: sd:
Introduce manage_shutdown device flag") introduced the manage_shutdown
boolean field for the same structure. Together, these 2 commits increase
the size of struct scsi_device by 8 bytes by using booleans instead of
defining the manage_xxx fields as single bit flags, similarly to other
flags of this structure.

Avoid this unnecessary structure size increase and be consistent with the
definition of other flags by reverting the definitions of the manage_xxx
fields as single bit flags.

Fixes: 3cc2ffe ("scsi: sd: Differentiate system and runtime start/stop management")
Fixes: 24eca2d ("scsi: sd: Introduce manage_shutdown device flag")
Cc: <stable@vger.kernel.org>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20231120225631.37938-2-dlemoal@kernel.org
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
damien-lemoal authored and martinkpetersen committed Nov 25, 2023
1 parent 93e6c0e commit 6371be7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions drivers/ata/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1056,8 +1056,8 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev)
* and resume and shutdown only. For system level suspend/resume,
* devices power state is handled directly by libata EH.
*/
sdev->manage_runtime_start_stop = true;
sdev->manage_shutdown = true;
sdev->manage_runtime_start_stop = 1;
sdev->manage_shutdown = 1;
}

/*
Expand Down
6 changes: 3 additions & 3 deletions drivers/firewire/sbp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1519,9 +1519,9 @@ static int sbp2_scsi_slave_configure(struct scsi_device *sdev)
sdev->use_10_for_rw = 1;

if (sbp2_param_exclusive_login) {
sdev->manage_system_start_stop = true;
sdev->manage_runtime_start_stop = true;
sdev->manage_shutdown = true;
sdev->manage_system_start_stop = 1;
sdev->manage_runtime_start_stop = 1;
sdev->manage_shutdown = 1;
}

if (sdev->type == TYPE_ROM)
Expand Down
6 changes: 3 additions & 3 deletions include/scsi/scsi_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,19 @@ struct scsi_device {
* power state for system suspend/resume (suspend to RAM and
* hibernation) operations.
*/
bool manage_system_start_stop;
unsigned manage_system_start_stop:1;

/*
* If true, let the high-level device driver (sd) manage the device
* power state for runtime device suspand and resume operations.
*/
bool manage_runtime_start_stop;
unsigned manage_runtime_start_stop:1;

/*
* If true, let the high-level device driver (sd) manage the device
* power state for system shutdown (power off) operations.
*/
bool manage_shutdown;
unsigned manage_shutdown:1;

unsigned removable:1;
unsigned changed:1; /* Data invalid due to media change */
Expand Down

0 comments on commit 6371be7

Please sign in to comment.