[v4,13/27] ata: add CONFIG_SATA_HOST=n version of ata_ncq_enabled()
diff mbox series

Message ID 20200317144333.2904-14-b.zolnierkie@samsung.com
State Not Applicable
Delegated to: David Miller
Headers show
Series
  • [v4,01/27] ata: remove stale maintainership information from core code
Related show

Commit Message

Bartlomiej Zolnierkiewicz March 17, 2020, 2:43 p.m. UTC
When CONFIG_SATA_HOST=n there are no NCQ capable host drivers
built so it is safe to hardwire ata_ncq_enabled() to always
return zero.

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

   text    data     bss     dec     hex filename
before:
  37820     572      40   38432    9620 drivers/ata/libata-core.o
  21040     105     576   21721    54d9 drivers/ata/libata-scsi.o
  17405      18       0   17423    440f drivers/ata/libata-eh.o
after:
  37582     572      40   38194    9532 drivers/ata/libata-core.o
  20702     105     576   21383    5387 drivers/ata/libata-scsi.o
  17353      18       0   17371    43db drivers/ata/libata-eh.o

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 include/linux/libata.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

hch@lst.de March 26, 2020, 9:50 a.m. UTC | #1
On Tue, Mar 17, 2020 at 03:43:19PM +0100, Bartlomiej Zolnierkiewicz wrote:
> When CONFIG_SATA_HOST=n there are no NCQ capable host drivers
> built so it is safe to hardwire ata_ncq_enabled() to always
> return zero.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

Patch
diff mbox series

diff --git a/include/linux/libata.h b/include/linux/libata.h
index 9ad072b6d007..b1b3e5e0a301 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1623,6 +1623,8 @@  extern struct ata_device *ata_dev_next(struct ata_device *dev,
  */
 static inline int ata_ncq_enabled(struct ata_device *dev)
 {
+	if (!IS_ENABLED(CONFIG_SATA_HOST))
+		return 0;
 	return (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ_OFF |
 			      ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ;
 }