All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/28] staging: unisys: More updates to make the code more readable.
@ 2017-08-30 17:36 David Kershner
  2017-08-30 17:36 ` [PATCH 01/28] staging: unisys: use the kernel min define David Kershner
                   ` (27 more replies)
  0 siblings, 28 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

Checkpatch cleanups and other misc cleanups.

David Binder (3):
  staging: unisys: visornic: Fix up existing function comments.
  staging: unisys: visornic: Fix miscellaneous block comment format issues.
  staging: unisys: visornic: Remove unnecessary return values

David Kershner (21):
  staging: unisys: use the kernel min define
  staging: unisys: visorbus: Clean up vmcall address function.
  staging: unisys: visorbus: Fix parameter alignment.
  staging: unisys: visorbus: Convert macros to functions.
  staging: unisys: visorbus: Use __func__ instead of name.
  staging: unisys: Don't check for null before getting driver device.
  staging: unisys: include: Add comment next to mutex.
  staging: unisys: visorbus: Consolidate controlvm channel creation.
  staging: unisys: visorbus: Remove useless comment.
  staging: unisys: visorbus: Remove useless initialization.
  staging: unisys: visorbus: Remove check for valid parm_addr.
  staging: unisys: visorbus: Split else if blocks into multiple if.
  staging: unisys: Change data to point to visor_controlvm_parameters_header.
  staging: unisys: visorbus: Remove useless else clause in visorutil_spar_detect.
  staging: unisys: visorbus: remove uneeded initializations
  staging: unisys: visorbus: Move parser functions location in file.
  staging: unisys: visorchipset: Shorten parser_init_byte_stream.
  staging: unisys: visorbus: use all 80 characters for multi-line messages
  staging: unisys: Use size of channel defined in the channel.
  staging: unisys: visorbus: just check for GUID
  staging: unisys: visorbus: Fix up GUID definition

Sameer Wadgaonkar (4):
  staging: unisys: visorbus: visorchipset.c: Fix bug in parser_init_byte_stream.
  staging: unisys: visorbus: visorbus_main.c: Fix return values for checks in visorbus_register_visor_driver.
  staging: unisys: visorbus: remove EXPORT_SYMBOL_GPL for visor_check_channel
  staging: unisys: change pr_err to dev_err in visor_check_channel

 drivers/staging/unisys/include/iochannel.h         |   3 +-
 drivers/staging/unisys/include/visorbus.h          |  16 +-
 drivers/staging/unisys/visorbus/visorbus_main.c    |  54 +-
 drivers/staging/unisys/visorbus/visorbus_private.h |  10 +-
 drivers/staging/unisys/visorbus/visorchannel.c     |  81 +--
 drivers/staging/unisys/visorbus/visorchipset.c     | 261 +++-----
 drivers/staging/unisys/visornic/visornic_main.c    | 451 ++++++--------
 7 files changed, 386 insertions(+), 490 deletions(-)

base-commit: 423a8a6eac2432a50e7ca4e4342a41ad3cf951e7
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 29+ messages in thread

* [PATCH 01/28] staging: unisys: use the kernel min define
  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 ` David Kershner
  2017-08-30 17:36 ` [PATCH 02/28] staging: unisys: visorbus: visorchipset.c: Fix bug in parser_init_byte_stream David Kershner
                   ` (26 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

The kernel already provides a min function, we should be using that
instead of creating our own MINNUM.

Reviewed-by: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/include/iochannel.h      |  3 ---
 drivers/staging/unisys/visornic/visornic_main.c |  9 ++++-----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h
index 9562947..a70760f 100644
--- a/drivers/staging/unisys/include/iochannel.h
+++ b/drivers/staging/unisys/include/iochannel.h
@@ -61,9 +61,6 @@
  * IO Partition is defined below.
  */
 
-/* Defines and enums. */
-#define MINNUM(a, b) (((a) < (b)) ? (a) : (b))
-
 /*
  * Define the two queues per data channel between iopart and ioguestparts.
  *	IOCHAN_TO_IOPART -- used by guest to 'insert' signals to iopart.
diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
index 3db4148..0c29d53 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -198,12 +198,11 @@ struct visornic_devdata {
 };
 
 /* Returns next non-zero index on success or 0 on failure (i.e. out of room). */
-static u16 add_physinfo_entries(u64 inp_pfn, u16 inp_off, u32 inp_len,
+static u16 add_physinfo_entries(u64 inp_pfn, u16 inp_off, u16 inp_len,
 				u16 index, u16 max_pi_arr_entries,
 				struct phys_info pi_arr[])
 {
-	u32 len;
-	u16 i, firstlen;
+	u16 i, len, firstlen;
 
 	firstlen = PI_PAGE_SIZE - inp_off;
 	if (inp_len <= firstlen) {
@@ -227,8 +226,8 @@ static u16 add_physinfo_entries(u64 inp_pfn, u16 inp_off, u32 inp_len,
 			pi_arr[index].pi_len = firstlen;
 		} else {
 			pi_arr[index + i].pi_off = 0;
-			pi_arr[index + i].pi_len =
-			    (u16)MINNUM(len, (u32)PI_PAGE_SIZE);
+			pi_arr[index + i].pi_len = min_t(u16, len,
+							 PI_PAGE_SIZE);
 		}
 	}
 	return index + i;
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 02/28] staging: unisys: visorbus: visorchipset.c: Fix bug in parser_init_byte_stream.
  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 ` 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
                   ` (25 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen; +Cc: Sameer Wadgaonkar

From: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>

This patch fixes a bug in the function parser_init_byte_stream()
by removing the call to parser_done from goto err_finish_ctx.
The function parser_done() decrements
chipset_dev->controlvm_payload_bytes_buffered which is not
incremented before this gets called.

Signed-off-by: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 25a30a4..e296df7 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1505,7 +1505,7 @@ static struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes,
 	return ctx;
 
 err_finish_ctx:
-	parser_done(ctx);
+	kfree(ctx);
 	return NULL;
 }
 
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 03/28] staging: unisys: visorbus: visorbus_main.c: Fix return values for checks in visorbus_register_visor_driver.
  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 ` David Kershner
  2017-08-30 17:36 ` [PATCH 04/28] staging: unisys: visornic: Fix up existing function comments David Kershner
                   ` (24 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen; +Cc: Sameer Wadgaonkar

From: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>

The error return values for the drv->probe, drv->remove, drv->pause
and drv->resume checks should be -EINVAL instead of -ENODEV.

Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index d9b0a8b..05b632e 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -969,16 +969,16 @@ int visorbus_register_visor_driver(struct visor_driver *drv)
 		return -ENODEV;
 
 	if (!drv->probe)
-		return -ENODEV;
+		return -EINVAL;
 
 	if (!drv->remove)
-		return -ENODEV;
+		return -EINVAL;
 
 	if (!drv->pause)
-		return -ENODEV;
+		return -EINVAL;
 
 	if (!drv->resume)
-		return -ENODEV;
+		return -EINVAL;
 
 	drv->driver.name = drv->name;
 	drv->driver.bus = &visorbus_type;
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 04/28] staging: unisys: visornic: Fix up existing function comments.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (2 preceding siblings ...)
  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 ` David Kershner
  2017-08-30 17:36 ` [PATCH 05/28] staging: unisys: visornic: Fix miscellaneous block comment format issues David Kershner
                   ` (23 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen; +Cc: David Binder

From: David Binder <david.binder@unisys.com>

Refactors existing static function comments to increase code readability.

Signed-off-by: David Binder <david.binder@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 417 +++++++----------
 1 file changed, 190 insertions(+), 227 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
index 0c29d53..ca7971b 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -233,17 +233,15 @@ static u16 add_physinfo_entries(u64 inp_pfn, u16 inp_off, u16 inp_len,
 	return index + i;
 }
 
-/*
- *	visor_copy_fragsinfo_from_skb(
- *	@skb_in: skbuff that we are pulling the frags from
- *	@firstfraglen: length of first fragment in skb
- *	@frags_max: max len of frags array
- *	@frags: frags array filled in on output
+/* visor_copy_fragsinfo_from_skb - copy fragment list in the SKB to a phys_info
+ *				   array that the IOPART understands
+ * @skb:	  Skbuff that we are pulling the frags from.
+ * @firstfraglen: Length of first fragment in skb.
+ * @frags_max:	  Max len of frags array.
+ * @frags:	  Frags array filled in on output.
  *
- *	Copy the fragment list in the SKB to a phys_info
- *	array that the IOPART understands.
- *	Return value indicates number of entries filled in frags
- *	Negative values indicate an error.
+ * Return: Positive integer indicating number of entries filled in frags on
+ *         success, negative integer on error.
  */
 static int visor_copy_fragsinfo_from_skb(struct sk_buff *skb,
 					 unsigned int firstfraglen,
@@ -341,14 +339,11 @@ static const struct file_operations debugfs_enable_ints_fops = {
 	.write = enable_ints_write,
 };
 
-/*
- *	visornic_serverdown_complete - IOPART went down, pause device
- *	@work: Work queue it was scheduled on
+/* visornic_serverdown_complete - pause device following IOPART going down
+ * @devdata: Device managed by IOPART.
  *
- *	The IO partition has gone down and we need to do some cleanup
- *	for when it comes back. Treat the IO partition as the link
- *	being down.
- *	Returns void.
+ * The IO partition has gone down, and we need to do some cleanup for when it
+ * comes back. Treat the IO partition as the link being down.
  */
 static void visornic_serverdown_complete(struct visornic_devdata *devdata)
 {
@@ -373,13 +368,14 @@ static void visornic_serverdown_complete(struct visornic_devdata *devdata)
 	devdata->server_down_complete_func = NULL;
 }
 
-/*
- *	visornic_serverdown - Command has notified us that IOPART is down
- *	@devdata: device that is being managed by IOPART
+/* visornic_serverdown - Command has notified us that IOPART is down
+ * @devdata:	   Device managed by IOPART.
+ * @complete_func: Function to call when finished.
+ *
+ * Schedule the work needed to handle the server down request. Make sure we
+ * haven't already handled the server change state event.
  *
- *	Schedule the work needed to handle the server down request. Make
- *	sure we haven't already handled the server change state event.
- *	Returns 0 if we scheduled the work, -EINVAL on error.
+ * Return: 0 if we scheduled the work, negative integer on error.
  */
 static int visornic_serverdown(struct visornic_devdata *devdata,
 			       visorbus_state_complete_func complete_func)
@@ -419,13 +415,13 @@ static int visornic_serverdown(struct visornic_devdata *devdata,
 	return err;
 }
 
-/*
- *	alloc_rcv_buf	- alloc rcv buffer to be given to the IO Partition.
- *	@netdev: network adapter the rcv bufs are attached too.
+/* alloc_rcv_buf - alloc rcv buffer to be given to the IO Partition
+ * @netdev: Network adapter the rcv bufs are attached too.
+ *
+ * Create an sk_buff (rcv_buf) that will be passed to the IO Partition
+ * so that it can write rcv data into our memory space.
  *
- *	Create an sk_buff (rcv_buf) that will be passed to the IO Partition
- *	so that it can write rcv data into our memory space.
- *	Return pointer to sk_buff
+ * Return: Pointer to sk_buff.
  */
 static struct sk_buff *alloc_rcv_buf(struct net_device *netdev)
 {
@@ -449,14 +445,12 @@ static struct sk_buff *alloc_rcv_buf(struct net_device *netdev)
 	return skb;
 }
 
-/*
- *	post_skb	- post a skb to the IO Partition.
- *	@cmdrsp: cmdrsp packet to be send to the IO Partition
- *	@devdata: visornic_devdata to post the skb too
- *	@skb: skb to give to the IO partition
+/* post_skb - post a skb to the IO Partition
+ * @cmdrsp:  Cmdrsp packet to be send to the IO Partition.
+ * @devdata: visornic_devdata to post the skb to.
+ * @skb:     Skb to give to the IO partition.
  *
- *	Send the skb to the IO Partition.
- *	Returns 0 or error
+ * Return: 0 on success, negative integer on error.
  */
 static int post_skb(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata,
 		    struct sk_buff *skb)
@@ -488,15 +482,14 @@ static int post_skb(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata,
 	return 0;
 }
 
-/*
- *	send_enbdis	- send NET_RCV_ENBDIS to IO Partition
- *	@netdev: netdevice we are enable/disable, used as context
- *		 return value
- *	@state: enable = 1/disable = 0
- *	@devdata: visornic device we are enabling/disabling
+/* send_enbdis - Send NET_RCV_ENBDIS to IO Partition
+ * @netdev:  Netdevice we are enabling/disabling, used as context return value.
+ * @state:   Enable = 1/disable = 0.
+ * @devdata: Visornic device we are enabling/disabling.
+ *
+ * Send the enable/disable message to the IO Partition.
  *
- *	Send the enable/disable message to the IO Partition.
- *	Returns 0 or error
+ * Return: 0 on success, negative integer on error.
  */
 static int send_enbdis(struct net_device *netdev, int state,
 		       struct visornic_devdata *devdata)
@@ -516,15 +509,14 @@ static int send_enbdis(struct net_device *netdev, int state,
 	return 0;
 }
 
-/*
- *	visornic_disable_with_timeout - Disable network adapter
- *	@netdev: netdevice to disable
- *	@timeout: timeout to wait for disable
+/* visornic_disable_with_timeout - disable network adapter
+ * @netdev:  netdevice to disable.
+ * @timeout: Timeout to wait for disable.
+ *
+ * Disable the network adapter and inform the IO Partition that we are disabled.
+ * Reclaim memory from rcv bufs.
  *
- *	Disable the network adapter and inform the IO Partition that we
- *	are disabled, reclaim memory from rcv bufs.
- *	Returns 0 on success, negative for failure of IO Partition
- *	responding.
+ * Return: 0 on success, negative integer on failure of IO Partition responding.
  */
 static int visornic_disable_with_timeout(struct net_device *netdev,
 					 const int timeout)
@@ -606,13 +598,13 @@ static int visornic_disable_with_timeout(struct net_device *netdev,
 	return 0;
 }
 
-/*
- *	init_rcv_bufs  -- initialize receive bufs and send them to the IO Part
- *	@netdev: struct netdevice
- *	@devdata: visornic_devdata
+/* init_rcv_bufs - initialize receive buffs and send them to the IO Partition
+ * @netdev:  struct netdevice.
+ * @devdata: visornic_devdata.
+ *
+ * Allocate rcv buffers and post them to the IO Partition.
  *
- *	Allocate rcv buffers and post them to the IO Partition.
- *	Return 0 for success, and negative for failure.
+ * Return: 0 on success, negative integer on failure.
  */
 static int init_rcv_bufs(struct net_device *netdev,
 			 struct visornic_devdata *devdata)
@@ -672,14 +664,14 @@ static int init_rcv_bufs(struct net_device *netdev,
 	return 0;
 }
 
-/*
- *	visornic_enable_with_timeout	- send enable to IO Part
- *	@netdev: struct net_device
- *	@timeout: Time to wait for the ACK from the enable
+/* visornic_enable_with_timeout	- send enable to IO Partition
+ * @netdev:  struct net_device.
+ * @timeout: Time to wait for the ACK from the enable.
  *
- *	Sends enable to IOVM, inits, and posts receive buffers to IOVM
- *	timeout is defined in msecs (timeout of 0 specifies infinite wait)
- *	Return 0 for success, negative for failure.
+ * Sends enable to IOVM and inits, and posts receive buffers to IOVM. Timeout is
+ * defined in msecs (timeout of 0 specifies infinite wait).
+ *
+ * Return: 0 on success, negative integer on failure.
  */
 static int visornic_enable_with_timeout(struct net_device *netdev,
 					const int timeout)
@@ -746,13 +738,12 @@ static int visornic_enable_with_timeout(struct net_device *netdev,
 	return 0;
 }
 
-/*
- *	visornic_timeout_reset	- handle xmit timeout resets
- *	@work	work item that scheduled the work
+/* visornic_timeout_reset - handle xmit timeout resets
+ * @work: Work item that scheduled the work.
  *
- *	Transmit Timeouts are typically handled by resetting the
- *	device for our virtual NIC we will send a Disable and Enable
- *	to the IOVM. If it doesn't respond we will trigger a serverdown.
+ * Transmit timeouts are typically handled by resetting the device for our
+ * virtual NIC; we will send a disable and enable to the IOVM. If it doesn't
+ * respond, we will trigger a serverdown.
  */
 static void visornic_timeout_reset(struct work_struct *work)
 {
@@ -788,12 +779,12 @@ static void visornic_timeout_reset(struct work_struct *work)
 	rtnl_unlock();
 }
 
-/*
- *	visornic_open - Enable the visornic device and mark the queue started
- *	@netdev: netdevice to start
+/* visornic_open - enable the visornic device and mark the queue started
+ * @netdev: netdevice to start.
+ *
+ * Enable the device and start the transmit queue.
  *
- *      Enable the device and start the transmit queue.
- *      Return 0 for success
+ * Return: 0 on success.
  */
 static int visornic_open(struct net_device *netdev)
 {
@@ -801,12 +792,12 @@ static int visornic_open(struct net_device *netdev)
 	return 0;
 }
 
-/*
- *	visornic_close - Disables the visornic device and stops the queues
- *	@netdev: netdevice to start
+/* visornic_close - disables the visornic device and stops the queues
+ * @netdev: netdevice to stop.
+ *
+ * Disable the device and stop the transmit queue.
  *
- *      Disable the device and stop the transmit queue.
- *      Return 0 for success
+ * Return 0 on success.
  */
 static int visornic_close(struct net_device *netdev)
 {
@@ -814,11 +805,10 @@ static int visornic_close(struct net_device *netdev)
 	return 0;
 }
 
-/*
- *	devdata_xmits_outstanding - compute outstanding xmits
- *	@devdata: visornic_devdata for device
+/* devdata_xmits_outstanding - compute outstanding xmits
+ * @devdata: visornic_devdata for device
  *
- *	Return value is the number of outstanding xmits.
+ * Return: Long integer representing the number of outstanding xmits.
  */
 static unsigned long devdata_xmits_outstanding(struct visornic_devdata *devdata)
 {
@@ -829,14 +819,13 @@ static unsigned long devdata_xmits_outstanding(struct visornic_devdata *devdata)
 		+ devdata->chstat.sent_xmit + 1);
 }
 
-/*
- *	vnic_hit_high_watermark
- *	@devdata: indicates visornic device we are checking
- *	@high_watermark: max num of unacked xmits we will tolerate,
- *                       before we will start throttling
+/* vnic_hit_high_watermark
+ * @devdata:	    Indicates visornic device we are checking.
+ * @high_watermark: Max num of unacked xmits we will tolerate before we will
+ *		    start throttling.
  *
- *      Returns true iff the number of unacked xmits sent to
- *      the IO partition is >= high_watermark.
+ * Return: True iff the number of unacked xmits sent to the IO Partition is >=
+ *	   high_watermark. False otherwise.
  */
 static bool vnic_hit_high_watermark(struct visornic_devdata *devdata,
 				    ulong high_watermark)
@@ -844,15 +833,13 @@ static bool vnic_hit_high_watermark(struct visornic_devdata *devdata,
 	return (devdata_xmits_outstanding(devdata) >= high_watermark);
 }
 
-/*
- *	vnic_hit_low_watermark
- *	@devdata: indicates visornic device we are checking
- *	@low_watermark: we will wait until the num of unacked xmits
- *                      drops to this value or lower before we start
- *                      transmitting again
+/* vnic_hit_low_watermark
+ * @devdata:	   Indicates visornic device we are checking.
+ * @low_watermark: We will wait until the num of unacked xmits drops to this
+ *		   value or lower before we start transmitting again.
  *
- *      Returns true iff the number of unacked xmits sent to
- *      the IO partition is <= low_watermark.
+ * Return: True iff the number of unacked xmits sent to the IO Partition is <=
+ *	   low_watermark.
  */
 static bool vnic_hit_low_watermark(struct visornic_devdata *devdata,
 				   ulong low_watermark)
@@ -860,17 +847,16 @@ static bool vnic_hit_low_watermark(struct visornic_devdata *devdata,
 	return (devdata_xmits_outstanding(devdata) <= low_watermark);
 }
 
-/*
- *	visornic_xmit - send a packet to the IO Partition
- *	@skb: Packet to be sent
- *	@netdev: net device the packet is being sent from
+/* visornic_xmit - send a packet to the IO Partition
+ * @skb:    Packet to be sent.
+ * @netdev: Net device the packet is being sent from.
  *
- *	Convert the skb to a cmdrsp so the IO Partition can understand it.
- *	Send the XMIT command to the IO Partition for processing. This
- *	function is protected from concurrent calls by a spinlock xmit_lock
- *	in the net_device struct, but as soon as the function returns it
- *	can be called again.
- *	Returns NETDEV_TX_OK.
+ * Convert the skb to a cmdrsp so the IO Partition can understand it, and send
+ * the XMIT command to the IO Partition for processing. This function is
+ * protected from concurrent calls by a spinlock xmit_lock in the net_device
+ * struct. As soon as the function returns, it can be called again.
+ *
+ * Return: NETDEV_TX_OK.
  */
 static int visornic_xmit(struct sk_buff *skb, struct net_device *netdev)
 {
@@ -1033,11 +1019,10 @@ static int visornic_xmit(struct sk_buff *skb, struct net_device *netdev)
 	return NETDEV_TX_OK;
 }
 
-/*
- *	visornic_get_stats - returns net_stats of the visornic device
- *	@netdev: netdevice
+/* visornic_get_stats - returns net_stats of the visornic device
+ * @netdev: netdevice.
  *
- *	Returns the net_device_stats for the device
+ * Return: Pointer to the net_device_stats struct for the device.
  */
 static struct net_device_stats *visornic_get_stats(struct net_device *netdev)
 {
@@ -1046,28 +1031,25 @@ static struct net_device_stats *visornic_get_stats(struct net_device *netdev)
 	return &devdata->net_stats;
 }
 
-/*
- *	visornic_change_mtu - changes mtu of device.
- *	@netdev: netdevice
- *	@new_mtu: value of new mtu
+/* visornic_change_mtu - changes mtu of device
+ * @netdev: netdevice.
+ * @new_mtu: Value of new mtu.
  *
- *	MTU cannot be changed by system, must be changed via
- *	CONTROLVM message. All vnics and pnics in a switch have
- *	to have the same MTU for everything to work.
- *	Currently not supported.
- *	Returns EINVAL
+ * The device's MTU cannot be changed by system; it must be changed via a
+ * CONTROLVM message. All vnics and pnics in a switch have to have the same MTU
+ * for everything to work. Currently not supported.
+ *
+ * Return: -EINVAL.
  */
 static int visornic_change_mtu(struct net_device *netdev, int new_mtu)
 {
 	return -EINVAL;
 }
 
-/*
- *	visornic_set_multi - changes mtu of device.
- *	@netdev: netdevice
+/* visornic_set_multi - set visornic device flags
+ * @netdev: netdevice.
  *
- *	Only flag we support currently is IFF_PROMISC
- *	Returns void
+ * The only flag we currently support is IFF_PROMISC.
  */
 static void visornic_set_multi(struct net_device *netdev)
 {
@@ -1101,13 +1083,11 @@ static void visornic_set_multi(struct net_device *netdev)
 	devdata->old_flags = netdev->flags;
 }
 
-/*
- *	visornic_xmit_timeout - request to timeout the xmit
- *	@netdev
+/* visornic_xmit_timeout - request to timeout the xmit
+ * @netdev: netdevice.
  *
- *	Queue the work and return. Make sure we have not already
- *	been informed the IO Partition is gone, if it is gone
- *	we will already timeout the xmits.
+ * Queue the work and return. Make sure we have not already been informed that
+ * the IO Partition is gone; if so, we will have already timed-out the xmits.
  */
 static void visornic_xmit_timeout(struct net_device *netdev)
 {
@@ -1135,16 +1115,16 @@ static void visornic_xmit_timeout(struct net_device *netdev)
 	spin_unlock_irqrestore(&devdata->priv_lock, flags);
 }
 
-/*
- *	repost_return	- repost rcv bufs that have come back
- *	@cmdrsp: io channel command struct to post
- *	@devdata: visornic devdata for the device
- *	@skb: skb
- *	@netdev: netdevice
+/* repost_return - repost rcv bufs that have come back
+ * @cmdrsp: IO channel command struct to post.
+ * @devdata: Visornic devdata for the device.
+ * @skb: Socket buffer.
+ * @netdev: netdevice.
  *
- *	Repost rcv buffers that have been returned to us when
- *	we are finished with them.
- *	Returns 0 for success, -1 for error.
+ * Repost rcv buffers that have been returned to us when we are finished
+ * with them.
+ *
+ * Return: 0 for success, negative integer on error.
  */
 static int repost_return(struct uiscmdrsp *cmdrsp,
 			 struct visornic_devdata *devdata,
@@ -1212,13 +1192,13 @@ static int repost_return(struct uiscmdrsp *cmdrsp,
 	return status;
 }
 
-/*
- *	visornic_rx - Handle receive packets coming back from IO Part
- *	@cmdrsp: Receive packet returned from IO Part
+/* visornic_rx - handle receive packets coming back from IO Partition
+ * @cmdrsp: Receive packet returned from IO Partition.
  *
- *	Got a receive packet back from the IO Part, handle it and send
- *	it up the stack.
- *	Returns 1 iff an skb was received, otherwise 0
+ * Got a receive packet back from the IO Partition; handle it and send it up
+ * the stack.
+
+ * Return: 1 iff an skb was received, otherwise 0.
  */
 static int visornic_rx(struct uiscmdrsp *cmdrsp)
 {
@@ -1416,14 +1396,13 @@ static int visornic_rx(struct uiscmdrsp *cmdrsp)
 	return 1;
 }
 
-/*
- *	devdata_initialize	- Initialize devdata structure
- *	@devdata: visornic_devdata structure to initialize
- *	#dev: visorbus_deviced it belongs to
+/* devdata_initialize - initialize devdata structure
+ * @devdata: visornic_devdata structure to initialize.
+ * @dev:     visorbus_device it belongs to.
+ *
+ * Setup initial values for the visornic, based on channel and default values.
  *
- *	Setup initial values for the visornic based on channel and default
- *	values.
- *	Returns a pointer to the devdata structure
+ * Return: A pointer to the devdata structure.
  */
 static struct visornic_devdata *devdata_initialize(
 					struct visornic_devdata *devdata,
@@ -1434,12 +1413,8 @@ static struct visornic_devdata *devdata_initialize(
 	return devdata;
 }
 
-/*
- *	devdata_release	- Frees up references in devdata
- *	@devdata: struct to clean up
- *
- *	Frees up references in devdata.
- *	Returns void
+/* devdata_release - free up references in devdata
+ * @devdata: Struct to clean up.
  */
 static void devdata_release(struct visornic_devdata *devdata)
 {
@@ -1611,12 +1586,10 @@ static const struct file_operations debugfs_info_fops = {
 	.read = info_debugfs_read,
 };
 
-/*
- *	send_rcv_posts_if_needed
- *	@devdata: visornic device
+/* send_rcv_posts_if_needed - send receive buffers to the IO Partition.
+ * @devdata: Visornic device.
  *
- *	Send receive buffers to the IO Partition.
- *	Returns void
+ * Return: 0.
  */
 static int send_rcv_posts_if_needed(struct visornic_devdata *devdata)
 {
@@ -1660,10 +1633,9 @@ static int send_rcv_posts_if_needed(struct visornic_devdata *devdata)
 	return 0;
 }
 
-/*
- *	drain_resp_queue  - drains and ignores all messages from the resp queue
- *	@cmdrsp: io channel command response message
- *	@devdata: visornic device to drain
+/* drain_resp_queue - drains and ignores all messages from the resp queue
+ * @cmdrsp:  IO channel command response message.
+ * @devdata: Visornic device to drain.
  */
 static void drain_resp_queue(struct uiscmdrsp *cmdrsp,
 			     struct visornic_devdata *devdata)
@@ -1674,14 +1646,14 @@ static void drain_resp_queue(struct uiscmdrsp *cmdrsp,
 		;
 }
 
-/*
- *	service_resp_queue	- drains the response queue
- *	@cmdrsp: io channel command response message
- *	@devdata: visornic device to drain
+/* service_resp_queue - drain the response queue
+ * @cmdrsp:  IO channel command response message.
+ * @devdata: Visornic device to drain.
+ * @rx_work_done:
+ * @budget:
  *
- *	Drain the response queue of any responses from the IO partition.
- *	Process the responses as we get them.
- *	Returns when response queue is empty or when the thread stops.
+ * Drain the response queue of any responses from the IO Partition. Process the
+ * responses as we get them.
  */
 static void service_resp_queue(struct uiscmdrsp *cmdrsp,
 			       struct visornic_devdata *devdata,
@@ -1796,13 +1768,11 @@ static int visornic_poll(struct napi_struct *napi, int budget)
 	return rx_count;
 }
 
-/*
- *	poll_for_irq	- Checks the status of the response queue.
- *	@v: void pointer to the visronic devdata
+/* poll_for_irq	- checks the status of the response queue
+ * @v: Void pointer to the visronic devdata struct.
  *
- *	Main function of the vnic_incoming thread. Periodically check the
- *	response queue and drain it if needed.
- *	Returns when thread has stopped.
+ * Main function of the vnic_incoming thread. Periodically check the response
+ * queue and drain it if needed.
  */
 static void poll_for_irq(unsigned long v)
 {
@@ -1818,13 +1788,13 @@ static void poll_for_irq(unsigned long v)
 	mod_timer(&devdata->irq_poll_timer, msecs_to_jiffies(2));
 }
 
-/*
- *	visornic_probe	- probe function for visornic devices
- *	@dev: The visor device discovered
+/* visornic_probe - probe function for visornic devices
+ * @dev: The visor device discovered.
+ *
+ * Called when visorbus discovers a visornic device on its bus. It creates a new
+ * visornic ethernet adapter.
  *
- *	Called when visorbus discovers a visornic device on its
- *	bus. It creates a new visornic ethernet adapter.
- *	Returns 0 or negative for error.
+ * Return: 0 on success, or negative integer on error.
  */
 static int visornic_probe(struct visor_device *dev)
 {
@@ -2013,12 +1983,10 @@ static int visornic_probe(struct visor_device *dev)
 	return err;
 }
 
-/*
- *	host_side_disappeared	- IO part is gone.
- *	@devdata: device object
+/* host_side_disappeared - IO Partition is gone
+ * @devdata: Device object.
  *
- *	IO partition servicing this device is gone, do cleanup
- *	Returns void.
+ * IO partition servicing this device is gone; do cleanup.
  */
 static void host_side_disappeared(struct visornic_devdata *devdata)
 {
@@ -2030,12 +1998,10 @@ static void host_side_disappeared(struct visornic_devdata *devdata)
 	spin_unlock_irqrestore(&devdata->priv_lock, flags);
 }
 
-/*
- *	visornic_remove		- Called when visornic dev goes away
- *	@dev: visornic device that is being removed
+/* visornic_remove - called when visornic dev goes away
+ * @dev: Visornic device that is being removed.
  *
- *	Called when DEVICE_DESTROY gets called to remove device.
- *	Returns void
+ * Called when DEVICE_DESTROY gets called to remove device.
  */
 static void visornic_remove(struct visor_device *dev)
 {
@@ -2077,18 +2043,17 @@ static void visornic_remove(struct visor_device *dev)
 	free_netdev(netdev);
 }
 
-/*
- *	visornic_pause		- Called when IO Part disappears
- *	@dev: visornic device that is being serviced
- *	@complete_func: call when finished.
+/* visornic_pause - called when IO Part disappears
+ * @dev:	   Visornic device that is being serviced.
+ * @complete_func: Call when finished.
  *
- *	Called when the IO Partition has gone down. Need to free
- *	up resources and wait for IO partition to come back. Mark
- *	link as down and don't attempt any DMA. When we have freed
- *	memory call the complete_func so that Command knows we are
- *	done. If we don't call complete_func, IO part will never
- *	come back.
- *	Returns 0 for success.
+ * Called when the IO Partition has gone down. Need to free up resources and
+ * wait for IO partition to come back. Mark link as down and don't attempt any
+ * DMA. When we have freed memory, call the complete_func so that Command knows
+ * we are done. If we don't call complete_func, the IO Partition will never
+ * come back.
+ *
+ * Return: 0 on success.
  */
 static int visornic_pause(struct visor_device *dev,
 			  visorbus_state_complete_func complete_func)
@@ -2099,15 +2064,14 @@ static int visornic_pause(struct visor_device *dev,
 	return 0;
 }
 
-/*
- *	visornic_resume		- Called when IO part has recovered
- *	@dev: visornic device that is being serviced
- *	@compelte_func: call when finished
+/* visornic_resume - called when IO Partition has recovered
+ * @dev:	   Visornic device that is being serviced.
+ * @compelte_func: Call when finished.
+ *
+ * Called when the IO partition has recovered. Re-establish connection to the IO
+ * Partition and set the link up. Okay to do DMA again.
  *
- *	Called when the IO partition has recovered. Reestablish
- *	connection to the IO part and set the link up. Okay to do
- *	DMA again.
- *	Returns 0 for success.
+ * Returns 0 for success, negative integer on error.
  */
 static int visornic_resume(struct visor_device *dev,
 			   visorbus_state_complete_func complete_func)
@@ -2169,12 +2133,12 @@ static struct visor_driver visornic_driver = {
 	.channel_interrupt = NULL,
 };
 
-/*
- *	visornic_init	- Init function
+/* visornic_init - init function
+ *
+ * Init function for the visornic driver. Do initial driver setup and wait
+ * for devices.
  *
- *	Init function for the visornic driver. Do initial driver setup
- *	and wait for devices.
- *	Returns 0 for success, negative for error.
+ * Return: 0 on success, negative integer on error.
  */
 static int visornic_init(void)
 {
@@ -2205,10 +2169,9 @@ static int visornic_init(void)
 	return err;
 }
 
-/*
- *	visornic_cleanup	- driver exit routine
+/* visornic_cleanup - driver exit routine
  *
- *	Unregister driver from the bus and free up memory.
+ * Unregister driver from the bus and free up memory.
  */
 static void visornic_cleanup(void)
 {
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 05/28] staging: unisys: visornic: Fix miscellaneous block comment format issues.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (3 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 04/28] staging: unisys: visornic: Fix up existing function comments David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 06/28] staging: unisys: visorbus: Clean up vmcall address function David Kershner
                   ` (22 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen; +Cc: David Binder

From: David Binder <david.binder@unisys.com>

Fixes miscellaneous formatting issues with several block comments
throughout visornic_main.c.

Signed-off-by: David Binder <david.binder@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
index ca7971b..0ca8666 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -52,8 +52,7 @@ static struct visor_channeltype_descriptor visornic_channel_types[] = {
 	{}
 };
 MODULE_DEVICE_TABLE(visorbus, visornic_channel_types);
-/*
- * FIXME XXX: This next line of code must be fixed and removed before
+/* FIXME XXX: This next line of code must be fixed and removed before
  * acceptance into the 'normal' part of the kernel.  It is only here as a place
  * holder to get module autoloading functionality working for visorbus.  Code
  * must be added to scripts/mode/file2alias.c, etc., to get this working
@@ -76,7 +75,6 @@ struct chanstat {
 };
 
 /* struct visornic_devdata
- *
  * @enabled:                        0 disabled 1 enabled to receive.
  * @enab_dis_acked:                 NET_RCV_ENABLE/DISABLE acked by IOPART.
  * @struct *dev:
@@ -1387,8 +1385,7 @@ static int visornic_rx(struct uiscmdrsp *cmdrsp)
 	 */
 
 	skb = NULL;
-	/*
-	 * whether the packet got dropped or handled, the skb is freed by
+	/* whether the packet got dropped or handled, the skb is freed by
 	 * kernel code, so we shouldn't free it. but we should repost a
 	 * new rcv buffer.
 	 */
@@ -1863,9 +1860,10 @@ static int visornic_probe(struct visor_device *dev)
 		goto cleanup_netdev;
 	}
 
