sata_mv: platform driver allocs dma without create
[sfrench/cifs-2.6.git] / drivers / ata / sata_mv.c
index 080b8362f8d63a033a66f7119c5be35f40d4f6de..04b571764aff4f82499386234431fbf188b73b81 100644 (file)
@@ -1716,14 +1716,16 @@ static void mv_host_intr(struct ata_host *host, u32 relevant, unsigned int hc)
        VPRINTK("ENTER, hc%u relevant=0x%08x HC IRQ cause=0x%08x\n",
                hc, relevant, hc_irq_cause);
 
-       for (port = port0; port < port0 + last_port; port++) {
+       for (port = port0; port < last_port; port++) {
                struct ata_port *ap = host->ports[port];
-               struct mv_port_priv *pp = ap->private_data;
+               struct mv_port_priv *pp;
                int have_err_bits, hard_port, shift;
 
                if ((!ap) || (ap->flags & ATA_FLAG_DISABLED))
                        continue;
 
+               pp = ap->private_data;
+
                shift = port << 1;              /* (port * 2) */
                if (port >= MV_PORTS_PER_HC) {
                        shift++;        /* skip bit 8 in the HC Main IRQ reg */
@@ -2879,6 +2881,26 @@ done:
        return rc;
 }
 
+static int mv_create_dma_pools(struct mv_host_priv *hpriv, struct device *dev)
+{
+       hpriv->crqb_pool   = dmam_pool_create("crqb_q", dev, MV_CRQB_Q_SZ,
+                                                            MV_CRQB_Q_SZ, 0);
+       if (!hpriv->crqb_pool)
+               return -ENOMEM;
+
+       hpriv->crpb_pool   = dmam_pool_create("crpb_q", dev, MV_CRPB_Q_SZ,
+                                                            MV_CRPB_Q_SZ, 0);
+       if (!hpriv->crpb_pool)
+               return -ENOMEM;
+
+       hpriv->sg_tbl_pool = dmam_pool_create("sg_tbl", dev, MV_SG_TBL_SZ,
+                                                            MV_SG_TBL_SZ, 0);
+       if (!hpriv->sg_tbl_pool)
+               return -ENOMEM;
+
+       return 0;
+}
+
 /**
  *      mv_platform_probe - handle a positive probe of an soc Marvell
  *      host
@@ -2932,6 +2954,10 @@ static int mv_platform_probe(struct platform_device *pdev)
        hpriv->base = ioremap(res->start, res->end - res->start + 1);
        hpriv->base -= MV_SATAHC0_REG_BASE;
 
+       rc = mv_create_dma_pools(hpriv, &pdev->dev);
+       if (rc)
+               return rc;
+
        /* initialize adapter */
        rc = mv_init_host(host, chip_soc);
        if (rc)
@@ -3068,26 +3094,6 @@ static void mv_print_info(struct ata_host *host)
               scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx");
 }
 
-static int mv_create_dma_pools(struct mv_host_priv *hpriv, struct device *dev)
-{
-       hpriv->crqb_pool   = dmam_pool_create("crqb_q", dev, MV_CRQB_Q_SZ,
-                                                            MV_CRQB_Q_SZ, 0);
-       if (!hpriv->crqb_pool)
-               return -ENOMEM;
-
-       hpriv->crpb_pool   = dmam_pool_create("crpb_q", dev, MV_CRPB_Q_SZ,
-                                                            MV_CRPB_Q_SZ, 0);
-       if (!hpriv->crpb_pool)
-               return -ENOMEM;
-
-       hpriv->sg_tbl_pool = dmam_pool_create("sg_tbl", dev, MV_SG_TBL_SZ,
-                                                            MV_SG_TBL_SZ, 0);
-       if (!hpriv->sg_tbl_pool)
-               return -ENOMEM;
-
-       return 0;
-}
-
 /**
  *      mv_pci_init_one - handle a positive probe of a PCI Marvell host
  *      @pdev: PCI device found