Eudyptula Challenge (Task 10)

2014-07-28 Thread Liviu I.
Hello Kernel Developers!

I've attached a small patch to fix a coding style problem and make checkpatch 
happy, as part of challenge 10 of Eudyptula.

Signed-off-by: Liviu Itoafa 

Thank you
--- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c.orig   2014-07-27 
20:26:53.714161698 +0100
+++ drivers/staging/lustre/lustre/ldlm/ldlm_extent.c2014-07-27 
20:27:50.410159692 +0100
@@ -151,7 +151,8 @@ static inline int lock_mode_to_index(ldl
 
LASSERT(mode != 0);
LASSERT(IS_PO2(mode));
-   for (index = -1; mode; index++, mode >>= 1) ;
+   for (index = -1; mode; index++, mode >>= 1)
+   ;
LASSERT(index < LCK_MODE_NUM);
return index;
 }
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Eudyptula Challenge (Task 10)

2014-07-28 Thread Dan Carpenter
Fix your From header and read paragraph 1 of
Documentation/email-clients.txt

regards,
dan carpenter

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


[PATCH 1/1] drivers: staging: vt6655: ioctl.c - missing __user annotation

2014-07-28 Thread Anil Belur
From: Anil Belur 

- private_ioctl() the internally calls copy_{to,from}_user() and does
  not use '__user' while refrencing user space pointers.
- this patch passes __user annotation as a cast, when the pointer is
 being refernced.
- this patch fixes the following sparse errors:
drivers/staging/vt6655/ioctl.c:44:12: warning: symbol 'wpa_Result' was not 
declared. Should it be static?
drivers/staging/vt6655/ioctl.c:78:51: warning: incorrect type in argument 2 
(different address spaces)
drivers/staging/vt6655/ioctl.c:78:51:expected void const [noderef] 
*from
drivers/staging/vt6655/ioctl.c:78:51:got void *data
drivers/staging/vt6655/ioctl.c:117:55: warning: incorrect type in argument 2 
(different address spaces)
drivers/staging/vt6655/ioctl.c:117:55:expected void const [noderef] 
*from
drivers/staging/vt6655/ioctl.c:117:55:got void *data
drivers/staging/vt6655/ioctl.c:149:46: warning: incorrect type in argument 1 
(different address spaces)
drivers/staging/vt6655/ioctl.c:149:46:expected void [noderef] *to
drivers/staging/vt6655/ioctl.c:149:46:got void *data
drivers/staging/vt6655/ioctl.c:166:51: warning: incorrect type in argument 2 
(different address spaces)
drivers/staging/vt6655/ioctl.c:166:51:expected void const [noderef] 
*from
drivers/staging/vt6655/ioctl.c:166:51:got void *data
drivers/staging/vt6655/ioctl.c:212:50: warning: incorrect type in argument 2 
(different address spaces)
drivers/staging/vt6655/ioctl.c:212:50:expected void const [noderef] 
*from
drivers/staging/vt6655/ioctl.c:212:50:got void *data
drivers/staging/vt6655/ioctl.c:276:38: warning: incorrect type in argument 1 
(different address spaces)
drivers/staging/vt6655/ioctl.c:276:38:expected void [noderef] *to
drivers/staging/vt6655/ioctl.c:276:38:got void *data
drivers/staging/vt6655/ioctl.c:292:38: warning: incorrect type in argument 1 
(different address spaces)
drivers/staging/vt6655/ioctl.c:292:38:expected void [noderef] *to
drivers/staging/vt6655/ioctl.c:292:38:got void *data
drivers/staging/vt6655/ioctl.c:300:48: warning: incorrect type in argument 2 
(different address spaces)
drivers/staging/vt6655/ioctl.c:300:48:expected void const [noderef] 
*from
drivers/staging/vt6655/ioctl.c:300:48:got void *data
drivers/staging/vt6655/ioctl.c:344:38: warning: incorrect type in argument 1 
(different address spaces)
drivers/staging/vt6655/ioctl.c:344:38:expected void [noderef] *to
drivers/staging/vt6655/ioctl.c:344:38:got void *data
drivers/staging/vt6655/ioctl.c:353:38: warning: incorrect type in argument 1 
(different address spaces)
drivers/staging/vt6655/ioctl.c:353:38:expected void [noderef] *to
drivers/staging/vt6655/ioctl.c:353:38:got void *data
drivers/staging/vt6655/ioctl.c:360:38: warning: incorrect type in argument 1 
(different address spaces)
drivers/staging/vt6655/ioctl.c:360:38:expected void [noderef] *to
drivers/staging/vt6655/ioctl.c:360:38:got void *data
drivers/staging/vt6655/ioctl.c:401:49: warning: incorrect type in argument 2 
(different address spaces)
drivers/staging/vt6655/ioctl.c:401:49:expected void const [noderef] 
*from
drivers/staging/vt6655/ioctl.c:401:49:got void *data
drivers/staging/vt6655/ioctl.c:424:49: warning: incorrect type in argument 2 
(different address spaces)
drivers/staging/vt6655/ioctl.c:424:49:expected void const [noderef] 
*from
drivers/staging/vt6655/ioctl.c:424:49:got void *data
drivers/staging/vt6655/ioctl.c:440:49: warning: incorrect type in argument 2 
(different address spaces)
drivers/staging/vt6655/ioctl.c:440:49:expected void const [noderef] 
*from
drivers/staging/vt6655/ioctl.c:440:49:got void *data
drivers/staging/vt6655/ioctl.c:457:49: warning: incorrect type in argument 2 
(different address spaces)
drivers/staging/vt6655/ioctl.c:457:49:expected void const [noderef] 
*from
drivers/staging/vt6655/ioctl.c:457:49:got void *data
drivers/staging/vt6655/ioctl.c:479:54: warning: incorrect type in argument 2 
(different address spaces)
drivers/staging/vt6655/ioctl.c:479:54:expected void const [noderef] 
*from
drivers/staging/vt6655/ioctl.c:479:54:got void *data
drivers/staging/vt6655/ioctl.c:563:38: warning: incorrect type in argument 1 
(different address spaces)
drivers/staging/vt6655/ioctl.c:563:38:expected void [noderef] *to
drivers/staging/vt6655/ioctl.c:563:38:got void *data
drivers/staging/vt6655/ioctl.c:571:52: warning: incorrect type in argument 2 
(different address spaces)
drivers/staging/vt6655/ioctl.c:571:52:expected void const [noderef] 
*from
drivers/staging/vt6655/ioctl.c:571:52:got void *data
drivers/staging/vt6655/ioctl.c:615:38: warning: incorrect type in argument 1 
(different address spaces)
drivers/staging/vt6655/ioctl.c:615:38:expected void [noderef] *to
drivers/staging/vt6655/ioctl.c:615:38:got void *data
drivers/staging/vt6655/ioctl.c:631:53: warning: incorrect type in argument 2 
(different address spaces)
dr

Re: [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq()

2014-07-28 Thread Ian Abbott

On 2014-07-27 19:45, Greg Kroah-Hartman wrote:

On Fri, Jul 25, 2014 at 06:23:10PM +, Hartley Sweeten wrote:

On Friday, July 25, 2014 10:07 AM, Ian Abbott wrote:

`dio200_detach()` in "amplc_dio200.c" calls
`amplc_dio200_common_detach()` in "amplc_dio200_common.c", followed by
`comedi_legacy_detach()` in "../drivers.c".  Both of those functions
call `free_irq()` if `dev->irq` is non-zero.  The second call produces a
warning message because the handler has already been freed.  Prevent
that by setting `dev->irq = 0` in `amplc_dio200_common_detach()`.

Signed-off-by: Ian Abbott 
---
  drivers/staging/comedi/drivers/amplc_dio200_common.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c 
b/drivers/staging/comedi/drivers/amplc_dio200_common.c
index 78700e8..3592e58 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
@@ -1202,8 +1202,10 @@ void amplc_dio200_common_detach(struct comedi_device 
*dev)

if (!thisboard || !devpriv)
return;
-   if (dev->irq)
+   if (dev->irq) {
free_irq(dev->irq, dev);
+   dev->irq = 0;
+   }
  }
  EXPORT_SYMBOL_GPL(amplc_dio200_common_detach);


Ian,

I have already gave a Reviewed-by signoff for this series.

After looking over the code I think a cleaner solution would be to:

1) Use comedi_legacy_detach() directly for the (*detach) in the
legacy ISA driver.
2) Move the code from amplc_dio200_common_detach() into the
(*detach) function for the PCI driver.
3) Remove the exported function amplc_dio200_common_detach().


So should I not apply these patches?

confused,

greg k-h


It fixes a bug (harmless, apart from a kernel warning), and does no 
harm, so might as well apply them.  Hartley's suggestion can be done later.


--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


经济动作的三不原则

2014-07-28 Thread 28


经济动作的三不原则mP.xls
Description: Binary data
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: usbip: remove redundant return statements

2014-07-28 Thread Max Vozeler
Remove redundant return statements at the end of void functions. This
addresses the checkpatch.pl warnings:

WARNING: void function return statements are not generally useful
#533: FILE: stub_rx.c:533:
+   return;
+}
#1125: FILE: vhci_hcd.c:1125:
+   return;
+}
#116: FILE: vhci_rx.c:116:
+   return;
+}

Signed-off-by: Max Vozeler 
---
 drivers/staging/usbip/stub_rx.c  | 1 -
 drivers/staging/usbip/vhci_hcd.c | 1 -
 drivers/staging/usbip/vhci_rx.c  | 2 --
 3 files changed, 4 deletions(-)

diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c
index eac1325..5156588 100644
--- a/drivers/staging/usbip/stub_rx.c
+++ b/drivers/staging/usbip/stub_rx.c
@@ -530,7 +530,6 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,
}
 
usbip_dbg_stub_rx("Leave\n");
-   return;
 }
 
 /* recv a pdu */
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c
index e21c1b4..c02374b 100644
--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c
@@ -1121,7 +1121,6 @@ static struct platform_driver vhci_driver = {
  */
 static void the_pdev_release(struct device *dev)
 {
-   return;
 }
 
 static struct platform_device the_pdev = {
diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/staging/usbip/vhci_rx.c
index d07fcb5..00e4a54 100644
i--- a/drivers/staging/usbip/vhci_rx.c
+++ b/drivers/staging/usbip/vhci_rx.c
@@ -111,8 +111,6 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev,
usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status);
 
usbip_dbg_vhci_rx("Leave\n");
-
-   return;
 }
 
 static struct vhci_unlink *dequeue_pending_unlink(struct vhci_device *vdev,
-- 
2.0.1

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


[PATCH 7/7] staging: comedi: amplc_pc236, amplc_pci236: get rid of bustype

2014-07-28 Thread Ian Abbott
The `bustype` member of `struct pc236_board` variables is initialized,
but never used.  Remove it along with the enumerated constants
associated with it.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/amplc_pc236.c  | 1 -
 drivers/staging/comedi/drivers/amplc_pc236.h  | 3 ---
 drivers/staging/comedi/drivers/amplc_pci236.c | 1 -
 3 files changed, 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c 
b/drivers/staging/comedi/drivers/amplc_pc236.c
index b95b877..875cc19 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -65,7 +65,6 @@ static int pc236_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
 static const struct pc236_board pc236_boards[] = {
{
.name = "pc36at",
-   .bustype = isa_bustype,
},
 };
 
diff --git a/drivers/staging/comedi/drivers/amplc_pc236.h 
b/drivers/staging/comedi/drivers/amplc_pc236.h
index 37348f1..91d6d9c 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.h
+++ b/drivers/staging/comedi/drivers/amplc_pc236.h
@@ -25,11 +25,8 @@
 
 struct comedi_device;
 
-enum pc236_bustype { isa_bustype, pci_bustype };
-
 struct pc236_board {
const char *name;
-   enum pc236_bustype bustype;
void (*intr_update_cb)(struct comedi_device *dev, bool enable);
bool (*intr_chk_clr_cb)(struct comedi_device *dev);
 };
diff --git a/drivers/staging/comedi/drivers/amplc_pci236.c 
b/drivers/staging/comedi/drivers/amplc_pci236.c
index a7e7a6f..436aeba 100644
--- a/drivers/staging/comedi/drivers/amplc_pci236.c
+++ b/drivers/staging/comedi/drivers/amplc_pci236.c
@@ -90,7 +90,6 @@ static const struct pc236_board pc236_pci_board = {
.name = "pci236",
.intr_update_cb = pci236_intr_update_cb,
.intr_chk_clr_cb = pci236_intr_chk_clr_cb,
-   .bustype = pci_bustype,
 };
 
 static int pci236_auto_attach(struct comedi_device *dev,
-- 
2.0.0

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


[PATCH 5/7] staging: comedi: amplc_pc236: add callback to check and clear interrupt

2014-07-28 Thread Ian Abbott
Add an optional callback function pointer to the board data to be called
when checking if an interrupt has occurred and to clear it if it has.

Since the callback returns `bool`, change a few other `int` values to
`bool` to match.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/amplc_pc236.c | 40 +---
 1 file changed, 24 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c 
b/drivers/staging/comedi/drivers/amplc_pc236.c
index c69aa2d..677911b 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -83,6 +83,7 @@ struct pc236_board {
const char *name;
enum pc236_bustype bustype;
void (*intr_update_cb)(struct comedi_device *dev, bool enable);
+   bool (*intr_chk_clr_cb)(struct comedi_device *dev);
 };
 
 struct pc236_private {
@@ -120,29 +121,21 @@ static void pc236_intr_update(struct comedi_device *dev, 
bool enable)
  * the interrupt has been marked as enabled and was generated by the
  * board.  If so, the function prepares the hardware for the next
  * interrupt.
- * Returns 0 if the interrupt should be ignored.
+ * Returns false if the interrupt should be ignored.
  */
-static int pc236_intr_check(struct comedi_device *dev)
+static bool pc236_intr_check(struct comedi_device *dev)
 {
const struct pc236_board *thisboard = comedi_board(dev);
struct pc236_private *devpriv = dev->private;
-   int retval = 0;
+   bool retval = false;
unsigned long flags;
-   unsigned int intcsr;
 
spin_lock_irqsave(&dev->spinlock, flags);
if (devpriv->enable_irq) {
-   retval = 1;
-   if (is_pci_board(thisboard)) {
-   intcsr = inl(devpriv->lcr_iobase + PLX9052_INTCSR);
-   if (!(intcsr & PLX9052_INTCSR_LI1STAT)) {
-   retval = 0;
-   } else {
-   /* Clear interrupt and keep it enabled. */
-   outl(PCI236_INTR_ENABLE,
-devpriv->lcr_iobase + PLX9052_INTCSR);
-   }
-   }
+   if (thisboard->intr_chk_clr_cb)
+   retval = thisboard->intr_chk_clr_cb(dev);
+   else
+   retval = true;
}
spin_unlock_irqrestore(&dev->spinlock, flags);
 
@@ -236,7 +229,7 @@ static irqreturn_t pc236_interrupt(int irq, void *d)
 {
struct comedi_device *dev = d;
struct comedi_subdevice *s = dev->read_subdev;
-   int handled;
+   bool handled;
 
handled = pc236_intr_check(dev);
if (dev->attached && handled) {
@@ -312,13 +305,28 @@ static void pci236_intr_update_cb(struct comedi_device 
*dev, bool enable)
 {
struct pc236_private *devpriv = dev->private;
 
+   /* this will also clear the "local interrupt 1" latch */
outl(enable ? PCI236_INTR_ENABLE : PCI236_INTR_DISABLE,
 devpriv->lcr_iobase + PLX9052_INTCSR);
 }
 
+static bool pci236_intr_chk_clr_cb(struct comedi_device *dev)
+{
+   struct pc236_private *devpriv = dev->private;
+
+   /* check if interrupt occurred */
+   if (!(inl(devpriv->lcr_iobase + PLX9052_INTCSR) &
+ PLX9052_INTCSR_LI1STAT))
+   return false;
+   /* clear the interrupt */
+   pci236_intr_update_cb(dev, devpriv->enable_irq);
+   return true;
+}
+
 static const struct pc236_board pc236_pci_board = {
.name = "pci236",
.intr_update_cb = pci236_intr_update_cb,
+   .intr_chk_clr_cb = pci236_intr_chk_clr_cb,
.bustype = pci_bustype,
 };
 
-- 
2.0.0

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


[PATCH 0/7] staging: comedi: amplc_pc236: split into separate ISA and PCI drivers

2014-07-28 Thread Ian Abbott
The "amplc_pc236" module is a low-level comedi driver that handles both
ISA boards (Amplicon PC36AT) and PCI boards (Amplicon PCI236).  Since
support for each is controlled by two separate kernel configuration
options, the module needs a small number of CPP conditionals to handle
the three different combinations (not counting the case where neither
option is enabled).

Split the module into three separate modules - "amplc_pci236" for the
Amplicon PCI236, the existing "amplc_pc236" for the PC36AT, and
"amplc_pc236_common" for the common code.

I may rename "amplc_pc236" to "amplc_pc36at" with a module alias to the
old module name, but it's such an old board, it may not be worth it.

1) staging: comedi: amplc_pc236: move static board data
2) staging: comedi: amplc_pc236: don't disable h/w interrupt on detach()
3) staging: comedi: amplc_pc236: add callback to enable/disable
   interrupt
4) staging: comedi: amplc_pc236: combine interrupt enable/disable
   functions
5) staging: comedi: amplc_pc236: add callback to check and clear
   interrupt
6) staging: comedi: amplc_pc236: split into ISA, PCI and common module
7) staging: comedi: amplc_pc236, amplc_pci236: get rid of bustype

I think this warning in PATCH 6 is a false positive:

WARNING: Missing a blank line after declarations
#535: FILE: drivers/staging/comedi/drivers/amplc_pc236.h:33:
+   enum pc236_bustype bustype;
+   void (*intr_update_cb)(struct comedi_device *dev, bool enable);

total: 0 errors, 1 warnings, 856 lines checked

 drivers/staging/comedi/Kconfig |   2 +-
 drivers/staging/comedi/drivers/Makefile|   4 +-
 drivers/staging/comedi/drivers/amplc_pc236.c   | 379 +
 drivers/staging/comedi/drivers/amplc_pc236.h   |  42 +++
 .../staging/comedi/drivers/amplc_pc236_common.c| 206 +++
 drivers/staging/comedi/drivers/amplc_pci236.c  | 161 +
 6 files changed, 429 insertions(+), 365 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/7] staging: comedi: amplc_pc236: move static board data

2014-07-28 Thread Ian Abbott
Move the static board data in `pc236_isa_boards[]` and `pc236_pci_board`
closer to where they are used.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/amplc_pc236.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c 
b/drivers/staging/comedi/drivers/amplc_pc236.c
index b92fc6f..c96519d 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -84,18 +84,6 @@ struct pc236_board {
enum pc236_bustype bustype;
 };
 
-static const struct pc236_board pc236_isa_boards[] = {
-   {
-   .name = "pc36at",
-   .bustype = isa_bustype,
-   },
-};
-
-static const struct pc236_board pc236_pci_board = {
-   .name = "pci236",
-   .bustype = pci_bustype,
-};
-
 struct pc236_private {
unsigned long lcr_iobase; /* PLX PCI9052 config registers in PCIBAR1 */
int enable_irq;
@@ -342,6 +330,11 @@ static int pc236_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
return pc236_common_attach(dev, dev->iobase, it->options[1], 0);
 }
 
+static const struct pc236_board pc236_pci_board = {
+   .name = "pci236",
+   .bustype = pci_bustype,
+};
+
 static int pc236_auto_attach(struct comedi_device *dev,
   unsigned long context_unused)
 {
@@ -387,6 +380,13 @@ static void pc236_detach(struct comedi_device *dev)
}
 }
 
+static const struct pc236_board pc236_isa_boards[] = {
+   {
+   .name = "pc36at",
+   .bustype = isa_bustype,
+   },
+};
+
 static struct comedi_driver amplc_pc236_driver = {
.driver_name = "amplc_pc236",
.module = THIS_MODULE,
-- 
2.0.0

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


[PATCH 2/7] staging: comedi: amplc_pc236: don't disable h/w interrupt on detach()

2014-07-28 Thread Ian Abbott
If an asynchronous command was running when the device is being
detached, the comedi core would have called the subdevice `cancel`
handler (`pc236_intr_cancel()`) before calling the `detach` handler
(`pc236_detach()`).  Since the cancel handler disables hardware
interrupts (at least for the PCI236 board) by calling
`pc236_disable_intr()`, there is no need for the detach handler to do so
as well.  Remove the call to `pc236_disable_intr()` from
`pc236_detach()`.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/amplc_pc236.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c 
b/drivers/staging/comedi/drivers/amplc_pc236.c
index c96519d..32275a5 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -369,8 +369,6 @@ static void pc236_detach(struct comedi_device *dev)
 
if (!thisboard)
return;
-   if (dev->iobase)
-   pc236_intr_disable(dev);
if (is_isa_board(thisboard)) {
comedi_legacy_detach(dev);
} else if (is_pci_board(thisboard)) {
-- 
2.0.0

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


[PATCH 3/7] staging: comedi: amplc_pc236: add callback to enable/disable interrupt

2014-07-28 Thread Ian Abbott
Add an optional callback function pointer to the board data to be called
when interrupts are logically enabled or disabled to update the hardware
registers.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/amplc_pc236.c | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c 
b/drivers/staging/comedi/drivers/amplc_pc236.c
index 32275a5..7b78d57 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -82,6 +82,7 @@ enum pc236_bustype { isa_bustype, pci_bustype };
 struct pc236_board {
const char *name;
enum pc236_bustype bustype;
+   void (*intr_update_cb)(struct comedi_device *dev, bool enable);
 };
 
 struct pc236_private {
@@ -114,8 +115,8 @@ static void pc236_intr_disable(struct comedi_device *dev)
 
spin_lock_irqsave(&dev->spinlock, flags);
devpriv->enable_irq = 0;
-   if (is_pci_board(thisboard))
-   outl(PCI236_INTR_DISABLE, devpriv->lcr_iobase + PLX9052_INTCSR);
+   if (thisboard->intr_update_cb)
+   thisboard->intr_update_cb(dev, false);
spin_unlock_irqrestore(&dev->spinlock, flags);
 }
 
@@ -132,8 +133,8 @@ static void pc236_intr_enable(struct comedi_device *dev)
 
spin_lock_irqsave(&dev->spinlock, flags);
devpriv->enable_irq = 1;
-   if (is_pci_board(thisboard))
-   outl(PCI236_INTR_ENABLE, devpriv->lcr_iobase + PLX9052_INTCSR);
+   if (thisboard->intr_update_cb)
+   thisboard->intr_update_cb(dev, true);
spin_unlock_irqrestore(&dev->spinlock, flags);
 }
 
@@ -330,8 +331,17 @@ static int pc236_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
return pc236_common_attach(dev, dev->iobase, it->options[1], 0);
 }
 
