All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs
@ 2016-10-04 14:16 David Kershner
  2016-10-04 14:16 ` [PATCH 01/13] staging: unisys: visorbus: controlvmchannel.h remove unused pound defines David Kershner
                   ` (13 more replies)
  0 siblings, 14 replies; 20+ messages in thread
From: David Kershner @ 2016-10-04 14:16 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

Move /sys/bus/visorbus/devices/visorbus<n>/client_bus_info to debugfs

In a 9/28/2016 patch inspection that fixed code within the function that
emits this client_bus_info sysfs entry, GregKH pointed out that this
shouldn't actually be a sysfs entry at all, and in fact belongs in debugfs.
This patchset addresses that.

This patchset also addresses several comments pointed out by GregKH,
specifically removal of useless initialization and removing unused
defines from the rest of the driver series. 

Erik Arfvidson (10):
  staging: unisys: visorbus: controlvmchannel.h remove unused pound
    defines
  staging: unisys: visorbus: controlvmchannel.h fix comments
  staging: unisys: visorbus: controlvmchannel.h fix spacing
  staging: unisys: include: include.h remove unused pound defines
  staging: unisys: include: iochannel.h remove unused pound defines
  staging: unisys: include: channel.h remove unused pound defines
  staging: unisys: visorbus: vmcallinterface.h remove unused pound
    defines
  staging: unisys: visorbus: vbuschannel.h remove unused pound defines
  staging: unisys: visorbus: visorchannel.c rename 'local' variable to
    dest
  staging: unisys: visorbus: visorbus_private rename 'local' var to dest

Tim Sell (2):
  staging: unisys: visorbus: move DEVICE_ATTR_RO defs as-per conventions
  staging: unisys: visorbus: convert client_bus_info sysfs to debugfs

sameer wadgaonkar (1):
  staging: unisys: visorbus: remove unused initializations

 drivers/staging/unisys/include/channel.h           |  63 ------
 drivers/staging/unisys/include/iochannel.h         |  28 ---
 drivers/staging/unisys/include/visorbus.h          |   2 +
 drivers/staging/unisys/visorbus/controlvmchannel.h | 152 +++++---------
 drivers/staging/unisys/visorbus/vbuschannel.h      | 225 +++------------------
 drivers/staging/unisys/visorbus/visorbus_main.c    | 187 +++++++++--------
 drivers/staging/unisys/visorbus/visorbus_private.h |   4 +-
 drivers/staging/unisys/visorbus/visorchannel.c     |  10 +-
 drivers/staging/unisys/visorbus/visorchipset.c     |   5 +-
 drivers/staging/unisys/visorbus/vmcallinterface.h  |   1 -
 10 files changed, 200 insertions(+), 477 deletions(-)

-- 
1.9.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 01/13] staging: unisys: visorbus: controlvmchannel.h remove unused pound defines
  2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
@ 2016-10-04 14:16 ` David Kershner
  2016-10-09 15:05   ` Greg KH
  2016-10-04 14:16 ` [PATCH 02/13] staging: unisys: visorbus: controlvmchannel.h fix comments David Kershner
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 20+ messages in thread
From: David Kershner @ 2016-10-04 14:16 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen
  Cc: Erik Arfvidson, David Kershner

From: Erik Arfvidson <erik.arfvidson@unisys.com>

This patch removes all unused pound defines in controlvmchannel.h.
Adds a comment on the now unused error codes for our spar firmware
to avoid new error messages conflicting with previously defined
messages.

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
---
 drivers/staging/unisys/visorbus/controlvmchannel.h | 36 ++--------------------
 1 file changed, 3 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h b/drivers/staging/unisys/visorbus/controlvmchannel.h
index f0bfc4d..a71f875 100644
--- a/drivers/staging/unisys/visorbus/controlvmchannel.h
+++ b/drivers/staging/unisys/visorbus/controlvmchannel.h
@@ -43,8 +43,6 @@
 		ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID, \
 		ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE)
 
-#define MAX_SERIAL_NUM	32
-
 /* Defines for various channel queues */
 #define CONTROLVM_QUEUE_REQUEST		0
 #define CONTROLVM_QUEUE_RESPONSE	1
@@ -436,26 +434,6 @@ struct spar_controlvm_channel_protocol {
 	 struct controlvm_message saved_crash_msg[CONTROLVM_CRASHMSG_MAX];
 };
 
-/* Offsets for VM channel attributes */
-#define VM_CH_REQ_QUEUE_OFFSET \
-	offsetof(struct spar_controlvm_channel_protocol, request_queue)
-#define VM_CH_RESP_QUEUE_OFFSET \
-	offsetof(struct spar_controlvm_channel_protocol, response_queue)
-#define VM_CH_EVENT_QUEUE_OFFSET \
-	offsetof(struct spar_controlvm_channel_protocol, event_queue)
-#define VM_CH_ACK_QUEUE_OFFSET \
-	offsetof(struct spar_controlvm_channel_protocol, event_ack_queue)
-#define VM_CH_REQ_MSG_OFFSET \
-	offsetof(struct spar_controlvm_channel_protocol, request_msg)
-#define VM_CH_RESP_MSG_OFFSET \
-	offsetof(struct spar_controlvm_channel_protocol, response_msg)
-#define VM_CH_EVENT_MSG_OFFSET \
-	offsetof(struct spar_controlvm_channel_protocol, event_msg)
-#define VM_CH_ACK_MSG_OFFSET \
-	offsetof(struct spar_controlvm_channel_protocol, event_ack_msg)
-#define VM_CH_CRASH_MSG_OFFSET \
-	offsetof(struct spar_controlvm_channel_protocol, saved_crash_msg)
-
 /* The following header will be located at the beginning of PayloadVmOffset for
  * various ControlVm commands. The receiver of a ControlVm command with a
  * PayloadVmOffset will dereference this address and then use connection_offset,
@@ -482,6 +460,9 @@ struct spar_controlvm_parameters_header {
 	u32 reserved;		/* Natural alignment */
 };
 
+/* The following error messages are reserved 100, 101,
+ * 201, 202, 401, 402, 403
+ */
 /* General Errors------------------------------------------------------[0-99] */
 #define CONTROLVM_RESP_SUCCESS                                  0
 #define CONTROLVM_RESP_ERROR_ALREADY_DONE                       1
@@ -489,21 +470,10 @@ struct spar_controlvm_parameters_header {
 #define CONTROLVM_RESP_ERROR_KMALLOC_FAILED                     3
 #define CONTROLVM_RESP_ERROR_MESSAGE_ID_UNKNOWN                 4
 #define CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT      5
-
-/* CONTROLVM_INIT_CHIPSET-------------------------------------------[100-199] */
-#define CONTROLVM_RESP_ERROR_CLIENT_SWITCHCOUNT_NONZERO         100
-#define CONTROLVM_RESP_ERROR_EXPECTED_CHIPSET_INIT              101
-
-/* Maximum Limit----------------------------------------------------[200-299] */
-#define CONTROLVM_RESP_ERROR_MAX_BUSES		201	/* BUS_CREATE */
-#define CONTROLVM_RESP_ERROR_MAX_DEVICES        202	/* DEVICE_CREATE */
 /* Payload and Parameter Related------------------------------------[400-499] */
 #define CONTROLVM_RESP_ERROR_PAYLOAD_INVALID	400	/* SWITCH_ATTACHEXTPORT,
 							 * DEVICE_CONFIGURE
 							 */
-#define CONTROLVM_RESP_ERROR_INITIATOR_PARAMETER_INVALID 401	/* Multiple */
-#define CONTROLVM_RESP_ERROR_TARGET_PARAMETER_INVALID 402 /* DEVICE_CONFIGURE */
-#define CONTROLVM_RESP_ERROR_CLIENT_PARAMETER_INVALID 403 /* DEVICE_CONFIGURE */
 /* Specified[Packet Structure] Value-------------------------------[500-599] */
 #define CONTROLVM_RESP_ERROR_BUS_INVALID	500	/* SWITCH_ATTACHINTPORT,
 							 * BUS_CONFIGURE,
-- 
1.9.1

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

* [PATCH 02/13] staging: unisys: visorbus: controlvmchannel.h fix comments
  2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
  2016-10-04 14:16 ` [PATCH 01/13] staging: unisys: visorbus: controlvmchannel.h remove unused pound defines David Kershner
