All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Kershner <david.kershner@unisys.com>
To: gregkh@linuxfoundation.org,
	driverdev-devel@linuxdriverproject.org,
	sparmaintainer@unisys.com, jes.sorensen@gmail.com
Subject: [PATCH 12/28] staging: unisys: visorbus: Consolidate controlvm channel creation.
Date: Wed, 30 Aug 2017 13:36:19 -0400	[thread overview]
Message-ID: <a2a07a7681d62e0b06d3b340aad020d7bde1e823.1504109643.git-series.david.kershner@unisys.com> (raw)
In-Reply-To: <cover.7bb5ed2411c582ab1e54255b493f8455545061de.1504109643.git-series.david.kershner@unisys.com>

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>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 47 ++++++-------------
 1 file changed, 17 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index c7b4599..dca936b 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1332,34 +1332,27 @@ static int unisys_vmcall(unsigned long tuple, unsigned long param)
 	}
 }
 
-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 @@ static void controlvm_periodic_work(struct work_struct *work)
 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",
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply	other threads:[~2017-08-30 17:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
2017-08-30 17:36 ` [PATCH 01/28] staging: unisys: use the kernel min define David Kershner
2017-08-30 17:36 ` [PATCH 02/28] staging: unisys: visorbus: visorchipset.c: Fix bug in parser_init_byte_stream David Kershner
2017-08-30 17:36 ` [PATCH 03/28] staging: unisys: visorbus: visorbus_main.c: Fix return values for checks in visorbus_register_visor_driver David Kershner
2017-08-30 17:36 ` [PATCH 04/28] staging: unisys: visornic: Fix up existing function comments David Kershner
2017-08-30 17:36 ` [PATCH 05/28] staging: unisys: visornic: Fix miscellaneous block comment format issues David Kershner
2017-08-30 17:36 ` [PATCH 06/28] staging: unisys: visorbus: Clean up vmcall address function David Kershner
2017-08-30 17:36 ` [PATCH 07/28] staging: unisys: visorbus: Fix parameter alignment David Kershner
2017-08-30 17:36 ` [PATCH 08/28] staging: unisys: visorbus: Convert macros to functions David Kershner
2017-08-30 17:36 ` [PATCH 09/28] staging: unisys: visorbus: Use __func__ instead of name David Kershner
2017-08-30 17:36 ` [PATCH 10/28] staging: unisys: Don't check for null before getting driver device David Kershner
2017-08-30 17:36 ` [PATCH 11/28] staging: unisys: include: Add comment next to mutex David Kershner
2017-08-30 17:36 ` David Kershner [this message]
2017-08-30 17:36 ` [PATCH 13/28] staging: unisys: visorbus: Remove useless comment David Kershner
2017-08-30 17:36 ` [PATCH 14/28] staging: unisys: visorbus: Remove useless initialization David Kershner
2017-08-30 17:36 ` [PATCH 15/28] staging: unisys: visorbus: Remove check for valid parm_addr David Kershner
2017-08-30 17:36 ` [PATCH 16/28] staging: unisys: visorbus: Split else if blocks into multiple if David Kershner
2017-08-30 17:36 ` [PATCH 17/28] staging: unisys: Change data to point to visor_controlvm_parameters_header David Kershner
2017-08-30 17:36 ` [PATCH 18/28] staging: unisys: visorbus: Remove useless else clause in visorutil_spar_detect David Kershner
2017-08-30 17:36 ` [PATCH 19/28] staging: unisys: visorbus: remove uneeded initializations David Kershner
2017-08-30 17:36 ` [PATCH 20/28] staging: unisys: visorbus: Move parser functions location in file David Kershner
2017-08-30 17:36 ` [PATCH 21/28] staging: unisys: visorchipset: Shorten parser_init_byte_stream David Kershner
2017-08-30 17:36 ` [PATCH 22/28] staging: unisys: visorbus: use all 80 characters for multi-line messages David Kershner
2017-08-30 17:36 ` [PATCH 23/28] staging: unisys: visornic: Remove unnecessary return values David Kershner
2017-08-30 17:36 ` [PATCH 24/28] staging: unisys: Use size of channel defined in the channel David Kershner
2017-08-30 17:36 ` [PATCH 25/28] staging: unisys: visorbus: just check for GUID David Kershner
2017-08-30 17:36 ` [PATCH 26/28] staging: unisys: visorbus: Fix up GUID definition David Kershner
2017-08-30 17:36 ` [PATCH 27/28] staging: unisys: visorbus: remove EXPORT_SYMBOL_GPL for visor_check_channel David Kershner
2017-08-30 17:36 ` [PATCH 28/28] staging: unisys: change pr_err to dev_err in visor_check_channel David Kershner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a2a07a7681d62e0b06d3b340aad020d7bde1e823.1504109643.git-series.david.kershner@unisys.com \
    --to=david.kershner@unisys.com \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jes.sorensen@gmail.com \
    --cc=sparmaintainer@unisys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.