+static void pci236_intr_update_cb(struct comedi_device *dev, bool enable)
+{
+   struct pc236_private *devpriv = dev->private;
+
+   outl(enable ? PCI236_INTR_ENABLE : PCI236_INTR_DISABLE,
+devpriv->lcr_iobase + PLX9052_INTCSR);
+}
+
 static const struct pc236_board pc236_pci_board = {
.name = "pci236",
+   .intr_update_cb = pci236_intr_update_cb,
.bustype = pci_bustype,
 };
 
-- 
2.0.0

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


[PATCH 4/7] staging: comedi: amplc_pc236: combine interrupt enable/disable functions

2014-07-28 Thread Ian Abbott
`pc236_intr_enable()` and `pc236_intr_disable()` are very similar.
Combine them into a single function `pc236_intr_update()` with a
parameter to indicate whether interrupts are being enabled or disabled.

Change type type of the `enable_irq` member of the private data to
`bool` to match the parameter.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/amplc_pc236.c | 37 ++--
 1 file changed, 7 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c 
b/drivers/staging/comedi/drivers/amplc_pc236.c
index 7b78d57..c69aa2d 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -87,7 +87,7 @@ struct pc236_board {
 
 struct pc236_private {
unsigned long lcr_iobase; /* PLX PCI9052 config registers in PCIBAR1 */
-   int enable_irq;
+   bool enable_irq;
 };
 
 /* test if ISA supported and this is an ISA board */
@@ -102,39 +102,16 @@ static inline bool is_pci_board(const struct pc236_board 
*board)
return DO_PCI && board->bustype == pci_bustype;
 }
 
-/*
- * This function is called to mark the interrupt as disabled (no command
- * configured on subdevice 1) and to physically disable the interrupt
- * (not possible on the PC36AT, except by removing the IRQ jumper!).
- */
-static void pc236_intr_disable(struct comedi_device *dev)
-{
-   const struct pc236_board *thisboard = comedi_board(dev);
-   struct pc236_private *devpriv = dev->private;
-   unsigned long flags;
-
-   spin_lock_irqsave(&dev->spinlock, flags);
-   devpriv->enable_irq = 0;
-   if (thisboard->intr_update_cb)
-   thisboard->intr_update_cb(dev, false);
-   spin_unlock_irqrestore(&dev->spinlock, flags);
-}
-
-/*
- * This function is called to mark the interrupt as enabled (a command
- * configured on subdevice 1) and to physically enable the interrupt
- * (not possible on the PC36AT, except by (re)connecting the IRQ jumper!).
- */
-static void pc236_intr_enable(struct comedi_device *dev)
+static void pc236_intr_update(struct comedi_device *dev, bool enable)
 {
const struct pc236_board *thisboard = comedi_board(dev);
struct pc236_private *devpriv = dev->private;
unsigned long flags;
 
spin_lock_irqsave(&dev->spinlock, flags);
-   devpriv->enable_irq = 1;
+   devpriv->enable_irq = enable;
if (thisboard->intr_update_cb)
-   thisboard->intr_update_cb(dev, true);
+   thisboard->intr_update_cb(dev, enable);
spin_unlock_irqrestore(&dev->spinlock, flags);
 }
 
@@ -235,7 +212,7 @@ static int pc236_intr_cmdtest(struct comedi_device *dev,
  */
 static int pc236_intr_cmd(struct comedi_device *dev, struct comedi_subdevice 
*s)
 {
-   pc236_intr_enable(dev);
+   pc236_intr_update(dev, true);
 
return 0;
 }
@@ -246,7 +223,7 @@ static int pc236_intr_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
 static int pc236_intr_cancel(struct comedi_device *dev,
 struct comedi_subdevice *s)
 {
-   pc236_intr_disable(dev);
+   pc236_intr_update(dev, false);
 
return 0;
 }
@@ -291,7 +268,7 @@ static int pc236_common_attach(struct comedi_device *dev, 
unsigned long iobase,
s = &dev->subdevices[1];
dev->read_subdev = s;
s->type = COMEDI_SUBD_UNUSED;
-   pc236_intr_disable(dev);
+   pc236_intr_update(dev, false);
if (irq) {
if (request_irq(irq, pc236_interrupt, req_irq_flags,
dev->board_name, dev) >= 0) {
-- 
2.0.0

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


[PATCH 6/7] staging: comedi: amplc_pc236: split into ISA, PCI and common module

2014-07-28 Thread Ian Abbott
The "amplc_pc236" driver currently handles both ISA and PCI devices and
uses a small amount of conditional compilation depending which are
enabled.

Move most of the functionality into a new module, "amplc_pc236_common",
and split off support for PCI devices into a new module, "amplc_pci236".
Retain support for ISA devices in the existing module, "amplc_pc236".

Since the `detach` handler (`pc236_detach()`) in the existing module
"amplc_pc236" now only needs to handle ISA devices and only calls
`comedi_legacy_detach()`, just use `comedi_legacy_detach()` directly as
the `detach` handler in `struct comedi_driver amplc_pc236_driver`.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/Kconfig |   2 +-
 drivers/staging/comedi/drivers/Makefile|   4 +-
 drivers/staging/comedi/drivers/amplc_pc236.c   | 363 +
 drivers/staging/comedi/drivers/amplc_pc236.h   |  45 +++
 .../staging/comedi/drivers/amplc_pc236_common.c| 206 
 drivers/staging/comedi/drivers/amplc_pci236.c  | 162 +
 6 files changed, 429 insertions(+), 353 deletions(-)
 create mode 100644 drivers/staging/comedi/drivers/amplc_pc236.h
 create mode 100644 drivers/staging/comedi/drivers/amplc_pc236_common.c
 create mode 100644 drivers/staging/comedi/drivers/amplc_pci236.c

diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index 341fc07..36f2c71 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -815,7 +815,7 @@ config COMEDI_AMPLC_PC236_PCI
  Enable support for Amplicon PCI236 DIO board.
 
  To compile this driver as a module, choose M here: the module will be
- called amplc_pc236.
+ called amplc_pci236.
 
 config COMEDI_AMPLC_PC263_PCI
tristate "Amplicon PCI263 relay board support"
diff --git a/drivers/staging/comedi/drivers/Makefile 
b/drivers/staging/comedi/drivers/Makefile
index 0757a82..8873d48 100644
--- a/drivers/staging/comedi/drivers/Makefile
+++ b/drivers/staging/comedi/drivers/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_COMEDI_SKEL) += skel.o
 
 # Comedi ISA drivers
 obj-$(CONFIG_COMEDI_AMPLC_DIO200_ISA)  += amplc_dio200.o
+obj-$(CONFIG_COMEDI_AMPLC_PC236_ISA)   += amplc_pc236.o
 obj-$(CONFIG_COMEDI_AMPLC_PC263_ISA)   += amplc_pc263.o
 obj-$(CONFIG_COMEDI_PCL711)+= pcl711.o
 obj-$(CONFIG_COMEDI_PCL724)+= pcl724.o
@@ -80,7 +81,7 @@ obj-$(CONFIG_COMEDI_ADV_PCI1723)  += adv_pci1723.o
 obj-$(CONFIG_COMEDI_ADV_PCI1724)   += adv_pci1724.o
 obj-$(CONFIG_COMEDI_ADV_PCI_DIO)   += adv_pci_dio.o
 obj-$(CONFIG_COMEDI_AMPLC_DIO200_PCI)  += amplc_dio200_pci.o
-obj-$(CONFIG_COMEDI_AMPLC_PC236)   += amplc_pc236.o
+obj-$(CONFIG_COMEDI_AMPLC_PC236_PCI)   += amplc_pci236.o
 obj-$(CONFIG_COMEDI_AMPLC_PC263_PCI)   += amplc_pci263.o
 obj-$(CONFIG_COMEDI_AMPLC_PCI224)  += amplc_pci224.o
 obj-$(CONFIG_COMEDI_AMPLC_PCI230)  += amplc_pci230.o
@@ -138,5 +139,6 @@ obj-$(CONFIG_COMEDI_NI_LABPC_ISADMA)+= 
ni_labpc_isadma.o
 
 obj-$(CONFIG_COMEDI_8255)  += 8255.o
 obj-$(CONFIG_COMEDI_AMPLC_DIO200)  += amplc_dio200_common.o
+obj-$(CONFIG_COMEDI_AMPLC_PC236)   += amplc_pc236_common.o
 obj-$(CONFIG_COMEDI_DAS08) += das08.o
 obj-$(CONFIG_COMEDI_FC)+= comedi_fc.o
diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c 
b/drivers/staging/comedi/drivers/amplc_pc236.c
index 677911b..b95b877 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -1,6 +1,6 @@
 /*
  * comedi/drivers/amplc_pc236.c
- * Driver for Amplicon PC36AT and PCI236 DIO boards.
+ * Driver for Amplicon PC36AT DIO boards.
  *
  * Copyright (C) 2002 MEV Ltd. 
  *
@@ -19,21 +19,17 @@
  */
 /*
  * Driver: amplc_pc236
- * Description: Amplicon PC36AT, PCI236
+ * Description: Amplicon PC36AT
  * Author: Ian Abbott 
- * Devices: [Amplicon] PC36AT (pc36at), PCI236 (pci236)
- * Updated: Thu, 24 Jul 2014 14:25:26 +
+ * Devices: [Amplicon] PC36AT (pc36at)
+ * Updated: Fri, 25 Jul 2014 15:32:40 +
  * Status: works
  *
  * Configuration options - PC36AT:
  *   [0] - I/O port base address
  *   [1] - IRQ (optional)
  *
- * Manual configuration of PCI board (PCI236) is not supported; it is
- * configured automatically.
- *
- * The PC36AT ISA board and PCI236 PCI board have a single 8255 appearing
- * as subdevice 0.
+ * The PC36AT board has a single 8255 appearing as subdevice 0.
  *
  * Subdevice 1 pretends to be a digital input device, but it always returns
  * 0 when read. However, if you run a command with scan_begin_src=TRIG_EXT,
@@ -45,251 +41,16 @@
  */
 
 #include 
-#include 
-#include 
 
 #include "../comedidev.h"
 
-#include "comedi_fc.h"
-#include "8255.h"
-#include "plx9052.h"
-
-#define DO_ISA IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_ISA)
-#define DO_PCI IS_ENABLED(CONFIG_COMEDI_AMPLC_PC236_PCI)
-
-/* PC36AT / PCI236 registers */

Re: Eudyptula Challenge (Task 10)

2014-07-28 Thread Christoph Hellwig
Can you folks please stop this challenge Bullshit?  More checkpatch
fixes is not something we'll need at all.

Thanks you!

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


[PATCH v5] staging: unisys: move parahotplug to sysfs

2014-07-28 Thread Benjamin Romer
Move the /proc/visorchipset/parahotplug interface to sysfs under
/sys/devices/platform/visorchipset/parahotplug/deviceenabled and
/sys/devices/platform/visorchipset/parahotplug/devicedisabled.

The parahotplug interface is used to deal with SR-IOV recovery situations on
s-Par guest partitions. The command service partition will send a message to a
guest when an SR-IOV device that guest is using needs to be temporarily removed.
The message triggers a udev event that will cause a recovery script to run.
When that script has completed its work, it will write to one of the
parahotplug interfaces to send a message back to Command, indicating that the
recovery action has completed.

When a guest that is sharing an SR-IOV device is restarted, that guest will
take down the PF driver on the device, but any guests with VFs will not know
that their device needs to be reset as well. The recovery script makes it so
the device will be shut down fully and then restarted after the sharing guest
comes back up, and ensures that the timing is correct.

Moving this interface to sysfs orphans the visorchipset_proc_read_writeonly()
function, so it is also removed.

Signed-off-by: Benjamin Romer 
---
v5: the new attribute functions were fixed to include static declaration.
v4: this patch is unchanged from v3.
v3: The interface was split in two, so only the ID need be passed as a parameter
to use the interfaces. Additional documentation was added.
v2: attribute creation was fixed and checks for controlvm_channel pointer were
removed.

 .../unisys/visorchipset/visorchipset_main.c| 99 +-
 1 file changed, 39 insertions(+), 60 deletions(-)

diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c 
b/drivers/staging/unisys/visorchipset/visorchipset_main.c
index 156a72f..fd1f09e 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -98,19 +98,11 @@ static CONTROLVM_MESSAGE_PACKET g_DeviceChangeStatePacket;
 #define is_diagpool_channel(channel_type_guid) \
 (uuid_le_cmp(channel_type_guid, UltraDiagPoolChannelProtocolGuid) == 0)
 
-#define VISORCHIPSET_PARAHOTPLUG_PROC_ENTRY_FN "parahotplug"
-static struct proc_dir_entry *parahotplug_proc_dir;
-
 static LIST_HEAD(BusInfoList);
 static LIST_HEAD(DevInfoList);
 
-static struct proc_dir_entry *ProcDir;
 static VISORCHANNEL *ControlVm_channel;
 
-static ssize_t visorchipset_proc_read_writeonly(struct file *file,
-   char __user *buf,
-   size_t len, loff_t *offset);
-
 typedef struct {
U8 __iomem *ptr;/* pointer to base address of payload pool */
U64 offset; /* offset from beginning of controlvm
@@ -293,6 +285,14 @@ static ssize_t chipsetready_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count);
 static DEVICE_ATTR_WO(chipsetready);
 
+static ssize_t devicedisabled_store(struct device *dev,
+   struct device_attribute *attr, const char *buf, size_t count);
+static DEVICE_ATTR_WO(devicedisabled);
+
+static ssize_t deviceenabled_store(struct device *dev,
+   struct device_attribute *attr, const char *buf, size_t count);
+static DEVICE_ATTR_WO(deviceenabled);
+
 static struct attribute *visorchipset_install_attrs[] = {
&dev_attr_toolaction.attr,
&dev_attr_boottotool.attr,
@@ -317,9 +317,21 @@ static struct attribute_group visorchipset_guest_group = {
.attrs = visorchipset_guest_attrs
 };
 
+static struct attribute *visorchipset_parahotplug_attrs[] = {
+   &dev_attr_devicedisabled.attr,
+   &dev_attr_deviceenabled.attr,
+   NULL
+};
+
+static struct attribute_group visorchipset_parahotplug_group = {
+   .name = "parahotplug",
+   .attrs = visorchipset_parahotplug_attrs
+};
+
 static const struct attribute_group *visorchipset_dev_groups[] = {
&visorchipset_install_group,
&visorchipset_guest_group,
+   &visorchipset_parahotplug_group,
NULL
 };
 
@@ -1736,53 +1748,36 @@ parahotplug_process_message(CONTROLVM_MESSAGE *inmsg)
}
 }
 
-/*
- * Gets called when the udev script writes to
- * /proc/visorchipset/parahotplug.  Expects input in the form of "
- * " where  is the identifier passed to the script that
- * matches a request on the request list, and  is 0 or 1
- * indicating whether the device is now enabled or not.
+/* The parahotplug/devicedisabled interface gets called by our support script
+ * when an SR-IOV device has been shut down. The ID is passed to the script
+ * and then passed back when the device has been removed.
  */
-static ssize_t
-parahotplug_proc_write(struct file *file, const char __user *buffer,
-  size_t count, loff_t *ppos)
+static ssize_t devicedisabled_store(struct device *dev,
+   struct device_attribute *attr, const char *buf, size_t count)
 {
-

[PATCH] staging: dgnc: removes unused if defined code

2014-07-28 Thread Seunghun Lee
DGNC_TRACER and TRC_TO_KMEM are never defined.

This patch removes if defined DGNC_TRACER and TRC_TO_KMEM code.

CC: Lidza Louina 
CC: Mark Hounschell 
Signed-off-by: Seunghun Lee 
---
 drivers/staging/dgnc/dgnc_driver.c |4 ---
 drivers/staging/dgnc/dgnc_driver.h |   53 
 drivers/staging/dgnc/dgnc_trace.c  |8 --
 3 files changed, 65 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 68460af..a5be911 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -388,10 +388,6 @@ void dgnc_cleanup_module(void)
 
dgnc_tty_post_uninit();
 
-#if defined(DGNC_TRACER)
-   /* last thing, make sure we release the tracebuffer */
-   dgnc_tracer_free();
-#endif
if (dgnc_NumBoards)
pci_unregister_driver(&dgnc_driver);
 }
diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index b40ee2c..58b5aa7 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -91,57 +91,6 @@
 
 #defineDBG_CARR(dgnc_debug & 0x1)
 
-
-#if defined(DGNC_TRACER)
-
-# if defined(TRC_TO_KMEM)
-/* Choose one: */
-#  define TRC_ON_OVERFLOW_WRAP_AROUND
-#  undef  TRC_ON_OVERFLOW_SHIFT_BUFFER
-# endif /* TRC_TO_KMEM */
-
-# define TRC_MAXMSG1024
-# define TRC_OVERFLOW  "(OVERFLOW)"
-# define TRC_DTRC  "/usr/bin/dtrc"
-
-#if defined TRC_TO_CONSOLE
-#define PRINTF_TO_CONSOLE(args) { printk(DRVSTR": "); printk args; }
-#else /* !defined TRACE_TO_CONSOLE */
-#define PRINTF_TO_CONSOLE(args)
-#endif
-
-#if defined TRC_TO_KMEM
-#define PRINTF_TO_KMEM(args) dgnc_tracef args
-#else /* !defined TRC_TO_KMEM */
-#define PRINTF_TO_KMEM(args)
-#endif
-
-#defineTRC(args)   { PRINTF_TO_KMEM(args); PRINTF_TO_CONSOLE(args) 
}
-
-# define DPR_INIT(ARGS)if (DBG_INIT) TRC(ARGS)
-# define DPR_BASIC(ARGS)   if (DBG_BASIC) TRC(ARGS)
-# define DPR_CORE(ARGS)if (DBG_CORE) TRC(ARGS)
-# define DPR_OPEN(ARGS)if (DBG_OPEN)  TRC(ARGS)
-# define DPR_CLOSE(ARGS)   if (DBG_CLOSE)  TRC(ARGS)
-# define DPR_READ(ARGS)if (DBG_READ)  TRC(ARGS)
-# define DPR_WRITE(ARGS)   if (DBG_WRITE) TRC(ARGS)
-# define DPR_IOCTL(ARGS)   if (DBG_IOCTL) TRC(ARGS)
-# define DPR_PROC(ARGS)if (DBG_PROC)  TRC(ARGS)
-# define DPR_PARAM(ARGS)   if (DBG_PARAM)  TRC(ARGS)
-# define DPR_PSCAN(ARGS)   if (DBG_PSCAN)  TRC(ARGS)
-# define DPR_EVENT(ARGS)   if (DBG_EVENT)  TRC(ARGS)
-# define DPR_DRAIN(ARGS)   if (DBG_DRAIN)  TRC(ARGS)
-# define DPR_CARR(ARGS)if (DBG_CARR)  TRC(ARGS)
-# define DPR_MGMT(ARGS)if (DBG_MGMT)  TRC(ARGS)
-# define DPR_INTR(ARGS)if (DBG_INTR)  TRC(ARGS)
-# define DPR_MSIGS(ARGS)   if (DBG_MSIGS)  TRC(ARGS)
-
-# define DPR(ARGS) if (dgnc_debug) TRC(ARGS)
-# define P(X)  dgnc_tracef(#X "=%p\n", X)
-# define X(X)  dgnc_tracef(#X "=%x\n", X)
-
-#else/* !defined DGNC_TRACER */
-
 #define PRINTF_TO_KMEM(args)
 # define TRC(ARGS)
 # define DPR_INIT(ARGS)
@@ -164,8 +113,6 @@
 
 # define DPR(args)
 
-#endif/* DGNC_TRACER */
-
 /* Number of boards we support at once. */
 #defineMAXBOARDS   20
 #defineMAXPORTS8
diff --git a/drivers/staging/dgnc/dgnc_trace.c 
b/drivers/staging/dgnc/dgnc_trace.c
index d764154..3bb2259 100644
--- a/drivers/staging/dgnc/dgnc_trace.c
+++ b/drivers/staging/dgnc/dgnc_trace.c
@@ -42,14 +42,6 @@
 /* file level globals */
 static char *dgnc_trcbuf;  /* the ringbuffer */
 
-#if defined(TRC_TO_KMEM)
-static int dgnc_trcbufi = 0;   /* index of the tilde at the end of */
-#endif
-
-#if defined(TRC_TO_KMEM)
-static DEFINE_SPINLOCK(dgnc_tracef_lock);
-#endif
-
 /*
  * dgnc_tracer_free()
  *
-- 
1.7.9.5

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


Re: Eudyptula Challenge (Task 10)

2014-07-28 Thread Lucas Tanure
Hi Christoph,

What kind of things that you think a newbie can fix ?

Thanks
--
Lucas Tanure
+55 (19) 988176559


On Mon, Jul 28, 2014 at 9:53 AM, Christoph Hellwig  wrote:
> Can you folks please stop this challenge Bullshit?  More checkpatch
> fixes is not something we'll need at all.
>
> Thanks you!
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1 linux-next] staging: ion: vm_insert_pfn and zap_page_range rely on CONFIG_MMU

2014-07-28 Thread Fabian Frederick


> On 25 July 2014 at 00:02 Greg Kroah-Hartman 
> wrote:
>
>
> On Wed, Jul 23, 2014 at 09:04:38PM +0200, Fabian Frederick wrote:
> > Fix following sh-allmodconfig errors reported on kisskb
> > "
> > drivers/built-in.o: In function `ion_vm_fault':
> > ion.c:(.text+0x1f2d8f8): undefined reference to `vm_insert_pfn'
> > drivers/built-in.o: In function `ion_buffer_sync_for_device':
> > ion.c:(.text+0x1f316bc): undefined reference to `zap_page_range'
> > make: *** [vmlinux] Error 1
> > "
> >
> > Signed-off-by: Fabian Frederick 
> > ---
> >
> > This is untested.
>
> I'd like to see it tested before I apply it...

Hello Greg,
       
        I did the following compilation tests:
       
        -sh/allyesconfig/cross-compile: no longer tries to compile ion with this
patch.
(MMU is only selected on !CPU_SH2 sub-type)

        -sh/SH-x3 subtype/cross-compile (->mmu on): compilation ok

        -x86_64 Compilation ok.
       
Do you need more testing ?

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


Re: Eudyptula Challenge (Task 10)

2014-07-28 Thread Denis Kirjanov
On 7/28/14, Lucas Tanure  wrote:
> Hi Christoph,
>
> What kind of things that you think a newbie can fix ?

You can start working on fixing the pci_map_* and dma_map_* return
value checks with CONFIG_DMA_API_DEBUG enabled. A lot of drivers still
missing that...

> Thanks
> --
> Lucas Tanure
> +55 (19) 988176559
>
>
> On Mon, Jul 28, 2014 at 9:53 AM, Christoph Hellwig 
> wrote:
>> Can you folks please stop this challenge Bullshit?  More checkpatch
>> fixes is not something we'll need at all.
>>
>> Thanks you!
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel"
>> in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
>


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


Re: Eudyptula Challenge (Task 10)

2014-07-28 Thread Jason Cooper
On Mon, Jul 28, 2014 at 05:53:19AM -0700, Christoph Hellwig wrote:
> Can you folks please stop this challenge Bullshit?  More checkpatch
> fixes is not something we'll need at all.

Greg and Dan have previously said that the staging tree is a good place
for newcomers to submit checkpatch cleanup patches.  However, I think
there are a few tweaks that could be made to the Eudyptula Challenge to
avoid this noise/frustration:

  - No need to send to lkml, the staging tree ML is probably fine.

  - Don't mention Eudyptula Challenge, it's not relevant to the patch.
 * It looks like you want a cookie.  We have none.

  - Submit the patch to the Challenge admins first for review.  This
patch submission should have never made the cut.
 - No S-o-B
 - MIME attachment
 - Subject line is just wrong
 - Full name missing in From:

I've worked with several participants of the challenge and never saw
this many things wrong with a patch submission.  Either the admins are
dropping the ball, or this participant got loose somehow. :)

It makes me wonder if they should start with a git workflow from day
one?  It would prevent a lot of these avoidable mistakes.

thx,

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


[PATCH 1/1] staging: rtl8192u: mark some functions as static.

2014-07-28 Thread Antoine Schweitzer-Chaput
Some functions defined in r8192U_core.c and only used locally are marked as 
static.
This fixes some warnings issued by sparse.

Signed-off-by: Antoine Schweitzer-Chaput 
---
 drivers/staging/rtl8192u/r8192U_core.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 7640386..4536a87 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -667,7 +667,7 @@ static void tx_timeout(struct net_device *dev)
 
 
 /* this is only for debug */
-void dump_eprom(struct net_device *dev)
+static void dump_eprom(struct net_device *dev)
 {
int i;
for (i = 0; i < 63; i++)
@@ -1553,7 +1553,8 @@ u16 N_DBPSOfRate(u16 DataRate)
return N_DBPS;
 }
 
-unsigned int txqueue2outpipe(struct r8192_priv *priv, unsigned int tx_queue)
+static unsigned int txqueue2outpipe(struct r8192_priv *priv,
+   unsigned int tx_queue)
 {
if (tx_queue >= 9) {
RT_TRACE(COMP_ERR, "%s():Unknown queue ID!!!\n", __func__);
@@ -4873,7 +4874,8 @@ static void query_rxdesc_status(struct sk_buff *skb,
 
 }
 
-u32 GetRxPacketShiftBytes819xUsb(struct ieee80211_rx_stats  *Status, bool 
bIsRxAggrSubframe)
+static u32 GetRxPacketShiftBytes819xUsb(struct ieee80211_rx_stats *Status,
+   bool bIsRxAggrSubframe)
 {
 #ifdef USB_RX_AGGREGATION_SUPPORT
if (bIsRxAggrSubframe)
-- 
1.7.10.4

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


RE: [PATCH 1/3] staging: comedi: amplc_dio200_common: prevent extra free_irq()

2014-07-28 Thread Hartley Sweeten
On Sunday, July 27, 2014 11:45 AM, Greg Kroah-Hartman wrote:
> On Fri, Jul 25, 2014 at 06:23:10PM +, Hartley Sweeten wrote:
>> On Friday, July 25, 2014 10:07 AM, Ian Abbott wrote:
>>> `dio200_detach()` in "amplc_dio200.c" calls
>>> `amplc_dio200_common_detach()` in "amplc_dio200_common.c", followed by
>>> `comedi_legacy_detach()` in "../drivers.c".  Both of those functions
>>> call `free_irq()` if `dev->irq` is non-zero.  The second call produces a
>>> warning message because the handler has already been freed.  Prevent
>>> that by setting `dev->irq = 0` in `amplc_dio200_common_detach()`.
>>>
>>> Signed-off-by: Ian Abbott 
>>>
>> I have already gave a Reviewed-by signoff for this series.
>> 
>> After looking over the code I think a cleaner solution would be to:
>> 
>> 1) Use comedi_legacy_detach() directly for the (*detach) in the
>>legacy ISA driver.
>> 2) Move the code from amplc_dio200_common_detach() into the
>>(*detach) function for the PCI driver.
>> 3) Remove the exported function amplc_dio200_common_detach().
>
> So should I not apply these patches?

Greg,

Yes, please apply this series from Ian. It does fix a bug with the
duplicate free_irq().

The comments I gave can be addressed in a later patch.

Sorry for the confusion.
Hartley
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/6] drivers/staging/bcm/IPIv6Protocol.c: cleanup patches

2014-07-28 Thread Matthias Beyer
Hi,

these are my patches for the

drivers/staging/bcm/IPv6Protocol.c

file.

Please note: I'm not able to test these patches as I do not have the appropriate
hardware, I compiled them at least.

Kind regards,
Matthias Beyer

Matthias Beyer (6):
  Staging: bcm: IPv6Protocol.c: Reindented switch-case
  Staging: bcm: IPv6Protocol.c: Removed unnecessary if-else blocks
  Staging: bcm: IPv6Procotol.c: Replaced member accessing with variable
  Staging: bcm: IPv6Protocol.c: Replaced member accessing with variable
  Staging: bcm: IPv6Protocol.c: Whitespace cleanup
  Staging: bcm: IPv6Protocol.c: Line length fixes

 drivers/staging/bcm/IPv6Protocol.c | 211 -
 1 file changed, 115 insertions(+), 96 deletions(-)

-- 
2.0.2

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


[PATCH 1/6] Staging: bcm: IPv6Protocol.c: Reindented switch-case

2014-07-28 Thread Matthias Beyer
This patch removes the unneccessary blocks inside the case statements
and fixes the indentation of their content.

Signed-off-by: Matthias Beyer 
---
 drivers/staging/bcm/IPv6Protocol.c | 88 +-
 1 file changed, 40 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/bcm/IPv6Protocol.c 
b/drivers/staging/bcm/IPv6Protocol.c
index e013c5a..44021da 100644
--- a/drivers/staging/bcm/IPv6Protocol.c
+++ b/drivers/staging/bcm/IPv6Protocol.c
@@ -34,12 +34,9 @@ static UCHAR *GetNextIPV6ChainedHeader(UCHAR **ppucPayload,
 
switch (*pucNextHeader) {
case IPV6HDR_TYPE_HOPBYHOP:
-   {
-
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
-   DBG_LVL_ALL, "\nIPv6 HopByHop Header");
-   usNextHeaderOffset += sizeof(struct 
bcm_ipv6_options_hdr);
-   }
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
+   DBG_LVL_ALL, "\nIPv6 HopByHop Header");
+   usNextHeaderOffset += sizeof(struct bcm_ipv6_options_hdr);
break;
 
case IPV6HDR_TYPE_ROUTING:
@@ -48,37 +45,41 @@ static UCHAR *GetNextIPV6ChainedHeader(UCHAR **ppucPayload,
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
DBG_LVL_ALL, "\nIPv6 Routing Header");
-   pstIpv6RoutingHeader = (struct bcm_ipv6_routing_hdr 
*)pucPayloadPtr;
+   pstIpv6RoutingHeader =
+   (struct bcm_ipv6_routing_hdr *)pucPayloadPtr;
usNextHeaderOffset += sizeof(struct 
bcm_ipv6_routing_hdr);
-   usNextHeaderOffset += 
pstIpv6RoutingHeader->ucNumAddresses * IPV6_ADDRESS_SIZEINBYTES;
-
+   usNextHeaderOffset += 
pstIpv6RoutingHeader->ucNumAddresses *
+ IPV6_ADDRESS_SIZEINBYTES;
}
break;
-   case IPV6HDR_TYPE_FRAGMENTATION:
-   {
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
-   DBG_LVL_ALL,
-   "\nIPv6 Fragmentation Header");
-   usNextHeaderOffset += sizeof(struct 
bcm_ipv6_fragment_hdr);
 
-   }
+   case IPV6HDR_TYPE_FRAGMENTATION:
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
+   DBG_LVL_ALL,
+   "\nIPv6 Fragmentation Header");
+   usNextHeaderOffset += sizeof(struct bcm_ipv6_fragment_hdr);
break;
+
case IPV6HDR_TYPE_DESTOPTS:
{
-   struct bcm_ipv6_dest_options_hdr *pstIpv6DestOptsHdr = 
(struct bcm_ipv6_dest_options_hdr *)pucPayloadPtr;
+   struct bcm_ipv6_dest_options_hdr *pstIpv6DestOptsHdr =
+   (struct bcm_ipv6_dest_options_hdr 
*)pucPayloadPtr;
int nTotalOptions = pstIpv6DestOptsHdr->ucHdrExtLen;
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
DBG_LVL_ALL,
"\nIPv6 DestOpts Header Header");
usNextHeaderOffset += sizeof(struct 
bcm_ipv6_dest_options_hdr);
-   usNextHeaderOffset += nTotalOptions * 
IPV6_DESTOPTS_HDR_OPTIONSIZE ;
-
+   usNextHeaderOffset += nTotalOptions *
+ IPV6_DESTOPTS_HDR_OPTIONSIZE ;
}
break;
+
+
case IPV6HDR_TYPE_AUTHENTICATION:
{
-   struct bcm_ipv6_authentication_hdr *pstIpv6AuthHdr = 
(struct bcm_ipv6_authentication_hdr *)pucPayloadPtr;
+   struct bcm_ipv6_authentication_hdr *pstIpv6AuthHdr =
+   (struct bcm_ipv6_authentication_hdr 
*)pucPayloadPtr;
int nHdrLen = pstIpv6AuthHdr->ucLength;
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
@@ -87,44 +88,35 @@ static UCHAR *GetNextIPV6ChainedHeader(UCHAR **ppucPayload,
usNextHeaderOffset += nHdrLen * 4;
}
break;
-   case IPV6HDR_TYPE_ENCRYPTEDSECURITYPAYLOAD:
-   {
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
-   DBG_LVL_ALL,
-   "\nIPv6 Encrypted Security Payload 
Header");
-   *bParseDone = TRUE;
 
-   }
+   case IPV6HDR_TYPE_ENCRYPTEDSECURITYPAYLOAD:
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
+   DBG_LVL_ALL,
+   "\nIPv6 Encrypted Security Payload Header");
+   *bParseDone = TRUE;

