[PATCH v3 3/7] staging: unisys: cleanup rc -1 in create_visor_device()

2016-02-23 Thread Benjamin Romer
Get rid of the rc = -1 initialization. Return a meaningful error on
failure in the function, or, the rc from a called function if it fails.

Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---

v2: Put the goto back in.
v3: sent the wrong version of the patch by mistake.
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index 0add9ffe..f81da4d 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -973,7 +973,7 @@ EXPORT_SYMBOL_GPL(visorbus_disable_channel_interrupts);
 static int
 create_visor_device(struct visor_device *dev)
 {
-   int rc = -1;
+   int rc;
u32 chipset_bus_no = dev->chipset_bus_no;
u32 chipset_dev_no = dev->chipset_dev_no;
 
@@ -995,6 +995,7 @@ create_visor_device(struct visor_device *dev)
if (!dev->periodic_work) {
POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, chipset_dev_no,
 DIAG_SEVERITY_ERR);
+   rc = -EINVAL;
goto away;
}
 
@@ -1032,14 +1033,15 @@ create_visor_device(struct visor_device *dev)
if (rc < 0) {
POSTCODE_LINUX_3(DEVICE_REGISTER_FAILURE_PC, chipset_dev_no,
 DIAG_SEVERITY_ERR);
-   goto away_register;
+   goto away_unregister;
}
 
list_add_tail(>list_all, _all_device_instances);
return 0;
 
-away_register:
+away_unregister:
device_unregister(>device);
+
 away:
put_device(>device);
return rc;
-- 
2.5.0

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


[PATCH v2 3/7] staging: unisys: cleanup goto in create_visor_device()

2016-02-23 Thread Benjamin Romer
Get rid of the rc = -1 initialization. Return a meaningful error on
failure in the function, or, the rc from a called function if it fails.

Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---

v2: Put the goto back in.
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index 0add9ffe..d407f45 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -973,7 +973,7 @@ EXPORT_SYMBOL_GPL(visorbus_disable_channel_interrupts);
 static int
 create_visor_device(struct visor_device *dev)
 {
-   int rc = -1;
+   int rc;
u32 chipset_bus_no = dev->chipset_bus_no;
u32 chipset_dev_no = dev->chipset_dev_no;
 
@@ -995,6 +995,7 @@ create_visor_device(struct visor_device *dev)
if (!dev->periodic_work) {
POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, chipset_dev_no,
 DIAG_SEVERITY_ERR);
+   rc = -EINVAL;
goto away;
}
 
@@ -1032,15 +1033,16 @@ create_visor_device(struct visor_device *dev)
if (rc < 0) {
POSTCODE_LINUX_3(DEVICE_REGISTER_FAILURE_PC, chipset_dev_no,
 DIAG_SEVERITY_ERR);
-   goto away_register;
+   goto away_unregister;
}
 
list_add_tail(>list_all, _all_device_instances);
return 0;
 
-away_register:
+   away_unregister:
device_unregister(>device);
-away:
+
+   away:
put_device(>device);
return rc;
 }
-- 
2.5.0

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


[PATCH 5/7] staging: unisys: remove pointless init of rc in chipset_device_create()

2016-02-23 Thread Benjamin Romer
The value of rc is set by calling a function, so there's no need to
initialize it to -1, or anything at all.

Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index c9b8637..2d3ed4e 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -1316,7 +1316,7 @@ chipset_bus_destroy(struct visor_device *dev)
 static void
 chipset_device_create(struct visor_device *dev_info)
 {
-   int rc = -1;
+   int rc;
u32 bus_no = dev_info->chipset_bus_no;
u32 dev_no = dev_info->chipset_dev_no;
 
-- 
2.5.0

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


[PATCH 3/7] staging: unisys: cleanup goto in create_visor_device()

2016-02-23 Thread Benjamin Romer
Get rid of the rc = -1 initialization, and remove the goto
mess entirely. Return a meaningful error on failure in the function, or
the rc from a called function if it fails.

Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index 0add9ffe..cb147fa 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -973,7 +973,7 @@ EXPORT_SYMBOL_GPL(visorbus_disable_channel_interrupts);
 static int
 create_visor_device(struct visor_device *dev)
 {
-   int rc = -1;
+   int rc;
u32 chipset_bus_no = dev->chipset_bus_no;
u32 chipset_dev_no = dev->chipset_dev_no;
 
@@ -995,7 +995,8 @@ create_visor_device(struct visor_device *dev)
if (!dev->periodic_work) {
POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, chipset_dev_no,
 DIAG_SEVERITY_ERR);
-   goto away;
+   put_device(>device);
+   return -EINVAL;
}
 
/* bus_id must be a unique name with respect to this bus TYPE
@@ -1025,24 +1026,21 @@ create_visor_device(struct visor_device *dev)
if (rc < 0) {
POSTCODE_LINUX_3(DEVICE_ADD_PC, chipset_bus_no,
 DIAG_SEVERITY_ERR);
-   goto away;
+   put_device(>device);
+   return rc;
}
 
rc = register_devmajorminor_attributes(dev);
if (rc < 0) {
POSTCODE_LINUX_3(DEVICE_REGISTER_FAILURE_PC, chipset_dev_no,
 DIAG_SEVERITY_ERR);
-   goto away_register;
+   device_unregister(>device);
+   put_device(>device);
+   return rc;
}
 
list_add_tail(>list_all, _all_device_instances);
return 0;
-
-away_register:
-   device_unregister(>device);
-away:
-   put_device(>device);
-   return rc;
 }
 
 static void
-- 
2.5.0

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


[PATCH 1/7] staging: unisys: fix return value for visorbus pci probe

2016-02-23 Thread Benjamin Romer
Instead of returning -1, return -ENODEV when there is no probe function
found for the device.

Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index a301385..c0badfa 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -771,7 +771,7 @@ visordriver_probe_device(struct device *xdev)
get_device(>device);
if (!drv->probe) {
up(>visordriver_callback_lock);
-   rc = -1;
+   rc = -ENODEV;
goto away;
}
rc = drv->probe(dev);
-- 
2.5.0

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


[PATCH 7/7] staging: unisys: return meaningful error for visorchipset_init()

2016-02-23 Thread Benjamin Romer
The other error paths return meaningful error codes, except for the one
when registering a device, which just returned -1. Let's return ENODEV
when it fails to register instead.

Signed-off-by: Benjamin Romer <benjamin.ro...@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 a79aa2d..b75b063 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -2316,7 +2316,7 @@ visorchipset_init(struct acpi_device *acpi_device)
visorchipset_platform_device.dev.devt = major_dev;
if (platform_device_register(_platform_device) < 0) {
POSTCODE_LINUX_2(DEVICE_REGISTER_FAILURE_PC, DIAG_SEVERITY_ERR);
-   rc = -1;
+   rc = -ENODEV;
goto cleanup;
}
POSTCODE_LINUX_2(CHIPSET_INIT_SUCCESS_PC, POSTCODE_SEVERITY_INFO);
-- 
2.5.0

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


[PATCH 0/7] staging: unisys: goto/rc = -1 cleanup series

2016-02-23 Thread Benjamin Romer
This series cleans up all the places where rc = -1 was being done, either
as initialization, or to return an error value. In some places, it can
just be removed, but other places it was better to cleaning up goto
statements and eliminate the -1 at the same time.

Benjamin Romer (7):
  staging: unisys: fix return value for visorbus pci probe
  staging: unisys: remove goto in get_vbus_header_info
  staging: unisys: cleanup goto in create_visor_device()
  staging: unisys: get rid of goto in create_bus_instance()
  staging: unisys: remove pointless init of rc in
chipset_device_create()
  staging: unisys: clean up initiate_chipset_device_pause_resume()
  staging: unisys: return meaningful error for visorchipset_init()

 drivers/staging/unisys/visorbus/visorbus_main.c | 96 +++--
 drivers/staging/unisys/visorbus/visorchipset.c  |  2 +-
 2 files changed, 44 insertions(+), 54 deletions(-)

-- 
2.5.0

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


[PATCH 2/7] staging: unisys: remove goto in get_vbus_header_info

2016-02-23 Thread Benjamin Romer
Remove the rc, the = -1, and all the goto mess here and just return
directly with a meaningful error number.

The caller only cares about success/failure right now, that needs to be
addressed in a later patch series.

Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index c0badfa..0add9ffe 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -1058,23 +1058,21 @@ static int
 get_vbus_header_info(struct visorchannel *chan,
 struct spar_vbus_headerinfo *hdr_info)
 {
-   int rc = -1;
-
if (!SPAR_VBUS_CHANNEL_OK_CLIENT(visorchannel_get_header(chan)))
-   goto away;
+   return -EINVAL;
+
if (visorchannel_read(chan, sizeof(struct channel_header), hdr_info,
  sizeof(*hdr_info)) < 0) {
-   goto away;
+   return -EIO;
}
if (hdr_info->struct_bytes < sizeof(struct spar_vbus_headerinfo))
-   goto away;
+   return -EINVAL;
+
if (hdr_info->device_info_struct_bytes <
sizeof(struct ultra_vbus_deviceinfo)) {
-   goto away;
+   return -EINVAL;
}
-   rc = 0;
-away:
-   return rc;
+   return 0;
 }
 
 /* Write the contents of  to the struct
-- 
2.5.0

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


[PATCH 6/7] staging: unisys: clean up initiate_chipset_device_pause_resume()

2016-02-23 Thread Benjamin Romer
Simplify this function by removing the goto in favor of handling errors
immediately. Eliminate the vaguely-named variable x, and remove the
unneeded initialization of rc. Lastly, provide meaningful error values
to the callback function instead of just passing back a -1 for failure.

Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 42 +
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index 2d3ed4e..e170e0a 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -1393,7 +1393,7 @@ resume_state_change_complete(struct visor_device *dev, 
int status)
 static void
 initiate_chipset_device_pause_resume(struct visor_device *dev, bool is_pause)
 {
-   int rc = -1, x;
+   int rc;
struct visor_driver *drv = NULL;
void (*notify_func)(struct visor_device *dev, int response) = NULL;
 
@@ -1402,14 +1402,18 @@ initiate_chipset_device_pause_resume(struct 
visor_device *dev, bool is_pause)
else
notify_func = chipset_responders.device_resume;
if (!notify_func)
-   goto away;
+   return;
 
drv = to_visor_driver(dev->device.driver);
-   if (!drv)
-   goto away;
+   if (!drv) {
+   (*notify_func)(dev, -ENODEV);
+   return;
+   }
 
-   if (dev->pausing || dev->resuming)
-   goto away;
+   if (dev->pausing || dev->resuming) {
+   (*notify_func)(dev, -EBUSY);
+   return;
+   }
 
/* Note that even though both drv->pause() and drv->resume
 * specify a callback function, it is NOT necessary for us to
@@ -1419,11 +1423,13 @@ initiate_chipset_device_pause_resume(struct 
visor_device *dev, bool is_pause)
 * visorbus while child function drivers are still running.
 */
if (is_pause) {
-   if (!drv->pause)
-   goto away;
+   if (!drv->pause) {
+   (*notify_func)(dev, -EINVAL);
+   return;
+   }
 
dev->pausing = true;
-   x = drv->pause(dev, pause_state_change_complete);
+   rc = drv->pause(dev, pause_state_change_complete);
} else {
/* This should be done at BUS resume time, but an
 * existing problem prevents us from ever getting a bus
@@ -1432,24 +1438,20 @@ initiate_chipset_device_pause_resume(struct 
visor_device *dev, bool is_pause)
 * would never even get here in that case.
 */
fix_vbus_dev_info(dev);
-   if (!drv->resume)
-   goto away;
+   if (!drv->resume) {
+   (*notify_func)(dev, -EINVAL);
+   return;
+   }
 
dev->resuming = true;
-   x = drv->resume(dev, resume_state_change_complete);
+   rc = drv->resume(dev, resume_state_change_complete);
}
-   if (x < 0) {
+   if (rc < 0) {
if (is_pause)
dev->pausing = false;
else
dev->resuming = false;
-   goto away;
-   }
-   rc = 0;
-away:
-   if (rc < 0) {
-   if (notify_func)
-   (*notify_func)(dev, rc);
+   (*notify_func)(dev, -EINVAL);
}
 }
 
-- 
2.5.0

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


[PATCH 4/7] staging: unisys: get rid of goto in create_bus_instance()

2016-02-23 Thread Benjamin Romer
Remove the unnecessary rc and goto messiness, and just handle freeing
the memory before returning an error in the one place where that needs
to happen.

Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 16 
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index cb147fa..c9b8637 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -1193,17 +1193,14 @@ fix_vbus_dev_info(struct visor_device *visordev)
 static int
 create_bus_instance(struct visor_device *dev)
 {
-   int rc;
int id = dev->chipset_bus_no;
struct spar_vbus_headerinfo *hdr_info;
 
POSTCODE_LINUX_2(BUS_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
 
hdr_info = kzalloc(sizeof(*hdr_info), GFP_KERNEL);
-   if (!hdr_info) {
-   rc = -1;
-   goto away;
-   }
+   if (!hdr_info)
+   return -ENOMEM;
 
dev_set_name(>device, "visorbus%d", id);
dev->device.bus = _type;
@@ -1213,8 +1210,8 @@ create_bus_instance(struct visor_device *dev)
if (device_register(>device) < 0) {
POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, id,
 POSTCODE_SEVERITY_ERR);
-   rc = -1;
-   goto away_mem;
+   kfree(hdr_info);
+   return -ENODEV;
}
 
if (get_vbus_header_info(dev->visorchannel, hdr_info) >= 0) {
@@ -1230,11 +1227,6 @@ create_bus_instance(struct visor_device *dev)
list_add_tail(>list_all, _all_bus_instances);
dev_set_drvdata(>device, dev);
return 0;
-
-away_mem:
-   kfree(hdr_info);
-away:
-   return rc;
 }
 
 /** Remove a device instance for the visor bus itself.
-- 
2.5.0

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


[PATCH v3 10/14] staging: unisys: fix comments in visorbus_main.c

2016-02-08 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
Block comments use a trailing */ on a separate line
Comment alignments

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was rebased.
v3: the patch was rebased.
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index eac97d2..a301385 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -1371,9 +1371,9 @@ pause_state_change_complete(struct visor_device *dev, int 
status)
return;
 
/* Notify the chipset driver that the pause is complete, which
-   * will presumably want to send some sort of response to the
-   * initiator.
-   */
+* will presumably want to send some sort of response to the
+* initiator.
+*/
(*chipset_responders.device_pause) (dev, status);
 }
 
-- 
2.5.0

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


[PATCH v3 12/14] staging: unisys: fix comments in visornic_main.c

2016-02-08 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was rebased.
v3: the patch was rebased.
---
 drivers/staging/unisys/visornic/visornic_main.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index 9b3eb95..3da849a 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -1219,8 +1219,9 @@ visornic_rx(struct uiscmdrsp *cmdrsp)
/* length rcvd is greater than firstfrag in this skb rcv buf  */
skb->tail += RCVPOST_BUF_SIZE;  /* amount in skb->data */
skb->data_len = skb->len - RCVPOST_BUF_SIZE;/* amount that
-  will be in
-  frag_list */
+*  will be in
+* frag_list
+*/
} else {
/* data fits in this skb - no chaining - do
 * PRECAUTIONARY check
@@ -1316,12 +1317,14 @@ visornic_rx(struct uiscmdrsp *cmdrsp)
}
if (found_mc)
break;  /* accept packet, dest
-  matches a multicast
-  address */
+* matches a multicast
+* address
+*/
}
} else if (skb->pkt_type == PACKET_HOST) {
break;  /* accept packet, h_dest must match vnic
-  mac address */
+*  mac address
+*/
} else if (skb->pkt_type == PACKET_OTHERHOST) {
/* something is not right */
dev_err(>netdev->dev,
@@ -1619,6 +1622,9 @@ service_resp_queue(struct uiscmdrsp *cmdrsp, struct 
visornic_devdata *devdata,
struct net_device *netdev;
 
while (*rx_work_done < budget) {
+   /* TODO: CLIENT ACQUIRE -- Don't really need this at the
+* moment
+*/
if (!visorchannel_signalremove(devdata->dev->visorchannel,
   IOCHAN_FROM_IOPART,
   cmdrsp))
-- 
2.5.0

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


[PATCH v3 05/14] staging: unisys: fix comments in visorchipset

2016-02-08 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes all the Block comments by using a trailing */
on a separate line

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was rebased.
v3: the patch was rebased.
---
 drivers/staging/unisys/visorbus/visorchipset.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index f4c37da..c3d46aa 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -86,8 +86,8 @@ visorchipset_release(struct inode *inode, struct file *file)
 */
 #define MIN_IDLE_SECONDS 10
 static unsigned long poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST;
-static unsigned long most_recent_message_jiffies;  /* when we got our last
-* controlvm message */
+/* when we got our last controlvm message */
+static unsigned long most_recent_message_jiffies;
 static int visorbusregistered;
 
 #define MAX_CHIPSET_EVENTS 2
@@ -120,7 +120,8 @@ static struct visorchannel *controlvm_channel;
 struct visor_controlvm_payload_info {
u8 *ptr;/* pointer to base address of payload pool */
u64 offset; /* offset from beginning of controlvm
-* channel to beginning of payload * pool */
+* channel to beginning of payload * pool
+*/
u32 bytes;  /* number of bytes in payload pool */
 };
 
@@ -184,7 +185,8 @@ struct putfile_request {
 * - this list is added to when controlvm messages come in that supply
 * file data
 * - this list is removed from via the hotplug program that is actually
-* consuming these buffers to write as file data */
+* consuming these buffers to write as file data
+*/
struct list_head input_buffer_list;
spinlock_t req_list_lock;   /* lock for input_buffer_list */
 
@@ -788,13 +790,15 @@ chipset_init(struct controlvm_message *inmsg)
POSTCODE_LINUX_2(CHIPSET_INIT_EXIT_PC, POSTCODE_SEVERITY_INFO);
 
/* Set features to indicate we support parahotplug (if Command
-* also supports it). */
+* also supports it).
+*/
features =
inmsg->cmd.init_chipset.
features & ULTRA_CHIPSET_FEATURE_PARA_HOTPLUG;
 
/* Set the "reply" bit so Command knows this is a
-* features-aware driver. */
+* features-aware driver.
+*/
features |= ULTRA_CHIPSET_FEATURE_REPLY;
 
 cleanup:
-- 
2.5.0

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


[PATCH v3 07/14] staging: unisys: fix comparison to NULL in visorchipset.c

2016-02-08 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following type of check patch warnings:
Comparison to NULL could be written

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was rebased.
v3: address a comment from Sudip about a change to a NULL comparison that
was made in a later patch, that should have been part of this one.
---
 drivers/staging/unisys/visorbus/visorchipset.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 085d19a..ab8f9dd 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -438,7 +438,7 @@ parser_id_get(struct parser_context *ctx)
 {
struct spar_controlvm_parameters_header *phdr = NULL;
 
-   if (ctx == NULL)
+   if (!ctx)
return NULL_UUID_LE;
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
return phdr->id;
@@ -461,7 +461,7 @@ parser_param_start(struct parser_context *ctx,
 {
struct spar_controlvm_parameters_header *phdr = NULL;
 
-   if (ctx == NULL)
+   if (!ctx)
goto Away;
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
switch (which_string) {
@@ -522,7 +522,7 @@ parser_string_get(struct parser_context *ctx)
if (value_length < 0)   /* '\0' was not included in the length */
value_length = nscan;
value = kmalloc(value_length + 1, GFP_KERNEL | __GFP_NORETRY);
-   if (value == NULL)
+   if (!value)
return NULL;
if (value_length > 0)
memcpy(value, pscan, value_length);
@@ -875,7 +875,7 @@ bus_responder(enum controlvm_id cmd_id,
  struct controlvm_message_header *pending_msg_hdr,
  int response)
 {
-   if (pending_msg_hdr == NULL)
+   if (!pending_msg_hdr)
return; /* no controlvm response needed */
 
if (pending_msg_hdr->id != (u32)cmd_id)
@@ -893,7 +893,7 @@ device_changestate_responder(enum controlvm_id cmd_id,
u32 bus_no = p->chipset_bus_no;
u32 dev_no = p->chipset_dev_no;
 
-   if (p->pending_msg_hdr == NULL)
+   if (!p->pending_msg_hdr)
return; /* no controlvm response needed */
if (p->pending_msg_hdr->id != cmd_id)
return;
@@ -914,7 +914,7 @@ device_responder(enum controlvm_id cmd_id,
 struct controlvm_message_header *pending_msg_hdr,
 int response)
 {
-   if (pending_msg_hdr == NULL)
+   if (!pending_msg_hdr)
return; /* no controlvm response needed */
 
if (pending_msg_hdr->id != (u32)cmd_id)
@@ -1180,7 +1180,7 @@ bus_configure(struct controlvm_message *inmsg,
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, bus_no,
 POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
-   } else if (bus_info->pending_msg_hdr != NULL) {
+   } else if (bus_info->pending_msg_hdr) {
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, bus_no,
 POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT;
-- 
2.5.0

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


[PATCH v3 06/14] staging: unisys: fix spacing in visorchipset.c

2016-02-08 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following checkpatch warning:
spaces preferred around that ‘*’ or ‘|’

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was rebased.
v3: address Sudip's comment about a change being made to a NULL comparison
that should have been made in a previous patch.
---
 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 c3d46aa..085d19a 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -47,7 +47,6 @@
 
 #define VISORCHIPSET_MMAP_CONTROLCHANOFFSET0x
 
-
 #define UNISYS_SPAR_LEAF_ID 0x4000
 
 /* The s-Par leaf ID returns "UnisysSpar64" encoded across ebx, ecx, edx */
@@ -379,7 +378,7 @@ parser_init_byte_stream(u64 addr, u32 bytes, bool local, 
bool *retry)
rc = NULL;
goto cleanup;
}
-   ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY);
+   ctx = kzalloc(allocbytes, GFP_KERNEL | __GFP_NORETRY);
if (!ctx) {
if (retry)
*retry = true;
@@ -522,7 +521,7 @@ parser_string_get(struct parser_context *ctx)
}
if (value_length < 0)   /* '\0' was not included in the length */
value_length = nscan;
-   value = kmalloc(value_length + 1, GFP_KERNEL|__GFP_NORETRY);
+   value = kmalloc(value_length + 1, GFP_KERNEL | __GFP_NORETRY);
if (value == NULL)
return NULL;
if (value_length > 0)
-- 
2.5.0

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


[PATCH v3 02/14] staging: unisys: fix comments for controlvmchannel.h

2016-02-08 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch simply fixes all trailing */ by modifying the comments
structures while trying to reduce the total number of lines

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was rebased.
v3: the patch was rebased.
---
 drivers/staging/unisys/visorbus/controlvmchannel.h | 237 +++--
 1 file changed, 119 insertions(+), 118 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h 
b/drivers/staging/unisys/visorbus/controlvmchannel.h
index ec25366..03e36fb 100644
--- a/drivers/staging/unisys/visorbus/controlvmchannel.h
+++ b/drivers/staging/unisys/visorbus/controlvmchannel.h
@@ -55,22 +55,25 @@
 #define CONTROLVM_CRASHMSG_MAX 2
 
 struct spar_segment_state  {
-   u16 enabled:1;  /* Bit 0: May enter other states */
-   u16 active:1;   /* Bit 1: Assigned to active partition */
-   u16 alive:1;/* Bit 2: Configure message sent to
-* service/server */
-   u16 revoked:1;  /* Bit 3: similar to partition state
-* ShuttingDown */
-   u16 allocated:1;/* Bit 4: memory (device/port number)
-* has been selected by Command */
-   u16 known:1;/* Bit 5: has been introduced to the
-* service/guest partition */
-   u16 ready:1;/* Bit 6: service/Guest partition has
-* responded to introduction */
-   u16 operating:1;/* Bit 7: resource is configured and
-* operating */
-   /* Note: don't use high bit unless we need to switch to ushort
-* which is non-compliant */
+   /* Bit 0: May enter other states */
+   u16 enabled:1;
+   /* Bit 1: Assigned to active partition */
+   u16 active:1;
+   /* Bit 2: Configure message sent to service/server */
+   u16 alive:1;
+   /* Bit 3: similar to partition state ShuttingDown */
+   u16 revoked:1;
+   /* Bit 4: memory (device/port number) has been selected by Command */
+   u16 allocated:1;
+   /* Bit 5: has been introduced to the service/guest partition */
+   u16 known:1;
+   /* Bit 6: service/Guest partition has responded to introduction */
+   u16 ready:1;
+   /* Bit 7: resource is configured and operating */
+   u16 operating:1;
+/* Note: don't use high bit unless we need to switch to ushort
+ * which is non-compliant
+ */
 };
 
 static const struct spar_segment_state segment_state_running = {
@@ -177,53 +180,53 @@ struct controlvm_message_header  {
/* For requests, indicates the message type. */
/* For responses, indicates the type of message we are responding to. */
 
-   u32 message_size;   /* Includes size of this struct + size
-* of message */
-   u32 segment_index;  /* Index of segment containing Vm
-* message/information */
-   u32 completion_status;  /* Error status code or result of
-* message completion */
+   /* Includes size of this struct + size of message */
+   u32 message_size;
+   /* Index of segment containing Vm message/information */
+   u32 segment_index;
+   /* Error status code or result of  message completion */
+   u32 completion_status;
struct  {
-   u32 failed:1;  /* =1 in a response to * signify
-   * failure */
-   u32 response_expected:1;   /* =1 in all messages that expect a
-   * response (Control ignores this
-   * bit) */
-   u32 server:1;  /* =1 in all bus & device-related
-   * messages where the message
-   * receiver is to act as the bus or
-   * device server */
-   u32 test_message:1;/* =1 for testing use only
-   * (Control and Command ignore this
-   * bit) */
-   u32 partial_completion:1;  /* =1 if there are forthcoming
-   * responses/acks associated
-   * with this message */
-   u32 preserve:1;/* =1 this is to let us know to
-   * preserve channel contents
-   * (for running guests)*/
-   u32 writer_in_diag:1;  /* =1 the DiagWriter is active in the
-   

[PATCH v3 09/14] staging: unisys: fix spaces after cast visorchipset.c

2016-02-08 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes checkpatch's no space is necessary after a cast

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was rebased.
v3: the patch was rebased.
---
 drivers/staging/unisys/visorbus/visorchipset.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 8d672c7..6ad03a5 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -397,7 +397,7 @@ parser_init_byte_stream(u64 addr, u32 bytes, bool local, 
bool *retry)
rc = NULL;
goto cleanup;
}
-   p = __va((unsigned long) (addr));
+   p = __va((unsigned long)(addr));
memcpy(ctx->data, p, bytes);
} else {
void *mapping;
@@ -525,7 +525,7 @@ parser_string_get(struct parser_context *ctx)
return NULL;
if (value_length > 0)
memcpy(value, pscan, value_length);
-   ((u8 *) (value))[value_length] = '\0';
+   ((u8 *)(value))[value_length] = '\0';
return value;
 }
 
@@ -815,7 +815,7 @@ controlvm_init_response(struct controlvm_message *msg,
msg->hdr.payload_max_bytes = 0;
if (response < 0) {
msg->hdr.flags.failed = 1;
-   msg->hdr.completion_status = (u32) (-response);
+   msg->hdr.completion_status = (u32)(-response);
}
 }
 
-- 
2.5.0

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


[PATCH v3 11/14] staging: unisys: fix block comments in ultrainputreport.h

2016-02-08 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was rebased.
v3: the patch was rebased.
---
 .../staging/unisys/visorinput/ultrainputreport.h   | 45 +-
 1 file changed, 26 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/ultrainputreport.h 
b/drivers/staging/unisys/visorinput/ultrainputreport.h
index 3e6a52f..1bc3d20 100644
--- a/drivers/staging/unisys/visorinput/ultrainputreport.h
+++ b/drivers/staging/unisys/visorinput/ultrainputreport.h
@@ -29,33 +29,40 @@ enum ultra_inputaction {
inputaction_mouse_button_up = 3, /* arg1: 1=left,2=center,3=right */
inputaction_mouse_button_click = 4, /* arg1: 1=left,2=center,3=right */
inputaction_mouse_button_dclick = 5, /* arg1: 1=left,2=center,
-   3=right */
+ * 3=right
+ */
inputaction_wheel_rotate_away = 6, /* arg1: wheel rotation away from
- user */
+   * user
+   */
inputaction_wheel_rotate_toward = 7, /* arg1: wheel rotation toward
-   user */
+ * user
+ */
inputaction_set_max_xy = 8, /* set screen maxXY; arg1=x, arg2=y */
inputaction_key_down = 64,  /* arg1: scancode, as follows:
-  If arg1 <= 0xff, it's a 1-byte
-  scancode and arg1 is that scancode.
-  If arg1 > 0xff, it's a 2-byte
-  scanecode, with the 1st byte in the
-  low 8 bits, and the 2nd byte in the
-  high 8 bits.  E.g., the right ALT key
-  would appear as x'38e0'. */
+* If arg1 <= 0xff, it's a 1-byte
+* scancode and arg1 is that scancode.
+* If arg1 > 0xff, it's a 2-byte
+* scanecode, with the 1st byte in the
+* low 8 bits, and the 2nd byte in the
+* high 8 bits.  E.g., the right ALT key
+* would appear as x'38e0'.
+*/
inputaction_key_up = 65,/* arg1: scancode (in same format as
-  inputaction_keyDown) */
+* inputaction_keyDown)
+*/
inputaction_set_locking_key_state = 66,
/* arg1: scancode (in same format
-as inputaction_keyDown);
-MUST refer to one of the
-locking keys, like capslock,
-numlock, or scrolllock
-  arg2: 1 iff locking key should be
-in the LOCKED position
-(e.g., light is ON) */
+*   as inputaction_keyDown);
+*   MUST refer to one of the
+*   locking keys, like capslock,
+*   numlock, or scrolllock
+* arg2: 1 iff locking key should be
+*   in the LOCKED position
+*   (e.g., light is ON)
+*/
inputaction_key_down_up = 67,   /* arg1: scancode (in same format
-as inputaction_keyDown) */
+*   as inputaction_keyDown)
+*/
inputaction_last
 };
 
-- 
2.5.0

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


[PATCH v3 14/14] staging: unisys: remove unnecessary goto

2016-02-08 Thread Benjamin Romer
parser_param_start() had a goto Away, which went to nothing but
a return statement. Remove the goto, the CamelCased label, and
just return directly.

Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was rebased.
v3: the patch was rebased.
---
 drivers/staging/unisys/visorbus/visorchipset.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 6ad03a5..a79aa2d 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -461,7 +461,8 @@ parser_param_start(struct parser_context *ctx,
struct spar_controlvm_parameters_header *phdr = NULL;
 
if (!ctx)
-   goto Away;
+   return;
+
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
switch (which_string) {
case PARSERSTRING_INITIATOR:
@@ -483,9 +484,6 @@ parser_param_start(struct parser_context *ctx,
default:
break;
}
-
-Away:
-   return;
 }
 
 static void parser_done(struct parser_context *ctx)
-- 
2.5.0

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


[PATCH v3 03/14] staging: unisys: Fix NULL comparison vbusdeviceinfo.h

2016-02-08 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patches resolves the NULL comparison checkpatch warnings

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was rebased.
v3: the patch was rebased.
---
 drivers/staging/unisys/visorbus/vbusdeviceinfo.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h 
b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
index f59fd8a..3216975 100644
--- a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
+++ b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
@@ -62,7 +62,7 @@ vbuschannel_sanitize_buffer(char *p, int remain, char *src, 
int srcmax)
p++;
remain--;
chars++;
-   } else if (p == NULL) {
+   } else if (!p) {
chars++;
}
nonprintable_streak = 0;
@@ -72,7 +72,7 @@ vbuschannel_sanitize_buffer(char *p, int remain, char *src, 
int srcmax)
p++;
remain--;
chars++;
-   } else if (p == NULL) {
+   } else if (!p) {
chars++;
}
} else {
-- 
2.5.0

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


[PATCH v3 08/14] staging: unisys: fix blank lines in visorchipset.c

2016-02-08 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

this patch removes the following checkpatch warnings:
please use a blank line after …
Please don’t use multiple blank lines

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was rebased.
v3: the patch was rebased.
---
 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 ab8f9dd..8d672c7 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -353,7 +353,6 @@ static void controlvm_respond_physdev_changestate(
struct controlvm_message_header *msg_hdr, int response,
struct spar_segment_state state);
 
-
 static void parser_done(struct parser_context *ctx);
 
 static struct parser_context *
@@ -530,7 +529,6 @@ parser_string_get(struct parser_context *ctx)
return value;
 }
 
-
 static ssize_t toolaction_show(struct device *dev,
   struct device_attribute *attr,
   char *buf)
@@ -707,6 +705,7 @@ static int match_visorbus_dev_by_id(struct device *dev, 
void *data)
 
return 0;
 }
+
 struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no,
   struct visor_device *from)
 {
-- 
2.5.0

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


[PATCH v3 01/14] staging: unisys: Fix guestlinuxdebug.h comments

2016-02-08 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch simply cleans up all checkpatch comment issues

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was rebased.
v3: the patch was rebased.
---
 drivers/staging/unisys/include/guestlinuxdebug.h | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/include/guestlinuxdebug.h 
b/drivers/staging/unisys/include/guestlinuxdebug.h
index 82ee565..b81287f 100644
--- a/drivers/staging/unisys/include/guestlinuxdebug.h
+++ b/drivers/staging/unisys/include/guestlinuxdebug.h
@@ -17,9 +17,10 @@
 #define __GUESTLINUXDEBUG_H__
 
 /*
-* This file contains supporting interface for "vmcallinterface.h", particularly
-* regarding adding additional structure and functionality to linux
-* ISSUE_IO_VMCALL_POSTCODE_SEVERITY */
+ * This file contains supporting interface for "vmcallinterface.h", 
particularly
+ * regarding adding additional structure and functionality to linux
+ * ISSUE_IO_VMCALL_POSTCODE_SEVERITY
+ */
 
 /*** INFO ON ISSUE_POSTCODE_LINUX() BELOW ***/
 enum driver_pc {   /* POSTCODE driver identifier tuples */
@@ -133,9 +134,9 @@ enum event_pc { /* POSTCODE event 
identifier tuples */
 
 #define POSTCODE_SEVERITY_ERR DIAG_SEVERITY_ERR
 #define POSTCODE_SEVERITY_WARNING DIAG_SEVERITY_WARNING
-#define POSTCODE_SEVERITY_INFO DIAG_SEVERITY_PRINT /* TODO-> Info currently
-* doesn't show, so we
-* set info=warning */
+/* TODO-> Info currently doesn't show, so we set info=warning */
+#define POSTCODE_SEVERITY_INFO DIAG_SEVERITY_PRINT
+
 /* example call of POSTCODE_LINUX_2(VISOR_CHIPSET_PC, POSTCODE_SEVERITY_ERR);
  * Please also note that the resulting postcode is in hex, so if you are
  * searching for the __LINE__ number, convert it first to decimal.  The line
-- 
2.5.0

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


[PATCH v3 04/14] staging: unisys: fix trailing comment in vbusdeviceinfo.h

2016-02-08 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

Fixes checkpatch trailing */ comment in vbusdeviceinfo.h

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was rebased.
v3: the patch was rebased.
---
 drivers/staging/unisys/visorbus/vbusdeviceinfo.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h 
b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
index 3216975..abdab4a 100644
--- a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
+++ b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
@@ -124,7 +124,8 @@ vbuschannel_itoa(char *p, int remain, int num)
}
if (remain < digits) {
/* not enough room left at  to hold number, so fill with
-* '?' */
+* '?'
+*/
for (i = 0; i < remain; i++, p++)
*p = '?';
return remain;
-- 
2.5.0

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


[PATCH v3 13/14] staging: unisys: fix else statement in visornic_main.c

2016-02-08 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
else is not generally useful after a break or return

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was rebased.
v3: the patch was rebased.
---
 drivers/staging/unisys/visornic/visornic_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index 3da849a..234fa21 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -377,8 +377,8 @@ visornic_serverdown(struct visornic_devdata *devdata,
__func__);
spin_unlock_irqrestore(>priv_lock, flags);
return -EINVAL;
-   } else
-   spin_unlock_irqrestore(>priv_lock, flags);
+   }
+   spin_unlock_irqrestore(>priv_lock, flags);
return 0;
 }
 
-- 
2.5.0

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


[PATCH v3 00/14] staging: unisys: cleanup series

2016-02-08 Thread Benjamin Romer
This patch series cleans up all of the remaining checkpatch.pl issues in
the Unisys driver tree. The changes made were:

- The entire patch series has been rebased.
- A patch making parenthesis alignment changes to visornic_main.c was
  dropped from the series, because the original code was acceptable as is.
- Two patches were modified to move a fix to a NULL comparison into the
  correct patch.

Benjamin Romer (1):
  staging: unisys: remove unnecessary goto

Erik Arfvidson (13):
  staging: unisys: Fix guestlinuxdebug.h comments
  staging: unisys: fix comments for controlvmchannel.h
  staging: unisys: Fix NULL comparison vbusdeviceinfo.h
  staging: unisys: fix trailing comment in vbusdeviceinfo.h
  staging: unisys: fix comments in visorchipset
  staging: unisys: fix spacing in visorchipset.c
  staging: unisys: fix comparison to NULL in visorchipset.c
  staging: unisys: fix blank lines in visorchipset.c
  staging: unisys: fix spaces after cast visorchipset.c
  staging: unisys: fix comments in visorbus_main.c
  staging: unisys: fix block comments in ultrainputreport.h
  staging: unisys: fix comments in visornic_main.c
  staging: unisys: fix else statement in visornic_main.c

 drivers/staging/unisys/include/guestlinuxdebug.h   |  13 +-
 drivers/staging/unisys/visorbus/controlvmchannel.h | 237 +++--
 drivers/staging/unisys/visorbus/vbusdeviceinfo.h   |   7 +-
 drivers/staging/unisys/visorbus/visorbus_main.c|   6 +-
 drivers/staging/unisys/visorbus/visorchipset.c |  50 ++---
 .../staging/unisys/visorinput/ultrainputreport.h   |  45 ++--
 drivers/staging/unisys/visornic/visornic_main.c|  20 +-
 7 files changed, 197 insertions(+), 181 deletions(-)

-- 
2.5.0

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


[PATCH 13/16] staging: unisys: fix else statement in visornic_main.c

2016-01-29 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
else is not generally useful after a break or return

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index 9633959..6f6f8e3 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -376,8 +376,8 @@ visornic_serverdown(struct visornic_devdata *devdata,
__func__);
spin_unlock_irqrestore(>priv_lock, flags);
return -EINVAL;
-   } else
-   spin_unlock_irqrestore(>priv_lock, flags);
+   }
+   spin_unlock_irqrestore(>priv_lock, flags);
return 0;
 }
 
-- 
2.5.0

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


[PATCH 11/16] staging: unisys: fix block comments in ultrainputreport.h

2016-01-29 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 .../staging/unisys/visorinput/ultrainputreport.h   | 45 +-
 1 file changed, 26 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/ultrainputreport.h 
b/drivers/staging/unisys/visorinput/ultrainputreport.h
index 3e6a52f..1bc3d20 100644
--- a/drivers/staging/unisys/visorinput/ultrainputreport.h
+++ b/drivers/staging/unisys/visorinput/ultrainputreport.h
@@ -29,33 +29,40 @@ enum ultra_inputaction {
inputaction_mouse_button_up = 3, /* arg1: 1=left,2=center,3=right */
inputaction_mouse_button_click = 4, /* arg1: 1=left,2=center,3=right */
inputaction_mouse_button_dclick = 5, /* arg1: 1=left,2=center,
-   3=right */
+ * 3=right
+ */
inputaction_wheel_rotate_away = 6, /* arg1: wheel rotation away from
- user */
+   * user
+   */
inputaction_wheel_rotate_toward = 7, /* arg1: wheel rotation toward
-   user */
+ * user
+ */
inputaction_set_max_xy = 8, /* set screen maxXY; arg1=x, arg2=y */
inputaction_key_down = 64,  /* arg1: scancode, as follows:
-  If arg1 <= 0xff, it's a 1-byte
-  scancode and arg1 is that scancode.
-  If arg1 > 0xff, it's a 2-byte
-  scanecode, with the 1st byte in the
-  low 8 bits, and the 2nd byte in the
-  high 8 bits.  E.g., the right ALT key
-  would appear as x'38e0'. */
+* If arg1 <= 0xff, it's a 1-byte
+* scancode and arg1 is that scancode.
+* If arg1 > 0xff, it's a 2-byte
+* scanecode, with the 1st byte in the
+* low 8 bits, and the 2nd byte in the
+* high 8 bits.  E.g., the right ALT key
+* would appear as x'38e0'.
+*/
inputaction_key_up = 65,/* arg1: scancode (in same format as
-  inputaction_keyDown) */
+* inputaction_keyDown)
+*/
inputaction_set_locking_key_state = 66,
/* arg1: scancode (in same format
-as inputaction_keyDown);
-MUST refer to one of the
-locking keys, like capslock,
-numlock, or scrolllock
-  arg2: 1 iff locking key should be
-in the LOCKED position
-(e.g., light is ON) */
+*   as inputaction_keyDown);
+*   MUST refer to one of the
+*   locking keys, like capslock,
+*   numlock, or scrolllock
+* arg2: 1 iff locking key should be
+*   in the LOCKED position
+*   (e.g., light is ON)
+*/
inputaction_key_down_up = 67,   /* arg1: scancode (in same format
-as inputaction_keyDown) */
+*   as inputaction_keyDown)
+*/
inputaction_last
 };
 
