aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuthikulpanit, Suravee <Suravee.Suthikulpanit@amd.com>2015-06-10 12:08:55 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-06-15 08:40:49 -0400
commit04825cfedf525b455384547adb90102d02b293b4 (patch)
treebabeed41b72d46366e480289c71c9af7477fb4e2
parent05ca556003b1d6b4df0b8831e4c07fad7f5bdd2c (diff)
crypto: ccp - Unify coherency checking logic with device_dma_is_coherent()
Currently, the driver has separate logic to determine device coherency for DT vs ACPI. This patch simplifies the code with a call to device_dma_is_coherent(). Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/crypto/ccp/ccp-platform.c60
1 files changed, 1 insertions, 59 deletions
diff --git a/drivers/crypto/ccp/ccp-platform.c b/drivers/crypto/ccp/ccp-platform.c
index b1c20b2b5647..e446781b1892 100644
--- a/drivers/crypto/ccp/ccp-platform.c
+++ b/drivers/crypto/ccp/ccp-platform.c
@@ -90,58 +90,6 @@ static struct resource *ccp_find_mmio_area(struct ccp_device *ccp)
90 return NULL; 90 return NULL;
91} 91}
92 92
93#ifdef CONFIG_ACPI
94static int ccp_acpi_support(struct ccp_device *ccp)
95{
96 struct ccp_platform *ccp_platform = ccp->dev_specific;
97 struct acpi_device *adev = ACPI_COMPANION(ccp->dev);
98 acpi_handle handle;
99 acpi_status status;
100 unsigned long long data;
101 int cca;
102
103 /* Retrieve the device cache coherency value */
104 handle = adev->handle;
105 do {
106 status = acpi_evaluate_integer(handle, "_CCA", NULL, &data);
107 if (!ACPI_FAILURE(status)) {
108 cca = data;
109 break;
110 }
111 } while (!ACPI_FAILURE(status));
112
113 if (ACPI_FAILURE(status)) {
114 dev_err(ccp->dev, "error obtaining acpi coherency value\n");
115 return -EINVAL;
116 }
117
118 ccp_platform->coherent = !!cca;
119
120 return 0;
121}
122#else /* CONFIG_ACPI */
123static int ccp_acpi_support(struct ccp_device *ccp)
124{
125 return -EINVAL;
126}
127#endif
128
129#ifdef CONFIG_OF
130static int ccp_of_support(struct ccp_device *ccp)
131{
132 struct ccp_platform *ccp_platform = ccp->dev_specific;
133
134 ccp_platform->coherent = of_dma_is_coherent(ccp->dev->of_node);
135
136 return 0;
137}
138#else
139static int ccp_of_support(struct ccp_device *ccp)
140{
141 return -EINVAL;
142}
143#endif
144
145static int ccp_platform_probe(struct platform_device *pdev) 93static int ccp_platform_probe(struct platform_device *pdev)
146{ 94{
147 struct ccp_device *ccp; 95 struct ccp_device *ccp;
@@ -182,13 +130,7 @@ static int ccp_platform_probe(struct platform_device *pdev)
182 goto e_err; 130 goto e_err;
183 } 131 }
184 132
185 if (ccp_platform->use_acpi) 133 ccp_platform->coherent = device_dma_is_coherent(ccp->dev);
186 ret = ccp_acpi_support(ccp);
187 else
188 ret = ccp_of_support(ccp);
189 if (ret)
190 goto e_err;
191
192 if (ccp_platform->coherent) 134 if (ccp_platform->coherent)
193 ccp->axcache = CACHE_WB_NO_ALLOC; 135 ccp->axcache = CACHE_WB_NO_ALLOC;
194 else 136 else