@ 2016-10-04 14:16 ` David Kershner
  2016-10-09 15:06   ` Greg KH
  2016-10-04 14:16 ` [PATCH 03/13] staging: unisys: visorbus: controlvmchannel.h fix spacing David Kershner
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 20+ messages in thread
From: David Kershner @ 2016-10-04 14:16 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

From: Erik Arfvidson <erik.arfvidson@unisys.com>

This patch simply fixes comments to mantain a more consistent
and shorter comments.

githubissue:
Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
---
 drivers/staging/unisys/visorbus/controlvmchannel.h | 82 +++++++++-------------
 1 file changed, 35 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h b/drivers/staging/unisys/visorbus/controlvmchannel.h
index a71f875..b904376 100644
--- a/drivers/staging/unisys/visorbus/controlvmchannel.h
+++ b/drivers/staging/unisys/visorbus/controlvmchannel.h
@@ -463,69 +463,57 @@ struct spar_controlvm_parameters_header {
 /* The following error messages are reserved 100, 101,
  * 201, 202, 401, 402, 403
  */
-/* General Errors------------------------------------------------------[0-99] */
+/* General Errors [0-99] */
 #define CONTROLVM_RESP_SUCCESS                                  0
 #define CONTROLVM_RESP_ERROR_ALREADY_DONE                       1
 #define CONTROLVM_RESP_ERROR_IOREMAP_FAILED                     2
 #define CONTROLVM_RESP_ERROR_KMALLOC_FAILED                     3
 #define CONTROLVM_RESP_ERROR_MESSAGE_ID_UNKNOWN                 4
 #define CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT      5
-/* Payload and Parameter Related------------------------------------[400-499] */
-#define CONTROLVM_RESP_ERROR_PAYLOAD_INVALID	400	/* SWITCH_ATTACHEXTPORT,
-							 * DEVICE_CONFIGURE
-							 */
-/* Specified[Packet Structure] Value-------------------------------[500-599] */
-#define CONTROLVM_RESP_ERROR_BUS_INVALID	500	/* SWITCH_ATTACHINTPORT,
-							 * BUS_CONFIGURE,
-							 * DEVICE_CREATE,
-							 * DEVICE_CONFIG
-							 * DEVICE_DESTROY
-							 */
-#define CONTROLVM_RESP_ERROR_DEVICE_INVALID	501 /* SWITCH_ATTACHINTPORT */
-						    /* DEVICE_CREATE,
-						     * DEVICE_CONFIGURE,
-						     * DEVICE_DESTROY
-						     */
-#define CONTROLVM_RESP_ERROR_CHANNEL_INVALID	502 /* DEVICE_CREATE,
-						     * DEVICE_CONFIGURE
-						     */
-/* Partition Driver Callback Interface----------------------[600-699] */
-#define CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE 604	/* BUS_CREATE,
-							 * BUS_DESTROY,
-							 * DEVICE_CREATE,
-							 * DEVICE_DESTROY
-							 */
+
+/* Payload and Parameter Related [400-499] */
+/* SWITCH_ATTACHEXTPORT, DEVICE_CONFIGURE */
+#define CONTROLVM_RESP_ERROR_PAYLOAD_INVALID	400
+
+/* Specified[Packet Structure] Value [500-599] */
+/* SWITCH_ATTACHINTPORT, BUS_CONFIGURE, DEVICE_CREATE, DEVICE_CONFIG,
+ * DEVICE_DESTROY
+ */
+#define CONTROLVM_RESP_ERROR_BUS_INVALID	500
+/* SWITCH_ATTACHINTPORT, DEVICE_CREATE, DEVICE_CONFIGURE, DEVICE_DESTROY */
+#define CONTROLVM_RESP_ERROR_DEVICE_INVALID	501
+ /* DEVICE_CREATE, DEVICE_CONFIGURE */
+#define CONTROLVM_RESP_ERROR_CHANNEL_INVALID	502
+
+/* Partition Driver Callback Interface [600-699] */
 /* Unable to invoke VIRTPCI callback */
-#define CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR 605
-							/* BUS_CREATE,
-							 * BUS_DESTROY,
-							 * DEVICE_CREATE,
-							 * DEVICE_DESTROY
-							 */
+/* BUS_CREATE, BUS_DESTROY, DEVICE_CREATE, DEVICE_DESTROY */
+#define CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE 604
+/* BUS_CREATE, BUS_DESTROY, DEVICE_CREATE, DEVICE_DESTROY */
 /* VIRTPCI Callback returned error */
+#define CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR 605
+/* SWITCH_ATTACHEXTPORT, SWITCH_DETACHEXTPORT, DEVICE_CONFIGURE */
 #define CONTROLVM_RESP_ERROR_GENERIC_DRIVER_CALLBACK_ERROR 606
-							/* SWITCH_ATTACHEXTPORT,
-							 * SWITCH_DETACHEXTPORT
-							 * DEVICE_CONFIGURE
-							 */
-
 /* generic device callback returned error */
-/* Bus Related------------------------------------------------------[700-799] */
-#define CONTROLVM_RESP_ERROR_BUS_DEVICE_ATTACHED 700	/* BUS_DESTROY */
-/* Channel Related--------------------------------------------------[800-899] */
-#define CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN 800	/* GET_CHANNELINFO,
-							 * DEVICE_DESTROY
-							 */
+
+/* Bus Related [700-799] */
+/* BUS_DESTROY */
+#define CONTROLVM_RESP_ERROR_BUS_DEVICE_ATTACHED 700
+
+/* Channel Related [800-899] */
+/* GET_CHANNELINFO, DEVICE_DESTROY */
+#define CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN 800
 #define CONTROLVM_RESP_ERROR_CHANNEL_SIZE_TOO_SMALL 801	/* DEVICE_CREATE */
-/* Chipset Shutdown Related---------------------------------------[1000-1099] */
+
+/* Chipset Shutdown Related [1000-1099] */
 #define CONTROLVM_RESP_ERROR_CHIPSET_SHUTDOWN_FAILED            1000
 #define CONTROLVM_RESP_ERROR_CHIPSET_SHUTDOWN_ALREADY_ACTIVE    1001
 
-/* Chipset Stop Related-------------------------------------------[1100-1199] */
+/* Chipset Stop Related [1100-1199] */
 #define CONTROLVM_RESP_ERROR_CHIPSET_STOP_FAILED_BUS            1100
 #define CONTROLVM_RESP_ERROR_CHIPSET_STOP_FAILED_SWITCH         1101
 
-/* Device Related-------------------------------------------------[1400-1499] */
+/* Device Related [1400-1499] */
 #define CONTROLVM_RESP_ERROR_DEVICE_UDEV_TIMEOUT                1400
 
-#endif				/* __CONTROLVMCHANNEL_H__ */
+#endif /* __CONTROLVMCHANNEL_H__ */
-- 
1.9.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 03/13] staging: unisys: visorbus: controlvmchannel.h fix spacing
  2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
  2016-10-04 14:16 ` [PATCH 01/13] staging: unisys: visorbus: controlvmchannel.h remove unused pound defines David Kershner
  2016-10-04 14:16 ` [PATCH 02/13] staging: unisys: visorbus: controlvmchannel.h fix comments David Kershner
@ 2016-10-04 14:16 ` David Kershner
  2016-10-09 15:07   ` Greg KH
  2016-10-04 14:16 ` [PATCH 04/13] staging: unisys: include: include.h remove unused pound defines David Kershner
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 20+ messages in thread
From: David Kershner @ 2016-10-04 14:16 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

From: Erik Arfvidson <erik.arfvidson@unisys.com>

This patch fixes space and tab aligned comments in
controlvmchannel.h.

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
---
 drivers/staging/unisys/visorbus/controlvmchannel.h | 42 +++++++++++-----------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h b/drivers/staging/unisys/visorbus/controlvmchannel.h
index b904376..9599d80 100644
--- a/drivers/staging/unisys/visorbus/controlvmchannel.h
+++ b/drivers/staging/unisys/visorbus/controlvmchannel.h
@@ -33,7 +33,7 @@
  * software.  Note that you can usually add fields to the END of the
  * channel struct withOUT needing to increment this.
  */
-#define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID  1
+#define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID 1
 
 #define SPAR_CONTROLVM_CHANNEL_OK_CLIENT(ch)           \
 	spar_check_channel_client(ch, \
@@ -44,13 +44,13 @@
 		ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE)
 
 /* Defines for various channel queues */
-#define CONTROLVM_QUEUE_REQUEST		0
-#define CONTROLVM_QUEUE_RESPONSE	1
-#define CONTROLVM_QUEUE_EVENT		2
-#define CONTROLVM_QUEUE_ACK		3
+#define CONTROLVM_QUEUE_REQUEST 0
+#define CONTROLVM_QUEUE_RESPONSE 1
+#define CONTROLVM_QUEUE_EVENT 2
+#define CONTROLVM_QUEUE_ACK 3
 
 /* Max num of messages stored during IOVM creation to be reused after crash */