-- 
2.5.0

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


[PATCH 02/16] staging: unisys: fix comments for controlvmchannel.h

2016-01-29 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch simply fixes all trailing */ by modifying the comments
structures while trying to reduce the total number of lines

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/controlvmchannel.h | 237 +++--
 1 file changed, 119 insertions(+), 118 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h 
b/drivers/staging/unisys/visorbus/controlvmchannel.h
index ec25366..03e36fb 100644
--- a/drivers/staging/unisys/visorbus/controlvmchannel.h
+++ b/drivers/staging/unisys/visorbus/controlvmchannel.h
@@ -55,22 +55,25 @@
 #define CONTROLVM_CRASHMSG_MAX 2
 
 struct spar_segment_state  {
-   u16 enabled:1;  /* Bit 0: May enter other states */
-   u16 active:1;   /* Bit 1: Assigned to active partition */
-   u16 alive:1;/* Bit 2: Configure message sent to
-* service/server */
-   u16 revoked:1;  /* Bit 3: similar to partition state
-* ShuttingDown */
-   u16 allocated:1;/* Bit 4: memory (device/port number)
-* has been selected by Command */
-   u16 known:1;/* Bit 5: has been introduced to the
-* service/guest partition */
-   u16 ready:1;/* Bit 6: service/Guest partition has
-* responded to introduction */
-   u16 operating:1;/* Bit 7: resource is configured and
-* operating */
-   /* Note: don't use high bit unless we need to switch to ushort
-* which is non-compliant */
+   /* Bit 0: May enter other states */
+   u16 enabled:1;
+   /* Bit 1: Assigned to active partition */
+   u16 active:1;
+   /* Bit 2: Configure message sent to service/server */
+   u16 alive:1;
+   /* Bit 3: similar to partition state ShuttingDown */
+   u16 revoked:1;
+   /* Bit 4: memory (device/port number) has been selected by Command */
+   u16 allocated:1;
+   /* Bit 5: has been introduced to the service/guest partition */
+   u16 known:1;
+   /* Bit 6: service/Guest partition has responded to introduction */
+   u16 ready:1;
+   /* Bit 7: resource is configured and operating */
+   u16 operating:1;
+/* Note: don't use high bit unless we need to switch to ushort
+ * which is non-compliant
+ */
 };
 
 static const struct spar_segment_state segment_state_running = {
@@ -177,53 +180,53 @@ struct controlvm_message_header  {
/* For requests, indicates the message type. */
/* For responses, indicates the type of message we are responding to. */
 
-   u32 message_size;   /* Includes size of this struct + size
-* of message */
-   u32 segment_index;  /* Index of segment containing Vm
-* message/information */
-   u32 completion_status;  /* Error status code or result of
-* message completion */
+   /* Includes size of this struct + size of message */
+   u32 message_size;
+   /* Index of segment containing Vm message/information */
+   u32 segment_index;
+   /* Error status code or result of  message completion */
+   u32 completion_status;
struct  {
-   u32 failed:1;  /* =1 in a response to * signify
-   * failure */
-   u32 response_expected:1;   /* =1 in all messages that expect a
-   * response (Control ignores this
-   * bit) */
-   u32 server:1;  /* =1 in all bus & device-related
-   * messages where the message
-   * receiver is to act as the bus or
-   * device server */
-   u32 test_message:1;/* =1 for testing use only
-   * (Control and Command ignore this
-   * bit) */
-   u32 partial_completion:1;  /* =1 if there are forthcoming
-   * responses/acks associated
-   * with this message */
-   u32 preserve:1;/* =1 this is to let us know to
-   * preserve channel contents
-   * (for running guests)*/
-   u32 writer_in_diag:1;  /* =1 the DiagWriter is active in the
-   * Diagnostic Partition*/
+   /* =1 in a response to signify failure 

[PATCH 16/16] staging: unisys: fix parenthesis in toolaction_show()

2016-01-29 Thread Benjamin Romer
Fix the only fixable parenthesis alignment issue in
visorchipset.c. The rest are unworkable because of the length
of the symbol names used.

Signed-off-by: Benjamin Romer <benjamin.ro...@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 7208618..775f53f 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -534,8 +534,8 @@ static ssize_t toolaction_show(struct device *dev,
u8 tool_action;
 
visorchannel_read(controlvm_channel,
-   offsetof(struct spar_controlvm_channel_protocol,
-tool_action), _action, sizeof(u8));
+ offsetof(struct spar_controlvm_channel_protocol,
+  tool_action), _action, sizeof(u8));
return scnprintf(buf, PAGE_SIZE, "%u\n", tool_action);
 }
 
-- 
2.5.0

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


[PATCH 05/16] staging: unisys: fix comments in visorchipset

2016-01-29 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes all the Block comments by using a trailing */
on a separate line

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 07594f4..fb56258 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -86,8 +86,8 @@ visorchipset_release(struct inode *inode, struct file *file)
 */
 #define MIN_IDLE_SECONDS 10
 static unsigned long poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST;
-static unsigned long most_recent_message_jiffies;  /* when we got our last
-* controlvm message */
+/* when we got our last controlvm message */
+static unsigned long most_recent_message_jiffies;
 static int visorbusregistered;
 
 #define MAX_CHIPSET_EVENTS 2
@@ -120,7 +120,8 @@ static struct visorchannel *controlvm_channel;
 struct visor_controlvm_payload_info {
u8 *ptr;/* pointer to base address of payload pool */
u64 offset; /* offset from beginning of controlvm
-* channel to beginning of payload * pool */
+* channel to beginning of payload * pool
+*/
u32 bytes;  /* number of bytes in payload pool */
 };
 
@@ -184,7 +185,8 @@ struct putfile_request {
 * - this list is added to when controlvm messages come in that supply
 * file data
 * - this list is removed from via the hotplug program that is actually
-* consuming these buffers to write as file data */
+* consuming these buffers to write as file data
+*/
struct list_head input_buffer_list;
spinlock_t req_list_lock;   /* lock for input_buffer_list */
 
@@ -788,13 +790,15 @@ chipset_init(struct controlvm_message *inmsg)
POSTCODE_LINUX_2(CHIPSET_INIT_EXIT_PC, POSTCODE_SEVERITY_INFO);
 
/* Set features to indicate we support parahotplug (if Command
-* also supports it). */
+* also supports it).
+*/
features =
inmsg->cmd.init_chipset.
features & ULTRA_CHIPSET_FEATURE_PARA_HOTPLUG;
 
/* Set the "reply" bit so Command knows this is a
-* features-aware driver. */
+* features-aware driver.
+*/
features |= ULTRA_CHIPSET_FEATURE_REPLY;
 
 cleanup:
-- 
2.5.0

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


[PATCH 08/16] staging: unisys: fix blank lines in visorchipset.c

2016-01-29 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

this patch removes the following checkpatch warnings:
please use a blank line after …
Please don’t use multiple blank lines

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@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 fdfd1c4..164fb7b 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -353,7 +353,6 @@ static void controlvm_respond_physdev_changestate(
struct controlvm_message_header *msg_hdr, int response,
struct spar_segment_state state);
 
-
 static void parser_done(struct parser_context *ctx);
 
 static struct parser_context *
@@ -530,7 +529,6 @@ parser_string_get(struct parser_context *ctx)
return value;
 }
 
-
 static ssize_t toolaction_show(struct device *dev,
   struct device_attribute *attr,
   char *buf)
@@ -707,6 +705,7 @@ static int match_visorbus_dev_by_id(struct device *dev, 
void *data)
 
return 0;
 }
+
 struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no,
   struct visor_device *from)
 {
-- 
2.5.0

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


[PATCH 14/16] staging: unisys: fix alignment in visornic_main.c

2016-01-29 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
Alignment should match open parenthesis

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index 6f6f8e3..77fd1ef 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -437,8 +437,8 @@ post_skb(struct uiscmdrsp *cmdrsp,
cmdrsp->net.type = NET_RCV_POST;
cmdrsp->cmdtype = CMD_NET_TYPE;
if (visorchannel_signalinsert(devdata->dev->visorchannel,
- IOCHAN_TO_IOPART,
- cmdrsp)) {
+ IOCHAN_TO_IOPART,
+ cmdrsp)) {
atomic_inc(>num_rcvbuf_in_iovm);
devdata->chstat.sent_post++;
} else {
@@ -466,8 +466,8 @@ send_enbdis(struct net_device *netdev, int state,
devdata->cmdrsp_rcv->net.type = NET_RCV_ENBDIS;
devdata->cmdrsp_rcv->cmdtype = CMD_NET_TYPE;
if (visorchannel_signalinsert(devdata->dev->visorchannel,
- IOCHAN_TO_IOPART,
- devdata->cmdrsp_rcv))
+ IOCHAN_TO_IOPART,
+ devdata->cmdrsp_rcv))
devdata->chstat.sent_enbdis++;
 }
 
