Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ahci: Cache host controller version

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>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Mika Westerberg and committed by
Tejun Heo
8ea909cb 5c6fab9d

+4 -4
+1
drivers/ata/ahci.h
··· 335 335 void __iomem * mmio; /* bus-independent mem map */ 336 336 u32 cap; /* cap to use */ 337 337 u32 cap2; /* cap2 to use */ 338 + u32 version; /* cached version */ 338 339 u32 port_map; /* port map to use */ 339 340 u32 saved_cap; /* saved initial cap */ 340 341 u32 saved_cap2; /* saved initial cap2 */
+3 -4
drivers/ata/libahci.c
··· 251 251 struct Scsi_Host *shost = class_to_shost(dev); 252 252 struct ata_port *ap = ata_shost_to_port(shost); 253 253 struct ahci_host_priv *hpriv = ap->host->private_data; 254 - void __iomem *mmio = hpriv->mmio; 255 254 256 - return sprintf(buf, "%x\n", readl(mmio + HOST_VERSION)); 255 + return sprintf(buf, "%x\n", hpriv->version); 257 256 } 258 257 259 258 static ssize_t ahci_show_port_cmd(struct device *dev, ··· 508 509 /* record values to use during operation */ 509 510 hpriv->cap = cap; 510 511 hpriv->cap2 = cap2; 512 + hpriv->version = readl(mmio + HOST_VERSION); 511 513 hpriv->port_map = port_map; 512 514 513 515 if (!hpriv->start_engine) ··· 2357 2357 void ahci_print_info(struct ata_host *host, const char *scc_s) 2358 2358 { 2359 2359 struct ahci_host_priv *hpriv = host->private_data; 2360 - void __iomem *mmio = hpriv->mmio; 2361 2360 u32 vers, cap, cap2, impl, speed; 2362 2361 const char *speed_s; 2363 2362 2364 - vers = readl(mmio + HOST_VERSION); 2363 + vers = hpriv->version; 2365 2364 cap = hpriv->cap; 2366 2365 cap2 = hpriv->cap2; 2367 2366 impl = hpriv->port_map;