-#define CONTROLVM_CRASHMSG_MAX		2
+#define CONTROLVM_CRASHMSG_MAX 2
 
 struct spar_segment_state  {
 	/* Bit 0: May enter other states */
@@ -464,26 +464,26 @@ struct spar_controlvm_parameters_header {
  * 201, 202, 401, 402, 403
  */
 /* General Errors [0-99] */
-#define CONTROLVM_RESP_SUCCESS                                  0
-#define CONTROLVM_RESP_ERROR_ALREADY_DONE                       1
-#define CONTROLVM_RESP_ERROR_IOREMAP_FAILED                     2
-#define CONTROLVM_RESP_ERROR_KMALLOC_FAILED                     3
-#define CONTROLVM_RESP_ERROR_MESSAGE_ID_UNKNOWN                 4
-#define CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT      5
+#define CONTROLVM_RESP_SUCCESS 0
+#define CONTROLVM_RESP_ERROR_ALREADY_DONE 1
+#define CONTROLVM_RESP_ERROR_IOREMAP_FAILED 2
+#define CONTROLVM_RESP_ERROR_KMALLOC_FAILED 3
+#define CONTROLVM_RESP_ERROR_MESSAGE_ID_UNKNOWN 4
+#define CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT 5
 
 /* Payload and Parameter Related [400-499] */
 /* SWITCH_ATTACHEXTPORT, DEVICE_CONFIGURE */
-#define CONTROLVM_RESP_ERROR_PAYLOAD_INVALID	400
+#define CONTROLVM_RESP_ERROR_PAYLOAD_INVALID 400
 
 /* Specified[Packet Structure] Value [500-599] */
 /* SWITCH_ATTACHINTPORT, BUS_CONFIGURE, DEVICE_CREATE, DEVICE_CONFIG,
  * DEVICE_DESTROY
  */
-#define CONTROLVM_RESP_ERROR_BUS_INVALID	500
+#define CONTROLVM_RESP_ERROR_BUS_INVALID 500
 /* SWITCH_ATTACHINTPORT, DEVICE_CREATE, DEVICE_CONFIGURE, DEVICE_DESTROY */
-#define CONTROLVM_RESP_ERROR_DEVICE_INVALID	501
+#define CONTROLVM_RESP_ERROR_DEVICE_INVALID 501
  /* DEVICE_CREATE, DEVICE_CONFIGURE */
-#define CONTROLVM_RESP_ERROR_CHANNEL_INVALID	502
+#define CONTROLVM_RESP_ERROR_CHANNEL_INVALID 502
 
 /* Partition Driver Callback Interface [600-699] */
 /* Unable to invoke VIRTPCI callback */
@@ -506,14 +506,14 @@ struct spar_controlvm_parameters_header {
 #define CONTROLVM_RESP_ERROR_CHANNEL_SIZE_TOO_SMALL 801	/* DEVICE_CREATE */
 
 /* Chipset Shutdown Related [1000-1099] */
-#define CONTROLVM_RESP_ERROR_CHIPSET_SHUTDOWN_FAILED            1000
-#define CONTROLVM_RESP_ERROR_CHIPSET_SHUTDOWN_ALREADY_ACTIVE    1001
+#define CONTROLVM_RESP_ERROR_CHIPSET_SHUTDOWN_FAILED 1000
+#define CONTROLVM_RESP_ERROR_CHIPSET_SHUTDOWN_ALREADY_ACTIVE 1001
 
 /* Chipset Stop Related [1100-1199] */
-#define CONTROLVM_RESP_ERROR_CHIPSET_STOP_FAILED_BUS            1100
-#define CONTROLVM_RESP_ERROR_CHIPSET_STOP_FAILED_SWITCH         1101
+#define CONTROLVM_RESP_ERROR_CHIPSET_STOP_FAILED_BUS 1100
+#define CONTROLVM_RESP_ERROR_CHIPSET_STOP_FAILED_SWITCH 1101
 
 /* Device Related [1400-1499] */
-#define CONTROLVM_RESP_ERROR_DEVICE_UDEV_TIMEOUT                1400
+#define CONTROLVM_RESP_ERROR_DEVICE_UDEV_TIMEOUT 1400
 
 #endif /* __CONTROLVMCHANNEL_H__ */
-- 
1.9.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 04/13] staging: unisys: include: include.h remove unused pound defines
  2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
                   ` (2 preceding siblings ...)
  2016-10-04 14:16 ` [PATCH 03/13] staging: unisys: visorbus: controlvmchannel.h fix spacing David Kershner
@ 2016-10-04 14:16 ` David Kershner
  2016-10-09 15:07   ` Greg KH
  2016-10-04 14:16 ` [PATCH 05/13] staging: unisys: visorbus: remove unused initializations David Kershner
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 20+ messages in thread
From: David Kershner @ 2016-10-04 14:16 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

From: Erik Arfvidson <erik.arfvidson@unisys.com>

This patch removes all the unused pound defines currently in
include.h.

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
---
 drivers/staging/unisys/include/channel.h | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/staging/unisys/include/channel.h b/drivers/staging/unisys/include/channel.h
index 259ef64..b8faa13 100644
--- a/drivers/staging/unisys/include/channel.h
+++ b/drivers/staging/unisys/include/channel.h
@@ -96,20 +96,6 @@ enum channel_clientstate {
 	  (((o) == CHANNELCLI_BUSY) && ((n) == CHANNELCLI_OWNED)) || (0)) \
 	 ? (1) : (0))
 
-/* Values for ULTRA_CHANNEL_PROTOCOL.CliErrorBoot: */
-/* throttling invalid boot channel statetransition error due to client
- * disabled
- */
-#define ULTRA_CLIERRORBOOT_THROTTLEMSG_DISABLED    0x01
-
-/* throttling invalid boot channel statetransition error due to client
- * not attached
- */
-#define ULTRA_CLIERRORBOOT_THROTTLEMSG_NOTATTACHED 0x02
-
-/* throttling invalid boot channel statetransition error due to busy channel */
-#define ULTRA_CLIERRORBOOT_THROTTLEMSG_BUSY        0x04
-
 /* Values for ULTRA_CHANNEL_PROTOCOL.Features: This define exists so
  * that windows guest can look at the FeatureFlags in the io channel,
  * and configure the windows driver to use interrupts or not based on
-- 
1.9.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 05/13] staging: unisys: visorbus: remove unused initializations
  2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
                   ` (3 preceding siblings ...)
  2016-10-04 14:16 ` [PATCH 04/13] staging: unisys: include: include.h remove unused pound defines David Kershner
@ 2016-10-04 14:16 ` David Kershner
  2016-10-09 15:08   ` Greg KH
  2016-10-04 14:16 ` [PATCH 06/13] staging: unisys: include: iochannel.h remove unused pound defines David Kershner
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 20+ messages in thread
From: David Kershner @ 2016-10-04 14:16 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen; +Cc: sameer wadgaonkar

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

Removed initializations from visorchipset_open() and visorchipset_init(),
and moved the memset in initialize_controlvm_payload_info() down in case
of early returns from the function.

Signed-off-by: Sameer Wadgaonkar <sameer.wadgaonkar@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c
index 5987149..e2ac3809 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -57,7 +57,6 @@ visorchipset_open(struct inode *inode, struct file *file)
 
 	if (minor_number)
 		return -ENODEV;
-	file->private_data = NULL;
 	return 0;
 }
 
@@ -1075,7 +1074,6 @@ initialize_controlvm_payload_info(u64 phys_addr, u64 offset, u32 bytes,
 	if (!info)
 		return -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID;
 
-	memset(info, 0, sizeof(struct visor_controlvm_payload_info));
 	if ((offset == 0) || (bytes == 0))
 		return -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID;
 
@@ -1083,6 +1081,7 @@ initialize_controlvm_payload_info(u64 phys_addr, u64 offset, u32 bytes,
 	if (!payload)
 		return -CONTROLVM_RESP_ERROR_IOREMAP_FAILED;
 
+	memset(info, 0, sizeof(struct visor_controlvm_payload_info));
 	info->offset = offset;
 	info->bytes = bytes;
 	info->ptr = payload;
@@ -2119,8 +2118,6 @@ visorchipset_init(struct acpi_device *acpi_device)
 	if (!addr)
 		goto error;
 
-	memset(&controlvm_payload_info, 0, sizeof(controlvm_payload_info));
-
 	controlvm_channel = visorchannel_create_with_lock(addr, 0,
 							  GFP_KERNEL, uuid);
 	if (!controlvm_channel)
-- 
1.9.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 06/13] staging: unisys: include: iochannel.h remove unused pound defines
  2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
                   ` (4 preceding siblings ...)
  2016-10-04 14:16 ` [PATCH 05/13] staging: unisys: visorbus: remove unused initializations David Kershner
@ 2016-10-04 14:16 ` David Kershner
  2016-10-04 14:16 ` [PATCH 07/13] staging: unisys: include: channel.h " David Kershner
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: David Kershner @ 2016-10-04 14:16 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

From: Erik Arfvidson <erik.arfvidson@unisys.com>

This patch removes all the unused pound defines currently
in iochannel.h.

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
---
 drivers/staging/unisys/include/iochannel.h | 28 ----------------------------
 1 file changed, 28 deletions(-)

diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h
index cba4433..21b0366 100644
--- a/drivers/staging/unisys/include/iochannel.h
+++ b/drivers/staging/unisys/include/iochannel.h
@@ -34,32 +34,12 @@
 #include <linux/dma-direction.h>
 #include "channel.h"
 
-#define ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE
-#define ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE
-#define ULTRA_VSWITCH_CHANNEL_PROTOCOL_SIGNATURE \
-	ULTRA_CHANNEL_PROTOCOL_SIGNATURE
-
 /* Must increment these whenever you insert or delete fields within this channel
  * struct.  Also increment whenever you change the meaning of fields within this
  * channel struct so as to break pre-existing software.  Note that you can
  * usually add fields to the END of the channel struct withOUT needing to
  * increment this.
  */
-#define ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID 2
-#define ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID 2
-#define ULTRA_VSWITCH_CHANNEL_PROTOCOL_VERSIONID 1
-
-#define SPAR_VHBA_CHANNEL_OK_CLIENT(ch)			\
-	(spar_check_channel_client(ch, spar_vhba_channel_protocol_uuid, \
-				   "vhba", MIN_IO_CHANNEL_SIZE,	\
-				   ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID, \
-				   ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE))
-
-#define SPAR_VNIC_CHANNEL_OK_CLIENT(ch)			\
-	(spar_check_channel_client(ch, spar_vnic_channel_protocol_uuid, \
-				   "vnic", MIN_IO_CHANNEL_SIZE,	\
-				   ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID, \
-				   ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE))
 
 /*
  * Everything necessary to handle SCSI & NIC traffic between Guest Partition and
@@ -153,8 +133,6 @@ struct guest_phys_info {
 	u64 length;
 } __packed;
 
-#define GPI_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(struct guest_phys_info))
-
 struct uisscsi_dest {
 	u32 channel;		/* channel == bus number */
 	u32 id;			/* id == target number */
@@ -456,7 +434,6 @@ struct uiscmdrsp_vdiskmgmt {
 	char result;
 
 	    /* result of taskmgmt command - set by IOPart - values are: */
-#define VDISK_MGMT_FAILED  0
 } __packed;
 
 /* keeping cmd & rsp info in one structure for now cmd rsp packet for scsi */
@@ -468,7 +445,6 @@ struct uiscmdrsp {
 #define CMD_NET_TYPE		2
 #define CMD_SCSITASKMGMT_TYPE	3
 #define CMD_NOTIFYGUEST_TYPE	4
-#define CMD_VDISKMGMT_TYPE	5
 	union {
 		struct uiscmdrsp_scsi scsi;
 		struct uiscmdrsp_net net;
@@ -512,12 +488,8 @@ struct spar_io_channel_protocol {
 } __packed;
 
 /* INLINE functions for initializing and accessing I/O data channels */
-#define SIZEOF_PROTOCOL (COVER(sizeof(struct spar_io_channel_protocol), 64))
 #define SIZEOF_CMDRSP (COVER(sizeof(struct uiscmdrsp), 64))
 
-#define MIN_IO_CHANNEL_SIZE COVER(SIZEOF_PROTOCOL + \
-				  2 * MIN_NUMSIGNALS * SIZEOF_CMDRSP, 4096)
-
 /*
  * INLINE function for expanding a guest's pfn-off-size into multiple 4K page
  * pfn-off-size entires.
-- 
1.9.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 07/13] staging: unisys: include: channel.h remove unused pound defines
  2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
                   ` (5 preceding siblings ...)
  2016-10-04 14:16 ` [PATCH 06/13] staging: unisys: include: iochannel.h remove unused pound defines David Kershner
@ 2016-10-04 14:16 ` David Kershner
  2016-10-04 14:16 ` [PATCH 08/13] staging: unisys: visorbus: vmcallinterface.h " David Kershner
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: David Kershner @ 2016-10-04 14:16 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen
  Cc: Erik Arfvidson, David Kershner

From: Erik Arfvidson <erik.arfvidson@unisys.com>

This patch removes all the unused pound defines currently in
channel.h.

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
---
 drivers/staging/unisys/include/channel.h | 49 --------------------------------
 1 file changed, 49 deletions(-)

diff --git a/drivers/staging/unisys/include/channel.h b/drivers/staging/unisys/include/channel.h
index b8faa13..3c27a73 100644
--- a/drivers/staging/unisys/include/channel.h
+++ b/drivers/staging/unisys/include/channel.h
@@ -30,13 +30,9 @@
 /* define the following to prevent include nesting in kernel header
  * files of similar abbreviated content
  */
-#define __SUPERVISOR_CHANNEL_H__
-
 #define SIGNATURE_16(A, B) ((A) | (B << 8))
 #define SIGNATURE_32(A, B, C, D) \
 	(SIGNATURE_16(A, B) | (SIGNATURE_16(C, D) << 16))
-#define SIGNATURE_64(A, B, C, D, E, F, G, H) \
-	(SIGNATURE_32(A, B, C, D) | ((u64)(SIGNATURE_32(E, F, G, H)) << 32))
 
 #ifndef lengthof
 #define lengthof(TYPE, MEMBER) (sizeof(((TYPE *)0)->MEMBER))
@@ -75,27 +71,6 @@ enum channel_clientstate {
 				/* access channel anytime */
 };
 
-#define SPAR_CHANNEL_SERVER_READY(ch) \
-	(readl(&(ch)->srv_state) == CHANNELSRV_READY)
-
-#define ULTRA_VALID_CHANNELCLI_TRANSITION(o, n)				\
-	(((((o) == CHANNELCLI_DETACHED) && ((n) == CHANNELCLI_DISABLED)) || \
-	  (((o) == CHANNELCLI_ATTACHING) && ((n) == CHANNELCLI_DISABLED)) || \
-	  (((o) == CHANNELCLI_ATTACHED) && ((n) == CHANNELCLI_DISABLED)) || \
-	  (((o) == CHANNELCLI_ATTACHING) && ((n) == CHANNELCLI_DETACHED)) || \
-	  (((o) == CHANNELCLI_ATTACHED) && ((n) == CHANNELCLI_DETACHED)) || \
-	  (((o) == CHANNELCLI_DETACHED) && ((n) == CHANNELCLI_ATTACHING)) || \
-	  (((o) == CHANNELCLI_ATTACHING) && ((n) == CHANNELCLI_ATTACHED)) || \
-	  (((o) == CHANNELCLI_DETACHED) && ((n) == CHANNELCLI_ATTACHED)) || \
-	  (((o) == CHANNELCLI_BUSY) && ((n) == CHANNELCLI_ATTACHED)) ||	\
-	  (((o) == CHANNELCLI_ATTACHED) && ((n) == CHANNELCLI_BUSY)) ||	\
-	  (((o) == CHANNELCLI_DETACHED) && ((n) == CHANNELCLI_OWNED)) || \
-	  (((o) == CHANNELCLI_DISABLED) && ((n) == CHANNELCLI_OWNED)) || \
-	  (((o) == CHANNELCLI_ATTACHING) && ((n) == CHANNELCLI_OWNED)) || \
-	  (((o) == CHANNELCLI_ATTACHED) && ((n) == CHANNELCLI_OWNED)) || \
-	  (((o) == CHANNELCLI_BUSY) && ((n) == CHANNELCLI_OWNED)) || (0)) \
-	 ? (1) : (0))
-
 /* Values for ULTRA_CHANNEL_PROTOCOL.Features: This define exists so
  * that windows guest can look at the FeatureFlags in the io channel,
  * and configure the windows driver to use interrupts or not based on
@@ -104,10 +79,7 @@ enum channel_clientstate {
  * channels should be defined here.  The io channel feature bits are
  * defined right here
  */
-#define ULTRA_IO_DRIVER_ENABLES_INTS (0x1ULL << 1)
 #define ULTRA_IO_CHANNEL_IS_POLLING (0x1ULL << 3)
-#define ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS (0x1ULL << 4)
-#define ULTRA_IO_DRIVER_DISABLES_INTS (0x1ULL << 5)
 #define ULTRA_IO_DRIVER_SUPPORTS_ENHANCED_RCVBUF_CHECKING (0x1ULL << 6)
 
 /* Common Channel Header */
@@ -158,8 +130,6 @@ struct channel_header {
 	u8 recover_channel;
 } __packed;
 
-#define ULTRA_CHANNEL_ENABLE_INTS (0x1ULL << 0)
-
 /* Subheader for the Signal Type variation of the Common Channel */
 struct signal_queue_header {
 	/* 1st cache line */
@@ -200,20 +170,6 @@ struct signal_queue_header {
 	u8 filler[12];		/* Pad out to 64 byte cacheline */
 } __packed;
 
-#define spar_signal_init(chan, QHDRFLD, QDATAFLD, QDATATYPE, ver, typ)	\
-	do {								\
-		memset(&chan->QHDRFLD, 0, sizeof(chan->QHDRFLD));	\
-		chan->QHDRFLD.version = ver;				\
-		chan->QHDRFLD.chtype = typ;				\
-		chan->QHDRFLD.size = sizeof(chan->QDATAFLD);		\
-		chan->QHDRFLD.signal_size = sizeof(QDATATYPE);		\
-		chan->QHDRFLD.sig_base_offset = (u64)(chan->QDATAFLD) -	\
-			(u64)(&chan->QHDRFLD);				\
-		chan->QHDRFLD.max_slots =				\
-			sizeof(chan->QDATAFLD) / sizeof(QDATATYPE);	\
-		chan->QHDRFLD.max_signals = chan->QHDRFLD.max_slots - 1;\
-	} while (0)
-
 /* Generic function useful for validating any type of channel when it is
  * received by the client that will be accessing the channel.
  * Note that <logCtx> is only needed for callers in the EFI environment, and
@@ -411,9 +367,4 @@ static const uuid_le spar_siovm_uuid = SPAR_SIOVM_UUID;
 static const uuid_le spar_controldirector_channel_protocol_uuid =
 	SPAR_CONTROLDIRECTOR_CHANNEL_PROTOCOL_UUID;
 
-/* {b4e79625-aede-4eAA-9e11-D3eddcd4504c} */
-#define SPAR_DIAG_POOL_CHANNEL_PROTOCOL_UUID				\
-		UUID_LE(0xb4e79625, 0xaede, 0x4eaa, \
-				0x9e, 0x11, 0xd3, 0xed, 0xdc, 0xd4, 0x50, 0x4c)
-
 #endif
-- 
1.9.1

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

* [PATCH 08/13] staging: unisys: visorbus: vmcallinterface.h remove unused pound defines
  2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
                   ` (6 preceding siblings ...)
  2016-10-04 14:16 ` [PATCH 07/13] staging: unisys: include: channel.h " David Kershner
@ 2016-10-04 14:16 ` David Kershner
  2016-10-04 14:16 ` [PATCH 09/13] staging: unisys: visorbus: vbuschannel.h " David Kershner
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: David Kershner @ 2016-10-04 14:16 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

From: Erik Arfvidson <erik.arfvidson@unisys.com>

This patch removes all the unused pound defines currently in
vmcallinterface.h.

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
---
 drivers/staging/unisys/visorbus/vmcallinterface.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/vmcallinterface.h b/drivers/staging/unisys/visorbus/vmcallinterface.h
index 86e695d..a8f6f6c 100644
--- a/drivers/staging/unisys/visorbus/vmcallinterface.h
+++ b/drivers/staging/unisys/visorbus/vmcallinterface.h
@@ -224,7 +224,6 @@ enum event_pc {			/* POSTCODE event identifier tuples */
 };
 
 #define POSTCODE_SEVERITY_ERR DIAG_SEVERITY_ERR
-#define POSTCODE_SEVERITY_WARNING DIAG_SEVERITY_WARNING
 /* TODO-> Info currently doesn't show, so we set info=warning */
 #define POSTCODE_SEVERITY_INFO DIAG_SEVERITY_PRINT
 
-- 
1.9.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 09/13] staging: unisys: visorbus: vbuschannel.h remove unused pound defines
  2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
                   ` (7 preceding siblings ...)
  2016-10-04 14:16 ` [PATCH 08/13] staging: unisys: visorbus: vmcallinterface.h " David Kershner
@ 2016-10-04 14:16 ` David Kershner
  2016-10-04 14:16 ` [PATCH 10/13] staging: unisys: visorbus: visorchannel.c rename 'local' variable to dest David Kershner
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: David Kershner @ 2016-10-04 14:16 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

From: Erik Arfvidson <erik.arfvidson@unisys.com>

this patch removes all the unused pound defines currently
in vbuschannel.h

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
---
 drivers/staging/unisys/visorbus/vbuschannel.h | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/vbuschannel.h b/drivers/staging/unisys/visorbus/vbuschannel.h
index e979175..6bca83e 100644
--- a/drivers/staging/unisys/visorbus/vbuschannel.h
+++ b/drivers/staging/unisys/visorbus/vbuschannel.h
@@ -50,12 +50,6 @@ static const uuid_le spar_vbus_channel_protocol_uuid =
 				   SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID, \
 				   SPAR_VBUS_CHANNEL_PROTOCOL_SIGNATURE)
 
-#define SPAR_VBUS_CHANNEL_OK_SERVER(actual_bytes)    \
-	(spar_check_channel_server(spar_vbus_channel_protocol_uuid,	\
-				   "vbus",				\
-				   sizeof(struct spar_vbus_channel_protocol),\
-				   actual_bytes))
-
 #pragma pack(push, 1)		/* both GCC and VC now allow this pragma */
 
 /*
@@ -293,11 +287,6 @@ struct spar_vbus_channel_protocol {
 	/* describes client device and driver for each device on the bus */
 };
 
-#define VBUS_CH_SIZE_EXACT(MAXDEVICES) \
-	(sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL) + ((MAXDEVICES) * \
-						sizeof(ULTRA_VBUS_DEVICEINFO)))
-#define VBUS_CH_SIZE(MAXDEVICES) COVER(VBUS_CH_SIZE_EXACT(MAXDEVICES), 4096)
-
 #pragma pack(pop)
 
 #endif
