Commit c4549595 authored by David Kershner's avatar David Kershner Committed by Greg Kroah-Hartman

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: default avatarDavid Kershner <david.kershner@unisys.com>
Reviewed-by: default avatarTim Sell <timothy.sell@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3cda79c6
...@@ -217,7 +217,7 @@ struct signal_queue_header { ...@@ -217,7 +217,7 @@ struct signal_queue_header {
* is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages. * is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages.
*/ */
static inline int static inline int
spar_check_channel_client(void __iomem *ch, spar_check_channel_client(struct channel_header *ch,
uuid_le expected_uuid, uuid_le expected_uuid,
char *chname, char *chname,
u64 expected_min_bytes, u64 expected_min_bytes,
...@@ -225,48 +225,37 @@ spar_check_channel_client(void __iomem *ch, ...@@ -225,48 +225,37 @@ spar_check_channel_client(void __iomem *ch,
u64 expected_signature) u64 expected_signature)
{ {
if (uuid_le_cmp(expected_uuid, NULL_UUID_LE) != 0) { 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 */ /* 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", pr_err("Channel mismatch on channel=%s(%pUL) field=type expected=%pUL actual=%pUL\n",
chname, &expected_uuid, chname, &expected_uuid,
&expected_uuid, &guid); &expected_uuid, &ch->chtype);
return 0; return 0;
} }
} }
if (expected_min_bytes > 0) { /* verify channel size */ if (expected_min_bytes > 0) { /* verify channel size */
unsigned long long bytes = if (ch->size < expected_min_bytes) {
readq(&((struct channel_header __iomem *)
(ch))->size);
if (bytes < expected_min_bytes) {
pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n", pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n",
chname, &expected_uuid, chname, &expected_uuid,
(unsigned long long)expected_min_bytes, bytes); (unsigned long long)expected_min_bytes,
ch->size);
return 0; return 0;
} }
} }
if (expected_version > 0) { /* verify channel version */ if (expected_version > 0) { /* verify channel version */
unsigned long ver = readl(&((struct channel_header __iomem *) if (ch->version_id != expected_version) {
(ch))->version_id); pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8x\n",
if (ver != expected_version) {
pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8lx\n",
chname, &expected_uuid, chname, &expected_uuid,
(unsigned long)expected_version, ver); (unsigned long)expected_version,
ch->version_id);
return 0; return 0;
} }
} }
if (expected_signature > 0) { /* verify channel signature */ if (expected_signature > 0) { /* verify channel signature */
unsigned long long sig = if (ch->signature != expected_signature) {
readq(&((struct channel_header __iomem *) pr_err("Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8Lx actual=0x%-8.8Lx\n",
(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",
chname, &expected_uuid, chname, &expected_uuid,
expected_signature, sig); expected_signature, ch->signature);
return 0; return 0;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment