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, &features, 8);
+       if (err) {
+               dev_err(&dev->device,
+                       "%s failed to get features from chan (%d)\n",
+                       __func__, err);
+               return err;
+       }
+
+       features |= (feature_bits);
+
+       err = visorbus_write_channel(dev, channel_offset, &features, 8);
+       if (err) {
+               dev_err(&dev->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, &features, 8);
+       if (err) {
+               dev_err(&dev->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, &features, 8);
+       if (err) {
+               dev_err(&dev->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

Reply via email to