Remove extraneous blank lines and get consistency of blank lines. Signed-off-by: David Kershner <david.kershner@xxxxxxxxxx> Reviewed-by: Tim Sell <timothy.sell@xxxxxxxxxx> --- drivers/staging/unisys/visorbus/visorchipset.c | 98 +------------------------- 1 file changed, 3 insertions(+), 95 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index df7429d..416e741 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -128,7 +128,6 @@ static ssize_t toolaction_show(struct device *dev, &tool_action, sizeof(u8)); if (err) return err; - return sprintf(buf, "%u\n", tool_action); } @@ -141,7 +140,6 @@ static ssize_t toolaction_store(struct device *dev, if (kstrtou8(buf, 10, &tool_action)) return -EINVAL; - err = visorchannel_write(chipset_dev->controlvm_channel, offsetof(struct visor_controlvm_channel, tool_action), @@ -178,7 +176,6 @@ static ssize_t boottotool_store(struct device *dev, if (kstrtoint(buf, 10, &val)) return -EINVAL; - efi_visor_indication.boot_to_tool = val; err = visorchannel_write(chipset_dev->controlvm_channel, offsetof(struct visor_controlvm_channel, @@ -214,7 +211,6 @@ static ssize_t error_store(struct device *dev, struct device_attribute *attr, if (kstrtou32(buf, 10, &error)) return -EINVAL; - err = visorchannel_write(chipset_dev->controlvm_channel, offsetof(struct visor_controlvm_channel, installation_error), @@ -237,7 +233,6 @@ static ssize_t textid_show(struct device *dev, struct device_attribute *attr, &text_id, sizeof(u32)); if (err) return err; - return sprintf(buf, "%u\n", text_id); } @@ -249,7 +244,6 @@ static ssize_t textid_store(struct device *dev, struct device_attribute *attr, if (kstrtou32(buf, 10, &text_id)) return -EINVAL; - err = visorchannel_write(chipset_dev->controlvm_channel, offsetof(struct visor_controlvm_channel, installation_text_id), @@ -272,7 +266,6 @@ static ssize_t remaining_steps_show(struct device *dev, &remaining_steps, sizeof(u16)); if (err) return err; - return sprintf(buf, "%hu\n", remaining_steps); } @@ -285,7 +278,6 @@ static ssize_t remaining_steps_store(struct device *dev, if (kstrtou16(buf, 10, &remaining_steps)) return -EINVAL; - err = visorchannel_write(chipset_dev->controlvm_channel, offsetof(struct visor_controlvm_channel, installation_remaining_steps), @@ -309,7 +301,6 @@ static int match_visorbus_dev_by_id(struct device *dev, void *data) if ((vdev->chipset_bus_no == id->bus_no) && (vdev->chipset_dev_no == id->dev_no)) return 1; - return 0; } @@ -374,7 +365,6 @@ static int chipset_init(struct controlvm_message *inmsg) goto out_respond; } chipset_inited = 1; - /* * Set features to indicate we support parahotplug (if Command also * supports it). Set the "reply" bit so Command knows this is a @@ -399,12 +389,10 @@ static int controlvm_respond(struct controlvm_message_header *msg_hdr, controlvm_init_response(&outmsg, msg_hdr, response); if (outmsg.hdr.flags.test_message == 1) return -EINVAL; - if (state) { outmsg.cmd.device_change_state.state = *state; outmsg.cmd.device_change_state.flags.phys_device = 1; } - return visorchannel_signalinsert(chipset_dev->controlvm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg); } @@ -430,13 +418,11 @@ static int save_crash_message(struct controlvm_message *msg, "failed to read message count\n"); return err; } - if (local_crash_msg_count != CONTROLVM_CRASHMSG_MAX) { dev_err(&chipset_dev->acpi_device->dev, "invalid number of messages\n"); return -EIO; } - err = visorchannel_read(chipset_dev->controlvm_channel, offsetof(struct visor_controlvm_channel, saved_crash_message_offset), @@ -446,7 +432,6 @@ static int save_crash_message(struct controlvm_message *msg, "failed to read offset\n"); return err; } - switch (cr_type) { case CRASH_DEV: local_crash_msg_offset += sizeof(struct controlvm_message); @@ -498,11 +483,9 @@ static int device_changestate_responder( return -EINVAL; controlvm_init_response(&outmsg, p->pending_msg_hdr, response); - outmsg.cmd.device_change_state.bus_no = p->chipset_bus_no; outmsg.cmd.device_change_state.dev_no = p->chipset_dev_no; outmsg.cmd.device_change_state.state = response_state; - return visorchannel_signalinsert(chipset_dev->controlvm_channel, CONTROLVM_QUEUE_REQUEST, &outmsg); } @@ -523,35 +506,29 @@ static int visorbus_create(struct controlvm_message *inmsg) err = -EEXIST; goto err_respond; } - bus_info = kzalloc(sizeof(*bus_info), GFP_KERNEL); if (!bus_info) { err = -ENOMEM; goto err_respond; } - INIT_LIST_HEAD(&bus_info->list_all); bus_info->chipset_bus_no = bus_no; bus_info->chipset_dev_no = BUS_ROOT_DEVICE; - if (guid_equal(&cmd->create_bus.bus_inst_guid, &visor_siovm_guid)) { err = save_crash_message(inmsg, CRASH_BUS); if (err) goto err_free_bus_info; } - if (inmsg->hdr.flags.response_expected == 1) { pmsg_hdr = kzalloc(sizeof(*pmsg_hdr), GFP_KERNEL); if (!pmsg_hdr) { err = -ENOMEM; goto err_free_bus_info; } - memcpy(pmsg_hdr, &inmsg->hdr, sizeof(struct controlvm_message_header)); bus_info->pending_msg_hdr = pmsg_hdr; } - visorchannel = visorchannel_create(cmd->create_bus.channel_addr, GFP_KERNEL, &cmd->create_bus.bus_data_type_guid); @@ -559,14 +536,11 @@ static int visorbus_create(struct controlvm_message *inmsg) err = -ENOMEM; goto err_free_pending_msg; } - bus_info->visorchannel = visorchannel; - /* Response will be handled by visorbus_create_instance on success */ err = visorbus_create_instance(bus_info); if (err) goto err_destroy_channel; - return 0; err_destroy_channel: @@ -611,12 +585,10 @@ static int visorbus_destroy(struct controlvm_message *inmsg) err = -ENOMEM; goto err_respond; } - memcpy(pmsg_hdr, &inmsg->hdr, sizeof(struct controlvm_message_header)); bus_info->pending_msg_hdr = pmsg_hdr; } - /* Response will be handled by visorbus_remove_instance */ visorbus_remove_instance(bus_info); return 0; @@ -654,10 +626,8 @@ static void *parser_name_get(struct parser_context *ctx) struct visor_controlvm_parameters_header *phdr = NULL; phdr = &ctx->data; - if (phdr->name_offset + phdr->name_length > ctx->param_bytes) return NULL; - ctx->curr = (char *)&phdr + phdr->name_offset; ctx->bytes_remaining = phdr->name_length; return parser_string_get(ctx->curr, phdr->name_length); @@ -685,19 +655,16 @@ static int visorbus_configure(struct controlvm_message *inmsg, err = -EIO; goto err_respond; } - err = visorchannel_set_clientpartition(bus_info->visorchannel, cmd->configure_bus.guest_handle); if (err) goto err_respond; - if (parser_ctx) { const guid_t *partition_guid = parser_id_get(parser_ctx); guid_copy(&bus_info->partition_guid, partition_guid); bus_info->name = parser_name_get(parser_ctx); } - if (inmsg->hdr.flags.response_expected == 1) controlvm_responder(inmsg->hdr.id, &inmsg->hdr, err); return 0; @@ -734,7 +701,6 @@ static int visorbus_device_create(struct controlvm_message *inmsg) err = -EINVAL; goto err_respond; } - dev_info = visorbus_get_device_by_id(bus_no, dev_no, NULL); if (dev_info && (dev_info->state.created == 1)) { dev_err(&chipset_dev->acpi_device->dev, @@ -748,12 +714,10 @@ static int visorbus_device_create(struct controlvm_message *inmsg) err = -ENOMEM; goto err_respond; } - dev_info->chipset_bus_no = bus_no; dev_info->chipset_dev_no = dev_no; guid_copy(&dev_info->inst, &cmd->create_device.dev_inst_guid); dev_info->device.parent = &bus_info->device; - visorchannel = visorchannel_create_with_lock(cmd->create_device.channel_addr, GFP_KERNEL, @@ -772,14 +736,12 @@ static int visorbus_device_create(struct controlvm_message *inmsg) if (err) goto err_destroy_visorchannel; } - if (inmsg->hdr.flags.response_expected == 1) { pmsg_hdr = kzalloc(sizeof(*pmsg_hdr), GFP_KERNEL); if (!pmsg_hdr) { err = -ENOMEM; goto err_destroy_visorchannel; } - memcpy(pmsg_hdr, &inmsg->hdr, sizeof(struct controlvm_message_header)); dev_info->pending_msg_hdr = pmsg_hdr; @@ -827,18 +789,17 @@ static int visorbus_device_changestate(struct controlvm_message *inmsg) err = -EIO; goto err_respond; } + if (inmsg->hdr.flags.response_expected == 1) { pmsg_hdr = kzalloc(sizeof(*pmsg_hdr), GFP_KERNEL); if (!pmsg_hdr) { err = -ENOMEM; goto err_respond; } - memcpy(pmsg_hdr, &inmsg->hdr, sizeof(struct controlvm_message_header)); dev_info->pending_msg_hdr = pmsg_hdr; } - if (state.alive == segment_state_running.alive && state.operating == segment_state_running.operating) /* Response will be sent from visorchipset_device_resume */ @@ -853,7 +814,6 @@ static int visorbus_device_changestate(struct controlvm_message *inmsg) err = visorchipset_device_pause(dev_info); if (err) goto err_respond; - return 0; err_respond: @@ -897,7 +857,6 @@ static int visorbus_device_destroy(struct controlvm_message *inmsg) sizeof(struct controlvm_message_header)); dev_info->pending_msg_hdr = pmsg_hdr; } - kfree(dev_info->name); remove_visor_device(dev_info); return 0; @@ -964,11 +923,9 @@ static struct parahotplug_request *parahotplug_request_create( req = kmalloc(sizeof(*req), GFP_KERNEL); if (!req) return NULL; - req->id = parahotplug_next_id(); req->expiration = parahotplug_next_expiration(); req->msg = *msg; - return req; } @@ -1003,7 +960,6 @@ static int parahotplug_request_complete(int id, u16 active) struct parahotplug_request *req; spin_lock(¶hotplug_request_list_lock); - /* Look for a request matching "id". */ list_for_each_safe(pos, tmp, ¶hotplug_request_list) { req = list_entry(pos, struct parahotplug_request, list); @@ -1023,7 +979,6 @@ static int parahotplug_request_complete(int id, u16 active) return 0; } } - spin_unlock(¶hotplug_request_list_lock); return -EINVAL; } @@ -1050,7 +1005,6 @@ static ssize_t devicedisabled_store(struct device *dev, if (kstrtouint(buf, 10, &id)) return -EINVAL; - err = parahotplug_request_complete(id, 0); if (err < 0) return err; @@ -1079,7 +1033,6 @@ static ssize_t deviceenabled_store(struct device *dev, if (kstrtouint(buf, 10, &id)) return -EINVAL; - parahotplug_request_complete(id, 1); return count; } @@ -1142,7 +1095,6 @@ static int parahotplug_request_kickoff(struct parahotplug_request *req) cmd->device_change_state.dev_no >> 3); sprintf(env_func, "VISOR_PARAHOTPLUG_FUNCTION=%d", cmd->device_change_state.dev_no & 0x7); - return kobject_uevent_env(&chipset_dev->acpi_device->dev.kobj, KOBJ_CHANGE, envp); } @@ -1160,7 +1112,6 @@ static int parahotplug_process_message(struct controlvm_message *inmsg) req = parahotplug_request_create(inmsg); if (!req) return -ENOMEM; - /* * For enable messages, just respond with success right away, we don't * need to wait to see if the enable was successful. @@ -1174,7 +1125,6 @@ static int parahotplug_process_message(struct controlvm_message *inmsg) parahotplug_request_destroy(req); return 0; } - /* * For disable messages, add the request to the request list before * kicking off the udev script. It won't get responded to until the @@ -1183,7 +1133,6 @@ static int parahotplug_process_message(struct controlvm_message *inmsg) spin_lock(¶hotplug_request_list_lock); list_add_tail(&req->list, ¶hotplug_request_list); spin_unlock(¶hotplug_request_list_lock); - err = parahotplug_request_kickoff(req); if (err) goto err_respond; @@ -1209,7 +1158,6 @@ static int chipset_ready_uevent(struct controlvm_message_header *msg_hdr) res = kobject_uevent(&chipset_dev->acpi_device->dev.kobj, KOBJ_ONLINE); if (msg_hdr->flags.response_expected) controlvm_respond(msg_hdr, res, NULL); - return res; } @@ -1229,10 +1177,8 @@ static int chipset_selftest_uevent(struct controlvm_message_header *msg_hdr) sprintf(env_selftest, "SPARSP_SELFTEST=%d", 1); res = kobject_uevent_env(&chipset_dev->acpi_device->dev.kobj, KOBJ_CHANGE, envp); - if (msg_hdr->flags.response_expected) controlvm_respond(msg_hdr, res, NULL); - return res; } @@ -1250,7 +1196,6 @@ static int chipset_notready_uevent(struct controlvm_message_header *msg_hdr) if (msg_hdr->flags.response_expected) controlvm_respond(msg_hdr, res, NULL); - return res; } @@ -1263,17 +1208,15 @@ static int unisys_vmcall(unsigned long tuple, unsigned long param) reg_ebx = param & 0xFFFFFFFF; reg_ecx = param >> 32; - cpuid(0x00000001, &cpuid_eax, &cpuid_ebx, &cpuid_ecx, &cpuid_edx); if (!(cpuid_ecx & 0x80000000)) return -EPERM; - __asm__ __volatile__(".byte 0x00f, 0x001, 0x0c1" : "=a"(result) : "a"(tuple), "b"(reg_ebx), "c"(reg_ecx)); if (result) goto error; - return 0; + /* Need to convert from VMCALL error codes to Linux */ error: switch (result) { @@ -1317,9 +1260,7 @@ static void setup_crash_devices_work_queue(struct work_struct *work) msg.hdr.id = CONTROLVM_CHIPSET_INIT; msg.cmd.init_chipset.bus_count = 23; msg.cmd.init_chipset.switch_count = 0; - chipset_init(&msg); - /* get saved message count */ if (visorchannel_read(chipset_dev->controlvm_channel, offsetof(struct visor_controlvm_channel, @@ -1329,12 +1270,10 @@ static void setup_crash_devices_work_queue(struct work_struct *work) "failed to read channel\n"); return; } - if (local_crash_msg_count != CONTROLVM_CRASHMSG_MAX) { dev_err(&chipset_dev->acpi_device->dev, "invalid count\n"); return; } - /* get saved crash message offset */ if (visorchannel_read(chipset_dev->controlvm_channel, offsetof(struct visor_controlvm_channel, @@ -1344,7 +1283,6 @@ static void setup_crash_devices_work_queue(struct work_struct *work) "failed to read channel\n"); return; } - /* read create device message for storage bus offset */ if (visorchannel_read(chipset_dev->controlvm_channel, local_crash_msg_offset, @@ -1354,7 +1292,6 @@ static void setup_crash_devices_work_queue(struct work_struct *work) "failed to read channel\n"); return; } - /* read create device message for storage device */ if (visorchannel_read(chipset_dev->controlvm_channel, local_crash_msg_offset + @@ -1365,7 +1302,6 @@ static void setup_crash_devices_work_queue(struct work_struct *work) "failed to read channel\n"); return; } - /* reuse IOVM create bus message */ if (!local_crash_bus_msg.cmd.create_bus.channel_addr) { dev_err(&chipset_dev->acpi_device->dev, @@ -1373,7 +1309,6 @@ static void setup_crash_devices_work_queue(struct work_struct *work) return; } visorbus_create(&local_crash_bus_msg); - /* reuse create device message for storage device */ if (!local_crash_dev_msg.cmd.create_device.channel_addr) { dev_err(&chipset_dev->acpi_device->dev, @@ -1421,7 +1356,6 @@ static struct parser_context *parser_init_stream(u64 addr, u32 bytes, void *mapping; *retry = false; - /* alloc an extra byte to ensure payload is \0 terminated */ allocbytes = bytes + 1 + (sizeof(struct parser_context) - sizeof(struct visor_controlvm_parameters_header)); @@ -1435,7 +1369,6 @@ static struct parser_context *parser_init_stream(u64 addr, u32 bytes, *retry = true; return NULL; } - ctx->allocbytes = allocbytes; ctx->param_bytes = bytes; mapping = memremap(addr, bytes, MEMREMAP_WB); @@ -1445,7 +1378,6 @@ static struct parser_context *parser_init_stream(u64 addr, u32 bytes, memunmap(mapping); ctx->byte_stream = true; chipset_dev->controlvm_payload_bytes_buffered += ctx->param_bytes; - return ctx; err_finish_ctx: @@ -1478,7 +1410,6 @@ static int handle_command(struct controlvm_message inmsg, u64 channel_addr) /* create parsing context if necessary */ parm_addr = channel_addr + inmsg.hdr.payload_vm_offset; parm_bytes = inmsg.hdr.payload_bytes; - /* * Parameter and channel addresses within test messages actually lie * within our OS-controlled memory. We need to know that, because it @@ -1496,7 +1427,6 @@ static int handle_command(struct controlvm_message inmsg, u64 channel_addr) CONTROLVM_QUEUE_ACK, &ackmsg); if (err) return err; - switch (inmsg.hdr.id) { case CONTROLVM_CHIPSET_INIT: err = chipset_init(&inmsg); @@ -1550,7 +1480,6 @@ static int handle_command(struct controlvm_message inmsg, u64 channel_addr) -CONTROLVM_RESP_ID_UNKNOWN, NULL); break; } - if (parser_ctx) { parser_done(parser_ctx); parser_ctx = NULL; @@ -1570,13 +1499,12 @@ static int read_controlvm_event(struct controlvm_message *msg) { int err = visorchannel_signalremove(chipset_dev->controlvm_channel, CONTROLVM_QUEUE_EVENT, msg); + if (err) return err; - /* got a message */ if (msg->hdr.flags.test_message == 1) return -EINVAL; - return 0; } @@ -1590,14 +1518,12 @@ static void parahotplug_process_list(void) struct list_head *tmp; spin_lock(¶hotplug_request_list_lock); - list_for_each_safe(pos, tmp, ¶hotplug_request_list) { struct parahotplug_request *req = list_entry(pos, struct parahotplug_request, list); if (!time_after_eq(jiffies, req->expiration)) continue; - list_del(pos); if (req->msg.hdr.flags.response_expected) controlvm_respond( @@ -1606,7 +1532,6 @@ static void parahotplug_process_list(void) &req->msg.cmd.device_change_state.state); parahotplug_request_destroy(req); } - spin_unlock(¶hotplug_request_list_lock); } @@ -1622,10 +1547,8 @@ static void controlvm_periodic_work(struct work_struct *work) CONTROLVM_QUEUE_RESPONSE, &inmsg); } while ((!err) && (++count < CONTROLVM_MESSAGE_MAX)); - if (err != -EAGAIN) goto schedule_out; - if (chipset_dev->controlvm_pending_msg_valid) { /* * we throttled processing of a prior msg, so try to process @@ -1637,7 +1560,6 @@ static void controlvm_periodic_work(struct work_struct *work) } else { err = read_controlvm_event(&inmsg); } - while (!err) { chipset_dev->most_recent_message_jiffies = jiffies; err = handle_command(inmsg, @@ -1651,7 +1573,6 @@ static void controlvm_periodic_work(struct work_struct *work) err = read_controlvm_event(&inmsg); } - /* parahotplug_worker */ parahotplug_process_list(); @@ -1677,7 +1598,6 @@ static void controlvm_periodic_work(struct work_struct *work) chipset_dev->poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; } - schedule_delayed_work(&chipset_dev->periodic_controlvm_work, chipset_dev->poll_jiffies); } @@ -1690,20 +1610,16 @@ static int visorchipset_init(struct acpi_device *acpi_device) chipset_dev = kzalloc(sizeof(*chipset_dev), GFP_KERNEL); if (!chipset_dev) goto error; - err = controlvm_channel_create(chipset_dev); if (err) goto error_free_chipset_dev; - acpi_device->driver_data = chipset_dev; chipset_dev->acpi_device = acpi_device; chipset_dev->poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; - err = sysfs_create_groups(&chipset_dev->acpi_device->dev.kobj, visorchipset_dev_groups); if (err < 0) goto error_destroy_channel; - controlvm_channel = chipset_dev->controlvm_channel; if (!visor_check_channel(visorchannel_get_header(controlvm_channel), &chipset_dev->acpi_device->dev, @@ -1713,7 +1629,6 @@ static int visorchipset_init(struct acpi_device *acpi_device) VISOR_CONTROLVM_CHANNEL_VERSIONID, VISOR_CHANNEL_SIGNATURE)) goto error_delete_groups; - /* if booting in a crash kernel */ if (is_kdump_kernel()) INIT_DELAYED_WORK(&chipset_dev->periodic_controlvm_work, @@ -1721,16 +1636,13 @@ static int visorchipset_init(struct acpi_device *acpi_device) else INIT_DELAYED_WORK(&chipset_dev->periodic_controlvm_work, controlvm_periodic_work); - chipset_dev->most_recent_message_jiffies = jiffies; chipset_dev->poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST; schedule_delayed_work(&chipset_dev->periodic_controlvm_work, chipset_dev->poll_jiffies); - err = visorbus_init(); if (err < 0) goto error_cancel_work; - return 0; error_cancel_work: @@ -1757,10 +1669,8 @@ static int visorchipset_exit(struct acpi_device *acpi_device) cancel_delayed_work_sync(&chipset_dev->periodic_controlvm_work); sysfs_remove_groups(&chipset_dev->acpi_device->dev.kobj, visorchipset_dev_groups); - visorchannel_destroy(chipset_dev->controlvm_channel); kfree(chipset_dev); - return 0; } @@ -1802,11 +1712,9 @@ static int init_unisys(void) if (!visorutil_spar_detect()) return -ENODEV; - result = acpi_bus_register_driver(&unisys_acpi_driver); if (result) return -ENODEV; - pr_info("Unisys Visorchipset Driver Loaded.\n"); return 0; }; -- 1.9.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel