From 9fd1b95aab5f4e72e8516e0a8b6dcb7dd6217d09 Mon Sep 17 00:00:00 2001 From: Benjamin Romer Date: Thu, 23 Oct 2014 14:29:55 -0400 Subject: [PATCH] staging: unisys: remove typedef for CHANNEL_HEADER Switch everywhere that CHANNEL_HEADER, pCHANNEL_HEADER, or ULTRA_CHANNEL_PROTOCOL was used, to struct channel_header. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/unisys/channels/channel.c | 10 ++-- drivers/staging/unisys/channels/chanstub.c | 4 +- drivers/staging/unisys/channels/chanstub.h | 8 ++-- .../common-spar/include/channels/channel.h | 47 ++++++++++--------- .../include/channels/controlvmchannel.h | 2 +- .../include/channels/diagchannel.h | 4 +- .../common-spar/include/channels/iochannel.h | 2 +- .../include/channels/vbuschannel.h | 2 +- drivers/staging/unisys/include/uisqueue.h | 2 +- drivers/staging/unisys/uislib/uislib.c | 12 +++-- drivers/staging/unisys/virthba/virthba.c | 4 +- drivers/staging/unisys/virtpci/virtpci.c | 6 +-- .../unisys/visorchannel/visorchannel_funcs.c | 30 +++++++----- .../unisys/visorchipset/visorchipset_main.c | 2 +- 14 files changed, 73 insertions(+), 62 deletions(-) diff --git a/drivers/staging/unisys/channels/channel.c b/drivers/staging/unisys/channels/channel.c index b4bdee4b575b..2033b3b8a11f 100644 --- a/drivers/staging/unisys/channels/channel.c +++ b/drivers/staging/unisys/channels/channel.c @@ -44,7 +44,8 @@ * 1 if the insertion succeeds, 0 if the queue was full. */ unsigned char -visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, u32 Queue, void *pSignal) +visor_signal_insert(struct channel_header __iomem *pChannel, u32 Queue, + void *pSignal) { void __iomem *psignal; unsigned int head, tail, nof; @@ -102,7 +103,8 @@ EXPORT_SYMBOL_GPL(visor_signal_insert); * 1 if the removal succeeds, 0 if the queue was empty. */ unsigned char -visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, u32 Queue, void *pSignal) +visor_signal_remove(struct channel_header __iomem *pChannel, u32 Queue, + void *pSignal) { void __iomem *psource; unsigned int head, tail; @@ -157,7 +159,7 @@ EXPORT_SYMBOL_GPL(visor_signal_remove); * # of signals copied. */ unsigned int -SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue, void *pSignal) +SignalRemoveAll(struct channel_header *pChannel, u32 Queue, void *pSignal) { void *psource; unsigned int head, tail, signalCount = 0; @@ -208,7 +210,7 @@ SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue, void *pSignal) * 1 if the signal queue is empty, 0 otherwise. */ unsigned char -visor_signalqueue_empty(CHANNEL_HEADER __iomem *pChannel, u32 Queue) +visor_signalqueue_empty(struct channel_header __iomem *pChannel, u32 Queue) { SIGNAL_QUEUE_HEADER __iomem *pqhdr = (SIGNAL_QUEUE_HEADER __iomem *) ((char __iomem *) pChannel + diff --git a/drivers/staging/unisys/channels/chanstub.c b/drivers/staging/unisys/channels/chanstub.c index d54c5d635a94..23d5aafef2cd 100644 --- a/drivers/staging/unisys/channels/chanstub.c +++ b/drivers/staging/unisys/channels/chanstub.c @@ -42,7 +42,7 @@ channel_mod_exit(void) } unsigned char -SignalInsert_withLock(CHANNEL_HEADER __iomem *pChannel, u32 Queue, +SignalInsert_withLock(struct channel_header __iomem *pChannel, u32 Queue, void *pSignal, spinlock_t *lock) { unsigned char result; @@ -55,7 +55,7 @@ SignalInsert_withLock(CHANNEL_HEADER __iomem *pChannel, u32 Queue, } unsigned char -SignalRemove_withLock(CHANNEL_HEADER __iomem *pChannel, u32 Queue, +SignalRemove_withLock(struct channel_header __iomem *pChannel, u32 Queue, void *pSignal, spinlock_t *lock) { unsigned char result; diff --git a/drivers/staging/unisys/channels/chanstub.h b/drivers/staging/unisys/channels/chanstub.h index d08e2c69d2ad..1531759a1b31 100644 --- a/drivers/staging/unisys/channels/chanstub.h +++ b/drivers/staging/unisys/channels/chanstub.h @@ -15,9 +15,9 @@ #ifndef __CHANSTUB_H__ #define __CHANSTUB_H__ -unsigned char SignalInsert_withLock(CHANNEL_HEADER __iomem *pChannel, u32 Queue, - void *pSignal, spinlock_t *lock); -unsigned char SignalRemove_withLock(CHANNEL_HEADER __iomem *pChannel, u32 Queue, - void *pSignal, spinlock_t *lock); +unsigned char SignalInsert_withLock(struct channel_header __iomem *pChannel, + u32 Queue, void *pSignal, spinlock_t *lock); +unsigned char SignalRemove_withLock(struct channel_header __iomem *pChannel, + u32 Queue, void *pSignal, spinlock_t *lock); #endif diff --git a/drivers/staging/unisys/common-spar/include/channels/channel.h b/drivers/staging/unisys/common-spar/include/channels/channel.h index c77e9c7afcd9..a71bac0526b2 100644 --- a/drivers/staging/unisys/common-spar/include/channels/channel.h +++ b/drivers/staging/unisys/common-spar/include/channels/channel.h @@ -133,21 +133,21 @@ ULTRA_CHANNELCLI_STRING(u32 v) newstate, logCtx) \ do { \ ULTRA_CHANNEL_CLIENT_CHK_TRANSITION( \ - readl(&(((CHANNEL_HEADER __iomem *) \ + readl(&(((struct channel_header __iomem *) \ (pChan))->CliStateOS)), \ newstate, \ chanId, logCtx, __FILE__, __LINE__); \ pr_info("%s Channel StateTransition (%s) %s(%d)-->%s(%d) @%s:%d\n", \ chanId, "CliStateOS", \ ULTRA_CHANNELCLI_STRING( \ - readl(&((CHANNEL_HEADER __iomem *) \ + readl(&((struct channel_header __iomem *)\ (pChan))->CliStateOS)), \ - readl(&((CHANNEL_HEADER __iomem *) \ + readl(&((struct channel_header __iomem *) \ (pChan))->CliStateOS), \ ULTRA_CHANNELCLI_STRING(newstate), \ newstate, \ PathName_Last_N_Nodes(__FILE__, 4), __LINE__); \ - writel(newstate, &((CHANNEL_HEADER __iomem *) \ + writel(newstate, &((struct channel_header __iomem *) \ (pChan))->CliStateOS); \ mb(); /* required for channel synch */ \ } while (0) @@ -200,18 +200,18 @@ ULTRA_CHANNELCLI_STRING(u32 v) #pragma pack(push, 1) /* both GCC and VC now allow this pragma */ /* Common Channel Header */ -typedef struct _CHANNEL_HEADER { +struct channel_header { u64 Signature; /* Signature */ u32 LegacyState; /* DEPRECATED - being replaced by */ /* / SrvState, CliStateBoot, and CliStateOS below */ - u32 HeaderSize; /* sizeof(CHANNEL_HEADER) */ + u32 HeaderSize; /* sizeof(struct channel_header) */ u64 Size; /* Total size of this channel in bytes */ u64 Features; /* Flags to modify behavior */ uuid_le Type; /* Channel type: data, bus, control, etc. */ u64 PartitionHandle; /* ID of guest partition */ u64 Handle; /* Device number of this channel in client */ u64 oChannelSpace; /* Offset in bytes to channel specific area */ - u32 VersionId; /* CHANNEL_HEADER Version ID */ + u32 VersionId; /* struct channel_header Version ID */ u32 PartitionIndex; /* Index of guest partition */ uuid_le ZoneGuid; /* Guid of Channel's zone */ u32 oClientString; /* offset from channel header to @@ -238,7 +238,7 @@ typedef struct _CHANNEL_HEADER { u8 Filler[1]; /* Pad out to 128 byte cacheline */ /* Please add all new single-byte values below here */ u8 RecoverChannel; -} CHANNEL_HEADER, *pCHANNEL_HEADER, ULTRA_CHANNEL_PROTOCOL; +}; #define ULTRA_CHANNEL_ENABLE_INTS (0x1ULL << 0) @@ -312,7 +312,8 @@ ULTRA_check_channel_client(void __iomem *pChannel, uuid_le guid; memcpy_fromio(&guid, - &((CHANNEL_HEADER __iomem *)(pChannel))->Type, + &((struct channel_header __iomem *) + (pChannel))->Type, sizeof(guid)); /* caller wants us to verify type GUID */ if (uuid_le_cmp(guid, expectedTypeGuid) != 0) { @@ -324,8 +325,9 @@ ULTRA_check_channel_client(void __iomem *pChannel, } if (expectedMinBytes > 0) { /* caller wants us to verify * channel size */ - unsigned long long bytes = readq(&((CHANNEL_HEADER __iomem *) - (pChannel))->Size); + unsigned long long bytes = + readq(&((struct channel_header __iomem *) + (pChannel))->Size); if (bytes < expectedMinBytes) { pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n", channelName, &expectedTypeGuid, @@ -335,7 +337,7 @@ ULTRA_check_channel_client(void __iomem *pChannel, } if (expectedVersionId > 0) { /* caller wants us to verify * channel version */ - unsigned long ver = readl(&((CHANNEL_HEADER __iomem *) + unsigned long ver = readl(&((struct channel_header __iomem *) (pChannel))->VersionId); if (ver != expectedVersionId) { pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8lx\n", @@ -346,8 +348,9 @@ ULTRA_check_channel_client(void __iomem *pChannel, } if (expectedSignature > 0) { /* caller wants us to verify * channel signature */ - unsigned long long sig = readq(&((CHANNEL_HEADER __iomem *) - (pChannel))->Signature); + unsigned long long sig = + readq(&((struct channel_header __iomem *) + (pChannel))->Signature); if (sig != expectedSignature) { pr_err("Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8llx actual=0x%-8.8llx\n", channelName, &expectedTypeGuid, @@ -416,7 +419,7 @@ static inline int ULTRA_channel_client_acquire_os(void __iomem *pChannel, u8 *chanId, void *logCtx, char *file, int line, char *func) { - CHANNEL_HEADER __iomem *pChan = pChannel; + struct channel_header __iomem *pChan = pChannel; if (readl(&pChan->CliStateOS) == CHANNELCLI_DISABLED) { if ((readb(&pChan->CliErrorOS) @@ -511,7 +514,7 @@ static inline void ULTRA_channel_client_release_os(void __iomem *pChannel, u8 *chanId, void *logCtx, char *file, int line, char *func) { - CHANNEL_HEADER __iomem *pChan = pChannel; + struct channel_header __iomem *pChan = pChannel; if (readb(&pChan->CliErrorOS) != 0) { /* we are in an error msg throttling state; come out of it */ @@ -552,8 +555,8 @@ ULTRA_channel_client_release_os(void __iomem *pChannel, u8 *chanId, * full. */ -unsigned char visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, u32 Queue, - void *pSignal); +unsigned char visor_signal_insert(struct channel_header __iomem *pChannel, + u32 Queue, void *pSignal); /* * Routine Description: @@ -574,8 +577,8 @@ unsigned char visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, u32 Queue, * empty. */ -unsigned char visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, u32 Queue, - void *pSignal); +unsigned char visor_signal_remove(struct channel_header __iomem *pChannel, + u32 Queue, void *pSignal); /* * Routine Description: @@ -596,7 +599,7 @@ unsigned char visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, u32 Queue, * Return value: * # of signals copied. */ -unsigned int SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue, +unsigned int SignalRemoveAll(struct channel_header *pChannel, u32 Queue, void *pSignal); /* @@ -610,7 +613,7 @@ unsigned int SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue, * Return value: * 1 if the signal queue is empty, 0 otherwise. */ -unsigned char visor_signalqueue_empty(CHANNEL_HEADER __iomem *pChannel, +unsigned char visor_signalqueue_empty(struct channel_header __iomem *pChannel, u32 Queue); #endif diff --git a/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h b/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h index f7ca6d167d60..8e8a5a57bddb 100644 --- a/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h +++ b/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h @@ -470,7 +470,7 @@ typedef struct _GUEST_DEVICES { } GUEST_DEVICES; typedef struct _ULTRA_CONTROLVM_CHANNEL_PROTOCOL { - CHANNEL_HEADER Header; + struct channel_header Header; GUEST_PHYSICAL_ADDRESS gpControlVm; /* guest physical address of * this channel */ GUEST_PHYSICAL_ADDRESS gpPartitionTables; /* guest physical address of diff --git a/drivers/staging/unisys/common-spar/include/channels/diagchannel.h b/drivers/staging/unisys/common-spar/include/channels/diagchannel.h index 9912e51b89b5..590022fd9fb6 100644 --- a/drivers/staging/unisys/common-spar/include/channels/diagchannel.h +++ b/drivers/staging/unisys/common-spar/include/channels/diagchannel.h @@ -383,7 +383,7 @@ typedef struct _DIAG_CHANNEL_PROTOCOL_HEADER { /* ----------------------- */ /* Offsets/sizes for diagnostic channel attributes... */ -#define DIAG_CH_QUEUE_HEADER_OFFSET (sizeof(ULTRA_CHANNEL_PROTOCOL)) +#define DIAG_CH_QUEUE_HEADER_OFFSET (sizeof(struct channel_header)) #define DIAG_CH_QUEUE_HEADER_SIZE (sizeof(SIGNAL_QUEUE_HEADER)) #define DIAG_CH_PROTOCOL_HEADER_OFFSET \ (DIAG_CH_QUEUE_HEADER_OFFSET + DIAG_CH_QUEUE_HEADER_SIZE) @@ -416,7 +416,7 @@ typedef struct _DIAG_CHANNEL_PROTOCOL_HEADER { *Reserved: Reserved area to allow for correct channel size padding. */ typedef struct _ULTRA_DIAG_CHANNEL_PROTOCOL { - ULTRA_CHANNEL_PROTOCOL CommonChannelHeader; + struct channel_header CommonChannelHeader; SIGNAL_QUEUE_HEADER QueueHeader; DIAG_CHANNEL_PROTOCOL_HEADER DiagChannelHeader; DIAG_CHANNEL_EVENT Events[(DIAG_CH_SIZE - DIAG_CH_EVENT_OFFSET) / diff --git a/drivers/staging/unisys/common-spar/include/channels/iochannel.h b/drivers/staging/unisys/common-spar/include/channels/iochannel.h index 7de87a481a8c..77335964e3fe 100644 --- a/drivers/staging/unisys/common-spar/include/channels/iochannel.h +++ b/drivers/staging/unisys/common-spar/include/channels/iochannel.h @@ -685,7 +685,7 @@ struct uiscmdrsp { * this header there is a large region of memory which contains the command and * response queues as specified in cmdQ and rspQ SIGNAL_QUEUE_HEADERS. */ typedef struct _ULTRA_IO_CHANNEL_PROTOCOL { - CHANNEL_HEADER ChannelHeader; + struct channel_header ChannelHeader; SIGNAL_QUEUE_HEADER cmdQ; SIGNAL_QUEUE_HEADER rspQ; union { diff --git a/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h b/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h index 420b7d859522..76bc7140d5e7 100644 --- a/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h +++ b/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h @@ -76,7 +76,7 @@ typedef struct _ULTRA_VBUS_HEADERINFO { } ULTRA_VBUS_HEADERINFO; struct ultra_vbus_channel_protocol { - ULTRA_CHANNEL_PROTOCOL ChannelHeader; /* initialized by server */ + struct channel_header ChannelHeader; /* initialized by server */ ULTRA_VBUS_HEADERINFO HdrInfo; /* initialized by server */ /* the remainder of this channel is filled in by the client */ struct ultra_vbus_deviceinfo ChpInfo; diff --git a/drivers/staging/unisys/include/uisqueue.h b/drivers/staging/unisys/include/uisqueue.h index db9d2051ae2f..7d01c42abcb9 100644 --- a/drivers/staging/unisys/include/uisqueue.h +++ b/drivers/staging/unisys/include/uisqueue.h @@ -34,7 +34,7 @@ #include "controlvmcompletionstatus.h" struct uisqueue_info { - CHANNEL_HEADER __iomem *chan; + struct channel_header __iomem *chan; /* channel containing queues in which scsi commands & * responses are queued */ diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index 35e8a61c7202..0de0eee95b8f 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c @@ -444,8 +444,9 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) if (!uuid_le_cmp(dev->channel_uuid, spar_vhba_channel_protocol_uuid)) { - wait_for_valid_guid(&((CHANNEL_HEADER - __iomem *) (dev-> + wait_for_valid_guid(&(( + struct channel_header + __iomem *) (dev-> chanptr))-> Type); if (!ULTRA_VHBA_CHANNEL_OK_CLIENT @@ -469,8 +470,9 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) } else if (!uuid_le_cmp(dev->channel_uuid, spar_vnic_channel_protocol_uuid)) { - wait_for_valid_guid(&((CHANNEL_HEADER - __iomem *) (dev-> + wait_for_valid_guid(&(( + struct channel_header + __iomem *) (dev-> chanptr))-> Type); if (!ULTRA_VNIC_CHANNEL_OK_CLIENT @@ -1565,7 +1567,7 @@ uislib_mod_init(void) LOGINF("sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL):%lu bytes\n", (ulong) sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL)); LOGINF("sizeof(CHANNEL_HEADER):%lu bytes\n", - (ulong) sizeof(CHANNEL_HEADER)); + (ulong) sizeof(struct channel_header)); LOGINF("sizeof(ULTRA_IO_CHANNEL_PROTOCOL):%lu bytes\n", (ulong) sizeof(ULTRA_IO_CHANNEL_PROTOCOL)); LOGINF("SIZEOF_CMDRSP:%lu bytes\n", SIZEOF_CMDRSP); diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c index e4130c9714fc..c25c1d9f129c 100644 --- a/drivers/staging/unisys/virthba/virthba.c +++ b/drivers/staging/unisys/virthba/virthba.c @@ -420,7 +420,7 @@ static irqreturn_t virthba_ISR(int irq, void *dev_id) { struct virthba_info *virthbainfo = (struct virthba_info *) dev_id; - CHANNEL_HEADER __iomem *pChannelHeader; + struct channel_header __iomem *pChannelHeader; SIGNAL_QUEUE_HEADER __iomem *pqhdr; u64 mask; unsigned long long rc1; @@ -461,7 +461,7 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id) int rsp; int i; irq_handler_t handler = virthba_ISR; - CHANNEL_HEADER __iomem *pChannelHeader; + struct channel_header __iomem *pChannelHeader; SIGNAL_QUEUE_HEADER __iomem *pqhdr; u64 mask; diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c index f782916cbf2b..2be0447c612e 100644 --- a/drivers/staging/unisys/virtpci/virtpci.c +++ b/drivers/staging/unisys/virtpci/virtpci.c @@ -195,7 +195,7 @@ static int write_vbus_chpInfo(struct ultra_vbus_channel_protocol *chan, LOGERR("vbus channel not present"); return -1; } - off = sizeof(ULTRA_CHANNEL_PROTOCOL) + chan->HdrInfo.chpInfoByteOffset; + off = sizeof(struct channel_header) + chan->HdrInfo.chpInfoByteOffset; if (chan->HdrInfo.chpInfoByteOffset == 0) { LOGERR("vbus channel not used, because chpInfoByteOffset == 0"); return -1; @@ -214,7 +214,7 @@ static int write_vbus_busInfo(struct ultra_vbus_channel_protocol *chan, LOGERR("vbus channel not present"); return -1; } - off = sizeof(ULTRA_CHANNEL_PROTOCOL) + chan->HdrInfo.busInfoByteOffset; + off = sizeof(struct channel_header) + chan->HdrInfo.busInfoByteOffset; if (chan->HdrInfo.busInfoByteOffset == 0) { LOGERR("vbus channel not used, because busInfoByteOffset == 0"); return -1; @@ -237,7 +237,7 @@ write_vbus_devInfo(struct ultra_vbus_channel_protocol *chan, return -1; } off = - (sizeof(ULTRA_CHANNEL_PROTOCOL) + + (sizeof(struct channel_header) + chan->HdrInfo.devInfoByteOffset) + (chan->HdrInfo.deviceInfoStructBytes * devix); if (chan->HdrInfo.devInfoByteOffset == 0) { diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c index 01a44c553500..d2fc89a0bbd2 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c +++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c @@ -30,7 +30,7 @@ struct VISORCHANNEL_Tag { MEMREGION *memregion; /* from visor_memregion_create() */ - CHANNEL_HEADER chan_hdr; + struct channel_header chan_hdr; uuid_le guid; ulong size; BOOL needs_lock; @@ -70,19 +70,19 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channelBytes, /* prepare chan_hdr (abstraction to read/write channel memory) */ if (parent == NULL) p->memregion = - visor_memregion_create(physaddr, sizeof(CHANNEL_HEADER)); + visor_memregion_create(physaddr, + sizeof(struct channel_header)); else p->memregion = visor_memregion_create_overlapped(parent->memregion, - off, - sizeof(CHANNEL_HEADER)); + off, sizeof(struct channel_header)); if (p->memregion == NULL) { ERRDRV("visor_memregion_create failed failed: (status=0)\n"); rc = NULL; goto Away; } if (visor_memregion_read(p->memregion, 0, &p->chan_hdr, - sizeof(CHANNEL_HEADER)) < 0) { + sizeof(struct channel_header)) < 0) { ERRDRV("visor_memregion_read failed: (status=0)\n"); rc = NULL; goto Away; @@ -225,8 +225,11 @@ visorchannel_read(VISORCHANNEL *channel, ulong offset, { int rc = visor_memregion_read(channel->memregion, offset, local, nbytes); - if ((rc >= 0) && (offset == 0) && (nbytes >= sizeof(CHANNEL_HEADER))) - memcpy(&channel->chan_hdr, local, sizeof(CHANNEL_HEADER)); + if ((rc >= 0) && (offset == 0) && + (nbytes >= sizeof(struct channel_header))) { + memcpy(&channel->chan_hdr, local, + sizeof(struct channel_header)); + } return rc; } EXPORT_SYMBOL_GPL(visorchannel_read); @@ -235,8 +238,9 @@ int visorchannel_write(VISORCHANNEL *channel, ulong offset, void *local, ulong nbytes) { - if (offset == 0 && nbytes >= sizeof(CHANNEL_HEADER)) - memcpy(&channel->chan_hdr, local, sizeof(CHANNEL_HEADER)); + if (offset == 0 && nbytes >= sizeof(struct channel_header)) + memcpy(&channel->chan_hdr, local, + sizeof(struct channel_header)); return visor_memregion_write(channel->memregion, offset, local, nbytes); } EXPORT_SYMBOL_GPL(visorchannel_write); @@ -316,7 +320,7 @@ sig_read_header(VISORCHANNEL *channel, u32 queue, { BOOL rc = FALSE; - if (channel->chan_hdr.oChannelSpace < sizeof(CHANNEL_HEADER)) { + if (channel->chan_hdr.oChannelSpace < sizeof(struct channel_header)) { ERRDRV("oChannelSpace too small: (status=%d)\n", rc); goto Away; } @@ -559,8 +563,8 @@ visorchannel_debug(VISORCHANNEL *channel, int nQueues, HOSTADDRESS addr = 0; ulong nbytes = 0, nbytes_region = 0; MEMREGION *memregion = NULL; - CHANNEL_HEADER hdr; - CHANNEL_HEADER *phdr = &hdr; + struct channel_header hdr; + struct channel_header *phdr = &hdr; int i = 0; int errcode = 0; @@ -576,7 +580,7 @@ visorchannel_debug(VISORCHANNEL *channel, int nQueues, addr = visor_memregion_get_physaddr(memregion); nbytes_region = visor_memregion_get_nbytes(memregion); errcode = visorchannel_read(channel, off, - phdr, sizeof(CHANNEL_HEADER)); + phdr, sizeof(struct channel_header)); if (errcode < 0) { seq_printf(seq, "Read of channel header failed with errcode=%d)\n", diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index cfacf17ad26a..e26db99c4d58 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -114,7 +114,7 @@ typedef struct { /* Manages the request payload in the controlvm channel */ static CONTROLVM_PAYLOAD_INFO ControlVm_payload_info; -static pCHANNEL_HEADER Test_Vnic_channel; +static struct channel_header *Test_Vnic_channel; typedef struct { CONTROLVM_MESSAGE_HEADER Dumpcapture_header;