Get rid of the typedef for CONTROLVM_PACKET_DEVICE_CREATE, instead using struct controlvm_packet_device_create. Fix CamelCase names and update all references to changed names. Clean up comments. busNo => bus_no devNo => dev_no channelAddr => channel_addr channelBytes => channel_bytes dataTypeGuid => data_type_uuid devInstGuid => dev_inst_uuid Signed-off-by: Benjamin Romer <benjamin.romer@xxxxxxxxxx> --- .../include/channels/controlvmchannel.h | 29 +++++------ drivers/staging/unisys/uislib/uislib.c | 56 +++++++++++----------- .../unisys/visorchipset/visorchipset_main.c | 18 +++---- 3 files changed, 50 insertions(+), 53 deletions(-) diff --git a/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h b/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h index abf6bc9..78c4b33 100644 --- a/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h +++ b/drivers/staging/unisys/common-spar/include/channels/controlvmchannel.h @@ -215,20 +215,17 @@ struct controlvm_message_header { /* if non-zero, there is a payload to copy. */ }; -typedef struct _CONTROLVM_PACKET_DEVICE_CREATE { - u32 busNo; /**< bus # (0..n-1) from the msg receiver's - * perspective */ - - /* Control uses header SegmentIndex field to access bus number... */ - u32 devNo; /**< bus-relative (0..n-1) device number */ - u64 channelAddr; /**< Guest physical address of the channel, which - * can be dereferenced by the receiver - * of this ControlVm command */ - u64 channelBytes; /**< specifies size of the channel in bytes */ - uuid_le dataTypeGuid;/**< specifies format of data in channel */ - uuid_le devInstGuid; /**< instance guid for the device */ - struct irq_info intr; /**< specifies interrupt information */ -} CONTROLVM_PACKET_DEVICE_CREATE; /* for CONTROLVM_DEVICE_CREATE */ +struct controlvm_packet_device_create { + u32 bus_no; /* bus # (0..n-1) from the msg receiver's end */ + u32 dev_no; /* bus-relative (0..n-1) device number */ + u64 channel_addr; /* Guest physical address of the channel, which + * can be dereferenced by the receiver of this + * ControlVm command */ + u64 channel_bytes; /* specifies size of the channel in bytes */ + uuid_le data_type_uuid; /* specifies format of data in channel */ + uuid_le dev_inst_uuid; /* instance guid for the device */ + struct irq_info intr; /* specifies interrupt information */ +}; /* for CONTROLVM_DEVICE_CREATE */ typedef struct _CONTROLVM_PACKET_DEVICE_CONFIGURE { u32 busNo; /**< bus # (0..n-1) from the msg @@ -240,7 +237,7 @@ typedef struct _CONTROLVM_PACKET_DEVICE_CONFIGURE { typedef struct _CONTROLVM_MESSAGE_DEVICE_CREATE { struct controlvm_message_header Header; - CONTROLVM_PACKET_DEVICE_CREATE Packet; + struct controlvm_packet_device_create Packet; } CONTROLVM_MESSAGE_DEVICE_CREATE; /* total 128 bytes */ typedef struct _CONTROLVM_MESSAGE_DEVICE_CONFIGURE { @@ -285,7 +282,7 @@ struct controlvm_message_packet { * sendBusInterruptHandle is kept in CP. */ } configure_bus; /* for CONTROLVM_BUS_CONFIGURE */ /* for CONTROLVM_DEVICE_CREATE */ - CONTROLVM_PACKET_DEVICE_CREATE create_device; + struct controlvm_packet_device_create create_device; struct { u32 bus_no; /* bus # (0..n-1) from the msg * receiver's perspective */ diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index 63f1d6e..2b1ae7c 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c @@ -354,8 +354,8 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) u64 minSize = MIN_IO_CHANNEL_SIZE; struct req_handler_info *pReqHandler; - busNo = msg->cmd.create_device.busNo; - devNo = msg->cmd.create_device.devNo; + busNo = msg->cmd.create_device.bus_no; + devNo = msg->cmd.create_device.dev_no; POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, devNo, busNo, POSTCODE_SEVERITY_INFO); @@ -368,9 +368,9 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) return CONTROLVM_RESP_ERROR_KMALLOC_FAILED; } - dev->channel_uuid = msg->cmd.create_device.dataTypeGuid; + dev->channel_uuid = msg->cmd.create_device.data_type_uuid; dev->intr = msg->cmd.create_device.intr; - dev->channel_addr = msg->cmd.create_device.channelAddr; + dev->channel_addr = msg->cmd.create_device.channel_addr; dev->bus_no = busNo; dev->dev_no = devNo; sema_init(&dev->interrupt_callback_lock, 1); /* unlocked */ @@ -385,9 +385,9 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) * channel */ minSize = pReqHandler->min_channel_bytes; - if (minSize > msg->cmd.create_device.channelBytes) { + if (minSize > msg->cmd.create_device.channel_bytes) { LOGERR("CONTROLVM_DEVICE_CREATE Failed: channel size is too small, channel size:0x%lx, required size:0x%lx", - (ulong) msg->cmd.create_device.channelBytes, + (ulong) msg->cmd.create_device.channel_bytes, (ulong) minSize); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, POSTCODE_SEVERITY_ERR); @@ -396,19 +396,19 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf) } dev->chanptr = uislib_ioremap_cache(dev->channel_addr, - msg->cmd.create_device.channelBytes); + msg->cmd.create_device.channel_bytes); if (!dev->chanptr) { LOGERR("CONTROLVM_DEVICE_CREATE Failed: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed", dev->channel_addr, - msg->cmd.create_device.channelBytes); + msg->cmd.create_device.channel_bytes); result = CONTROLVM_RESP_ERROR_IOREMAP_FAILED; POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo, POSTCODE_SEVERITY_ERR); goto Away; } } - dev->instance_uuid = msg->cmd.create_device.devInstGuid; - dev->channel_bytes = msg->cmd.create_device.channelBytes; + dev->instance_uuid = msg->cmd.create_device.dev_inst_uuid; + dev->channel_bytes = msg->cmd.create_device.channel_bytes; read_lock(&BusListLock); for (bus = BusListHead; bus; bus = bus->next) { @@ -945,15 +945,15 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, * need to be ioremap()ed */ msg.hdr.flags.test_message = 1; - msg.cmd.create_device.busNo = bus_no; - msg.cmd.create_device.devNo = dev_no; - msg.cmd.create_device.devInstGuid = inst_uuid; + msg.cmd.create_device.bus_no = bus_no; + msg.cmd.create_device.dev_no = dev_no; + msg.cmd.create_device.dev_inst_uuid = inst_uuid; if (intr) msg.cmd.create_device.intr = *intr; else memset(&msg.cmd.create_device.intr, 0, sizeof(struct irq_info)); - msg.cmd.create_device.channelAddr = phys_chan_addr; + msg.cmd.create_device.channel_addr = phys_chan_addr; if (chan_bytes < MIN_IO_CHANNEL_SIZE) { LOGERR("wrong channel size.chan_bytes = 0x%x IO_CHANNEL_SIZE= 0x%x\n", chan_bytes, (unsigned int) MIN_IO_CHANNEL_SIZE); @@ -961,8 +961,8 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR); return 0; } - msg.cmd.create_device.channelBytes = chan_bytes; - msg.cmd.create_device.dataTypeGuid = spar_vhba_channel_protocol_uuid; + msg.cmd.create_device.channel_bytes = chan_bytes; + msg.cmd.create_device.data_type_uuid = spar_vhba_channel_protocol_uuid; if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { LOGERR("VHBA create_device failed.\n"); POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, dev_no, bus_no, @@ -1004,15 +1004,15 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, * need to be ioremap()ed */ msg.hdr.flags.test_message = 1; - msg.cmd.create_device.busNo = bus_no; - msg.cmd.create_device.devNo = dev_no; - msg.cmd.create_device.devInstGuid = inst_uuid; + msg.cmd.create_device.bus_no = bus_no; + msg.cmd.create_device.dev_no = dev_no; + msg.cmd.create_device.dev_inst_uuid = inst_uuid; if (intr) msg.cmd.create_device.intr = *intr; else memset(&msg.cmd.create_device.intr, 0, sizeof(struct irq_info)); - msg.cmd.create_device.channelAddr = phys_chan_addr; + msg.cmd.create_device.channel_addr = phys_chan_addr; if (chan_bytes < MIN_IO_CHANNEL_SIZE) { LOGERR("wrong channel size.chan_bytes = 0x%x IO_CHANNEL_SIZE= 0x%x\n", chan_bytes, (unsigned int) MIN_IO_CHANNEL_SIZE); @@ -1020,8 +1020,8 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR); return 0; } - msg.cmd.create_device.channelBytes = chan_bytes; - msg.cmd.create_device.dataTypeGuid = spar_vnic_channel_protocol_uuid; + msg.cmd.create_device.channel_bytes = chan_bytes; + msg.cmd.create_device.data_type_uuid = spar_vnic_channel_protocol_uuid; if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { LOGERR("VNIC create_device failed.\n"); POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, dev_no, bus_no, @@ -1105,13 +1105,13 @@ uislib_client_add_vnic(u32 busNo) init_msg_header(&msg, CONTROLVM_DEVICE_CREATE, 0, 0); msg.hdr.flags.test_message = 1; - msg.cmd.create_device.busNo = busNo; - msg.cmd.create_device.devNo = devNo; - msg.cmd.create_device.devInstGuid = NULL_UUID_LE; + msg.cmd.create_device.bus_no = busNo; + msg.cmd.create_device.dev_no = devNo; + msg.cmd.create_device.dev_inst_uuid = NULL_UUID_LE; memset(&msg.cmd.create_device.intr, 0, sizeof(struct irq_info)); - msg.cmd.create_device.channelAddr = PhysicalDataChan; - msg.cmd.create_device.channelBytes = MIN_IO_CHANNEL_SIZE; - msg.cmd.create_device.dataTypeGuid = spar_vnic_channel_protocol_uuid; + msg.cmd.create_device.channel_addr = PhysicalDataChan; + msg.cmd.create_device.channel_bytes = MIN_IO_CHANNEL_SIZE; + msg.cmd.create_device.data_type_uuid = spar_vnic_channel_protocol_uuid; if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { LOGERR("client create_device failed"); goto AwayCleanup; diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index b7d5352..d7f644a 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -1229,8 +1229,8 @@ static void my_device_create(CONTROLVM_MESSAGE *inmsg) { struct controlvm_message_packet *cmd = &inmsg->cmd; - ulong busNo = cmd->create_device.busNo; - ulong devNo = cmd->create_device.devNo; + ulong busNo = cmd->create_device.bus_no; + ulong devNo = cmd->create_device.dev_no; VISORCHIPSET_DEVICE_INFO *pDevInfo = NULL; VISORCHIPSET_BUS_INFO *pBusInfo = NULL; int rc = CONTROLVM_RESP_SUCCESS; @@ -1274,7 +1274,7 @@ my_device_create(CONTROLVM_MESSAGE *inmsg) INIT_LIST_HEAD(&pDevInfo->entry); pDevInfo->busNo = busNo; pDevInfo->devNo = devNo; - pDevInfo->devInstGuid = cmd->create_device.devInstGuid; + pDevInfo->devInstGuid = cmd->create_device.dev_inst_uuid; POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, devNo, busNo, POSTCODE_SEVERITY_INFO); @@ -1282,9 +1282,9 @@ my_device_create(CONTROLVM_MESSAGE *inmsg) pDevInfo->chanInfo.addrType = ADDRTYPE_localTest; else pDevInfo->chanInfo.addrType = ADDRTYPE_localPhysical; - pDevInfo->chanInfo.channelAddr = cmd->create_device.channelAddr; - pDevInfo->chanInfo.nChannelBytes = cmd->create_device.channelBytes; - pDevInfo->chanInfo.channelTypeGuid = cmd->create_device.dataTypeGuid; + pDevInfo->chanInfo.channelAddr = cmd->create_device.channel_addr; + pDevInfo->chanInfo.nChannelBytes = cmd->create_device.channel_bytes; + pDevInfo->chanInfo.channelTypeGuid = cmd->create_device.data_type_uuid; pDevInfo->chanInfo.intr = cmd->create_device.intr; list_add(&pDevInfo->entry, &DevInfoList); POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, devNo, busNo, @@ -1848,8 +1848,8 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) break; case CONTROLVM_DEVICE_CREATE: LOGINF("DEVICE_CREATE(%lu,%lu)", - (ulong) cmd->create_device.busNo, - (ulong) cmd->create_device.devNo); + (ulong) cmd->create_device.bus_no, + (ulong) cmd->create_device.dev_no); my_device_create(&inmsg); break; case CONTROLVM_DEVICE_CHANGESTATE: @@ -2130,7 +2130,7 @@ setup_crash_devices_work_queue(struct work_struct *work) } /* reuse create device message for storage device */ - if (localCrashCreateDevMsg.cmd.create_device.channelAddr != 0) + if (localCrashCreateDevMsg.cmd.create_device.channel_addr != 0) my_device_create(&localCrashCreateDevMsg); else { LOGERR("CrashCreateDevMsg is null, no dump will be taken"); -- 1.9.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel