staging: unisys: fix placement of logical ops in visorchipset_main.c
[firefly-linux-kernel-4.4.55.git] / drivers / staging / unisys / visorchipset / visorchipset_main.c
index 2c97030b6c1c3d1b077c41c5b4549edecb3fd550..401cd1e0d1a579a2118555bb97b00c47fd162f66 100644 (file)
@@ -67,33 +67,34 @@ static u8 chipset_events[MAX_CHIPSET_EVENTS] = { 0, 0 };
 
 static struct delayed_work periodic_controlvm_work;
 static struct workqueue_struct *periodic_controlvm_workqueue;
-static DEFINE_SEMAPHORE(NotifierLock);
+static DEFINE_SEMAPHORE(notifier_lock);
 
 static struct controlvm_message_header g_diag_msg_hdr;
 static struct controlvm_message_header g_chipset_msg_hdr;
 static struct controlvm_message_header g_del_dump_msg_hdr;
-static const uuid_le UltraDiagPoolChannelProtocolGuid =
+static const uuid_le spar_diag_pool_channel_protocol_uuid =
        SPAR_DIAG_POOL_CHANNEL_PROTOCOL_UUID;
 /* 0xffffff is an invalid Bus/Device number */
-static ulong g_diagpoolBusNo = 0xffffff;
-static ulong g_diagpoolDevNo = 0xffffff;
-static struct controlvm_message_packet g_DeviceChangeStatePacket;
+static ulong g_diagpool_bus_no = 0xffffff;
+static ulong g_diagpool_dev_no = 0xffffff;
+static struct controlvm_message_packet g_devicechangestate_packet;
 
 /* Only VNIC and VHBA channels are sent to visorclientbus (aka
  * "visorhackbus")
  */
 #define FOR_VISORHACKBUS(channel_type_guid) \
        (((uuid_le_cmp(channel_type_guid,\
-                      spar_vnic_channel_protocol_uuid) == 0)\
-       || (uuid_le_cmp(channel_type_guid,\
+                      spar_vnic_channel_protocol_uuid) == 0) ||\
+       (uuid_le_cmp(channel_type_guid,\
                        spar_vhba_channel_protocol_uuid) == 0)))
 #define FOR_VISORBUS(channel_type_guid) (!(FOR_VISORHACKBUS(channel_type_guid)))
 
 #define is_diagpool_channel(channel_type_guid) \
-        (uuid_le_cmp(channel_type_guid, UltraDiagPoolChannelProtocolGuid) == 0)
+       (uuid_le_cmp(channel_type_guid,\
+                    spar_diag_pool_channel_protocol_uuid) == 0)
 
-static LIST_HEAD(BusInfoList);
-static LIST_HEAD(DevInfoList);
+static LIST_HEAD(bus_info_list);
+static LIST_HEAD(dev_info_list);
 
 static struct visorchannel *ControlVm_channel;
 
