Skip to content

Commit 1e3ed59

Browse files
jgunthorpeJarkko Sakkinen
authored andcommitted
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>
1 parent 0019482 commit 1e3ed59

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

drivers/char/tpm/tpm_crb.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static u8 crb_status(struct tpm_chip *chip)
8989
struct crb_priv *priv = chip->vendor.priv;
9090
u8 sts = 0;
9191

92-
if ((le32_to_cpu(ioread32(&priv->cca->start)) & CRB_START_INVOKE) !=
92+
if ((ioread32(&priv->cca->start) & CRB_START_INVOKE) !=
9393
CRB_START_INVOKE)
9494
sts |= CRB_STS_COMPLETE;
9595

@@ -105,7 +105,7 @@ static int crb_recv(struct tpm_chip *chip, u8 *buf, size_t count)
105105
if (count < 6)
106106
return -EIO;
107107

108-
if (le32_to_cpu(ioread32(&priv->cca->sts)) & CRB_CA_STS_ERROR)
108+
if (ioread32(&priv->cca->sts) & CRB_CA_STS_ERROR)
109109
return -EIO;
110110

111111
memcpy_fromio(buf, priv->rsp, 6);
@@ -141,11 +141,11 @@ static int crb_send(struct tpm_chip *chip, u8 *buf, size_t len)
141141
struct crb_priv *priv = chip->vendor.priv;
142142
int rc = 0;
143143

144-
if (len > le32_to_cpu(ioread32(&priv->cca->cmd_size))) {
144+
if (len > ioread32(&priv->cca->cmd_size)) {
145145
dev_err(&chip->dev,
146146
"invalid command count value %x %zx\n",
147147
(unsigned int) len,
148-
(size_t) le32_to_cpu(ioread32(&priv->cca->cmd_size)));
148+
(size_t) ioread32(&priv->cca->cmd_size));
149149
return -E2BIG;
150150
}
151151

@@ -181,7 +181,7 @@ static void crb_cancel(struct tpm_chip *chip)
181181
static bool crb_req_canceled(struct tpm_chip *chip, u8 status)
182182
{
183183
struct crb_priv *priv = chip->vendor.priv;
184-
u32 cancel = le32_to_cpu(ioread32(&priv->cca->cancel));
184+
u32 cancel = ioread32(&priv->cca->cancel);
185185

186186
return (cancel & CRB_CANCEL_INVOKE) == CRB_CANCEL_INVOKE;
187187
}
@@ -251,19 +251,19 @@ static int crb_acpi_add(struct acpi_device *device)
251251
return -ENOMEM;
252252
}
253253

254-
pa = ((u64) le32_to_cpu(ioread32(&priv->cca->cmd_pa_high)) << 32) |
255-
(u64) le32_to_cpu(ioread32(&priv->cca->cmd_pa_low));
256-
priv->cmd = devm_ioremap_nocache(dev, pa,
257-
ioread32(&priv->cca->cmd_size));
254+
pa = ((u64)ioread32(&priv->cca->cmd_pa_high) << 32) |
255+
(u64)ioread32(&priv->cca->cmd_pa_low);
256+
priv->cmd =
257+
devm_ioremap_nocache(dev, pa, ioread32(&priv->cca->cmd_size));
258258
if (!priv->cmd) {
259259
dev_err(dev, "ioremap of the command buffer failed\n");
260260
return -ENOMEM;
261261
}
262262

263263
memcpy_fromio(&pa, &priv->cca->rsp_pa, 8);
264264
pa = le64_to_cpu(pa);
265-
priv->rsp = devm_ioremap_nocache(dev, pa,
266-
ioread32(&priv->cca->rsp_size));
265+
priv->rsp =
266+
devm_ioremap_nocache(dev, pa, ioread32(&priv->cca->rsp_size));
267267
if (!priv->rsp) {
268268
dev_err(dev, "ioremap of the response buffer failed\n");
269269
return -ENOMEM;

0 commit comments

Comments
 (0)