[PATCH 3/6] Staging: bcm: IPv6Procotol.c: Replaced member accessing with variable

2014-07-28 Thread Matthias Beyer
Signed-off-by: Matthias Beyer 
---
 drivers/staging/bcm/IPv6Protocol.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/bcm/IPv6Protocol.c 
b/drivers/staging/bcm/IPv6Protocol.c
index 5bcdaf9..c5bbb14 100644
--- a/drivers/staging/bcm/IPv6Protocol.c
+++ b/drivers/staging/bcm/IPv6Protocol.c
@@ -289,6 +289,8 @@ static bool MatchSrcIpv6Address(struct bcm_classifier_rule 
*pstClassifierRule,
UINT uiIpv6AddrNoLongWords = 4;
ULONG aulSrcIP[4];
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
+   union u_ip_address *src_adr = &pstClassifierRule->stSrcIpAddress;
+
/*
 * This is the no. of Src Addresses ie Range of IP Addresses contained
 * in the classifier rule for which we need to match
@@ -310,14 +312,14 @@ static bool MatchSrcIpv6Address(struct 
bcm_classifier_rule *pstClassifierRule,
DumpIpv6Address(aulSrcIP);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
"\n Src Ipv6 Mask In Classifier Rule:\n");
-   
DumpIpv6Address(&pstClassifierRule->stSrcIpAddress.ulIpv6Mask[uiLoopIndex]);
+   DumpIpv6Address(&src_adr->ulIpv6Mask[uiLoopIndex]);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
"\n Src Ipv6 Address In Classifier Rule :\n");
-   
DumpIpv6Address(&pstClassifierRule->stSrcIpAddress.ulIpv6Addr[uiLoopIndex]);
+   DumpIpv6Address(&src_adr->ulIpv6Addr[uiLoopIndex]);
 
for (uiIpv6AddIndex = 0; uiIpv6AddIndex < 
uiIpv6AddrNoLongWords; uiIpv6AddIndex++) {
-   if 
((pstClassifierRule->stSrcIpAddress.ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & 
aulSrcIP[uiIpv6AddIndex])
-   != 
pstClassifierRule->stSrcIpAddress.ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) {
+   if ((src_adr->ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & 
aulSrcIP[uiIpv6AddIndex])
+   != 
src_adr->ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) {
/*
 * Match failed for current Ipv6 Address
 * Try next Ipv6 Address
-- 
2.0.2

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


[PATCH 2/6] Staging: bcm: IPv6Protocol.c: Removed unnecessary if-else blocks

2014-07-28 Thread Matthias Beyer
This patch simplifies

if (a) {
x = false;
} else {
if (b) {
x = false;
}
}

to
if (a || b) {
x = false;
}

Signed-off-by: Matthias Beyer 
---
 drivers/staging/bcm/IPv6Protocol.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/bcm/IPv6Protocol.c 
b/drivers/staging/bcm/IPv6Protocol.c
index 44021da..5bcdaf9 100644
--- a/drivers/staging/bcm/IPv6Protocol.c
+++ b/drivers/staging/bcm/IPv6Protocol.c
@@ -272,12 +272,9 @@ USHORT IpVersion6(struct bcm_mini_adapter *Adapter, 
PVOID pcIpHeader,
INT iMatchedSFQueueIndex = 0;
 
iMatchedSFQueueIndex = SearchSfid(Adapter, 
pstClassifierRule->ulSFID);
-   if (iMatchedSFQueueIndex >= NO_OF_QUEUES) {
+   if ((iMatchedSFQueueIndex >= NO_OF_QUEUES) ||
+   (Adapter->PackInfo[iMatchedSFQueueIndex].bActive == false))
bClassificationSucceed = false;
-   } else {
-   if (Adapter->PackInfo[iMatchedSFQueueIndex].bActive == 
false)
-   bClassificationSucceed = false;
-   }
}
 
return bClassificationSucceed;
-- 
2.0.2

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


[PATCH 4/6] Staging: bcm: IPv6Protocol.c: Replaced member accessing with variable

2014-07-28 Thread Matthias Beyer
Signed-off-by: Matthias Beyer 
---
 drivers/staging/bcm/IPv6Protocol.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/bcm/IPv6Protocol.c 
b/drivers/staging/bcm/IPv6Protocol.c
index c5bbb14..c1b0367 100644
--- a/drivers/staging/bcm/IPv6Protocol.c
+++ b/drivers/staging/bcm/IPv6Protocol.c
@@ -347,6 +347,8 @@ static bool MatchDestIpv6Address(struct bcm_classifier_rule 
*pstClassifierRule,
UINT uiIpv6AddrNoLongWords = 4;
ULONG aulDestIP[4];
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
+   union u_ip_address *dest_addr = &pstClassifierRule->stDestIpAddress;
+
/*
 * This is the no. of Destination Addresses
 * ie Range of IP Addresses contained in the classifier rule
@@ -369,14 +371,14 @@ static bool MatchDestIpv6Address(struct 
bcm_classifier_rule *pstClassifierRule,
DumpIpv6Address(aulDestIP);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
"\n Destination Ipv6 Mask In Classifier Rule 
:\n");
-   
DumpIpv6Address(&pstClassifierRule->stDestIpAddress.ulIpv6Mask[uiLoopIndex]);
+   DumpIpv6Address(&dest_addr->ulIpv6Mask[uiLoopIndex]);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL,
"\n Destination Ipv6 Address In Classifier Rule 
:\n");
-   
DumpIpv6Address(&pstClassifierRule->stDestIpAddress.ulIpv6Addr[uiLoopIndex]);
+   DumpIpv6Address(&dest_addr->ulIpv6Addr[uiLoopIndex]);
 
for (uiIpv6AddIndex = 0; uiIpv6AddIndex < 
uiIpv6AddrNoLongWords; uiIpv6AddIndex++) {
-   if 
((pstClassifierRule->stDestIpAddress.ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & 
aulDestIP[uiIpv6AddIndex])
-   != 
pstClassifierRule->stDestIpAddress.ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) {
+   if ((dest_addr->ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] 
& aulDestIP[uiIpv6AddIndex])
+   != 
dest_addr->ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) {
/*
 * Match failed for current Ipv6 Address.
 * Try next Ipv6 Address
-- 
2.0.2

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


[PATCH 5/6] Staging: bcm: IPv6Protocol.c: Whitespace cleanup

2014-07-28 Thread Matthias Beyer
Removes whitespace before semicolons and add blank line after
declaration.

Signed-off-by: Matthias Beyer 
---
 drivers/staging/bcm/IPv6Protocol.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/bcm/IPv6Protocol.c 
b/drivers/staging/bcm/IPv6Protocol.c
index c1b0367..75eb1d7 100644
--- a/drivers/staging/bcm/IPv6Protocol.c
+++ b/drivers/staging/bcm/IPv6Protocol.c
@@ -11,7 +11,7 @@ static UCHAR *GetNextIPV6ChainedHeader(UCHAR **ppucPayload,
 {
UCHAR *pucRetHeaderPtr = NULL;
UCHAR *pucPayloadPtr = NULL;
-   USHORT  usNextHeaderOffset = 0 ;
+   USHORT  usNextHeaderOffset = 0;
struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
 
if ((ppucPayload == NULL) || (*pusPayloadLength == 0) ||
@@ -71,7 +71,7 @@ static UCHAR *GetNextIPV6ChainedHeader(UCHAR **ppucPayload,
"\nIPv6 DestOpts Header Header");
usNextHeaderOffset += sizeof(struct 
bcm_ipv6_dest_options_hdr);
usNextHeaderOffset += nTotalOptions *
- IPV6_DESTOPTS_HDR_OPTIONSIZE ;
+ IPV6_DESTOPTS_HDR_OPTIONSIZE;
}
break;
 
@@ -282,7 +282,7 @@ USHORT  IpVersion6(struct bcm_mini_adapter *Adapter, 
PVOID pcIpHeader,
 
 
 static bool MatchSrcIpv6Address(struct bcm_classifier_rule *pstClassifierRule,
-   struct bcm_ipv6_hdr *pstIpv6Header)
+   struct bcm_ipv6_hdr *pstIpv6Header)
 {
UINT uiLoopIndex = 0;
UINT uiIpv6AddIndex = 0;
@@ -340,7 +340,7 @@ static bool MatchSrcIpv6Address(struct bcm_classifier_rule 
*pstClassifierRule,
 }
 
 static bool MatchDestIpv6Address(struct bcm_classifier_rule *pstClassifierRule,
-   struct bcm_ipv6_hdr *pstIpv6Header)
+struct bcm_ipv6_hdr *pstIpv6Header)
 {
UINT uiLoopIndex = 0;
UINT uiIpv6AddIndex = 0;
@@ -354,8 +354,7 @@ static bool MatchDestIpv6Address(struct bcm_classifier_rule 
*pstClassifierRule,
 * ie Range of IP Addresses contained in the classifier rule
 * for which we need to match
 */
-   UINT  uiCountIPDestinationAddresses = 
(UINT)pstClassifierRule->ucIPDestinationAddressLength;
-
+   UINT uiCountIPDestinationAddresses = 
(UINT)pstClassifierRule->ucIPDestinationAddressLength;
 
if (uiCountIPDestinationAddresses == 0)
return TRUE;
-- 
2.0.2

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


[PATCH 6/6] Staging: bcm: IPv6Protocol.c: Line length fixes

2014-07-28 Thread Matthias Beyer
Signed-off-by: Matthias Beyer 
---
 drivers/staging/bcm/IPv6Protocol.c | 93 --
 1 file changed, 60 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/bcm/IPv6Protocol.c 
b/drivers/staging/bcm/IPv6Protocol.c
index 75eb1d7..9abdbb7 100644
--- a/drivers/staging/bcm/IPv6Protocol.c
+++ b/drivers/staging/bcm/IPv6Protocol.c
@@ -151,7 +151,9 @@ static UCHAR GetIpv6ProtocolPorts(UCHAR *pucPayload, USHORT 
*pusSrcPort,
ucHeaderType = ucNextHeader;
while (!bDone) {
pucNextHeader = GetNextIPV6ChainedHeader(&pIpv6HdrScanContext,
-   &ucHeaderType, &bDone, 
&usPayloadLength);
+&ucHeaderType,
+&bDone,
+&usPayloadLength);
if (bDone) {
if ((ucHeaderType == TCP_HEADER_TYPE) ||
(ucHeaderType == UDP_HEADER_TYPE)) {
@@ -172,11 +174,12 @@ static UCHAR GetIpv6ProtocolPorts(UCHAR *pucPayload, 
USHORT *pusSrcPort,
 
 
 /*
- * Arg 1 struct bcm_mini_adapter *Adapter is a pointer ot the driver contorl 
structure
+ * Arg 1 struct bcm_mini_adapter *Adapter is a pointer ot the driver control
+ * structure
  * Arg 2 PVOID pcIpHeader is a pointer to the IP header of the packet
  */
 USHORT IpVersion6(struct bcm_mini_adapter *Adapter, PVOID pcIpHeader,
-   struct bcm_classifier_rule 
*pstClassifierRule)
+  struct bcm_classifier_rule *pstClassifierRule)
 {
USHORT  ushDestPort = 0;
USHORT  ushSrcPort = 0;
@@ -195,11 +198,12 @@ USHORTIpVersion6(struct bcm_mini_adapter *Adapter, 
PVOID pcIpHeader,
 * Try to get the next higher layer protocol
 * and the Ports Nos if TCP or UDP
 */
-   ucNextProtocolAboveIP = GetIpv6ProtocolPorts((UCHAR *)(pcIpHeader + 
sizeof(struct bcm_ipv6_hdr)),
-   &ushSrcPort,
-   &ushDestPort,
-   
pstIpv6Header->usPayloadLength,
-   
pstIpv6Header->ucNextHeader);
+   ucNextProtocolAboveIP = GetIpv6ProtocolPorts((UCHAR *)(pcIpHeader +
+sizeof(struct 
bcm_ipv6_hdr)),
+&ushSrcPort,
+&ushDestPort,
+
pstIpv6Header->usPayloadLength,
+
pstIpv6Header->ucNextHeader);
 
do {
if (pstClassifierRule->ucDirection == 0) {
@@ -219,12 +223,12 @@ USHORTIpVersion6(struct bcm_mini_adapter *Adapter, 
PVOID pcIpHeader,
}
 
bClassificationSucceed = MatchSrcIpv6Address(pstClassifierRule,
-   pstIpv6Header);
+pstIpv6Header);
if (!bClassificationSucceed)
break;
 
bClassificationSucceed = MatchDestIpv6Address(pstClassifierRule,
-   pstIpv6Header);
+ pstIpv6Header);
if (!bClassificationSucceed)
break;
 
@@ -234,7 +238,7 @@ USHORT  IpVersion6(struct bcm_mini_adapter *Adapter, 
PVOID pcIpHeader,
 * Chain of IPv6 prot headers
 */
bClassificationSucceed = MatchProtocol(pstClassifierRule,
-   ucNextProtocolAboveIP);
+  ucNextProtocolAboveIP);
if (!bClassificationSucceed)
break;
 
@@ -248,7 +252,7 @@ USHORT  IpVersion6(struct bcm_mini_adapter *Adapter, 
PVOID pcIpHeader,
DBG_LVL_ALL, "\nIPv6 Source Port:%x\n",
ntohs(ushSrcPort));
bClassificationSucceed = MatchSrcPort(pstClassifierRule,
-   ntohs(ushSrcPort));
+ 
ntohs(ushSrcPort));
if (!bClassificationSucceed)
break;
 
@@ -257,21 +261,24 @@ USHORTIpVersion6(struct bcm_mini_adapter *Adapter, 
PVOID pcIpHeader,
 
/* Match Dest Port */
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG,
-   DBG_LVL_ALL, "\nIPv6 Destination 
Port:%x\n",
+ 

[PATCH 09/19] staging: comedi: ni_tio: tidy up Gi_Reset_Bit

2014-07-28 Thread H Hartley Sweeten
Convert this inline CamelCase function into a define.

For aesthetics, move the new define so it is associated with the
register define.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tio.c  | 2 +-
 drivers/staging/comedi/drivers/ni_tio_internal.h | 7 +--
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c 
b/drivers/staging/comedi/drivers/ni_tio.c
index ccdf96e..fb7b271 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -184,7 +184,7 @@ static void ni_tio_reset_count_and_disarm(struct ni_gpct 
*counter)
 {
unsigned cidx = counter->counter_index;
 
-   write_register(counter, Gi_Reset_Bit(cidx), NITIO_RESET_REG(cidx));
+   write_register(counter, GI_RESET(cidx), NITIO_RESET_REG(cidx));
 }
 
 static uint64_t ni_tio_clock_period_ps(const struct ni_gpct *counter,
diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h 
b/drivers/staging/comedi/drivers/ni_tio_internal.h
index 37fde62..ea1c9fb 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -126,6 +126,7 @@
 #define GI_TC_ERROR(x) (((x) % 2) ? (1 << 13) : (1 << 12))
 #define GI_GATE_ERROR(x)   (((x) % 2) ? (1 << 15) : (1 << 14))
 #define NITIO_RESET_REG(x) (NITIO_G01_RESET + ((x) / 2))
+#define GI_RESET(x)(1 << (2 + ((x) % 2)))
 #define NITIO_STATUS1_REG(x)   (NITIO_G01_STATUS1 + ((x) / 2))
 #define NITIO_STATUS2_REG(x)   (NITIO_G01_STATUS2 + ((x) / 2))
 #define NITIO_DMA_CFG_REG(x)   (NITIO_G0_DMA_CFG + (x))
@@ -135,12 +136,6 @@
 #define NITIO_STATUS_REG(x)(NITIO_G0_STATUS + (x))
 #define NITIO_INT_ENA_REG(x)   (NITIO_G0_INT_ENA + (x))
 
-/* joint reset register bits */
-static inline unsigned Gi_Reset_Bit(unsigned counter_index)
-{
-   return 0x1 << (2 + (counter_index % 2));
-}
-
 enum Gxx_Joint_Status2_Bits {
G0_Output_Bit = 0x1,
G1_Output_Bit = 0x2,
-- 
2.0.3

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


[PATCH 16/19] staging: comedi: ni_tiocmd: tidy up ni_tio_configure_dma()

2014-07-28 Thread H Hartley Sweeten
The 'enable' and 'read_not_write' parameters are true/false flags. For
aesthetics, change their types to bool.

Rename the local variable 'input_select_bits' to simply 'bits' and reuse
it when enabling the dma on the m series and 660x counter variants.

Add a local variable for the 'mask' that is passed to ni_tio_set_bits()
to help clarify the code.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tiocmd.c | 48 ++
 1 file changed, 23 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c 
b/drivers/staging/comedi/drivers/ni_tiocmd.c
index 8c89786..16858fb 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -49,40 +49,38 @@ TODO:
 #include "ni_tio_internal.h"
 #include "mite.h"
 
-static void ni_tio_configure_dma(struct ni_gpct *counter, short enable,
-short read_not_write)
+static void ni_tio_configure_dma(struct ni_gpct *counter,
+bool enable, bool read)
 {
struct ni_gpct_device *counter_dev = counter->counter_dev;
unsigned cidx = counter->counter_index;
-   unsigned input_select_bits = 0;
+   unsigned mask;
+   unsigned bits;
+
+   mask = GI_READ_ACKS_IRQ | GI_WRITE_ACKS_IRQ;
+   bits = 0;
 
if (enable) {
-   if (read_not_write)
-   input_select_bits |= GI_READ_ACKS_IRQ;
+   if (read)
+   bits |= GI_READ_ACKS_IRQ;
else
-   input_select_bits |= GI_WRITE_ACKS_IRQ;
+   bits |= GI_WRITE_ACKS_IRQ;
}
-   ni_tio_set_bits(counter, NITIO_INPUT_SEL_REG(cidx),
-   GI_READ_ACKS_IRQ | GI_WRITE_ACKS_IRQ,
-   input_select_bits);
+   ni_tio_set_bits(counter, NITIO_INPUT_SEL_REG(cidx), mask, bits);
+
switch (counter_dev->variant) {
case ni_gpct_variant_e_series:
break;
case ni_gpct_variant_m_series:
case ni_gpct_variant_660x:
-   {
-   unsigned gi_dma_config_bits = 0;
-
-   if (enable) {
-   gi_dma_config_bits |= GI_DMA_ENABLE;
-   gi_dma_config_bits |= GI_DMA_INT_ENA;
-   }
-   if (read_not_write == 0)
-   gi_dma_config_bits |= GI_DMA_WRITE;
-   ni_tio_set_bits(counter, NITIO_DMA_CFG_REG(cidx),
-   GI_DMA_ENABLE | GI_DMA_INT_ENA |
-   GI_DMA_WRITE, gi_dma_config_bits);
-   }
+   mask = GI_DMA_ENABLE | GI_DMA_INT_ENA | GI_DMA_WRITE;
+   bits = 0;
+
+   if (enable)
+   bits |= GI_DMA_ENABLE | GI_DMA_INT_ENA;
+   if (!read)
+   bits |= GI_DMA_WRITE;
+   ni_tio_set_bits(counter, NITIO_DMA_CFG_REG(cidx), mask, bits);
break;
}
 }
@@ -140,7 +138,7 @@ static int ni_tio_input_cmd(struct comedi_subdevice *s)
break;
}
ni_tio_set_bits(counter, NITIO_CMD_REG(cidx), GI_SAVE_TRACE, 0);
-   ni_tio_configure_dma(counter, 1, 1);
+   ni_tio_configure_dma(counter, true, true);
switch (cmd->start_src) {
case TRIG_NOW:
async->inttrig = NULL;
@@ -176,7 +174,7 @@ static int ni_tio_output_cmd(struct comedi_subdevice *s)
 
counter->mite_chan->dir = COMEDI_OUTPUT;
mite_prep_dma(counter->mite_chan, 32, 32);
-   ni_tio_configure_dma(counter, 1, 0);
+   ni_tio_configure_dma(counter, true, false);
mite_dma_arm(counter->mite_chan);
return ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE);
 }
@@ -319,7 +317,7 @@ int ni_tio_cancel(struct ni_gpct *counter)
if (counter->mite_chan)
mite_dma_disarm(counter->mite_chan);
spin_unlock_irqrestore(&counter->lock, flags);
-   ni_tio_configure_dma(counter, 0, 0);
+   ni_tio_configure_dma(counter, false, false);
 
ni_tio_set_bits(counter, NITIO_INT_ENA_REG(cidx),
GI_GATE_INTERRUPT_ENABLE(cidx), 0x0);
-- 
2.0.3

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


[PATCH 04/19] staging: comedi: ni_tio: tidy up Gi_Auto_Increment_Reg_Bits

2014-07-28 Thread H Hartley Sweeten
Convert this enum into defines and rename the CamelCase symbols.

For aesthetics, move the new defines so they are associated with
the register define.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tio_internal.h | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h 
b/drivers/staging/comedi/drivers/ni_tio_internal.h
index 55f1bfc..4c19149 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -22,6 +22,7 @@
 #include "ni_tio.h"
 
 #define NITIO_AUTO_INC_REG(x)  (NITIO_G0_AUTO_INC + (x))
+#define GI_AUTO_INC_MASK   0xff
 #define NITIO_CMD_REG(x)   (NITIO_G0_CMD + (x))
 #define GI_ARM (1 << 0)
 #define GI_SAVE_TRACE  (1 << 1)
@@ -78,10 +79,6 @@
 #define NITIO_STATUS_REG(x)(NITIO_G0_STATUS + (x))
 #define NITIO_INT_ENA_REG(x)   (NITIO_G0_INT_ENA + (x))
 
-enum Gi_Auto_Increment_Reg_Bits {
-   Gi_Auto_Increment_Mask = 0xff
-};
-
 #define Gi_Source_Select_Shift 2
 #define Gi_Gate_Select_Shift 7
 enum Gi_Input_Select_Bits {
-- 
2.0.3

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


[PATCH 17/19] staging: comedi: ni_tiocmd: tidy up ni_tio_input_inttrig()

2014-07-28 Thread H Hartley Sweeten
Remove the BUG_ON(counter == NULL). If this can never happen and it
if did the driver should have died long before this function is called.

For aesthetics, rename the local variable 'retval' to simply 'ret'.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tiocmd.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c 
b/drivers/staging/comedi/drivers/ni_tiocmd.c
index 16858fb..334ce35 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -92,9 +92,7 @@ static int ni_tio_input_inttrig(struct comedi_device *dev,
struct ni_gpct *counter = s->private;
struct comedi_cmd *cmd = &s->async->cmd;
unsigned long flags;
-   int retval = 0;
-
-   BUG_ON(counter == NULL);
+   int ret = 0;
 
if (trig_num != cmd->start_src)
return -EINVAL;
@@ -103,14 +101,14 @@ static int ni_tio_input_inttrig(struct comedi_device *dev,
if (counter->mite_chan)
mite_dma_arm(counter->mite_chan);
else
-   retval = -EIO;
+   ret = -EIO;
spin_unlock_irqrestore(&counter->lock, flags);
-   if (retval < 0)
-   return retval;
-   retval = ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE);
+   if (ret < 0)
+   return ret;
+   ret = ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE);
s->async->inttrig = NULL;
 
-   return retval;
+   return ret;
 }
 
 static int ni_tio_input_cmd(struct comedi_subdevice *s)
-- 
2.0.3

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


[PATCH 19/19] staging: comedi: ni_tiocmd: introduce ni_tio_acknowledge()

2014-07-28 Thread H Hartley Sweeten
The external callers of ni_tio_acknowledge_and_confirm() only call
this function to ack any pending errors or interrupts before starting
a new async command. Only the internal code in ni_tiocmd uses the
data that is optionally returned by this function.

Remove the export from ni_tio_acknowledge_and_confirm() and introduce
a new exported function that handles passing the NULL params.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_660x.c   |  2 +-
 drivers/staging/comedi/drivers/ni_mio_common.c |  2 +-
 drivers/staging/comedi/drivers/ni_tio.h|  4 +---
 drivers/staging/comedi/drivers/ni_tiocmd.c | 15 +++
 4 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index 20fe692..ef4a8f0 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -749,7 +749,7 @@ static int ni_660x_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
"no dma channel available for use by counter\n");
return retval;
}
-   ni_tio_acknowledge_and_confirm(counter, NULL, NULL, NULL, NULL);
+   ni_tio_acknowledge(counter);
 
return ni_tio_cmd(dev, s);
 }
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 4285f07..888ec8d 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -5252,7 +5252,7 @@ static int ni_gpct_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
"no dma channel available for use by counter\n");
return retval;
}
-   ni_tio_acknowledge_and_confirm(counter, NULL, NULL, NULL, NULL);
+   ni_tio_acknowledge(counter);
ni_e_series_enable_second_irq(dev, counter->counter_index, 1);
 
return ni_tio_cmd(dev, s);
diff --git a/drivers/staging/comedi/drivers/ni_tio.h 
b/drivers/staging/comedi/drivers/ni_tio.h
index 1056bf0..25aedd0 100644
--- a/drivers/staging/comedi/drivers/ni_tio.h
+++ b/drivers/staging/comedi/drivers/ni_tio.h
@@ -149,8 +149,6 @@ int ni_tio_cmdtest(struct comedi_device *, struct 
comedi_subdevice *,
 int ni_tio_cancel(struct ni_gpct *);
 void ni_tio_handle_interrupt(struct ni_gpct *, struct comedi_subdevice *);
 void ni_tio_set_mite_channel(struct ni_gpct *, struct mite_channel *);
-void ni_tio_acknowledge_and_confirm(struct ni_gpct *,
-   int *gate_error, int *tc_error,
-   int *perm_stale_data, int *stale_data);
+void ni_tio_acknowledge(struct ni_gpct *);
 
 #endif /* _COMEDI_NI_TIO_H */
diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c 
b/drivers/staging/comedi/drivers/ni_tiocmd.c
index c360667..299cedd 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -343,9 +343,11 @@ static int should_ack_gate(struct ni_gpct *counter)
return retval;
 }
 
-void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter, int *gate_error,
-   int *tc_error, int *perm_stale_data,
-   int *stale_data)
+static void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter,
+  int *gate_error,
+  int *tc_error,
+  int *perm_stale_data,
+  int *stale_data)
 {
unsigned cidx = counter->counter_index;
const unsigned short gxx_status = read_register(counter,
@@ -404,7 +406,12 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct 
*counter, int *gate_error,
}
}
 }