@@ -587,7 +588,7 @@ visorchipset_register_busdev_server(
                        struct visorchipset_busdev_responders *responders,
                        struct ultra_vbus_deviceinfo *driver_info)
 {
-       down(&NotifierLock);
+       down(&notifier_lock);
        if (notifiers == NULL) {
                memset(&BusDev_Server_Notifiers, 0,
                       sizeof(BusDev_Server_Notifiers));
@@ -602,7 +603,7 @@ visorchipset_register_busdev_server(
                bus_device_info_init(driver_info, "chipset", "visorchipset",
                                   VERSION, NULL);
 
-       up(&NotifierLock);
+       up(&notifier_lock);
 }
 EXPORT_SYMBOL_GPL(visorchipset_register_busdev_server);
 
@@ -612,7 +613,7 @@ visorchipset_register_busdev_client(
                        struct visorchipset_busdev_responders *responders,
                        struct ultra_vbus_deviceinfo *driver_info)
 {
-       down(&NotifierLock);
+       down(&notifier_lock);
        if (notifiers == NULL) {
                memset(&BusDev_Client_Notifiers, 0,
                       sizeof(BusDev_Client_Notifiers));
@@ -626,7 +627,7 @@ visorchipset_register_busdev_client(
        if (driver_info)
                bus_device_info_init(driver_info, "chipset(bolts)",
                                     "visorchipset", VERSION, NULL);
-       up(&NotifierLock);
+       up(&notifier_lock);
 }
 EXPORT_SYMBOL_GPL(visorchipset_register_busdev_client);
 
@@ -636,13 +637,13 @@ cleanup_controlvm_structures(void)
        struct visorchipset_bus_info *bi, *tmp_bi;
        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, &bus_info_list, entry) {
                busInfo_clear(bi);
                list_del(&bi->entry);
                kfree(bi);
        }
 
-       list_for_each_entry_safe(di, tmp_di, &DevInfoList, entry) {
+       list_for_each_entry_safe(di, tmp_di, &dev_info_list, entry) {
                devInfo_clear(di);
                list_del(&di->entry);
                kfree(di);
@@ -704,12 +705,12 @@ controlvm_respond(struct controlvm_message_header *msgHdr, int response)
        controlvm_init_response(&outmsg, msgHdr, response);
        /* For DiagPool channel DEVICE_CHANGESTATE, we need to send
        * back the deviceChangeState structure in the packet. */
-       if (msgHdr->id == CONTROLVM_DEVICE_CHANGESTATE
-           && g_DeviceChangeStatePacket.device_change_state.bus_no ==
-           g_diagpoolBusNo
-           && g_DeviceChangeStatePacket.device_change_state.dev_no ==
-           g_diagpoolDevNo)
-               outmsg.cmd = g_DeviceChangeStatePacket;
+       if (msgHdr->id == CONTROLVM_DEVICE_CHANGESTATE &&
+           g_devicechangestate_packet.device_change_state.bus_no ==
+           g_diagpool_bus_no &&
+           g_devicechangestate_packet.device_change_state.dev_no ==
+           g_diagpool_dev_no)
+               outmsg.cmd = g_devicechangestate_packet;
        if (outmsg.hdr.flags.test_message == 1)
                return;
 
@@ -811,7 +812,7 @@ bus_responder(enum controlvm_id cmdId, ulong busNo, int response)
        struct visorchipset_bus_info *p = NULL;
        BOOL need_clear = FALSE;
 
-       p = findbus(&BusInfoList, busNo);
+       p = findbus(&bus_info_list, busNo);
        if (!p)
                return;
 
@@ -819,7 +820,7 @@ bus_responder(enum controlvm_id cmdId, ulong busNo, int response)
                if ((cmdId == CONTROLVM_BUS_CREATE) &&
                    (response != (-CONTROLVM_RESP_ERROR_ALREADY_DONE)))
                        /* undo the row we just created... */
-                       delbusdevices(&DevInfoList, busNo);
+                       delbusdevices(&dev_info_list, busNo);
        } else {
                if (cmdId == CONTROLVM_BUS_CREATE)
                        p->state.created = 1;
@@ -835,7 +836,7 @@ bus_responder(enum controlvm_id cmdId, ulong busNo, int response)
        p->pending_msg_hdr.id = CONTROLVM_INVALID;
        if (need_clear) {
                busInfo_clear(p);
-               delbusdevices(&DevInfoList, busNo);
+               delbusdevices(&dev_info_list, busNo);
        }
 }
 
@@ -847,7 +848,7 @@ device_changestate_responder(enum controlvm_id cmdId,
        struct visorchipset_device_info *p = NULL;
        struct controlvm_message outmsg;
 
-       p = finddevice(&DevInfoList, busNo, devNo);
+       p = finddevice(&dev_info_list, busNo, devNo);
        if (!p)
                return;
        if (p->pending_msg_hdr.id == CONTROLVM_INVALID)
@@ -875,7 +876,7 @@ device_responder(enum controlvm_id cmdId, ulong busNo, ulong devNo,
        struct visorchipset_device_info *p = NULL;
        BOOL need_clear = FALSE;
 
-       p = finddevice(&DevInfoList, busNo, devNo);
+       p = finddevice(&dev_info_list, busNo, devNo);
        if (!p)
                return;
        if (response >= 0) {
@@ -904,7 +905,7 @@ bus_epilog(u32 busNo,
 {
        BOOL notified = FALSE;
 
-       struct visorchipset_bus_info *pBusInfo = findbus(&BusInfoList, busNo);
+       struct visorchipset_bus_info *pBusInfo = findbus(&bus_info_list, busNo);
 
        if (!pBusInfo)
                return;
@@ -915,7 +916,7 @@ bus_epilog(u32 busNo,
        } else
                pBusInfo->pending_msg_hdr.id = CONTROLVM_INVALID;
 
-       down(&NotifierLock);
+       down(&notifier_lock);
        if (response == CONTROLVM_RESP_SUCCESS) {
                switch (cmd) {
                case CONTROLVM_BUS_CREATE:
@@ -960,7 +961,7 @@ bus_epilog(u32 busNo,
                ;
        else
                bus_responder(cmd, busNo, response);
-       up(&NotifierLock);
+       up(&notifier_lock);
 }
 
 static void
@@ -972,7 +973,7 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd,
        BOOL notified = FALSE;
 
        struct visorchipset_device_info *pDevInfo =
-               finddevice(&DevInfoList, busNo, devNo);
+               finddevice(&dev_info_list, busNo, devNo);
        char *envp[] = {
                "SPARSP_DIAGPOOL_PAUSED_STATE = 1",
                NULL
@@ -991,7 +992,7 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd,
        } else
                pDevInfo->pending_msg_hdr.id = CONTROLVM_INVALID;
 
-       down(&NotifierLock);
+       down(&notifier_lock);
        if (response >= 0) {
                switch (cmd) {
                case CONTROLVM_DEVICE_CREATE:
@@ -1029,8 +1030,8 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd,
                                /* this is lite pause where channel is
                                 * still valid just 'pause' of it
                                 */
-                               if (busNo == g_diagpoolBusNo
-                                   && devNo == g_diagpoolDevNo) {
+                               if (busNo == g_diagpool_bus_no &&
+                                   devNo == g_diagpool_dev_no) {
                                        /* this will trigger the
                                         * diag_shutdown.sh script in
                                         * the visorchipset hotplug */
@@ -1056,7 +1057,7 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd,
                ;
        else
                device_responder(cmd, busNo, devNo, response);
-       up(&NotifierLock);
+       up(&notifier_lock);
 }
 
 static void
@@ -1068,7 +1069,7 @@ bus_create(struct controlvm_message *inmsg)
        struct visorchipset_bus_info *pBusInfo = NULL;
 
 
-       pBusInfo = findbus(&BusInfoList, busNo);
+       pBusInfo = findbus(&bus_info_list, busNo);
        if (pBusInfo && (pBusInfo->state.created == 1)) {
                POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo,
                                 POSTCODE_SEVERITY_ERR);
@@ -1101,7 +1102,7 @@ bus_create(struct controlvm_message *inmsg)
                        cmd->create_bus.bus_data_type_uuid;
        pBusInfo->chan_info.channel_inst_uuid = cmd->create_bus.bus_inst_uuid;
 
-       list_add(&pBusInfo->entry, &BusInfoList);
+       list_add(&pBusInfo->entry, &bus_info_list);
 
        POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, busNo, POSTCODE_SEVERITY_INFO);
 
@@ -1118,7 +1119,7 @@ bus_destroy(struct controlvm_message *inmsg)
        struct visorchipset_bus_info *pBusInfo;
        int rc = CONTROLVM_RESP_SUCCESS;
 
-       pBusInfo = findbus(&BusInfoList, busNo);
+       pBusInfo = findbus(&bus_info_list, busNo);
        if (!pBusInfo) {
                rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
                goto Away;
@@ -1146,7 +1147,7 @@ bus_configure(struct controlvm_message *inmsg,
        busNo = cmd->configure_bus.bus_no;
        POSTCODE_LINUX_3(BUS_CONFIGURE_ENTRY_PC, busNo, POSTCODE_SEVERITY_INFO);
 
-       pBusInfo = findbus(&BusInfoList, busNo);
+       pBusInfo = findbus(&bus_info_list, busNo);
        if (!pBusInfo) {
                POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo,
                                 POSTCODE_SEVERITY_ERR);
@@ -1189,14 +1190,14 @@ my_device_create(struct controlvm_message *inmsg)
        struct visorchipset_bus_info *pBusInfo = NULL;
        int rc = CONTROLVM_RESP_SUCCESS;
 
-       pDevInfo = finddevice(&DevInfoList, busNo, devNo);
+       pDevInfo = finddevice(&dev_info_list, busNo, devNo);
        if (pDevInfo && (pDevInfo->state.created == 1)) {
                POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
                                 POSTCODE_SEVERITY_ERR);
                rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
                goto Away;
        }
-       pBusInfo = findbus(&BusInfoList, busNo);
+       pBusInfo = findbus(&bus_info_list, busNo);
        if (!pBusInfo) {
                POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
                                 POSTCODE_SEVERITY_ERR);
@@ -1233,15 +1234,15 @@ my_device_create(struct controlvm_message *inmsg)
        pDevInfo->chan_info.channel_type_uuid =
                        cmd->create_device.data_type_uuid;
        pDevInfo->chan_info.intr = cmd->create_device.intr;
-       list_add(&pDevInfo->entry, &DevInfoList);
+       list_add(&pDevInfo->entry, &dev_info_list);
        POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, devNo, busNo,
                         POSTCODE_SEVERITY_INFO);
 Away:
        /* get the bus and devNo for DiagPool channel */
        if (pDevInfo &&
            is_diagpool_channel(pDevInfo->chan_info.channel_type_uuid)) {
-               g_diagpoolBusNo = busNo;
-               g_diagpoolDevNo = devNo;
+               g_diagpool_bus_no = busNo;
+               g_diagpool_dev_no = devNo;
        }
        device_epilog(busNo, devNo, segment_state_running,
                      CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc,
@@ -1259,7 +1260,7 @@ my_device_changestate(struct controlvm_message *inmsg)
        struct visorchipset_device_info *pDevInfo = NULL;
        int rc = CONTROLVM_RESP_SUCCESS;
 
-       pDevInfo = finddevice(&DevInfoList, busNo, devNo);
+       pDevInfo = finddevice(&dev_info_list, busNo, devNo);
        if (!pDevInfo) {
                POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, devNo, busNo,
                                 POSTCODE_SEVERITY_ERR);
@@ -1289,7 +1290,7 @@ my_device_destroy(struct controlvm_message *inmsg)
        struct visorchipset_device_info *pDevInfo = NULL;
        int rc = CONTROLVM_RESP_SUCCESS;
 
-       pDevInfo = finddevice(&DevInfoList, busNo, devNo);
+       pDevInfo = finddevice(&dev_info_list, busNo, devNo);
        if (!pDevInfo) {
                rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID;
                goto Away;
@@ -1755,7 +1756,7 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr)
                        /* when sending back the response to Command */
                        my_device_changestate(&inmsg);
                        g_diag_msg_hdr = inmsg.hdr;
-                       g_DeviceChangeStatePacket = inmsg.cmd;
+                       g_devicechangestate_packet = inmsg.cmd;
                        break;
                }
                break;
@@ -1827,8 +1828,8 @@ controlvm_periodic_work(struct work_struct *work)
        /* Check events to determine if response to CHIPSET_READY
         * should be sent
         */
-       if (visorchipset_holdchipsetready
-           && (g_chipset_msg_hdr.id != CONTROLVM_INVALID)) {
+       if (visorchipset_holdchipsetready &&
+           (g_chipset_msg_hdr.id != CONTROLVM_INVALID)) {
                if (check_chipset_events() == 1) {
                        controlvm_respond(&g_chipset_msg_hdr, 0);
                        clear_chipset_events();
@@ -2046,7 +2047,7 @@ device_resume_response(ulong busNo, ulong devNo, int response)
 BOOL
 visorchipset_get_bus_info(ulong bus_no, struct visorchipset_bus_info *bus_info)
 {
-       void *p = findbus(&BusInfoList, bus_no);
+       void *p = findbus(&bus_info_list, bus_no);
 
        if (!p)
                return FALSE;
@@ -2058,7 +2059,7 @@ EXPORT_SYMBOL_GPL(visorchipset_get_bus_info);
 BOOL
 visorchipset_set_bus_context(ulong bus_no, void *context)
 {
-       struct visorchipset_bus_info *p = findbus(&BusInfoList, bus_no);
+       struct visorchipset_bus_info *p = findbus(&bus_info_list, bus_no);
 
        if (!p)
                return FALSE;
@@ -2071,7 +2072,7 @@ BOOL
 visorchipset_get_device_info(ulong bus_no, ulong dev_no,
                             struct visorchipset_device_info *dev_info)
 {
-       void *p = finddevice(&DevInfoList, bus_no, dev_no);
+       void *p = finddevice(&dev_info_list, bus_no, dev_no);
 
        if (!p)
                return FALSE;
@@ -2084,7 +2085,7 @@ BOOL
 visorchipset_set_device_context(ulong bus_no, ulong dev_no, void *context)
 {
        struct visorchipset_device_info *p =
-                       finddevice(&DevInfoList, bus_no, dev_no);
+                       finddevice(&dev_info_list, bus_no, dev_no);
 
        if (!p)
                return FALSE;