Re: [PATCH v5 1/3] scsi: sd: Add manage_restart device attribute to scsi_disk

From: Damien Le Moal

Date: Mon Oct 27 2025 - 23:57:19 EST


On 10/28/25 5:23 AM, Markus Probst wrote:
> In addition to the already existing manage_shutdown,
> manage_system_start_stop and manage_runtime_start_stop device
> scsi_disk attributes, add manage_restart, which allows the high-level
> device driver (sd) to manage the device power state for SYSTEM_RESTART if
> set to 1.
>
> This attribute is necessary for the following commit "ata: stop disk on
> restart if ACPI power resources are found" to avoid a potential disk power
> failure in the case the SATA power connector does not retain the power
> state after a restart.
>
> Signed-off-by: Markus Probst <markus.probst@xxxxxxxxx>

One nit below.

With that fixed, looks OK to me.

Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>

> +static ssize_t manage_restart_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct scsi_disk *sdkp = to_scsi_disk(dev);
> + struct scsi_device *sdp = sdkp->device;
> +
> + return sysfs_emit(buf, "%u\n", sdp->manage_restart);
> +}
> +
> +

One extra blank line not needed here.

> +static ssize_t manage_restart_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + struct scsi_disk *sdkp = to_scsi_disk(dev);
> + struct scsi_device *sdp = sdkp->device;
> + bool v;

--
Damien Le Moal
Western Digital Research