-EXPORT_SYMBOL_GPL(ni_tio_acknowledge_and_confirm);
+
+void ni_tio_acknowledge(struct ni_gpct *counter)
+{
+   ni_tio_acknowledge_and_confirm(counter, NULL, NULL, NULL, NULL);
+}
+EXPORT_SYMBOL_GPL(ni_tio_acknowledge);
 
 void ni_tio_handle_interrupt(struct ni_gpct *counter,
 struct comedi_subdevice *s)
-- 
2.0.3

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


[PATCH 05/19] staging: comedi: ni_tio: tidy up Gi_Input_Select_Bits

2014-07-28 Thread H Hartley Sweeten
Convert this enum into defines and rename the CamelCase symbols.

For aesthetics, move the new defines so they are associated with
the register define.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tio.c  | 86 +++-
 drivers/staging/comedi/drivers/ni_tio_internal.h | 25 ---
 drivers/staging/comedi/drivers/ni_tiocmd.c   |  6 +-
 3 files changed, 53 insertions(+), 64 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c 
b/drivers/staging/comedi/drivers/ni_tio.c
index 8df8468..bd6a21e 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -51,7 +51,7 @@ TODO:
 
 /*
  * clock sources for ni e and m series boards,
- * get bits with Gi_Source_Select_Bits()
+ * get bits with GI_SRC_SEL()
  */
 #define NI_M_TIMEBASE_1_CLK0x0 /* 20MHz */
 #define NI_M_PFI_CLK(x)(((x) < 10) ? (1 + (x)) : (0xb 
+ (x)))
@@ -69,7 +69,7 @@ TODO:
 
 /*
  * clock sources for ni_660x boards,
- * get bits with Gi_Source_Select_Bits()
+ * get bits with GI_SRC_SEL()
  */
 #define NI_660X_TIMEBASE_1_CLK 0x0 /* 20MHz */
 #define NI_660X_SRC_PIN_I_CLK  0x1
@@ -168,16 +168,6 @@ static inline unsigned GI_HW_ARM_SEL_MASK(enum 
ni_gpct_variant variant)
}
 }
 