-	/* set the net_xmit outstanding threshold */
-	/* always leave two slots open but you should have 3 at a minimum */
-	/* note that max_outstanding_net_xmits must be > 0 */
+	/* set the net_xmit outstanding threshold
+	 * always leave two slots open but you should have 3 at a minimum
+	 * note that max_outstanding_net_xmits must be > 0
+	 */
 	devdata->max_outstanding_net_xmits =
 		max_t(unsigned long, 3, ((devdata->num_rcv_bufs / 3) - 2));
 	devdata->upper_threshold_net_xmits =
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 06/28] staging: unisys: visorbus: Clean up vmcall address function.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (4 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 05/28] staging: unisys: visornic: Fix miscellaneous block comment format issues David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 07/28] staging: unisys: visorbus: Fix parameter alignment David Kershner
                   ` (21 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

The function vmcall address needed to be cleaned up. The structure
vmcall_controlvm_addr was not needed so it was removed and was replaced
with vmcall_io_controlvm_addr_params since it needs to be allocated on the
heap for DMA access.

With the structure removed and the fields as local variables, it helped
clean up the formatting of the function.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 27 +++++++------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index e296df7..7423c9e 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -86,12 +86,6 @@ struct vmcall_io_controlvm_addr_params {
 	u8 unused[4];
 } __packed;
 
-struct vmcall_controlvm_addr {
-	struct vmcall_io_controlvm_addr_params params;
-	int err;
-	u64 physaddr;
-};
-
 struct visorchipset_device {
 	struct acpi_device *acpi_device;
 	unsigned long poll_jiffies;
@@ -109,7 +103,7 @@ struct visorchipset_device {
 	 */
 	struct controlvm_message controlvm_pending_msg;
 	bool controlvm_pending_msg_valid;
-	struct vmcall_controlvm_addr controlvm_addr;
+	struct vmcall_io_controlvm_addr_params controlvm_params;
 };
 
 static struct visorchipset_device *chipset_dev;
@@ -1341,15 +1335,16 @@ static int unisys_vmcall(unsigned long tuple, unsigned long param)
 static unsigned int issue_vmcall_io_controlvm_addr(u64 *control_addr,
 						   u32 *control_bytes)
 {
-	chipset_dev->controlvm_addr.physaddr = virt_to_phys(
-					   &chipset_dev->controlvm_addr.params);
-	chipset_dev->controlvm_addr.err = unisys_vmcall(VMCALL_CONTROLVM_ADDR,
-					  chipset_dev->controlvm_addr.physaddr);
-	if (chipset_dev->controlvm_addr.err)
-		return chipset_dev->controlvm_addr.err;
-
-	*control_addr = chipset_dev->controlvm_addr.params.address;
-	*control_bytes = chipset_dev->controlvm_addr.params.channel_bytes;
+	u64 physaddr;
+	int err;
+
+	physaddr = virt_to_phys(&chipset_dev->controlvm_params);
+	err = unisys_vmcall(VMCALL_CONTROLVM_ADDR, physaddr);
+	if (err)
+		return err;
+
+	*control_addr = chipset_dev->controlvm_params.address;
+	*control_bytes = chipset_dev->controlvm_params.channel_bytes;
 
 	return 0;
 }
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 07/28] staging: unisys: visorbus: Fix parameter alignment.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (5 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 06/28] staging: unisys: visorbus: Clean up vmcall address function David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 08/28] staging: unisys: visorbus: Convert macros to functions David Kershner
                   ` (20 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

Fixed the following checkpatch warning:
visorchannel.c:443: CHECK: Alignment should match open parenthesis

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchannel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c
index 6afc745..3969217 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -440,7 +440,7 @@ static struct visorchannel *visorchannel_create_guts(
 		goto err_destroy_channel;
 
 	channel->mapped = memremap(channel->physaddr, channel_bytes,
-			MEMREMAP_WB);
+				   MEMREMAP_WB);
 	if (!channel->mapped) {
 		release_mem_region(channel->physaddr, channel_bytes);
 		goto err_destroy_channel;
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 08/28] staging: unisys: visorbus: Convert macros to functions.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (6 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 07/28] staging: unisys: visorbus: Fix parameter alignment David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 09/28] staging: unisys: visorbus: Use __func__ instead of name David Kershner
                   ` (19 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

Several macros in visorchannel.c were doing complex arithmetic, converted
them to functions so that valid type checking could be done.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchannel.c | 25 +++++++++++--------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c
index 3969217..81e428a 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -155,17 +155,22 @@ void *visorchannel_get_header(struct visorchannel *channel)
  * Return offset of a specific SIGNAL_QUEUE_HEADER from the beginning of a
  * channel header
  */
-#define SIG_QUEUE_OFFSET(chan_hdr, q) \
-	((chan_hdr)->ch_space_offset + \
-	 ((q) * sizeof(struct signal_queue_header)))
+int sig_queue_offset(struct channel_header *chan_hdr, int q)
+{
+	return ((chan_hdr)->ch_space_offset +
+	       ((q) * sizeof(struct signal_queue_header)));
+}
 
 /*
  * Return offset of a specific queue entry (data) from the beginning of a
  * channel header
  */
-#define SIG_DATA_OFFSET(chan_hdr, q, sig_hdr, slot) \
-	(SIG_QUEUE_OFFSET(chan_hdr, q) + (sig_hdr)->sig_base_offset + \
-	 ((slot) * (sig_hdr)->signal_size))
+int sig_data_offset(struct channel_header *chan_hdr, int q,
+		    struct signal_queue_header *sig_hdr, int slot)
+{
+	return (sig_queue_offset(chan_hdr, q) + sig_hdr->sig_base_offset +
+	       (slot * sig_hdr->signal_size));
+}
 
 /*
  * Write the contents of a specific field within a SIGNAL_QUEUE_HEADER back
@@ -173,7 +178,7 @@ void *visorchannel_get_header(struct visorchannel *channel)
  */
 #define SIG_WRITE_FIELD(channel, queue, sig_hdr, FIELD) \
 	visorchannel_write(channel, \
-			   SIG_QUEUE_OFFSET(&channel->chan_hdr, queue) + \
+			   sig_queue_offset(&channel->chan_hdr, queue) + \
 			   offsetof(struct signal_queue_header, FIELD), \
 			   &((sig_hdr)->FIELD), \
 			   sizeof((sig_hdr)->FIELD))
@@ -186,7 +191,7 @@ static int sig_read_header(struct visorchannel *channel, u32 queue,
 
 	/* Read the appropriate SIGNAL_QUEUE_HEADER into local memory. */
 	return visorchannel_read(channel,
-				 SIG_QUEUE_OFFSET(&channel->chan_hdr, queue),
+				 sig_queue_offset(&channel->chan_hdr, queue),
 				 sig_hdr, sizeof(struct signal_queue_header));
 }
 
@@ -194,7 +199,7 @@ static int sig_read_data(struct visorchannel *channel, u32 queue,
 			 struct signal_queue_header *sig_hdr, u32 slot,
 			 void *data)
 {
-	int signal_data_offset = SIG_DATA_OFFSET(&channel->chan_hdr, queue,
+	int signal_data_offset = sig_data_offset(&channel->chan_hdr, queue,
 						 sig_hdr, slot);
 
 	return visorchannel_read(channel, signal_data_offset,
@@ -205,7 +210,7 @@ static int sig_write_data(struct visorchannel *channel, u32 queue,
 			  struct signal_queue_header *sig_hdr, u32 slot,
 			  void *data)
 {
-	int signal_data_offset = SIG_DATA_OFFSET(&channel->chan_hdr, queue,
+	int signal_data_offset = sig_data_offset(&channel->chan_hdr, queue,
 						 sig_hdr, slot);
 
 	return visorchannel_write(channel, signal_data_offset,
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 09/28] staging: unisys: visorbus: Use __func__ instead of name.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (7 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 08/28] staging: unisys: visorbus: Convert macros to functions David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 10/28] staging: unisys: Don't check for null before getting driver device David Kershner
                   ` (18 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

The dev_err was using the hardcoded function name, as reported by
checkpatch, it should be using __func__.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 7423c9e..c7b4599 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -744,7 +744,7 @@ static int visorbus_configure(struct controlvm_message *inmsg,
 
 err_respond:
 	dev_err(&chipset_dev->acpi_device->dev,
-		"visorbus_configure exited with err: %d\n", err);
+		"%s exited with err: %d\n", __func__, err);
 	if (inmsg->hdr.flags.response_expected == 1)
 		controlvm_responder(inmsg->hdr.id, &inmsg->hdr, err);
 	return err;
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 10/28] staging: unisys: Don't check for null before getting driver device.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (8 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 09/28] staging: unisys: visorbus: Use __func__ instead of name David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 11/28] staging: unisys: include: Add comment next to mutex David Kershner
                   ` (17 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

The macro to convert to the driver object was giving a checkpatch warning
when it ateempted to check for a null driver. It would return NULL if it
found it, but only one location was checking to see if it was NULL.

Remove the check in the MACRO and do it prior to calling the macro if
required.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/include/visorbus.h       | 3 +--
 drivers/staging/unisys/visorbus/visorbus_main.c | 8 ++++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index e97bb5f..0af5477 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -104,8 +104,7 @@ struct visor_driver {
 	struct device_driver driver;
 };
 
-#define to_visor_driver(x) ((x) ? \
-	(container_of(x, struct visor_driver, driver)) : (NULL))
+#define to_visor_driver(x) (container_of(x, struct visor_driver, driver))
 
 /**
  * struct visor_device - A device type for things "plugged" into the visorbus
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index 05b632e..0957eaa 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -1158,13 +1158,13 @@ static int visorchipset_initiate_device_pause_resume(struct visor_device *dev,
 	int err;
 	struct visor_driver *drv = NULL;
 
-	drv = to_visor_driver(dev->device.driver);
-	if (!drv)
-		return -ENODEV;
-
+	/* If no driver associated with the device nothing to pause/resume */
+	if (!dev->device.driver)
+		return 0;
 	if (dev->pausing || dev->resuming)
 		return -EBUSY;
 
+	drv = to_visor_driver(dev->device.driver);
 	if (is_pause) {
 		dev->pausing = true;
 		err = drv->pause(dev, pause_state_change_complete);
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 11/28] staging: unisys: include: Add comment next to mutex.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (9 preceding siblings ...)
  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 ` David Kershner
  2017-08-30 17:36 ` [PATCH 12/28] staging: unisys: visorbus: Consolidate controlvm channel creation David Kershner
                   ` (16 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

Checkpatch reports an error that no comment was next to the mutex lock.
Add an appropriate message for the lock.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/include/visorbus.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index 0af5477..d7fa27b 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -119,8 +119,8 @@ struct visor_driver {
  *				activity.
  * @being_removed:		Indicates that the device is being removed from
  *				the bus. Private bus driver use only.
- * @visordriver_callback_lock:	Used by the bus driver to lock when handling
- *				channel events.
+ * @visordriver_callback_lock:	Used by the bus driver to lock when adding and
+ *				removing devices.
  * @pausing:			Indicates that a change towards a paused state.
  *				is in progress. Only modified by the bus driver.
  * @resuming:			Indicates that a change towards a running state
@@ -149,7 +149,7 @@ struct visor_device {
 	struct timer_list timer;
 	bool timer_active;
 	bool being_removed;
-	struct mutex visordriver_callback_lock;
+	struct mutex visordriver_callback_lock; /* synchronize probe/remove */
 	bool pausing;
 	bool resuming;
 	u32 chipset_bus_no;
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 12/28] staging: unisys: visorbus: Consolidate controlvm channel creation.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (10 preceding siblings ...)
  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
  2017-08-30 17:36 ` [PATCH 13/28] staging: unisys: visorbus: Remove useless comment David Kershner
                   ` (15 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

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

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 13/28] staging: unisys: visorbus: Remove useless comment.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (11 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 12/28] staging: unisys: visorbus: Consolidate controlvm channel creation David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 14/28] staging: unisys: visorbus: Remove useless initialization David Kershner
                   ` (14 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

Currently setting it in the right location, so no longer not sure.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index dca936b..88cefa5 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -792,8 +792,6 @@ static int visorbus_device_create(struct controlvm_message *inmsg)
 	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);
-
-	/* not sure where the best place to set the 'parent' */
 	dev_info->device.parent = &bus_info->device;
 
 	visorchannel =
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 14/28] staging: unisys: visorbus: Remove useless initialization.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (12 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 13/28] staging: unisys: visorbus: Remove useless comment David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 15/28] staging: unisys: visorbus: Remove check for valid parm_addr David Kershner
                   ` (13 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

The variable ctx was allocated with kzalloc, so all the data inside is
zero, no need to reset it to 0.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 88cefa5..98c991b 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1477,9 +1477,6 @@ static struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes,
 
 	ctx->allocbytes = allocbytes;
 	ctx->param_bytes = bytes;
-	ctx->curr = NULL;
-	ctx->bytes_remaining = 0;
-	ctx->byte_stream = false;
 	mapping = memremap(addr, bytes, MEMREMAP_WB);
 	if (!mapping)
 		goto err_finish_ctx;
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 15/28] staging: unisys: visorbus: Remove check for valid parm_addr.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (13 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 14/28] staging: unisys: visorbus: Remove useless initialization David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 16/28] staging: unisys: visorbus: Split else if blocks into multiple if David Kershner
                   ` (12 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

The variable parm_addr will never be null, so no need to check for it.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 98c991b..e5d051f 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1523,7 +1523,7 @@ static int handle_command(struct controlvm_message inmsg, u64 channel_addr)
 	 * within our OS-controlled memory. We need to know that, because it
 	 * makes a difference in how we compute the virtual address.
 	 */
-	if (parm_addr && parm_bytes) {
+	if (parm_bytes) {
 		bool retry = false;
 
 		parser_ctx =
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 16/28] staging: unisys: visorbus: Split else if blocks into multiple if.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (14 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 15/28] staging: unisys: visorbus: Remove check for valid parm_addr David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 17/28] staging: unisys: Change data to point to visor_controlvm_parameters_header David Kershner
                   ` (11 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

Visorbus_configure had a block of "else if" clauses at the beginning of the
function. Simplify this to just being "if" clauses since each code block
ended with a goto.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index e5d051f..3a8357e 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -717,10 +717,12 @@ static int visorbus_configure(struct controlvm_message *inmsg,
 	if (!bus_info) {
 		err = -EINVAL;
 		goto err_respond;
-	} else if (bus_info->state.created == 0) {
+	}
+	if (bus_info->state.created == 0) {
 		err = -EINVAL;
 		goto err_respond;
-	} else if (bus_info->pending_msg_hdr) {
+	}
+	if (bus_info->pending_msg_hdr) {
 		err = -EIO;
 		goto err_respond;
 	}
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 17/28] staging: unisys: Change data to point to visor_controlvm_parameters_header.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (15 preceding siblings ...)
  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 ` David Kershner
  2017-08-30 17:36 ` [PATCH 18/28] staging: unisys: visorbus: Remove useless else clause in visorutil_spar_detect David Kershner
                   ` (10 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

The data field was being defined as a character array and then casted into
a visor_controlvm_parameters_header structure. This patch converts it to
just point to the visor_controlvm_parameters_header structure. The data
following the header is still behind the header_info.

Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 23 +++++++------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 3a8357e..d27e0e8 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -53,7 +53,7 @@ struct parser_context {
 	u8 *curr;
 	unsigned long bytes_remaining;
 	bool byte_stream;
-	char data[0];
+	struct visor_controlvm_parameters_header data;
 };
 
 /* VMCALL_CONTROLVM_ADDR: Used by all guests, not just IO. */
@@ -299,10 +299,7 @@ static DEVICE_ATTR_RW(remaining_steps);
 
 static const guid_t *parser_id_get(struct parser_context *ctx)
 {
-	struct visor_controlvm_parameters_header *phdr = NULL;
-
-	phdr = (struct visor_controlvm_parameters_header *)(ctx->data);
-	return &phdr->id;
+	return &ctx->data.id;
 }
 
 static void parser_done(struct parser_context *ctx)
@@ -348,12 +345,12 @@ static void *parser_name_get(struct parser_context *ctx)
 {
 	struct visor_controlvm_parameters_header *phdr = NULL;
 
-	phdr = (struct visor_controlvm_parameters_header *)(ctx->data);
+	phdr = &ctx->data;
 
 	if (phdr->name_offset + phdr->name_length > ctx->param_bytes)
 		return NULL;
 
-	ctx->curr = ctx->data + phdr->name_offset;
+	ctx->curr = (char *)&phdr + phdr->name_offset;
 	ctx->bytes_remaining = phdr->name_length;
 	return parser_string_get(ctx);
 }
@@ -1455,17 +1452,15 @@ void visorbus_device_changestate_response(struct visor_device *dev_info,
 static struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes,
 						      bool *retry)
 {
-	int allocbytes = sizeof(struct parser_context) + bytes;
+	int allocbytes;
 	struct parser_context *ctx;
 	void *mapping;
 
 	*retry = false;
 
-	/*
-	 * alloc an 0 extra byte to ensure payload is
-	 * '\0'-terminated
-	 */
-	allocbytes++;
+	/* alloc an extra byte to ensure payload is \0 terminated */
+	allocbytes = bytes + 1 + (sizeof(struct parser_context) -
+		     sizeof(struct visor_controlvm_parameters_header));
 	if ((chipset_dev->controlvm_payload_bytes_buffered + bytes)
 	    > MAX_CONTROLVM_PAYLOAD_BYTES) {
 		*retry = true;
@@ -1482,7 +1477,7 @@ static struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes,
 	mapping = memremap(addr, bytes, MEMREMAP_WB);
 	if (!mapping)
 		goto err_finish_ctx;
-	memcpy(ctx->data, mapping, bytes);
+	memcpy(&ctx->data, mapping, bytes);
 	memunmap(mapping);
 	ctx->byte_stream = true;
 	chipset_dev->controlvm_payload_bytes_buffered += ctx->param_bytes;
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 18/28] staging: unisys: visorbus: Remove useless else clause in visorutil_spar_detect.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (16 preceding siblings ...)
  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 ` David Kershner
  2017-08-30 17:36 ` [PATCH 19/28] staging: unisys: visorbus: remove uneeded initializations David Kershner
                   ` (9 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

The function visorutil_spar_detect had an if clause that returns from the
function, no need to do the rest of the code in an else clause.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index d27e0e8..a602ba6 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1830,9 +1830,8 @@ static __init int visorutil_spar_detect(void)
 		return  (ebx == UNISYS_VISOR_ID_EBX) &&
 			(ecx == UNISYS_VISOR_ID_ECX) &&
 			(edx == UNISYS_VISOR_ID_EDX);
-	} else {
-		return 0;
 	}
+	return 0;
 }
 
 static int init_unisys(void)
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 19/28] staging: unisys: visorbus: remove uneeded initializations
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (17 preceding siblings ...)
  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 ` David Kershner
  2017-08-30 17:36 ` [PATCH 20/28] staging: unisys: visorbus: Move parser functions location in file David Kershner
                   ` (8 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

Several variables were initialized when not needed. Remove the extraneous
initializations.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index a602ba6..090818f 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -312,8 +312,8 @@ static void *parser_string_get(struct parser_context *ctx)
 {
 	u8 *pscan;
 	unsigned long nscan;
-	int value_length = -1;
-	void *value = NULL;
+	int value_length;
+	void *value;
 	int i;
 
 	pscan = ctx->curr;
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 20/28] staging: unisys: visorbus: Move parser functions location in file.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (18 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 19/28] staging: unisys: visorbus: remove uneeded initializations David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 21/28] staging: unisys: visorchipset: Shorten parser_init_byte_stream David Kershner
                   ` (7 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

The parser functions were defined at the top of the file even though they
were not referenced until later in the file. This patch moves them closer
to where they are defined so they can be easily referenced.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 116 +++++++++---------
 1 file changed, 58 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 090818f..b30e3a1 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -297,64 +297,6 @@ static ssize_t remaining_steps_store(struct device *dev,
 }
 static DEVICE_ATTR_RW(remaining_steps);
 
-static const guid_t *parser_id_get(struct parser_context *ctx)
-{
-	return &ctx->data.id;
-}
-
-static void parser_done(struct parser_context *ctx)
-{
-	chipset_dev->controlvm_payload_bytes_buffered -= ctx->param_bytes;
-	kfree(ctx);
-}
-
-static void *parser_string_get(struct parser_context *ctx)
-{
-	u8 *pscan;
-	unsigned long nscan;
-	int value_length;
-	void *value;
-	int i;
-
-	pscan = ctx->curr;
-	if (!pscan)
-		return NULL;
-	nscan = ctx->bytes_remaining;
-	if (nscan == 0)
-		return NULL;
-
-	for (i = 0, value_length = -1; i < nscan; i++)
-		if (pscan[i] == '\0') {
-			value_length = i;
-			break;
-		}
-	/* '\0' was not included in the length */
-	if (value_length < 0)
-		value_length = nscan;
-
-	value = kmalloc(value_length + 1, GFP_KERNEL);
-	if (!value)
-		return NULL;
-	if (value_length > 0)
-		memcpy(value, pscan, value_length);
-	((u8 *)(value))[value_length] = '\0';
-	return value;
-}
-
-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);
-}
-
 struct visor_busdev {
 	u32 bus_no;
 	u32 dev_no;
@@ -701,6 +643,58 @@ static int visorbus_destroy(struct controlvm_message *inmsg)
 	return err;
 }
 
