]> git.itanic.dy.fi Git - linux-stable/commitdiff
ata: ahci: Convert __ahci_port_base to accepting hpriv as arguments
authorSerge Semin <Sergey.Semin@baikalelectronics.ru>
Fri, 9 Sep 2022 19:36:13 +0000 (22:36 +0300)
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>
Fri, 16 Sep 2022 16:39:54 +0000 (01:39 +0900)
The port base address may be required even before the ata_host instance is
initialized and activated, for instance in the ahci_save_initial_config()
method which we are about to update (consider this modification as a
preparation for that one). Seeing the __ahci_port_base() function isn't
used much it's the best candidate to provide the required functionality.
So let's convert it to accepting the ahci_host_priv structure pointer.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
drivers/ata/ahci.c
drivers/ata/ahci.h

index 35f6d12889ff0df5b33232a3063bc3b40ff144a2..639de2d75d63644d2feb09e23e4bf4ce5795321c 100644 (file)
@@ -690,7 +690,7 @@ static void ahci_pci_init_controller(struct ata_host *host)
                        mv = 2;
                else
                        mv = 4;
-               port_mmio = __ahci_port_base(host, mv);
+               port_mmio = __ahci_port_base(hpriv, mv);
 
                writel(0, port_mmio + PORT_IRQ_MASK);
 
index cc4f40e6c9246ec2bc0733dc307051dd0ef68ce3..5d9db5e7476cc5a92c3c2b45ee232391b3d1ee5d 100644 (file)
@@ -432,10 +432,9 @@ int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht);
 void ahci_error_handler(struct ata_port *ap);
 u32 ahci_handle_port_intr(struct ata_host *host, u32 irq_masked);
 
-static inline void __iomem *__ahci_port_base(struct ata_host *host,
+static inline void __iomem *__ahci_port_base(struct ahci_host_priv *hpriv,
                                             unsigned int port_no)
 {
-       struct ahci_host_priv *hpriv = host->private_data;
        void __iomem *mmio = hpriv->mmio;
 
        return mmio + 0x100 + (port_no * 0x80);
@@ -443,7 +442,9 @@ static inline void __iomem *__ahci_port_base(struct ata_host *host,
 
 static inline void __iomem *ahci_port_base(struct ata_port *ap)
 {
-       return __ahci_port_base(ap->host, ap->port_no);
+       struct ahci_host_priv *hpriv = ap->host->private_data;
+
+       return __ahci_port_base(hpriv, ap->port_no);
 }
 
 static inline int ahci_nr_ports(u32 cap)