[PATCH 85/91] staging: unisys: refactor ULTRA_IO_CHANNEL_PROTOCOL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove the typedef from ULTRA_IO_CHANNEL_PROTOCOL and use the name struct
spar_io_channel_protocol instead. Fix CamelCase member names:

ChannelHeader => channel_header
cmdQ => cmd_q
rspQ => rsp_q
zoneGuid => zone_uuid
ClientString => client_string

Update all references to changed names.

Signed-off-by: Benjamin Romer <benjamin.romer@xxxxxxxxxx>
---
 .../common-spar/include/channels/iochannel.h       | 127 +++++++++++----------
 drivers/staging/unisys/uislib/uislib.c             |   4 +-
 drivers/staging/unisys/virtpci/virtpci.c           |  26 ++---
 3 files changed, 79 insertions(+), 78 deletions(-)

diff --git a/drivers/staging/unisys/common-spar/include/channels/iochannel.h b/drivers/staging/unisys/common-spar/include/channels/iochannel.h
index b4da347..071cf72 100644
--- a/drivers/staging/unisys/common-spar/include/channels/iochannel.h
+++ b/drivers/staging/unisys/common-spar/include/channels/iochannel.h
@@ -662,11 +662,11 @@ struct uiscmdrsp {
 
 /* This is just the header of the IO channel.  It is assumed that directly after
 * 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 {
-	struct channel_header ChannelHeader;
-	struct signal_queue_header cmdQ;
-	struct signal_queue_header rspQ;
+* response queues as specified in cmd_q and rsp_q SIGNAL_QUEUE_HEADERS. */
+struct spar_io_channel_protocol {
+	struct channel_header channel_header;
+	struct signal_queue_header cmd_q;
+	struct signal_queue_header rsp_q;
 	union {
 		struct {
 			struct vhba_wwnn wwnn;	/* 8 bytes */
@@ -676,14 +676,14 @@ typedef struct _ULTRA_IO_CHANNEL_PROTOCOL {
 			u8 macaddr[MAX_MACADDR_LEN];	/* 6 bytes */
 			u32 num_rcv_bufs;	/* 4 */
 			u32 mtu;	/* 4 */
-			uuid_le zoneGuid;	/* 16 */
+			uuid_le zone_uuid;	/* 16 */
 		} vnic;		/* total     30 */
 	};
 
 #define MAX_CLIENTSTRING_LEN 1024
-	 u8 clientString[MAX_CLIENTSTRING_LEN];	/* NULL terminated - so holds
+	 u8 client_string[MAX_CLIENTSTRING_LEN];/* NULL terminated - so holds
 						 * max - 1 bytes */
-} ULTRA_IO_CHANNEL_PROTOCOL;
+};
 
 #pragma pack(pop)
 /* ///////////// END PRAGMA PACK PUSH 1 /////////////////////////// */
@@ -712,13 +712,14 @@ typedef struct _ULTRA_IO_CHANNEL_PROTOCOL {
 * INLINE functions for initializing and accessing I/O data channels
 */
 
-#define NUMSIGNALS(x, q) (((ULTRA_IO_CHANNEL_PROTOCOL *)(x))->q.MaxSignalSlots)
-#define SIZEOF_PROTOCOL (COVER(sizeof(ULTRA_IO_CHANNEL_PROTOCOL), 64))
+#define NUMSIGNALS(x, q) \
+		(((struct spar_io_channel_protocol *)(x))->q.MaxSignalSlots)
+#define SIZEOF_PROTOCOL (COVER(sizeof(struct spar_io_channel_protocol), 64))
 #define SIZEOF_CMDRSP (COVER(sizeof(struct uiscmdrsp), 64))
 
 #define IO_CHANNEL_SIZE(x) COVER(SIZEOF_PROTOCOL + \
-				 (NUMSIGNALS(x, cmdQ) + \
-				  NUMSIGNALS(x, rspQ)) * SIZEOF_CMDRSP, 4096)
+				 (NUMSIGNALS(x, cmd_q) + \
+				  NUMSIGNALS(x, rsp_q)) * SIZEOF_CMDRSP, 4096)
 #define MIN_IO_CHANNEL_SIZE COVER(SIZEOF_PROTOCOL + \
 				  2 * MIN_NUMSIGNALS * SIZEOF_CMDRSP, 4096)
 #ifdef __GNUC__