+static const guid_t *parser_id_get(struct parser_context *ctx)
+{
+	return &ctx->data.id;
+}
+
+static void *parser_string_get(struct parser_context *ctx)
+{
+	u8 *pscan;
+	unsigned long nscan;
+	int value_length;
+	void *value;
+	int i;
+
+	pscan = ctx->curr;
+	if (!pscan)
+		return NULL;
+	nscan = ctx->bytes_remaining;
+	if (nscan == 0)
+		return NULL;
+
+	for (i = 0, value_length = -1; i < nscan; i++)
+		if (pscan[i] == '\0') {
+			value_length = i;
+			break;
+		}
+	/* '\0' was not included in the length */
+	if (value_length < 0)
+		value_length = nscan;
+
+	value = kmalloc(value_length + 1, GFP_KERNEL);
+	if (!value)
+		return NULL;
+	if (value_length > 0)
+		memcpy(value, pscan, value_length);
+	((u8 *)(value))[value_length] = '\0';
+	return value;
+}
+
+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);
+}
+
 static int visorbus_configure(struct controlvm_message *inmsg,
 			      struct parser_context *parser_ctx)
 {
@@ -1449,6 +1443,12 @@ void visorbus_device_changestate_response(struct visor_device *dev_info,
 	dev_info->pending_msg_hdr = NULL;
 }
 
+static void parser_done(struct parser_context *ctx)
+{
+	chipset_dev->controlvm_payload_bytes_buffered -= ctx->param_bytes;
+	kfree(ctx);
+}
+
 static struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes,
 						      bool *retry)
 {
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 21/28] staging: unisys: visorchipset: Shorten parser_init_byte_stream.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (19 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 20/28] staging: unisys: visorbus: Move parser functions location in file David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 22/28] staging: unisys: visorbus: use all 80 characters for multi-line messages David Kershner
                   ` (6 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

Shorten the name of the function parser_init_byte_stream to just
parser_init_stream.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index b30e3a1..1f7c6bf 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1449,8 +1449,8 @@ static void parser_done(struct parser_context *ctx)
 	kfree(ctx);
 }
 
-static struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes,
-						      bool *retry)
+static struct parser_context *parser_init_stream(u64 addr, u32 bytes,
+						 bool *retry)
 {
 	int allocbytes;
 	struct parser_context *ctx;
@@ -1523,8 +1523,7 @@ static int handle_command(struct controlvm_message inmsg, u64 channel_addr)
 	if (parm_bytes) {
 		bool retry = false;
 
-		parser_ctx =
-		    parser_init_byte_stream(parm_addr, parm_bytes, &retry);
+		parser_ctx = parser_init_stream(parm_addr, parm_bytes, &retry);
 		if (!parser_ctx && retry)
 			return -EAGAIN;
 	}
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 22/28] staging: unisys: visorbus: use all 80 characters for multi-line messages
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (20 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 21/28] staging: unisys: visorchipset: Shorten parser_init_byte_stream David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 23/28] staging: unisys: visornic: Remove unnecessary return values David Kershner
                   ` (5 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

The file visorchipset had a bunch of comments that were not using the full
screen before they wrapped, update the comments to wrap at 80 characters
instead.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 35 ++++++++-----------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 1f7c6bf..0ea20bb 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -41,9 +41,9 @@ static const guid_t visor_controlvm_channel_guid = VISOR_CONTROLVM_CHANNEL_GUID;
 #define UNISYS_VISOR_ID_EDX 0x34367261
 
 /*
- * When the controlvm channel is idle for at least MIN_IDLE_SECONDS,
- * we switch to slow polling mode. As soon as we get a controlvm
- * message, we switch back to fast polling mode.
+ * When the controlvm channel is idle for at least MIN_IDLE_SECONDS, we switch
+ * to slow polling mode. As soon as we get a controlvm message, we switch back
+ * to fast polling mode.
  */
 #define MIN_IDLE_SECONDS 10
 
@@ -377,15 +377,15 @@ static int chipset_init(struct controlvm_message *inmsg)
 	chipset_inited = 1;
 
 	/*
-	 * Set features to indicate we support parahotplug (if Command
-	 * also supports it).
+	 * Set features to indicate we support parahotplug (if Command also
+	 * supports it).
 	 */
 	features = inmsg->cmd.init_chipset.features &
 		   VISOR_CHIPSET_FEATURE_PARA_HOTPLUG;
 
 	/*
-	 * Set the "reply" bit so Command knows this is a
-	 * features-aware driver.
+	 * Set the "reply" bit so Command knows this is a features-aware
+	 * driver.
 	 */
 	features |= VISOR_CHIPSET_FEATURE_REPLY;
 
@@ -1210,10 +1210,9 @@ static int parahotplug_process_message(struct controlvm_message *inmsg)
 	}
 
 	/*
-	 * For disable messages, add the request to the
-	 * request list before kicking off the udev script. It
-	 * won't get responded to until the script has
-	 * indicated it's done.
+	 * For disable messages, add the request to the request list before
+	 * kicking off the udev script. It won't get responded to until the
+	 * script has indicated it's done.
 	 */
 	spin_lock(&parahotplug_request_list_lock);
 	list_add_tail(&req->list, &parahotplug_request_list);
