]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ata: libata-scsi: make ata_scsi_simulate() static
authorDamien Le Moal <dlemoal@kernel.org>
Thu, 19 Feb 2026 01:47:03 +0000 (10:47 +0900)
committerDamien Le Moal <dlemoal@kernel.org>
Tue, 24 Feb 2026 00:40:58 +0000 (09:40 +0900)
ata_scsi_simulate() is called only from libata-scsi.c. Move this
function definition as a static function before its call in
__ata_scsi_queuecmd() and remove its declaration from
include/linux/libata.h.

No functional changes.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
drivers/ata/libata-scsi.c
include/linux/libata.h

index 41918e21d0f83e30347927862af7b9d7ff22bd40..ad628b398fc3773d36ca9c8395df7918091e4758 100644 (file)
@@ -4420,6 +4420,79 @@ static inline ata_xlat_func_t ata_get_xlat_func(struct ata_device *dev, u8 cmd)
        return NULL;
 }
 
+/**
+ *     ata_scsi_simulate - simulate SCSI command on ATA device
+ *     @dev: the target device
+ *     @cmd: SCSI command being sent to device.
+ *
+ *     Interprets and directly executes a select list of SCSI commands
+ *     that can be handled internally.
+ *
+ *     LOCKING:
+ *     spin_lock_irqsave(host lock)
+ */
+static void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
+{
+       const u8 *scsicmd = cmd->cmnd;
+       u8 tmp8;
+
+       switch (scsicmd[0]) {
+       case INQUIRY:
+               ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_inquiry);
+               break;
+
+       case MODE_SENSE:
+       case MODE_SENSE_10:
+               ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_mode_sense);
+               break;
+
+       case READ_CAPACITY:
+       case SERVICE_ACTION_IN_16:
+               ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_read_cap);
+               break;
+
+       case REPORT_LUNS:
+               ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_report_luns);
+               break;
+
+       case REQUEST_SENSE:
+               ata_scsi_set_sense(dev, cmd, 0, 0, 0);
+               break;
+
+       /* if we reach this, then writeback caching is disabled,
+        * turning this into a no-op.
+        */
+       case SYNCHRONIZE_CACHE:
+       case SYNCHRONIZE_CACHE_16:
+               fallthrough;
+
+       /* no-op's, complete with success */
+       case REZERO_UNIT:
+       case SEEK_6:
+       case SEEK_10:
+       case TEST_UNIT_READY:
+               break;
+
+       case SEND_DIAGNOSTIC:
+               tmp8 = scsicmd[1] & ~(1 << 3);
+               if (tmp8 != 0x4 || scsicmd[3] || scsicmd[4])
+                       ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
+               break;
+
+       case MAINTENANCE_IN:
+               ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_maint_in);
+               break;
+
+       /* all other commands */
+       default:
+               ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x20, 0x0);
+               /* "Invalid command operation code" */
+               break;
+       }
+
+       scsi_done(cmd);
+}
+
 enum scsi_qc_status __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
                                        struct ata_device *dev)
 {
@@ -4522,80 +4595,6 @@ enum scsi_qc_status ata_scsi_queuecmd(struct Scsi_Host *shost,
 }
 EXPORT_SYMBOL_GPL(ata_scsi_queuecmd);
 
-/**
- *     ata_scsi_simulate - simulate SCSI command on ATA device
- *     @dev: the target device
- *     @cmd: SCSI command being sent to device.
- *
- *     Interprets and directly executes a select list of SCSI commands
- *     that can be handled internally.
- *
- *     LOCKING:
- *     spin_lock_irqsave(host lock)
- */
-
-void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
-{
-       const u8 *scsicmd = cmd->cmnd;
-       u8 tmp8;
-
-       switch(scsicmd[0]) {
-       case INQUIRY:
-               ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_inquiry);
-               break;
-
-       case MODE_SENSE:
-       case MODE_SENSE_10:
-               ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_mode_sense);
-               break;
-
-       case READ_CAPACITY:
-       case SERVICE_ACTION_IN_16:
-               ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_read_cap);
-               break;
-
-       case REPORT_LUNS:
-               ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_report_luns);
-               break;
-
-       case REQUEST_SENSE:
-               ata_scsi_set_sense(dev, cmd, 0, 0, 0);
-               break;
-
-       /* if we reach this, then writeback caching is disabled,
-        * turning this into a no-op.
-        */
-       case SYNCHRONIZE_CACHE:
-       case SYNCHRONIZE_CACHE_16:
-               fallthrough;
-
-       /* no-op's, complete with success */
-       case REZERO_UNIT:
-       case SEEK_6:
-       case SEEK_10:
-       case TEST_UNIT_READY:
-               break;
-
-       case SEND_DIAGNOSTIC:
-               tmp8 = scsicmd[1] & ~(1 << 3);
-               if (tmp8 != 0x4 || scsicmd[3] || scsicmd[4])
-                       ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
-               break;
-
-       case MAINTENANCE_IN:
-               ata_scsi_rbuf_fill(dev, cmd, ata_scsiop_maint_in);
-               break;
-
-       /* all other commands */
-       default:
-               ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x20, 0x0);
-               /* "Invalid command operation code" */
-               break;
-       }
-
-       scsi_done(cmd);
-}
-
 int ata_scsi_add_hosts(struct ata_host *host, const struct scsi_host_template *sht)
 {
        int i, rc;
index 00346ce3af5e0d24a5dfa403c4706eff1fdc7cd3..db87c99e418915f3b809723dc39600ad2557e4a1 100644 (file)
@@ -1205,7 +1205,6 @@ extern unsigned int ata_do_dev_read_id(struct ata_device *dev,
                                       struct ata_taskfile *tf, __le16 *id);
 extern void ata_qc_complete(struct ata_queued_cmd *qc);
 extern u64 ata_qc_get_active(struct ata_port *ap);
-extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd);
 extern int ata_std_bios_param(struct scsi_device *sdev,
                              struct gendisk *unused,
                              sector_t capacity, int geom[]);