ata: simplify ata_scsiop_inq_89()
authorBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Thu, 26 Mar 2020 15:58:00 +0000 (16:58 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 26 Mar 2020 16:28:18 +0000 (10:28 -0600)
Initialize rbuf[] directly instead of using ata_tf_to_fis(). This
results in simpler and smaller code. It also allows separating
ata_tf_to_fis() into SATA specific libata part in the future.

Code size savings on m68k arch using (modified) atari_defconfig:

   text    data     bss     dec     hex filename
before:
  20824     105    4096   25025    61c1 drivers/ata/libata-scsi.o
after:
  20782     105    4096   24983    6197 drivers/ata/libata-scsi.o

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/ata/libata-scsi.c

index 005c6f2..0912acb 100644 (file)
@@ -2357,10 +2357,6 @@ static unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf)
  */
 static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf)
 {
-       struct ata_taskfile tf;
-
-       memset(&tf, 0, sizeof(tf));
-
        rbuf[1] = 0x89;                 /* our page code */
        rbuf[2] = (0x238 >> 8);         /* page size fixed at 238h */
        rbuf[3] = (0x238 & 0xff);
@@ -2369,14 +2365,14 @@ static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf)
        memcpy(&rbuf[16], "libata          ", 16);
        memcpy(&rbuf[32], DRV_VERSION, 4);
 
-       /* we don't store the ATA device signature, so we fake it */
-
-       tf.command = ATA_DRDY;          /* really, this is Status reg */
-       tf.lbal = 0x1;
-       tf.nsect = 0x1;
-
-       ata_tf_to_fis(&tf, 0, 1, &rbuf[36]);    /* TODO: PMP? */
        rbuf[36] = 0x34;                /* force D2H Reg FIS (34h) */
+       rbuf[37] = (1 << 7);            /* bit 7 indicates Command FIS */
+                                       /* TODO: PMP? */
+
+       /* we don't store the ATA device signature, so we fake it */
+       rbuf[38] = ATA_DRDY;            /* really, this is Status reg */
+       rbuf[40] = 0x1;
+       rbuf[48] = 0x1;
 
        rbuf[56] = ATA_CMD_ID_ATA;