diff options
Diffstat (limited to 'drivers/staging/unisys/uislib/uislib.c')
-rw-r--r-- | drivers/staging/unisys/uislib/uislib.c | 225 |
1 files changed, 35 insertions, 190 deletions
diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c index a9eeddeba735..f93d0bb11b12 100644 --- a/drivers/staging/unisys/uislib/uislib.c +++ b/drivers/staging/unisys/uislib/uislib.c @@ -29,7 +29,6 @@ #include <linux/uuid.h> #include <linux/version.h> -#include "uniklog.h" #include "diagnostics/appos_subsystems.h" #include "uisutils.h" #include "vbuschannel.h" @@ -132,14 +131,10 @@ static __iomem void *init_vbus_channel(u64 ch_addr, u32 ch_bytes) { void __iomem *ch = uislib_ioremap_cache(ch_addr, ch_bytes); - if (!ch) { - LOGERR("CONTROLVM_BUS_CREATE error: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed", - (unsigned long long)ch_addr, - (unsigned long long)ch_bytes); + if (!ch) return NULL; - } + if (!SPAR_VBUS_CHANNEL_OK_CLIENT(ch)) { - ERRDRV("%s channel cannot be used", __func__); uislib_iounmap(ch); return NULL; } @@ -154,8 +149,6 @@ create_bus(struct controlvm_message *msg, char *buf) size_t size; if (max_bus_count == bus_list_count) { - LOGERR("CONTROLVM_BUS_CREATE Failed: max buses:%d already created\n", - max_bus_count); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, max_bus_count, POSTCODE_SEVERITY_ERR); return CONTROLVM_RESP_ERROR_MAX_BUSES; @@ -172,7 +165,6 @@ create_bus(struct controlvm_message *msg, char *buf) (dev_count * sizeof(struct device_info *)); bus = kzalloc(size, GFP_ATOMIC); if (!bus) { - LOGERR("CONTROLVM_BUS_CREATE Failed: kmalloc for bus failed.\n"); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no, POSTCODE_SEVERITY_ERR); return CONTROLVM_RESP_ERROR_KMALLOC_FAILED; @@ -209,8 +201,6 @@ create_bus(struct controlvm_message *msg, char *buf) /* found a bus already in the list with same bus_no - * reject add */ - LOGERR("CONTROLVM_BUS_CREATE Failed: bus %d already exists.\n", - bus->bus_no); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, POSTCODE_SEVERITY_ERR); kfree(bus); @@ -234,14 +224,12 @@ create_bus(struct controlvm_message *msg, char *buf) cmd.add_vbus.bus_uuid = msg->cmd.create_bus.bus_data_type_uuid; cmd.add_vbus.instance_uuid = msg->cmd.create_bus.bus_inst_uuid; if (!virt_control_chan_func) { - LOGERR("CONTROLVM_BUS_CREATE Failed: virtpci callback not registered."); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, POSTCODE_SEVERITY_ERR); kfree(bus); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_BUS_CREATE Failed: virtpci GUEST_ADD_VBUS returned error."); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, POSTCODE_SEVERITY_ERR); kfree(bus); @@ -287,17 +275,13 @@ destroy_bus(struct controlvm_message *msg, char *buf) } if (!bus) { - LOGERR("CONTROLVM_BUS_DESTROY Failed: failed to find bus %d.\n", - bus_no); read_unlock(&bus_list_lock); return CONTROLVM_RESP_ERROR_ALREADY_DONE; } /* verify that this bus has no devices. */ for (i = 0; i < bus->device_count; i++) { - if (bus->device[i] != NULL) { - LOGERR("CONTROLVM_BUS_DESTROY Failed: device %i attached to bus %d.", - i, bus_no); + if (bus->device[i]) { read_unlock(&bus_list_lock); return CONTROLVM_RESP_ERROR_BUS_DEVICE_ATTACHED; } @@ -311,14 +295,11 @@ destroy_bus(struct controlvm_message *msg, char *buf) with this bus. */ cmd.msgtype = GUEST_DEL_VBUS; cmd.del_vbus.bus_no = bus_no; - if (!virt_control_chan_func) { - LOGERR("CONTROLVM_BUS_DESTROY Failed: virtpci callback not registered."); + if (!virt_control_chan_func) return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; - } - if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_BUS_DESTROY Failed: virtpci GUEST_DEL_VBUS returned error."); + + if (!virt_control_chan_func(&cmd)) return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; - } /* finally, remove the bus from the list */ remove: @@ -357,7 +338,6 @@ static int create_device(struct controlvm_message *msg, char *buf) dev = kzalloc(sizeof(*dev), GFP_ATOMIC); if (!dev) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: kmalloc for dev failed.\n"); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); return CONTROLVM_RESP_ERROR_KMALLOC_FAILED; @@ -381,9 +361,6 @@ static int create_device(struct controlvm_message *msg, char *buf) */ min_size = req_handler->min_channel_bytes; if (min_size > 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.channel_bytes, - (ulong)min_size); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = CONTROLVM_RESP_ERROR_CHANNEL_SIZE_TOO_SMALL; @@ -393,9 +370,6 @@ static int create_device(struct controlvm_message *msg, char *buf) uislib_ioremap_cache(dev->channel_addr, 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.channel_bytes); result = CONTROLVM_RESP_ERROR_IOREMAP_FAILED; POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -411,8 +385,6 @@ static int create_device(struct controlvm_message *msg, char *buf) continue; /* make sure the device number is valid */ if (dev_no >= bus->device_count) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: device (%d) >= deviceCount (%d).", - dev_no, bus->device_count); result = CONTROLVM_RESP_ERROR_MAX_DEVICES; POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -421,8 +393,6 @@ static int create_device(struct controlvm_message *msg, char *buf) } /* make sure this device is not already set */ if (bus->device[dev_no]) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: device %d is already exists.", - dev_no); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -445,8 +415,6 @@ static int create_device(struct controlvm_message *msg, char *buf) wait_for_valid_guid(&((struct channel_header __iomem *) (dev->chanptr))->chtype); if (!SPAR_VHBA_CHANNEL_OK_CLIENT(dev->chanptr)) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed:[CLIENT]VHBA dev %d chan invalid.", - dev_no); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -464,8 +432,6 @@ static int create_device(struct controlvm_message *msg, char *buf) wait_for_valid_guid(&((struct channel_header __iomem *) (dev->chanptr))->chtype); if (!SPAR_VNIC_CHANNEL_OK_CLIENT(dev->chanptr)) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: VNIC[CLIENT] dev %d chan invalid.", - dev_no); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); @@ -479,7 +445,6 @@ static int create_device(struct controlvm_message *msg, char *buf) cmd.add_vnic.instance_uuid = dev->instance_uuid; cmd.add_vhba.intr = dev->intr; } else { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: unknown channelTypeGuid.\n"); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; @@ -487,7 +452,6 @@ static int create_device(struct controlvm_message *msg, char *buf) } if (!virt_control_chan_func) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: virtpci callback not registered."); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; @@ -495,7 +459,6 @@ static int create_device(struct controlvm_message *msg, char *buf) } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_DEVICE_CREATE Failed: virtpci GUEST_ADD_[VHBA||VNIC] returned error."); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = @@ -510,8 +473,6 @@ static int create_device(struct controlvm_message *msg, char *buf) } read_unlock(&bus_list_lock); - LOGERR("CONTROLVM_DEVICE_CREATE Failed: failed to find bus %d.", - bus_no); POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no, POSTCODE_SEVERITY_ERR); result = CONTROLVM_RESP_ERROR_BUS_INVALID; @@ -542,15 +503,11 @@ static int pause_device(struct controlvm_message *msg) if (bus->bus_no == bus_no) { /* make sure the device number is valid */ if (dev_no >= bus->device_count) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device(%d) >= deviceCount(%d).", - dev_no, bus->device_count); retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID; } else { /* make sure this device exists */ dev = bus->device[dev_no]; if (!dev) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device %d does not exist.", - dev_no); retval = CONTROLVM_RESP_ERROR_ALREADY_DONE; } @@ -558,11 +515,9 @@ static int pause_device(struct controlvm_message *msg) break; } } - if (!bus) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: bus %d does not exist", - bus_no); + if (!bus) retval = CONTROLVM_RESP_ERROR_BUS_INVALID; - } + read_unlock(&bus_list_lock); if (retval == CONTROLVM_RESP_SUCCESS) { /* the msg is bound for virtpci; send @@ -577,15 +532,11 @@ static int pause_device(struct controlvm_message *msg) cmd.msgtype = GUEST_PAUSE_VNIC; cmd.pause_vnic.chanptr = dev->chanptr; } else { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: unknown channelTypeGuid.\n"); return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; } - if (!virt_control_chan_func) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: virtpci callback not registered."); + if (!virt_control_chan_func) return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; - } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: virtpci GUEST_PAUSE_[VHBA||VNIC] returned error."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; } @@ -609,15 +560,11 @@ static int resume_device(struct controlvm_message *msg) if (bus->bus_no == bus_no) { /* make sure the device number is valid */ if (dev_no >= bus->device_count) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: device(%d) >= deviceCount(%d).", - dev_no, bus->device_count); retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID; } else { /* make sure this device exists */ dev = bus->device[dev_no]; if (!dev) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: device %d does not exist.", - dev_no); retval = CONTROLVM_RESP_ERROR_ALREADY_DONE; } @@ -626,11 +573,9 @@ static int resume_device(struct controlvm_message *msg) } } - if (!bus) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: bus %d does not exist", - bus_no); + if (!bus) retval = CONTROLVM_RESP_ERROR_BUS_INVALID; - } + read_unlock(&bus_list_lock); /* the msg is bound for virtpci; send * guest_msgs struct to callback @@ -645,15 +590,11 @@ static int resume_device(struct controlvm_message *msg) cmd.msgtype = GUEST_RESUME_VNIC; cmd.resume_vnic.chanptr = dev->chanptr; } else { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: unknown channelTypeGuid.\n"); return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; } - if (!virt_control_chan_func) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: virtpci callback not registered."); + if (!virt_control_chan_func) return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; - } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: virtpci GUEST_RESUME_[VHBA||VNIC] returned error."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; } @@ -673,21 +614,15 @@ static int destroy_device(struct controlvm_message *msg, char *buf) dev_no = msg->cmd.destroy_device.bus_no; read_lock(&bus_list_lock); - LOGINF("destroy_device called for bus_no=%u, dev_no=%u", bus_no, - dev_no); for (bus = bus_list; bus; bus = bus->next) { if (bus->bus_no == bus_no) { /* make sure the device number is valid */ if (dev_no >= bus->device_count) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: device(%d) >= device_count(%d).", - dev_no, bus->device_count); retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID; } else { /* make sure this device exists */ dev = bus->device[dev_no]; if (!dev) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: device %d does not exist.", - dev_no); retval = CONTROLVM_RESP_ERROR_ALREADY_DONE; } @@ -696,11 +631,8 @@ static int destroy_device(struct controlvm_message *msg, char *buf) } } - if (!bus) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: bus %d does not exist", - bus_no); + if (!bus) retval = CONTROLVM_RESP_ERROR_BUS_INVALID; - } read_unlock(&bus_list_lock); if (retval == CONTROLVM_RESP_SUCCESS) { /* the msg is bound for virtpci; send @@ -715,17 +647,14 @@ static int destroy_device(struct controlvm_message *msg, char *buf) cmd.msgtype = GUEST_DEL_VNIC; cmd.del_vnic.chanptr = dev->chanptr; } else { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: unknown channelTypeGuid.\n"); return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN; } if (!virt_control_chan_func) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: virtpci callback not registered."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE; } if (!virt_control_chan_func(&cmd)) { - LOGERR("CONTROLVM_DEVICE_DESTROY Failed: virtpci GUEST_DEL_[VHBA||VNIC] returned error."); return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR; } @@ -734,15 +663,11 @@ static int destroy_device(struct controlvm_message *msg, char *buf) * on which accesses the channel and you will get a "unable to handle * kernel paging request" */ - if (dev->polling) { - LOGINF("calling uislib_disable_channel_interrupts"); + if (dev->polling) uislib_disable_channel_interrupts(bus_no, dev_no); - } /* unmap the channel memory for the device. */ - if (!msg->hdr.flags.test_message) { - LOGINF("destroy_device, doing iounmap"); + if (!msg->hdr.flags.test_message) uislib_iounmap(dev->chanptr); - } kfree(dev); bus->device[dev_no] = NULL; } @@ -780,10 +705,8 @@ static int delete_bus_glue(u32 bus_no) init_msg_header(&msg, CONTROLVM_BUS_DESTROY, 0, 0); msg.cmd.destroy_bus.bus_no = bus_no; - if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("destroy_bus failed. bus_no=0x%x\n", bus_no); + if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) return 0; - } return 1; } @@ -794,11 +717,8 @@ static int delete_device_glue(u32 bus_no, u32 dev_no) init_msg_header(&msg, CONTROLVM_DEVICE_DESTROY, 0, 0); msg.cmd.destroy_device.bus_no = bus_no; msg.cmd.destroy_device.dev_no = dev_no; - if (destroy_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("destroy_device failed. bus_no=0x%x dev_no=0x%x\n", - bus_no, dev_no); + if (destroy_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) return 0; - } return 1; } @@ -808,7 +728,6 @@ uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid, { struct controlvm_message msg; - LOGINF("enter busNo=0x%x\n", bus_no); /* step 0: init the chipset */ POSTCODE_LINUX_3(CHIPSET_INIT_ENTRY_PC, bus_no, POSTCODE_SEVERITY_INFO); @@ -824,11 +743,8 @@ uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid, */ msg.cmd.init_chipset.bus_count = 23; msg.cmd.init_chipset.switch_count = 0; - if (init_chipset(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("init_chipset failed.\n"); + if (init_chipset(&msg, NULL) != CONTROLVM_RESP_SUCCESS) return 0; - } - LOGINF("chipset initialized\n"); POSTCODE_LINUX_3(CHIPSET_INIT_EXIT_PC, bus_no, POSTCODE_SEVERITY_INFO); } @@ -842,7 +758,6 @@ uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid, msg.cmd.create_bus.channel_addr = channel_addr; msg.cmd.create_bus.channel_bytes = n_channel_bytes; if (create_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) { - LOGERR("create_bus failed.\n"); POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no, POSTCODE_SEVERITY_ERR); return 0; @@ -871,11 +786,8 @@ uislib_client_inject_pause_vhba(u32 bus_no, u32 dev_no) msg.cmd.device_change_state.dev_no = dev_no; msg.cmd.device_change_state.state = segment_state_standby; rc = pause_device(&msg); - if (rc != CONTROLVM_RESP_SUCCESS) { - LOGERR("VHBA pause_device failed. busNo=0x%x devNo=0x%x\n", - bus_no, dev_no); + if (rc != CONTROLVM_RESP_SUCCESS) return rc; - } return 0; } EXPORT_SYMBOL_GPL(uislib_client_inject_pause_vhba); @@ -891,11 +803,8 @@ uislib_client_inject_resume_vhba(u32 bus_no, u32 dev_no) msg.cmd.device_change_state.dev_no = dev_no; msg.cmd.device_change_state.state = segment_state_running; rc = resume_device(&msg); - if (rc != CONTROLVM_RESP_SUCCESS) { - LOGERR("VHBA resume_device failed. busNo=0x%x devNo=0x%x\n", - bus_no, dev_no); + if (rc != CONTROLVM_RESP_SUCCESS) return rc; - } return 0; } EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vhba); @@ -908,7 +817,6 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, { struct controlvm_message msg; - LOGINF(" enter busNo=0x%x devNo=0x%x\n", bus_no, dev_no); /* chipset init'ed with bus bus has been previously created - * Verify it still exists step 2: create the VHBA device on the * bus @@ -932,8 +840,6 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, sizeof(struct irq_info)); 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); POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, chan_bytes, MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR); return 0; @@ -941,7 +847,6 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no, 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, POSTCODE_SEVERITY_ERR); return 0; @@ -967,7 +872,6 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, { struct controlvm_message msg; - LOGINF(" enter busNo=0x%x devNo=0x%x\n", bus_no, dev_no); /* chipset init'ed with bus bus has been previously created - * Verify it still exists step 2: create the VNIC device on the * bus @@ -991,8 +895,6 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, sizeof(struct irq_info)); 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); POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, chan_bytes, MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR); return 0; @@ -1000,7 +902,6 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no, 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, POSTCODE_SEVERITY_ERR); return 0; @@ -1023,11 +924,8 @@ uislib_client_inject_pause_vnic(u32 bus_no, u32 dev_no) msg.cmd.device_change_state.dev_no = dev_no; msg.cmd.device_change_state.state = segment_state_standby; rc = pause_device(&msg); - if (rc != CONTROLVM_RESP_SUCCESS) { - LOGERR("VNIC pause_device failed. busNo=0x%x devNo=0x%x\n", - bus_no, dev_no); + if (rc != CONTROLVM_RESP_SUCCESS) return -1; - } return 0; } EXPORT_SYMBOL_GPL(uislib_client_inject_pause_vnic); @@ -1043,11 +941,8 @@ uislib_client_inject_resume_vnic(u32 bus_no, u32 dev_no) msg.cmd.device_change_state.dev_no = dev_no; msg.cmd.device_change_state.state = segment_state_running; rc = resume_device(&msg); - if (rc != CONTROLVM_RESP_SUCCESS) { - LOGERR("VNIC resume_device failed. busNo=0x%x devNo=0x%x\n", - bus_no, dev_no); + if (rc != CONTROLVM_RESP_SUCCESS) return -1; - } return 0; } EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vnic); @@ -1069,11 +964,8 @@ uislib_cache_alloc(struct kmem_cache *cur_pool, char *fn, int ln) */ void *p = kmem_cache_alloc(cur_pool, GFP_ATOMIC | __GFP_NORETRY); - if (p == NULL) { - LOGERR("uislib_malloc failed to alloc uiscmdrsp @%s:%d", - fn, ln); + if (!p) return NULL; - } return p; } EXPORT_SYMBOL_GPL(uislib_cache_alloc); @@ -1081,10 +973,8 @@ EXPORT_SYMBOL_GPL(uislib_cache_alloc); void uislib_cache_free(struct kmem_cache *cur_pool, void *p, char *fn, int ln) { - if (p == NULL) { - LOGERR("uislib_free NULL pointer @%s:%d", fn, ln); + if (!p) return; - } kmem_cache_free(cur_pool, p); } EXPORT_SYMBOL_GPL(uislib_cache_free); @@ -1162,20 +1052,16 @@ static ssize_t info_debugfs_read(struct file *file, char __user *buf, int remaining_bytes = PROC_READ_BUFFER_SIZE; /* *start = buf; */ - if (debug_buf == NULL) { - DBGINF("debug_buf == NULL; allocating buffer.\n."); + if (!debug_buf) { debug_buf = vmalloc(PROC_READ_BUFFER_SIZE); - if (debug_buf == NULL) { - LOGERR("failed to allocate buffer to provide proc data.\n"); + if (!debug_buf) return -ENOMEM; - } } temp = debug_buf; if ((*offset == 0) || (!debug_buf_valid)) { - DBGINF("calling info_debugfs_read_helper.\n"); /* if the read fails, then -1 will be returned */ total_bytes = info_debugfs_read_helper(&temp, &remaining_bytes); debug_buf_valid = 1; @@ -1196,17 +1082,9 @@ static struct device_info *find_dev(u32 bus_no, u32 dev_no) for (bus = bus_list; bus; bus = bus->next) { if (bus->bus_no == bus_no) { /* make sure the device number is valid */ - if (dev_no >= bus->device_count) { - LOGERR("%s bad bus_no, dev_no=%d,%d", - __func__, - (int)bus_no, (int)dev_no); + if (dev_no >= bus->device_count) break; - } dev = bus->device[dev_no]; - if (!dev) - LOGERR("%s bad bus_no, dev_no=%d,%d", - __func__, - (int)bus_no, (int)dev_no); break; } } @@ -1253,7 +1131,6 @@ static int process_incoming(void *v) wait_cycles = (cur_cycles - old_cycles); } } - LOGINF("wait_cycles=%llu", wait_cycles); cycles_before_wait = wait_cycles; idle_cycles = 0; poll_dev_start = 0; @@ -1281,7 +1158,7 @@ static int process_incoming(void *v) * Reschedule work to occur as soon as * possible. */ idle_cycles = 0; - if (new_tail == NULL) { + if (!new_tail) { dev->first_busy_cnt++; if (! (list_is_last @@ -1294,10 +1171,10 @@ static int process_incoming(void *v) } } } - if (incoming_ti.should_stop) + if (kthread_should_stop()) break; } - if (new_tail != NULL) { + if (new_tail) { tot_moved_to_tail_cnt++; list_move_tail(new_tail, &poll_dev_chan); } @@ -1311,12 +1188,10 @@ static int process_incoming(void *v) * - there is no input waiting on any of the channels * - we have received a signal to stop this thread */ - if (incoming_ti.should_stop) + if (kthread_should_stop()) break; - if (en_smart_wakeup == 0xFF) { - LOGINF("en_smart_wakeup set to 0xff, to force exiting process_incoming"); + if (en_smart_wakeup == 0xFF) break; - } /* wait for POLLJIFFIES_NORMAL jiffies, or until * someone wakes up poll_dev_wake_q, * whichever comes first only do a wait when we have @@ -1335,7 +1210,6 @@ static int process_incoming(void *v) idle_cycles = idle_cycles + delta_cycles; } } - DBGINF("exiting.\n"); complete_and_exit(&incoming_ti.has_stopped, 0); } @@ -1346,7 +1220,6 @@ initialize_incoming_thread(void) return TRUE; if (!uisthread_start(&incoming_ti, &process_incoming, NULL, "dev_incoming")) { - LOGERR("uisthread_start initialize_incoming_thread ****FAILED"); return FALSE; } incoming_started = TRUE; @@ -1367,11 +1240,9 @@ uislib_enable_channel_interrupts(u32 bus_no, u32 dev_no, struct device_info *dev; dev = find_dev(bus_no, dev_no); - if (!dev) { - LOGERR("%s busNo=%d, devNo=%d", __func__, (int)(bus_no), - (int)(dev_no)); + if (!dev) return; - } + down(&poll_dev_lock); initialize_incoming_thread(); dev->interrupt = interrupt; @@ -1392,11 +1263,8 @@ uislib_disable_channel_interrupts(u32 bus_no, u32 dev_no) struct device_info *dev; dev = find_dev(bus_no, dev_no); - if (!dev) { - LOGERR("%s busNo=%d, devNo=%d", __func__, (int)(bus_no), - (int)(dev_no)); + if (!dev) return; - } down(&poll_dev_lock); list_del(&dev->list_polling_device_channels); dev->polling = FALSE; @@ -1446,27 +1314,6 @@ uislib_mod_init(void) if (!unisys_spar_platform) return -ENODEV; - LOGINF("MONITORAPIS"); - - LOGINF("sizeof(struct uiscmdrsp):%lu bytes\n", - (ulong)sizeof(struct uiscmdrsp)); - LOGINF("sizeof(struct phys_info):%lu\n", - (ulong)sizeof(struct phys_info)); - LOGINF("sizeof(uiscmdrsp_scsi):%lu\n", - (ulong)sizeof(struct uiscmdrsp_scsi)); - LOGINF("sizeof(uiscmdrsp_net):%lu\n", - (ulong)sizeof(struct uiscmdrsp_net)); - LOGINF("sizeof(CONTROLVM_MESSAGE):%lu bytes\n", - (ulong)sizeof(struct controlvm_message)); - LOGINF("sizeof(struct spar_controlvm_channel_protocol):%lu bytes\n", - (ulong)sizeof(struct spar_controlvm_channel_protocol)); - LOGINF("sizeof(CHANNEL_HEADER):%lu bytes\n", - (ulong)sizeof(struct channel_header)); - 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); - /* initialize global pointers to NULL */ bus_list = NULL; bus_list_count = 0; @@ -1514,8 +1361,6 @@ uislib_mod_exit(void) debugfs_remove(cycles_before_wait_debugfs_read); debugfs_remove(platformnumber_debugfs_read); debugfs_remove(dir_debugfs); - - DBGINF("goodbye.\n"); } module_init(uislib_mod_init); |