Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1337171

[PATCH 4/7] ahci: Cache host controller version

From Mika Westerberg <mika.westerberg@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH 4/7] ahci: Cache host controller version
Date 2016-02-18 10:00 +0100
Message-ID <r3sBl-311-31@gated-at.bofh.it> (permalink)
References <r3sBk-311-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This allows sysfs nodes to read the cached value directly instead of
powering up possibly runtime suspended controller.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/ata/ahci.h    | 1 +
 drivers/ata/libahci.c | 7 +++----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index a44c75d4c284..8138bc967eda 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -336,6 +336,7 @@ struct ahci_host_priv {
 	void __iomem *		mmio;		/* bus-independent mem map */
 	u32			cap;		/* cap to use */
 	u32			cap2;		/* cap2 to use */
+	u32			version;	/* cached version */
 	u32			port_map;	/* port map to use */
 	u32			saved_cap;	/* saved initial cap */
 	u32			saved_cap2;	/* saved initial cap2 */
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 402967902cbe..2ce4c638714e 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -250,9 +250,8 @@ static ssize_t ahci_show_host_version(struct device *dev,
 	struct Scsi_Host *shost = class_to_shost(dev);
 	struct ata_port *ap = ata_shost_to_port(shost);
 	struct ahci_host_priv *hpriv = ap->host->private_data;
-	void __iomem *mmio = hpriv->mmio;
 
-	return sprintf(buf, "%x\n", readl(mmio + HOST_VERSION));
+	return sprintf(buf, "%x\n", hpriv->version);
 }
 
 static ssize_t ahci_show_port_cmd(struct device *dev,
@@ -508,6 +507,7 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv)
 	/* record values to use during operation */
 	hpriv->cap = cap;
 	hpriv->cap2 = cap2;
+	hpriv->version = readl(mmio + HOST_VERSION);
 	hpriv->port_map = port_map;
 
 	if (!hpriv->start_engine)
@@ -2389,11 +2389,10 @@ static void ahci_port_stop(struct ata_port *ap)
 void ahci_print_info(struct ata_host *host, const char *scc_s)
 {
 	struct ahci_host_priv *hpriv = host->private_data;
-	void __iomem *mmio = hpriv->mmio;
 	u32 vers, cap, cap2, impl, speed;
 	const char *speed_s;
 
-	vers = readl(mmio + HOST_VERSION);
+	vers = hpriv->version;
 	cap = hpriv->cap;
 	cap2 = hpriv->cap2;
 	impl = hpriv->port_map;
-- 
2.7.0

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/7] Runtime PM support for AHCI host controller driver Mika Westerberg <mika.westerberg@linux.intel.com> - 2016-02-18 10:00 +0100
  [PATCH 2/7] scsi: Set request queue runtime PM status back to active on resume Mika Westerberg <mika.westerberg@linux.intel.com> - 2016-02-18 10:00 +0100
  [PATCH 4/7] ahci: Cache host controller version Mika Westerberg <mika.westerberg@linux.intel.com> - 2016-02-18 10:00 +0100
  [PATCH 7/7] ahci: Add runtime PM support for the host controller Mika Westerberg <mika.westerberg@linux.intel.com> - 2016-02-18 10:00 +0100
  [PATCH 6/7] ahci: Add functions to manage runtime PM of AHCI ports Mika Westerberg <mika.westerberg@linux.intel.com> - 2016-02-18 10:00 +0100
  Re: [PATCH 0/7] Runtime PM support for AHCI host controller driver Tejun Heo <tj@kernel.org> - 2016-02-18 17:50 +0100
    Re: [PATCH 0/7] Runtime PM support for AHCI host controller driver Mika Westerberg <mika.westerberg@linux.intel.com> - 2016-02-19 09:50 +0100
    Re: [PATCH 0/7] Runtime PM support for AHCI host controller driver Jens Axboe <axboe@kernel.dk> - 2016-02-19 16:20 +0100
  Re: [PATCH 0/7] Runtime PM support for AHCI host controller driver Tejun Heo <tj@kernel.org> - 2016-02-19 17:00 +0100

csiph-web