-- 
1.9.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 10/13] staging: unisys: visorbus: visorchannel.c rename 'local' variable to dest
  2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
                   ` (8 preceding siblings ...)
  2016-10-04 14:16 ` [PATCH 09/13] staging: unisys: visorbus: vbuschannel.h " David Kershner
@ 2016-10-04 14:16 ` David Kershner
  2016-10-04 14:16 ` [PATCH 11/13] staging: unisys: visorbus: visorbus_private rename 'local' var " David Kershner
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: David Kershner @ 2016-10-04 14:16 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen

From: Erik Arfvidson <erik.arfvidson@unisys.com>

This patch renames poorly named 'local' variable to 'dest'.

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchannel.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c
index 300a65d..ea82e56 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -127,19 +127,19 @@ EXPORT_SYMBOL_GPL(visorchannel_get_uuid);
 
 int
 visorchannel_read(struct visorchannel *channel, ulong offset,
-		  void *local, ulong nbytes)
+		  void *dest, ulong nbytes)
 {
 	if (offset + nbytes > channel->nbytes)
 		return -EIO;
 
-	memcpy(local, channel->mapped + offset, nbytes);
+	memcpy(dest, channel->mapped + offset, nbytes);
 
 	return 0;
 }
 
 int
 visorchannel_write(struct visorchannel *channel, ulong offset,
-		   void *local, ulong nbytes)
+		   void *dest, ulong nbytes)
 {
 	size_t chdr_size = sizeof(struct channel_header);
 	size_t copy_size;
@@ -150,10 +150,10 @@ visorchannel_write(struct visorchannel *channel, ulong offset,
 	if (offset < chdr_size) {
 		copy_size = min(chdr_size - offset, nbytes);
 		memcpy(((char *)(&channel->chan_hdr)) + offset,
-		       local, copy_size);
+		       dest, copy_size);
 	}
 
-	memcpy(channel->mapped + offset, local, nbytes);
+	memcpy(channel->mapped + offset, dest, nbytes);
 
 	return 0;
 }
-- 
1.9.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 11/13] staging: unisys: visorbus: visorbus_private rename 'local' var to dest
  2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
                   ` (9 preceding siblings ...)
  2016-10-04 14:16 ` [PATCH 10/13] staging: unisys: visorbus: visorchannel.c rename 'local' variable to dest David Kershner
@ 2016-10-04 14:16 ` David Kershner
  2016-10-04 14:16 ` [PATCH 12/13] staging: unisys: visorbus: move DEVICE_ATTR_RO defs as-per conventions David Kershner
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: David Kershner @ 2016-10-04 14:16 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen
  Cc: Erik Arfvidson, David Kershner

From: Erik Arfvidson <erik.arfvidson@unisys.com>

This patch renames the poorly named 'local' var to 'dest' in
the visorbus_private.h file

Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_private.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_private.h b/drivers/staging/unisys/visorbus/visorbus_private.h
index 15403fb..49bec17 100644
--- a/drivers/staging/unisys/visorbus/visorbus_private.h
+++ b/drivers/staging/unisys/visorbus/visorbus_private.h
@@ -70,9 +70,9 @@ struct visorchannel *visorchannel_create_with_lock(u64 physaddr,
 						   gfp_t gfp, uuid_le guid);
 void visorchannel_destroy(struct visorchannel *channel);
 int visorchannel_read(struct visorchannel *channel, ulong offset,
-		      void *local, ulong nbytes);
+		      void *dest, ulong nbytes);
 int visorchannel_write(struct visorchannel *channel, ulong offset,
-		       void *local, ulong nbytes);
+		       void *dest, ulong nbytes);
 u64 visorchannel_get_physaddr(struct visorchannel *channel);
 ulong visorchannel_get_nbytes(struct visorchannel *channel);
 char *visorchannel_id(struct visorchannel *channel, char *s);
-- 
1.9.1

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

* [PATCH 12/13] staging: unisys: visorbus: move DEVICE_ATTR_RO defs as-per conventions
  2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
                   ` (10 preceding siblings ...)
  2016-10-04 14:16 ` [PATCH 11/13] staging: unisys: visorbus: visorbus_private rename 'local' var " David Kershner
