From: David Kershner Date: Fri, 17 Mar 2017 15:27:10 +0000 (-0400) Subject: staging: unisys: include: simplify spar_check_channel_client X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=c4549595c9bbbc8354f89111f96221466a6809ec;p=openwrt%2Fstaging%2Fblogic.git staging: unisys: include: simplify spar_check_channel_client The function spar_check_channel_client shouldn't need to do readq's, it is referencing a local copy of the channel header. Simplify it to just access the fields directly. Signed-off-by: David Kershner Reviewed-by: Tim Sell Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/unisys/include/channel.h b/drivers/staging/unisys/include/channel.h index d3c1dac77faa..8c6a7ad2f46c 100644 --- a/drivers/staging/unisys/include/channel.h +++ b/drivers/staging/unisys/include/channel.h @@ -217,7 +217,7 @@ struct signal_queue_header { * is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages. */ static inline int -spar_check_channel_client(void __iomem *ch, +spar_check_channel_client(struct channel_header *ch, uuid_le expected_uuid, char *chname, u64 expected_min_bytes, @@ -225,48 +225,37 @@ spar_check_channel_client(void __iomem *ch, u64 expected_signature) { if (uuid_le_cmp(expected_uuid, NULL_UUID_LE) != 0) { - uuid_le guid; - - memcpy_fromio(&guid, - &((struct channel_header __iomem *)(ch))->chtype, - sizeof(guid)); /* caller wants us to verify type GUID */ - if (uuid_le_cmp(guid, expected_uuid) != 0) { + if (uuid_le_cmp(ch->chtype, expected_uuid) != 0) { pr_err("Channel mismatch on channel=%s(%pUL) field=type expected=%pUL actual=%pUL\n", chname, &expected_uuid, - &expected_uuid, &guid); + &expected_uuid, &ch->chtype); return 0; } } if (expected_min_bytes > 0) { /* verify channel size */ - unsigned long long bytes = - readq(&((struct channel_header __iomem *) - (ch))->size); - if (bytes < expected_min_bytes) { + if (ch->size < expected_min_bytes) { pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n", chname, &expected_uuid, - (unsigned long long)expected_min_bytes, bytes); + (unsigned long long)expected_min_bytes, + ch->size); return 0; } } if (expected_version > 0) { /* verify channel version */ - unsigned long ver = readl(&((struct channel_header __iomem *) - (ch))->version_id); - if (ver != expected_version) { - pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8lx\n", + if (ch->version_id != expected_version) { + pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8x\n", chname, &expected_uuid, - (unsigned long)expected_version, ver); + (unsigned long)expected_version, + ch->version_id); return 0; } } if (expected_signature > 0) { /* verify channel signature */ - unsigned long long sig = - readq(&((struct channel_header __iomem *) - (ch))->signature); - if (sig != expected_signature) { - pr_err("Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8llx actual=0x%-8.8llx\n", + if (ch->signature != expected_signature) { + pr_err("Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8Lx actual=0x%-8.8Lx\n", chname, &expected_uuid, - expected_signature, sig); + expected_signature, ch->signature); return 0; } }