@@ -1554,8 +1553,8 @@ static int handle_command(struct controlvm_message inmsg, u64 channel_addr)
 			err = parahotplug_process_message(&inmsg);
 		} else {
 			/*
-			 * save the hdr and cmd structures for later use
-			 * when sending back the response to Command
+			 * save the hdr and cmd structures for later use when
+			 * sending back the response to Command
 			 */
 			err = visorbus_device_changestate(&inmsg);
 			break;
@@ -1664,9 +1663,8 @@ static void controlvm_periodic_work(struct work_struct *work)
 
 	if (chipset_dev->controlvm_pending_msg_valid) {
 		/*
-		 * we throttled processing of a prior
-		 * msg, so try to process it again
-		 * rather than reading a new one
+		 * we throttled processing of a prior msg, so try to process
+		 * it again rather than reading a new one
 		 */
 		inmsg = chipset_dev->controlvm_pending_msg;
 		chipset_dev->controlvm_pending_msg_valid = false;
@@ -1701,9 +1699,8 @@ static void controlvm_periodic_work(struct work_struct *work)
 	if (time_after(jiffies, chipset_dev->most_recent_message_jiffies +
 				(HZ * MIN_IDLE_SECONDS))) {
 		/*
-		 * it's been longer than MIN_IDLE_SECONDS since we
-		 * processed our last controlvm message; slow down the
-		 * polling
+		 * it's been longer than MIN_IDLE_SECONDS since we processed
+		 * our last controlvm message; slow down the polling
 		 */
 		if (chipset_dev->poll_jiffies !=
 					      POLLJIFFIES_CONTROLVMCHANNEL_SLOW)
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 23/28] staging: unisys: visornic: Remove unnecessary return values
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (21 preceding siblings ...)
  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 ` David Kershner
  2017-08-30 17:36 ` [PATCH 24/28] staging: unisys: Use size of channel defined in the channel David Kershner
                   ` (4 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen; +Cc: David Binder

From: David Binder <david.binder@unisys.com>

Removes unnecessary return value in send_rcv_posts_if_needed(), since
NAPI polling functions do not return errors.

Signed-off-by: David Binder <david.binder@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
index 0ca8666..dc390ea 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -1585,10 +1585,8 @@ static const struct file_operations debugfs_info_fops = {
 
 /* send_rcv_posts_if_needed - send receive buffers to the IO Partition.
  * @devdata: Visornic device.
- *
- * Return: 0.
  */
-static int send_rcv_posts_if_needed(struct visornic_devdata *devdata)
+static void send_rcv_posts_if_needed(struct visornic_devdata *devdata)
 {
 	int i;
 	struct net_device *netdev;
@@ -1598,7 +1596,7 @@ static int send_rcv_posts_if_needed(struct visornic_devdata *devdata)
 
 	/* don't do this until vnic is marked ready */
 	if (!(devdata->enabled && devdata->enab_dis_acked))
-		return 0;
+		return;
 
 	netdev = devdata->netdev;
 	rcv_bufs_allocated = 0;
@@ -1627,7 +1625,6 @@ static int send_rcv_posts_if_needed(struct visornic_devdata *devdata)
 		}
 	}
 	devdata->num_rcv_bufs_could_not_alloc -= rcv_bufs_allocated;
-	return 0;
 }
 
 /* drain_resp_queue - drains and ignores all messages from the resp queue
@@ -1750,12 +1747,8 @@ static int visornic_poll(struct napi_struct *napi, int budget)
 							struct visornic_devdata,
 							napi);
 	int rx_count = 0;
-	int err;
-
-	err = send_rcv_posts_if_needed(devdata);
-	if (err)
-		return err;
 
+	send_rcv_posts_if_needed(devdata);
 	service_resp_queue(devdata->cmdrsp, devdata, &rx_count, budget);
 
 	/* If there aren't any more packets to receive stop the poll */
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 24/28] staging: unisys: Use size of channel defined in the channel.
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (22 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 23/28] staging: unisys: visornic: Remove unnecessary return values David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 25/28] staging: unisys: visorbus: just check for GUID David Kershner
                   ` (3 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

The size of the channel should be pulled from the channel header, not
from the message. All channels must be at least the size of the
channel_header.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_private.h | 10 +--
 drivers/staging/unisys/visorbus/visorchannel.c     | 56 ++++-----------
 drivers/staging/unisys/visorbus/visorchipset.c     |  6 +--
 3 files changed, 22 insertions(+), 50 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h
index 8651c87..e878d65 100644
--- a/drivers/staging/unisys/visorbus/visorbus_private.h
+++ b/drivers/staging/unisys/visorbus/visorbus_private.h
@@ -38,12 +38,10 @@ int visorbus_init(void);
 void visorbus_exit(void);
 
 /* visorchannel access functions */
-struct visorchannel *visorchannel_create(u64 physaddr,
-					 unsigned long channel_bytes,
-					 gfp_t gfp, const guid_t *guid);
-struct visorchannel *visorchannel_create_with_lock(u64 physaddr,
-						   unsigned long channel_bytes,
-						   gfp_t gfp, const guid_t *guid);
+struct visorchannel *visorchannel_create(u64 physaddr, gfp_t gfp,
+					 const guid_t *guid);
+struct visorchannel *visorchannel_create_with_lock(u64 physaddr, gfp_t gfp,
+						   const guid_t *guid);
 void visorchannel_destroy(struct visorchannel *channel);
 int visorchannel_read(struct visorchannel *channel, ulong offset,
 		      void *dest, ulong nbytes);
diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c
index 81e428a..49d1f5f 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -363,17 +363,8 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue,
  *                              for a data area in memory, but does NOT modify
  *                              this data area
  * @physaddr:      physical address of start of channel
- * @channel_bytes: size of the channel in bytes; this may 0 if the channel has
- *                 already been initialized in memory (which is true for all
- *                 channels provided to guest environments by the s-Par
- *                 back-end), in which case the actual channel size will be
- *                 read from the channel header in memory
  * @gfp:           gfp_t to use when allocating memory for the data struct
- * @guid:          GUID that identifies channel type; this may 0 if the channel
- *                 has already been initialized in memory (which is true for all
- *                 channels provided to guest environments by the s-Par
- *                 back-end), in which case the actual channel guid will be
- *                 read from the channel header in memory
+ * @guid:          GUID that identifies channel type;
  * @needs_lock:    must specify true if you have multiple threads of execution
  *                 that will be calling visorchannel methods of this
  *                 visorchannel at the same time
@@ -381,11 +372,9 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue,
  * Return: pointer to visorchannel that was created if successful,
  *         otherwise NULL
  */
-static struct visorchannel *visorchannel_create_guts(
-						u64 physaddr,
-						unsigned long channel_bytes,
-					        gfp_t gfp, const guid_t *guid,
-						bool needs_lock)
+static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp,
+						     const guid_t *guid,
+						     bool needs_lock)
 {
 	struct visorchannel *channel;
 	int err;
@@ -423,35 +412,28 @@ static struct visorchannel *visorchannel_create_guts(
 	channel->physaddr = physaddr;
 	channel->nbytes = size;
 
-	err = visorchannel_read(channel, 0, &channel->chan_hdr,
-				sizeof(struct channel_header));
+	err = visorchannel_read(channel, 0, &channel->chan_hdr, size);
 	if (err)
 		goto err_destroy_channel;
-
-	/* we had better be a CLIENT of this channel */
-	if (channel_bytes == 0)
-		channel_bytes = (ulong)channel->chan_hdr.size;
-	if (guid_is_null(guid))
-		guid = &channel->chan_hdr.chtype;
+	size = (ulong)channel->chan_hdr.size;
 
 	memunmap(channel->mapped);
 	if (channel->requested)
 		release_mem_region(channel->physaddr, channel->nbytes);
 	channel->mapped = NULL;
-	channel->requested = request_mem_region(channel->physaddr,
-						channel_bytes, VISOR_DRV_NAME);
+	channel->requested = request_mem_region(channel->physaddr, size,
+						VISOR_DRV_NAME);
 	if (!channel->requested && !guid_equal(guid, &visor_video_guid))
 		/* we only care about errors if this is not the video channel */
 		goto err_destroy_channel;
 
-	channel->mapped = memremap(channel->physaddr, channel_bytes,
-				   MEMREMAP_WB);
+	channel->mapped = memremap(channel->physaddr, size, MEMREMAP_WB);
 	if (!channel->mapped) {
-		release_mem_region(channel->physaddr, channel_bytes);
+		release_mem_region(channel->physaddr, size);
 		goto err_destroy_channel;
 	}
 
-	channel->nbytes = channel_bytes;
+	channel->nbytes = size;
 	guid_copy(&channel->guid, guid);
 	return channel;
 
@@ -460,20 +442,16 @@ static struct visorchannel *visorchannel_create_guts(
 	return NULL;
 }
 
-struct visorchannel *visorchannel_create(u64 physaddr,
-					 unsigned long channel_bytes,
-					 gfp_t gfp, const guid_t *guid)
+struct visorchannel *visorchannel_create(u64 physaddr, gfp_t gfp,
+					 const guid_t *guid)
 {
-	return visorchannel_create_guts(physaddr, channel_bytes, gfp, guid,
-					false);
+	return visorchannel_create_guts(physaddr, gfp, guid, false);
 }
 
-struct visorchannel *visorchannel_create_with_lock(u64 physaddr,
-						   unsigned long channel_bytes,
-						   gfp_t gfp, const guid_t *guid)
+struct visorchannel *visorchannel_create_with_lock(u64 physaddr, gfp_t gfp,
+						   const guid_t *guid)
 {
-	return visorchannel_create_guts(physaddr, channel_bytes, gfp, guid,
-					true);
+	return visorchannel_create_guts(physaddr, gfp, guid, true);
 }
 
 /**
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 0ea20bb..5bafadc 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -567,7 +567,6 @@ static int visorbus_create(struct controlvm_message *inmsg)
 	}
 
 	visorchannel = visorchannel_create(cmd->create_bus.channel_addr,
-					   cmd->create_bus.channel_bytes,
 					   GFP_KERNEL,
 					   &cmd->create_bus.bus_data_type_guid);
 	if (!visorchannel) {
@@ -789,7 +788,6 @@ static int visorbus_device_create(struct controlvm_message *inmsg)
 
 	visorchannel =
 	       visorchannel_create_with_lock(cmd->create_device.channel_addr,
-					     cmd->create_device.channel_bytes,
 					     GFP_KERNEL,
 					     &cmd->create_device.data_type_guid);
 	if (!visorchannel) {
@@ -1326,7 +1324,6 @@ static int controlvm_channel_create(struct visorchipset_device *dev)
 {
 	struct visorchannel *chan;
 	u64 addr;
-	u32 size;
 	int err;
 
 	err = unisys_vmcall(VMCALL_CONTROLVM_ADDR,
@@ -1334,8 +1331,7 @@ static int controlvm_channel_create(struct visorchipset_device *dev)
 	if (err)
 		return err;
 	addr = dev->controlvm_params.address;
-	size = dev->controlvm_params.channel_bytes;
-	chan = visorchannel_create_with_lock(addr, size, GFP_KERNEL,
+	chan = visorchannel_create_with_lock(addr, GFP_KERNEL,
 					     &visor_controlvm_channel_guid);
 	if (!chan)
 		return -ENOMEM;
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 25/28] staging: unisys: visorbus: just check for GUID
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (23 preceding siblings ...)
  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 ` David Kershner
  2017-08-30 17:36 ` [PATCH 26/28] staging: unisys: visorbus: Fix up GUID definition David Kershner
                   ` (2 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

Every channel_type must have a valid GUID, checking for the name was just
redundant.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index 0957eaa..a95901c 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -151,9 +151,7 @@ static int visorbus_match(struct device *xdev, struct device_driver *xdrv)
 	if (!drv->channel_types)
 		return 0;
 
-	for (i = 0;
-	     !guid_is_null(&drv->channel_types[i].guid) || drv->channel_types[i].name;
-	     i++)
+	for (i = 0; !guid_is_null(&drv->channel_types[i].guid); i++)
 		if (guid_equal(&drv->channel_types[i].guid, channel_type))
 			return i + 1;
 
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 26/28] staging: unisys: visorbus: Fix up GUID definition
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (24 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 25/28] staging: unisys: visorbus: just check for GUID David Kershner
@ 2017-08-30 17:36 ` 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
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

Fix up the GUID definition to remove some checkpatch warnings as well as
using the whole width of the screen.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 5bafadc..82b3bf7 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -20,9 +20,8 @@
 #include "visorbus_private.h"
 
 /* {72120008-4AAB-11DC-8530-444553544200} */
-#define VISOR_SIOVM_GUID \
-        GUID_INIT(0x72120008, 0x4AAB, 0x11DC, \
-                  0x85, 0x30, 0x44, 0x45, 0x53, 0x54, 0x42, 0x00)
+#define VISOR_SIOVM_GUID GUID_INIT(0x72120008, 0x4AAB, 0x11DC, 0x85, 0x30, \
+				   0x44, 0x45, 0x53, 0x54, 0x42, 0x00)
 
 static const guid_t visor_vhba_channel_guid = VISOR_VHBA_CHANNEL_GUID;
 static const guid_t visor_siovm_guid = VISOR_SIOVM_GUID;
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 27/28] staging: unisys: visorbus: remove EXPORT_SYMBOL_GPL for visor_check_channel
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (25 preceding siblings ...)
  2017-08-30 17:36 ` [PATCH 26/28] staging: unisys: visorbus: Fix up GUID definition David Kershner
@ 2017-08-30 17:36 ` David Kershner
  2017-08-30 17:36 ` [PATCH 28/28] staging: unisys: change pr_err to dev_err in visor_check_channel David Kershner
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen; +Cc: Sameer Wadgaonkar

From: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>

Removing EXPORT_SYMBOL_GPU from visor_check_channel since it is
used only in visorbus.

Signed-off-by: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index a95901c..ab47bbc 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -116,7 +116,6 @@ int visor_check_channel(struct channel_header *ch,
 	}
 	return 1;
 }
-EXPORT_SYMBOL_GPL(visor_check_channel);
 
 static int visorbus_uevent(struct device *xdev, struct kobj_uevent_env *env)
 {
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

* [PATCH 28/28] staging: unisys: change pr_err to dev_err in visor_check_channel
  2017-08-30 17:36 [PATCH 00/28] staging: unisys: More updates to make the code more readable David Kershner
                   ` (26 preceding siblings ...)
  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 ` David Kershner
  27 siblings, 0 replies; 29+ messages in thread
From: David Kershner @ 2017-08-30 17:36 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen; +Cc: Sameer Wadgaonkar

From: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>

Changing pr_err to dev_err in visor_check_channel. Added device
as an argument to visor_check_channel to pass into dev_err.

Signed-off-by: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reviewed-by: Tim Sell <timothy.sell@unisys.com>
---
 drivers/staging/unisys/include/visorbus.h       |  7 ++--
 drivers/staging/unisys/visorbus/visorbus_main.c | 33 +++++++++---------
 drivers/staging/unisys/visorbus/visorchipset.c  |  1 +-
 3 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index d7fa27b..e4ee38c 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -166,9 +166,10 @@ struct visor_device {
 
 #define to_visor_device(x) container_of(x, struct visor_device, device)
 
-int visor_check_channel(struct channel_header *ch, const guid_t *expected_guid,
-			char *chname, u64 expected_min_bytes,
-			u32 expected_version, u64 expected_signature);
+int visor_check_channel(struct channel_header *ch, struct device *dev,
+			const guid_t *expected_uuid, char *chname,
+			u64 expected_min_bytes,	u32 expected_version,
+			u64 expected_signature);
 
 int visorbus_register_visor_driver(struct visor_driver *drv);
 void visorbus_unregister_visor_driver(struct visor_driver *drv);
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index ab47bbc..2bc7ff7 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -70,6 +70,7 @@ static LIST_HEAD(list_all_device_instances);
  * is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages.
  */
 int visor_check_channel(struct channel_header *ch,
+			struct device *dev,
 			const guid_t *expected_guid,
 			char *chname,
 			u64 expected_min_bytes,
@@ -79,38 +80,38 @@ int visor_check_channel(struct channel_header *ch,
 	if (!guid_is_null(expected_guid)) {
 		/* caller wants us to verify type GUID */
 		if (!guid_equal(&ch->chtype, expected_guid)) {
-			pr_err("Channel mismatch on channel=%s(%pUL) field=type expected=%pUL actual=%pUL\n",
-			       chname, expected_guid,
-			       expected_guid, &ch->chtype);
+			dev_err(dev, "Channel mismatch on channel=%s(%pUL) field=type expected=%pUL actual=%pUL\n",
+				chname, expected_guid, expected_guid,
+				&ch->chtype);
 			return 0;
 		}
 	}
 	/* verify channel size */
 	if (expected_min_bytes > 0) {
 		if (ch->size < expected_min_bytes) {
-			pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n",
-			       chname, expected_guid,
-			       (unsigned long long)expected_min_bytes,
-			       ch->size);
+			dev_err(dev, "Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n",
+				chname, expected_guid,
+				(unsigned long long)expected_min_bytes,
+				ch->size);
 			return 0;
 		}
 	}
 	/* verify channel version */
 	if (expected_version > 0) {
 		if (ch->version_id != expected_version) {
-			pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8x\n",
-			       chname, expected_guid,
-			       (unsigned long)expected_version,
-			       ch->version_id);
+			dev_err(dev, "Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8x\n",
+				chname, expected_guid,
+				(unsigned long)expected_version,
+				ch->version_id);
 			return 0;
 		}
 	}
 	/* verify channel signature */
 	if (expected_signature > 0) {
 		if (ch->signature != expected_signature) {
-			pr_err("Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8Lx actual=0x%-8.8Lx\n",
-			       chname, expected_guid,
-			       expected_signature, ch->signature);
+			dev_err(dev, "Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8Lx actual=0x%-8.8Lx\n",
+				chname, expected_guid,	expected_signature,
+				ch->signature);
 			return 0;
 		}
 	}
@@ -699,11 +700,13 @@ void remove_visor_device(struct visor_device *dev)
 }
 
 static int get_vbus_header_info(struct visorchannel *chan,
+				struct device *dev,
 				struct visor_vbus_headerinfo *hdr_info)
 {
 	int err;
 
 	if (!visor_check_channel(visorchannel_get_header(chan),
+				 dev,
 				 &visor_vbus_channel_guid,
 				 "vbus",
 				 sizeof(struct visor_vbus_channel),
@@ -1030,7 +1033,7 @@ int visorbus_create_instance(struct visor_device *dev)
 				    &client_bus_info_debugfs_fops);
 
 	dev_set_drvdata(&dev->device, dev);
-	err = get_vbus_header_info(dev->visorchannel, hdr_info);
+	err = get_vbus_header_info(dev->visorchannel, &dev->device, hdr_info);
 	if (err < 0)
 		goto err_debugfs_dir;
 
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 82b3bf7..74cce4f 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1736,6 +1736,7 @@ static int visorchipset_init(struct acpi_device *acpi_device)
 
 	controlvm_channel = chipset_dev->controlvm_channel;
 	if (!visor_check_channel(visorchannel_get_header(controlvm_channel),
+				 &chipset_dev->acpi_device->dev,
 				 &visor_controlvm_channel_guid,
 				 "controlvm",
 				 sizeof(struct visor_controlvm_channel),
-- 
git-series 0.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2017-08-30 17:37 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 12/28] staging: unisys: visorbus: Consolidate controlvm channel creation David Kershner
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

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.