@ 2016-10-04 14:16 ` David Kershner
  2016-10-04 14:16 ` [PATCH 13/13] staging: unisys: visorbus: convert client_bus_info sysfs to debugfs David Kershner
  2016-10-09 15:09 ` [PATCH 00/13] staging: unisys: Convert client_bus_info " Greg KH
  13 siblings, 0 replies; 20+ messages in thread
From: David Kershner @ 2016-10-04 14:16 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen; +Cc: Tim Sell

From: Tim Sell <Timothy.Sell@unisys.com>

The kernel convention is for DEVICE_ATTR_RO(<attr>) definitions to occur
immediately after the functions that implement the attribute behaviors.
DEVICE_ATTR_RO definitions in visorbus_main.c have been moved to comply
with this convention.

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Signed-off-by: David Kershner <david.kershner@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index fec0a54..2b22515 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -186,6 +186,7 @@ static ssize_t physaddr_show(struct device *dev, struct device_attribute *attr,
 	return snprintf(buf, PAGE_SIZE, "0x%llx\n",
 			visorchannel_get_physaddr(vdev->visorchannel));
 }
+static DEVICE_ATTR_RO(physaddr);
 
 static ssize_t nbytes_show(struct device *dev, struct device_attribute *attr,
 			   char *buf)
@@ -197,6 +198,7 @@ static ssize_t nbytes_show(struct device *dev, struct device_attribute *attr,
 	return snprintf(buf, PAGE_SIZE, "0x%lx\n",
 			visorchannel_get_nbytes(vdev->visorchannel));
 }
+static DEVICE_ATTR_RO(nbytes);
 
 static ssize_t clientpartition_show(struct device *dev,
 				    struct device_attribute *attr, char *buf)
@@ -208,6 +210,7 @@ static ssize_t clientpartition_show(struct device *dev,
 	return snprintf(buf, PAGE_SIZE, "0x%llx\n",
 			visorchannel_get_clientpartition(vdev->visorchannel));
 }
+static DEVICE_ATTR_RO(clientpartition);
 
 static ssize_t typeguid_show(struct device *dev, struct device_attribute *attr,
 			     char *buf)
@@ -220,6 +223,7 @@ static ssize_t typeguid_show(struct device *dev, struct device_attribute *attr,
 	return snprintf(buf, PAGE_SIZE, "%s\n",
 			visorchannel_id(vdev->visorchannel, typeid));
 }
+static DEVICE_ATTR_RO(typeguid);
 
 static ssize_t zoneguid_show(struct device *dev, struct device_attribute *attr,
 			     char *buf)
@@ -232,6 +236,7 @@ static ssize_t zoneguid_show(struct device *dev, struct device_attribute *attr,
 	return snprintf(buf, PAGE_SIZE, "%s\n",
 			visorchannel_zoneid(vdev->visorchannel, zoneid));
 }
+static DEVICE_ATTR_RO(zoneguid);
 
 static ssize_t typename_show(struct device *dev, struct device_attribute *attr,
 			     char *buf)
@@ -250,12 +255,6 @@ static ssize_t typename_show(struct device *dev, struct device_attribute *attr,
 	drv = to_visor_driver(xdrv);
 	return snprintf(buf, PAGE_SIZE, "%s\n", drv->channel_types[i - 1].name);
 }
-
-static DEVICE_ATTR_RO(physaddr);
-static DEVICE_ATTR_RO(nbytes);
-static DEVICE_ATTR_RO(clientpartition);
-static DEVICE_ATTR_RO(typeguid);
-static DEVICE_ATTR_RO(zoneguid);
 static DEVICE_ATTR_RO(typename);
 
 static struct attribute *channel_attrs[] = {
@@ -295,6 +294,7 @@ static ssize_t partition_handle_show(struct device *dev,
 
 	return snprintf(buf, PAGE_SIZE, "0x%llx\n", handle);
 }
+static DEVICE_ATTR_RO(partition_handle);
 
 static ssize_t partition_guid_show(struct device *dev,
 				   struct device_attribute *attr,
@@ -303,6 +303,7 @@ static ssize_t partition_guid_show(struct device *dev,
 
 	return snprintf(buf, PAGE_SIZE, "{%pUb}\n", &vdev->partition_uuid);
 }
+static DEVICE_ATTR_RO(partition_guid);
 
 static ssize_t partition_name_show(struct device *dev,
 				   struct device_attribute *attr,
@@ -311,6 +312,7 @@ static ssize_t partition_name_show(struct device *dev,
 
 	return snprintf(buf, PAGE_SIZE, "%s\n", vdev->name);
 }
+static DEVICE_ATTR_RO(partition_name);
 
 static ssize_t channel_addr_show(struct device *dev,
 				 struct device_attribute *attr,
@@ -320,6 +322,7 @@ static ssize_t channel_addr_show(struct device *dev,
 
 	return snprintf(buf, PAGE_SIZE, "0x%llx\n", addr);
 }
+static DEVICE_ATTR_RO(channel_addr);
 
 static ssize_t channel_bytes_show(struct device *dev,
 				  struct device_attribute *attr,
@@ -329,6 +332,7 @@ static ssize_t channel_bytes_show(struct device *dev,
 
 	return snprintf(buf, PAGE_SIZE, "0x%llx\n", nbytes);
 }
+static DEVICE_ATTR_RO(channel_bytes);
 
 static ssize_t channel_id_show(struct device *dev,
 			       struct device_attribute *attr,
@@ -343,6 +347,7 @@ static ssize_t channel_id_show(struct device *dev,
 	}
 	return len;
 }
+static DEVICE_ATTR_RO(channel_id);
 
 static ssize_t client_bus_info_show(struct device *dev,
 				    struct device_attribute *attr,
@@ -406,13 +411,6 @@ static ssize_t client_bus_info_show(struct device *dev,
 	}
 	return PAGE_SIZE - remain;
 }
-
-static DEVICE_ATTR_RO(partition_handle);
-static DEVICE_ATTR_RO(partition_guid);
-static DEVICE_ATTR_RO(partition_name);
-static DEVICE_ATTR_RO(channel_addr);
-static DEVICE_ATTR_RO(channel_bytes);
-static DEVICE_ATTR_RO(channel_id);
 static DEVICE_ATTR_RO(client_bus_info);
 
 static struct attribute *dev_attrs[] = {
-- 
1.9.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 13/13] staging: unisys: visorbus: convert client_bus_info sysfs to debugfs
  2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
                   ` (11 preceding siblings ...)
  2016-10-04 14:16 ` [PATCH 12/13] staging: unisys: visorbus: move DEVICE_ATTR_RO defs as-per conventions David Kershner
@ 2016-10-04 14:16 ` David Kershner
  2016-10-09 15:09 ` [PATCH 00/13] staging: unisys: Convert client_bus_info " Greg KH
  13 siblings, 0 replies; 20+ messages in thread
From: David Kershner @ 2016-10-04 14:16 UTC (permalink / raw)
  To: gregkh, driverdev-devel, sparmaintainer, jes.sorensen; +Cc: Tim Sell

From: Tim Sell <Timothy.Sell@unisys.com>

Previously, the sysfs entry (assuming traditional sysfs mountpoint):

    /sys/bus/visorbus/devices/visorbus<n>/client_bus_info

violated kernel conventions by printing more than one item.  This along
with the fact that the data emitted was diagnostic data (intended to shadow
the client driver info provided via s-Par livedumps) made it a logical
candidate for debugfs.  So this patch moves this sysfs entry to debugfs as
(assuming traditional debugfs mountpoint):

    /sys/kernel/debug/visorbus/visorbus<n>/client_bus_info

Data for this debugfs is emitted using the preferred seq_file interface,
which allowed a vastly-simplified version of vbuschannel_print_devinfo() to
format the individual output components.

Functionality was verified as follows:

  [root@sparguest visorbus]# mount | grep debug
  debugfs on /sys/kernel/debug type debugfs (rw)
  [root@sparguest visorbus]# pwd
  /sys/kernel/debug/visorbus
  [root@sparguest visorbus]# l visorbus1/
  total 0
  drwxr-xr-x 2 root root 0 Sep 28 16:36 .
  drwxr-xr-x 4 root root 0 Sep 28 16:36 ..
  -r--r----- 1 root root 0 Sep 28 16:36 client_bus_info
  [root@sparguest visorbus]# l visorbus2
  total 0
  drwxr-xr-x 2 root root 0 Sep 28 16:36 .
  drwxr-xr-x 4 root root 0 Sep 28 16:36 ..
  -r--r----- 1 root root 0 Sep 28 16:36 client_bus_info
  [root@sparguest visorbus]# cat visorbus1/client_bus_info
  Client device / client driver info for s-Par Console partition (vbus #1):
     chipset          visorchipset     kernel ver. 4.8.0-rc6-ARCH+
     clientbus        visorbus         kernel ver. 4.8.0-rc6-ARCH+
  [2]keyboard         visorinput       kernel ver. 4.8.0-rc6-ARCH+
  [3]mouse            visorinput       kernel ver. 4.8.0-rc6-ARCH+
  [root@sparguest visorbus]# cat visorbus2/client_bus_info
  Client device / client driver info for s-Par IOVM partition (vbus #2):
     chipset          visorchipset     kernel ver. 4.8.0-rc6-ARCH+
     clientbus        visorbus         kernel ver. 4.8.0-rc6-ARCH+
  [0]ultravnic        visornic         kernel ver. 4.8.0-rc6-ARCH+
  [1]ultravnic        visornic         kernel ver. 4.8.0-rc6-ARCH+
  [2]sparvhba         visorhba         kernel ver. 4.8.0-rc6-ARCH+

Signed-off-by: Tim Sell <Timothy.Sell@unisys.com>
Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David Kershner <david.kershner@unisys.com>
---
 drivers/staging/unisys/include/visorbus.h       |   2 +
 drivers/staging/unisys/visorbus/vbuschannel.h   | 214 +++---------------------
 drivers/staging/unisys/visorbus/visorbus_main.c | 165 ++++++++++--------
 3 files changed, 127 insertions(+), 254 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
index 677627c..03d56f8 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -166,6 +166,8 @@ struct visor_device {
 	struct controlvm_message_header *pending_msg_hdr;
 	void *vbus_hdr_info;
 	uuid_le partition_uuid;
+	struct dentry *debugfs_dir;
+	struct dentry *debugfs_client_bus_info;
 };
 
 #define to_visor_device(x) container_of(x, struct visor_device, device)
diff --git a/drivers/staging/unisys/visorbus/vbuschannel.h b/drivers/staging/unisys/visorbus/vbuschannel.h
index 6bca83e..b0df261 100644
--- a/drivers/staging/unisys/visorbus/vbuschannel.h
+++ b/drivers/staging/unisys/visorbus/vbuschannel.h
@@ -23,6 +23,7 @@
  *  the client devices and client drivers for the server end to see.
  */
 #include <linux/uuid.h>
+#include <linux/ctype.h>
 #include "channel.h"
 
 /* {193b331b-c58f-11da-95a9-00e08161165f} */
@@ -66,199 +67,38 @@ struct ultra_vbus_deviceinfo {
 };
 
 /**
- * vbuschannel_sanitize_buffer() - remove non-printable chars from buffer
- * @p: destination buffer where chars are written to
- * @remain: number of bytes that can be written starting at #p
- * @src: pointer to source buffer
- * @srcmax: number of valid characters at #src
- *
- * Reads chars from the buffer at @src for @srcmax bytes, and writes to
- * the buffer at @p, which is @remain bytes long, ensuring never to
- * overflow the buffer at @p, using the following rules:
- * - printable characters are simply copied from the buffer at @src to the
- *   buffer at @p
- * - intervening streaks of non-printable characters in the buffer at @src
- *   are replaced with a single space in the buffer at @p
- * Note that we pay no attention to '\0'-termination.
- *
- * Pass @p == NULL and @remain == 0 for this special behavior -- In this
- * case, we simply return the number of bytes that WOULD HAVE been written
- * to a buffer at @p, had it been infinitely big.
- *
- * Return: the number of bytes written to @p (or WOULD HAVE been written to
- *         @p, as described in the previous paragraph)
- */
-static inline int
-vbuschannel_sanitize_buffer(char *p, int remain, char *src, int srcmax)
-{
-	int chars = 0;
-	int nonprintable_streak = 0;
-
-	while (srcmax > 0) {
-		if ((*src >= ' ') && (*src < 0x7f)) {
-			if (nonprintable_streak) {
-				if (remain > 0) {
-					*p = ' ';
-					p++;
-					remain--;
-					chars++;
-				} else if (!p) {
-					chars++;
-				}
-				nonprintable_streak = 0;
-			}
-			if (remain > 0) {
-				*p = *src;
-				p++;
-				remain--;
-				chars++;
-			} else if (!p) {
-				chars++;
-			}
-		} else {
-			nonprintable_streak = 1;
-		}
-		src++;
-		srcmax--;
-	}
-	return chars;
-}
-
-#define VBUSCHANNEL_ADDACHAR(ch, p, remain, chars) \
-	do {					   \
-		if (remain <= 0)		   \
-			break;			   \
-		*p = ch;			   \
-		p++;  chars++;  remain--;	   \
-	} while (0)
-
-/**
- * vbuschannel_itoa() - convert non-negative int to string
- * @p: destination string
- * @remain: max number of bytes that can be written to @p
- * @num: input int to convert
- *
- * Converts the non-negative value at @num to an ascii decimal string
- * at @p, writing at most @remain bytes.  Note there is NO '\0' termination
- * written to @p.
- *
- * Return: number of bytes written to @p
- *
- */
-static inline int
-vbuschannel_itoa(char *p, int remain, int num)
-{
-	int digits = 0;
-	char s[32];
-	int i;
-
-	if (num == 0) {
-		/* '0' is a special case */
-		if (remain <= 0)
-			return 0;
-		*p = '0';
-		return 1;
-	}
-	/* form a backwards decimal ascii string in <s> */
-	while (num > 0) {
-		if (digits >= (int)sizeof(s))
-			return 0;
-		s[digits++] = (num % 10) + '0';
-		num = num / 10;
-	}
-	if (remain < digits) {
-		/* not enough room left at <p> to hold number, so fill with
-		 * '?'
-		 */
-		for (i = 0; i < remain; i++, p++)
-			*p = '?';
-		return remain;
-	}
-	/* plug in the decimal ascii string representing the number, by */
-	/* reversing the string we just built in <s> */
-	i = digits;
-	while (i > 0) {
-		i--;
-		*p = s[i];
-		p++;
-	}
-	return digits;
-}
-
-/**
- * vbuschannel_devinfo_to_string() - format a struct ultra_vbus_deviceinfo
- *                                   to a printable string
+ * vbuschannel_print_devinfo() - format a struct ultra_vbus_deviceinfo
+ *                               and write it to a seq_file
  * @devinfo: the struct ultra_vbus_deviceinfo to format
- * @p: destination string area
- * @remain: size of destination string area in bytes
+ * @seq: seq_file to write to
  * @devix: the device index to be included in the output data, or -1 if no
  *         device index is to be included
  *
- * Reads @devInfo, and converts its contents to a printable string at @p,
- * writing at most @remain bytes. Note there is NO '\0' termination
- * written to @p.
- *
- * Return: number of bytes written to @p
+ * Reads @devInfo, and writes it in human-readable notation to @seq.
  */
-static inline int
-vbuschannel_devinfo_to_string(struct ultra_vbus_deviceinfo *devinfo,
-			      char *p, int remain, int devix)
+static inline void
+vbuschannel_print_devinfo(struct ultra_vbus_deviceinfo *devinfo,
+			  struct seq_file *seq, int devix)
 {
-	char *psrc;
-	int nsrc, x, i, pad;
-	int chars = 0;
-
-	psrc = &devinfo->devtype[0];
-	nsrc = sizeof(devinfo->devtype);
-	if (vbuschannel_sanitize_buffer(NULL, 0, psrc, nsrc) <= 0)
-		return 0;
-
-	/* emit device index */
-	if (devix >= 0) {
-		VBUSCHANNEL_ADDACHAR('[', p, remain, chars);
-		x = vbuschannel_itoa(p, remain, devix);
-		p += x;
-		remain -= x;
-		chars += x;
-		VBUSCHANNEL_ADDACHAR(']', p, remain, chars);
-	} else {
-		VBUSCHANNEL_ADDACHAR(' ', p, remain, chars);
-		VBUSCHANNEL_ADDACHAR(' ', p, remain, chars);
-		VBUSCHANNEL_ADDACHAR(' ', p, remain, chars);
-	}
-
-	/* emit device type */
-	x = vbuschannel_sanitize_buffer(p, remain, psrc, nsrc);
-	p += x;
-	remain -= x;
-	chars += x;
-	pad = 15 - x;		/* pad device type to be exactly 15 chars */
-	for (i = 0; i < pad; i++)
-		VBUSCHANNEL_ADDACHAR(' ', p, remain, chars);
-	VBUSCHANNEL_ADDACHAR(' ', p, remain, chars);
-
-	/* emit driver name */
-	psrc = &devinfo->drvname[0];
-	nsrc = sizeof(devinfo->drvname);
-	x = vbuschannel_sanitize_buffer(p, remain, psrc, nsrc);
-	p += x;
-	remain -= x;
-	chars += x;
-	pad = 15 - x;		/* pad driver name to be exactly 15 chars */
-	for (i = 0; i < pad; i++)
-		VBUSCHANNEL_ADDACHAR(' ', p, remain, chars);
-	VBUSCHANNEL_ADDACHAR(' ', p, remain, chars);
-
-	/* emit strings */
-	psrc = &devinfo->infostrs[0];
-	nsrc = sizeof(devinfo->infostrs);
-	x = vbuschannel_sanitize_buffer(p, remain, psrc, nsrc);
-	p += x;
-	remain -= x;
-	chars += x;
-	VBUSCHANNEL_ADDACHAR('\n', p, remain, chars);
-
-	return chars;
+	if (!isprint(devinfo->devtype[0]))
+		return; /* uninitialized vbus device entry */
+
+	if (devix >= 0)
+		seq_printf(seq, "[%d]", devix);
+	else
+		/* vbus device entry is for bus or chipset */
+		seq_puts(seq, "   ");
+
+	/*
+	 * Note: because the s-Par back-end is free to scribble in this area,
+	 * we never assume '\0'-termination.
+	 */
+	seq_printf(seq, "%-*.*s ", (int)sizeof(devinfo->devtype),
+		   (int)sizeof(devinfo->devtype), devinfo->devtype);
+	seq_printf(seq, "%-*.*s ", (int)sizeof(devinfo->drvname),
+		   (int)sizeof(devinfo->drvname), devinfo->drvname);
+	seq_printf(seq, "%.*s\n", (int)sizeof(devinfo->infostrs),
+		   devinfo->infostrs);
 }
 
 struct spar_vbus_headerinfo {
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index 2b22515..b7001ed 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -14,6 +14,7 @@
  * details.
  */
 
+#include <linux/debugfs.h>
 #include <linux/uuid.h>
 
 #include "visorbus.h"
@@ -33,6 +34,7 @@ static int visorbus_forcenomatch;
 #define POLLJIFFIES_NORMALCHANNEL     10
 
 static int busreg_rc = -ENODEV; /* stores the result from bus registration */
+static struct dentry *visorbus_debugfs_dir;
 
 /*
  * DEVICE type attributes
@@ -151,6 +153,8 @@ visorbus_release_busdevice(struct device *xdev)
 {
 	struct visor_device *dev = dev_get_drvdata(xdev);
 
+	debugfs_remove(dev->debugfs_client_bus_info);
+	debugfs_remove_recursive(dev->debugfs_dir);
 	kfree(dev);
 }
 
@@ -349,70 +353,6 @@ static ssize_t channel_id_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(channel_id);
 
-static ssize_t client_bus_info_show(struct device *dev,
-				    struct device_attribute *attr,
-				    char *buf) {
-	struct visor_device *vdev = to_visor_device(dev);
-	struct visorchannel *channel = vdev->visorchannel;
-
-	int i, shift, remain = PAGE_SIZE;
-	unsigned long off;
-	char *pos = buf;
-	u8 *partition_name;
-	struct ultra_vbus_deviceinfo dev_info;
-
-	partition_name = "";
-	if (channel) {
-		if (vdev->name)
-			partition_name = vdev->name;
-		shift = snprintf(pos, remain,
-				 "Client device / client driver info for %s partition (vbus #%u):\n",
-				 partition_name, vdev->chipset_bus_no);
-		pos += shift;
-		remain -= shift;
-		shift = visorchannel_read(channel,
-					  offsetof(struct
-						   spar_vbus_channel_protocol,
-						   chp_info),
-					  &dev_info, sizeof(dev_info));
-		if (shift >= 0) {
-			shift = vbuschannel_devinfo_to_string(&dev_info, pos,
-							      remain, -1);
-			pos += shift;
-			remain -= shift;
-		}
-		shift = visorchannel_read(channel,
-					  offsetof(struct
-						   spar_vbus_channel_protocol,
-						   bus_info),
-					  &dev_info, sizeof(dev_info));
-		if (shift >= 0) {
-			shift = vbuschannel_devinfo_to_string(&dev_info, pos,
-							      remain, -1);
-			pos += shift;
-			remain -= shift;
-		}
-		off = offsetof(struct spar_vbus_channel_protocol, dev_info);
-		i = 0;
-		while (off + sizeof(dev_info) <=
-		       visorchannel_get_nbytes(channel)) {
-			shift = visorchannel_read(channel,
-						  off, &dev_info,
-						  sizeof(dev_info));
-			if (shift >= 0) {
-				shift = vbuschannel_devinfo_to_string
-				    (&dev_info, pos, remain, i);
-				pos += shift;
-				remain -= shift;
-			}
-			off += sizeof(dev_info);
-			i++;
-		}
-	}
-	return PAGE_SIZE - remain;
-}
-static DEVICE_ATTR_RO(client_bus_info);
-
 static struct attribute *dev_attrs[] = {
 		&dev_attr_partition_handle.attr,
 		&dev_attr_partition_guid.attr,
@@ -420,7 +360,6 @@ static struct attribute *dev_attrs[] = {
 		&dev_attr_channel_addr.attr,
 		&dev_attr_channel_bytes.attr,
 		&dev_attr_channel_id.attr,
-		&dev_attr_client_bus_info.attr,
 		NULL
 };
 
@@ -433,6 +372,66 @@ static const struct attribute_group *visorbus_groups[] = {
 		NULL
 };
 
+/*
+ *  BUS debugfs entries
+ *
+ *  define & implement display of debugfs attributes under
+ *  /sys/kernel/debug/visorbus/visorbus<n>.
+ */
+
+static int client_bus_info_debugfs_show(struct seq_file *seq, void *v)
+{
+	struct visor_device *vdev = seq->private;
+	struct visorchannel *channel = vdev->visorchannel;
+
+	int i;
+	unsigned long off;
+	struct ultra_vbus_deviceinfo dev_info;
+
+	if (!channel)
+		return 0;
+
+	seq_printf(seq,
+		   "Client device / client driver info for %s partition (vbus #%u):\n",
+		   ((vdev->name) ? (char *)(vdev->name) : ""),
+		   vdev->chipset_bus_no);
+	if (visorchannel_read(channel,
+			      offsetof(struct spar_vbus_channel_protocol,
+				       chp_info),
+			      &dev_info, sizeof(dev_info)) >= 0)
+		vbuschannel_print_devinfo(&dev_info, seq, -1);
+	if (visorchannel_read(channel,
+			      offsetof(struct spar_vbus_channel_protocol,
+				       bus_info),
+			      &dev_info, sizeof(dev_info)) >= 0)
+		vbuschannel_print_devinfo(&dev_info, seq, -1);
+	off = offsetof(struct spar_vbus_channel_protocol, dev_info);
+	i = 0;
+	while (off + sizeof(dev_info) <= visorchannel_get_nbytes(channel)) {
+		if (visorchannel_read(channel, off, &dev_info,
+				      sizeof(dev_info)) >= 0)
+			vbuschannel_print_devinfo(&dev_info, seq, i);
+		off += sizeof(dev_info);
+		i++;
+	}
+
+	return 0;
+}
+
+static int client_bus_info_debugfs_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, client_bus_info_debugfs_show,
+			   inode->i_private);
+}
+
+static const struct file_operations client_bus_info_debugfs_fops = {
+	.owner = THIS_MODULE,
+	.open = client_bus_info_debugfs_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
+};
+
 static void
 dev_periodic_work(unsigned long __opaque)
 {
@@ -964,6 +963,7 @@ static int
 create_bus_instance(struct visor_device *dev)
 {
 	int id = dev->chipset_bus_no;
+	int err;
 	struct spar_vbus_headerinfo *hdr_info;
 
 	POSTCODE_LINUX_2(BUS_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
@@ -977,11 +977,26 @@ create_bus_instance(struct visor_device *dev)
 	dev->device.groups = visorbus_groups;
 	dev->device.release = visorbus_release_busdevice;
 
+	dev->debugfs_dir = debugfs_create_dir(dev_name(&dev->device),
+					      visorbus_debugfs_dir);
+	if (!dev->debugfs_dir) {
+		err = -ENOMEM;
+		goto err_hdr_info;
+	}
+	dev->debugfs_client_bus_info =
+		debugfs_create_file("client_bus_info", S_IRUSR | S_IRGRP,
+				    dev->debugfs_dir, dev,
+				    &client_bus_info_debugfs_fops);
+	if (!dev->debugfs_client_bus_info) {
+		err = -ENOMEM;
+		goto err_debugfs_dir;
+	}
+
 	if (device_register(&dev->device) < 0) {
 		POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, id,
 				 POSTCODE_SEVERITY_ERR);
-		kfree(hdr_info);
-		return -ENODEV;
+		err = -ENODEV;
+		goto err_debugfs_created;
 	}
 
 	if (get_vbus_header_info(dev->visorchannel, hdr_info) >= 0) {
@@ -996,6 +1011,16 @@ create_bus_instance(struct visor_device *dev)
 	list_add_tail(&dev->list_all, &list_all_bus_instances);
 	dev_set_drvdata(&dev->device, dev);
 	return 0;
+
+err_debugfs_created:
+	debugfs_remove(dev->debugfs_client_bus_info);
+
+err_debugfs_dir:
+	debugfs_remove_recursive(dev->debugfs_dir);
+
+err_hdr_info:
+	kfree(hdr_info);
+	return err;
 }
 
 /**
@@ -1273,6 +1298,11 @@ visorbus_init(void)
 	int err;
 
 	POSTCODE_LINUX_3(DRIVER_ENTRY_PC, 0, POSTCODE_SEVERITY_INFO);
+
+	visorbus_debugfs_dir = debugfs_create_dir("visorbus", NULL);
+	if (!visorbus_debugfs_dir)
+		return -ENOMEM;
+
 	bus_device_info_init(&clientbus_driverinfo, "clientbus", "visorbus");
 
 	err = create_bus_type();
@@ -1304,6 +1334,7 @@ visorbus_exit(void)
 		remove_bus_instance(dev);
 	}
 	remove_bus_type();
+	debugfs_remove_recursive(visorbus_debugfs_dir);
 }
 
 module_param_named(forcematch, visorbus_forcematch, int, S_IRUGO);
-- 
1.9.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH 01/13] staging: unisys: visorbus: controlvmchannel.h remove unused pound defines
  2016-10-04 14:16 ` [PATCH 01/13] staging: unisys: visorbus: controlvmchannel.h remove unused pound defines David Kershner
