aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>2016-01-07 19:36:25 -0500
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2016-02-09 21:11:43 -0500
commit1e3ed59d6200eb31b554dbdcfdde62d1e3d91f0c (patch)
tree3825151b8dd86a58a67f05736a507dad312bf93d /drivers/char
parent00194826e6be333083ba9ddbd6e83fb423206f8a (diff)
tpm_crb: Drop le32_to_cpu(ioread32(..))
ioread32 and readl are defined to read from PCI style memory, ie little endian and return the result in host order. On platforms where a swap is required ioread32/readl do the swap internally (eg see ppc). Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Acked-by: Peter Huewe <peterhuewe@gmx.de>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm_crb.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
index 8dd70696ebe8..0237006dc4d8 100644
--- a/drivers/char/tpm/tpm_crb.c
+++ b/drivers/char/tpm/tpm_crb.c
@@ -89,7 +89,7 @@ static u8 crb_status(struct tpm_chip *chip)
89 struct crb_priv *priv = chip->vendor.priv; 89 struct crb_priv *priv = chip->vendor.priv;
90 u8 sts = 0; 90 u8 sts = 0;
91 91
92 if ((le32_to_cpu(ioread32(&priv->cca->start)) & CRB_START_INVOKE) != 92 if ((ioread32(&priv->cca->start) & CRB_START_INVOKE) !=
93 CRB_START_INVOKE) 93 CRB_START_INVOKE)
94 sts |= CRB_STS_COMPLETE; 94 sts |= CRB_STS_COMPLETE;
95 95
@@ -105,7 +105,7 @@ static int crb_recv(struct tpm_chip *chip, u8 *buf, size_t count)
105 if (count < 6) 105 if (count < 6)
106 return -EIO; 106 return -EIO;
107 107
108 if (le32_to_cpu(ioread32(&priv->cca->sts)) & CRB_CA_STS_ERROR) 108 if (ioread32(&priv->cca->sts) & CRB_CA_STS_ERROR)
109 return -EIO; 109 return -EIO;
110 110
111 memcpy_fromio(buf, priv->rsp, 6); 111 memcpy_fromio(buf, priv->rsp, 6);
@@ -141,11 +141,11 @@ static int crb_send(struct tpm_chip *chip, u8 *buf, size_t len)
141 struct crb_priv *priv = chip->vendor.priv; 141 struct crb_priv *priv = chip->vendor.priv;
142 int rc = 0; 142 int rc = 0;
143 143
144 if (len > le32_to_cpu(ioread32(&priv->cca->cmd_size))) { 144 if (len > ioread32(&priv->cca->cmd_size)) {
145 dev_err(&chip->dev, 145 dev_err(&chip->dev,
146 "invalid command count value %x %zx\n", 146 "invalid command count value %x %zx\n",
147 (unsigned int) len, 147 (unsigned int) len,
148 (size_t) le32_to_cpu(ioread32(&priv->cca->cmd_size))); 148 (size_t) ioread32(&priv->cca->cmd_size));
149 return -E2BIG; 149 return -E2BIG;
150 } 150 }
151 151
@@ -181,7 +181,7 @@ static void crb_cancel(struct tpm_chip *chip)
181static bool crb_req_canceled(struct tpm_chip *chip, u8 status) 181static bool crb_req_canceled(struct tpm_chip *chip, u8 status)
182{ 182{
183 struct crb_priv *priv = chip->vendor.priv; 183 struct crb_priv *priv = chip->vendor.priv;
184 u32 cancel = le32_to_cpu(ioread32(&priv->cca->cancel)); 184 u32 cancel = ioread32(&priv->cca->cancel);
185 185
186 return (cancel & CRB_CANCEL_INVOKE) == CRB_CANCEL_INVOKE; 186 return (cancel & CRB_CANCEL_INVOKE) == CRB_CANCEL_INVOKE;
187} 187}
@@ -251,10 +251,10 @@ static int crb_acpi_add(struct acpi_device *device)
251 return -ENOMEM; 251 return -ENOMEM;
252 } 252 }
253 253
254 pa = ((u64) le32_to_cpu(ioread32(&priv->cca->cmd_pa_high)) << 32) | 254 pa = ((u64)ioread32(&priv->cca->cmd_pa_high) << 32) |
255 (u64) le32_to_cpu(ioread32(&priv->cca->cmd_pa_low)); 255 (u64)ioread32(&priv->cca->cmd_pa_low);
256 priv->cmd = devm_ioremap_nocache(dev, pa, 256 priv->cmd =
257 ioread32(&priv->cca->cmd_size)); 257 devm_ioremap_nocache(dev, pa, ioread32(&priv->cca->cmd_size));
258 if (!priv->cmd) { 258 if (!priv->cmd) {
259 dev_err(dev, "ioremap of the command buffer failed\n"); 259 dev_err(dev, "ioremap of the command buffer failed\n");
260 return -ENOMEM; 260 return -ENOMEM;
@@ -262,8 +262,8 @@ static int crb_acpi_add(struct acpi_device *device)
262 262
263 memcpy_fromio(&pa, &priv->cca->rsp_pa, 8); 263 memcpy_fromio(&pa, &priv->cca->rsp_pa, 8);
264 pa = le64_to_cpu(pa); 264 pa = le64_to_cpu(pa);
265 priv->rsp = devm_ioremap_nocache(dev, pa, 265 priv->rsp =
266 ioread32(&priv->cca->rsp_size)); 266 devm_ioremap_nocache(dev, pa, ioread32(&priv->cca->rsp_size));
267 if (!priv->rsp) { 267 if (!priv->rsp) {
268 dev_err(dev, "ioremap of the response buffer failed\n"); 268 dev_err(dev, "ioremap of the response buffer failed\n");
269 return -ENOMEM; 269 return -ENOMEM;