@@ -728,34 +729,34 @@ typedef struct _ULTRA_IO_CHANNEL_PROTOCOL {
 #define QSIZEFROMBYTES(bytes) (QSLOTSFROMBYTES(bytes)*SIZEOF_CMDRSP)
 #define SignalQInit(x)						\
 	do {							\
-		x->cmdQ.size = QSIZEFROMBYTES(x->ChannelHeader.size);	\
-		x->cmdQ.sig_base_offset = SIZEOF_PROTOCOL -		\
-			offsetof(ULTRA_IO_CHANNEL_PROTOCOL, cmdQ);	\
-		x->cmdQ.signal_size = SIZEOF_CMDRSP;			\
-		x->cmdQ.max_slots =				\
-			QSLOTSFROMBYTES(x->ChannelHeader.size);		\
-		x->cmdQ.max_signals = x->cmdQ.max_slots - 1;	\
-		x->rspQ.size = QSIZEFROMBYTES(x->ChannelHeader.size);	\
-		x->rspQ.sig_base_offset =				\
-			(SIZEOF_PROTOCOL + x->cmdQ.size) -		\
-			offsetof(ULTRA_IO_CHANNEL_PROTOCOL, rspQ);	\
-		x->rspQ.signal_size = SIZEOF_CMDRSP;			\
-		x->rspQ.max_slots =				\
-			QSLOTSFROMBYTES(x->ChannelHeader.size);		\
-		x->rspQ.max_signals = x->rspQ.max_slots - 1;	\
-		x->ChannelHeader.ch_space_offset =			\
-			offsetof(ULTRA_IO_CHANNEL_PROTOCOL, cmdQ);	\
+		x->cmd_q.size = QSIZEFROMBYTES(x->channel_header.size);	\
+		x->cmd_q.sig_base_offset = SIZEOF_PROTOCOL -		\
+			offsetof(struct spar_io_channel_protocol, cmd_q);\
+		x->cmd_q.signal_size = SIZEOF_CMDRSP;			\
+		x->cmd_q.max_slots =				\
+			QSLOTSFROMBYTES(x->channel_header.size);	\
+		x->cmd_q.max_signals = x->cmd_q.max_slots - 1;	\
+		x->rsp_q.size = QSIZEFROMBYTES(x->channel_header.size);	\
+		x->rsp_q.sig_base_offset =				\
+			(SIZEOF_PROTOCOL + x->cmd_q.size) -		\
+			offsetof(struct spar_io_channel_protocol, rsp_q);\
+		x->rsp_q.signal_size = SIZEOF_CMDRSP;			\
+		x->rsp_q.max_slots =				\
+			QSLOTSFROMBYTES(x->channel_header.size);	\
+		x->rsp_q.max_signals = x->rsp_q.max_slots - 1;	\
+		x->channel_header.ch_space_offset =			\
+			offsetof(struct spar_io_channel_protocol, cmd_q);\
 	} while (0)
 
 #define INIT_CLIENTSTRING(chan, type, clientStr, clientStrLen)	\
 	do {								\
 		if (clientStr) {					\
-			chan->ChannelHeader.cli_str_offset =		\
-				offsetof(type, clientString);		\
-			memcpy(chan->clientString, clientStr,		\
+			chan->channel_header.cli_str_offset =		\
+				offsetof(type, client_string);		\
+			memcpy(chan->client_string, clientStr,		\
 			       MINNUM(clientStrLen,			\
 				      (u32)(MAX_CLIENTSTRING_LEN - 1))); \
-			chan->clientString[MINNUM(clientStrLen,		\
+			chan->client_string[MINNUM(clientStrLen,	\
 						  (u32)(MAX_CLIENTSTRING_LEN \
 							 - 1))]		\
 				= '\0';					\
@@ -773,68 +774,68 @@ typedef struct _ULTRA_IO_CHANNEL_PROTOCOL {
 	ULTRA_CHANNEL_SERVER_TRANSITION(x, chanId, SrvState, \
 					CHANNELSRV_UNINITIALIZED, logCtx)
 
-static inline int ULTRA_VHBA_init_channel(ULTRA_IO_CHANNEL_PROTOCOL *x,
+static inline int ULTRA_VHBA_init_channel(struct spar_io_channel_protocol *x,
 					      struct vhba_wwnn *wwnn,
 					      struct vhba_config_max *max,
 					      unsigned char *clientStr,
 					      u32 clientStrLen, u64 bytes)  {
-	memset(x, 0, sizeof(ULTRA_IO_CHANNEL_PROTOCOL));
-	x->ChannelHeader.version_id = ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID;
-	x->ChannelHeader.signature = ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE;
-	x->ChannelHeader.srv_state = CHANNELSRV_UNINITIALIZED;
-	x->ChannelHeader.header_size = sizeof(x->ChannelHeader);
-	x->ChannelHeader.size = COVER(bytes, 4096);
-	x->ChannelHeader.chtype = spar_vhba_channel_protocol_uuid;
-	x->ChannelHeader.zone_uuid = NULL_UUID_LE;
+	memset(x, 0, sizeof(struct spar_io_channel_protocol));
+	x->channel_header.version_id = ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID;
+	x->channel_header.signature = ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE;
+	x->channel_header.srv_state = CHANNELSRV_UNINITIALIZED;
+	x->channel_header.header_size = sizeof(x->channel_header);
+	x->channel_header.size = COVER(bytes, 4096);
+	x->channel_header.chtype = spar_vhba_channel_protocol_uuid;
+	x->channel_header.zone_uuid = NULL_UUID_LE;
 	x->vhba.wwnn = *wwnn;
 	x->vhba.max = *max;
-	INIT_CLIENTSTRING(x, ULTRA_IO_CHANNEL_PROTOCOL, clientStr,
+	INIT_CLIENTSTRING(x, struct spar_io_channel_protocol, clientStr,
 			  clientStrLen);
 	SignalQInit(x);
-	if ((x->cmdQ.max_slots > MAX_NUMSIGNALS) ||
-	     (x->rspQ.max_slots > MAX_NUMSIGNALS)) {
+	if ((x->cmd_q.max_slots > MAX_NUMSIGNALS) ||
+	     (x->rsp_q.max_slots > MAX_NUMSIGNALS)) {
 		return 0;
 	}
-	if ((x->cmdQ.max_slots < MIN_NUMSIGNALS) ||
-	     (x->rspQ.max_slots < MIN_NUMSIGNALS)) {
+	if ((x->cmd_q.max_slots < MIN_NUMSIGNALS) ||
+	     (x->rsp_q.max_slots < MIN_NUMSIGNALS)) {
 		return 0;
 	}
 	return 1;
 }
 
-static inline void ULTRA_VHBA_set_max(ULTRA_IO_CHANNEL_PROTOCOL *x,
+static inline void ULTRA_VHBA_set_max(struct spar_io_channel_protocol *x,
 				      struct vhba_config_max *max)  {
 	x->vhba.max = *max;
 }
 
-static inline int ULTRA_VNIC_init_channel(ULTRA_IO_CHANNEL_PROTOCOL *x,
+static inline int ULTRA_VNIC_init_channel(struct spar_io_channel_protocol *x,
 						 unsigned char *macaddr,
 						 u32 num_rcv_bufs, u32 mtu,
 						 uuid_le zoneGuid,
 						 unsigned char *clientStr,
 						 u32 clientStrLen,
 						 u64 bytes)  {
-	memset(x, 0, sizeof(ULTRA_IO_CHANNEL_PROTOCOL));
-	x->ChannelHeader.version_id = ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID;
-	x->ChannelHeader.signature = ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE;
-	x->ChannelHeader.srv_state = CHANNELSRV_UNINITIALIZED;
-	x->ChannelHeader.header_size = sizeof(x->ChannelHeader);
-	x->ChannelHeader.size = COVER(bytes, 4096);
-	x->ChannelHeader.chtype = spar_vnic_channel_protocol_uuid;
-	x->ChannelHeader.zone_uuid = NULL_UUID_LE;
+	memset(x, 0, sizeof(struct spar_io_channel_protocol));
+	x->channel_header.version_id = ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID;
+	x->channel_header.signature = ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE;
+	x->channel_header.srv_state = CHANNELSRV_UNINITIALIZED;
+	x->channel_header.header_size = sizeof(x->channel_header);
+	x->channel_header.size = COVER(bytes, 4096);
+	x->channel_header.chtype = spar_vnic_channel_protocol_uuid;
+	x->channel_header.zone_uuid = NULL_UUID_LE;
 	memcpy(x->vnic.macaddr, macaddr, MAX_MACADDR_LEN);
 	x->vnic.num_rcv_bufs = num_rcv_bufs;
 	x->vnic.mtu = mtu;
-	x->vnic.zoneGuid = zoneGuid;
-	INIT_CLIENTSTRING(x, ULTRA_IO_CHANNEL_PROTOCOL, clientStr,
+	x->vnic.zone_uuid = zoneGuid;
+	INIT_CLIENTSTRING(x, struct spar_io_channel_protocol, clientStr,
 			   clientStrLen);
 	SignalQInit(x);
-	if ((x->cmdQ.max_slots > MAX_NUMSIGNALS) ||
-	     (x->rspQ.max_slots > MAX_NUMSIGNALS)) {
+	if ((x->cmd_q.max_slots > MAX_NUMSIGNALS) ||
+	     (x->rsp_q.max_slots > MAX_NUMSIGNALS)) {
 		return 0;
 	}
-	if ((x->cmdQ.max_slots < MIN_NUMSIGNALS) ||
-	     (x->rspQ.max_slots < MIN_NUMSIGNALS)) {
+	if ((x->cmd_q.max_slots < MIN_NUMSIGNALS) ||
+	     (x->rsp_q.max_slots < MIN_NUMSIGNALS)) {
 		return 0;
 	}
 	return 1;
diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c
index 14948a0..6e08734 100644
--- a/drivers/staging/unisys/uislib/uislib.c
+++ b/drivers/staging/unisys/uislib/uislib.c
@@ -1568,8 +1568,8 @@ uislib_mod_init(void)
 	       (ulong) sizeof(struct spar_controlvm_channel_protocol));
 	LOGINF("sizeof(CHANNEL_HEADER):%lu bytes\n",
 	       (ulong) sizeof(struct channel_header));
-	LOGINF("sizeof(ULTRA_IO_CHANNEL_PROTOCOL):%lu bytes\n",
-	       (ulong) sizeof(ULTRA_IO_CHANNEL_PROTOCOL));
+	LOGINF("sizeof(struct spar_io_channel_protocol):%lu bytes\n",
+	       (ulong) sizeof(struct spar_io_channel_protocol));
 	LOGINF("SIZEOF_CMDRSP:%lu bytes\n", SIZEOF_CMDRSP);
 	LOGINF("SIZEOF_PROTOCOL:%lu bytes\n", SIZEOF_PROTOCOL);
 
diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c
index eaae4e8..ee1beb5 100644
--- a/drivers/staging/unisys/virtpci/virtpci.c
+++ b/drivers/staging/unisys/virtpci/virtpci.c
@@ -171,13 +171,13 @@ struct virtpci_busdev {
 /*****************************************************/
 
 static inline
-int WAIT_FOR_IO_CHANNEL(ULTRA_IO_CHANNEL_PROTOCOL __iomem  *chanptr)
+int WAIT_FOR_IO_CHANNEL(struct spar_io_channel_protocol __iomem  *chanptr)
 {
 	int count = 120;
 
 	while (count > 0) {
 
-		if (SPAR_CHANNEL_SERVER_READY(&chanptr->ChannelHeader))
+		if (SPAR_CHANNEL_SERVER_READY(&chanptr->channel_header))
 			return 1;
 		UIS_THREAD_WAIT_SEC(1);
 		count--;
@@ -293,11 +293,11 @@ static int add_vbus(struct add_vbus_guestpart *addparams)
  */
 #define GET_SCSIADAPINFO_FROM_CHANPTR(chanptr) {			\
 	memcpy_fromio(&scsi.wwnn,					\
-		      &((ULTRA_IO_CHANNEL_PROTOCOL __iomem *)		\
+		      &((struct spar_io_channel_protocol __iomem *)	\
 			chanptr)->vhba.wwnn,				\
 		      sizeof(struct vhba_wwnn));			\
 	memcpy_fromio(&scsi.max,					\
-		      &((ULTRA_IO_CHANNEL_PROTOCOL __iomem *)		\
+		      &((struct spar_io_channel_protocol __iomem *)	\
 			chanptr)->vhba.max,				\
 		      sizeof(struct vhba_config_max));			\
 	}
@@ -325,7 +325,7 @@ static int add_vhba(struct add_virt_guestpart *addparams)
 
 	POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
 	if (!WAIT_FOR_IO_CHANNEL
-	    ((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) addparams->chanptr)) {
+	    ((struct spar_io_channel_protocol __iomem *) addparams->chanptr)) {
 		LOGERR("Timed out.  Channel not ready\n");
 		POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
 		return 0;
@@ -355,17 +355,17 @@ static int add_vhba(struct add_virt_guestpart *addparams)
  */
 #define GET_NETADAPINFO_FROM_CHANPTR(chanptr) {				\
 		memcpy_fromio(net.mac_addr,				\
-		       ((ULTRA_IO_CHANNEL_PROTOCOL __iomem *)		\
+		       ((struct spar_io_channel_protocol __iomem *)	\
 			chanptr)->vnic.macaddr,				\
 		       MAX_MACADDR_LEN);				\
 		net.num_rcv_bufs =					\
-			readl(&((ULTRA_IO_CHANNEL_PROTOCOL __iomem *)	\
+			readl(&((struct spar_io_channel_protocol __iomem *)\
 				chanptr)->vnic.num_rcv_bufs);		\
-		net.mtu = readl(&((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) \
+		net.mtu = readl(&((struct spar_io_channel_protocol __iomem *) \
 				  chanptr)->vnic.mtu);			\
 		memcpy_fromio(&net.zoneGuid, \
-			      &((ULTRA_IO_CHANNEL_PROTOCOL __iomem *)	\
-				chanptr)->vnic.zoneGuid,		\
+			      &((struct spar_io_channel_protocol __iomem *)\
+				chanptr)->vnic.zone_uuid,		\
 			      sizeof(uuid_le));				\
 }
 
@@ -382,7 +382,7 @@ add_vnic(struct add_virt_guestpart *addparams)
 
 	POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
 	if (!WAIT_FOR_IO_CHANNEL
-	    ((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) addparams->chanptr)) {
+	    ((struct spar_io_channel_protocol __iomem *) addparams->chanptr)) {
 		LOGERR("Timed out, channel not ready\n");
 		POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
 		return 0;
@@ -905,7 +905,7 @@ static int virtpci_device_add(struct device *parentbus, int devtype,
 	struct virtpci_dev *tmpvpcidev = NULL, *prev;
 	unsigned long flags;
 	int ret;
-	ULTRA_IO_CHANNEL_PROTOCOL __iomem *pIoChan = NULL;
+	struct spar_io_channel_protocol __iomem *pIoChan = NULL;
 	struct device *pDev;
 
 	LOGINF("virtpci_device_add parentbus:%p chanptr:%p\n", parentbus,
@@ -946,7 +946,7 @@ static int virtpci_device_add(struct device *parentbus, int devtype,
 	virtpcidev->queueinfo.send_int_if_needed = NULL;
 
 	/* Set up safe queue... */
-	pIoChan = (ULTRA_IO_CHANNEL_PROTOCOL __iomem *)
+	pIoChan = (struct spar_io_channel_protocol __iomem *)
 		virtpcidev->queueinfo.chan;
 
 	virtpcidev->intr = addparams->intr;
-- 
1.9.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux