libahci_platform: add host_flags parameter in ahci_platform_init_host()
authorKefeng Wang <kefeng.wang@linaro.org>
Wed, 14 May 2014 06:13:41 +0000 (14:13 +0800)
committerTejun Heo <tj@kernel.org>
Wed, 14 May 2014 17:07:10 +0000 (13:07 -0400)
Add a dynamic host_flags argument to make ahci_platform_init_host more flexible,
then remove the AHCI_HFLAGS(...) argument from some driver's ata_port_info,
and pass that in as the new argument.

Cc: Hans de Geode <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kefeng Wang <kefeng.wang@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
drivers/ata/ahci_da850.c
drivers/ata/ahci_imx.c
drivers/ata/ahci_mvebu.c
drivers/ata/ahci_platform.c
drivers/ata/ahci_st.c
drivers/ata/ahci_sunxi.c
drivers/ata/ahci_xgene.c
drivers/ata/libahci_platform.c
include/linux/ahci_platform.h

index 2c83613ce2dbf343642c1c37e176e4311f5c5204..2b77d53bccf80a1773cf117d80297823bd6e3297 100644 (file)
@@ -85,7 +85,8 @@ static int ahci_da850_probe(struct platform_device *pdev)
 
        da850_sata_init(dev, pwrdn_reg, hpriv->mmio);
 
-       rc = ahci_platform_init_host(pdev, hpriv, &ahci_da850_port_info, 0, 0);
+       rc = ahci_platform_init_host(pdev, hpriv, &ahci_da850_port_info,
+                                    0, 0, 0);
        if (rc)
                goto disable_resources;
 
index 497c7abe1c7df5ef79ccd246828b68a1251c5201..e7e44a73e4fe25919dccc0594b5379a31cd07f3e 100644 (file)
@@ -267,7 +267,8 @@ static int imx_ahci_probe(struct platform_device *pdev)
        reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000;
        writel(reg_val, hpriv->mmio + HOST_TIMER1MS);
 
-       ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info, 0, 0);
+       ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info,
+                                     0, 0, 0);
        if (ret)
                imx_sata_disable(hpriv);
 
index 1df8630c6b6522a3717f6ad4da78533756a89438..fd3dfd733b8436b24fb55c5be4c686f01f8ba1bb 100644 (file)
@@ -88,7 +88,8 @@ static int ahci_mvebu_probe(struct platform_device *pdev)
        ahci_mvebu_mbus_config(hpriv, dram);
        ahci_mvebu_regret_option(hpriv);
 
-       rc = ahci_platform_init_host(pdev, hpriv, &ahci_mvebu_port_info, 0, 0);
+       rc = ahci_platform_init_host(pdev, hpriv, &ahci_mvebu_port_info,
+                                    0, 0, 0);
        if (rc)
                goto disable_resources;
 
index ef67e79944f9962e3e32382dd43794404d866b01..a476a1fd3f8fa7ae80b17e15a0b2d3f53a8c511b 100644 (file)
@@ -55,7 +55,7 @@ static int ahci_probe(struct platform_device *pdev)
                        goto disable_resources;
        }
 
-       rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, 0, 0);
+       rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, 0, 0, 0);
        if (rc)
                goto pdata_exit;
 
index 633222226c19132210b596ba291b5e18dc4efa7d..2595598df9ce6ff955b5e5471141ba54128dcd02 100644 (file)
@@ -166,7 +166,7 @@ static int st_ahci_probe(struct platform_device *pdev)
        if (err)
                return err;
 
-       err = ahci_platform_init_host(pdev, hpriv, &st_ahci_port_info, 0, 0);
+       err = ahci_platform_init_host(pdev, hpriv, &st_ahci_port_info, 0, 0, 0);
        if (err) {
                ahci_platform_disable_resources(hpriv);
                return err;
index 42d3f64e74b3b4603ec811bf1f19fea872ab4e02..02002f125bd4c4d1387d64616d1fdad5f572d0f4 100644 (file)
@@ -157,8 +157,6 @@ static void ahci_sunxi_start_engine(struct ata_port *ap)
 }
 
 static const struct ata_port_info ahci_sunxi_port_info = {
-       AHCI_HFLAGS(AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI |
-                         AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ),
        .flags          = AHCI_FLAG_COMMON | ATA_FLAG_NCQ,
        .pio_mask       = ATA_PIO4,
        .udma_mask      = ATA_UDMA6,
@@ -169,6 +167,7 @@ static int ahci_sunxi_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct ahci_host_priv *hpriv;
+       unsigned long hflags;
        int rc;
 
        hpriv = ahci_platform_get_resources(pdev);
@@ -185,7 +184,11 @@ static int ahci_sunxi_probe(struct platform_device *pdev)
        if (rc)
                goto disable_resources;
 
-       rc = ahci_platform_init_host(pdev, hpriv, &ahci_sunxi_port_info, 0, 0);
+       hflags = AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI |
+                AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ;
+
+       rc = ahci_platform_init_host(pdev, hpriv, &ahci_sunxi_port_info,
+                                    hflags, 0, 0);
        if (rc)
                goto disable_resources;
 
index 77c89bf171f14723ec72e306191b96405ca4f2e2..042a9bb45c86d40f4d06511b673ddfc83bea55e2 100644 (file)
@@ -303,7 +303,6 @@ static struct ata_port_operations xgene_ahci_ops = {
 };
 
 static const struct ata_port_info xgene_ahci_port_info = {
-       AHCI_HFLAGS(AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ),
        .flags = AHCI_FLAG_COMMON | ATA_FLAG_NCQ,
        .pio_mask = ATA_PIO4,
        .udma_mask = ATA_UDMA6,
@@ -382,6 +381,7 @@ static int xgene_ahci_probe(struct platform_device *pdev)
        struct ahci_host_priv *hpriv;
        struct xgene_ahci_context *ctx;
        struct resource *res;
+       unsigned long hflags;
        int rc;
 
        hpriv = ahci_platform_get_resources(pdev);
@@ -450,7 +450,10 @@ static int xgene_ahci_probe(struct platform_device *pdev)
                goto disable_resources;
        }
 
-       rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info, 0, 0);
+       hflags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ;
+
+       rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info,
+                                    hflags, 0, 0);
        if (rc)
                goto disable_resources;
 
index 7cb3a85719c0010099dd2ae835144cbb6d853986..3a5b4ed25a4f81a5ecb21140a1116363a3657f88 100644 (file)
@@ -283,6 +283,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_get_resources);
  * @pdev: platform device pointer for the host
  * @hpriv: ahci-host private data for the host
  * @pi_template: template for the ata_port_info to use
+ * @host_flags: ahci host flags used in ahci_host_priv
  * @force_port_map: param passed to ahci_save_initial_config
  * @mask_port_map: param passed to ahci_save_initial_config
  *
@@ -296,6 +297,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_get_resources);
 int ahci_platform_init_host(struct platform_device *pdev,
                            struct ahci_host_priv *hpriv,
                            const struct ata_port_info *pi_template,
+                           unsigned long host_flags,
                            unsigned int force_port_map,
                            unsigned int mask_port_map)
 {
@@ -312,7 +314,8 @@ int ahci_platform_init_host(struct platform_device *pdev,
        }
 
        /* prepare host */
-       hpriv->flags |= (unsigned long)pi.private_data;
+       pi.private_data = (void *)host_flags;
+       hpriv->flags |= host_flags;
 
        ahci_save_initial_config(dev, hpriv, force_port_map, mask_port_map);
 
index 1f16d502600c5d887dbb54fea12440bd7bf9692a..6dfd51a04d77a5438fa50756fe5bb79e634dd3e6 100644 (file)
@@ -44,6 +44,7 @@ struct ahci_host_priv *ahci_platform_get_resources(
 int ahci_platform_init_host(struct platform_device *pdev,
                            struct ahci_host_priv *hpriv,
                            const struct ata_port_info *pi_template,
+                           unsigned long host_flags,
                            unsigned int force_port_map,
                            unsigned int mask_port_map);