[PATCH 15/28] ata: move sata_print_link_status() to libata-core-sata.c

From: Bartlomiej Zolnierkiewicz
Date: Tue Jan 28 2020 - 08:35:15 EST


* move sata_print_link_status() to libata-core-sata.c

* add static inline for CONFIG_SATA_HOST=n case

Code size savings on m68k arch using atari_defconfig:

text data bss dec hex filename
before:
35499 572 40 36111 8d0f drivers/ata/libata-core.o
after:
35276 572 40 35888 8c30 drivers/ata/libata-core.o

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx>
---
drivers/ata/libata-core-sata.c | 27 +++++++++++++++++++++++++++
drivers/ata/libata-core.c | 27 ---------------------------
drivers/ata/libata.h | 2 ++
3 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/drivers/ata/libata-core-sata.c b/drivers/ata/libata-core-sata.c
index f2629e069a55..8ad8f97660df 100644
--- a/drivers/ata/libata-core-sata.c
+++ b/drivers/ata/libata-core-sata.c
@@ -258,6 +258,33 @@ int ata_dev_config_ncq(struct ata_device *dev, char *desc, size_t desc_sz)
return 0;
}

+/**
+ * sata_print_link_status - Print SATA link status
+ * @link: SATA link to printk link status about
+ *
+ * This function prints link speed and status of a SATA link.
+ *
+ * LOCKING:
+ * None.
+ */
+void sata_print_link_status(struct ata_link *link)
+{
+ u32 sstatus, scontrol, tmp;
+
+ if (sata_scr_read(link, SCR_STATUS, &sstatus))
+ return;
+ sata_scr_read(link, SCR_CONTROL, &scontrol);
+
+ if (ata_phys_link_online(link)) {
+ tmp = (sstatus >> 4) & 0xf;
+ ata_link_info(link, "SATA link up %s (SStatus %X SControl %X)\n",
+ sata_spd_string(tmp), sstatus, scontrol);
+ } else {
+ ata_link_info(link, "SATA link down (SStatus %X SControl %X)\n",
+ sstatus, scontrol);
+ }
+}
+
/**
* sata_link_scr_lpm - manipulate SControl IPM and SPM fields
* @link: ATA link to manipulate SControl for
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 0a90e0e65f0b..73f732a32261 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2742,33 +2742,6 @@ int ata_bus_probe(struct ata_port *ap)
goto retry;
}

-/**
- * sata_print_link_status - Print SATA link status
- * @link: SATA link to printk link status about
- *
- * This function prints link speed and status of a SATA link.
- *
- * LOCKING:
- * None.
- */
-static void sata_print_link_status(struct ata_link *link)
-{
- u32 sstatus, scontrol, tmp;
-
- if (sata_scr_read(link, SCR_STATUS, &sstatus))
- return;
- sata_scr_read(link, SCR_CONTROL, &scontrol);
-
- if (ata_phys_link_online(link)) {
- tmp = (sstatus >> 4) & 0xf;
- ata_link_info(link, "SATA link up %s (SStatus %X SControl %X)\n",
- sata_spd_string(tmp), sstatus, scontrol);
- } else {
- ata_link_info(link, "SATA link down (SStatus %X SControl %X)\n",
- sstatus, scontrol);
- }
-}
-
/**
* ata_dev_pair - return other device on cable
* @adev: device
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 24b08efd79a3..909c2cae52a0 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -102,6 +102,7 @@ static inline bool ata_log_supported(struct ata_device *dev, u8 log)
#ifdef CONFIG_SATA_HOST
int ata_do_link_spd_horkage(struct ata_device *dev);
int ata_dev_config_ncq(struct ata_device *dev, char *desc, size_t desc_sz);
+void sata_print_link_status(struct ata_link *link);
#else
static inline int ata_do_link_spd_horkage(struct ata_device *dev) { return 0; }
static inline int ata_dev_config_ncq(struct ata_device *dev, char *desc,
@@ -110,6 +111,7 @@ static inline int ata_dev_config_ncq(struct ata_device *dev, char *desc,
desc[0] = '\0';
return 0;
}
+static inline void sata_print_link_status(struct ata_link *link) { }
#endif

/* libata-acpi.c */
--
2.24.1