-static inline unsigned Gi_Source_Select_Bits(unsigned source)
-{
-   return (source << Gi_Source_Select_Shift) & Gi_Source_Select_Mask;
-}
-
-static inline unsigned Gi_Gate_Select_Bits(unsigned gate_select)
-{
-   return (gate_select << Gi_Gate_Select_Shift) & Gi_Gate_Select_Mask;
-}
-
 static int ni_tio_has_gate2_registers(const struct ni_gpct_device *counter_dev)
 {
switch (counter_dev->variant) {
@@ -248,7 +238,7 @@ static unsigned ni_tio_clock_src_modifiers(const struct 
ni_gpct *counter)
unsigned bits = 0;
 
if (ni_tio_get_soft_copy(counter, NITIO_INPUT_SEL_REG(cidx)) &
-   Gi_Source_Polarity_Bit)
+   GI_SRC_POL_INVERT)
bits |= NI_GPCT_INVERT_CLOCK_SRC_BIT;
if (counting_mode_bits & GI_PRESCALE_X2(counter_dev->variant))
bits |= NI_GPCT_PRESCALE_X2_CLOCK_SRC_BITS;
@@ -263,12 +253,13 @@ static unsigned ni_m_series_clock_src_select(const struct 
ni_gpct *counter)
unsigned cidx = counter->counter_index;
const unsigned second_gate_reg = NITIO_GATE2_REG(cidx);
unsigned clock_source = 0;
+   unsigned src;
unsigned i;
-   const unsigned input_select =
-   (ni_tio_get_soft_copy(counter, NITIO_INPUT_SEL_REG(cidx)) &
-   Gi_Source_Select_Mask) >> Gi_Source_Select_Shift;
 
-   switch (input_select) {
+   src = GI_BITS_TO_SRC(ni_tio_get_soft_copy(counter,
+ NITIO_INPUT_SEL_REG(cidx)));
+
+   switch (src) {
case NI_M_TIMEBASE_1_CLK:
clock_source = NI_GPCT_TIMEBASE_1_CLOCK_SRC_BITS;
break;
@@ -301,7 +292,7 @@ static unsigned ni_m_series_clock_src_select(const struct 
ni_gpct *counter)
break;
default:
for (i = 0; i <= NI_M_MAX_RTSI_CHAN; ++i) {
-   if (input_select == NI_M_RTSI_CLK(i)) {
+   if (src == NI_M_RTSI_CLK(i)) {
clock_source = NI_GPCT_RTSI_CLOCK_SRC_BITS(i);
break;
}
@@ -309,7 +300,7 @@ static unsigned ni_m_series_clock_src_select(const struct 
ni_gpct *counter)
if (i <= NI_M_MAX_RTSI_CHAN)
break;
for (i = 0; i <= NI_M_MAX_PFI_CHAN; ++i) {
-   if (input_select == NI_M_PFI_CLK(i)) {
+   if (src == NI_M_PFI_CLK(i)) {
clock_source = NI_GPCT_PFI_CLOCK_SRC_BITS(i);
break;
}
@@ -327,12 +318,13 @@ static unsigned ni_660x_clock_src_select(const struct 
ni_gpct *counter)
 {
unsigned clock_source = 0;
unsigned cidx = counter->counter_index;
-   const unsigned input_select =
-   (ni_tio_get_soft_copy(counter, NITIO_INPUT_SEL_REG(cidx)) &
-   Gi_Source_Select_Mask) >> Gi_Source_Select_Shift;
+   unsigned src;
unsigned i;
 
-   switch (input_select) {
+   src = GI_BITS_TO_SRC(ni_tio_get_soft_copy(counter,
+ NITIO_INPUT_SEL_REG(cidx)));
+
+   switch (src) {
case NI_660X_TIMEBASE_1_CLK:
clock_source = NI_GPCT_TIMEBASE_1_CLOCK_SRC_BITS;
break;
@@ -356,7 +348,7 @@ static unsigned ni_660x_clock_src_select(const struct 
ni_gpct *counter)
break;
default:
for (i = 0; i <= NI_660X_MAX_RTSI_CHAN; ++i) {
-   if (input_select == NI_660X_RTSI_CLK(i)) {
+

[PATCH 06/19] staging: comedi: ni_tio: tidy up Gi_Mode_Bits

2014-07-28 Thread H Hartley Sweeten
Convert this enum into defines and rename the CamelCase symbols.

For aesthetics, move the new defines so they are associated with
the register define.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tio.c  | 30 ++--
 drivers/staging/comedi/drivers/ni_tio_internal.h | 62 +++-
 drivers/staging/comedi/drivers/ni_tiocmd.c   |  2 +-
 3 files changed, 45 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c 
b/drivers/staging/comedi/drivers/ni_tio.c
index bd6a21e..7a37d2b 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -441,18 +441,18 @@ static int ni_tio_set_counter_mode(struct ni_gpct 
*counter, unsigned mode)
NI_GPCT_HARDWARE_DISARM_MASK | NI_GPCT_LOADING_ON_TC_BIT |
NI_GPCT_LOADING_ON_GATE_BIT | NI_GPCT_LOAD_B_SELECT_BIT;
 
-   mode_reg_mask = mode_reg_direct_mask | Gi_Reload_Source_Switching_Bit;
+   mode_reg_mask = mode_reg_direct_mask | GI_RELOAD_SRC_SWITCHING;
mode_reg_values = mode & mode_reg_direct_mask;
switch (mode & NI_GPCT_RELOAD_SOURCE_MASK) {
case NI_GPCT_RELOAD_SOURCE_FIXED_BITS:
break;
case NI_GPCT_RELOAD_SOURCE_SWITCHING_BITS:
-   mode_reg_values |= Gi_Reload_Source_Switching_Bit;
+   mode_reg_values |= GI_RELOAD_SRC_SWITCHING;
break;
case NI_GPCT_RELOAD_SOURCE_GATE_SELECT_BITS:
input_select_bits |= GI_GATE_SEL_LOAD_SRC;
-   mode_reg_mask |= Gi_Gating_Mode_Mask;
-   mode_reg_values |= Gi_Level_Gating_Bits;
+   mode_reg_mask |= GI_GATING_MODE_MASK;
+   mode_reg_values |= GI_LEVEL_GATING;
break;
default:
break;
@@ -907,18 +907,18 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, unsigned 
gate_index,
case 0:
if (chan == NI_GPCT_DISABLED_GATE_SELECT) {
ni_tio_set_bits(counter, NITIO_MODE_REG(cidx),
-   Gi_Gating_Mode_Mask,
-   Gi_Gating_Disabled_Bits);
+   GI_GATING_MODE_MASK,
+   GI_GATING_DISABLED);
return 0;
}
if (gate_source & CR_INVERT)
-   mode |= Gi_Gate_Polarity_Bit;
+   mode |= GI_GATE_POL_INVERT;
if (gate_source & CR_EDGE)
-   mode |= Gi_Rising_Edge_Gating_Bits;
+   mode |= GI_RISING_EDGE_GATING;
else
-   mode |= Gi_Level_Gating_Bits;
+   mode |= GI_LEVEL_GATING;
ni_tio_set_bits(counter, NITIO_MODE_REG(cidx),
-   Gi_Gate_Polarity_Bit | Gi_Gating_Mode_Mask,
+   GI_GATE_POL_INVERT | GI_GATING_MODE_MASK,
mode);
switch (counter_dev->variant) {
case ni_gpct_variant_e_series:
@@ -1132,7 +1132,7 @@ static int ni_tio_get_gate_src(struct ni_gpct *counter, 
unsigned gate_index,
 
switch (gate_index) {
case 0:
-   if ((mode & Gi_Gating_Mode_Mask) == Gi_Gating_Disabled_Bits) {
+   if ((mode & GI_GATING_MODE_MASK) == GI_GATING_DISABLED) {
*gate_source = NI_GPCT_DISABLED_GATE_SELECT;
return 0;
}
@@ -1150,13 +1150,13 @@ static int ni_tio_get_gate_src(struct ni_gpct *counter, 
unsigned gate_index,
*gate_source = ni_660x_gate_to_generic_gate(gate);
break;
}
-   if (mode & Gi_Gate_Polarity_Bit)
+   if (mode & GI_GATE_POL_INVERT)
*gate_source |= CR_INVERT;
-   if ((mode & Gi_Gating_Mode_Mask) != Gi_Level_Gating_Bits)
+   if ((mode & GI_GATING_MODE_MASK) != GI_LEVEL_GATING)
*gate_source |= CR_EDGE;
break;
case 1:
-   if ((mode & Gi_Gating_Mode_Mask) == Gi_Gating_Disabled_Bits ||
+   if ((mode & GI_GATING_MODE_MASK) == GI_GATING_DISABLED ||
!(counter_dev->regs[gate2_reg] & Gi_Second_Gate_Mode_Bit)) {
*gate_source = NI_GPCT_DISABLED_GATE_SELECT;
return 0;
@@ -1179,7 +1179,7 @@ static int ni_tio_get_gate_src(struct ni_gpct *counter, 
unsigned gate_index,
if (counter_dev->regs[gate2_reg] & Gi_Second_Gate_Polarity_Bit)
*gate_source |= CR_INVERT;
/* second gate can't have edge/level mode set independently */
-   if ((mode & Gi_Gating_Mode_Mask) != Gi_Level_Gating_Bits)
+   if ((mode & GI_GATING_MODE_MASK) != GI_LEVEL_

[PATCH 18/19] staging: comedi: ni_tiocmd: tidy up ni_tio_input_cmd()

2014-07-28 Thread H Hartley Sweeten
The cmd->start_src is validated in the (*do_cmdtest) before this
function is called. All valid trigger sources are handled so the
default BUG() case can never occure.

For aesthetics, refactor the switch into if/else tests and remove
the BUG().

For aesthetics, rename the local variable 'retval' to simply 'ret'.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tiocmd.c | 30 ++
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c 
b/drivers/staging/comedi/drivers/ni_tiocmd.c
index 334ce35..c360667 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -118,7 +118,7 @@ static int ni_tio_input_cmd(struct comedi_subdevice *s)
unsigned cidx = counter->counter_index;
struct comedi_async *async = s->async;
struct comedi_cmd *cmd = &async->cmd;
-   int retval = 0;
+   int ret = 0;
 
/* write alloc the entire buffer */
comedi_buf_write_alloc(s, async->prealloc_bufsz);
@@ -137,29 +137,19 @@ static int ni_tio_input_cmd(struct comedi_subdevice *s)
}
ni_tio_set_bits(counter, NITIO_CMD_REG(cidx), GI_SAVE_TRACE, 0);
ni_tio_configure_dma(counter, true, true);
-   switch (cmd->start_src) {
-   case TRIG_NOW:
-   async->inttrig = NULL;
-   mite_dma_arm(counter->mite_chan);
-   retval = ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE);
-   break;
-   case TRIG_INT:
+
+   if (cmd->start_src == TRIG_INT) {
async->inttrig = &ni_tio_input_inttrig;
-   break;
-   case TRIG_EXT:
+   } else {/* TRIG_NOW || TRIG_EXT || TRIG_OTHER */
async->inttrig = NULL;
mite_dma_arm(counter->mite_chan);
-   retval = ni_tio_arm(counter, 1, cmd->start_arg);
-   break;
-   case TRIG_OTHER:
-   async->inttrig = NULL;
-   mite_dma_arm(counter->mite_chan);
-   break;
-   default:
-   BUG();
-   break;
+
+   if (cmd->start_src == TRIG_NOW)
+   ret = ni_tio_arm(counter, 1, NI_GPCT_ARM_IMMEDIATE);
+   else if (cmd->start_src == TRIG_EXT)
+   ret = ni_tio_arm(counter, 1, cmd->start_arg);
}
-   return retval;
+   return ret;
 }
 
 static int ni_tio_output_cmd(struct comedi_subdevice *s)
-- 
2.0.3

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


[PATCH 12/19] staging: comedi: ni_tio: tidy up Gi_DMA_Status_Reg_Bits

2014-07-28 Thread H Hartley Sweeten
Convert this enum into defines and rename the CamelCase symbols.

For aesthetics, move the new defines so they are associated with
the register define.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tio_internal.h | 9 +++--
 drivers/staging/comedi/drivers/ni_tiocmd.c   | 2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h 
b/drivers/staging/comedi/drivers/ni_tio_internal.h
index a74cec4..db6b563 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -139,17 +139,14 @@
 #define GI_DMA_RESET   (1 << 3)
 #define GI_DMA_BANKSW_ERROR(1 << 4)
 #define NITIO_DMA_STATUS_REG(x)(NITIO_G0_DMA_STATUS + (x))
+#define GI_DMA_READBANK(1 << 13)
+#define GI_DRQ_ERROR   (1 << 14)
+#define GI_DRQ_STATUS  (1 << 15)
 #define NITIO_ABZ_REG(x)   (NITIO_G0_ABZ + (x))
 #define NITIO_INT_ACK_REG(x)   (NITIO_G0_INT_ACK + (x))
 #define NITIO_STATUS_REG(x)(NITIO_G0_STATUS + (x))
 #define NITIO_INT_ENA_REG(x)   (NITIO_G0_INT_ENA + (x))
 
-enum Gi_DMA_Status_Reg_Bits {
-   Gi_DMA_Readbank_Bit = 0x2000,
-   Gi_DRQ_Error_Bit = 0x4000,
-   Gi_DRQ_Status_Bit = 0x8000
-};
-
 enum G02_Interrupt_Acknowledge_Bits {
G0_Gate_Error_Confirm_Bit = 0x20,
G0_TC_Error_Confirm_Bit = 0x40
diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c 
b/drivers/staging/comedi/drivers/ni_tiocmd.c
index d80bb35..f8019bf 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -443,7 +443,7 @@ void ni_tio_handle_interrupt(struct ni_gpct *counter,
case ni_gpct_variant_m_series:
case ni_gpct_variant_660x:
if (read_register(counter, NITIO_DMA_STATUS_REG(cidx)) &
-   Gi_DRQ_Error_Bit) {
+   GI_DRQ_ERROR) {
dev_notice(counter->counter_dev->dev->class_dev,
   "%s: Gi_DRQ_Error detected.\n", __func__);
s->async->events |= COMEDI_CB_OVERFLOW;
-- 
2.0.3

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


[PATCH 14/19] staging: comedi: ni_tio: tidy up Gi_Status_Bits

2014-07-28 Thread H Hartley Sweeten
Convert this enum into defines and rename the CamelCase symbols.

For aesthetics, move the new defines so they are associated with
the register define.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tio_internal.h | 9 +++--
 drivers/staging/comedi/drivers/ni_tiocmd.c   | 4 ++--
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h 
b/drivers/staging/comedi/drivers/ni_tio_internal.h
index 8d1b254..37cdb49 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -149,14 +149,11 @@
 #define GI_TC_INTERRUPT_ACK(1 << 14)
 #define GI_GATE_INTERRUPT_ACK  (1 << 15)
 #define NITIO_STATUS_REG(x)(NITIO_G0_STATUS + (x))
+#define GI_GATE_INTERRUPT  (1 << 2)
+#define GI_TC  (1 << 3)
+#define GI_INTERRUPT   (1 << 15)
 #define NITIO_INT_ENA_REG(x)   (NITIO_G0_INT_ENA + (x))
 
-enum Gi_Status_Bits {
-   Gi_Gate_Interrupt_Bit = 0x4,
-   Gi_TC_Bit = 0x8,
-   Gi_Interrupt_Bit = 0x8000
-};
-
 enum G02_Interrupt_Enable_Bits {
G0_TC_Interrupt_Enable_Bit = 0x40,
G0_Gate_Interrupt_Enable_Bit = 0x100
diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c 
b/drivers/staging/comedi/drivers/ni_tiocmd.c
index 43a7bee..3ec8995 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -394,9 +394,9 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct 
*counter, int *gate_error,
if (tc_error)
*tc_error = 1;
}
-   if (gi_status & Gi_TC_Bit)
+   if (gi_status & GI_TC)
ack |= GI_TC_INTERRUPT_ACK;
-   if (gi_status & Gi_Gate_Interrupt_Bit) {
+   if (gi_status & GI_GATE_INTERRUPT) {
if (should_ack_gate(counter))
ack |= GI_GATE_INTERRUPT_ACK;
}
-- 
2.0.3

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


[PATCH 10/19] staging: comedi: ni_tio: tidy up Gxx_Joint_Status2_Bits

2014-07-28 Thread H Hartley Sweeten
Convert this enum into defines and rename the CamelCase symbols.

For aesthetics, move the new defines so they are associated with
the register define.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tio_internal.h | 19 +++
 drivers/staging/comedi/drivers/ni_tiocmd.c   |  2 +-
 2 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h 
b/drivers/staging/comedi/drivers/ni_tio_internal.h
index ea1c9fb..18a1e16 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -129,6 +129,9 @@
 #define GI_RESET(x)(1 << (2 + ((x) % 2)))
 #define NITIO_STATUS1_REG(x)   (NITIO_G01_STATUS1 + ((x) / 2))
 #define NITIO_STATUS2_REG(x)   (NITIO_G01_STATUS2 + ((x) / 2))
+#define GI_OUTPUT(x)   (((x) % 2) ? (1 << 1) : (1 << 0))
+#define GI_HW_SAVE(x)  (((x) % 2) ? (1 << 13) : (1 << 12))
+#define GI_PERMANENT_STALE(x)  (((x) % 2) ? (1 << 15) : (1 << 14))
 #define NITIO_DMA_CFG_REG(x)   (NITIO_G0_DMA_CFG + (x))
 #define NITIO_DMA_STATUS_REG(x)(NITIO_G0_DMA_STATUS + (x))
 #define NITIO_ABZ_REG(x)   (NITIO_G0_ABZ + (x))
@@ -136,22 +139,6 @@
 #define NITIO_STATUS_REG(x)(NITIO_G0_STATUS + (x))
 #define NITIO_INT_ENA_REG(x)   (NITIO_G0_INT_ENA + (x))
 
-enum Gxx_Joint_Status2_Bits {
-   G0_Output_Bit = 0x1,
-   G1_Output_Bit = 0x2,
-   G0_HW_Save_Bit = 0x1000,
-   G1_HW_Save_Bit = 0x2000,
-   G0_Permanent_Stale_Bit = 0x4000,
-   G1_Permanent_Stale_Bit = 0x8000
-};
-static inline enum Gxx_Joint_Status2_Bits Gi_Permanent_Stale_Bit(unsigned
-counter_index)
-{
-   if (counter_index % 2)
-   return G1_Permanent_Stale_Bit;
-   return G0_Permanent_Stale_Bit;
-}
-
 enum Gi_DMA_Config_Reg_Bits {
Gi_DMA_Enable_Bit = 0x1,
Gi_DMA_Write_Bit = 0x2,
diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c 
b/drivers/staging/comedi/drivers/ni_tiocmd.c
index d628748..9ba4079 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -409,7 +409,7 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct 
*counter, int *gate_error,
*stale_data = 1;
}
if (read_register(counter, NITIO_STATUS2_REG(cidx)) &
-   Gi_Permanent_Stale_Bit(cidx)) {
+   GI_PERMANENT_STALE(cidx)) {
dev_info(counter->counter_dev->dev->class_dev,
 "%s: Gi_Permanent_Stale_Data detected.\n",
 __func__);
-- 
2.0.3

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


[PATCH 15/19] staging: comedi: ni_tio: tidy up G{02, 12}_Interrupt_Enable_Bits

2014-07-28 Thread H Hartley Sweeten
Convert these enums into defines and rename the CamelCase symbols.

For aesthetics, move the new defines so they are associated with
the register define.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tio_internal.h | 21 ++---
 drivers/staging/comedi/drivers/ni_tiocmd.c   |  6 +++---
 2 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h 
b/drivers/staging/comedi/drivers/ni_tio_internal.h
index 37cdb49..2bceae4 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -153,25 +153,8 @@
 #define GI_TC  (1 << 3)
 #define GI_INTERRUPT   (1 << 15)
 #define NITIO_INT_ENA_REG(x)   (NITIO_G0_INT_ENA + (x))
-
-enum G02_Interrupt_Enable_Bits {
-   G0_TC_Interrupt_Enable_Bit = 0x40,
-   G0_Gate_Interrupt_Enable_Bit = 0x100
-};
-enum G13_Interrupt_Enable_Bits {
-   G1_TC_Interrupt_Enable_Bit = 0x200,
-   G1_Gate_Interrupt_Enable_Bit = 0x400
-};
-static inline unsigned Gi_Gate_Interrupt_Enable_Bit(unsigned counter_index)
-{
-   unsigned bit;
-
-   if (counter_index % 2)
-   bit = G1_Gate_Interrupt_Enable_Bit;
-   else
-   bit = G0_Gate_Interrupt_Enable_Bit;
-   return bit;
-}
+#define GI_TC_INTERRUPT_ENABLE(x)  (((x) % 2) ? (1 << 9) : (1 << 6))
+#define GI_GATE_INTERRUPT_ENABLE(x)(((x) % 2) ? (1 << 10) : (1 << 8))
 
 static inline void write_register(struct ni_gpct *counter, unsigned bits,
  enum ni_gpct_register reg)
diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c 
b/drivers/staging/comedi/drivers/ni_tiocmd.c
index 3ec8995..8c89786 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -201,8 +201,8 @@ static int ni_tio_cmd_setup(struct comedi_subdevice *s)
retval = ni_tio_set_gate_src(counter, 0, gate_source);
if (cmd->flags & TRIG_WAKE_EOS) {
ni_tio_set_bits(counter, NITIO_INT_ENA_REG(cidx),
-   Gi_Gate_Interrupt_Enable_Bit(cidx),
-   Gi_Gate_Interrupt_Enable_Bit(cidx));
+   GI_GATE_INTERRUPT_ENABLE(cidx),
+   GI_GATE_INTERRUPT_ENABLE(cidx));
}
return retval;
 }
@@ -322,7 +322,7 @@ int ni_tio_cancel(struct ni_gpct *counter)
ni_tio_configure_dma(counter, 0, 0);
 
ni_tio_set_bits(counter, NITIO_INT_ENA_REG(cidx),
-   Gi_Gate_Interrupt_Enable_Bit(cidx), 0x0);
+   GI_GATE_INTERRUPT_ENABLE(cidx), 0x0);
return 0;
 }
 EXPORT_SYMBOL_GPL(ni_tio_cancel);
-- 
2.0.3

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


[PATCH 08/19] staging: comedi: ni_tio: tidy up Gxx_Status_Bits

2014-07-28 Thread H Hartley Sweeten
Convert this enum into defines and rename the CamelCase symbols.

For aesthetics, move the new defines so they are associated with
the register define.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tio.c  |  6 +--
 drivers/staging/comedi/drivers/ni_tio_internal.h | 69 +++-
 drivers/staging/comedi/drivers/ni_tiocmd.c   |  6 +--
 3 files changed, 14 insertions(+), 67 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c 
b/drivers/staging/comedi/drivers/ni_tio.c
index 1536412..ccdf96e 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -1200,9 +1200,9 @@ int ni_tio_insn_config(struct comedi_device *dev,
case INSN_CONFIG_GET_COUNTER_STATUS:
data[1] = 0;
status = read_register(counter, NITIO_SHARED_STATUS_REG(cidx));
-   if (status & Gi_Armed_Bit(cidx)) {
+   if (status & GI_ARMED(cidx)) {
data[1] |= COMEDI_COUNTER_ARMED;
-   if (status & Gi_Counting_Bit(cidx))
+   if (status & GI_COUNTING(cidx))
data[1] |= COMEDI_COUNTER_COUNTING;
}
data[2] = COMEDI_COUNTER_ARMED | COMEDI_COUNTER_COUNTING;
@@ -1289,7 +1289,7 @@ static unsigned ni_tio_next_load_register(struct ni_gpct 
*counter)
const unsigned bits =
read_register(counter, NITIO_SHARED_STATUS_REG(cidx));
 
-   return (bits & Gi_Next_Load_Source_Bit(cidx))
+   return (bits & GI_NEXT_LOAD_SRC(cidx))
? NITIO_LOADB_REG(cidx)
: NITIO_LOADA_REG(cidx);
 }
diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h 
b/drivers/staging/comedi/drivers/ni_tio_internal.h
index 889bd30..37fde62 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -117,6 +117,14 @@
 #define GI_GATE2_SUBSEL(1 << 14)
 #define GI_SRC_SUBSEL  (1 << 15)
 #define NITIO_SHARED_STATUS_REG(x) (NITIO_G01_STATUS + ((x) / 2))
+#define GI_SAVE(x) (((x) % 2) ? (1 << 1) : (1 << 0))
+#define GI_COUNTING(x) (((x) % 2) ? (1 << 3) : (1 << 2))
+#define GI_NEXT_LOAD_SRC(x)(((x) % 2) ? (1 << 5) : (1 << 4))
+#define GI_STALE_DATA(x)   (((x) % 2) ? (1 << 7) : (1 << 6))
+#define GI_ARMED(x)(((x) % 2) ? (1 << 9) : (1 << 8))
+#define GI_NO_LOAD_BETWEEN_GATES(x)(((x) % 2) ? (1 << 11) : (1 << 10))
+#define GI_TC_ERROR(x) (((x) % 2) ? (1 << 13) : (1 << 12))
+#define GI_GATE_ERROR(x)   (((x) % 2) ? (1 << 15) : (1 << 14))
 #define NITIO_RESET_REG(x) (NITIO_G01_RESET + ((x) / 2))
 #define NITIO_STATUS1_REG(x)   (NITIO_G01_STATUS1 + ((x) / 2))
 #define NITIO_STATUS2_REG(x)   (NITIO_G01_STATUS2 + ((x) / 2))
@@ -127,67 +135,6 @@
 #define NITIO_STATUS_REG(x)(NITIO_G0_STATUS + (x))
 #define NITIO_INT_ENA_REG(x)   (NITIO_G0_INT_ENA + (x))
 
-enum Gxx_Status_Bits {
-   G0_Save_Bit = 0x1,
-   G1_Save_Bit = 0x2,
-   G0_Counting_Bit = 0x4,
-   G1_Counting_Bit = 0x8,
-   G0_Next_Load_Source_Bit = 0x10,
-   G1_Next_Load_Source_Bit = 0x20,
-   G0_Stale_Data_Bit = 0x40,
-   G1_Stale_Data_Bit = 0x80,
-   G0_Armed_Bit = 0x100,
-   G1_Armed_Bit = 0x200,
-   G0_No_Load_Between_Gates_Bit = 0x400,
-   G1_No_Load_Between_Gates_Bit = 0x800,
-   G0_TC_Error_Bit = 0x1000,
-   G1_TC_Error_Bit = 0x2000,
-   G0_Gate_Error_Bit = 0x4000,
-   G1_Gate_Error_Bit = 0x8000
-};
-static inline enum Gxx_Status_Bits Gi_Counting_Bit(unsigned counter_index)
-{
-   if (counter_index % 2)
-   return G1_Counting_Bit;
-   return G0_Counting_Bit;
-}
-
-static inline enum Gxx_Status_Bits Gi_Armed_Bit(unsigned counter_index)
-{
-   if (counter_index % 2)
-   return G1_Armed_Bit;
-   return G0_Armed_Bit;
-}
-
-static inline enum Gxx_Status_Bits Gi_Next_Load_Source_Bit(unsigned
-  counter_index)
-{
-   if (counter_index % 2)
-   return G1_Next_Load_Source_Bit;
-   return G0_Next_Load_Source_Bit;
-}
-
-static inline enum Gxx_Status_Bits Gi_Stale_Data_Bit(unsigned counter_index)
-{
-   if (counter_index % 2)
-   return G1_Stale_Data_Bit;
-   return G0_Stale_Data_Bit;
-}
-
-static inline enum Gxx_Status_Bits Gi_TC_Error_Bit(unsigned counter_index)
-{
-   if (counter_index % 2)
-   return G1_TC_Error_Bit;
-   return G0_TC_Error_Bit;
-}
-
-static inline enum Gxx_Status_Bits Gi_Gate_Error_Bit(unsigned counter_index)
-{
-   if (counter_index % 2)
-   return G1_Gate_Error_Bit;
-   return G0_Gate_Error_Bit;
-}
-
 /* joint reset register bits */
 stati

[PATCH 07/19] staging: comedi: ni_tio: tidy up Gi_Second_Gate_Bits

2014-07-28 Thread H Hartley Sweeten
Convert this enum into defines and rename the CamelCase symbols.

For aesthetics, move the new defines so they are associated with
the register define.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tio.c  | 44 ++--
 drivers/staging/comedi/drivers/ni_tio_internal.h | 23 -
 2 files changed, 25 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c 
b/drivers/staging/comedi/drivers/ni_tio.c
index 7a37d2b..1536412 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -267,8 +267,7 @@ static unsigned ni_m_series_clock_src_select(const struct 
ni_gpct *counter)
clock_source = NI_GPCT_TIMEBASE_2_CLOCK_SRC_BITS;
break;
case NI_M_TIMEBASE_3_CLK:
-   if (counter_dev->regs[second_gate_reg] &
-   Gi_Source_Subselect_Bit)
+   if (counter_dev->regs[second_gate_reg] & GI_SRC_SUBSEL)
clock_source =
NI_GPCT_ANALOG_TRIGGER_OUT_CLOCK_SRC_BITS;
else
@@ -278,8 +277,7 @@ static unsigned ni_m_series_clock_src_select(const struct 
ni_gpct *counter)
clock_source = NI_GPCT_LOGIC_LOW_CLOCK_SRC_BITS;
break;
case NI_M_NEXT_GATE_CLK:
-   if (counter_dev->regs[second_gate_reg] &
-   Gi_Source_Subselect_Bit)
+   if (counter_dev->regs[second_gate_reg] & GI_SRC_SUBSEL)
clock_source = NI_GPCT_PXI_STAR_TRIGGER_CLOCK_SRC_BITS;
else
clock_source = NI_GPCT_NEXT_GATE_CLOCK_SRC_BITS;
@@ -666,12 +664,12 @@ static void ni_tio_set_source_subselect(struct ni_gpct 
*counter,
/* Gi_Source_Subselect is zero */
case NI_GPCT_NEXT_GATE_CLOCK_SRC_BITS:
case NI_GPCT_TIMEBASE_3_CLOCK_SRC_BITS:
-   counter_dev->regs[second_gate_reg] &= ~Gi_Source_Subselect_Bit;
+   counter_dev->regs[second_gate_reg] &= ~GI_SRC_SUBSEL;
break;
/* Gi_Source_Subselect is one */
case NI_GPCT_ANALOG_TRIGGER_OUT_CLOCK_SRC_BITS:
case NI_GPCT_PXI_STAR_TRIGGER_CLOCK_SRC_BITS:
-   counter_dev->regs[second_gate_reg] |= Gi_Source_Subselect_Bit;
+   counter_dev->regs[second_gate_reg] |= GI_SRC_SUBSEL;
break;
/* Gi_Source_Subselect doesn't matter */
default:
@@ -863,9 +861,9 @@ static int ni_660x_set_gate2(struct ni_gpct *counter, 
unsigned int gate_source)
break;
return -EINVAL;
}
-   counter_dev->regs[gate2_reg] |= Gi_Second_Gate_Mode_Bit;
-   counter_dev->regs[gate2_reg] &= ~Gi_Second_Gate_Select_Mask;
-   counter_dev->regs[gate2_reg] |= Gi_Second_Gate_Select_Bits(gate2_sel);
+   counter_dev->regs[gate2_reg] |= GI_GATE2_MODE;
+   counter_dev->regs[gate2_reg] &= ~GI_GATE2_SEL_MASK;
+   counter_dev->regs[gate2_reg] |= GI_GATE2_SEL(gate2_sel);
write_register(counter, counter_dev->regs[gate2_reg], gate2_reg);
return 0;
 }
@@ -887,9 +885,9 @@ static int ni_m_set_gate2(struct ni_gpct *counter, unsigned 
int gate_source)
gate2_sel = chan & 0x1f;
break;
}
-   counter_dev->regs[gate2_reg] |= Gi_Second_Gate_Mode_Bit;
-   counter_dev->regs[gate2_reg] &= ~Gi_Second_Gate_Select_Mask;
-   counter_dev->regs[gate2_reg] |= Gi_Second_Gate_Select_Bits(gate2_sel);
+   counter_dev->regs[gate2_reg] |= GI_GATE2_MODE;
+   counter_dev->regs[gate2_reg] &= ~GI_GATE2_SEL_MASK;
+   counter_dev->regs[gate2_reg] |= GI_GATE2_SEL(gate2_sel);
write_register(counter, counter_dev->regs[gate2_reg], gate2_reg);
return 0;
 }
@@ -934,19 +932,15 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, unsigned 
gate_index,
return -EINVAL;
 
if (chan == NI_GPCT_DISABLED_GATE_SELECT) {
-   counter_dev->regs[gate2_reg] &=
-   ~Gi_Second_Gate_Mode_Bit;
+   counter_dev->regs[gate2_reg] &= ~GI_GATE2_MODE;
write_register(counter, counter_dev->regs[gate2_reg],
   gate2_reg);
return 0;
}
-   if (gate_source & CR_INVERT) {
-   counter_dev->regs[gate2_reg] |=
-   Gi_Second_Gate_Polarity_Bit;
-   } else {
-   counter_dev->regs[gate2_reg] &=
-   ~Gi_Second_Gate_Polarity_Bit;
-   }
+   if (gate_source & CR_INVERT)
+   counter_dev->regs[gate2_reg] |= GI_GATE2_POL_INVERT;
+   else
+   counter_dev->regs[gate2

[PATCH 00/19] staging: comedi: ni_tio: cleanup CamelCase issues

2014-07-28 Thread H Hartley Sweeten
Fix the CamelCase issues by replacing the enums used for the register
bits with simple defines/macros and renaming the symbols.

Remove some unnecessary BUG() checks and tidy up some of the functions
in ni_tiocmd.

H Hartley Sweeten (19):
  staging: comedi: ni_tio: tidy up ni_tio_read_sw_save_reg()
  staging: comedi: ni_tio: tidy up Gi_Counting_Mode_Reg_Bits
  staging: comedi: ni_tio: tidy up Gi_Command_Reg_Bits
  staging: comedi: ni_tio: tidy up Gi_Auto_Increment_Reg_Bits
  staging: comedi: ni_tio: tidy up Gi_Input_Select_Bits
  staging: comedi: ni_tio: tidy up Gi_Mode_Bits
  staging: comedi: ni_tio: tidy up Gi_Second_Gate_Bits
  staging: comedi: ni_tio: tidy up Gxx_Status_Bits
  staging: comedi: ni_tio: tidy up Gi_Reset_Bit
  staging: comedi: ni_tio: tidy up Gxx_Joint_Status2_Bits
  staging: comedi: ni_tio: tidy up Gi_DMA_Config_Reg_Bits
  staging: comedi: ni_tio: tidy up Gi_DMA_Status_Reg_Bits
  staging: comedi: ni_tio: tidy up Gxx_Interrupt_Acknowledge_Bits
  staging: comedi: ni_tio: tidy up Gi_Status_Bits
  staging: comedi: ni_tio: tidy up G{02,12}_Interrupt_Enable_Bits
  staging: comedi: ni_tiocmd: tidy up ni_tio_configure_dma()
  staging: comedi: ni_tiocmd: tidy up ni_tio_input_inttrig()
  staging: comedi: ni_tiocmd: tidy up ni_tio_input_cmd()
  staging: comedi: ni_tiocmd: introduce ni_tio_acknowledge()

 drivers/staging/comedi/drivers/ni_660x.c |   2 +-
 drivers/staging/comedi/drivers/ni_mio_common.c   |   2 +-
 drivers/staging/comedi/drivers/ni_stc.h  |   8 -
 drivers/staging/comedi/drivers/ni_tio.c  | 298 --
 drivers/staging/comedi/drivers/ni_tio.h  |   4 +-
 drivers/staging/comedi/drivers/ni_tio_internal.h | 385 +++
 drivers/staging/comedi/drivers/ni_tiocmd.c   | 139 
 7 files changed, 313 insertions(+), 525 deletions(-)

-- 
2.0.3

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


[PATCH 01/19] staging: comedi: ni_tio: tidy up ni_tio_read_sw_save_reg()

2014-07-28 Thread H Hartley Sweeten
Remove the need for some of the local variables.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tio.c | 17 ++---
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c 
b/drivers/staging/comedi/drivers/ni_tio.c
index f9f6320..6ed14df 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -1266,9 +1266,7 @@ static unsigned int ni_tio_read_sw_save_reg(struct 
comedi_device *dev,
 {
struct ni_gpct *counter = s->private;
unsigned cidx = counter->counter_index;
-   unsigned int first_read;
-   unsigned int second_read;
-   unsigned int correct_read;
+   unsigned int val;
 
ni_tio_set_bits(counter, NITIO_CMD_REG(cidx), Gi_Save_Trace_Bit, 0);
ni_tio_set_bits(counter, NITIO_CMD_REG(cidx),
@@ -1283,14 +1281,11 @@ static unsigned int ni_tio_read_sw_save_reg(struct 
comedi_device *dev,
 * will be correct since the count value will definitely have latched
 * by then.
 */
-   first_read = read_register(counter, NITIO_SW_SAVE_REG(cidx));
-   second_read = read_register(counter, NITIO_SW_SAVE_REG(cidx));
-   if (first_read != second_read)
-   correct_read = read_register(counter, NITIO_SW_SAVE_REG(cidx));
-   else
-   correct_read = first_read;
-
-   return correct_read;
+   val = read_register(counter, NITIO_SW_SAVE_REG(cidx));
+   if (val != read_register(counter, NITIO_SW_SAVE_REG(cidx)))
+   val = read_register(counter, NITIO_SW_SAVE_REG(cidx));
+
+   return val;
 }
 
 int ni_tio_insn_read(struct comedi_device *dev,
-- 
2.0.3

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


[PATCH 02/19] staging: comedi: ni_tio: tidy up Gi_Counting_Mode_Reg_Bits

2014-07-28 Thread H Hartley Sweeten
Convert this enum into defines and rename all the CamelCase symbols.

For aesthetics, move the new defines so they are associated with the
register define.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tio.c  | 99 ++--
 drivers/staging/comedi/drivers/ni_tio_internal.h | 56 +-
 2 files changed, 64 insertions(+), 91 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c 
b/drivers/staging/comedi/drivers/ni_tio.c
index 6ed14df..1baad07 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -116,59 +116,55 @@ TODO:
 #define NI_660X_LOGIC_LOW_GATE2_SEL0x1f
 #define NI_660X_MAX_UP_DOWN_PIN7
 
-static inline enum Gi_Counting_Mode_Reg_Bits
-Gi_Alternate_Sync_Bit(enum ni_gpct_variant variant)
+static inline unsigned GI_ALT_SYNC(enum ni_gpct_variant variant)
 {
switch (variant) {
case ni_gpct_variant_e_series:
default:
return 0;
case ni_gpct_variant_m_series:
-   return Gi_M_Series_Alternate_Sync_Bit;
+   return GI_M_ALT_SYNC;
case ni_gpct_variant_660x:
-   return Gi_660x_Alternate_Sync_Bit;
+   return GI_660X_ALT_SYNC;
}
 }
 
-static inline enum Gi_Counting_Mode_Reg_Bits
-Gi_Prescale_X2_Bit(enum ni_gpct_variant variant)
+static inline unsigned GI_PRESCALE_X2(enum ni_gpct_variant variant)
 {
switch (variant) {
case ni_gpct_variant_e_series:
default:
return 0;
case ni_gpct_variant_m_series:
-   return Gi_M_Series_Prescale_X2_Bit;
+   return GI_M_PRESCALE_X2;
case ni_gpct_variant_660x:
-   return Gi_660x_Prescale_X2_Bit;
+   return GI_660X_PRESCALE_X2;
}
 }
 
-static inline enum Gi_Counting_Mode_Reg_Bits
-Gi_Prescale_X8_Bit(enum ni_gpct_variant variant)
+static inline unsigned GI_PRESCALE_X8(enum ni_gpct_variant variant)
 {
switch (variant) {
case ni_gpct_variant_e_series:
default:
return 0;
case ni_gpct_variant_m_series:
-   return Gi_M_Series_Prescale_X8_Bit;
+   return GI_M_PRESCALE_X8;
case ni_gpct_variant_660x:
-   return Gi_660x_Prescale_X8_Bit;
+   return GI_660X_PRESCALE_X8;
}
 }
 
-static inline enum Gi_Counting_Mode_Reg_Bits
-Gi_HW_Arm_Select_Mask(enum ni_gpct_variant variant)
+static inline unsigned GI_HW_ARM_SEL_MASK(enum ni_gpct_variant variant)
 {
switch (variant) {
case ni_gpct_variant_e_series:
default:
return 0;
case ni_gpct_variant_m_series:
-   return Gi_M_Series_HW_Arm_Select_Mask;
+   return GI_M_HW_ARM_SEL_MASK;
case ni_gpct_variant_660x:
-   return Gi_660x_HW_Arm_Select_Mask;
+   return GI_660X_HW_ARM_SEL_MASK;
}
 }
 
@@ -254,9 +250,9 @@ static unsigned ni_tio_clock_src_modifiers(const struct 
ni_gpct *counter)
if (ni_tio_get_soft_copy(counter, NITIO_INPUT_SEL_REG(cidx)) &
Gi_Source_Polarity_Bit)
bits |= NI_GPCT_INVERT_CLOCK_SRC_BIT;
-   if (counting_mode_bits & Gi_Prescale_X2_Bit(counter_dev->variant))
+   if (counting_mode_bits & GI_PRESCALE_X2(counter_dev->variant))
bits |= NI_GPCT_PRESCALE_X2_CLOCK_SRC_BITS;
-   if (counting_mode_bits & Gi_Prescale_X8_Bit(counter_dev->variant))
+   if (counting_mode_bits & GI_PRESCALE_X8(counter_dev->variant))
bits |= NI_GPCT_PRESCALE_X8_CLOCK_SRC_BITS;
return bits;
 }
@@ -401,17 +397,18 @@ static void ni_tio_set_sync_mode(struct ni_gpct *counter, 
int force_alt_sync)
unsigned cidx = counter->counter_index;
const unsigned counting_mode_reg = NITIO_CNT_MODE_REG(cidx);
static const uint64_t min_normal_sync_period_ps = 25000;
+   unsigned mode;
uint64_t clock_period_ps;
 
if (ni_tio_counting_mode_registers_present(counter_dev) == 0)
return;
 
-   switch (ni_tio_get_soft_copy(counter, counting_mode_reg) &
-   Gi_Counting_Mode_Mask) {
-   case Gi_Counting_Mode_QuadratureX1_Bits:
-   case Gi_Counting_Mode_QuadratureX2_Bits:
-   case Gi_Counting_Mode_QuadratureX4_Bits:
-   case Gi_Counting_Mode_Sync_Source_Bits:
+   mode = ni_tio_get_soft_copy(counter, counting_mode_reg);
+   switch (mode & GI_CNT_MODE_MASK) {
+   case GI_CNT_MODE_QUADX1:
+   case GI_CNT_MODE_QUADX2:
+   case GI_CNT_MODE_QUADX4:
+   case GI_CNT_MODE_SYNC_SRC:
force_alt_sync = 1;
break;
default:
@@ -429,11 +426,11 @@ static void ni_tio_set_sync_mode(struct ni_gpct *counter, 
int force_alt_sync)
if (force_alt_sync ||
(clock_period_ps && clock_period_ps < min_normal_sync_period_ps)) {
ni_tio_set_bits

[PATCH 13/19] staging: comedi: ni_tio: tidy up Gxx_Interrupt_Acknowledge_Bits

2014-07-28 Thread H Hartley Sweeten
Convert this enum and the others related to it into defines and
rename the CamelCase symbols.

For aesthetics, move the new defines so they are associated with
the register define.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tio_internal.h | 32 +++-
 drivers/staging/comedi/drivers/ni_tiocmd.c   |  8 +++---
 2 files changed, 8 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h 
b/drivers/staging/comedi/drivers/ni_tio_internal.h
index db6b563..8d1b254 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -144,37 +144,13 @@
 #define GI_DRQ_STATUS  (1 << 15)
 #define NITIO_ABZ_REG(x)   (NITIO_G0_ABZ + (x))
 #define NITIO_INT_ACK_REG(x)   (NITIO_G0_INT_ACK + (x))
+#define GI_GATE_ERROR_CONFIRM(x)   (((x) % 2) ? (1 << 1) : (1 << 5))
+#define GI_TC_ERROR_CONFIRM(x) (((x) % 2) ? (1 << 2) : (1 << 6))
+#define GI_TC_INTERRUPT_ACK(1 << 14)
+#define GI_GATE_INTERRUPT_ACK  (1 << 15)
 #define NITIO_STATUS_REG(x)(NITIO_G0_STATUS + (x))
 #define NITIO_INT_ENA_REG(x)   (NITIO_G0_INT_ENA + (x))
 
-enum G02_Interrupt_Acknowledge_Bits {
-   G0_Gate_Error_Confirm_Bit = 0x20,
-   G0_TC_Error_Confirm_Bit = 0x40
-};
-enum G13_Interrupt_Acknowledge_Bits {
-   G1_Gate_Error_Confirm_Bit = 0x2,
-   G1_TC_Error_Confirm_Bit = 0x4
-};
-static inline unsigned Gi_Gate_Error_Confirm_Bit(unsigned counter_index)
-{
-   if (counter_index % 2)
-   return G1_Gate_Error_Confirm_Bit;
-   return G0_Gate_Error_Confirm_Bit;
-}
-
-static inline unsigned Gi_TC_Error_Confirm_Bit(unsigned counter_index)
-{
-   if (counter_index % 2)
-   return G1_TC_Error_Confirm_Bit;
-   return G0_TC_Error_Confirm_Bit;
-}
-
-/* bits that are the same in G0/G2 and G1/G3 interrupt acknowledge registers */
-enum Gxx_Interrupt_Acknowledge_Bits {
-   Gi_TC_Interrupt_Ack_Bit = 0x4000,
-   Gi_Gate_Interrupt_Ack_Bit = 0x8000
-};
-
 enum Gi_Status_Bits {
Gi_Gate_Interrupt_Bit = 0x4,
Gi_TC_Bit = 0x8,
diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c 
b/drivers/staging/comedi/drivers/ni_tiocmd.c
index f8019bf..43a7bee 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -378,7 +378,7 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct 
*counter, int *gate_error,
*stale_data = 0;
 
if (gxx_status & GI_GATE_ERROR(cidx)) {
-   ack |= Gi_Gate_Error_Confirm_Bit(cidx);
+   ack |= GI_GATE_ERROR_CONFIRM(cidx);
if (gate_error) {
/*660x don't support automatic acknowledgement
  of gate interrupt via dma read/write
@@ -390,15 +390,15 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct 
*counter, int *gate_error,
}
}
if (gxx_status & GI_TC_ERROR(cidx)) {
-   ack |= Gi_TC_Error_Confirm_Bit(cidx);
+   ack |= GI_TC_ERROR_CONFIRM(cidx);
if (tc_error)
*tc_error = 1;
}
if (gi_status & Gi_TC_Bit)
-   ack |= Gi_TC_Interrupt_Ack_Bit;
+   ack |= GI_TC_INTERRUPT_ACK;
if (gi_status & Gi_Gate_Interrupt_Bit) {
if (should_ack_gate(counter))
-   ack |= Gi_Gate_Interrupt_Ack_Bit;
+   ack |= GI_GATE_INTERRUPT_ACK;
}
if (ack)
write_register(counter, ack, NITIO_INT_ACK_REG(cidx));
-- 
2.0.3

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


[PATCH 11/19] staging: comedi: ni_tio: tidy up Gi_DMA_Config_Reg_Bits

2014-07-28 Thread H Hartley Sweeten
Convert this enum into defines and rename the CamelCase symbols.

For aesthetics, move the new defines so they are associated with
the register define.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_stc.h  |  8 
 drivers/staging/comedi/drivers/ni_tio_internal.h | 11 +--
 drivers/staging/comedi/drivers/ni_tiocmd.c   | 10 +-
 3 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_stc.h 
b/drivers/staging/comedi/drivers/ni_stc.h
index caad9d8..a284129 100644
--- a/drivers/staging/comedi/drivers/ni_stc.h
+++ b/drivers/staging/comedi/drivers/ni_stc.h
@@ -1285,14 +1285,6 @@ static inline unsigned 
MSeries_PFI_Output_Select_Source(unsigned channel,
return (bits >> ((channel % 3) * 5)) & 0x1f;
 };
 
-enum MSeries_Gi_DMA_Config_Bits {
-   Gi_DMA_BankSW_Error_Bit = 0x10,
-   Gi_DMA_Reset_Bit = 0x8,
-   Gi_DMA_Int_Enable_Bit = 0x4,
-   Gi_DMA_Write_Bit = 0x2,
-   Gi_DMA_Enable_Bit = 0x1,
-};
-
 static inline unsigned MSeries_PFI_Filter_Select_Mask(unsigned channel)
 {
return 0x3 << (channel * 2);
diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h 
b/drivers/staging/comedi/drivers/ni_tio_internal.h
index 18a1e16..a74cec4 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -133,18 +133,17 @@
 #define GI_HW_SAVE(x)  (((x) % 2) ? (1 << 13) : (1 << 12))
 #define GI_PERMANENT_STALE(x)  (((x) % 2) ? (1 << 15) : (1 << 14))
 #define NITIO_DMA_CFG_REG(x)   (NITIO_G0_DMA_CFG + (x))
+#define GI_DMA_ENABLE  (1 << 0)
+#define GI_DMA_WRITE   (1 << 1)
+#define GI_DMA_INT_ENA (1 << 2)
+#define GI_DMA_RESET   (1 << 3)
+#define GI_DMA_BANKSW_ERROR(1 << 4)
 #define NITIO_DMA_STATUS_REG(x)(NITIO_G0_DMA_STATUS + (x))
 #define NITIO_ABZ_REG(x)   (NITIO_G0_ABZ + (x))
 #define NITIO_INT_ACK_REG(x)   (NITIO_G0_INT_ACK + (x))
 #define NITIO_STATUS_REG(x)(NITIO_G0_STATUS + (x))
 #define NITIO_INT_ENA_REG(x)   (NITIO_G0_INT_ENA + (x))
 
-enum Gi_DMA_Config_Reg_Bits {
-   Gi_DMA_Enable_Bit = 0x1,
-   Gi_DMA_Write_Bit = 0x2,
-   Gi_DMA_Int_Bit = 0x4
-};
-
 enum Gi_DMA_Status_Reg_Bits {
Gi_DMA_Readbank_Bit = 0x2000,
Gi_DRQ_Error_Bit = 0x4000,
diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c 
b/drivers/staging/comedi/drivers/ni_tiocmd.c
index 9ba4079..d80bb35 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -74,14 +74,14 @@ static void ni_tio_configure_dma(struct ni_gpct *counter, 
short enable,
unsigned gi_dma_config_bits = 0;
 
if (enable) {
-   gi_dma_config_bits |= Gi_DMA_Enable_Bit;
-   gi_dma_config_bits |= Gi_DMA_Int_Bit;
+   gi_dma_config_bits |= GI_DMA_ENABLE;
+   gi_dma_config_bits |= GI_DMA_INT_ENA;
}
if (read_not_write == 0)
-   gi_dma_config_bits |= Gi_DMA_Write_Bit;
+   gi_dma_config_bits |= GI_DMA_WRITE;
ni_tio_set_bits(counter, NITIO_DMA_CFG_REG(cidx),
-   Gi_DMA_Enable_Bit | Gi_DMA_Int_Bit |
-   Gi_DMA_Write_Bit, gi_dma_config_bits);
+   GI_DMA_ENABLE | GI_DMA_INT_ENA |
+   GI_DMA_WRITE, gi_dma_config_bits);
}
break;
}
-- 
2.0.3

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


[PATCH 03/19] staging: comedi: ni_tio: tidy up Gi_Command_Reg_Bits

2014-07-28 Thread H Hartley Sweeten
Convert this enum into defines and rename all the CamelCase symbols.

For aesthetics, move the new defines so they are associated with the
register define.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_tio.c  | 20 ++---
 drivers/staging/comedi/drivers/ni_tio_internal.h | 37 ++--
 drivers/staging/comedi/drivers/ni_tiocmd.c   |  2 +-
 3 files changed, 25 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c 
b/drivers/staging/comedi/drivers/ni_tio.c
index 1baad07..8df8468 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -481,10 +481,8 @@ static int ni_tio_set_counter_mode(struct ni_gpct 
*counter, unsigned mode)
ni_tio_set_sync_mode(counter, 0);
}
 
-   ni_tio_set_bits(counter, NITIO_CMD_REG(cidx),
-   Gi_Up_Down_Mask,
-   (mode >> NI_GPCT_COUNTING_DIRECTION_SHIFT) <<
-   Gi_Up_Down_Shift);
+   ni_tio_set_bits(counter, NITIO_CMD_REG(cidx), GI_CNT_DIR_MASK,
+   GI_CNT_DIR(mode >> NI_GPCT_COUNTING_DIRECTION_SHIFT));
 
if (mode & NI_GPCT_OR_GATE_BIT)
input_select_bits |= Gi_Or_Gate_Bit;
@@ -506,10 +504,10 @@ int ni_tio_arm(struct ni_gpct *counter, int arm, unsigned 
start_trigger)
if (arm) {
switch (start_trigger) {
case NI_GPCT_ARM_IMMEDIATE:
-   command_transient_bits |= Gi_Arm_Bit;
+   command_transient_bits |= GI_ARM;
break;
case NI_GPCT_ARM_PAIRED_IMMEDIATE:
-   command_transient_bits |= Gi_Arm_Bit | Gi_Arm_Copy_Bit;
+   command_transient_bits |= GI_ARM | GI_ARM_COPY;
break;
default:
break;
@@ -543,7 +541,7 @@ int ni_tio_arm(struct ni_gpct *counter, int arm, unsigned 
start_trigger)
GI_HW_ARM_ENA | sel_mask, bits);
}
} else {
-   command_transient_bits |= Gi_Disarm_Bit;
+   command_transient_bits |= GI_DISARM;
}
ni_tio_set_bits_transient(counter, NITIO_CMD_REG(cidx),
  0, 0, command_transient_bits);
@@ -1255,9 +1253,9 @@ static unsigned int ni_tio_read_sw_save_reg(struct 
comedi_device *dev,
unsigned cidx = counter->counter_index;
unsigned int val;
 
-   ni_tio_set_bits(counter, NITIO_CMD_REG(cidx), Gi_Save_Trace_Bit, 0);
+   ni_tio_set_bits(counter, NITIO_CMD_REG(cidx), GI_SAVE_TRACE, 0);
ni_tio_set_bits(counter, NITIO_CMD_REG(cidx),
-   Gi_Save_Trace_Bit, Gi_Save_Trace_Bit);
+   GI_SAVE_TRACE, GI_SAVE_TRACE);
 
/*
 * The count doesn't get latched until the next clock edge, so it is
@@ -1341,7 +1339,7 @@ int ni_tio_insn_write(struct comedi_device *dev,
load_reg = ni_tio_next_load_register(counter);
write_register(counter, data[0], load_reg);
ni_tio_set_bits_transient(counter, NITIO_CMD_REG(cidx),
- 0, 0, Gi_Load_Bit);
+ 0, 0, GI_LOAD);
/* restore load reg */
write_register(counter, counter_dev->regs[load_reg], load_reg);
break;
@@ -1372,7 +1370,7 @@ void ni_tio_init_counter(struct ni_gpct *counter)
write_register(counter, 0x0, NITIO_AUTO_INC_REG(cidx));
 
ni_tio_set_bits(counter, NITIO_CMD_REG(cidx),
-   ~0, Gi_Synchronize_Gate_Bit);
+   ~0, GI_SYNC_GATE);
 
ni_tio_set_bits(counter, NITIO_MODE_REG(cidx), ~0, 0);
 
diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h 
b/drivers/staging/comedi/drivers/ni_tio_internal.h
index 03aa895..55f1bfc 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -23,6 +23,21 @@
 
 #define NITIO_AUTO_INC_REG(x)  (NITIO_G0_AUTO_INC + (x))
 #define NITIO_CMD_REG(x)   (NITIO_G0_CMD + (x))
+#define GI_ARM (1 << 0)
+#define GI_SAVE_TRACE  (1 << 1)
+#define GI_LOAD(1 << 2)
+#define GI_DISARM  (1 << 4)
+#define GI_CNT_DIR(x)  (((x) & 0x3) << 5)
+#define GI_CNT_DIR_MASK(3 << 5)
+#define GI_WRITE_SWITCH(1 << 7)
+#define GI_SYNC_GATE   (1 << 8)
+#define GI_LITTLE_BIG_ENDIAN   (1 << 9)
+#define GI_BANK_SWITCH_START   (1 << 10)
+#define GI_BANK_SWITCH_MODE(1 << 11)
+#define GI_BANK_SWITCH_ENABLE  (1 << 12)
+#define GI_ARM_COPY(1 << 13)
+#define GI_SAVE_TRACE_COPY

[PATCH 1/9] staging: rtl8188eu: Remove unused member MultiFunc from struct hal_data_8188e

2014-07-28 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c |1 -
 drivers/staging/rtl8188eu/include/rtl8188e_hal.h  |1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c 
b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
index 161138f..fbf70f6 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c
@@ -517,7 +517,6 @@ static struct HAL_VERSION ReadChipVersion8188E(struct 
adapter *padapter)
pHalData->RegulatorMode = ((value32 & TRP_BT_EN) ? RT_LDO_REGULATOR : 
RT_SWITCHING_REGULATOR);
 
ChipVersion.ROMVer = 0; /*  ROM code version. */
-   pHalData->MultiFunc = RT_MULTI_FUNC_NONE;
 
dump_chip_info(ChipVersion);
 
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h 
b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
index 4b7b069..fb20653 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
@@ -240,7 +240,6 @@ enum rt_regulator_mode {
 
 struct hal_data_8188e {
struct HAL_VERSION  VersionID;
-   enum rt_multi_func MultiFunc; /*  For multi-function consideration. */
enum rt_regulator_mode RegulatorMode; /*  switching regulator or LDO */
u16 CustomerID;
 
-- 
1.7.10.4

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


[PATCH 2/9] staging: rtl8188eu: Remove wrapper function rtw_join_timeout_handler()

2014-07-28 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c |3 ++-
 drivers/staging/rtl8188eu/include/rtw_mlme.h  |3 +--
 drivers/staging/rtl8188eu/os_dep/mlme_linux.c |   10 +-
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index c15fab2..f63f1c2 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1362,8 +1362,9 @@ void rtw_cpwm_event_callback(struct adapter *padapter, u8 
*pbuf)
 * _rtw_join_timeout_handler - Timeout/faliure handler for CMD JoinBss
 * @adapter: pointer to struct adapter structure
 */
-void _rtw_join_timeout_handler (struct adapter *adapter)
+void _rtw_join_timeout_handler (void *function_context)
 {
+   struct adapter *adapter = (struct adapter *)function_context;
struct  mlme_priv *pmlmepriv = &adapter->mlmepriv;
int do_join_r;
 
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme.h
index 5b1fcd2..40b0c4b 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme.h
@@ -436,7 +436,6 @@ void indicate_wx_scan_complete_event(struct adapter 
*padapter);
 void rtw_indicate_wx_assoc_event(struct adapter *padapter);
 void rtw_indicate_wx_disassoc_event(struct adapter *padapter);
 int event_thread(void *context);
-void rtw_join_timeout_handler(void *FunctionContext);
 void _rtw_scan_timeout_handler(void *FunctionContext);
 void rtw_free_network_queue(struct adapter *adapter, u8 isfreeall);
 int rtw_init_mlme_priv(struct adapter *adapter);
@@ -553,7 +552,7 @@ void rtw_update_registrypriv_dev_network(struct adapter 
*adapter);
 
 void rtw_get_encrypt_decrypt_from_registrypriv(struct adapter *adapter);
 
-void _rtw_join_timeout_handler(struct adapter *adapter);
+void _rtw_join_timeout_handler(void *function_context);
 void rtw_scan_timeout_handler(struct adapter *adapter);
 
 void rtw_dynamic_check_timer_handlder(struct adapter *adapter);
diff --git a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c 
b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
index 737677c..41d2459 100644
--- a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
@@ -25,14 +25,6 @@
 #include 
 #include 
 
-void rtw_join_timeout_handler (void *FunctionContext)
-{
-   struct adapter *adapter = (struct adapter *)FunctionContext;
-
-   _rtw_join_timeout_handler(adapter);
-}
-
-
 void _rtw_scan_timeout_handler (void *FunctionContext)
 {
struct adapter *adapter = (struct adapter *)FunctionContext;
@@ -54,7 +46,7 @@ void rtw_init_mlme_timer(struct adapter *padapter)
 {
struct  mlme_priv *pmlmepriv = &padapter->mlmepriv;
 
-   _init_timer(&(pmlmepriv->assoc_timer), padapter->pnetdev, 
rtw_join_timeout_handler, padapter);
+   _init_timer(&(pmlmepriv->assoc_timer), padapter->pnetdev, 
_rtw_join_timeout_handler, padapter);
_init_timer(&(pmlmepriv->scan_to_timer), padapter->pnetdev, 
_rtw_scan_timeout_handler, padapter);
_init_timer(&(pmlmepriv->dynamic_chk_timer), padapter->pnetdev, 
_dynamic_check_timer_handlder, padapter);
 }
-- 
1.7.10.4

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


[PATCH 8/9] staging: rtl81888eu: Remove unused function rtw_os_read_port()

2014-07-28 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/include/recv_osdep.h |2 --
 drivers/staging/rtl8188eu/os_dep/recv_linux.c  |   12 
 2 files changed, 14 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/recv_osdep.h 
b/drivers/staging/rtl8188eu/include/recv_osdep.h
index a52a696..5aabd39 100644
--- a/drivers/staging/rtl8188eu/include/recv_osdep.h
+++ b/drivers/staging/rtl8188eu/include/recv_osdep.h
@@ -43,8 +43,6 @@ int rtw_os_recv_resource_alloc(struct adapter *adapt,
 
 int rtw_os_recvbuf_resource_alloc(struct adapter *adapt, struct recv_buf *buf);
 
-void rtw_os_read_port(struct adapter *padapter, struct recv_buf *precvbuf);
-
 void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl);
 int _netdev_open(struct net_device *pnetdev);
 int netdev_open(struct net_device *pnetdev);
diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c 
b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
index f8ac996..f7d53dd 100644
--- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
@@ -191,18 +191,6 @@ _recv_indicatepkt_drop:
 return _FAIL;
 }
 
-void rtw_os_read_port(struct adapter *padapter, struct recv_buf *precvbuf)
-{
-   struct recv_priv *precvpriv = &padapter->recvpriv;
-
-   /* free skb in recv_buf */
-   dev_kfree_skb_any(precvbuf->pskb);
-   precvbuf->pskb = NULL;
-   precvbuf->reuse = false;
-   usb_read_port(padapter, precvpriv->ff_hwaddr, 0,
-   (unsigned char *)precvbuf);
-}
-
 static void _rtw_reordering_ctrl_timeout_handler(void *func_context)
 {
struct recv_reorder_ctrl *preorder_ctrl;
-- 
1.7.10.4

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


[PATCH 9/9] staging:rtl8188eu:Remove wrapper function _rtw_reordering_ctrl_timeout_handler()

2014-07-28 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/os_dep/recv_linux.c |   10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c 
b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
index f7d53dd..05427c4 100644
--- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
@@ -191,17 +191,9 @@ _recv_indicatepkt_drop:
 return _FAIL;
 }
 
-static void _rtw_reordering_ctrl_timeout_handler(void *func_context)
-{
-   struct recv_reorder_ctrl *preorder_ctrl;
-
-   preorder_ctrl = (struct recv_reorder_ctrl *)func_context;
-   rtw_reordering_ctrl_timeout_handler(preorder_ctrl);
-}
-
 void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl)
 {
struct adapter *padapter = preorder_ctrl->padapter;
 
-   _init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, 
_rtw_reordering_ctrl_timeout_handler, preorder_ctrl);
+   _init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, 
rtw_reordering_ctrl_timeout_handler, preorder_ctrl);
 }
-- 
1.7.10.4

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


[PATCH 5/9] staging: rtl8188eu: Remove wrapper function _survey_timer_hdl()

2014-07-28 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c|3 ++-
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h |2 +-
 drivers/staging/rtl8188eu/os_dep/mlme_linux.c|9 +
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 41cfd30..b113f0b 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -4833,8 +4833,9 @@ void linked_status_chk(struct adapter *padapter)
}
 }
 
-void survey_timer_hdl(struct adapter *padapter)
+void survey_timer_hdl(void *function_context)
 {
+   struct adapter *padapter = (struct adapter *)function_context;
struct cmd_obj  *ph2c;
struct sitesurvey_parm  *psurveyPara;
struct cmd_priv *pcmdpriv = 
&padapter->cmdpriv;
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index 654bd36..a948d45 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -646,7 +646,7 @@ void mlmeext_sta_add_event_callback(struct adapter 
*padapter,
 
 void linked_status_chk(struct adapter *padapter);
 
-void survey_timer_hdl (struct adapter *padapter);
+void survey_timer_hdl (void *function_context);
 void link_timer_hdl (struct adapter *padapter);
 void addba_timer_hdl(struct sta_info *psta);
 
diff --git a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c 
b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
index 82b71fa..f59e130 100644
--- a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
@@ -129,13 +129,6 @@ void rtw_report_sec_ie(struct adapter *adapter, u8 
authmode, u8 *sec_ie)
}
 }
 
-static void _survey_timer_hdl(void *FunctionContext)
-{
-   struct adapter *padapter = (struct adapter *)FunctionContext;
-
-   survey_timer_hdl(padapter);
-}
-
 static void _link_timer_hdl(void *FunctionContext)
 {
struct adapter *padapter = (struct adapter *)FunctionContext;
@@ -157,7 +150,7 @@ void init_mlme_ext_timer(struct adapter *padapter)
 {
struct  mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
 
-   _init_timer(&pmlmeext->survey_timer, padapter->pnetdev, 
_survey_timer_hdl, padapter);
+   _init_timer(&pmlmeext->survey_timer, padapter->pnetdev, 
survey_timer_hdl, padapter);
_init_timer(&pmlmeext->link_timer, padapter->pnetdev, _link_timer_hdl, 
padapter);
 }
 
-- 
1.7.10.4

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


[PATCH 6/9] staging: rtl8188eu: Remove wrapper function _link_timer_hdl()

2014-07-28 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c|3 ++-
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h |2 +-
 drivers/staging/rtl8188eu/os_dep/mlme_linux.c|8 +---
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index b113f0b..f18bb78 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -4873,8 +4873,9 @@ exit_survey_timer_hdl:
return;
 }
 
-void link_timer_hdl(struct adapter *padapter)
+void link_timer_hdl(void *function_context)
 {
+   struct adapter *padapter = (struct adapter *)function_context;
struct mlme_ext_priv*pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
 
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index a948d45..05a010f 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -647,7 +647,7 @@ void mlmeext_sta_add_event_callback(struct adapter 
*padapter,
 void linked_status_chk(struct adapter *padapter);
 
 void survey_timer_hdl (void *function_context);
-void link_timer_hdl (struct adapter *padapter);
+void link_timer_hdl (void *funtion_context);
 void addba_timer_hdl(struct sta_info *psta);
 
 #define set_survey_timer(mlmeext, ms) \
diff --git a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c 
b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
index f59e130..4f5fa08 100644
--- a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
@@ -129,12 +129,6 @@ void rtw_report_sec_ie(struct adapter *adapter, u8 
authmode, u8 *sec_ie)
}
 }
 
-static void _link_timer_hdl(void *FunctionContext)
-{
-   struct adapter *padapter = (struct adapter *)FunctionContext;
-   link_timer_hdl(padapter);
-}
-
 static void _addba_timer_hdl(void *FunctionContext)
 {
struct sta_info *psta = (struct sta_info *)FunctionContext;
@@ -151,7 +145,7 @@ void init_mlme_ext_timer(struct adapter *padapter)
struct  mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
 
_init_timer(&pmlmeext->survey_timer, padapter->pnetdev, 
survey_timer_hdl, padapter);
-   _init_timer(&pmlmeext->link_timer, padapter->pnetdev, _link_timer_hdl, 
padapter);
+   _init_timer(&pmlmeext->link_timer, padapter->pnetdev, link_timer_hdl, 
padapter);
 }
 
 #ifdef CONFIG_88EU_AP_MODE
-- 
1.7.10.4

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


[PATCH 3/9] staging: rtl8188eu: Remove wrapper function _rtw_scan_timeout_handler()

2014-07-28 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c |3 ++-
 drivers/staging/rtl8188eu/include/rtw_mlme.h  |3 +--
 drivers/staging/rtl8188eu/os_dep/mlme_linux.c |9 +
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index f63f1c2..d5b2f51 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1404,8 +1404,9 @@ void _rtw_join_timeout_handler (void *function_context)
 * rtw_scan_timeout_handler - Timeout/Faliure handler for CMD SiteSurvey
 * @adapter: pointer to struct adapter structure
 */
-void rtw_scan_timeout_handler (struct adapter *adapter)
+void rtw_scan_timeout_handler (void *function_context)
 {
+   struct adapter *adapter = (struct adapter *)function_context;
struct  mlme_priv *pmlmepriv = &adapter->mlmepriv;
 
DBG_88E(FUNC_ADPT_FMT" fw_state=%x\n", FUNC_ADPT_ARG(adapter), 
get_fwstate(pmlmepriv));
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme.h
index 40b0c4b..8f5457b 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme.h
@@ -436,7 +436,6 @@ void indicate_wx_scan_complete_event(struct adapter 
*padapter);
 void rtw_indicate_wx_assoc_event(struct adapter *padapter);
 void rtw_indicate_wx_disassoc_event(struct adapter *padapter);
 int event_thread(void *context);
-void _rtw_scan_timeout_handler(void *FunctionContext);
 void rtw_free_network_queue(struct adapter *adapter, u8 isfreeall);
 int rtw_init_mlme_priv(struct adapter *adapter);
 void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv);
@@ -553,7 +552,7 @@ void rtw_update_registrypriv_dev_network(struct adapter 
*adapter);
 void rtw_get_encrypt_decrypt_from_registrypriv(struct adapter *adapter);
 
 void _rtw_join_timeout_handler(void *function_context);
-void rtw_scan_timeout_handler(struct adapter *adapter);
+void rtw_scan_timeout_handler(void *function_context);
 
 void rtw_dynamic_check_timer_handlder(struct adapter *adapter);
 #define rtw_is_scan_deny(adapter) false
diff --git a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c 
b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
index 41d2459..0bfaa78 100644
--- a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
@@ -25,13 +25,6 @@
 #include 
 #include 
 
-void _rtw_scan_timeout_handler (void *FunctionContext)
-{
-   struct adapter *adapter = (struct adapter *)FunctionContext;
-
-   rtw_scan_timeout_handler(adapter);
-}
-
 static void _dynamic_check_timer_handlder(void *FunctionContext)
 {
struct adapter *adapter = (struct adapter *)FunctionContext;
@@ -47,7 +40,7 @@ void rtw_init_mlme_timer(struct adapter *padapter)
struct  mlme_priv *pmlmepriv = &padapter->mlmepriv;
 
_init_timer(&(pmlmepriv->assoc_timer), padapter->pnetdev, 
_rtw_join_timeout_handler, padapter);
-   _init_timer(&(pmlmepriv->scan_to_timer), padapter->pnetdev, 
_rtw_scan_timeout_handler, padapter);
+   _init_timer(&(pmlmepriv->scan_to_timer), padapter->pnetdev, 
rtw_scan_timeout_handler, padapter);
_init_timer(&(pmlmepriv->dynamic_chk_timer), padapter->pnetdev, 
_dynamic_check_timer_handlder, padapter);
 }
 
-- 
1.7.10.4

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


[PATCH 7/9] staging: rtl8188eu: Remove wrapper function _addba_timer_hdl()

2014-07-28 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c|3 ++-
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h |2 +-
 drivers/staging/rtl8188eu/os_dep/mlme_linux.c|8 +---
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index f18bb78..5ba5099 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -4910,8 +4910,9 @@ void link_timer_hdl(void *function_context)
return;
 }
 
-void addba_timer_hdl(struct sta_info *psta)
+void addba_timer_hdl(void *function_context)
 {
+   struct sta_info *psta = (struct sta_info *)function_context;
struct ht_priv  *phtpriv;
 
if (!psta)
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
index 05a010f..d699ca1 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h
@@ -648,7 +648,7 @@ void linked_status_chk(struct adapter *padapter);
 
 void survey_timer_hdl (void *function_context);
 void link_timer_hdl (void *funtion_context);
-void addba_timer_hdl(struct sta_info *psta);
+void addba_timer_hdl(void *function_context);
 
 #define set_survey_timer(mlmeext, ms) \
do { \
diff --git a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c 
b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
index 4f5fa08..1b892c4 100644
--- a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
@@ -129,15 +129,9 @@ void rtw_report_sec_ie(struct adapter *adapter, u8 
authmode, u8 *sec_ie)
}
 }
 
-static void _addba_timer_hdl(void *FunctionContext)
-{
-   struct sta_info *psta = (struct sta_info *)FunctionContext;
-   addba_timer_hdl(psta);
-}
-
 void init_addba_retry_timer(struct adapter *padapter, struct sta_info *psta)
 {
-   _init_timer(&psta->addba_retry_timer, padapter->pnetdev, 
_addba_timer_hdl, psta);
+   _init_timer(&psta->addba_retry_timer, padapter->pnetdev, 
addba_timer_hdl, psta);
 }
 
 void init_mlme_ext_timer(struct adapter *padapter)
-- 
1.7.10.4

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


[PATCH 4/9] staging: rtl8188eu: Remove wrapper function _dynamic_check_timer_handlder()

2014-07-28 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c |   13 -
 drivers/staging/rtl8188eu/include/rtw_mlme.h  |2 +-
 drivers/staging/rtl8188eu/os_dep/mlme_linux.c |   12 +---
 3 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index d5b2f51..149c271 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1431,24 +1431,27 @@ static void rtw_auto_scan_handler(struct adapter 
*padapter)
}
 }
 
-void rtw_dynamic_check_timer_handlder(struct adapter *adapter)
+void rtw_dynamic_check_timer_handlder(void *function_context)
 {
+   struct adapter *adapter = (struct adapter *)function_context;
struct registry_priv *pregistrypriv = &adapter->registrypriv;
 
if (!adapter)
-   return;
+   goto exit;
if (!adapter->hw_init_completed)
-   return;
+   goto exit;
if ((adapter->bDriverStopped) || (adapter->bSurpriseRemoved))
-   return;
+   goto exit;
if (adapter->net_closed)
-   return;
+   goto exit;
rtw_dynamic_chk_wk_cmd(adapter);
 
if (pregistrypriv->wifi_spec == 1) {
/* auto site survey */
rtw_auto_scan_handler(adapter);
}
+exit:
+   _set_timer(&adapter->mlmepriv.dynamic_chk_timer, 2000);
 }
 
 #define RTW_SCAN_RESULT_EXPIRE 2000
diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme.h 
b/drivers/staging/rtl8188eu/include/rtw_mlme.h
index 8f5457b..8d83f7c 100644
--- a/drivers/staging/rtl8188eu/include/rtw_mlme.h
+++ b/drivers/staging/rtl8188eu/include/rtw_mlme.h
@@ -554,7 +554,7 @@ void rtw_get_encrypt_decrypt_from_registrypriv(struct 
adapter *adapter);
 void _rtw_join_timeout_handler(void *function_context);
 void rtw_scan_timeout_handler(void *function_context);
 
-void rtw_dynamic_check_timer_handlder(struct adapter *adapter);
+void rtw_dynamic_check_timer_handlder(void *function_context);
 #define rtw_is_scan_deny(adapter) false
 #define rtw_clear_scan_deny(adapter) do {} while (0)
 #define rtw_set_scan_deny_timer_hdl(adapter) do {} while (0)
diff --git a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c 
b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
index 0bfaa78..82b71fa 100644
--- a/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/mlme_linux.c
@@ -25,23 +25,13 @@
 #include 
 #include 
 
-static void _dynamic_check_timer_handlder(void *FunctionContext)
-{
-   struct adapter *adapter = (struct adapter *)FunctionContext;
-
-   if (adapter->registrypriv.mp_mode == 1)
-   return;
-   rtw_dynamic_check_timer_handlder(adapter);
-   _set_timer(&adapter->mlmepriv.dynamic_chk_timer, 2000);
-}
-
 void rtw_init_mlme_timer(struct adapter *padapter)
 {
struct  mlme_priv *pmlmepriv = &padapter->mlmepriv;
 
_init_timer(&(pmlmepriv->assoc_timer), padapter->pnetdev, 
_rtw_join_timeout_handler, padapter);
_init_timer(&(pmlmepriv->scan_to_timer), padapter->pnetdev, 
rtw_scan_timeout_handler, padapter);
-   _init_timer(&(pmlmepriv->dynamic_chk_timer), padapter->pnetdev, 
_dynamic_check_timer_handlder, padapter);
+   _init_timer(&(pmlmepriv->dynamic_chk_timer), padapter->pnetdev, 
rtw_dynamic_check_timer_handlder, padapter);
 }
 
 void rtw_os_indicate_connect(struct adapter *adapter)
-- 
1.7.10.4

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


RE: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-28 Thread KY Srinivasan


> -Original Message-
> From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
> Sent: Saturday, July 26, 2014 12:25 PM
> To: KY Srinivasan
> Cc: Martin K. Petersen; Sitsofe Wheeler; Christoph Hellwig;
> gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
> de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
> jasow...@redhat.com; jbottom...@parallels.com; linux-
> s...@vger.kernel.org
> Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
> 
> > "KY" == KY Srinivasan  writes:
> 
> >> Great! I'd just like to have a reasonable level of confidence in
> >> what's happening down the stack before I entertain turning something
> >> on that's not being properly advertised.
> 
> KY> As I look at the output of inquiry between Linux on Hyper-V and
> KY> native Linux, is not specifying conformance level the main issue?
> 
> The main problem for this particular use case (aside from the issue we've
> already addressed) is that the passthrough device (SATA SSD) has
> LBPME=0 in the READ CAPACITY(16) response. The LBP VPD is correctly
> provided with LBPU flag set but because LBPME is reported as disabled we
> will not attempt to issue UNMAP commands to the device.

Had a chance to chat with the Windows sscsi folks. Here is their response:

"At the time  thin-provisioning was defined, the discovery information was 
first proposed in READ CAPACITY 16 command. And then moved into the new 
dedicated VPD page - B2h. You can see the information reported in this VPD page 
is richer than READ CAPACITY 16 command. As this transition happened during we 
added the feature, Windows uses the newer method that based on VPD page B2h. It 
looks Linux tries to use both new and old method which is weird to me."

Would it make sense for us to work  around this issue for Linux on Hyper-V 
(just use the VPD page instead of looking at the output of READ CAPACITY)?

Regards,

K. Y
> 
> --
> Martin K. PetersenOracle Linux Engineering
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-28 Thread Martin K. Petersen
> "KY" == KY Srinivasan  writes:

KY,

KY> "At the time thin-provisioning was defined, the discovery
KY> information was first proposed in READ CAPACITY 16 command. And then
KY> moved into the new dedicated VPD page - B2h. You can see the
KY> information reported in this VPD page is richer than READ CAPACITY
KY> 16 command. As this transition happened during we added the feature,
KY> Windows uses the newer method that based on VPD page B2h. It looks
KY> Linux tries to use both new and old method which is weird to me."

The READ CAPACITY(16) response is not optional.

SBC3r36 section 4.7.3.3 Thin provisioned logical unit:

The device server in a thin provisioned logical unit shall set:

a) the LBPME bit to one in the READ CAPACITY (16) parameter data (see
   5.16.2); and

b) the PROVISIONING TYPE field to 010b (i.e., thin provisioned) in the
   Logical Block Provisioning VPD page (see 6.6.4).

That's a "shall". The LBP VPD elaborates on the provisioning type,
commands preference, etc. But it's all gated by LBPME=1 in the READ
CAPACITY(16) response.

-- 
Martin K. Petersen  Oracle Linux Engineering
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-28 Thread KY Srinivasan


> -Original Message-
> From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
> Sent: Monday, July 28, 2014 12:03 PM
> To: KY Srinivasan
> Cc: Martin K. Petersen; Sitsofe Wheeler; Christoph Hellwig;
> gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
> de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
> jasow...@redhat.com; jbottom...@parallels.com; linux-
> s...@vger.kernel.org
> Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
> 
> > "KY" == KY Srinivasan  writes:
> 
> KY,
> 
> KY> "At the time thin-provisioning was defined, the discovery
> KY> information was first proposed in READ CAPACITY 16 command. And
> then
> KY> moved into the new dedicated VPD page - B2h. You can see the
> KY> information reported in this VPD page is richer than READ CAPACITY
> KY> 16 command. As this transition happened during we added the feature,
> KY> Windows uses the newer method that based on VPD page B2h. It looks
> KY> Linux tries to use both new and old method which is weird to me."
> 
> The READ CAPACITY(16) response is not optional.

Ok; that settles the issue then. I will attempt to get it fixed on Windows.

K. Y

> 
> --
> Martin K. PetersenOracle Linux Engineering
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-28 Thread James Bottomley
On Mon, 2014-07-28 at 19:05 +, KY Srinivasan wrote:
> 
> > -Original Message-
> > From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
> > Sent: Monday, July 28, 2014 12:03 PM
> > To: KY Srinivasan
> > Cc: Martin K. Petersen; Sitsofe Wheeler; Christoph Hellwig;
> > gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
> > de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
> > jasow...@redhat.com; jbottom...@parallels.com; linux-
> > s...@vger.kernel.org
> > Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
> > 
> > > "KY" == KY Srinivasan  writes:
> > 
> > KY,
> > 
> > KY> "At the time thin-provisioning was defined, the discovery
> > KY> information was first proposed in READ CAPACITY 16 command. And
> > then
> > KY> moved into the new dedicated VPD page - B2h. You can see the
> > KY> information reported in this VPD page is richer than READ CAPACITY
> > KY> 16 command. As this transition happened during we added the feature,
> > KY> Windows uses the newer method that based on VPD page B2h. It looks
> > KY> Linux tries to use both new and old method which is weird to me."
> > 
> > The READ CAPACITY(16) response is not optional.
> 
> Ok; that settles the issue then. I will attempt to get it fixed on Windows.

Like Martin says, this isn't optional either/or; it's mandatory to
support the RC 16 bits.  If you don't want to get into playing the
messenger between us and the windows guys on SCSI standards, we'd be
happy to communicate directly, either by email or a phone meeting.

James

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


RE: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests

2014-07-28 Thread KY Srinivasan


> -Original Message-
> From: James Bottomley [mailto:jbottom...@parallels.com]
> Sent: Monday, July 28, 2014 1:03 PM
> To: KY Srinivasan
> Cc: linux-ker...@vger.kernel.org; h...@infradead.org; sits...@gmail.com;
> de...@linuxdriverproject.org; a...@canonical.com;
> martin.peter...@oracle.com; linux-s...@vger.kernel.org;
> oher...@suse.com; gre...@linuxfoundation.org; jasow...@redhat.com
> Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks tests
> 
> On Mon, 2014-07-28 at 19:05 +, KY Srinivasan wrote:
> >
> > > -Original Message-
> > > From: Martin K. Petersen [mailto:martin.peter...@oracle.com]
> > > Sent: Monday, July 28, 2014 12:03 PM
> > > To: KY Srinivasan
> > > Cc: Martin K. Petersen; Sitsofe Wheeler; Christoph Hellwig;
> > > gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
> > > de...@linuxdriverproject.org; oher...@suse.com; a...@canonical.com;
> > > jasow...@redhat.com; jbottom...@parallels.com; linux-
> > > s...@vger.kernel.org
> > > Subject: Re: [PATCH v2 3/3] [SCSI] Make LBP quirk skip lbpme checks
> > > tests
> > >
> > > > "KY" == KY Srinivasan  writes:
> > >
> > > KY,
> > >
> > > KY> "At the time thin-provisioning was defined, the discovery
> > > KY> information was first proposed in READ CAPACITY 16 command. And
> > > then
> > > KY> moved into the new dedicated VPD page - B2h. You can see the
> > > KY> information reported in this VPD page is richer than READ
> > > KY> CAPACITY
> > > KY> 16 command. As this transition happened during we added the
> > > KY> feature, Windows uses the newer method that based on VPD page
> > > KY> B2h. It looks Linux tries to use both new and old method which is
> weird to me."
> > >
> > > The READ CAPACITY(16) response is not optional.
> >
> > Ok; that settles the issue then. I will attempt to get it fixed on Windows.
> 
> Like Martin says, this isn't optional either/or; it's mandatory to support 
> the RC
> 16 bits.  If you don't want to get into playing the messenger between us and
> the windows guys on SCSI standards, we'd be happy to communicate
> directly, either by email or a phone meeting.

Thanks James. I will take up your offer if needed.

Regards,

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


[PATCH] Staging: android: Missing a blank line after declarations in sw_sync.c This is a patch to the sw_sync.c file that fixes up a missing a blank warning found by the checkpatch.pl tool

2014-07-28 Thread adrianremonda
From: Adrian Remonda 


Signed-off-by: Adrian Remonda 
---
 drivers/staging/android/sw_sync.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
index a76db3ff87cb..863d4b17387a 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -97,6 +97,7 @@ static void sw_sync_pt_value_str(struct sync_pt *sync_pt,
   char *str, int size)
 {
struct sw_sync_pt *pt = (struct sw_sync_pt *)sync_pt;
+
snprintf(str, size, "%d", pt->value);
 }
 
@@ -156,6 +157,7 @@ static int sw_sync_open(struct inode *inode, struct file 
*file)
 static int sw_sync_release(struct inode *inode, struct file *file)
 {
struct sw_sync_timeline *obj = file->private_data;
+
sync_timeline_destroy(&obj->obj);
return 0;
 }
-- 
1.7.10.4

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


[PATCH] Staging: android: sw_sync.c: fix missing blank line after declaration

2014-07-28 Thread Murilo Opsfelder Araujo
Fix coding style issue.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/android/sw_sync.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
index a76db3f..863d4b1 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -97,6 +97,7 @@ static void sw_sync_pt_value_str(struct sync_pt *sync_pt,
   char *str, int size)
 {
struct sw_sync_pt *pt = (struct sw_sync_pt *)sync_pt;
+
snprintf(str, size, "%d", pt->value);
 }
 
@@ -156,6 +157,7 @@ static int sw_sync_open(struct inode *inode, struct file 
*file)
 static int sw_sync_release(struct inode *inode, struct file *file)
 {
struct sw_sync_timeline *obj = file->private_data;
+
sync_timeline_destroy(&obj->obj);
return 0;
 }
-- 
1.7.10.4

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


[PATCH] Staging: android: sync.c: fix missing blank line after declaration

2014-07-28 Thread Murilo Opsfelder Araujo
Fix coding style issue.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/android/sync.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index e7b2e02..69c16cb 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -705,6 +705,7 @@ static long sync_fence_ioctl(struct file *file, unsigned 
int cmd,
 unsigned long arg)
 {
struct sync_fence *fence = file->private_data;
+
switch (cmd) {
case SYNC_IOC_WAIT:
return sync_fence_ioctl_wait(fence, arg);
@@ -726,4 +727,3 @@ static const struct file_operations sync_fence_fops = {
.unlocked_ioctl = sync_fence_ioctl,
.compat_ioctl = sync_fence_ioctl,
 };
-
-- 
1.7.10.4

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


[PATCH] Staging: android: timed_gpio.c: remove else statement after return

2014-07-28 Thread Murilo Opsfelder Araujo
This patch makes checkpatch.pl script happy by fixing the following
warning:

WARNING: else is not generally useful after a break or return

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/android/timed_gpio.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/timed_gpio.c 
b/drivers/staging/android/timed_gpio.c
index 180c209..05cb578 100644
--- a/drivers/staging/android/timed_gpio.c
+++ b/drivers/staging/android/timed_gpio.c
@@ -53,8 +53,9 @@ static int gpio_get_time(struct timed_output_dev *dev)
struct timeval t = ktime_to_timeval(r);
 
return t.tv_sec * 1000 + t.tv_usec / 1000;
-   } else
-   return 0;
+   }
+
+   return 0;
 }
 
 static void gpio_enable(struct timed_output_dev *dev, int value)
-- 
1.7.10.4

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


[PATCH] Staging: android: timed_output.c: use kstrtoint() instead of sscanf()

2014-07-28 Thread Murilo Opsfelder Araujo
This patch makes checkpatch.pl happy by fixing the following warning:

WARNING: Prefer kstrto to single variable sscanf

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/android/timed_output.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/timed_output.c 
b/drivers/staging/android/timed_output.c
index c341ac1..b41429f 100644
--- a/drivers/staging/android/timed_output.c
+++ b/drivers/staging/android/timed_output.c
@@ -41,8 +41,10 @@ static ssize_t enable_store(struct device *dev, struct 
device_attribute *attr,
 {
struct timed_output_dev *tdev = dev_get_drvdata(dev);
int value;
+   int rc;
 
-   if (sscanf(buf, "%d", &value) != 1)
+   rc = kstrtoint(buf, 0, &value);
+   if (rc != 0)
return -EINVAL;
 
tdev->enable(tdev, value);
-- 
1.7.10.4

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


[PATCH] Staging: bcm: Bcmchar.c: remove else statement after return

2014-07-28 Thread Murilo Opsfelder Araujo
This patch makes checkpatch.pl script happier by fixing all warnings
related to else statement after break or return.

Signed-off-by: Murilo Opsfelder Araujo 
---
 drivers/staging/bcm/Bcmchar.c |   21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index c1e01f7..5790627 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -561,10 +561,10 @@ static int bcm_char_ioctl_gpio_set_request(void __user 
*argp,
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
"GPIO_MODE_REGISTER read failed");
return Status;
-   } else {
-   Status = STATUS_SUCCESS;
}
 
+   Status = STATUS_SUCCESS;
+
/* Set the gpio mode register to output */
*(UINT *)ucResetValue |= (1NVMRdmWrmLock);
return Status;
-   } else {
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
-   DBG_LVL_ALL, "Firm Download Over...\n");
}
 
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG,
+   DBG_LVL_ALL, "Firm Download Over...\n");
+
mdelay(10);
 
/* Wait for MailBox Interrupt */
@@ -2649,4 +2649,3 @@ void unregister_control_device_interface(struct 
bcm_mini_adapter *Adapter)
unregister_chrdev(Adapter->major, DEV_NAME);
}
 }
-
-- 
1.7.10.4

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


Re: [PATCH] Staging: bcm: Bcmchar.c: remove else statement after return

2014-07-28 Thread Joe Perches
On Mon, 2014-07-28 at 21:09 -0300, Murilo Opsfelder Araujo wrote:
> This patch makes checkpatch.pl script happier by fixing all warnings
> related to else statement after break or return.
[]
> diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
[]
> @@ -561,10 +561,10 @@ static int bcm_char_ioctl_gpio_set_request(void __user 
> *argp,
>   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
>   "GPIO_MODE_REGISTER read failed");
>   return Status;
> - } else {
> - Status = STATUS_SUCCESS;
>   }
>  
> + Status = STATUS_SUCCESS;

This set of Status is unnecessary

>   /* Set the gpio mode register to output */
>   *(UINT *)ucResetValue |= (1<   Status = wrmaltWithLock(Adapter, GPIO_MODE_REGISTER,

as it's immediately overwritten.

> @@ -669,10 +669,10 @@ static int bcm_char_ioctl_gpio_status_request(void 
> __user *argp,
>   Status = bytes;
>   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
>   "RDM Failed\n");
> - return Status;
>   } else {
>   Status = STATUS_SUCCESS;
>   }
> +
>   return Status;

return STATUS_SUCCESS;

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


Re: [PATCH] Staging: android: timed_gpio.c: remove else statement after return

2014-07-28 Thread Joe Perches
On Mon, 2014-07-28 at 20:11 -0300, Murilo Opsfelder Araujo wrote:
> This patch makes checkpatch.pl script happy by fixing the following
> warning:
> 
> WARNING: else is not generally useful after a break or return
> 
> Signed-off-by: Murilo Opsfelder Araujo 
> ---
>  drivers/staging/android/timed_gpio.c |5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/android/timed_gpio.c 
> b/drivers/staging/android/timed_gpio.c
> index 180c209..05cb578 100644
> --- a/drivers/staging/android/timed_gpio.c
> +++ b/drivers/staging/android/timed_gpio.c
> @@ -53,8 +53,9 @@ static int gpio_get_time(struct timed_output_dev *dev)
>   struct timeval t = ktime_to_timeval(r);
>  
>   return t.tv_sec * 1000 + t.tv_usec / 1000;
> - } else
> - return 0;
> + }
> +
> + return 0;
>  }

It may be better to reverse the logic here.
Something like:

 drivers/staging/android/timed_gpio.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/android/timed_gpio.c 
b/drivers/staging/android/timed_gpio.c
index 180c209..8fa4758 100644
--- a/drivers/staging/android/timed_gpio.c
+++ b/drivers/staging/android/timed_gpio.c
@@ -45,16 +45,17 @@ static enum hrtimer_restart gpio_timer_func(struct hrtimer 
*timer)
 
 static int gpio_get_time(struct timed_output_dev *dev)
 {
-   struct timed_gpio_data  *data =
-   container_of(dev, struct timed_gpio_data, dev);
+   struct timed_gpio_data *data;
+   struct timeval t;
 
-   if (hrtimer_active(&data->timer)) {
-   ktime_t r = hrtimer_get_remaining(&data->timer);
-   struct timeval t = ktime_to_timeval(r);
+   data = container_of(dev, struct timed_gpio_data, dev);
 
-   return t.tv_sec * 1000 + t.tv_usec / 1000;
-   } else
+   if (!hrtimer_active(&data->timer))
return 0;
+
+   t = ktime_to_timeval(hrtimer_get_remaining(&data->timer));
+
+   return t.tv_sec * 1000 + t.tv_usec / 1000;
 }
 
 static void gpio_enable(struct timed_output_dev *dev, int value)



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