@ 2016-10-09 15:05   ` Greg KH
  0 siblings, 0 replies; 20+ messages in thread
From: Greg KH @ 2016-10-09 15:05 UTC (permalink / raw)
  To: David Kershner
  Cc: driverdev-devel, sparmaintainer, jes.sorensen, Erik Arfvidson

On Tue, Oct 04, 2016 at 10:16:39AM -0400, David Kershner wrote:
> From: Erik Arfvidson <erik.arfvidson@unisys.com>
> 
> This patch removes all unused pound defines in controlvmchannel.h.
> Adds a comment on the now unused error codes for our spar firmware
> to avoid new error messages conflicting with previously defined
> messages.
> 
> Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
> Signed-off-by: David Kershner <david.kershner@unisys.com>
> ---
>  drivers/staging/unisys/visorbus/controlvmchannel.h | 36 ++--------------------
>  1 file changed, 3 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h b/drivers/staging/unisys/visorbus/controlvmchannel.h
> index f0bfc4d..a71f875 100644
> --- a/drivers/staging/unisys/visorbus/controlvmchannel.h
> +++ b/drivers/staging/unisys/visorbus/controlvmchannel.h
> @@ -43,8 +43,6 @@
>  		ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID, \
>  		ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE)
>  
> -#define MAX_SERIAL_NUM	32
> -
>  /* Defines for various channel queues */
>  #define CONTROLVM_QUEUE_REQUEST		0
>  #define CONTROLVM_QUEUE_RESPONSE	1
> @@ -436,26 +434,6 @@ struct spar_controlvm_channel_protocol {
>  	 struct controlvm_message saved_crash_msg[CONTROLVM_CRASHMSG_MAX];
>  };
>  
> -/* Offsets for VM channel attributes */
> -#define VM_CH_REQ_QUEUE_OFFSET \
> -	offsetof(struct spar_controlvm_channel_protocol, request_queue)
> -#define VM_CH_RESP_QUEUE_OFFSET \
> -	offsetof(struct spar_controlvm_channel_protocol, response_queue)
> -#define VM_CH_EVENT_QUEUE_OFFSET \
> -	offsetof(struct spar_controlvm_channel_protocol, event_queue)
> -#define VM_CH_ACK_QUEUE_OFFSET \
> -	offsetof(struct spar_controlvm_channel_protocol, event_ack_queue)
> -#define VM_CH_REQ_MSG_OFFSET \
> -	offsetof(struct spar_controlvm_channel_protocol, request_msg)
> -#define VM_CH_RESP_MSG_OFFSET \
> -	offsetof(struct spar_controlvm_channel_protocol, response_msg)
> -#define VM_CH_EVENT_MSG_OFFSET \
> -	offsetof(struct spar_controlvm_channel_protocol, event_msg)
> -#define VM_CH_ACK_MSG_OFFSET \
> -	offsetof(struct spar_controlvm_channel_protocol, event_ack_msg)
> -#define VM_CH_CRASH_MSG_OFFSET \
> -	offsetof(struct spar_controlvm_channel_protocol, saved_crash_msg)
> -
>  /* The following header will be located at the beginning of PayloadVmOffset for
>   * various ControlVm commands. The receiver of a ControlVm command with a
>   * PayloadVmOffset will dereference this address and then use connection_offset,
> @@ -482,6 +460,9 @@ struct spar_controlvm_parameters_header {
>  	u32 reserved;		/* Natural alignment */
>  };
>  
> +/* The following error messages are reserved 100, 101,
> + * 201, 202, 401, 402, 403
> + */

Reserved where?  It's ok to leave defines in here that you don't use, if
the hardware uses/needs them somehow.  Don't feel like you have to only
have things that you use, especially if you end up with cryptic comments
like this :)

I'll not take this patch.

thanks,

greg k-h

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

* Re: [PATCH 02/13] staging: unisys: visorbus: controlvmchannel.h fix comments
  2016-10-04 14:16 ` [PATCH 02/13] staging: unisys: visorbus: controlvmchannel.h fix comments David Kershner
@ 2016-10-09 15:06   ` Greg KH
  0 siblings, 0 replies; 20+ messages in thread
From: Greg KH @ 2016-10-09 15:06 UTC (permalink / raw)
  To: David Kershner; +Cc: driverdev-devel, sparmaintainer, jes.sorensen

On Tue, Oct 04, 2016 at 10:16:40AM -0400, David Kershner wrote:
> From: Erik Arfvidson <erik.arfvidson@unisys.com>
> 
> This patch simply fixes comments to mantain a more consistent
> and shorter comments.

Any reason you don't wrap your changelog comment lines at 72 columns
like git asks you to?

> 
> githubissue:

What does that mean?

thanks,

greg k-h

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

* Re: [PATCH 03/13] staging: unisys: visorbus: controlvmchannel.h fix spacing
  2016-10-04 14:16 ` [PATCH 03/13] staging: unisys: visorbus: controlvmchannel.h fix spacing David Kershner
@ 2016-10-09 15:07   ` Greg KH
  0 siblings, 0 replies; 20+ messages in thread
From: Greg KH @ 2016-10-09 15:07 UTC (permalink / raw)
  To: David Kershner; +Cc: driverdev-devel, sparmaintainer, jes.sorensen

On Tue, Oct 04, 2016 at 10:16:41AM -0400, David Kershner wrote:
> From: Erik Arfvidson <erik.arfvidson@unisys.com>
> 
> This patch fixes space and tab aligned comments in
> controlvmchannel.h.

It does?

> 
> Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com>
> Signed-off-by: David Kershner <david.kershner@unisys.com>
> ---
>  drivers/staging/unisys/visorbus/controlvmchannel.h | 42 +++++++++++-----------
>  1 file changed, 21 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h b/drivers/staging/unisys/visorbus/controlvmchannel.h
> index b904376..9599d80 100644
> --- a/drivers/staging/unisys/visorbus/controlvmchannel.h
> +++ b/drivers/staging/unisys/visorbus/controlvmchannel.h
> @@ -33,7 +33,7 @@
>   * software.  Note that you can usually add fields to the END of the
>   * channel struct withOUT needing to increment this.
>   */
> -#define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID  1
> +#define ULTRA_CONTROLVM_CHANNEL_PROTOCOL_VERSIONID 1
>  
>  #define SPAR_CONTROLVM_CHANNEL_OK_CLIENT(ch)           \
>  	spar_check_channel_client(ch, \
> @@ -44,13 +44,13 @@
>  		ULTRA_CONTROLVM_CHANNEL_PROTOCOL_SIGNATURE)
>  
>  /* Defines for various channel queues */
> -#define CONTROLVM_QUEUE_REQUEST		0
> -#define CONTROLVM_QUEUE_RESPONSE	1
> -#define CONTROLVM_QUEUE_EVENT		2
> -#define CONTROLVM_QUEUE_ACK		3
> +#define CONTROLVM_QUEUE_REQUEST 0
> +#define CONTROLVM_QUEUE_RESPONSE 1
> +#define CONTROLVM_QUEUE_EVENT 2
> +#define CONTROLVM_QUEUE_ACK 3

That looks better now?  Doesn't to me :(

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

* Re: [PATCH 04/13] staging: unisys: include: include.h remove unused pound defines
  2016-10-04 14:16 ` [PATCH 04/13] staging: unisys: include: include.h remove unused pound defines David Kershner
@ 2016-10-09 15:07   ` Greg KH
  0 siblings, 0 replies; 20+ messages in thread
From: Greg KH @ 2016-10-09 15:07 UTC (permalink / raw)
  To: David Kershner; +Cc: driverdev-devel, sparmaintainer, jes.sorensen

On Tue, Oct 04, 2016 at 10:16:42AM -0400, David Kershner wrote:
> From: Erik Arfvidson <erik.arfvidson@unisys.com>
> 
> This patch removes all the unused pound defines currently in
> include.h.

But does the hardware think they might be needed?  If so, leave them.

And again, wrap at 72.

thanks,

greg k-h

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

* Re: [PATCH 05/13] staging: unisys: visorbus: remove unused initializations
  2016-10-04 14:16 ` [PATCH 05/13] staging: unisys: visorbus: remove unused initializations David Kershner
@ 2016-10-09 15:08   ` Greg KH
  0 siblings, 0 replies; 20+ messages in thread
From: Greg KH @ 2016-10-09 15:08 UTC (permalink / raw)
  To: David Kershner
  Cc: driverdev-devel, sparmaintainer, jes.sorensen, sameer wadgaonkar

On Tue, Oct 04, 2016 at 10:16:43AM -0400, David Kershner wrote:
> From: sameer wadgaonkar <sameer.wadgaonkar@unisys.com>

lower-case name?

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

* Re: [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs
  2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
                   ` (12 preceding siblings ...)
  2016-10-04 14:16 ` [PATCH 13/13] staging: unisys: visorbus: convert client_bus_info sysfs to debugfs David Kershner
@ 2016-10-09 15:09 ` Greg KH
  13 siblings, 0 replies; 20+ messages in thread
From: Greg KH @ 2016-10-09 15:09 UTC (permalink / raw)
  To: David Kershner; +Cc: driverdev-devel, sparmaintainer, jes.sorensen

On Tue, Oct 04, 2016 at 10:16:38AM -0400, David Kershner wrote:
> Move /sys/bus/visorbus/devices/visorbus<n>/client_bus_info to debugfs
> 
> In a 9/28/2016 patch inspection that fixed code within the function that
> emits this client_bus_info sysfs entry, GregKH pointed out that this
> shouldn't actually be a sysfs entry at all, and in fact belongs in debugfs.
> This patchset addresses that.
> 
> This patchset also addresses several comments pointed out by GregKH,
> specifically removal of useless initialization and removing unused
> defines from the rest of the driver series. 

I stopped reading after 5 patches.  Please fix up the series based on
the review comments so far and resend.

thanks,

greg k-h

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

end of thread, other threads:[~2016-10-09 15:09 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-04 14:16 [PATCH 00/13] staging: unisys: Convert client_bus_info to debugfs David Kershner
2016-10-04 14:16 ` [PATCH 01/13] staging: unisys: visorbus: controlvmchannel.h remove unused pound defines David Kershner
2016-10-09 15:05   ` Greg KH
2016-10-04 14:16 ` [PATCH 02/13] staging: unisys: visorbus: controlvmchannel.h fix comments David Kershner
2016-10-09 15:06   ` Greg KH
2016-10-04 14:16 ` [PATCH 03/13] staging: unisys: visorbus: controlvmchannel.h fix spacing David Kershner
2016-10-09 15:07   ` Greg KH
2016-10-04 14:16 ` [PATCH 04/13] staging: unisys: include: include.h remove unused pound defines David Kershner
2016-10-09 15:07   ` Greg KH
2016-10-04 14:16 ` [PATCH 05/13] staging: unisys: visorbus: remove unused initializations David Kershner
2016-10-09 15:08   ` Greg KH
2016-10-04 14:16 ` [PATCH 06/13] staging: unisys: include: iochannel.h remove unused pound defines David Kershner
2016-10-04 14:16 ` [PATCH 07/13] staging: unisys: include: channel.h " David Kershner
2016-10-04 14:16 ` [PATCH 08/13] staging: unisys: visorbus: vmcallinterface.h " David Kershner
2016-10-04 14:16 ` [PATCH 09/13] staging: unisys: visorbus: vbuschannel.h " David Kershner
2016-10-04 14:16 ` [PATCH 10/13] staging: unisys: visorbus: visorchannel.c rename 'local' variable to dest David Kershner
2016-10-04 14:16 ` [PATCH 11/13] staging: unisys: visorbus: visorbus_private rename 'local' var " David Kershner
2016-10-04 14:16 ` [PATCH 12/13] staging: unisys: visorbus: move DEVICE_ATTR_RO defs as-per conventions David Kershner
2016-10-04 14:16 ` [PATCH 13/13] staging: unisys: visorbus: convert client_bus_info sysfs to debugfs David Kershner
2016-10-09 15:09 ` [PATCH 00/13] staging: unisys: Convert client_bus_info " Greg KH

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.