Remove the typedef and use struct visorchipset_device_info instead. Fix CamelCase names:
busNo => bus_no devNo => dev_no devInstGuid => dev_inst_guid chanInfo => chan_info Reserved1 => reserved1 Reserved2 => reserved2 switchNo => switch_no internalPortNo => internal_port_no pendingMsgHdr => pending_msg_hdr Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com> --- drivers/staging/unisys/visorchipset/visorchipset.h | 34 +++++----- .../unisys/visorchipset/visorchipset_main.c | 78 +++++++++++----------- 2 files changed, 57 insertions(+), 55 deletions(-) diff --git a/drivers/staging/unisys/visorchipset/visorchipset.h b/drivers/staging/unisys/visorchipset/visorchipset.h index c8a9366..a792cf2 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset.h +++ b/drivers/staging/unisys/visorchipset/visorchipset.h @@ -75,30 +75,30 @@ struct visorchipset_channel_info { * visorchipset_get_client_device_info() or * visorchipset_get_server_device_info(). */ -typedef struct { +struct visorchipset_device_info { struct list_head entry; - u32 busNo; - u32 devNo; - uuid_le devInstGuid; + u32 bus_no; + u32 dev_no; + uuid_le dev_inst_uuid; struct visorchipset_state state; - struct visorchipset_channel_info chanInfo; - u32 Reserved1; /* control_vm_id */ - u64 Reserved2; - u32 switchNo; /* when devState.attached==1 */ - u32 internalPortNo; /* when devState.attached==1 */ - struct controlvm_message_header pendingMsgHdr; /* CONTROLVM_MESSAGE */ + struct visorchipset_channel_info chan_info; + u32 reserved1; /* control_vm_id */ + u64 reserved2; + u32 switch_no; /* when devState.attached==1 */ + u32 internal_port_no; /* when devState.attached==1 */ + struct controlvm_message_header pending_msg_hdr;/* CONTROLVM_MESSAGE */ /** For private use by the bus driver */ void *bus_driver_context; -} VISORCHIPSET_DEVICE_INFO; +}; -static inline VISORCHIPSET_DEVICE_INFO * +static inline struct visorchipset_device_info * finddevice(struct list_head *list, u32 busNo, u32 devNo) { - VISORCHIPSET_DEVICE_INFO *p; + struct visorchipset_device_info *p; list_for_each_entry(p, list, entry) { - if (p->busNo == busNo && p->devNo == devNo) + if (p->bus_no == busNo && p->dev_no == devNo) return p; } return NULL; @@ -106,10 +106,10 @@ finddevice(struct list_head *list, u32 busNo, u32 devNo) static inline void delbusdevices(struct list_head *list, u32 busNo) { - VISORCHIPSET_DEVICE_INFO *p, *tmp; + struct visorchipset_device_info *p, *tmp; list_for_each_entry_safe(p, tmp, list, entry) { - if (p->busNo == busNo) { + if (p->bus_no == busNo) { list_del(&p->entry); kfree(p); } @@ -274,7 +274,7 @@ 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_device_info(ulong busNo, ulong devNo, - VISORCHIPSET_DEVICE_INFO *devInfo); + struct visorchipset_device_info *devInfo); BOOL visorchipset_get_switch_info(ulong switchNo, VISORCHIPSET_SWITCH_INFO *switchInfo); BOOL visorchipset_get_externalport_info(ulong switchNo, ulong externalPortNo, diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 00a3445..ba74bf5 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -561,10 +561,11 @@ busInfo_clear(void *v) static void devInfo_clear(void *v) { - VISORCHIPSET_DEVICE_INFO *p = (VISORCHIPSET_DEVICE_INFO *) (v); + struct visorchipset_device_info *p = + (struct visorchipset_device_info *)(v); p->state.created = 0; - memset(p, 0, sizeof(VISORCHIPSET_DEVICE_INFO)); + memset(p, 0, sizeof(struct visorchipset_device_info)); } static u8 @@ -638,7 +639,7 @@ static void cleanup_controlvm_structures(void) { VISORCHIPSET_BUS_INFO *bi, *tmp_bi; - VISORCHIPSET_DEVICE_INFO *di, *tmp_di; + struct visorchipset_device_info *di, *tmp_di; list_for_each_entry_safe(bi, tmp_bi, &BusInfoList, entry) { busInfo_clear(bi); @@ -865,7 +866,7 @@ device_changestate_responder(enum controlvm_id cmdId, ulong busNo, ulong devNo, int response, struct spar_segment_state responseState) { - VISORCHIPSET_DEVICE_INFO *p = NULL; + struct visorchipset_device_info *p = NULL; struct controlvm_message outmsg; p = finddevice(&DevInfoList, busNo, devNo); @@ -873,16 +874,16 @@ device_changestate_responder(enum controlvm_id cmdId, LOGERR("internal error; busNo=%lu, devNo=%lu", busNo, devNo); return; } - if (p->pendingMsgHdr.id == CONTROLVM_INVALID) { + if (p->pending_msg_hdr.id == CONTROLVM_INVALID) { LOGERR("device_responder no pending msg"); return; /* no controlvm response needed */ } - if (p->pendingMsgHdr.id != cmdId) { - LOGERR("expected=%d, found=%d", cmdId, p->pendingMsgHdr.id); + if (p->pending_msg_hdr.id != cmdId) { + LOGERR("expected=%d, found=%d", cmdId, p->pending_msg_hdr.id); return; } - controlvm_init_response(&outmsg, &p->pendingMsgHdr, response); + controlvm_init_response(&outmsg, &p->pending_msg_hdr, response); outmsg.cmd.device_change_state.bus_no = busNo; outmsg.cmd.device_change_state.dev_no = devNo; @@ -894,14 +895,14 @@ device_changestate_responder(enum controlvm_id cmdId, return; } - p->pendingMsgHdr.id = CONTROLVM_INVALID; + p->pending_msg_hdr.id = CONTROLVM_INVALID; } static void device_responder(enum controlvm_id cmdId, ulong busNo, ulong devNo, int response) { - VISORCHIPSET_DEVICE_INFO *p = NULL; + struct visorchipset_device_info *p = NULL; BOOL need_clear = FALSE; p = finddevice(&DevInfoList, busNo, devNo); @@ -916,16 +917,16 @@ device_responder(enum controlvm_id cmdId, ulong busNo, ulong devNo, need_clear = TRUE; } - if (p->pendingMsgHdr.id == CONTROLVM_INVALID) { + if (p->pending_msg_hdr.id == CONTROLVM_INVALID) { LOGERR("device_responder no pending msg"); return; /* no controlvm response needed */ } - if (p->pendingMsgHdr.id != (u32) cmdId) { - LOGERR("expected=%d, found=%d", cmdId, p->pendingMsgHdr.id); + if (p->pending_msg_hdr.id != (u32) cmdId) { + LOGERR("expected=%d, found=%d", cmdId, p->pending_msg_hdr.id); return; } - controlvm_respond(&p->pendingMsgHdr, response); - p->pendingMsgHdr.id = CONTROLVM_INVALID; + controlvm_respond(&p->pending_msg_hdr, response); + p->pending_msg_hdr.id = CONTROLVM_INVALID; if (need_clear) devInfo_clear(p); } @@ -1005,7 +1006,7 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers = NULL; BOOL notified = FALSE; - VISORCHIPSET_DEVICE_INFO *pDevInfo = + struct visorchipset_device_info *pDevInfo = finddevice(&DevInfoList, busNo, devNo); char *envp[] = { "SPARSP_DIAGPOOL_PAUSED_STATE = 1", @@ -1021,10 +1022,10 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd, else notifiers = &BusDev_Client_Notifiers; if (needResponse) { - memcpy(&pDevInfo->pendingMsgHdr, msgHdr, + memcpy(&pDevInfo->pending_msg_hdr, msgHdr, sizeof(struct controlvm_message_header)); } else - pDevInfo->pendingMsgHdr.id = CONTROLVM_INVALID; + pDevInfo->pending_msg_hdr.id = CONTROLVM_INVALID; down(&NotifierLock); if (response >= 0) { @@ -1234,7 +1235,7 @@ my_device_create(struct controlvm_message *inmsg) struct controlvm_message_packet *cmd = &inmsg->cmd; ulong busNo = cmd->create_device.bus_no; ulong devNo = cmd->create_device.dev_no; - VISORCHIPSET_DEVICE_INFO *pDevInfo = NULL; + struct visorchipset_device_info *pDevInfo = NULL; VISORCHIPSET_BUS_INFO *pBusInfo = NULL; int rc = CONTROLVM_RESP_SUCCESS; @@ -1264,7 +1265,7 @@ my_device_create(struct controlvm_message *inmsg) rc = -CONTROLVM_RESP_ERROR_BUS_INVALID; goto Away; } - pDevInfo = kzalloc(sizeof(VISORCHIPSET_DEVICE_INFO), GFP_KERNEL); + pDevInfo = kzalloc(sizeof(struct visorchipset_device_info), GFP_KERNEL); if (pDevInfo == NULL) { LOGERR("CONTROLVM_DEVICE_CREATE Failed: busNo=%lu, devNo=%lu kmaloc failed", busNo, devNo); @@ -1275,27 +1276,27 @@ my_device_create(struct controlvm_message *inmsg) } INIT_LIST_HEAD(&pDevInfo->entry); - pDevInfo->busNo = busNo; - pDevInfo->devNo = devNo; - pDevInfo->devInstGuid = cmd->create_device.dev_inst_uuid; + pDevInfo->bus_no = busNo; + pDevInfo->dev_no = devNo; + pDevInfo->dev_inst_uuid = cmd->create_device.dev_inst_uuid; POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, devNo, busNo, POSTCODE_SEVERITY_INFO); if (inmsg->hdr.flags.test_message == 1) - pDevInfo->chanInfo.addr_type = ADDRTYPE_LOCALTEST; + pDevInfo->chan_info.addr_type = ADDRTYPE_LOCALTEST; else - pDevInfo->chanInfo.addr_type = ADDRTYPE_LOCALPHYSICAL; - pDevInfo->chanInfo.channel_addr = cmd->create_device.channel_addr; - pDevInfo->chanInfo.n_channel_bytes = cmd->create_device.channel_bytes; - pDevInfo->chanInfo.channel_type_uuid = + pDevInfo->chan_info.addr_type = ADDRTYPE_LOCALPHYSICAL; + pDevInfo->chan_info.channel_addr = cmd->create_device.channel_addr; + pDevInfo->chan_info.n_channel_bytes = cmd->create_device.channel_bytes; + pDevInfo->chan_info.channel_type_uuid = cmd->create_device.data_type_uuid; - pDevInfo->chanInfo.intr = cmd->create_device.intr; + pDevInfo->chan_info.intr = cmd->create_device.intr; list_add(&pDevInfo->entry, &DevInfoList); POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, devNo, busNo, POSTCODE_SEVERITY_INFO); Away: /* get the bus and devNo for DiagPool channel */ - if (is_diagpool_channel(pDevInfo->chanInfo.channel_type_uuid)) { + if (is_diagpool_channel(pDevInfo->chan_info.channel_type_uuid)) { g_diagpoolBusNo = busNo; g_diagpoolDevNo = devNo; LOGINF("CONTROLVM_DEVICE_CREATE for DiagPool channel: busNo=%lu, devNo=%lu", @@ -1304,7 +1305,7 @@ Away: device_epilog(busNo, devNo, segment_state_running, CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc, inmsg->hdr.flags.response_expected == 1, - FOR_VISORBUS(pDevInfo->chanInfo.channel_type_uuid)); + FOR_VISORBUS(pDevInfo->chan_info.channel_type_uuid)); } static void @@ -1314,7 +1315,7 @@ my_device_changestate(struct controlvm_message *inmsg) ulong busNo = cmd->device_change_state.bus_no; ulong devNo = cmd->device_change_state.dev_no; struct spar_segment_state state = cmd->device_change_state.state; - VISORCHIPSET_DEVICE_INFO *pDevInfo = NULL; + struct visorchipset_device_info *pDevInfo = NULL; int rc = CONTROLVM_RESP_SUCCESS; pDevInfo = finddevice(&DevInfoList, busNo, devNo); @@ -1339,7 +1340,7 @@ Away: &inmsg->hdr, rc, inmsg->hdr.flags.response_expected == 1, FOR_VISORBUS( - pDevInfo->chanInfo.channel_type_uuid)); + pDevInfo->chan_info.channel_type_uuid)); } static void @@ -1348,7 +1349,7 @@ my_device_destroy(struct controlvm_message *inmsg) struct controlvm_message_packet *cmd = &inmsg->cmd; ulong busNo = cmd->destroy_device.bus_no; ulong devNo = cmd->destroy_device.dev_no; - VISORCHIPSET_DEVICE_INFO *pDevInfo = NULL; + struct visorchipset_device_info *pDevInfo = NULL; int rc = CONTROLVM_RESP_SUCCESS; pDevInfo = finddevice(&DevInfoList, busNo, devNo); @@ -1370,7 +1371,7 @@ Away: CONTROLVM_DEVICE_DESTROY, &inmsg->hdr, rc, inmsg->hdr.flags.response_expected == 1, FOR_VISORBUS( - pDevInfo->chanInfo.channel_type_uuid)); + pDevInfo->chan_info.channel_type_uuid)); } /* When provided with the physical address of the controlvm channel @@ -2228,7 +2229,7 @@ EXPORT_SYMBOL_GPL(visorchipset_set_bus_context); BOOL visorchipset_get_device_info(ulong busNo, ulong devNo, - VISORCHIPSET_DEVICE_INFO *devInfo) + struct visorchipset_device_info *devInfo) { void *p = finddevice(&DevInfoList, busNo, devNo); @@ -2236,7 +2237,7 @@ visorchipset_get_device_info(ulong busNo, ulong devNo, LOGERR("(%lu,%lu) failed", busNo, devNo); return FALSE; } - memcpy(devInfo, p, sizeof(VISORCHIPSET_DEVICE_INFO)); + memcpy(devInfo, p, sizeof(struct visorchipset_device_info)); return TRUE; } EXPORT_SYMBOL_GPL(visorchipset_get_device_info); @@ -2244,7 +2245,8 @@ EXPORT_SYMBOL_GPL(visorchipset_get_device_info); BOOL visorchipset_set_device_context(ulong busNo, ulong devNo, void *context) { - VISORCHIPSET_DEVICE_INFO *p = finddevice(&DevInfoList, busNo, devNo); + struct visorchipset_device_info *p = + finddevice(&DevInfoList, busNo, devNo); if (!p) { LOGERR("(%lu,%lu) failed", busNo, devNo); -- 2.1.0 _______________________________________________ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel