Commit 33192fa1 authored by Benjamin Romer's avatar Benjamin Romer Committed by Greg Kroah-Hartman

staging: unisys: refactor VISORCHIPSET_BUS_INFO

Remove the typedef and use the name struct visorchipset_bus_info instead.
Fix CamelCase member names in the structure:

busNo => bus_no
chanInfo => chan_info
partitionGuid => partition_uuid
partitionHandle => partition_handle
Reserved1 => reserved1
Reserved2 => reserved2
procObject => proc_object

Update references to changed names.
Signed-off-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8f67b5bc
...@@ -122,37 +122,37 @@ static inline void delbusdevices(struct list_head *list, u32 bus_no) ...@@ -122,37 +122,37 @@ static inline void delbusdevices(struct list_head *list, u32 bus_no)
* Any visorchipset client can query these attributes using * Any visorchipset client can query these attributes using
* visorchipset_get_client_bus_info() or visorchipset_get_bus_info(). * visorchipset_get_client_bus_info() or visorchipset_get_bus_info().
*/ */
typedef struct { struct visorchipset_bus_info {
struct list_head entry; struct list_head entry;
u32 busNo; u32 bus_no;
struct visorchipset_state state; struct visorchipset_state state;
struct visorchipset_channel_info chanInfo; struct visorchipset_channel_info chan_info;
uuid_le partitionGuid; uuid_le partition_uuid;
u64 partitionHandle; u64 partition_handle;
u8 *name; /* UTF8 */ u8 *name; /* UTF8 */
u8 *description; /* UTF8 */ u8 *description; /* UTF8 */
u64 Reserved1; u64 reserved1;
u32 Reserved2; u32 reserved2;
MYPROCOBJECT *procObject; MYPROCOBJECT *proc_object;
struct { struct {
u32 server:1; u32 server:1;
/* Add new fields above. */ /* Add new fields above. */
/* Remaining bits in this 32-bit word are unused. */ /* Remaining bits in this 32-bit word are unused. */
} flags; } flags;
struct controlvm_message_header pendingMsgHdr; /* CONTROLVM MsgHdr */ struct controlvm_message_header pending_msg_hdr;/* CONTROLVM MsgHdr */
/** For private use by the bus driver */ /** For private use by the bus driver */
void *bus_driver_context; void *bus_driver_context;
u64 devNo; u64 dev_no;
} VISORCHIPSET_BUS_INFO; };
static inline VISORCHIPSET_BUS_INFO * static inline struct visorchipset_bus_info *
findbus(struct list_head *list, u32 busNo) findbus(struct list_head *list, u32 busNo)
{ {
VISORCHIPSET_BUS_INFO *p; struct visorchipset_bus_info *p;
list_for_each_entry(p, list, entry) { list_for_each_entry(p, list, entry) {
if (p->busNo == busNo) if (p->bus_no == busNo)
return p; return p;
} }
return NULL; return NULL;
...@@ -272,7 +272,8 @@ typedef void (*SPARREPORTEVENT_COMPLETE_FUNC) (struct controlvm_message *msg, ...@@ -272,7 +272,8 @@ typedef void (*SPARREPORTEVENT_COMPLETE_FUNC) (struct controlvm_message *msg,
void visorchipset_device_pause_response(ulong busNo, ulong devNo, int response); void visorchipset_device_pause_response(ulong busNo, ulong devNo, int response);
BOOL visorchipset_get_bus_info(ulong busNo, VISORCHIPSET_BUS_INFO *busInfo); BOOL visorchipset_get_bus_info(ulong busNo,
struct visorchipset_bus_info *busInfo);
BOOL visorchipset_get_device_info(ulong busNo, ulong devNo, BOOL visorchipset_get_device_info(ulong busNo, ulong devNo,
struct visorchipset_device_info *devInfo); struct visorchipset_device_info *devInfo);
BOOL visorchipset_get_switch_info(ulong switchNo, BOOL visorchipset_get_switch_info(ulong switchNo,
......
...@@ -542,11 +542,11 @@ testUnicode(void) ...@@ -542,11 +542,11 @@ testUnicode(void)
static void static void
busInfo_clear(void *v) busInfo_clear(void *v)
{ {
VISORCHIPSET_BUS_INFO *p = (VISORCHIPSET_BUS_INFO *) (v); struct visorchipset_bus_info *p = (struct visorchipset_bus_info *) (v);
if (p->procObject) { if (p->proc_object) {
visor_proc_DestroyObject(p->procObject); visor_proc_DestroyObject(p->proc_object);
p->procObject = NULL; p->proc_object = NULL;
} }
kfree(p->name); kfree(p->name);
p->name = NULL; p->name = NULL;
...@@ -555,7 +555,7 @@ busInfo_clear(void *v) ...@@ -555,7 +555,7 @@ busInfo_clear(void *v)
p->description = NULL; p->description = NULL;
p->state.created = 0; p->state.created = 0;
memset(p, 0, sizeof(VISORCHIPSET_BUS_INFO)); memset(p, 0, sizeof(struct visorchipset_bus_info));
} }
static void static void
...@@ -638,7 +638,7 @@ EXPORT_SYMBOL_GPL(visorchipset_register_busdev_client); ...@@ -638,7 +638,7 @@ EXPORT_SYMBOL_GPL(visorchipset_register_busdev_client);
static void static void
cleanup_controlvm_structures(void) cleanup_controlvm_structures(void)
{ {
VISORCHIPSET_BUS_INFO *bi, *tmp_bi; struct visorchipset_bus_info *bi, *tmp_bi;
struct visorchipset_device_info *di, *tmp_di; struct visorchipset_device_info *di, *tmp_di;
list_for_each_entry_safe(bi, tmp_bi, &BusInfoList, entry) { list_for_each_entry_safe(bi, tmp_bi, &BusInfoList, entry) {
...@@ -825,7 +825,7 @@ EXPORT_SYMBOL_GPL(visorchipset_save_message); ...@@ -825,7 +825,7 @@ EXPORT_SYMBOL_GPL(visorchipset_save_message);
static void static void
bus_responder(enum controlvm_id cmdId, ulong busNo, int response) bus_responder(enum controlvm_id cmdId, ulong busNo, int response)
{ {
VISORCHIPSET_BUS_INFO *p = NULL; struct visorchipset_bus_info *p = NULL;
BOOL need_clear = FALSE; BOOL need_clear = FALSE;
p = findbus(&BusInfoList, busNo); p = findbus(&BusInfoList, busNo);
...@@ -845,16 +845,16 @@ bus_responder(enum controlvm_id cmdId, ulong busNo, int response) ...@@ -845,16 +845,16 @@ bus_responder(enum controlvm_id cmdId, ulong busNo, int response)
need_clear = TRUE; need_clear = TRUE;
} }
if (p->pendingMsgHdr.id == CONTROLVM_INVALID) { if (p->pending_msg_hdr.id == CONTROLVM_INVALID) {
LOGERR("bus_responder no pending msg"); LOGERR("bus_responder no pending msg");
return; /* no controlvm response needed */ return; /* no controlvm response needed */
} }
if (p->pendingMsgHdr.id != (u32) cmdId) { if (p->pending_msg_hdr.id != (u32) cmdId) {
LOGERR("expected=%d, found=%d", cmdId, p->pendingMsgHdr.id); LOGERR("expected=%d, found=%d", cmdId, p->pending_msg_hdr.id);
return; return;
} }
controlvm_respond(&p->pendingMsgHdr, response); controlvm_respond(&p->pending_msg_hdr, response);
p->pendingMsgHdr.id = CONTROLVM_INVALID; p->pending_msg_hdr.id = CONTROLVM_INVALID;
if (need_clear) { if (need_clear) {
busInfo_clear(p); busInfo_clear(p);
delbusdevices(&DevInfoList, busNo); delbusdevices(&DevInfoList, busNo);
...@@ -938,17 +938,17 @@ bus_epilog(u32 busNo, ...@@ -938,17 +938,17 @@ bus_epilog(u32 busNo,
{ {
BOOL notified = FALSE; BOOL notified = FALSE;
VISORCHIPSET_BUS_INFO *pBusInfo = findbus(&BusInfoList, busNo); struct visorchipset_bus_info *pBusInfo = findbus(&BusInfoList, busNo);
if (!pBusInfo) { if (!pBusInfo) {
LOGERR("HUH? bad busNo=%d", busNo); LOGERR("HUH? bad busNo=%d", busNo);
return; return;
} }
if (needResponse) { if (needResponse) {
memcpy(&pBusInfo->pendingMsgHdr, msgHdr, memcpy(&pBusInfo->pending_msg_hdr, msgHdr,
sizeof(struct controlvm_message_header)); sizeof(struct controlvm_message_header));
} else } else
pBusInfo->pendingMsgHdr.id = CONTROLVM_INVALID; pBusInfo->pending_msg_hdr.id = CONTROLVM_INVALID;
down(&NotifierLock); down(&NotifierLock);
if (response == CONTROLVM_RESP_SUCCESS) { if (response == CONTROLVM_RESP_SUCCESS) {
...@@ -1103,7 +1103,7 @@ bus_create(struct controlvm_message *inmsg) ...@@ -1103,7 +1103,7 @@ bus_create(struct controlvm_message *inmsg)
struct controlvm_message_packet *cmd = &inmsg->cmd; struct controlvm_message_packet *cmd = &inmsg->cmd;
ulong busNo = cmd->create_bus.bus_no; ulong busNo = cmd->create_bus.bus_no;
int rc = CONTROLVM_RESP_SUCCESS; int rc = CONTROLVM_RESP_SUCCESS;
VISORCHIPSET_BUS_INFO *pBusInfo = NULL; struct visorchipset_bus_info *pBusInfo = NULL;
pBusInfo = findbus(&BusInfoList, busNo); pBusInfo = findbus(&BusInfoList, busNo);
...@@ -1115,7 +1115,7 @@ bus_create(struct controlvm_message *inmsg) ...@@ -1115,7 +1115,7 @@ bus_create(struct controlvm_message *inmsg)
rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
goto Away; goto Away;
} }
pBusInfo = kzalloc(sizeof(VISORCHIPSET_BUS_INFO), GFP_KERNEL); pBusInfo = kzalloc(sizeof(struct visorchipset_bus_info), GFP_KERNEL);
if (pBusInfo == NULL) { if (pBusInfo == NULL) {
LOGERR("CONTROLVM_BUS_CREATE Failed: bus %lu kzalloc failed", LOGERR("CONTROLVM_BUS_CREATE Failed: bus %lu kzalloc failed",
busNo); busNo);
...@@ -1126,22 +1126,22 @@ bus_create(struct controlvm_message *inmsg) ...@@ -1126,22 +1126,22 @@ bus_create(struct controlvm_message *inmsg)
} }
INIT_LIST_HEAD(&pBusInfo->entry); INIT_LIST_HEAD(&pBusInfo->entry);
pBusInfo->busNo = busNo; pBusInfo->bus_no = busNo;
pBusInfo->devNo = cmd->create_bus.dev_count; pBusInfo->dev_no = cmd->create_bus.dev_count;
POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, busNo, POSTCODE_SEVERITY_INFO); POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, busNo, POSTCODE_SEVERITY_INFO);
if (inmsg->hdr.flags.test_message == 1) if (inmsg->hdr.flags.test_message == 1)
pBusInfo->chanInfo.addr_type = ADDRTYPE_LOCALTEST; pBusInfo->chan_info.addr_type = ADDRTYPE_LOCALTEST;
else else
pBusInfo->chanInfo.addr_type = ADDRTYPE_LOCALPHYSICAL; pBusInfo->chan_info.addr_type = ADDRTYPE_LOCALPHYSICAL;
pBusInfo->flags.server = inmsg->hdr.flags.server; pBusInfo->flags.server = inmsg->hdr.flags.server;
pBusInfo->chanInfo.channel_addr = cmd->create_bus.channel_addr; pBusInfo->chan_info.channel_addr = cmd->create_bus.channel_addr;
pBusInfo->chanInfo.n_channel_bytes = cmd->create_bus.channel_bytes; pBusInfo->chan_info.n_channel_bytes = cmd->create_bus.channel_bytes;
pBusInfo->chanInfo.channel_type_uuid = pBusInfo->chan_info.channel_type_uuid =
cmd->create_bus.bus_data_type_uuid; cmd->create_bus.bus_data_type_uuid;
pBusInfo->chanInfo.channel_inst_uuid = cmd->create_bus.bus_inst_uuid; pBusInfo->chan_info.channel_inst_uuid = cmd->create_bus.bus_inst_uuid;
list_add(&pBusInfo->entry, &BusInfoList); list_add(&pBusInfo->entry, &BusInfoList);
...@@ -1157,7 +1157,7 @@ bus_destroy(struct controlvm_message *inmsg) ...@@ -1157,7 +1157,7 @@ bus_destroy(struct controlvm_message *inmsg)
{ {
struct controlvm_message_packet *cmd = &inmsg->cmd; struct controlvm_message_packet *cmd = &inmsg->cmd;
ulong busNo = cmd->destroy_bus.bus_no; ulong busNo = cmd->destroy_bus.bus_no;
VISORCHIPSET_BUS_INFO *pBusInfo; struct visorchipset_bus_info *pBusInfo;
int rc = CONTROLVM_RESP_SUCCESS; int rc = CONTROLVM_RESP_SUCCESS;
pBusInfo = findbus(&BusInfoList, busNo); pBusInfo = findbus(&BusInfoList, busNo);
...@@ -1183,7 +1183,7 @@ bus_configure(struct controlvm_message *inmsg, PARSER_CONTEXT *parser_ctx) ...@@ -1183,7 +1183,7 @@ bus_configure(struct controlvm_message *inmsg, PARSER_CONTEXT *parser_ctx)
{ {
struct controlvm_message_packet *cmd = &inmsg->cmd; struct controlvm_message_packet *cmd = &inmsg->cmd;
ulong busNo = cmd->configure_bus.bus_no; ulong busNo = cmd->configure_bus.bus_no;
VISORCHIPSET_BUS_INFO *pBusInfo = NULL; struct visorchipset_bus_info *pBusInfo = NULL;
int rc = CONTROLVM_RESP_SUCCESS; int rc = CONTROLVM_RESP_SUCCESS;
char s[99]; char s[99];
...@@ -1208,21 +1208,21 @@ bus_configure(struct controlvm_message *inmsg, PARSER_CONTEXT *parser_ctx) ...@@ -1208,21 +1208,21 @@ bus_configure(struct controlvm_message *inmsg, PARSER_CONTEXT *parser_ctx)
goto Away; goto Away;
} }
/* TBD - add this check to other commands also... */ /* TBD - add this check to other commands also... */
if (pBusInfo->pendingMsgHdr.id != CONTROLVM_INVALID) { if (pBusInfo->pending_msg_hdr.id != CONTROLVM_INVALID) {
LOGERR("CONTROLVM_BUS_CONFIGURE Failed: bus %lu MsgId=%u outstanding", LOGERR("CONTROLVM_BUS_CONFIGURE Failed: bus %lu MsgId=%u outstanding",
busNo, (uint) pBusInfo->pendingMsgHdr.id); busNo, (uint) pBusInfo->pending_msg_hdr.id);
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo, POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo,
POSTCODE_SEVERITY_ERR); POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT; rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT;
goto Away; goto Away;
} }
pBusInfo->partitionHandle = cmd->configure_bus.guest_handle; pBusInfo->partition_handle = cmd->configure_bus.guest_handle;
pBusInfo->partitionGuid = parser_id_get(parser_ctx); pBusInfo->partition_uuid = parser_id_get(parser_ctx);
parser_param_start(parser_ctx, PARSERSTRING_NAME); parser_param_start(parser_ctx, PARSERSTRING_NAME);
pBusInfo->name = parser_string_get(parser_ctx); pBusInfo->name = parser_string_get(parser_ctx);
visorchannel_uuid_id(&pBusInfo->partitionGuid, s); visorchannel_uuid_id(&pBusInfo->partition_uuid, s);
POSTCODE_LINUX_3(BUS_CONFIGURE_EXIT_PC, busNo, POSTCODE_SEVERITY_INFO); POSTCODE_LINUX_3(BUS_CONFIGURE_EXIT_PC, busNo, POSTCODE_SEVERITY_INFO);
Away: Away:
bus_epilog(busNo, CONTROLVM_BUS_CONFIGURE, &inmsg->hdr, bus_epilog(busNo, CONTROLVM_BUS_CONFIGURE, &inmsg->hdr,
...@@ -1236,7 +1236,7 @@ my_device_create(struct controlvm_message *inmsg) ...@@ -1236,7 +1236,7 @@ my_device_create(struct controlvm_message *inmsg)
ulong busNo = cmd->create_device.bus_no; ulong busNo = cmd->create_device.bus_no;
ulong devNo = cmd->create_device.dev_no; ulong devNo = cmd->create_device.dev_no;
struct visorchipset_device_info *pDevInfo = NULL; struct visorchipset_device_info *pDevInfo = NULL;
VISORCHIPSET_BUS_INFO *pBusInfo = NULL; struct visorchipset_bus_info *pBusInfo = NULL;
int rc = CONTROLVM_RESP_SUCCESS; int rc = CONTROLVM_RESP_SUCCESS;
pDevInfo = finddevice(&DevInfoList, busNo, devNo); pDevInfo = finddevice(&DevInfoList, busNo, devNo);
...@@ -2200,7 +2200,7 @@ device_resume_response(ulong busNo, ulong devNo, int response) ...@@ -2200,7 +2200,7 @@ device_resume_response(ulong busNo, ulong devNo, int response)
} }
BOOL BOOL
visorchipset_get_bus_info(ulong busNo, VISORCHIPSET_BUS_INFO *busInfo) visorchipset_get_bus_info(ulong busNo, struct visorchipset_bus_info *busInfo)
{ {
void *p = findbus(&BusInfoList, busNo); void *p = findbus(&BusInfoList, busNo);
...@@ -2208,7 +2208,7 @@ visorchipset_get_bus_info(ulong busNo, VISORCHIPSET_BUS_INFO *busInfo) ...@@ -2208,7 +2208,7 @@ visorchipset_get_bus_info(ulong busNo, VISORCHIPSET_BUS_INFO *busInfo)
LOGERR("(%lu) failed", busNo); LOGERR("(%lu) failed", busNo);
return FALSE; return FALSE;
} }
memcpy(busInfo, p, sizeof(VISORCHIPSET_BUS_INFO)); memcpy(busInfo, p, sizeof(struct visorchipset_bus_info));
return TRUE; return TRUE;
} }
EXPORT_SYMBOL_GPL(visorchipset_get_bus_info); EXPORT_SYMBOL_GPL(visorchipset_get_bus_info);
...@@ -2216,7 +2216,7 @@ EXPORT_SYMBOL_GPL(visorchipset_get_bus_info); ...@@ -2216,7 +2216,7 @@ EXPORT_SYMBOL_GPL(visorchipset_get_bus_info);
BOOL BOOL
visorchipset_set_bus_context(ulong busNo, void *context) visorchipset_set_bus_context(ulong busNo, void *context)
{ {
VISORCHIPSET_BUS_INFO *p = findbus(&BusInfoList, busNo); struct visorchipset_bus_info *p = findbus(&BusInfoList, busNo);
if (!p) { if (!p) {
LOGERR("(%lu) failed", busNo); LOGERR("(%lu) failed", busNo);
......
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