@@ -1651,7 +1651,7 @@ service_resp_queue(struct uiscmdrsp *cmdrsp, struct 
visornic_devdata *devdata,
 * netif_wake_queue()
 */
if (vnic_hit_low_watermark(devdata,
-   devdata->lower_threshold_net_xmits)) {
+   devdata->lower_threshold_net_xmits)) {
/* enough NET_XMITs completed
 * so can restart netif queue
 */
-- 
2.5.0

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


[PATCH 07/16] staging: unisys: fix comparison to NULL in visorchipset.c

2016-01-29 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following type of check patch warnings:
Comparison to NULL could be written

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 8347ccd..fdfd1c4 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -438,7 +438,7 @@ parser_id_get(struct parser_context *ctx)
 {
struct spar_controlvm_parameters_header *phdr = NULL;
 
-   if (ctx == NULL)
+   if (!ctx)
return NULL_UUID_LE;
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
return phdr->id;
@@ -461,7 +461,7 @@ parser_param_start(struct parser_context *ctx,
 {
struct spar_controlvm_parameters_header *phdr = NULL;
 
-   if (ctx == NULL)
+   if (!ctx)
goto Away;
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
switch (which_string) {
@@ -875,7 +875,7 @@ bus_responder(enum controlvm_id cmd_id,
  struct controlvm_message_header *pending_msg_hdr,
  int response)
 {
-   if (pending_msg_hdr == NULL)
+   if (!pending_msg_hdr)
return; /* no controlvm response needed */
 
if (pending_msg_hdr->id != (u32)cmd_id)
@@ -893,7 +893,7 @@ device_changestate_responder(enum controlvm_id cmd_id,
u32 bus_no = p->chipset_bus_no;
u32 dev_no = p->chipset_dev_no;
 
-   if (p->pending_msg_hdr == NULL)
+   if (!p->pending_msg_hdr)
return; /* no controlvm response needed */
if (p->pending_msg_hdr->id != cmd_id)
return;
@@ -914,7 +914,7 @@ device_responder(enum controlvm_id cmd_id,
 struct controlvm_message_header *pending_msg_hdr,
 int response)
 {
-   if (pending_msg_hdr == NULL)
+   if (!pending_msg_hdr)
return; /* no controlvm response needed */
 
if (pending_msg_hdr->id != (u32)cmd_id)
@@ -1180,7 +1180,7 @@ bus_configure(struct controlvm_message *inmsg,
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, bus_no,
 POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
-   } else if (bus_info->pending_msg_hdr != NULL) {
+   } else if (bus_info->pending_msg_hdr) {
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, bus_no,
 POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT;
-- 
2.5.0

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


[PATCH 10/16] staging: unisys: fix comments in visorbus_main.c

2016-01-29 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
Block comments use a trailing */ on a separate line
Comment alignments

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index eac97d2..a301385 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -1371,9 +1371,9 @@ pause_state_change_complete(struct visor_device *dev, int 
status)
return;
 
/* Notify the chipset driver that the pause is complete, which
-   * will presumably want to send some sort of response to the
-   * initiator.
-   */
+* will presumably want to send some sort of response to the
+* initiator.
+*/
(*chipset_responders.device_pause) (dev, status);
 }
 
-- 
2.5.0

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


[PATCH 06/16] staging: unisys: fix spacing in visorchipset.c

2016-01-29 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following checkpatch warning:
spaces preferred around that ‘*’ or ‘|’

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index fb56258..8347ccd 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -43,11 +43,10 @@
 #define POLLJIFFIES_CONTROLVMCHANNEL_FAST   1
 #define POLLJIFFIES_CONTROLVMCHANNEL_SLOW 100
 
-#define MAX_CONTROLVM_PAYLOAD_BYTES (1024*128)
+#define MAX_CONTROLVM_PAYLOAD_BYTES (1024 * 128)
 
 #define VISORCHIPSET_MMAP_CONTROLCHANOFFSET0x
 
-
 #define UNISYS_SPAR_LEAF_ID 0x4000
 
 /* The s-Par leaf ID returns "UnisysSpar64" encoded across ebx, ecx, edx */
@@ -379,7 +378,7 @@ parser_init_byte_stream(u64 addr, u32 bytes, bool local, 
bool *retry)
rc = NULL;
goto cleanup;
}
-   ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY);
+   ctx = kzalloc(allocbytes, GFP_KERNEL | __GFP_NORETRY);
if (!ctx) {
if (retry)
*retry = true;
@@ -522,8 +521,8 @@ parser_string_get(struct parser_context *ctx)
}
if (value_length < 0)   /* '\0' was not included in the length */
value_length = nscan;
-   value = kmalloc(value_length + 1, GFP_KERNEL|__GFP_NORETRY);
-   if (value == NULL)
+   value = kmalloc(value_length + 1, GFP_KERNEL | __GFP_NORETRY);
+   if (!value)
return NULL;
if (value_length > 0)
memcpy(value, pscan, value_length);
-- 
2.5.0

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


[PATCH 15/16] staging: unisys: remove unnecessary goto

2016-01-29 Thread Benjamin Romer
parser_param_start() had a goto Away, which went to nothing but
a return statement. Remove the goto, the CamelCased label, and
just return directly.

Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 5535073..7208618 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -461,7 +461,8 @@ parser_param_start(struct parser_context *ctx,
struct spar_controlvm_parameters_header *phdr = NULL;
 
if (!ctx)
-   goto Away;
+   return;
+
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
switch (which_string) {
case PARSERSTRING_INITIATOR:
@@ -483,9 +484,6 @@ parser_param_start(struct parser_context *ctx,
default:
break;
}
-
-Away:
-   return;
 }
 
 static void parser_done(struct parser_context *ctx)
-- 
2.5.0

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


[PATCH 01/16] staging: unisys: Fix guestlinuxdebug.h comments

2016-01-29 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch simply cleans up all checkpatch comment issues

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/include/guestlinuxdebug.h | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/include/guestlinuxdebug.h 
b/drivers/staging/unisys/include/guestlinuxdebug.h
index 82ee565..b81287f 100644
--- a/drivers/staging/unisys/include/guestlinuxdebug.h
+++ b/drivers/staging/unisys/include/guestlinuxdebug.h
@@ -17,9 +17,10 @@
 #define __GUESTLINUXDEBUG_H__
 
 /*
-* This file contains supporting interface for "vmcallinterface.h", particularly
-* regarding adding additional structure and functionality to linux
-* ISSUE_IO_VMCALL_POSTCODE_SEVERITY */
+ * This file contains supporting interface for "vmcallinterface.h", 
particularly
+ * regarding adding additional structure and functionality to linux
+ * ISSUE_IO_VMCALL_POSTCODE_SEVERITY
+ */
 
 /*** INFO ON ISSUE_POSTCODE_LINUX() BELOW ***/
 enum driver_pc {   /* POSTCODE driver identifier tuples */
@@ -133,9 +134,9 @@ enum event_pc { /* POSTCODE event 
identifier tuples */
 
 #define POSTCODE_SEVERITY_ERR DIAG_SEVERITY_ERR
 #define POSTCODE_SEVERITY_WARNING DIAG_SEVERITY_WARNING
-#define POSTCODE_SEVERITY_INFO DIAG_SEVERITY_PRINT /* TODO-> Info currently
-* doesn't show, so we
-* set info=warning */
+/* TODO-> Info currently doesn't show, so we set info=warning */
+#define POSTCODE_SEVERITY_INFO DIAG_SEVERITY_PRINT
+
 /* example call of POSTCODE_LINUX_2(VISOR_CHIPSET_PC, POSTCODE_SEVERITY_ERR);
  * Please also note that the resulting postcode is in hex, so if you are
  * searching for the __LINE__ number, convert it first to decimal.  The line
-- 
2.5.0

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


[PATCH 12/16] staging: unisys: fix comments in visornic_main.c

2016-01-29 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index 0519470..9633959 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -1218,8 +1218,9 @@ visornic_rx(struct uiscmdrsp *cmdrsp)
/* length rcvd is greater than firstfrag in this skb rcv buf  */
skb->tail += RCVPOST_BUF_SIZE;  /* amount in skb->data */
skb->data_len = skb->len - RCVPOST_BUF_SIZE;/* amount that
-  will be in
-  frag_list */
+*  will be in
+* frag_list
+*/
} else {
/* data fits in this skb - no chaining - do
 * PRECAUTIONARY check
@@ -1315,12 +1316,14 @@ visornic_rx(struct uiscmdrsp *cmdrsp)
}
if (found_mc)
break;  /* accept packet, dest
-  matches a multicast
-  address */
+* matches a multicast
+* address
+*/
}
} else if (skb->pkt_type == PACKET_HOST) {
break;  /* accept packet, h_dest must match vnic
-  mac address */
+*  mac address
+*/
} else if (skb->pkt_type == PACKET_OTHERHOST) {
/* something is not right */
dev_err(>netdev->dev,
@@ -1619,7 +1622,8 @@ service_resp_queue(struct uiscmdrsp *cmdrsp, struct 
visornic_devdata *devdata,
struct net_device *netdev;
 
/* TODO: CLIENT ACQUIRE -- Don't really need this at the
-* moment */
+* moment
+*/
for (;;) {
if (!visorchannel_signalremove(devdata->dev->visorchannel,
   IOCHAN_FROM_IOPART,
-- 
2.5.0

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


[PATCH 00/16] staging: unisys: cleanup series

2016-01-29 Thread Benjamin Romer
This patch series cleans up all the remaining issues reported by
checkpatch.pl that can be fixed. The series was rebased against
the current contents of staging-next.

Benjamin Romer (2):
  staging: unisys: remove unnecessary goto
  staging: unisys: fix parenthesis in toolaction_show()

Erik Arfvidson (14):
  staging: unisys: Fix guestlinuxdebug.h comments
  staging: unisys: fix comments for controlvmchannel.h
  staging: unisys: Fix NULL comparison vbusdeviceinfo.h
  staging: unisys: fix trailing comment in vbusdeviceinfo.h
  staging: unisys: fix comments in visorchipset
  staging: unisys: fix spacing in visorchipset.c
  staging: unisys: fix comparison to NULL in visorchipset.c
  staging: unisys: fix blank lines in visorchipset.c
  staging: unisys: fix spaces after cast visorchipset.c
  staging: unisys: fix comments in visorbus_main.c
  staging: unisys: fix block comments in ultrainputreport.h
  staging: unisys: fix comments in visornic_main.c
  staging: unisys: fix else statement in visornic_main.c
  staging: unisys: fix alignment in visornic_main.c

 drivers/staging/unisys/include/guestlinuxdebug.h   |  13 +-
 drivers/staging/unisys/visorbus/controlvmchannel.h | 237 +++--
 drivers/staging/unisys/visorbus/vbusdeviceinfo.h   |   7 +-
 drivers/staging/unisys/visorbus/visorbus_main.c|   6 +-
 drivers/staging/unisys/visorbus/visorchipset.c |  56 ++---
 .../staging/unisys/visorinput/ultrainputreport.h   |  45 ++--
 drivers/staging/unisys/visornic/visornic_main.c|  30 +--
 7 files changed, 204 insertions(+), 190 deletions(-)

-- 
2.5.0

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


[PATCH 09/16] staging: unisys: fix spaces after cast visorchipset.c

2016-01-29 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes checkpatch's no space is necessary after a cast

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 164fb7b..5535073 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -397,7 +397,7 @@ parser_init_byte_stream(u64 addr, u32 bytes, bool local, 
bool *retry)
rc = NULL;
goto cleanup;
}
-   p = __va((unsigned long) (addr));
+   p = __va((unsigned long)(addr));
memcpy(ctx->data, p, bytes);
} else {
void *mapping;
@@ -525,7 +525,7 @@ parser_string_get(struct parser_context *ctx)
return NULL;
if (value_length > 0)
memcpy(value, pscan, value_length);
-   ((u8 *) (value))[value_length] = '\0';
+   ((u8 *)(value))[value_length] = '\0';
return value;
 }
 
@@ -815,7 +815,7 @@ controlvm_init_response(struct controlvm_message *msg,
msg->hdr.payload_max_bytes = 0;
if (response < 0) {
msg->hdr.flags.failed = 1;
-   msg->hdr.completion_status = (u32) (-response);
+   msg->hdr.completion_status = (u32)(-response);
}
 }
 
-- 
2.5.0

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


[PATCH 03/16] staging: unisys: Fix NULL comparison vbusdeviceinfo.h

2016-01-29 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patches resolves the NULL comparison checkpatch warnings

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/vbusdeviceinfo.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h 
b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
index f59fd8a..3216975 100644
--- a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
+++ b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
@@ -62,7 +62,7 @@ vbuschannel_sanitize_buffer(char *p, int remain, char *src, 
int srcmax)
p++;
remain--;
chars++;
-   } else if (p == NULL) {
+   } else if (!p) {
chars++;
}
nonprintable_streak = 0;
@@ -72,7 +72,7 @@ vbuschannel_sanitize_buffer(char *p, int remain, char *src, 
int srcmax)
p++;
remain--;
chars++;
-   } else if (p == NULL) {
+   } else if (!p) {
chars++;
}
} else {
-- 
2.5.0

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


[PATCH 04/16] staging: unisys: fix trailing comment in vbusdeviceinfo.h

2016-01-29 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

Fixes checkpatch trailing */ comment in vbusdeviceinfo.h

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/vbusdeviceinfo.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h 
b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
index 3216975..abdab4a 100644
--- a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
+++ b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
@@ -124,7 +124,8 @@ vbuschannel_itoa(char *p, int remain, int num)
}
if (remain < digits) {
/* not enough room left at  to hold number, so fill with
-* '?' */
+* '?'
+*/
for (i = 0; i < remain; i++, p++)
*p = '?';
return remain;
-- 
2.5.0

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


[PATCH] staging: unisys: Only process up to budget amount of responses

2016-01-15 Thread Benjamin Romer
From: David Kershner <david.kersh...@unisys.com>

>From napi documentation you should only process the amount your
budget allows, if you go over it just wait for the next napi poll
to continue.

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index 0519470..2d51299 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -36,6 +36,7 @@
  * = 163840 bytes
  */
 #define MAX_BUF 163840
+#define NAPI_WEIGHT 64
 
 static int visornic_probe(struct visor_device *dev);
 static void visornic_remove(struct visor_device *dev);
@@ -1613,14 +1614,12 @@ drain_resp_queue(struct uiscmdrsp *cmdrsp, struct 
visornic_devdata *devdata)
  */
 static void
 service_resp_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata,
-  int *rx_work_done)
+  int *rx_work_done, int budget)
 {
unsigned long flags;
struct net_device *netdev;
 
-   /* TODO: CLIENT ACQUIRE -- Don't really need this at the
-* moment */
-   for (;;) {
+   while (*rx_work_done < budget) {
if (!visorchannel_signalremove(devdata->dev->visorchannel,
   IOCHAN_FROM_IOPART,
   cmdrsp))
@@ -1709,7 +1708,7 @@ static int visornic_poll(struct napi_struct *napi, int 
budget)
int rx_count = 0;
 
send_rcv_posts_if_needed(devdata);
-   service_resp_queue(devdata->cmdrsp, devdata, _count);
+   service_resp_queue(devdata->cmdrsp, devdata, _count, budget);
 
/*
 * If there aren't any more packets to receive
@@ -1893,6 +1892,16 @@ static int visornic_probe(struct visor_device *dev)
goto cleanup_napi_add;
}
 
+   /* Let's start our threads to get responses */
+   netif_napi_add(netdev, >napi, visornic_poll, NAPI_WEIGHT);
+
+   /*
+* Note: Interupts have to be enable before the while
+* loop below because the napi routine is responsible for
+* setting enab_dis_acked
+*/
+   visorbus_enable_channel_interrupts(dev);
+
err = register_netdev(netdev);
if (err) {
dev_err(>device,
-- 
2.5.0

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


[PATCH] staging: unisys: fix parenthesis in toolaction_show()

2015-12-07 Thread Benjamin Romer
Fix the only fixable parenthesis alignment issue in
visorchipset.c. The rest are unworkable because of the length
of the symbol names used.

Signed-off-by: Benjamin Romer <benjamin.ro...@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 7208618..775f53f 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -534,8 +534,8 @@ static ssize_t toolaction_show(struct device *dev,
u8 tool_action;
 
visorchannel_read(controlvm_channel,
-   offsetof(struct spar_controlvm_channel_protocol,
-tool_action), _action, sizeof(u8));
+ offsetof(struct spar_controlvm_channel_protocol,
+  tool_action), _action, sizeof(u8));
return scnprintf(buf, PAGE_SIZE, "%u\n", tool_action);
 }
 
-- 
2.5.0

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


[PATCH] staging: unisys: remove unnecessary goto

2015-12-07 Thread Benjamin Romer
parser_param_start() had a goto Away, which went to nothing but
a return statement. Remove the goto, the CamelCased label, and
just return directly.

Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 5535073..7208618 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -461,7 +461,8 @@ parser_param_start(struct parser_context *ctx,
struct spar_controlvm_parameters_header *phdr = NULL;
 
if (!ctx)
-   goto Away;
+   return;
+
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
switch (which_string) {
case PARSERSTRING_INITIATOR:
@@ -483,9 +484,6 @@ parser_param_start(struct parser_context *ctx,
default:
break;
}
-
-Away:
-   return;
 }
 
 static void parser_done(struct parser_context *ctx)
-- 
2.5.0

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


[PATCH 02/15] staging: unisys: fix comments for controlvmchannel.h

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch simply fixes all trailing */ by modifying the comments
structures while trying to reduce the total number of lines

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/controlvmchannel.h | 237 +++--
 1 file changed, 119 insertions(+), 118 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/controlvmchannel.h 
b/drivers/staging/unisys/visorbus/controlvmchannel.h
index ec25366..03e36fb 100644
--- a/drivers/staging/unisys/visorbus/controlvmchannel.h
+++ b/drivers/staging/unisys/visorbus/controlvmchannel.h
@@ -55,22 +55,25 @@
 #define CONTROLVM_CRASHMSG_MAX 2
 
 struct spar_segment_state  {
-   u16 enabled:1;  /* Bit 0: May enter other states */
-   u16 active:1;   /* Bit 1: Assigned to active partition */
-   u16 alive:1;/* Bit 2: Configure message sent to
-* service/server */
-   u16 revoked:1;  /* Bit 3: similar to partition state
-* ShuttingDown */
-   u16 allocated:1;/* Bit 4: memory (device/port number)
-* has been selected by Command */
-   u16 known:1;/* Bit 5: has been introduced to the
-* service/guest partition */
-   u16 ready:1;/* Bit 6: service/Guest partition has
-* responded to introduction */
-   u16 operating:1;/* Bit 7: resource is configured and
-* operating */
-   /* Note: don't use high bit unless we need to switch to ushort
-* which is non-compliant */
+   /* Bit 0: May enter other states */
+   u16 enabled:1;
+   /* Bit 1: Assigned to active partition */
+   u16 active:1;
+   /* Bit 2: Configure message sent to service/server */
+   u16 alive:1;
+   /* Bit 3: similar to partition state ShuttingDown */
+   u16 revoked:1;
+   /* Bit 4: memory (device/port number) has been selected by Command */
+   u16 allocated:1;
+   /* Bit 5: has been introduced to the service/guest partition */
+   u16 known:1;
+   /* Bit 6: service/Guest partition has responded to introduction */
+   u16 ready:1;
+   /* Bit 7: resource is configured and operating */
+   u16 operating:1;
+/* Note: don't use high bit unless we need to switch to ushort
+ * which is non-compliant
+ */
 };
 
 static const struct spar_segment_state segment_state_running = {
@@ -177,53 +180,53 @@ struct controlvm_message_header  {
/* For requests, indicates the message type. */
/* For responses, indicates the type of message we are responding to. */
 
-   u32 message_size;   /* Includes size of this struct + size
-* of message */
-   u32 segment_index;  /* Index of segment containing Vm
-* message/information */
-   u32 completion_status;  /* Error status code or result of
-* message completion */
+   /* Includes size of this struct + size of message */
+   u32 message_size;
+   /* Index of segment containing Vm message/information */
+   u32 segment_index;
+   /* Error status code or result of  message completion */
+   u32 completion_status;
struct  {
-   u32 failed:1;  /* =1 in a response to * signify
-   * failure */
-   u32 response_expected:1;   /* =1 in all messages that expect a
-   * response (Control ignores this
-   * bit) */
-   u32 server:1;  /* =1 in all bus & device-related
-   * messages where the message
-   * receiver is to act as the bus or
-   * device server */
-   u32 test_message:1;/* =1 for testing use only
-   * (Control and Command ignore this
-   * bit) */
-   u32 partial_completion:1;  /* =1 if there are forthcoming
-   * responses/acks associated
-   * with this message */
-   u32 preserve:1;/* =1 this is to let us know to
-   * preserve channel contents
-   * (for running guests)*/
-   u32 writer_in_diag:1;  /* =1 the DiagWriter is active in the
-   * Diagnostic Partition*/
+   /* =1 in a response to signify failure 

[PATCH 11/15] staging: unisys: fix block comments in ultrainputreport.h

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 .../staging/unisys/visorinput/ultrainputreport.h   | 45 +-
 1 file changed, 26 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/ultrainputreport.h 
b/drivers/staging/unisys/visorinput/ultrainputreport.h
index 3e6a52f..1bc3d20 100644
--- a/drivers/staging/unisys/visorinput/ultrainputreport.h
+++ b/drivers/staging/unisys/visorinput/ultrainputreport.h
@@ -29,33 +29,40 @@ enum ultra_inputaction {
inputaction_mouse_button_up = 3, /* arg1: 1=left,2=center,3=right */
inputaction_mouse_button_click = 4, /* arg1: 1=left,2=center,3=right */
inputaction_mouse_button_dclick = 5, /* arg1: 1=left,2=center,
-   3=right */
+ * 3=right
+ */
inputaction_wheel_rotate_away = 6, /* arg1: wheel rotation away from
- user */
+   * user
+   */
inputaction_wheel_rotate_toward = 7, /* arg1: wheel rotation toward
-   user */
+ * user
+ */
inputaction_set_max_xy = 8, /* set screen maxXY; arg1=x, arg2=y */
inputaction_key_down = 64,  /* arg1: scancode, as follows:
-  If arg1 <= 0xff, it's a 1-byte
-  scancode and arg1 is that scancode.
-  If arg1 > 0xff, it's a 2-byte
-  scanecode, with the 1st byte in the
-  low 8 bits, and the 2nd byte in the
-  high 8 bits.  E.g., the right ALT key
-  would appear as x'38e0'. */
+* If arg1 <= 0xff, it's a 1-byte
+* scancode and arg1 is that scancode.
+* If arg1 > 0xff, it's a 2-byte
+* scanecode, with the 1st byte in the
+* low 8 bits, and the 2nd byte in the
+* high 8 bits.  E.g., the right ALT key
+* would appear as x'38e0'.
+*/
inputaction_key_up = 65,/* arg1: scancode (in same format as
-  inputaction_keyDown) */
+* inputaction_keyDown)
+*/
inputaction_set_locking_key_state = 66,
/* arg1: scancode (in same format
-as inputaction_keyDown);
-MUST refer to one of the
-locking keys, like capslock,
-numlock, or scrolllock
-  arg2: 1 iff locking key should be
-in the LOCKED position
-(e.g., light is ON) */
+*   as inputaction_keyDown);
+*   MUST refer to one of the
+*   locking keys, like capslock,
+*   numlock, or scrolllock
+* arg2: 1 iff locking key should be
+*   in the LOCKED position
+*   (e.g., light is ON)
+*/
inputaction_key_down_up = 67,   /* arg1: scancode (in same format
-as inputaction_keyDown) */
+*   as inputaction_keyDown)
+*/
inputaction_last
 };
 
-- 
2.5.0

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


[PATCH 06/15] staging: unisys: fix spacing in visorchipset.c

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following checkpatch warning:
spaces preferred around that ‘*’ or ‘|’

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index fb56258..8347ccd 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -43,11 +43,10 @@
 #define POLLJIFFIES_CONTROLVMCHANNEL_FAST   1
 #define POLLJIFFIES_CONTROLVMCHANNEL_SLOW 100
 
-#define MAX_CONTROLVM_PAYLOAD_BYTES (1024*128)
+#define MAX_CONTROLVM_PAYLOAD_BYTES (1024 * 128)
 
 #define VISORCHIPSET_MMAP_CONTROLCHANOFFSET0x
 
-
 #define UNISYS_SPAR_LEAF_ID 0x4000
 
 /* The s-Par leaf ID returns "UnisysSpar64" encoded across ebx, ecx, edx */
@@ -379,7 +378,7 @@ parser_init_byte_stream(u64 addr, u32 bytes, bool local, 
bool *retry)
rc = NULL;
goto cleanup;
}
-   ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY);
+   ctx = kzalloc(allocbytes, GFP_KERNEL | __GFP_NORETRY);
if (!ctx) {
if (retry)
*retry = true;
@@ -522,8 +521,8 @@ parser_string_get(struct parser_context *ctx)
}
if (value_length < 0)   /* '\0' was not included in the length */
value_length = nscan;
-   value = kmalloc(value_length + 1, GFP_KERNEL|__GFP_NORETRY);
-   if (value == NULL)
+   value = kmalloc(value_length + 1, GFP_KERNEL | __GFP_NORETRY);
+   if (!value)
return NULL;
if (value_length > 0)
memcpy(value, pscan, value_length);
-- 
2.5.0

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


[PATCH 13/15] staging: unisys: fix else statement in visornic_main.c

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
else is not generally useful after a break or return

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index d50dc4b..0b305e5 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -376,8 +376,8 @@ visornic_serverdown(struct visornic_devdata *devdata,
__func__);
spin_unlock_irqrestore(>priv_lock, flags);
return -EINVAL;
-   } else
-   spin_unlock_irqrestore(>priv_lock, flags);
+   }
+   spin_unlock_irqrestore(>priv_lock, flags);
return 0;
 }
 
-- 
2.5.0

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


[PATCH 01/15] staging: unisys: Fix guestlinuxdebug.h comments

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch simply cleans up all checkpatch comment issues

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/include/guestlinuxdebug.h | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/include/guestlinuxdebug.h 
b/drivers/staging/unisys/include/guestlinuxdebug.h
index 82ee565..b81287f 100644
--- a/drivers/staging/unisys/include/guestlinuxdebug.h
+++ b/drivers/staging/unisys/include/guestlinuxdebug.h
@@ -17,9 +17,10 @@
 #define __GUESTLINUXDEBUG_H__
 
 /*
-* This file contains supporting interface for "vmcallinterface.h", particularly
-* regarding adding additional structure and functionality to linux
-* ISSUE_IO_VMCALL_POSTCODE_SEVERITY */
+ * This file contains supporting interface for "vmcallinterface.h", 
particularly
+ * regarding adding additional structure and functionality to linux
+ * ISSUE_IO_VMCALL_POSTCODE_SEVERITY
+ */
 
 /*** INFO ON ISSUE_POSTCODE_LINUX() BELOW ***/
 enum driver_pc {   /* POSTCODE driver identifier tuples */
@@ -133,9 +134,9 @@ enum event_pc { /* POSTCODE event 
identifier tuples */
 
 #define POSTCODE_SEVERITY_ERR DIAG_SEVERITY_ERR
 #define POSTCODE_SEVERITY_WARNING DIAG_SEVERITY_WARNING
-#define POSTCODE_SEVERITY_INFO DIAG_SEVERITY_PRINT /* TODO-> Info currently
-* doesn't show, so we
-* set info=warning */
+/* TODO-> Info currently doesn't show, so we set info=warning */
+#define POSTCODE_SEVERITY_INFO DIAG_SEVERITY_PRINT
+
 /* example call of POSTCODE_LINUX_2(VISOR_CHIPSET_PC, POSTCODE_SEVERITY_ERR);
  * Please also note that the resulting postcode is in hex, so if you are
  * searching for the __LINE__ number, convert it first to decimal.  The line
-- 
2.5.0

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


[PATCH 00/15] staging: unisys: checkpatch cleanup series

2015-11-30 Thread Benjamin Romer
This set of patches cleans up all remaining checkpatch formatting warnings
in the Unisys driver series.

Erik Arfvidson (15):
  staging: unisys: Fix guestlinuxdebug.h comments
  staging: unisys: fix comments for controlvmchannel.h
  staging: unisys: Fix NULL comparison vbusdeviceinfo.h
  staging: unisys: fix trailing comment in vbusdeviceinfo.h
  staging: unisys: fix comments in visorchipset
  staging: unisys: fix spacing in visorchipset.c
  staging: unisys: fix comparison to NULL in visorchipset.c
  staging: unisys: fix blank lines in visorchipset.c
  staging: unisys: fix spaces after cast visorchipset.c
  staging: unisys: fix comments in visorbus_main.c
  staging: unisys: fix block comments in ultrainputreport.h
  staging: unisys: fix comments in visornic_main.c
  staging: unisys: fix else statement in visornic_main.c
  staging: unisys: fix alignment in visornic_main.c
  staging: unisys: fix blank line in visornic_main.c

 drivers/staging/unisys/include/guestlinuxdebug.h   |  13 +-
 drivers/staging/unisys/visorbus/controlvmchannel.h | 237 +++--
 drivers/staging/unisys/visorbus/vbusdeviceinfo.h   |   7 +-
 drivers/staging/unisys/visorbus/visorbus_main.c|   6 +-
 drivers/staging/unisys/visorbus/visorchipset.c |  46 ++--
 .../staging/unisys/visorinput/ultrainputreport.h   |  45 ++--
 drivers/staging/unisys/visornic/visornic_main.c|  31 +--
 7 files changed, 200 insertions(+), 185 deletions(-)

-- 
2.5.0

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


[PATCH 03/15] staging: unisys: Fix NULL comparison vbusdeviceinfo.h

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patches resolves the NULL comparison checkpatch warnings

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/vbusdeviceinfo.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h 
b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
index f59fd8a..3216975 100644
--- a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
+++ b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
@@ -62,7 +62,7 @@ vbuschannel_sanitize_buffer(char *p, int remain, char *src, 
int srcmax)
p++;
remain--;
chars++;
-   } else if (p == NULL) {
+   } else if (!p) {
chars++;
}
nonprintable_streak = 0;
@@ -72,7 +72,7 @@ vbuschannel_sanitize_buffer(char *p, int remain, char *src, 
int srcmax)
p++;
remain--;
chars++;
-   } else if (p == NULL) {
+   } else if (!p) {
chars++;
}
} else {
-- 
2.5.0

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


[PATCH 09/15] staging: unisys: fix spaces after cast visorchipset.c

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes checkpatch's no space is necessary after a cast

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 164fb7b..5535073 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -397,7 +397,7 @@ parser_init_byte_stream(u64 addr, u32 bytes, bool local, 
bool *retry)
rc = NULL;
goto cleanup;
}
-   p = __va((unsigned long) (addr));
+   p = __va((unsigned long)(addr));
memcpy(ctx->data, p, bytes);
} else {
void *mapping;
@@ -525,7 +525,7 @@ parser_string_get(struct parser_context *ctx)
return NULL;
if (value_length > 0)
memcpy(value, pscan, value_length);
-   ((u8 *) (value))[value_length] = '\0';
+   ((u8 *)(value))[value_length] = '\0';
return value;
 }
 
@@ -815,7 +815,7 @@ controlvm_init_response(struct controlvm_message *msg,
msg->hdr.payload_max_bytes = 0;
if (response < 0) {
msg->hdr.flags.failed = 1;
-   msg->hdr.completion_status = (u32) (-response);
+   msg->hdr.completion_status = (u32)(-response);
}
 }
 
-- 
2.5.0

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


[PATCH 04/15] staging: unisys: fix trailing comment in vbusdeviceinfo.h

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

Fixes checkpatch trailing */ comment in vbusdeviceinfo.h

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/vbusdeviceinfo.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h 
b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
index 3216975..abdab4a 100644
--- a/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
+++ b/drivers/staging/unisys/visorbus/vbusdeviceinfo.h
@@ -124,7 +124,8 @@ vbuschannel_itoa(char *p, int remain, int num)
}
if (remain < digits) {
/* not enough room left at  to hold number, so fill with
-* '?' */
+* '?'
+*/
for (i = 0; i < remain; i++, p++)
*p = '?';
return remain;
-- 
2.5.0

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


[PATCH 07/15] staging: unisys: fix comparison to NULL in visorchipset.c

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following type of check patch warnings:
Comparison to NULL could be written

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 8347ccd..fdfd1c4 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -438,7 +438,7 @@ parser_id_get(struct parser_context *ctx)
 {
struct spar_controlvm_parameters_header *phdr = NULL;
 
-   if (ctx == NULL)
+   if (!ctx)
return NULL_UUID_LE;
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
return phdr->id;
@@ -461,7 +461,7 @@ parser_param_start(struct parser_context *ctx,
 {
struct spar_controlvm_parameters_header *phdr = NULL;
 
-   if (ctx == NULL)
+   if (!ctx)
goto Away;
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
switch (which_string) {
@@ -875,7 +875,7 @@ bus_responder(enum controlvm_id cmd_id,
  struct controlvm_message_header *pending_msg_hdr,
  int response)
 {
-   if (pending_msg_hdr == NULL)
+   if (!pending_msg_hdr)
return; /* no controlvm response needed */
 
if (pending_msg_hdr->id != (u32)cmd_id)
@@ -893,7 +893,7 @@ device_changestate_responder(enum controlvm_id cmd_id,
u32 bus_no = p->chipset_bus_no;
u32 dev_no = p->chipset_dev_no;
 
-   if (p->pending_msg_hdr == NULL)
+   if (!p->pending_msg_hdr)
return; /* no controlvm response needed */
if (p->pending_msg_hdr->id != cmd_id)
return;
@@ -914,7 +914,7 @@ device_responder(enum controlvm_id cmd_id,
 struct controlvm_message_header *pending_msg_hdr,
 int response)
 {
-   if (pending_msg_hdr == NULL)
+   if (!pending_msg_hdr)
return; /* no controlvm response needed */
 
if (pending_msg_hdr->id != (u32)cmd_id)
@@ -1180,7 +1180,7 @@ bus_configure(struct controlvm_message *inmsg,
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, bus_no,
 POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
-   } else if (bus_info->pending_msg_hdr != NULL) {
+   } else if (bus_info->pending_msg_hdr) {
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, bus_no,
 POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT;
-- 
2.5.0

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


[PATCH 08/15] staging: unisys: fix blank lines in visorchipset.c

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

this patch removes the following checkpatch warnings:
please use a blank line after …
Please don’t use multiple blank lines

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@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 fdfd1c4..164fb7b 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -353,7 +353,6 @@ static void controlvm_respond_physdev_changestate(
struct controlvm_message_header *msg_hdr, int response,
struct spar_segment_state state);
 
-
 static void parser_done(struct parser_context *ctx);
 
 static struct parser_context *
@@ -530,7 +529,6 @@ parser_string_get(struct parser_context *ctx)
return value;
 }
 
-
 static ssize_t toolaction_show(struct device *dev,
   struct device_attribute *attr,
   char *buf)
@@ -707,6 +705,7 @@ static int match_visorbus_dev_by_id(struct device *dev, 
void *data)
 
return 0;
 }
+
 struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no,
   struct visor_device *from)
 {
-- 
2.5.0

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


[PATCH 15/15] staging: unisys: fix blank line in visornic_main.c

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following type of check patch warning:
Blank lines aren't necessary before a close brace '}'

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index bf1fd93..77fd1ef 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -1746,7 +1746,6 @@ poll_for_irq(unsigned long v)
atomic_set(>interrupt_rcvd, 0);
 
mod_timer(>irq_poll_timer, msecs_to_jiffies(2));
-
 }
 
 /**
-- 
2.5.0

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


[PATCH 05/15] staging: unisys: fix comments in visorchipset

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes all the Block comments by using a trailing */
on a separate line

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchipset.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 07594f4..fb56258 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -86,8 +86,8 @@ visorchipset_release(struct inode *inode, struct file *file)
 */
 #define MIN_IDLE_SECONDS 10
 static unsigned long poll_jiffies = POLLJIFFIES_CONTROLVMCHANNEL_FAST;
-static unsigned long most_recent_message_jiffies;  /* when we got our last
-* controlvm message */
+/* when we got our last controlvm message */
+static unsigned long most_recent_message_jiffies;
 static int visorbusregistered;
 
 #define MAX_CHIPSET_EVENTS 2
@@ -120,7 +120,8 @@ static struct visorchannel *controlvm_channel;
 struct visor_controlvm_payload_info {
u8 *ptr;/* pointer to base address of payload pool */
u64 offset; /* offset from beginning of controlvm
-* channel to beginning of payload * pool */
+* channel to beginning of payload * pool
+*/
u32 bytes;  /* number of bytes in payload pool */
 };
 
@@ -184,7 +185,8 @@ struct putfile_request {
 * - this list is added to when controlvm messages come in that supply
 * file data
 * - this list is removed from via the hotplug program that is actually
-* consuming these buffers to write as file data */
+* consuming these buffers to write as file data
+*/
struct list_head input_buffer_list;
spinlock_t req_list_lock;   /* lock for input_buffer_list */
 
@@ -788,13 +790,15 @@ chipset_init(struct controlvm_message *inmsg)
POSTCODE_LINUX_2(CHIPSET_INIT_EXIT_PC, POSTCODE_SEVERITY_INFO);
 
/* Set features to indicate we support parahotplug (if Command
-* also supports it). */
+* also supports it).
+*/
features =
inmsg->cmd.init_chipset.
features & ULTRA_CHIPSET_FEATURE_PARA_HOTPLUG;
 
/* Set the "reply" bit so Command knows this is a
-* features-aware driver. */
+* features-aware driver.
+*/
features |= ULTRA_CHIPSET_FEATURE_REPLY;
 
 cleanup:
-- 
2.5.0

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


[PATCH 12/15] staging: unisys: fix comments in visornic_main.c

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index 296b11c..d50dc4b 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -1218,8 +1218,9 @@ visornic_rx(struct uiscmdrsp *cmdrsp)
/* length rcvd is greater than firstfrag in this skb rcv buf  */
skb->tail += RCVPOST_BUF_SIZE;  /* amount in skb->data */
skb->data_len = skb->len - RCVPOST_BUF_SIZE;/* amount that
-  will be in
-  frag_list */
+*  will be in
+* frag_list
+*/
} else {
/* data fits in this skb - no chaining - do
 * PRECAUTIONARY check
@@ -1315,12 +1316,14 @@ visornic_rx(struct uiscmdrsp *cmdrsp)
}
if (found_mc)
break;  /* accept packet, dest
-  matches a multicast
-  address */
+* matches a multicast
+* address
+*/
}
} else if (skb->pkt_type == PACKET_HOST) {
break;  /* accept packet, h_dest must match vnic
-  mac address */
+*  mac address
+*/
} else if (skb->pkt_type == PACKET_OTHERHOST) {
/* something is not right */
dev_err(>netdev->dev,
@@ -1619,7 +1622,8 @@ service_resp_queue(struct uiscmdrsp *cmdrsp, struct 
visornic_devdata *devdata,
struct net_device *netdev;
 
/* TODO: CLIENT ACQUIRE -- Don't really need this at the
-* moment */
+* moment
+*/
for (;;) {
if (!visorchannel_signalremove(devdata->dev->visorchannel,
   IOCHAN_FROM_IOPART,
-- 
2.5.0

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


[PATCH 14/15] staging: unisys: fix alignment in visornic_main.c

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
Alignment should match open parenthesis

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index 0b305e5..bf1fd93 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -437,8 +437,8 @@ post_skb(struct uiscmdrsp *cmdrsp,
cmdrsp->net.type = NET_RCV_POST;
cmdrsp->cmdtype = CMD_NET_TYPE;
if (visorchannel_signalinsert(devdata->dev->visorchannel,
- IOCHAN_TO_IOPART,
- cmdrsp)) {
+ IOCHAN_TO_IOPART,
+ cmdrsp)) {
atomic_inc(>num_rcvbuf_in_iovm);
devdata->chstat.sent_post++;
} else {
@@ -466,8 +466,8 @@ send_enbdis(struct net_device *netdev, int state,
devdata->cmdrsp_rcv->net.type = NET_RCV_ENBDIS;
devdata->cmdrsp_rcv->cmdtype = CMD_NET_TYPE;
if (visorchannel_signalinsert(devdata->dev->visorchannel,
- IOCHAN_TO_IOPART,
- devdata->cmdrsp_rcv))
+ IOCHAN_TO_IOPART,
+ devdata->cmdrsp_rcv))
devdata->chstat.sent_enbdis++;
 }
 
@@ -1651,7 +1651,7 @@ service_resp_queue(struct uiscmdrsp *cmdrsp, struct 
visornic_devdata *devdata,
 * netif_wake_queue()
 */
if (vnic_hit_low_watermark(devdata,
-   devdata->lower_threshold_net_xmits)) {
+   devdata->lower_threshold_net_xmits)) {
/* enough NET_XMITs completed
 * so can restart netif queue
 */
-- 
2.5.0

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


[PATCH 10/15] staging: unisys: fix comments in visorbus_main.c

2015-11-30 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
Block comments use a trailing */ on a separate line
Comment alignments

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index eac97d2..a301385 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -1371,9 +1371,9 @@ pause_state_change_complete(struct visor_device *dev, int 
status)
return;
 
/* Notify the chipset driver that the pause is complete, which
-   * will presumably want to send some sort of response to the
-   * initiator.
-   */
+* will presumably want to send some sort of response to the
+* initiator.
+*/
(*chipset_responders.device_pause) (dev, status);
 }
 
-- 
2.5.0

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


[PATCH] staging: unisys: better config switch comments

2015-11-24 Thread Benjamin Romer
We should provide more information in the Kconfig help for visorbus and
visorinput.

Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/Kconfig   | 7 ++-
 drivers/staging/unisys/visorinput/Kconfig | 7 ++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/Kconfig 
b/drivers/staging/unisys/visorbus/Kconfig
index 9b299ac..5113880 100644
--- a/drivers/staging/unisys/visorbus/Kconfig
+++ b/drivers/staging/unisys/visorbus/Kconfig
@@ -6,4 +6,9 @@ config UNISYS_VISORBUS
tristate "Unisys visorbus driver"
depends on UNISYSSPAR
---help---
-   If you say Y here, you will enable the Unisys visorbus driver.
+   The visorbus driver is a virtualized bus for the Unisys s-Par firmware.
+   Virtualized devices allow Linux guests on a system to share disks and
+   network cards that do not have SR-IOV support, and to be accessed using
+   the partition desktop application. The visorbus driver is required to
+   discover devices on an s-Par guest, and must be present for any other
+   s-Par guest driver to function correctly.
diff --git a/drivers/staging/unisys/visorinput/Kconfig 
b/drivers/staging/unisys/visorinput/Kconfig
index d83deb4..3476d41 100644
--- a/drivers/staging/unisys/visorinput/Kconfig
+++ b/drivers/staging/unisys/visorinput/Kconfig
@@ -6,5 +6,10 @@ config UNISYS_VISORINPUT
tristate "Unisys visorinput driver"
depends on UNISYSSPAR && UNISYS_VISORBUS && FB
---help---
-   If you say Y here, you will enable the Unisys visorinput driver.
+   The Unisys s-Par visorinput driver provides a virtualized system
+   console (keyboard and mouse) that is accessible through the
+   s-Par firmware's user interface. s-Par provides video using the EFI
+   GOP protocol, so If this driver is not present, the Linux guest should
+   still boot with visible output in the partition desktop, but keyboard
+   and mouse interaction will not be available.
 
-- 
2.5.0

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


[PATCH 08/14] staging: unisys: Add channel feature access functions

2015-11-17 Thread Benjamin Romer
From: David Kershner <david.kersh...@unisys.com>

Need access functions to set channel polling

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 55 +
 1 file changed, 55 insertions(+)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index 63e7863..4304ca0 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -977,6 +977,61 @@ visorbus_disable_channel_interrupts(struct visor_device 
*dev)
 }
 EXPORT_SYMBOL_GPL(visorbus_disable_channel_interrupts);
 
+int visorbus_set_channel_features(struct visor_device *dev, u64 feature_bits)
+{
+   int channel_offset = 0, err = 0;
+   u64 features;
+
+   channel_offset = offsetof(struct channel_header,
+ features);
+   err = visorbus_read_channel(dev, channel_offset, , 8);
+   if (err) {
+   dev_err(>device,
+   "%s failed to get features from chan (%d)\n",
+   __func__, err);
+   return err;
+   }
+
+   features |= (feature_bits);
+
+   err = visorbus_write_channel(dev, channel_offset, , 8);
+   if (err) {
+   dev_err(>device,
+   "%s failed to get features from chan (%d)\n",
+   __func__, err);
+   return err;
+   }
+   return err;
+}
+
+int visorbus_clear_channel_features(struct visor_device *dev, u64 feature_bits)
+{
+   int channel_offset = 0, err = 0;
+   u64 features, mask;
+
+   channel_offset = offsetof(struct channel_header,
+ features);
+   err = visorbus_read_channel(dev, channel_offset, , 8);
+   if (err) {
+   dev_err(>device,
+   "%s failed to get features from chan (%d)\n",
+   __func__, err);
+   return err;
+   }
+
+   mask = ~(feature_bits);
+   features &= mask;
+
+   err = visorbus_write_channel(dev, channel_offset, , 8);
+   if (err) {
+   dev_err(>device,
+   "%s failed to get features from chan (%d)\n",
+   __func__, err);
+   return err;
+   }
+   return err;
+}
+
 /** This is how everything starts from the device end.
  *  This function is called when a channel first appears via a ControlVM
  *  message.  In response, this function allocates a visor_device to
-- 
2.5.0

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


[PATCH 05/14] staging: unisys: visorinput: use spinlock for channel_interrupt() locking

2015-11-17 Thread Benjamin Romer
From: Tim Sell <timothy.s...@unisys.com>

Because visorinput_channel_interrupt() is now called from interrupt
context, we can't use our lock_visor_dev semaphore there.  Instead, we
use a new lock_isr spinlock, which is essentially needed to prevent
visorinput_dev from disappearing while we're accessing it in
visorinput_channel_interrupt().

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorinput/visorinput.c | 26 ++
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index 57193b3..1c2a210 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -102,6 +102,7 @@ struct visorinput_devdata {
struct visor_device *dev;
enum visorinput_device_type devtype;
struct rw_semaphore lock_visor_dev; /* lock for dev */
+   spinlock_t lock_isr; /* for data accessed in isr */
struct input_dev *visorinput_dev;
bool paused;
struct workqueue_struct *wq;
@@ -417,6 +418,7 @@ static void devdata_put(struct visorinput_devdata *devdata)
 
 static void async_change_resolution(struct work_struct *work)
 {
+   struct input_dev *visorinput_dev = NULL;
struct change_resolution_work *p_change_resolution_work =
container_of(work, struct change_resolution_work, work);
struct visorinput_devdata *devdata =
@@ -425,13 +427,20 @@ static void async_change_resolution(struct work_struct 
*work)
 change_resolution_work_data);
 
down_write(>lock_visor_dev);
+   spin_lock(>lock_isr);
 
-   if (devdata->paused) /* don't touch device/channel when paused */
-   goto out_locked;
-   if (!devdata->visorinput_dev)
-   goto out_locked;
+   /* devdata->visorinput_dev can only go NULL when lock_isr is held */
 
-   unregister_client_input(devdata->visorinput_dev);
+   if (devdata->paused || (!devdata->visorinput_dev)) {
+   spin_unlock(>lock_isr);
+   goto out;
+   }
+   visorinput_dev = devdata->visorinput_dev; /* can't unreg with lock */
+   devdata->visorinput_dev = NULL;
+
+   spin_unlock(>lock_isr);
+
+   unregister_client_input(visorinput_dev);
/*
 * input_set_abs_params is only effective prior to
 * input_register_device().
@@ -448,7 +457,7 @@ static void async_change_resolution(struct work_struct 
*work)
dev_info(>dev->device, "created mouse %s\n",
 dev_name(>visorinput_dev->dev));
 
-out_locked:
+out:
up_write(>lock_visor_dev);
devdata_put(devdata);  /* from schedule_mouse_resolution_change() */
 }
@@ -481,6 +490,7 @@ devdata_create(struct visor_device *dev, enum 
visorinput_device_type devtype)
INIT_WORK(>change_resolution_work_data.work,
  async_change_resolution);
init_rwsem(>lock_visor_dev);
+   spin_lock_init(>lock_isr);
down_write(>lock_visor_dev);
 
/*
@@ -665,7 +675,7 @@ visorinput_channel_interrupt(struct visor_device *dev)
if (!devdata)
return;
 
-   down_write(>lock_visor_dev);
+   spin_lock(>lock_isr);
if (devdata->paused) /* don't touch device/channel when paused */
goto out_locked;
 
@@ -771,7 +781,7 @@ visorinput_channel_interrupt(struct visor_device *dev)
}
 out_locked:
devdata_put(devdata);
-   up_write(>lock_visor_dev);
+   spin_unlock(>lock_isr);
 }
 
 static int
-- 
2.5.0

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


[PATCH 00/14] staging: unisys: add channel interrupt support

2015-11-17 Thread Benjamin Romer
This patch series adds a centralized infrastructure and device support
for channel interrupts sent to s-Par virtual devices. With these changes,
the visorhba device is ~80% faster than with only polling, and visornic
receives a speedup of over 3500% (from ~9Mb/s to between 360Mb/s and
390Mb/s).

David Kershner (13):
  staging: unisys: Change poll rate to 2 ms for work
  staging: unisys: set client state
  staging: unisys: visorhba: Convert visorhba to use visorbus channel
interrupts.
  staging: unisys: Convert visornic to use visorbus channel interrupt
code
  staging: unisys: Only process up to budget amount of responses
  staging: unisys: Add support to update Features bits in channel queues
  staging: unisys: Add channel feature access functions
  staging: unisys: Re-enable interrupts after we have done the work
  staging: unisys: Capture data from device create to register
interrupt.
  staging: unisys: Don't go into POLLING mode in visornic_probe.
  staging: unisys: Don't set polling mode in visorhba_probe
  staging: unisys: Remove semaphores around channel interrupts.
  staging: unisys: Allow for unregistering of interrupts.

Tim Sell (1):
  staging: unisys: visorinput: use spinlock for channel_interrupt()
locking

 drivers/staging/unisys/include/visorbus.h   |  13 ++
 drivers/staging/unisys/visorbus/visorbus_main.c | 259 +++-
 drivers/staging/unisys/visorbus/visorchannel.c  |  47 +
 drivers/staging/unisys/visorbus/visorchipset.c  |  17 +-
 drivers/staging/unisys/visorhba/visorhba_main.c | 138 ++---
 drivers/staging/unisys/visorinput/visorinput.c  |  31 ++-
 drivers/staging/unisys/visornic/visornic_main.c |  74 +++
 7 files changed, 437 insertions(+), 142 deletions(-)

-- 
2.5.0

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


[PATCH 03/14] staging: unisys: visorhba: Convert visorhba to use visorbus channel interrupts.

2015-11-17 Thread Benjamin Romer
From: David Kershner <david.kersh...@unisys.com>

Use a tasklet to process the response queue from the IO Service
Partition instead of using a thread. Register with visorbus to have it
issue either "soft" interrupts or "s-Par" interrupts depending on
registration values from the create message.

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorhba/visorhba_main.c | 114 +++-
 1 file changed, 52 insertions(+), 62 deletions(-)

diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c 
b/drivers/staging/unisys/visorhba/visorhba_main.c
index c119f20..70bc878 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -66,23 +67,6 @@ static struct visor_channeltype_descriptor 
visorhba_channel_types[] = {
{ NULL_UUID_LE, NULL }
 };
 
-/* This is used to tell the visor bus driver which types of visor devices
- * we support, and what functions to call when a visor device that we support
- * is attached or removed.
- */
-static struct visor_driver visorhba_driver = {
-   .name = "visorhba",
-   .owner = THIS_MODULE,
-   .channel_types = visorhba_channel_types,
-   .probe = visorhba_probe,
-   .remove = visorhba_remove,
-   .pause = visorhba_pause,
-   .resume = visorhba_resume,
-   .channel_interrupt = NULL,
-};
-MODULE_DEVICE_TABLE(visorbus, visorhba_channel_types);
-MODULE_ALIAS("visorbus:" SPAR_VHBA_CHANNEL_PROTOCOL_UUID_STR);
-
 struct visor_thread_info {
struct task_struct *task;
struct completion has_stopped;
@@ -137,8 +121,42 @@ struct visorhba_devdata {
int devnum;
struct visor_thread_info threadinfo;
int thread_wait_ms;
+   struct tasklet_struct tasklet;
+};
+
+/**visorhba_isr - function to handle interrupts from visorbus
+ * @dev: device that received interrupt, could be shared
+ *
+ * Interrupts from visorbus are processed here. Since the IOVM
+ * sends us "real" interrupts, we are interrupt context here, so
+ * we need to schedule the work (if any). Note: Interrupts might
+ * be shared between devices.
+ */
+static void visorhba_isr(struct visor_device *dev)
+{
+   struct visorhba_devdata *devdata = dev_get_drvdata(>device);
+
+   tasklet_schedule(>tasklet);
+}
+
+/* This is used to tell the visor bus driver which types of visor devices
+ * we support, and what functions to call when a visor device that we support
+ * is attached or removed.
+ */
+static struct visor_driver visorhba_driver = {
+   .name = "visorhba",
+   .owner = THIS_MODULE,
+   .channel_types = visorhba_channel_types,
+   .probe = visorhba_probe,
+   .remove = visorhba_remove,
+   .pause = visorhba_pause,
+   .resume = visorhba_resume,
+   .channel_interrupt = visorhba_isr,
 };
 
+MODULE_DEVICE_TABLE(visorbus, visorhba_channel_types);
+MODULE_ALIAS("visorbus:" SPAR_VHBA_CHANNEL_PROTOCOL_UUID_STR);
+
 struct visorhba_devices_open {
struct visorhba_devdata *devdata;
 };
@@ -150,31 +168,6 @@ static struct visorhba_devices_open 
visorhbas_open[VISORHBA_OPEN_MAX];
if ((iter->channel == match->channel) &&  \
(iter->id == match->id) &&\
(iter->lun == match->lun))
-/**
- * visor_thread_start - starts a thread for the device
- * @thrinfo: The thread to start
- * @threadfn: Function the thread starts
- * @thrcontext: Context to pass to the thread, i.e. devdata
- * @name: string describing name of thread
- *
- * Starts a thread for the device.
- *
- * Return 0 on success;
- */
-static int visor_thread_start(struct visor_thread_info *thrinfo,
- int (*threadfn)(void *),
- void *thrcontext, char *name)
-{
-   /* used to stop the thread */
-   init_completion(>has_stopped);
-   thrinfo->task = kthread_run(threadfn, thrcontext, name);
-   if (IS_ERR(thrinfo->task)) {
-   thrinfo->id = 0;
-   return PTR_ERR(thrinfo->task);
-   }
-   thrinfo->id = thrinfo->task->pid;
-   return 0;
-}
 
 /**
  * add_scsipending_entry - save off io command that is pending in
@@ -684,10 +677,11 @@ static void visorhba_serverdown_complete(struct 
visorhba_devdata *devdata)
struct uiscmdrsp *cmdrsp;
unsigned long flags;
 
+   visorbus_disable_channel_interrupts(devdata->dev);
/* Stop using the IOVM response queue (queue should be drained
 * by the end)
 */
-   kthread_stop(devdata->threadinfo.task);
+   tasklet_d

[PATCH 01/14] staging: unisys: Change poll rate to 2 ms for work

2015-11-17 Thread Benjamin Romer
From: David Kershner <david.kersh...@unisys.com>

Use ms_to_jiffies for the periodic work queue instead of raw jiffies.

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index a272b48..1fa6e5b 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -34,8 +34,8 @@ static int visorbus_debugref;
 #define SERIALLOOPBACKCHANADDR (100 * 1024 * 1024)
 
 #define CURRENT_FILE_PC VISOR_BUS_PC_visorbus_main_c
-#define POLLJIFFIES_TESTWORK 100
-#define POLLJIFFIES_NORMALCHANNEL 10
+#define POLLJIFFIES_TESTWORK msecs_to_jiffies(100)
+#define POLLJIFFIES_NORMALCHANNEL msecs_to_jiffies(2)
 
 static int busreg_rc = -ENODEV; /* stores the result from bus registration */
 
-- 
2.5.0

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


[PATCH 06/14] staging: unisys: Only process up to budget amount of responses

2015-11-17 Thread Benjamin Romer
From: David Kershner <david.kersh...@unisys.com>

>From napi documentation you should only process the amount your
budget allows, if you go over it just wait for the next napi poll
to continue.

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index 9bf5bfd..9566b91 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -36,6 +36,7 @@
  * = 163840 bytes
  */
 #define MAX_BUF 163840
+#define NAPI_WEIGHT 64
 
 static int visornic_probe(struct visor_device *dev);
 static void visornic_remove(struct visor_device *dev);
@@ -1611,12 +1612,12 @@ drain_resp_queue(struct uiscmdrsp *cmdrsp, struct 
visornic_devdata *devdata)
  */
 static void
 service_resp_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata,
-  int *rx_work_done)
+  int *rx_work_done, int budget)
 {
unsigned long flags;
struct net_device *netdev;
 
-   for (;;) {
+   while (*rx_work_done < budget) {
if (!visorchannel_signalremove(devdata->dev->visorchannel,
   IOCHAN_FROM_IOPART,
   cmdrsp))
@@ -1705,7 +1706,7 @@ static int visornic_poll(struct napi_struct *napi, int 
budget)
int rx_count = 0;
 
send_rcv_posts_if_needed(devdata);
-   service_resp_queue(devdata->cmdrsp, devdata, _count);
+   service_resp_queue(devdata->cmdrsp, devdata, _count, budget);
 
/*
 * If there aren't any more packets to receive
@@ -1872,7 +1873,7 @@ static int visornic_probe(struct visor_device *dev)
}
 
/* Let's start our threads to get responses */
-   netif_napi_add(netdev, >napi, visornic_poll, 64);
+   netif_napi_add(netdev, >napi, visornic_poll, NAPI_WEIGHT);
 
/*
 * Note: Interupts have to be enable before the while
-- 
2.5.0

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


[PATCH 02/14] staging: unisys: set client state

2015-11-17 Thread Benjamin Romer
From: David Kershner <david.kersh...@unisys.com>

Every channel has an s-Par channel state associated with it. This patch
correctly sets of the channels.

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 32 -
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index 1fa6e5b..63e7863 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -747,6 +747,23 @@ dev_stop_periodic_work(struct visor_device *dev)
put_device(>device);
 }
 
+int visorbus_set_channel_state(struct visor_device *dev, u32 cli_state)
+{
+   int channel_offset = 0, err = 0;
+
+   channel_offset = offsetof(struct channel_header, cli_state_os);
+
+   err = visorbus_write_channel(dev, channel_offset, _state, 4);
+   if (err) {
+   dev_err(>device,
+   "%s failed to set client_state_os from chan (%d)\n",
+   __func__, err);
+   return err;
+   }
+
+   return err;
+}
+
 /** This is called automatically upon adding a visor_device (device_add), or
  *  adding a visor_driver (visorbus_register_visor_driver), but only after
  *  visorbus_match has returned 1 to indicate a successful match between
@@ -769,6 +786,7 @@ visordriver_probe_device(struct device *xdev)
 */
wmb();
get_device(>device);
+   visorbus_set_channel_state(dev, CHANNELCLI_OWNED);
if (!drv->probe) {
up(>visordriver_callback_lock);
rc = -1;
@@ -782,8 +800,10 @@ visordriver_probe_device(struct device *xdev)
up(>visordriver_callback_lock);
rc = 0;
 away:
-   if (rc != 0)
+   if (rc != 0) {
+   visorbus_set_channel_state(dev, CHANNELCLI_ATTACHED);
put_device(>device);
+   }
return rc;
 }
 
@@ -814,6 +834,7 @@ visordriver_remove_device(struct device *xdev)
dev_stop_periodic_work(dev);
devmajorminor_remove_all_files(dev);
 
+   visorbus_set_channel_state(dev, CHANNELCLI_ATTACHED);
put_device(>device);
 
return 0;
@@ -1036,6 +1057,8 @@ create_visor_device(struct visor_device *dev)
}
 
list_add_tail(>list_all, _all_device_instances);
+
+   visorbus_set_channel_state(dev, CHANNELCLI_ATTACHED);
return 0;
 
 away_register:
@@ -1388,6 +1411,9 @@ resume_state_change_complete(struct visor_device *dev, 
int status)
if (!chipset_responders.device_resume) /* this can never happen! */
return;
 
+   if (status < 0)
+   visorbus_set_channel_state(dev, CHANNELCLI_ATTACHED);
+
/* Notify the chipset driver that the resume is complete,
 * which will presumably want to send some sort of response to
 * the initiator. */
@@ -1409,6 +1435,7 @@ initiate_chipset_device_pause_resume(struct visor_device 
*dev, bool is_pause)
notify_func = chipset_responders.device_pause;
else
notify_func = chipset_responders.device_resume;
+
if (!notify_func)
goto away;
 
@@ -1443,6 +1470,7 @@ initiate_chipset_device_pause_resume(struct visor_device 
*dev, bool is_pause)
goto away;
 
dev->resuming = true;
+   visorbus_set_channel_state(dev, CHANNELCLI_OWNED);
x = drv->resume(dev, resume_state_change_complete);
}
if (x < 0) {
@@ -1455,6 +1483,8 @@ initiate_chipset_device_pause_resume(struct visor_device 
*dev, bool is_pause)
rc = 0;
 away:
if (rc < 0) {
+   if (!is_pause)
+   visorbus_set_channel_state(dev, CHANNELCLI_ATTACHED);
if (notify_func)
(*notify_func)(dev, rc);
}
-- 
2.5.0

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


[PATCH 04/14] staging: unisys: Convert visornic to use visorbus channel interrupt code

2015-11-17 Thread Benjamin Romer
From: David Kershner <david.kersh...@unisys.com>

Instead of having our own timer to set off a interrupt, use the shared code
from visorbus. When visorbus gets s-Par interrupts working we will
automatically get support from it.

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 59 +
 1 file changed, 21 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index 296b11c..9bf5bfd 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -43,6 +43,7 @@ static int visornic_pause(struct visor_device *dev,
  visorbus_state_complete_func complete_func);
 static int visornic_resume(struct visor_device *dev,
   visorbus_state_complete_func complete_func);
+static void visornic_irq(struct visor_device *v);
 
 /* DEBUGFS declarations */
 static ssize_t info_debugfs_read(struct file *file, char __user *buf,
@@ -92,7 +93,7 @@ static struct visor_driver visornic_driver = {
.remove = visornic_remove,
.pause = visornic_pause,
.resume = visornic_resume,
-   .channel_interrupt = NULL,
+   .channel_interrupt = visornic_irq,
 };
 
 struct chanstat {
@@ -117,7 +118,6 @@ struct visornic_devdata {
struct visor_device *dev;
struct net_device *netdev;
struct net_device_stats net_stats;
-   atomic_t interrupt_rcvd;
wait_queue_head_t rsp_queue;
struct sk_buff **rcvbuf;
u64 incarnation_id; /* lets IOPART know about re-birth */
@@ -190,13 +190,11 @@ struct visornic_devdata {
 
int queuefullmsg_logged;
struct chanstat chstat;
-   struct timer_list irq_poll_timer;
struct napi_struct napi;
struct uiscmdrsp cmdrsp[SIZEOF_CMDRSP];
 };
 
 static int visornic_poll(struct napi_struct *napi, int budget);
-static void poll_for_irq(unsigned long v);
 
 /**
  * visor_copy_fragsinfo_from_skb(
@@ -326,7 +324,7 @@ visornic_serverdown_complete(struct visornic_devdata 
*devdata)
netdev = devdata->netdev;
 
/* Stop polling for interrupts */
-   del_timer_sync(>irq_poll_timer);
+   visorbus_disable_channel_interrupts(devdata->dev);
 
rtnl_lock();
dev_close(netdev);
@@ -1618,8 +1616,6 @@ service_resp_queue(struct uiscmdrsp *cmdrsp, struct 
visornic_devdata *devdata,
unsigned long flags;
struct net_device *netdev;
 
-   /* TODO: CLIENT ACQUIRE -- Don't really need this at the
-* moment */
for (;;) {
if (!visorchannel_signalremove(devdata->dev->visorchannel,
   IOCHAN_FROM_IOPART,
@@ -1722,7 +1718,7 @@ static int visornic_poll(struct napi_struct *napi, int 
budget)
 }
 
 /**
- * poll_for_irq- Checks the status of the response queue.
+ * visornic_irq- Checks the status of the response queue.
  * @v: void pointer to the visronic devdata
  *
  * Main function of the vnic_incoming thread. Peridocially check the
@@ -1730,19 +1726,13 @@ static int visornic_poll(struct napi_struct *napi, int 
budget)
  * Returns when thread has stopped.
  */
 static void
-poll_for_irq(unsigned long v)
+visornic_irq(struct visor_device *v)
 {
-   struct visornic_devdata *devdata = (struct visornic_devdata *)v;
+   struct visornic_devdata *devdata = dev_get_drvdata(>device);
 
-   if (!visorchannel_signalempty(
-  devdata->dev->visorchannel,
-  IOCHAN_FROM_IOPART))
+   if (!visorchannel_signalempty(devdata->dev->visorchannel,
+ IOCHAN_FROM_IOPART))
napi_schedule(>napi);
-
-   atomic_set(>interrupt_rcvd, 0);
-
-   mod_timer(>irq_poll_timer, msecs_to_jiffies(2));
-
 }
 
 /**
@@ -1861,19 +1851,6 @@ static int visornic_probe(struct visor_device *dev)
goto cleanup_xmit_cmdrsp;
}
 
-   /* TODO: Setup Interrupt information */
-   /* Let's start our threads to get responses */
-   netif_napi_add(netdev, >napi, visornic_poll, 64);
-
-   setup_timer(>irq_poll_timer, poll_for_irq,
-   (unsigned long)devdata);
-   /*
-* Note: This time has to start running before the while
-* loop below because the napi routine is responsible for
-* setting enab_dis_acked
-*/
-   mod_timer(>irq_poll_timer, msecs_to_jiffies(2));
-
channel_offset = offsetof(struct spar_io_channel_protocol,
  channel_header.features);
err = visorbus_read_channel(dev, channel_offset, , 8);
@@ -1894,6 +1871,16 @@ static int visornic_pro

[PATCH 10/14] staging: unisys: Capture data from device create to register interrupt.

2015-11-17 Thread Benjamin Romer
From: David Kershner <david.kersh...@unisys.com>

s-Par Firmware sends a CREATE_DEVICE information for each device that
gets created. Contained in the CREATE_DEVICE is the GSI interrupt vector
we should request an interrupt on. Save off that information and when
the client driver asks to register for interrupt, register the gsi
number and then request the irq based off that information.

When an interrupt happens, update the flag to inform IO Service Partition
and call the channel_interrupt function. Update the flag in the rearm
function to accept another interrupt.

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Tim Sell <timothy.s...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/include/visorbus.h   |   5 +
 drivers/staging/unisys/visorbus/visorbus_main.c | 118 ++--
 drivers/staging/unisys/visorbus/visorchannel.c  |   1 +
 drivers/staging/unisys/visorbus/visorchipset.c  |  17 +++-
 drivers/staging/unisys/visorhba/visorhba_main.c |   4 +
 drivers/staging/unisys/visornic/visornic_main.c |   5 +-
 6 files changed, 137 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h 
b/drivers/staging/unisys/include/visorbus.h
index 5f44289..e2251f7 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -159,6 +159,9 @@ struct visor_device {
u32 switch_no;
u32 internal_port_no;
uuid_le partition_uuid;
+   int irq;
+   int wait_ms;
+   int recv_queue; /* specifies which queue to receive msgs on */
 };
 
 #define to_visor_device(x) container_of(x, struct visor_device, device)
@@ -176,6 +179,8 @@ int visorbus_clear_channel(struct visor_device *dev,
   unsigned long offset, u8 ch, unsigned long nbytes);
 int visorbus_registerdevnode(struct visor_device *dev,
 const char *name, int major, int minor);
+int visorbus_register_for_channel_interrupts(struct visor_device *dev,
+u32 queue);
 void visorbus_enable_channel_interrupts(struct visor_device *dev);
 void visorbus_disable_channel_interrupts(struct visor_device *dev);
 void visorbus_rearm_channel_interrupts(struct visor_device *dev);
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index afbb9bc..a45c6a2 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -14,6 +14,8 @@
  * details.
  */
 
+#include 
+#include 
 #include 
 
 #include "visorbus.h"
@@ -715,13 +717,6 @@ unregister_driver_attributes(struct visor_driver *drv)
driver_remove_file(>driver, >version_attr);
 }
 
-visorbus_rearm_channel_interrupts(struct visor_device *dev)
-{
-   if (!visor_periodic_work_nextperiod(dev->periodic_work))
-   put_device(>device);
-}
-EXPORT_SYMBOL_GPL(visorbus_rearm_channel_interrupts);
-
 static void
 dev_periodic_work(void *xdev)
 {
@@ -969,19 +964,63 @@ EXPORT_SYMBOL_GPL(visorbus_registerdevnode);
  *  interrupt function periodically...
  */
 void
+visorbus_rearm_channel_interrupts(struct visor_device *dev)
+{
+   if (dev->irq)
+   visorchannel_set_sig_features(dev->visorchannel,
+ dev->recv_queue,
+ ULTRA_CHANNEL_ENABLE_INTS);
+   else if (!visor_periodic_work_nextperiod(dev->periodic_work))
+   put_device(>device);
+}
+EXPORT_SYMBOL_GPL(visorbus_rearm_channel_interrupts);
+
+void
 visorbus_enable_channel_interrupts(struct visor_device *dev)
 {
-   dev_start_periodic_work(dev);
+   if (dev->irq)
+   visorchannel_set_sig_features(dev->visorchannel,
+ dev->recv_queue,
+ ULTRA_CHANNEL_ENABLE_INTS);
+   else
+   dev_start_periodic_work(dev);
 }
 EXPORT_SYMBOL_GPL(visorbus_enable_channel_interrupts);
 
 void
 visorbus_disable_channel_interrupts(struct visor_device *dev)
 {
-   dev_stop_periodic_work(dev);
+   if (!dev->irq)
+   visorchannel_clear_sig_features(dev->visorchannel,
+   dev->recv_queue,
+   ULTRA_CHANNEL_ENABLE_INTS);
+   else
+   dev_stop_periodic_work(dev);
 }
 EXPORT_SYMBOL_GPL(visorbus_disable_channel_interrupts);
 
+static irqreturn_t
+visorbus_isr(int irq, void *dev_id)
+{
+   struct visor_device *dev = (struct visor_device *)dev_id;
+   struct visor_driver *drv = to_visor_driver(dev->device.driver);
+
+   /* Disable the interrupt in hardware for this device.
+* When the device is done handling the interrupt, it has
+* the r

[PATCH 13/14] staging: unisys: Remove semaphores around channel interrupts.

2015-11-17 Thread Benjamin Romer
From: David Kershner <david.kersh...@unisys.com>

We can remove the semaphore from around the interrupt callback in
dev_periodic_work().

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Tim Sell <timothy.s...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index a45c6a2..962af12 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -723,10 +723,8 @@ dev_periodic_work(void *xdev)
struct visor_device *dev = xdev;
struct visor_driver *drv = to_visor_driver(dev->device.driver);
 
-   down(>visordriver_callback_lock);
if (drv->channel_interrupt)
drv->channel_interrupt(dev);
-   up(>visordriver_callback_lock);
 }
 
 static void
-- 
2.5.0

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


[PATCH 14/14] staging: unisys: Allow for unregistering of interrupts.

2015-11-17 Thread Benjamin Romer
From: David Kershner <david.kersh...@unisys.com>

The new interrupt code was NOT distinguishing between the availability of
an irq (i.e., visor_device.irq != 0), and the fact that we were in fact
operating in real interrupt mode (i.e., request_irq() succeeded).  This
could cause us to do the wrong thing in visorbus_enable_channel_interrupts,
visorbus_disable_channel_interrupts and visorbus_rearm_channel_interrupts.
This was fixed by adding a boolean named visor_device.irq_requested, which
is true iff request_irq() succeeded.

We were not properly restoring interrupt-related state after a failed
attempt of visorbus_register_channel_interrupts(), nor after the device
was unattached from a function driver.  Most-notably, we did NOT call
free_irq() (the book-end to request_irq()).  This was fixed via a new
visorbus_unregister_for_channel_interrupts.

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Tim Sell <timothy.s...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/include/visorbus.h   |  2 +
 drivers/staging/unisys/visorbus/visorbus_main.c | 65 ++---
 2 files changed, 59 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h 
b/drivers/staging/unisys/include/visorbus.h
index e2251f7..23f4704 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -162,6 +162,7 @@ struct visor_device {
int irq;
int wait_ms;
int recv_queue; /* specifies which queue to receive msgs on */
+   bool irq_requested; /* true iff request_irq() succeeded */
 };
 
 #define to_visor_device(x) container_of(x, struct visor_device, device)
@@ -181,6 +182,7 @@ int visorbus_registerdevnode(struct visor_device *dev,
 const char *name, int major, int minor);
 int visorbus_register_for_channel_interrupts(struct visor_device *dev,
 u32 queue);
+int visorbus_unregister_for_channel_interrupts(struct visor_device *dev);
 void visorbus_enable_channel_interrupts(struct visor_device *dev);
 void visorbus_disable_channel_interrupts(struct visor_device *dev);
 void visorbus_rearm_channel_interrupts(struct visor_device *dev);
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index 962af12..27aa3df 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -723,6 +723,14 @@ dev_periodic_work(void *xdev)
struct visor_device *dev = xdev;
struct visor_driver *drv = to_visor_driver(dev->device.driver);
 
+   /*
+* Note that channel_interrupt() is called withOUT
+* visordriver_callback_lock(), unlike the other callbacks.  This both
+* makes the behavior consistent between polling versus NON-polling
+* modes, and enables us to handle I/Os while in the function driver's
+* probe() function, which is necessary particularly for the
+* scsi_scan_host() call in the visorhba case.
+*/
if (drv->channel_interrupt)
drv->channel_interrupt(dev);
 }
@@ -734,8 +742,10 @@ dev_start_periodic_work(struct visor_device *dev)
return;
/* now up by at least 2 */
get_device(>device);
-   if (!visor_periodic_work_start(dev->periodic_work))
+   if (!visor_periodic_work_start(dev->periodic_work)) {
+   dev_err(>device, "%s failed\n", __func__);
put_device(>device);
+   }
 }
 
 static void
@@ -786,13 +796,18 @@ visordriver_probe_device(struct device *xdev)
get_device(>device);
visorbus_set_channel_state(dev, CHANNELCLI_OWNED);
if (!drv->probe) {
+   dev_err(xdev, "%s function driver provide no probe()\n",
+   __func__);
up(>visordriver_callback_lock);
rc = -1;
goto away;
}
rc = drv->probe(dev);
-   if (rc < 0)
+   if (rc < 0) {
+   dev_err(xdev, "%s function driver probe() errored\n",
+   __func__);
goto away;
+   }
 
fix_vbus_dev_info(dev);
up(>visordriver_callback_lock);
@@ -830,6 +845,7 @@ visordriver_remove_device(struct device *xdev)
}
up(>visordriver_callback_lock);
dev_stop_periodic_work(dev);
+   visorbus_unregister_for_channel_interrupts(dev);
devmajorminor_remove_all_files(dev);
 
visorbus_set_channel_state(dev, CHANNELCLI_ATTACHED);
@@ -964,7 +980,7 @@ EXPORT_SYMBOL_GPL(visorbus_registerdevnode);
 void
 visorbus_rearm_channel_interrupts(struct visor_device *dev)
 {
-   if (dev->irq)
+   if (dev->irq_requested)
vi

[PATCH 07/14] staging: unisys: Add support to update Features bits in channel queues

2015-11-17 Thread Benjamin Romer
From: David Kershner <david.kersh...@unisys.com>

Add support to visorbus to update the features in the channel queues.
Signal queues features is the memory location to disable/enable signal
queue interrupts.

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/include/visorbus.h  |  4 +++
 drivers/staging/unisys/visorbus/visorchannel.c | 46 ++
 2 files changed, 50 insertions(+)

diff --git a/drivers/staging/unisys/include/visorbus.h 
b/drivers/staging/unisys/include/visorbus.h
index 9235536..644ca30 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -218,6 +218,10 @@ char *visorchannel_uuid_id(uuid_le *guid, char *s);
 void visorchannel_debug(struct visorchannel *channel, int num_queues,
struct seq_file *seq, u32 off);
 void __iomem *visorchannel_get_header(struct visorchannel *channel);
+void visorchannel_set_sig_features(struct visorchannel *channel, u32 queue,
+  u64 features);
+void visorchannel_clear_sig_features(struct visorchannel *channel, u32 queue,
+u64 features);
 
 #define BUS_ROOT_DEVICEUINT_MAX
 struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no,
diff --git a/drivers/staging/unisys/visorbus/visorchannel.c 
b/drivers/staging/unisys/visorbus/visorchannel.c
index a4e117f..2ef79fa 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -538,6 +538,52 @@ visorchannel_signalqueue_max_slots(struct visorchannel 
*channel, u32 queue)
 }
 EXPORT_SYMBOL_GPL(visorchannel_signalqueue_max_slots);
 
+/**
+ * visorchannel_clear_or_set_sig_features
+ *
+ * Clear or set bits within the 64-bit features word for the
+ * specified channel and queue.
+ * @channel: the channel to modify features for.
+ * @queue: the queue number to modify features for.
+ * @features: a mask of feature bits usage based on is_set flag;
+ * @is_set: if is_set is true, 1 bits indicate which features bits
+ *  you want to set within the feature word;
+ *  if is_set is false, 1 bits indicate which feature bits
+ *  you want to clear within the features word
+ */
+void
+visorchannel_clear_or_set_sig_features(struct visorchannel *channel,
+  u32 queue, u64 features, bool is_set)
+{
+   struct signal_queue_header sig_hdr;
+
+   if (!sig_read_header(channel, queue, _hdr))
+   return;
+   sig_hdr.features = (is_set) ? sig_hdr.features | features :
+  sig_hdr.features & !features;
+   if (!SIG_WRITE_FIELD(channel, queue, _hdr, features))
+   return;
+   wmb(); /* required to sync channel with IOSP */
+}
+
+void
+visorchannel_clear_sig_features(struct visorchannel *channel, u32 queue,
+   u64 features)
+{
+   visorchannel_clear_or_set_sig_features(channel, queue, features,
+  false);
+}
+EXPORT_SYMBOL_GPL(visorchannel_clear_sig_features);
+
+void
+visorchannel_set_sig_features(struct visorchannel *channel, u32 queue,
+ u64 features)
+{
+   visorchannel_clear_or_set_sig_features(channel, queue, features,
+  true);
+}
+EXPORT_SYMBOL_GPL(visorchannel_set_sig_features);
+
 static void
 sigqueue_debug(struct signal_queue_header *q, int which, struct seq_file *seq)
 {
-- 
2.5.0

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


[PATCH 09/14] staging: unisys: Re-enable interrupts after we have done the work

2015-11-17 Thread Benjamin Romer
From: David Kershner <david.kersh...@unisys.com>

Instead of rescheduling the work queue after we have called the
channel interrupt, start it when the driver has finished processing
the queue.

This patch introduces the visorbus_rearm_channel_interrupts function
that must get called when the driver decides that it is done processing
its queue.

Visorinput, visorhba, and visornic were all updated to call the new
function.

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/include/visorbus.h   | 2 ++
 drivers/staging/unisys/visorbus/visorbus_main.c | 9 +++--
 drivers/staging/unisys/visorhba/visorhba_main.c | 6 +-
 drivers/staging/unisys/visorinput/visorinput.c  | 5 -
 drivers/staging/unisys/visornic/visornic_main.c | 6 +-
 5 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h 
b/drivers/staging/unisys/include/visorbus.h
index 644ca30..5f44289 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -178,6 +178,8 @@ int visorbus_registerdevnode(struct visor_device *dev,
 const char *name, int major, int minor);
 void visorbus_enable_channel_interrupts(struct visor_device *dev);
 void visorbus_disable_channel_interrupts(struct visor_device *dev);
+void visorbus_rearm_channel_interrupts(struct visor_device *dev);
+
 #endif
 
 /* Note that for visorchannel_create()
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index 4304ca0..afbb9bc 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -715,6 +715,13 @@ unregister_driver_attributes(struct visor_driver *drv)
driver_remove_file(>driver, >version_attr);
 }
 
+visorbus_rearm_channel_interrupts(struct visor_device *dev)
+{
+   if (!visor_periodic_work_nextperiod(dev->periodic_work))
+   put_device(>device);
+}
+EXPORT_SYMBOL_GPL(visorbus_rearm_channel_interrupts);
+
 static void
 dev_periodic_work(void *xdev)
 {
@@ -725,8 +732,6 @@ dev_periodic_work(void *xdev)
if (drv->channel_interrupt)
drv->channel_interrupt(dev);
up(>visordriver_callback_lock);
-   if (!visor_periodic_work_nextperiod(dev->periodic_work))
-   put_device(>device);
 }
 
 static void
diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c 
b/drivers/staging/unisys/visorhba/visorhba_main.c
index 70bc878..0f6bb26 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -1008,12 +1008,16 @@ static void process_incoming_rsps(unsigned long v)
const int size = sizeof(*cmdrsp);
 
cmdrsp = kmalloc(size, GFP_ATOMIC);
-   if (!cmdrsp)
+   if (!cmdrsp) {
+   visorbus_rearm_channel_interrupts(devdata->dev);
return;
+   }
 
/* drain queue */
drain_queue(cmdrsp, devdata);
 
+   visorbus_rearm_channel_interrupts(devdata->dev);
+
kfree(cmdrsp);
return;
 }
diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index 1c2a210..84d0511 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -673,7 +673,7 @@ visorinput_channel_interrupt(struct visor_device *dev)
devdata_get(dev_get_drvdata(>device));
 
if (!devdata)
-   return;
+   goto rearm_interrupts;
 
spin_lock(>lock_isr);
if (devdata->paused) /* don't touch device/channel when paused */
@@ -782,6 +782,9 @@ visorinput_channel_interrupt(struct visor_device *dev)
 out_locked:
devdata_put(devdata);
spin_unlock(>lock_isr);
+
+rearm_interrupts:
+   visorbus_rearm_channel_interrupts(dev);
 }
 
 static int
diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index 9566b91..e8ad219 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -1712,8 +1712,10 @@ static int visornic_poll(struct napi_struct *napi, int 
budget)
 * If there aren't any more packets to receive
 * stop the poll
 */
-   if (rx_count < budget)
+   if (rx_count < budget) {
napi_complete(napi);
+   visorbus_rearm_channel_interrupts(devdata->dev);
+   }
 
return rx_count;
 }
@@ -1734,6 +1736,8 @@ visornic_irq(struct visor_device *v)
if (!visorchannel_signalempty(devdata->dev->visorchannel,
  IOCHAN_FROM_IOPART))
napi_schedule(>napi);
+   else
+   visorbus_rearm_channel_interrup

[PATCH 12/14] staging: unisys: Don't set polling mode in visorhba_probe

2015-11-17 Thread Benjamin Romer
From: David Kershner <david.kersh...@unisys.com>

Visorbus handles interrupt states for the drivers now, don't need
to handle it in the driver.

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorhba/visorhba_main.c | 14 --
 1 file changed, 14 deletions(-)

diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c 
b/drivers/staging/unisys/visorhba/visorhba_main.c
index e87bc2b..319ccfd 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -1085,7 +1085,6 @@ static int visorhba_probe(struct visor_device *dev)
struct vhba_config_max max;
struct visorhba_devdata *devdata = NULL;
int i, err, channel_offset;
-   u64 features;
 
scsihost = scsi_host_alloc(_driver_template,
   sizeof(*devdata));
@@ -1129,16 +1128,6 @@ static int visorhba_probe(struct visor_device *dev)
devdata->serverchangingstate = false;
devdata->scsihost = scsihost;
 
-   channel_offset = offsetof(struct spar_io_channel_protocol,
- channel_header.features);
-   err = visorbus_read_channel(dev, channel_offset, , 8);
-   if (err)
-   goto err_scsi_remove_host;
-   features |= ULTRA_IO_CHANNEL_IS_POLLING;
-   err = visorbus_write_channel(dev, channel_offset, , 8);
-   if (err)
-   goto err_scsi_remove_host;
-
devdata->thread_wait_ms = 2;
tasklet_init(>tasklet, process_incoming_rsps,
 (unsigned long)devdata);
@@ -1153,9 +1142,6 @@ static int visorhba_probe(struct visor_device *dev)
 
return 0;
 
-err_scsi_remove_host:
-   scsi_remove_host(scsihost);
-
 err_scsi_host_put:
scsi_host_put(scsihost);
return err;
-- 
2.5.0

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


[PATCH 11/14] staging: unisys: Don't go into POLLING mode in visornic_probe.

2015-11-17 Thread Benjamin Romer
From: David Kershner <david.kersh...@unisys.com>

Since visorbus now supports s-Par interrupts it will
handle the polling/interrupt mode for us.

Signed-off-by: David Kershner <david.kersh...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c 
b/drivers/staging/unisys/visornic/visornic_main.c
index 39a97f3..25c89b4 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -1866,7 +1866,6 @@ static int visornic_probe(struct visor_device *dev)
goto cleanup_napi_add;
}
 
-   features |= ULTRA_IO_CHANNEL_IS_POLLING;
features |= ULTRA_IO_DRIVER_SUPPORTS_ENHANCED_RCVBUF_CHECKING;
err = visorbus_write_channel(dev, channel_offset, , 8);
if (err) {
-- 
2.5.0

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


[PATCH 02/14] staging: unisys: iochannel.h remove redundant comments

2015-11-17 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

iochannel cleanup redudant comments in function declarations.

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/include/iochannel.h | 14 ++
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/unisys/include/iochannel.h 
b/drivers/staging/unisys/include/iochannel.h
index 457fe3d..ec04576 100644
--- a/drivers/staging/unisys/include/iochannel.h
+++ b/drivers/staging/unisys/include/iochannel.h
@@ -575,18 +575,8 @@ struct spar_io_channel_protocol {
  * room)
  */
 static inline  u16
-add_physinfo_entries(u32 inp_pfn,  /* input - specifies the pfn to be used
-* to add entries */
-u16 inp_off,   /* input - specifies the off to be used
-* to add entries */
-u32 inp_len,   /* input - specifies the len to be used
-* to add entries */
-u16 index, /* input - index in array at which new
-* entries are added */
-u16 max_pi_arr_entries,/* input - specifies the maximum
-* entries pi_arr can hold */
-struct phys_info pi_arr[]) /* input & output - array to
- * which entries are added */
+add_physinfo_entries(u32 inp_pfn, u16 inp_off, u32 inp_len, u16 index,
+u16 max_pi_arr_entries, struct phys_info pi_arr[])
 {
u32 len;
u16 i, firstlen;
-- 
2.5.0

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


[PATCH 08/14] staging: unisys: Fix visorchannel.c block comments

2015-11-17 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the last checkpatch warning about:
Block comments use a trailing */ on a separate line

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/visorchannel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchannel.c 
b/drivers/staging/unisys/visorbus/visorchannel.c
index 618784e..b8c6b2c 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -42,8 +42,8 @@ struct visorchannel {
struct channel_header chan_hdr;
uuid_le guid;
ulong size;
-   bool needs_lock;/* channel creator knows if more than one
-* thread will be inserting or removing */
+   bool needs_lock;/* channel creator knows if more than one */
+   /* thread will be inserting or removing */
spinlock_t insert_lock; /* protect head writes in chan_hdr */
spinlock_t remove_lock; /* protect tail writes in chan_hdr */
 
-- 
2.5.0

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


[PATCH 01/14] staging: unisys: iochannel fix block comments

2015-11-17 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes warning messages from checkpatch.pl specifically:
WARNING: Block comments use a trailing */ on a separate lines

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/include/iochannel.h | 137 +
 1 file changed, 59 insertions(+), 78 deletions(-)

diff --git a/drivers/staging/unisys/include/iochannel.h 
b/drivers/staging/unisys/include/iochannel.h
index 14e656f..457fe3d 100644
--- a/drivers/staging/unisys/include/iochannel.h
+++ b/drivers/staging/unisys/include/iochannel.h
@@ -6,7 +6,8 @@
 /*
  * Everything needed for IOPart-GuestPart communication is define in
  * this file.  Note: Everything is OS-independent because this file is
- * used by Windows, Linux and possible EFI drivers.  */
+ * used by Windows, Linux and possible EFI drivers.
+ */
 
 /*
  * Communication flow between the IOPart and GuestPart uses the channel headers
@@ -66,21 +67,15 @@
  * IO Partition is defined below.
  */
 
-/*
- * Defines and enums.
- */
-
+/* Defines and enums. */
 #define MINNUM(a, b) (((a) < (b)) ? (a) : (b))
 #define MAXNUM(a, b) (((a) > (b)) ? (a) : (b))
 
-/* these define the two queues per data channel between iopart and
- * ioguestparts
- */
-#define IOCHAN_TO_IOPART 0 /* used by ioguestpart to 'insert' signals to
-   * iopart */
-
-#define IOCHAN_FROM_IOPART 1 /* used by ioguestpart to 'remove' signals from
- * iopart - same queue as previous queue */
+/* define the two queues per data channel between iopart and ioguestparts */
+/* used by ioguestpart to 'insert' signals to iopart */
+#define IOCHAN_TO_IOPART 0
+/* used by ioguestpart to 'remove' signals from iopart, same previous queue */
+#define IOCHAN_FROM_IOPART 1
 
 /* size of cdb - i.e., scsi cmnd */
 #define MAX_CMND_SIZE 16
@@ -92,26 +87,29 @@
 /* various types of network packets that can be sent in cmdrsp */
 enum net_types {
NET_RCV_POST = 0,   /* submit buffer to hold receiving
-* incoming packet */
+* incoming packet
+*/
/* virtnic -> uisnic */
NET_RCV,/* incoming packet received */
/* uisnic -> virtpci */
-   NET_XMIT,   /* for outgoing net packets  */
+   NET_XMIT,   /* for outgoing net packets */
/* virtnic -> uisnic */
NET_XMIT_DONE,  /* outgoing packet xmitted */
/* uisnic -> virtpci */
NET_RCV_ENBDIS, /* enable/disable packet reception */
/* virtnic -> uisnic */
-   NET_RCV_ENBDIS_ACK, /* acknowledge enable/disable packet
-* reception */
+   NET_RCV_ENBDIS_ACK, /* acknowledge enable/disable packet */
+   /* reception */
/* uisnic -> virtnic */
NET_RCV_PROMISC,/* enable/disable promiscuous mode */
/* virtnic -> uisnic */
NET_CONNECT_STATUS, /* indicate the loss or restoration of a network
-* connection */
+* connection
+*/
/* uisnic -> virtnic */
NET_MACADDR,/* indicates the client has requested to update
-* its MAC addr */
+* its MAC addr
+*/
NET_MACADDR_ACK,/* MAC address */
 
 };
@@ -170,51 +168,43 @@ struct vhba_wwnn {
 } __packed;
 
 /* WARNING: Values stired in this structure must contain maximum counts (not
- * maximum values). */
-struct vhba_config_max {   /* 20 bytes */
-   u32 max_channel;/* maximum channel for devices attached to this
-* bus */
-   u32 max_id; /* maximum SCSI ID for devices attached to this
-* bus */
-   u32 max_lun;/* maximum SCSI LUN for devices attached to this
-* bus */
-   u32 cmd_per_lun;/* maximum number of outstanding commands per
-* lun that are allowed at one time */
-   u32 max_io_size;/* maximum io size for devices attached to this
-* bus */
+ * maximum values).
+ */
+struct vhba_config_max {/* 20 bytes */
+   u32 max_channel;/* maximum channel for devices attached to this bus */
+   u32 max_id; /* maximum SCSI ID for devices attached to bus */
+   u32 max_lun;/* maximum SCSI LUN for devices attached to bus */
+   u32 cmd_per_lun;/* maximum number of outstanding commands per LUN */
+   u32 max_io_size;/* maximum io size for devices attached to this bus */
/* max io size is 

[PATCH 11/14] staging: unisys: Fix periodic_work.c parenthesis alignment

2015-11-17 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes checkpatch.pl message:
 CHECK: Alignment should match open parenthesis

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/periodic_work.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/periodic_work.c 
b/drivers/staging/unisys/visorbus/periodic_work.c
index 115b7aa..00b1527 100644
--- a/drivers/staging/unisys/visorbus/periodic_work.c
+++ b/drivers/staging/unisys/visorbus/periodic_work.c
@@ -43,11 +43,12 @@ static void periodic_work_func(struct work_struct *work)
(*pw->workfunc)(pw->workfuncarg);
 }
 
-struct periodic_work *visor_periodic_work_create(ulong jiffy_interval,
-   struct workqueue_struct *workqueue,
-   void (*workfunc)(void *),
-   void *workfuncarg,
-   const char *devnam)
+struct periodic_work
+*visor_periodic_work_create(ulong jiffy_interval,
+   struct workqueue_struct *workqueue,
+   void (*workfunc)(void *),
+   void *workfuncarg,
+   const char *devnam)
 {
struct periodic_work *pw;
 
-- 
2.5.0

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


[PATCH 09/14] staging: unisys: Fix vmcallerinterface.h block comments

2015-11-17 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes all the checkpatch Block comments use a trailing
*/ while keeping comments clean.

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/vmcallinterface.h | 34 ++-
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/vmcallinterface.h 
b/drivers/staging/unisys/visorbus/vmcallinterface.h
index c8d8483..c043fa4 100644
--- a/drivers/staging/unisys/visorbus/vmcallinterface.h
+++ b/drivers/staging/unisys/visorbus/vmcallinterface.h
@@ -43,20 +43,15 @@ enum vmcall_monitor_interface_method_tuple { /* VMCALL 
identification tuples  */
 * - the 0x01 identifies it as the 1st instance of a VMCALL_VIRTPART
 *   type of VMCALL
 */
-
-   VMCALL_IO_CONTROLVM_ADDR = 0x0501,  /* used by all Guests, not just
-* IO */
-   VMCALL_QUERY_GUEST_VIRTUAL_TIME_OFFSET = 0x0708, /* Allow caller to
- * query virtual time
- * offset */
-   VMCALL_POST_CODE_LOGEVENT = 0x070B, /* LOGEVENT Post Code (RDX) with
-* specified subsystem mask (RCX
-* - monitor_subsystems.h) and
-* severity (RDX) */
-   VMCALL_UPDATE_PHYSICAL_TIME = 0x0a02/* Allow
-* ULTRA_SERVICE_CAPABILITY_TIME
-* capable guest to make
-* VMCALL */
+   /* used by all Guests, not just IO */
+   VMCALL_IO_CONTROLVM_ADDR = 0x0501,
+   /* Allow caller to query virtual time offset */
+   VMCALL_QUERY_GUEST_VIRTUAL_TIME_OFFSET = 0x0708,
+   /* LOGEVENT Post Code (RDX) with specified subsystem mask */
+   /* (RCX - monitor_subsystems.h) and severity (RDX) */
+   VMCALL_POST_CODE_LOGEVENT = 0x070B,
+   /* Allow ULTRA_SERVICE_CAPABILITY_TIME capable guest to make VMCALL */
+   VMCALL_UPDATE_PHYSICAL_TIME = 0x0a02
 };
 
 #define VMCALL_SUCCESS 0
@@ -74,7 +69,8 @@ enum vmcall_monitor_interface_method_tuple { /* VMCALL 
identification tuples  */
unisys_extended_vmcall(method, param1, param2, param3)
 
 /* The following uses VMCALL_POST_CODE_LOGEVENT interface but is currently
- * not used much */
+ * not used much
+ */
 #define ISSUE_IO_VMCALL_POSTCODE_SEVERITY(postcode, severity)  \
ISSUE_IO_EXTENDED_VMCALL(VMCALL_POST_CODE_LOGEVENT, severity,   \
 MDS_APPOS, postcode)
@@ -84,11 +80,11 @@ enum vmcall_monitor_interface_method_tuple { /* VMCALL 
identification tuples  */
 
 /* Parameters to VMCALL_IO_CONTROLVM_ADDR interface */
 struct vmcall_io_controlvm_addr_params {
-   /* The Guest-relative physical address of the ControlVm channel.
-   * This VMCall fills this in with the appropriate address. */
+   /* The Guest-relative physical address of the ControlVm channel. */
+   /* This VMCall fills this in with the appropriate address. */
u64 address;/* contents provided by this VMCALL (OUT) */
-   /* the size of the ControlVm channel in bytes This VMCall fills this
-   * in with the appropriate address. */
+   /* the size of the ControlVm channel in bytes This VMCall fills this */
+   /* in with the appropriate address. */
u32 channel_bytes;  /* contents provided by this VMCALL (OUT) */
u8 unused[4];   /* Unused Bytes in the 64-Bit Aligned Struct */
 } __packed;
-- 
2.5.0

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


[PATCH 14/14] staging: unisys: fix ultrainputreport.h block comment warnings

2015-11-17 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the following types of check patch warnings:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 .../staging/unisys/visorinput/ultrainputreport.h   | 45 +-
 1 file changed, 26 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/ultrainputreport.h 
b/drivers/staging/unisys/visorinput/ultrainputreport.h
index 3e6a52f..1bc3d20 100644
--- a/drivers/staging/unisys/visorinput/ultrainputreport.h
+++ b/drivers/staging/unisys/visorinput/ultrainputreport.h
@@ -29,33 +29,40 @@ enum ultra_inputaction {
inputaction_mouse_button_up = 3, /* arg1: 1=left,2=center,3=right */
inputaction_mouse_button_click = 4, /* arg1: 1=left,2=center,3=right */
inputaction_mouse_button_dclick = 5, /* arg1: 1=left,2=center,
-   3=right */
+ * 3=right
+ */
inputaction_wheel_rotate_away = 6, /* arg1: wheel rotation away from
- user */
+   * user
+   */
inputaction_wheel_rotate_toward = 7, /* arg1: wheel rotation toward
-   user */
+ * user
+ */
inputaction_set_max_xy = 8, /* set screen maxXY; arg1=x, arg2=y */
inputaction_key_down = 64,  /* arg1: scancode, as follows:
-  If arg1 <= 0xff, it's a 1-byte
-  scancode and arg1 is that scancode.
-  If arg1 > 0xff, it's a 2-byte
-  scanecode, with the 1st byte in the
-  low 8 bits, and the 2nd byte in the
-  high 8 bits.  E.g., the right ALT key
-  would appear as x'38e0'. */
+* If arg1 <= 0xff, it's a 1-byte
+* scancode and arg1 is that scancode.
+* If arg1 > 0xff, it's a 2-byte
+* scanecode, with the 1st byte in the
+* low 8 bits, and the 2nd byte in the
+* high 8 bits.  E.g., the right ALT key
+* would appear as x'38e0'.
+*/
inputaction_key_up = 65,/* arg1: scancode (in same format as
-  inputaction_keyDown) */
+* inputaction_keyDown)
+*/
inputaction_set_locking_key_state = 66,
/* arg1: scancode (in same format
-as inputaction_keyDown);
-MUST refer to one of the
-locking keys, like capslock,
-numlock, or scrolllock
-  arg2: 1 iff locking key should be
-in the LOCKED position
-(e.g., light is ON) */
+*   as inputaction_keyDown);
+*   MUST refer to one of the
+*   locking keys, like capslock,
+*   numlock, or scrolllock
+* arg2: 1 iff locking key should be
+*   in the LOCKED position
+*   (e.g., light is ON)
+*/
inputaction_key_down_up = 67,   /* arg1: scancode (in same format
-as inputaction_keyDown) */
+*   as inputaction_keyDown)
+*/
inputaction_last
 };
 
-- 
2.5.0

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


[PATCH 12/14] staging: unisys: controlvmcompletionstatus.h fix block comments

2015-11-17 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes the checkpatch warning messages in
controlvmcompletionstatus.h. All the warning messages in this file are
caused by "Block comments use atrailing */ on a separate line"

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 .../unisys/visorbus/controlvmcompletionstatus.h| 24 ++
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/controlvmcompletionstatus.h 
b/drivers/staging/unisys/visorbus/controlvmcompletionstatus.h
index 3c97ebac4..23ad0ea 100644
--- a/drivers/staging/unisys/visorbus/controlvmcompletionstatus.h
+++ b/drivers/staging/unisys/visorbus/controlvmcompletionstatus.h
@@ -39,7 +39,8 @@
 #define CONTROLVM_RESP_ERROR_MAX_DEVICES202/* DEVICE_CREATE */
 /* Payload and Parameter Related[400-499] 
*/
 #define CONTROLVM_RESP_ERROR_PAYLOAD_INVALID   400 /* SWITCH_ATTACHEXTPORT,
-* DEVICE_CONFIGURE */
+* 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 
*/
@@ -48,36 +49,43 @@
 * BUS_CONFIGURE,
 * DEVICE_CREATE,
 * DEVICE_CONFIG
-* DEVICE_DESTROY */
+* DEVICE_DESTROY
+*/
 #define CONTROLVM_RESP_ERROR_DEVICE_INVALID501 /* SWITCH_ATTACHINTPORT */
/* DEVICE_CREATE,
 * DEVICE_CONFIGURE,
-* DEVICE_DESTROY */
+* DEVICE_DESTROY
+*/
 #define CONTROLVM_RESP_ERROR_CHANNEL_INVALID   502 /* DEVICE_CREATE,
-* DEVICE_CONFIGURE */
+* DEVICE_CONFIGURE
+*/
 /* Partition Driver Callback Interface--[600-699] */
 #define CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE 604/* BUS_CREATE,
 * BUS_DESTROY,
 * DEVICE_CREATE,
-* DEVICE_DESTROY */
+* DEVICE_DESTROY
+*/
 /* Unable to invoke VIRTPCI callback */
 #define CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR 605
/* BUS_CREATE,
 * BUS_DESTROY,
 * DEVICE_CREATE,
-* DEVICE_DESTROY */
+* DEVICE_DESTROY
+*/
 /* VIRTPCI Callback returned error */
 #define CONTROLVM_RESP_ERROR_GENERIC_DRIVER_CALLBACK_ERROR 606
/* SWITCH_ATTACHEXTPORT,
 * SWITCH_DETACHEXTPORT
-* DEVICE_CONFIGURE */
+* 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 */
+* DEVICE_DESTROY
+*/
 #define CONTROLVM_RESP_ERROR_CHANNEL_SIZE_TOO_SMALL 801/* 
DEVICE_CREATE */
 /* Chipset Shutdown Related---[1000-1099] 
*/
 #define CONTROLVM_RESP_ERROR_CHIPSET_SHUTDOWN_FAIL

[PATCH 04/14] staging: unisys: iochannel fix trailing */

2015-11-17 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

Fixed last warning message from checkpatch.pl by removing the
wordiness of the comment

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/include/iochannel.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/include/iochannel.h 
b/drivers/staging/unisys/include/iochannel.h
index 36664cc..162ca18 100644
--- a/drivers/staging/unisys/include/iochannel.h
+++ b/drivers/staging/unisys/include/iochannel.h
@@ -566,8 +566,7 @@ struct spar_io_channel_protocol {
  * pfn-off-size entires.
  */
 
-/* we deal with 4K page sizes when we it comes to passing page information
- * between */
+/* use 4K page sizes when we it comes to passing page information between */
 /* Guest and IOPartition. */
 #define PI_PAGE_SIZE  0x1000
 #define PI_PAGE_MASK  0x0FFF
-- 
2.5.0

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


[PATCH 00/14] staging: unisys: checkpatch cleanup series

2015-11-17 Thread Benjamin Romer
This series takes care of checkpatch.pl issues found recently, as the
current version now inspects comment formatting. In addition, some
spacing and alignment issues are corrected.

Erik Arfvidson (14):
  staging: unisys: iochannel fix block comments
  staging: unisys: iochannel.h remove redundant comments
  staging: unisys: iochannel fix spacing around operators
  staging: unisys: iochannel fix trailing */
  staging: unisys: visorbus.h fix block comment
  staging: unisys: vbushelper.h fix Block comment
  staging: unisys: Fix guestlinuxdebug.h comments
  staging: unisys: Fix visorchannel.c block comments
  staging: unisys: Fix vmcallerinterface.h block comments
  staging: unisys: Fix channel.h Block comments
  staging: unisys: Fix periodic_work.c parenthesis alignment
  staging: unisys: controlvmcompletionstatus.h fix block comments
  staging: unisys: fix vbuschannel.h comments
  staging: unisys: fix ultrainputreport.h block comment warnings

 drivers/staging/unisys/include/channel.h   | 114 +--
 drivers/staging/unisys/include/guestlinuxdebug.h   |  13 +-
 drivers/staging/unisys/include/iochannel.h | 157 +
 drivers/staging/unisys/include/vbushelper.h|   3 +-
 drivers/staging/unisys/include/visorbus.h  |   4 +-
 .../unisys/visorbus/controlvmcompletionstatus.h|  24 ++--
 drivers/staging/unisys/visorbus/periodic_work.c|  11 +-
 drivers/staging/unisys/visorbus/vbuschannel.h  |   9 +-
 drivers/staging/unisys/visorbus/visorchannel.c |   4 +-
 drivers/staging/unisys/visorbus/vmcallinterface.h  |  34 ++---
 .../staging/unisys/visorinput/ultrainputreport.h   |  45 +++---
 11 files changed, 212 insertions(+), 206 deletions(-)

-- 
2.5.0

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


[PATCH 10/14] staging: unisys: Fix channel.h Block comments

2015-11-17 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes all the checkpatch.pl block commments that use a
trailing */ in channel.h

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/include/channel.h | 114 ++-
 1 file changed, 67 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/unisys/include/channel.h 
b/drivers/staging/unisys/include/channel.h
index c6c2442..5af59a5 100644
--- a/drivers/staging/unisys/include/channel.h
+++ b/drivers/staging/unisys/include/channel.h
@@ -60,15 +60,19 @@ enum channel_clientstate {
CHANNELCLI_DISABLED = 1,/* client can see channel but is NOT
 * allowed to use it unless given TBD
 * explicit request (should actually be
-* < DETACHED) */
+* < DETACHED)
+*/
CHANNELCLI_ATTACHING = 2,   /* legacy EFI client request
-* for EFI server to attach */
+* for EFI server to attach
+*/
CHANNELCLI_ATTACHED = 3,/* idle, but client may want
-* to use channel any time */
+* to use channel any time
+*/
CHANNELCLI_BUSY = 4,/* client either wants to use or is
-* using channel */
-   CHANNELCLI_OWNED = 5/* "no worries" state - client can
-* access channel anytime */
+* using channel
+*/
+   CHANNELCLI_OWNED = 5/* "no worries" state - client can */
+   /* access channel anytime */
 };
 
 static inline const u8 *
@@ -116,11 +120,13 @@ ULTRA_CHANNELCLI_STRING(u32 v)
 
 /* Values for ULTRA_CHANNEL_PROTOCOL.CliErrorBoot: */
 /* throttling invalid boot channel statetransition error due to client
- * disabled */
+ * disabled
+ */
 #define ULTRA_CLIERRORBOOT_THROTTLEMSG_DISABLED0x01
 
 /* throttling invalid boot channel statetransition error due to client
- * not attached */
+ * not attached
+ */
 #define ULTRA_CLIERRORBOOT_THROTTLEMSG_NOTATTACHED 0x02
 
 /* throttling invalid boot channel statetransition error due to busy channel */
@@ -128,24 +134,28 @@ ULTRA_CHANNELCLI_STRING(u32 v)
 
 /* Values for ULTRA_CHANNEL_PROTOCOL.CliErrorOS: */
 /* throttling invalid guest OS channel statetransition error due to
- * client disabled */
+ * client disabled
+ */
 #define ULTRA_CLIERROROS_THROTTLEMSG_DISABLED  0x01
 
 /* throttling invalid guest OS channel statetransition error due to
- * client not attached */
+ * client not attached
+ */
 #define ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED   0x02
 
 /* throttling invalid guest OS channel statetransition error due to
- * busy channel */
+ * busy channel
+ */
 #define ULTRA_CLIERROROS_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
-* this setting.  This flag is set in uislib after the
-* ULTRA_VHBA_init_channel is called.  All feature bits for all
-* channels should be defined here.  The io channel feature bits are
-* defined right here */
+ * that windows guest can look at the FeatureFlags in the io channel,
+ * and configure the windows driver to use interrupts or not based on
+ * this setting.  This flag is set in uislib after the
+ * ULTRA_VHBA_init_channel is called.  All feature bits for all
+ * 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)
@@ -156,7 +166,7 @@ ULTRA_CHANNELCLI_STRING(u32 v)
 struct channel_header {
u64 signature;  /* Signature */
u32 legacy_state;   /* DEPRECATED - being replaced by */
-   /* /  SrvState, CliStateBoot, and CliStateOS below */
+   /* SrvState, CliStateBoot, and CliStateOS below */
u32 header_size;/* sizeof(struct channel_header) */
u64 size;   /* Total size of this channel in bytes */
u64 features;   /* Flags to modify behavior */
@@ -169,25 +179,32 @@ struct channel_header {
uuid_le zone_uuid;  /* Guid of Channel's zone */
u32 cli_str_offset; /* offset from channel header to
   

[PATCH 13/14] staging: unisys: fix vbuschannel.h comments

2015-11-17 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

Fixes trailling */ from vbuschannel.h and alignment issue on the
same comment block

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorbus/vbuschannel.h | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/vbuschannel.h 
b/drivers/staging/unisys/visorbus/vbuschannel.h
index 80e6447..90fa12e 100644
--- a/drivers/staging/unisys/visorbus/vbuschannel.h
+++ b/drivers/staging/unisys/visorbus/vbuschannel.h
@@ -36,10 +36,11 @@ static const uuid_le spar_vbus_channel_protocol_uuid =
 #define SPAR_VBUS_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE
 
 /* Must increment this 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. */
+ * 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 SPAR_VBUS_CHANNEL_PROTOCOL_VERSIONID 1
 
 #define SPAR_VBUS_CHANNEL_OK_CLIENT(ch)   \
-- 
2.5.0

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


[PATCH 05/14] staging: unisys: visorbus.h fix block comment

2015-11-17 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This fixes last checkpatch warning:
WARNING: Block comments use a trailing */ on a separate line

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/include/visorbus.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/include/visorbus.h 
b/drivers/staging/unisys/include/visorbus.h
index 23f4704..98f6ebc 100644
--- a/drivers/staging/unisys/include/visorbus.h
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -140,8 +140,8 @@ struct visor_device {
struct {
int major, minor;
void *attr; /* private use by devmajorminor_attr.c you can
-  * change this constant to whatever you
-  * want; */
+* change this constant to whatever you want
+*/
} devnodes[5];
/* the code will detect and behave appropriately) */
struct semaphore visordriver_callback_lock;
-- 
2.5.0

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


[PATCH 07/14] staging: unisys: Fix guestlinuxdebug.h comments

2015-11-17 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch simply cleans up all checkpatch warnings and fixes
styling

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/include/guestlinuxdebug.h | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/unisys/include/guestlinuxdebug.h 
b/drivers/staging/unisys/include/guestlinuxdebug.h
index 82ee565..c1d515f 100644
--- a/drivers/staging/unisys/include/guestlinuxdebug.h
+++ b/drivers/staging/unisys/include/guestlinuxdebug.h
@@ -17,9 +17,10 @@
 #define __GUESTLINUXDEBUG_H__
 
 /*
-* This file contains supporting interface for "vmcallinterface.h", particularly
-* regarding adding additional structure and functionality to linux
-* ISSUE_IO_VMCALL_POSTCODE_SEVERITY */
+ * This file contains supporting interface for "vmcallinterface.h", 
particularly
+ * regarding adding additional structure and functionality to linux
+ * ISSUE_IO_VMCALL_POSTCODE_SEVERITY
+ */
 
 /*** INFO ON ISSUE_POSTCODE_LINUX() BELOW ***/
 enum driver_pc {   /* POSTCODE driver identifier tuples */
@@ -133,9 +134,9 @@ enum event_pc { /* POSTCODE event 
identifier tuples */
 
 #define POSTCODE_SEVERITY_ERR DIAG_SEVERITY_ERR
 #define POSTCODE_SEVERITY_WARNING DIAG_SEVERITY_WARNING
-#define POSTCODE_SEVERITY_INFO DIAG_SEVERITY_PRINT /* TODO-> Info currently
-* doesn't show, so we
-* set info=warning */
+#define POSTCODE_SEVERITY_INFO DIAG_SEVERITY_PRINT
+/* TODO-> Info currently doesn't show, so we set info=warning */
+
 /* example call of POSTCODE_LINUX_2(VISOR_CHIPSET_PC, POSTCODE_SEVERITY_ERR);
  * Please also note that the resulting postcode is in hex, so if you are
  * searching for the __LINE__ number, convert it first to decimal.  The line
-- 
2.5.0

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


[PATCH 03/14] staging: unisys: iochannel fix spacing around operators

2015-11-17 Thread Benjamin Romer
From: Erik Arfvidson <erik.arfvid...@unisys.com>

This patch fixes check warning from checkpatch.pl in the macro definition
CHECK: spaces preferred around that '+' (ctx:VxV)

Signed-off-by: Erik Arfvidson <erik.arfvid...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/include/iochannel.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/include/iochannel.h 
b/drivers/staging/unisys/include/iochannel.h
index ec04576..36664cc 100644
--- a/drivers/staging/unisys/include/iochannel.h
+++ b/drivers/staging/unisys/include/iochannel.h
@@ -366,7 +366,8 @@ struct net_pkt_xmtdone {
  */
 #define RCVPOST_BUF_SIZE 4032
 #define MAX_NET_RCV_CHAIN \
-   ((ETH_MAX_MTU+ETH_HEADER_SIZE + RCVPOST_BUF_SIZE-1) / RCVPOST_BUF_SIZE)
+   ((ETH_MAX_MTU + ETH_HEADER_SIZE + RCVPOST_BUF_SIZE - 1) \
+   / RCVPOST_BUF_SIZE)
 
 struct net_pkt_rcvpost {
/* rcv buf size must be large enough to include ethernet data len +
-- 
2.5.0

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


[PATCH v2 0/7] staging: unisys: visorinput fixes and enhancements

2015-11-16 Thread Benjamin Romer
This patch series fixes visorinput to remove the dependency on FB and
add dependency to INPUT, cleans up some formatting issues found with
checkpatch.pl, and adds the capability to change screen resolutions
without breaking mouse functionality.

This is a resubmission of the series.

Tim Sell (7):
  staging: unisys: visorinput: use kref ref-counting for device data
struct
  staging: unisys: visorinput: remove need for 'depends on FB'
  staging: unisys: visorinput: ensure proper locking wrt creation & ints
  staging: unisys: visorinput: respond to resolution changes on-the-fly
  staging: unisys: visorinput: sanity check resolution changes
  staging: unisys: visorinput: add useful dev_dbg() and dev_info()
messages
  staging: unisys: visorinput: add INPUT to dependent driver list

 drivers/staging/unisys/visorinput/Kconfig  |   2 +-
 drivers/staging/unisys/visorinput/visorinput.c | 209 +
 2 files changed, 183 insertions(+), 28 deletions(-)

-- 
2.5.0

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


[PATCH v2 7/7] staging: unisys: visorinput: add INPUT to dependent driver list

2015-11-16 Thread Benjamin Romer
From: Tim Sell <timothy.s...@unisys.com>

This was an obvious omission, as visorinput is an input-class driver.

Signed-off-by: Tim Sell <timothy.s...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was resubmitted.
---
 drivers/staging/unisys/visorinput/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorinput/Kconfig 
b/drivers/staging/unisys/visorinput/Kconfig
index 1c5a072..d70da14 100644
--- a/drivers/staging/unisys/visorinput/Kconfig
+++ b/drivers/staging/unisys/visorinput/Kconfig
@@ -4,7 +4,7 @@
 
 config UNISYS_VISORINPUT
tristate "Unisys visorinput driver"
-   depends on UNISYSSPAR && UNISYS_VISORBUS
+   depends on UNISYSSPAR && UNISYS_VISORBUS && INPUT
---help---
If you say Y here, you will enable the Unisys visorinput driver.
 
-- 
2.5.0

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


[PATCH v2 3/7] staging: unisys: visorinput: ensure proper locking wrt creation & ints

2015-11-16 Thread Benjamin Romer
From: Tim Sell <timothy.s...@unisys.com>

Ensure we properly lock between visorinput_channel_interrupt() and
devdata_create().  We now guarantee that interrupts will be disabled and
we will be holding lock_visor_dev at the time input_register_device() is
called (from register_client_keyboard() or register_client_mouse()), after
which we may quickly find ourselves in visorinput_open(), where we enable
interrupts, and hence may call visorinput_channel_interrupt().

Signed-off-by: Tim Sell <timothy.s...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was resubmitted.
---
 drivers/staging/unisys/visorinput/visorinput.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index 4620a49..8c22e0f 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -415,6 +415,8 @@ devdata_create(struct visor_device *dev, enum 
visorinput_device_type devtype)
if (!devdata)
return NULL;
devdata->dev = dev;
+   init_rwsem(>lock_visor_dev);
+   down_write(>lock_visor_dev);
 
/*
 * This is an input device in a client guest partition,
@@ -453,12 +455,14 @@ devdata_create(struct visor_device *dev, enum 
visorinput_device_type devtype)
break;
}
 
-   init_rwsem(>lock_visor_dev);
kref_init(>kref);
+   dev_set_drvdata(>device, devdata);
+   up_write(>lock_visor_dev);
 
return devdata;
 
 cleanups_register:
+   up_write(>lock_visor_dev);
kfree(devdata);
return NULL;
 }
@@ -466,7 +470,6 @@ cleanups_register:
 static int
 visorinput_probe(struct visor_device *dev)
 {
-   struct visorinput_devdata *devdata = NULL;
uuid_le guid;
enum visorinput_device_type devtype;
 
@@ -477,10 +480,9 @@ visorinput_probe(struct visor_device *dev)
devtype = visorinput_keyboard;
else
return -ENODEV;
-   devdata = devdata_create(dev, devtype);
-   if (!devdata)
+   visorbus_disable_channel_interrupts(dev);
+   if (!devdata_create(dev, devtype))
return -ENOMEM;
-   dev_set_drvdata(>device, devdata);
return 0;
 }
 
-- 
2.5.0

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


[PATCH v2 2/7] staging: unisys: visorinput: remove need for 'depends on FB'

2015-11-16 Thread Benjamin Romer
From: Tim Sell <timothy.s...@unisys.com>

Previously, we used a hack to determine the max x,y resolution of the
visor virtual mouse: we just looked at the resolution of the
first-registered framebuffer device, using the currently-valid assumption
that in a Unisys s-Par guest environment the video will be provided by an
efifb framebuffer device.

This hack has been removed, by instead determining the default mouse
resolution by looking at fields within the visor mouse channel memory,
mouse.x_resolution and mouse.y_resolution.  If these fields are 0, a
default resolution of 1024x768 is assumed.  Note that in current
implementations, mouse.x_resolution and mouse.y_resolution are always just
initialized to 0 by the back-end, and only 1024x768 is supported, but
coding it this way will allow other resolutions to work in the future.

Signed-off-by: Tim Sell <timothy.s...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was resubmitted.
---
 drivers/staging/unisys/visorinput/Kconfig  |  2 +-
 drivers/staging/unisys/visorinput/visorinput.c | 63 +-
 2 files changed, 52 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/Kconfig 
b/drivers/staging/unisys/visorinput/Kconfig
index d83deb4..1c5a072 100644
--- a/drivers/staging/unisys/visorinput/Kconfig
+++ b/drivers/staging/unisys/visorinput/Kconfig
@@ -4,7 +4,7 @@
 
 config UNISYS_VISORINPUT
tristate "Unisys visorinput driver"
-   depends on UNISYSSPAR && UNISYS_VISORBUS && FB
+   depends on UNISYSSPAR && UNISYS_VISORBUS
---help---
If you say Y here, you will enable the Unisys visorinput driver.
 
diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index 238a132..4620a49 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -47,8 +47,38 @@
 #define SPAR_MOUSE_CHANNEL_PROTOCOL_UUID_STR \
"addf07d4-94a9-46e2-81c3-61abcdbdbd87"
 
-#define PIXELS_ACROSS_DEFAULT  800
-#define PIXELS_DOWN_DEFAULT600
+/* header of keyboard/mouse channels */
+struct spar_input_channel_protocol {
+   struct channel_header channel_header;
+   u32 n_input_reports;
+   union {
+   struct {
+   u16 x_resolution;
+   u16 y_resolution;
+   } mouse;
+   struct {
+   u32 flags;
+   } keyboard;
+   };
+} __packed;
+
+#define sizeofmemb(TYPE, MEMBER) sizeof(((TYPE *)0)->MEMBER)
+
+static unsigned read_input_channel_uint(struct visor_device *dev,
+   unsigned offset, unsigned size)
+{
+   unsigned v = 0;
+
+   if (visorbus_read_channel(dev, offset, , size)) {
+   dev_warn(>device,
+"failed to read channel int at offset %u\n", offset);
+   return 0;
+   }
+   return v;
+}
+
+#define PIXELS_ACROSS_DEFAULT  1024
+#define PIXELS_DOWN_DEFAULT768
 #define KEYCODE_TABLE_BYTES256
 
 enum visorinput_device_type {
@@ -298,12 +328,11 @@ register_client_keyboard(void *devdata,  /* opaque on 
purpose */
 }
 
 static struct input_dev *
-register_client_mouse(void *devdata /* opaque on purpose */)
+register_client_mouse(void *devdata /* opaque on purpose */,
+ unsigned xres, unsigned yres)
 {
int error;
struct input_dev *visorinput_dev = NULL;
-   int xres, yres;
-   struct fb_info *fb0;
 
visorinput_dev = input_allocate_device();
if (!visorinput_dev)
@@ -321,14 +350,10 @@ register_client_mouse(void *devdata /* opaque on purpose 
*/)
set_bit(BTN_RIGHT, visorinput_dev->keybit);
set_bit(BTN_MIDDLE, visorinput_dev->keybit);
 
-   if (registered_fb[0]) {
-   fb0 = registered_fb[0];
-   xres = fb0->var.xres_virtual;
-   yres = fb0->var.yres_virtual;
-   } else {
+   if (xres == 0)
xres = PIXELS_ACROSS_DEFAULT;
+   if (yres == 0)
yres = PIXELS_DOWN_DEFAULT;
-   }
input_set_abs_params(visorinput_dev, ABS_X, 0, xres, 0, 0);
input_set_abs_params(visorinput_dev, ABS_Y, 0, yres, 0, 0);
 
@@ -381,6 +406,7 @@ devdata_create(struct visor_device *dev, enum 
visorinput_device_type devtype)
 {
struct visorinput_devdata *devdata = NULL;
unsigned int extra_bytes = 0;
+   unsigned xres, yres;
 
if (devtype == visorinput_keyboard)
/* allocate room for devdata->keycode_table, filled in below */
@@ -408,7 +434,20 @@ devdata_create(struct visor_device *dev, enum 
visorinput_device_type devtype)
goto cleanups_register;
break;
case visorinput_mouse:
-   devdata->visorinput_dev = register_cl

[PATCH v2 4/7] staging: unisys: visorinput: respond to resolution changes on-the-fly

2015-11-16 Thread Benjamin Romer
From: Tim Sell <timothy.s...@unisys.com>

Whenever the absolute x,y resolution of the video (and mouse) changes, the
back-end sends an inputaction_set_max_xy message indicating the new
resolution.  This commit adds the infrastructure to detect and correctly
respond to that message.

There were several reasons this wasn't as easy as it sounds:

* input_set_abs_params() is only effective if it is called prior to
  input_register_device().  So we need to free the input_dev and
  re-create it whenever the resolution changes.

* Because freeing the input_dev and re-creating it will take us thru
  visorinput_close() and visorinput_open() if someone in user-land has the
  device open, and because those will end up calling
  visorbus_enable_channel_interrupts() and
  visorbus_disable_channel_interrupts(), we canNOT just free the input_dev
  and re-create it inline within visorinput_channel_interrupt().  We need
  to use a workqueue to do it asynchronously.

Signed-off-by: Tim Sell <timothy.s...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was resubmitted.
---
 drivers/staging/unisys/visorinput/visorinput.c | 71 ++
 1 file changed, 71 insertions(+)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index 8c22e0f..77e0252 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "version.h"
 #include "visorbus.h"
@@ -86,6 +87,11 @@ enum visorinput_device_type {
visorinput_mouse,
 };
 
+struct change_resolution_work {
+   struct work_struct work;
+   unsigned xres, yres;
+};
+
 /*
  * This is the private data that we store for each device.
  * A pointer to this struct is maintained via
@@ -97,6 +103,8 @@ struct visorinput_devdata {
struct rw_semaphore lock_visor_dev; /* lock for dev */
struct input_dev *visorinput_dev;
bool paused;
+   struct workqueue_struct *wq;
+   struct change_resolution_work change_resolution_work_data;
unsigned int keycode_table_bytes; /* size of following array */
/* for keyboard devices: visorkbd_keycode[] + visorkbd_ext_keycode[] */
unsigned char keycode_table[0];
@@ -384,6 +392,10 @@ static void devdata_release(struct kref *kref)
struct visorinput_devdata *devdata =
container_of(kref, struct visorinput_devdata, kref);
unregister_client_input(devdata->visorinput_dev);
+   if (devdata->wq) {
+   flush_workqueue(devdata->wq);
+   destroy_workqueue(devdata->wq);
+   }
kfree(devdata);
 }
 
@@ -401,6 +413,51 @@ static void devdata_put(struct visorinput_devdata *devdata)
kref_put(>kref, devdata_release);
 }
 
+static void async_change_resolution(struct work_struct *work)
+{
+   struct change_resolution_work *p_change_resolution_work =
+   container_of(work, struct change_resolution_work, work);
+   struct visorinput_devdata *devdata =
+   container_of(p_change_resolution_work,
+struct visorinput_devdata,
+change_resolution_work_data);
+
+   down_write(>lock_visor_dev);
+
+   if (devdata->paused) /* don't touch device/channel when paused */
+   goto out_locked;
+   if (!devdata->visorinput_dev)
+   goto out_locked;
+
+   unregister_client_input(devdata->visorinput_dev);
+   /*
+* input_set_abs_params is only effective prior to
+* input_register_device().
+*/
+   devdata->visorinput_dev =
+   register_client_mouse(devdata,
+ p_change_resolution_work->xres,
+ p_change_resolution_work->yres);
+   if (!devdata->visorinput_dev)
+   dev_err(>dev->device,
+   "failed create of new mouse input dev for new 
resolution %u,%u\n",
+   p_change_resolution_work->xres,
+   p_change_resolution_work->yres);
+
+out_locked:
+   up_write(>lock_visor_dev);
+   devdata_put(devdata);  /* from schedule_mouse_resolution_change() */
+}
+
+static void schedule_mouse_resolution_change(struct visorinput_devdata 
*devdata,
+unsigned xres, unsigned yres)
+{
+   devdata->change_resolution_work_data.xres = xres;
+   devdata->change_resolution_work_data.yres = yres;
+   devdata_get(devdata);  /* don't go away until work processed */
+   queue_work(devdata->wq, >change_resolution_work_data.work);
+}
+
 static struct visorinput_devdata *
 devdata_create(struct visor_device *dev, enum visorinput_device_type devtype)
 {
@@ -4

[PATCH v2 6/7] staging: unisys: visorinput: add useful dev_dbg() and dev_info() messages

2015-11-16 Thread Benjamin Romer
From: Tim Sell <timothy.s...@unisys.com>

The dev_info() messages at init time are particularly useful for mapping
visor devices to input devices.

Signed-off-by: Tim Sell <timothy.s...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was resubmitted.
---
 drivers/staging/unisys/visorinput/visorinput.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index cf364c4..f570ce0 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -392,6 +392,7 @@ static void devdata_release(struct kref *kref)
 {
struct visorinput_devdata *devdata =
container_of(kref, struct visorinput_devdata, kref);
+   dev_dbg(>dev->device, "releasing resources\n");
unregister_client_input(devdata->visorinput_dev);
if (devdata->wq) {
flush_workqueue(devdata->wq);
@@ -444,6 +445,8 @@ static void async_change_resolution(struct work_struct 
*work)
"failed create of new mouse input dev for new 
resolution %u,%u\n",
p_change_resolution_work->xres,
p_change_resolution_work->yres);
+   dev_info(>dev->device, "created mouse %s\n",
+dev_name(>visorinput_dev->dev));
 
 out_locked:
up_write(>lock_visor_dev);
@@ -496,6 +499,8 @@ devdata_create(struct visor_device *dev, enum 
visorinput_device_type devtype)
(devdata, devdata->keycode_table);
if (!devdata->visorinput_dev)
goto cleanups_register;
+   dev_info(>dev->device, "created keyboard %s\n",
+dev_name(>visorinput_dev->dev));
break;
case visorinput_mouse:
xres = read_input_channel_uint
@@ -514,6 +519,8 @@ devdata_create(struct visor_device *dev, enum 
visorinput_device_type devtype)
register_client_mouse(devdata, xres, yres);
if (!devdata->visorinput_dev)
goto cleanups_register;
+   dev_info(>dev->device, "created mouse %s\n",
+dev_name(>visorinput_dev->dev));
break;
}
 
@@ -746,6 +753,10 @@ visorinput_channel_interrupt(struct visor_device *dev)
"mouse resolution change for NON-mouse 
device!\n");
continue;
}
+   dev_info(>device,
+"mouse resolution change to %ux%u\n",
+r.activity.arg1,
+r.activity.arg2);
/*
 * we can NOT handle this inline, because this may go
 * thru a close() path, which will attempt to stop the
-- 
2.5.0

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


[PATCH v2 1/7] staging: unisys: visorinput: use kref ref-counting for device data struct

2015-11-16 Thread Benjamin Romer
From: Tim Sell <timothy.s...@unisys.com>

This is NOT technically required for the code as it stands now, but will
be needed for subsequent patches.

Signed-off-by: Tim Sell <timothy.s...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: resources are released in the reverse order they were acquired, as per
Dan Carpenter's comment.
---
 drivers/staging/unisys/visorinput/visorinput.c | 45 --
 1 file changed, 35 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index 5c16f66..238a132 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -62,6 +62,7 @@ enum visorinput_device_type {
  * dev_get_drvdata() / dev_set_drvdata() for each struct device.
  */
 struct visorinput_devdata {
+   struct kref kref;
struct visor_device *dev;
struct rw_semaphore lock_visor_dev; /* lock for dev */
struct input_dev *visorinput_dev;
@@ -346,6 +347,35 @@ register_client_mouse(void *devdata /* opaque on purpose 
*/)
return visorinput_dev;
 }
 
+static void
+unregister_client_input(struct input_dev *visorinput_dev)
+{
+   if (visorinput_dev)
+   input_unregister_device(visorinput_dev);
+}
+
+static void devdata_release(struct kref *kref)
+{
+   struct visorinput_devdata *devdata =
+   container_of(kref, struct visorinput_devdata, kref);
+   unregister_client_input(devdata->visorinput_dev);
+   kfree(devdata);
+}
+
+static struct visorinput_devdata *
+devdata_get(struct visorinput_devdata *devdata)
+{
+   if (devdata)
+   kref_get(>kref);
+   return devdata;
+}
+
+static void devdata_put(struct visorinput_devdata *devdata)
+{
+   if (devdata)
+   kref_put(>kref, devdata_release);
+}
+
 static struct visorinput_devdata *
 devdata_create(struct visor_device *dev, enum visorinput_device_type devtype)
 {
@@ -385,6 +415,7 @@ devdata_create(struct visor_device *dev, enum 
visorinput_device_type devtype)
}
 
init_rwsem(>lock_visor_dev);
+   kref_init(>kref);
 
return devdata;
 
@@ -415,13 +446,6 @@ visorinput_probe(struct visor_device *dev)
 }
 
 static void
-unregister_client_input(struct input_dev *visorinput_dev)
-{
-   if (visorinput_dev)
-   input_unregister_device(visorinput_dev);
-}
-
-static void
 visorinput_remove(struct visor_device *dev)
 {
struct visorinput_devdata *devdata = dev_get_drvdata(>device);
@@ -438,9 +462,8 @@ visorinput_remove(struct visor_device *dev)
 
down_write(>lock_visor_dev);
dev_set_drvdata(>device, NULL);
-   unregister_client_input(devdata->visorinput_dev);
up_write(>lock_visor_dev);
-   kfree(devdata);
+   devdata_put(devdata);
 }
 
 /*
@@ -526,7 +549,8 @@ visorinput_channel_interrupt(struct visor_device *dev)
int xmotion, ymotion, zmotion, button;
int i;
 
-   struct visorinput_devdata *devdata = dev_get_drvdata(>device);
+   struct visorinput_devdata *devdata =
+   devdata_get(dev_get_drvdata(>device));
 
if (!devdata)
return;
@@ -617,6 +641,7 @@ visorinput_channel_interrupt(struct visor_device *dev)
}
 out_locked:
up_write(>lock_visor_dev);
+   devdata_put(devdata);
 }
 
 static int
-- 
2.5.0

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


[PATCH v2 5/7] staging: unisys: visorinput: sanity check resolution changes

2015-11-16 Thread Benjamin Romer
From: Tim Sell <timothy.s...@unisys.com>

This commit sanity checks so that if a change resolution request is ever
received for a non-mouse device, that an error message will be logged and
the message will be ignored.

Signed-off-by: Tim Sell <timothy.s...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>

---
v2: the patch was resubmitted.
---
 drivers/staging/unisys/visorinput/visorinput.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index 77e0252..cf364c4 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -100,6 +100,7 @@ struct change_resolution_work {
 struct visorinput_devdata {
struct kref kref;
struct visor_device *dev;
+   enum visorinput_device_type devtype;
struct rw_semaphore lock_visor_dev; /* lock for dev */
struct input_dev *visorinput_dev;
bool paused;
@@ -472,6 +473,7 @@ devdata_create(struct visor_device *dev, enum 
visorinput_device_type devtype)
if (!devdata)
return NULL;
devdata->dev = dev;
+   devdata->devtype = devtype;
devdata->wq = alloc_ordered_workqueue("visorinput", 0);
INIT_WORK(>change_resolution_work_data.work,
  async_change_resolution);
@@ -739,6 +741,11 @@ visorinput_channel_interrupt(struct visor_device *dev)
input_sync(visorinput_dev);
break;
case inputaction_set_max_xy:
+   if (devdata->devtype != visorinput_mouse) {
+   dev_err(>device,
+   "mouse resolution change for NON-mouse 
device!\n");
+   continue;
+   }
/*
 * we can NOT handle this inline, because this may go
 * thru a close() path, which will attempt to stop the
-- 
2.5.0

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


[PATCH 3/9] staging: unisys: visorinput: use kref ref-counting for device data struct

2015-10-16 Thread Benjamin Romer
From: Tim Sell <timothy.s...@unisys.com>

This is NOT technically required for the code as it stands now, but will
be needed for subsequent patches.

Signed-off-by: Tim Sell <timothy.s...@unisys.com>
Signed-off-by: Benjamin Romer <benjamin.ro...@unisys.com>
---
 drivers/staging/unisys/visorinput/visorinput.c | 45 --
 1 file changed, 35 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/unisys/visorinput/visorinput.c 
b/drivers/staging/unisys/visorinput/visorinput.c
index d23c129..59641d7 100644
--- a/drivers/staging/unisys/visorinput/visorinput.c
+++ b/drivers/staging/unisys/visorinput/visorinput.c
@@ -62,6 +62,7 @@ enum visorinput_device_type {
  * dev_get_drvdata() / dev_set_drvdata() for each struct device.
  */
 struct visorinput_devdata {
+   struct kref kref;
struct visor_device *dev;
struct rw_semaphore lock_visor_dev; /* lock for dev */
struct input_dev *visorinput_dev;
@@ -346,6 +347,35 @@ register_client_mouse(void *devdata /* opaque on purpose 
*/)
return visorinput_dev;
 }
 
+static void
+unregister_client_input(struct input_dev *visorinput_dev)
+{
+   if (visorinput_dev)
+   input_unregister_device(visorinput_dev);
+}
+
+static void devdata_release(struct kref *kref)
+{
+   struct visorinput_devdata *devdata =
+   container_of(kref, struct visorinput_devdata, kref);
+   unregister_client_input(devdata->visorinput_dev);
+   kfree(devdata);
+}
+
+static struct visorinput_devdata *
+devdata_get(struct visorinput_devdata *devdata)
+{
+   if (devdata)
+   kref_get(>kref);
+   return devdata;
+}
+
+static void devdata_put(struct visorinput_devdata *devdata)
+{
+   if (devdata)
+   kref_put(>kref, devdata_release);
+}
+
 static struct visorinput_devdata *
 devdata_create(struct visor_device *dev, enum visorinput_device_type devtype)
 {
@@ -385,6 +415,7 @@ devdata_create(struct visor_device *dev, enum 
visorinput_device_type devtype)
}
 
init_rwsem(>lock_visor_dev);
+   kref_init(>kref);
 
return devdata;
 
@@ -415,13 +446,6 @@ visorinput_probe(struct visor_device *dev)
 }
 
 static void
-unregister_client_input(struct input_dev *visorinput_dev)
-{
-   if (visorinput_dev)
-   input_unregister_device(visorinput_dev);
-}
-
-static void
 visorinput_remove(struct visor_device *dev)
 {
struct visorinput_devdata *devdata = dev_get_drvdata(>device);
@@ -438,9 +462,8 @@ visorinput_remove(struct visor_device *dev)
 
down_write(>lock_visor_dev);
dev_set_drvdata(>device, NULL);
-   unregister_client_input(devdata->visorinput_dev);
up_write(>lock_visor_dev);
-   kfree(devdata);
+   devdata_put(devdata);
 }
 
 /*
@@ -526,7 +549,8 @@ visorinput_channel_interrupt(struct visor_device *dev)
int xmotion, ymotion, zmotion, button;
int i;
 
-   struct visorinput_devdata *devdata = dev_get_drvdata(>device);
+   struct visorinput_devdata *devdata =
+   devdata_get(dev_get_drvdata(>device));
 
if (!devdata)
return;
@@ -616,6 +640,7 @@ visorinput_channel_interrupt(struct visor_device *dev)
}
}
 out_locked:
+   devdata_put(devdata);
up_write(>lock_visor_dev);
 }
 
-- 
2.1.4

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


  1   2   3   4   5   6   7   8   9   10   >