aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorDavid Kershner <david.kershner@unisys.com>2017-08-30 13:36:19 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-08-31 18:17:39 +0200
commitf1f537c2e7f565a808623d3244ea73a65839240e (patch)
tree4a3c81e45b0c23f8a171c31365d0bad4930fd99f /drivers/staging
parentstaging: unisys: include: Add comment next to mutex. (diff)
downloadlinux-dev-f1f537c2e7f565a808623d3244ea73a65839240e.tar.xz
linux-dev-f1f537c2e7f565a808623d3244ea73a65839240e.zip
staging: unisys: visorbus: Consolidate controlvm channel creation.
The functions to create the controlvm channel were disjointed and ignoring information that was available. This patch consolidates it so it clearer what is happening. Signed-off-by: David Kershner <david.kershner@unisys.com> Reviewed-by: Tim Sell <timothy.sell@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/unisys/visorbus/visorchipset.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index c7b4599a591b..dca936bbb7b4 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1332,34 +1332,27 @@ error:
}
}
-static unsigned int issue_vmcall_io_controlvm_addr(u64 *control_addr,
- u32 *control_bytes)
+static int controlvm_channel_create(struct visorchipset_device *dev)
{
- u64 physaddr;
+ struct visorchannel *chan;
+ u64 addr;
+ u32 size;
int err;
- physaddr = virt_to_phys(&chipset_dev->controlvm_params);
- err = unisys_vmcall(VMCALL_CONTROLVM_ADDR, physaddr);
+ err = unisys_vmcall(VMCALL_CONTROLVM_ADDR,
+ virt_to_phys(&dev->controlvm_params));
if (err)
return err;
-
- *control_addr = chipset_dev->controlvm_params.address;
- *control_bytes = chipset_dev->controlvm_params.channel_bytes;
-
+ addr = dev->controlvm_params.address;
+ size = dev->controlvm_params.channel_bytes;
+ chan = visorchannel_create_with_lock(addr, size, GFP_KERNEL,
+ &visor_controlvm_channel_guid);
+ if (!chan)
+ return -ENOMEM;
+ dev->controlvm_channel = chan;
return 0;
}
-static u64 controlvm_get_channel_address(void)
-{
- u64 addr = 0;
- u32 size = 0;
-
- if (issue_vmcall_io_controlvm_addr(&addr, &size))
- return 0;
-
- return addr;
-}
-
static void setup_crash_devices_work_queue(struct work_struct *work)
{
struct controlvm_message local_crash_bus_msg;
@@ -1739,32 +1732,26 @@ schedule_out:
static int visorchipset_init(struct acpi_device *acpi_device)
{
int err = -ENODEV;
- u64 addr;
struct visorchannel *controlvm_channel;
chipset_dev = kzalloc(sizeof(*chipset_dev), GFP_KERNEL);
if (!chipset_dev)
goto error;
- addr = controlvm_get_channel_address();
- if (!addr)
- 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;
- controlvm_channel = visorchannel_create_with_lock(addr, 0, GFP_KERNEL,
- &visor_controlvm_channel_guid);
- if (!controlvm_channel)
- goto error_free_chipset_dev;
-
- chipset_dev->controlvm_channel = controlvm_channel;
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),
&visor_controlvm_channel_guid,
"controlvm",