Re: [PATCH 1/2] mfd: rtsx: fix PM suspend for 5227

2014-09-12 Thread Dan Carpenter
On Thu, Sep 11, 2014 at 10:42:49AM +0300, Dan Carpenter wrote:
> On Thu, Sep 11, 2014 at 03:17:52PM +0800, micky_ch...@realsil.com.cn wrote:
> > +   err = pci_read_config_byte(pcr->pci, addr, &val);
> > +   if (err)
> > +   return err;
> 
> Some of these check for "if (err) " and some check for "if (err < 0) ".
> What is the significance of that?  I'm a newbie here.  Did you mean for
> them to be different?

You've updated them all to be "if (err < 0)" how is that different from
"if (err)"?  What I'm saying is that could you reply to the question?

I guess I normally prefer "if (err)" over "if (err < 0)" but I don't
know if it makes a difference here?

regards,
dan carpenter
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] mfd: rtsx: fix PM suspend for 5227

2014-09-12 Thread micky

On 09/12/2014 04:36 PM, Dan Carpenter wrote:

You've updated them all to be "if (err < 0)" how is that different from
"if (err)"?  What I'm saying is that could you reply to the question?

I guess I normally prefer "if (err)" over "if (err < 0)" but I don't
know if it makes a difference here?

Hi Dan,

these function never return positive value, but other part of the driver 
code

use (err < 0), I use (err < 0) here for consistency.

(err) and (err < 0) is same at least for these function called here.

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


[PATCH 2/3] staging: comedi: adl_pci9118: don't overallocate DMA buffer

2014-09-12 Thread Ian Abbott
The last parameter of `__get_free_pages()` is log2 (the 'order') of the
number of pages to be allocated.  This driver seems to think it is the
linear number of pages, so `pci9118_alloc_dma()` first tries to allocate
16 pages, but only uses 4 of them, setting the buffer size to PAGE_SIZE
multiplied by the 'order'.  If the allocation fails, it tries
progressively smaller orders, down to 0.  If the allocation at order 0
succeeds, the buffer size is set to 0, which is likely to cause
problems.

Set the buffer size to `PAGE_SIZE` shifted left by the allocation order.
Since the maximum buffer size previously used was 4, start with an
allocation order of 2 instead of 4.  Rename the `pages` member of
`struct pci9118_dmabuf` (and the local variable in
`pci9118_alloc_dma()`) to `order` to make it clearer what it is.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 1169104..6ab9e0a 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -208,7 +208,7 @@ struct pci9118_dmabuf {
unsigned long hw;   /* hardware (bus) address of buffer */
unsigned int size;  /* size of dma buffer in bytes */
unsigned int use_size;  /* which size we may now use for transfer */
-   int pages;  /* number of pages in buffer */
+   int order;  /* log2 number of pages in buffer */
 };
 
 struct pci9118_private {
@@ -1479,20 +1479,20 @@ static void pci9118_alloc_dma(struct comedi_device *dev)
 {
struct pci9118_private *devpriv = dev->private;
struct pci9118_dmabuf *dmabuf;
-   int pages;
+   int order;
int i;
 
for (i = 0; i < 2; i++) {
dmabuf = &devpriv->dmabuf[i];
-   for (pages = 4; pages >= 0; pages--) {
-   dmabuf->virt = __get_free_pages(GFP_KERNEL, pages);
+   for (order = 2; order >= 0; order--) {
+   dmabuf->virt = __get_free_pages(GFP_KERNEL, order);
if (dmabuf->virt)
break;
}
if (!dmabuf->virt)
break;
-   dmabuf->pages = pages;
-   dmabuf->size = PAGE_SIZE * pages;
+   dmabuf->order = order;
+   dmabuf->size = PAGE_SIZE << order;
dmabuf->hw = virt_to_bus((void *)dmabuf->virt);
 
if (i == 0)
@@ -1514,7 +1514,7 @@ static void pci9118_free_dma(struct comedi_device *dev)
for (i = 0; i < 2; i++) {
dmabuf = &devpriv->dmabuf[i];
if (dmabuf->virt)
-   free_pages(dmabuf->virt, dmabuf->pages);
+   free_pages(dmabuf->virt, dmabuf->order);
}
 }
 
-- 
2.1.0

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


[PATCH 0/3] staging: comedi: adl_pci9118: redo DMA buffer allocation

2014-09-12 Thread Ian Abbott
"adl_pci9118" allocates more pages of DMA buffer than it uses, may
allocate half a double-buffer it does not use because it's the "wrong"
half that it managed to allocate (unlikely), and relies on virt_to_bus()
to treat generic kernel memory from get_free_pages() as coherent DMA
memory.  Correct the issues, using dma_alloc_coherent() to allocate the
DMA buffers.

1) staging: comedi: adl_pci9118: don't allocate 2nd DMA buffer on
   failure
2) staging: comedi: adl_pci9118: don't overallocate DMA buffer
3) staging: comedi: adl_pci9118: use dma_alloc_coherent()

 drivers/staging/comedi/Kconfig   |  2 +-
 drivers/staging/comedi/drivers/adl_pci9118.c | 40 ++--
 2 files changed, 21 insertions(+), 21 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/3] staging: comedi: adl_pci9118: don't allocate 2nd DMA buffer on failure

2014-09-12 Thread Ian Abbott
`pci9118_alloc_dma()` tries to allocate two DMA buffers but may allocate
a single buffer or none at all.  If it fails to allocate the first
buffer, it still tries to allocate the second buffer, even though it
won't be used.  Change it to not bother trying to allocate the second
buffer if the first one fails.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/adl_pci9118.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 8d3f813..1169104 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -1489,16 +1489,16 @@ static void pci9118_alloc_dma(struct comedi_device *dev)
if (dmabuf->virt)
break;
}
-   if (dmabuf->virt) {
-   dmabuf->pages = pages;
-   dmabuf->size = PAGE_SIZE * pages;
-   dmabuf->hw = virt_to_bus((void *)dmabuf->virt);
-
-   if (i == 0)
-   devpriv->master = 1;
-   if (i == 1)
-   devpriv->dma_doublebuf = 1;
-   }
+   if (!dmabuf->virt)
+   break;
+   dmabuf->pages = pages;
+   dmabuf->size = PAGE_SIZE * pages;
+   dmabuf->hw = virt_to_bus((void *)dmabuf->virt);
+
+   if (i == 0)
+   devpriv->master = 1;
+   if (i == 1)
+   devpriv->dma_doublebuf = 1;
}
 }
 
-- 
2.1.0

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


[PATCH 3/3] staging: comedi: adl_pci9118: use dma_alloc_coherent()

2014-09-12 Thread Ian Abbott
Use `dma_alloc_coherent()` to allocate the DMA buffers instead of
using `__get_free_pages()` to allocate and `virt_to_bus()` to get the
hardware address.  The coherent buffers are fairly small - at most 4
pages (although there are two of them).  Use of `virt_to_bus()` is
discouraged.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/Kconfig   |  2 +-
 drivers/staging/comedi/drivers/adl_pci9118.c | 20 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index fd5f939..9eaffd4 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -740,7 +740,7 @@ config COMEDI_ADL_PCI9111
 config COMEDI_ADL_PCI9118
tristate "ADLink PCI-9118DG, PCI-9118HG, PCI-9118HR support"
select COMEDI_FC
-   depends on VIRT_TO_BUS
+   depends on HAS_DMA
---help---
  Enable support for ADlink PCI-9118DG, PCI-9118HG, PCI-9118HR cards
 
diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 6ab9e0a..e18fd95 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -204,11 +204,10 @@ static const struct pci9118_boardinfo pci9118_boards[] = {
 };
 
 struct pci9118_dmabuf {
-   unsigned long virt; /* virtual address of buffer */
-   unsigned long hw;   /* hardware (bus) address of buffer */
+   unsigned short *virt;   /* virtual address of buffer */
+   dma_addr_t hw;  /* hardware (bus) address of buffer */
unsigned int size;  /* size of dma buffer in bytes */
unsigned int use_size;  /* which size we may now use for transfer */
-   int order;  /* log2 number of pages in buffer */
 };
 
 struct pci9118_private {
@@ -475,12 +474,11 @@ static unsigned int defragment_dma_buffer(struct 
comedi_device *dev,
 
 static int move_block_from_dma(struct comedi_device *dev,
   struct comedi_subdevice *s,
-  unsigned long virt_addr,
+  unsigned short *dma_buffer,
   unsigned int num_samples)
 {
struct pci9118_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
-   unsigned short *dma_buffer = (unsigned short *)virt_addr;
unsigned int num_bytes;
 
num_samples = defragment_dma_buffer(dev, s, dma_buffer, num_samples);
@@ -1485,15 +1483,15 @@ static void pci9118_alloc_dma(struct comedi_device *dev)
for (i = 0; i < 2; i++) {
dmabuf = &devpriv->dmabuf[i];
for (order = 2; order >= 0; order--) {
-   dmabuf->virt = __get_free_pages(GFP_KERNEL, order);
+   dmabuf->virt =
+   dma_alloc_coherent(dev->hw_dev, PAGE_SIZE << order,
+  &dmabuf->hw, GFP_KERNEL);
if (dmabuf->virt)
break;
}
if (!dmabuf->virt)
break;
-   dmabuf->order = order;
dmabuf->size = PAGE_SIZE << order;
-   dmabuf->hw = virt_to_bus((void *)dmabuf->virt);
 
if (i == 0)
devpriv->master = 1;
@@ -1513,8 +1511,10 @@ static void pci9118_free_dma(struct comedi_device *dev)
 
for (i = 0; i < 2; i++) {
dmabuf = &devpriv->dmabuf[i];
-   if (dmabuf->virt)
-   free_pages(dmabuf->virt, dmabuf->order);
+   if (dmabuf->virt) {
+   dma_free_coherent(dev->hw_dev, dmabuf->size,
+ dmabuf->virt, dmabuf->hw);
+   }
}
 }
 
-- 
2.1.0

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


[PATCH] staging: comedi: remove comedi_board()

2014-09-12 Thread Ian Abbott
All calls to the inline function `comedi_board()` in "comedidev.h" have
been removed, so remove the function.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/comedidev.h | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/comedi/comedidev.h 
b/drivers/staging/comedi/comedidev.h
index bda5304..7f4d7e5 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -269,11 +269,6 @@ struct comedi_device {
void (*close)(struct comedi_device *dev);
 };
 
-static inline const void *comedi_board(const struct comedi_device *dev)
-{
-   return dev->board_ptr;
-}
-
 /*
  * function prototypes
  */
-- 
2.1.0

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


Re: [PATCH 00/25] staging: comedi: tidy up async command termination

2014-09-12 Thread Ian Abbott

On 2014-09-12 00:07, H Hartley Sweeten wrote:

The comedi async commands should stop if an error/overflow happens or when
the end-of-acquisition for the command is detected. Some of the drivers
do this correctly but many don't.

The cfc_handle_events() function automatically detects the events that would
terminate a command. If the events are set it calls the subdevice (*cancel)
operation to stop the command.

Convert all the drivers that still use comedi_event() to use cfc_handle_events()
instead. This allows removing the unnecessary cancel in the driver, if present,
and ensures that all the drivers terminate the commands if necessary.

The only drivers that still use comedi_event() directly are the usbdux drivers.
These have a "cancel" in the urb completion routines that does not do what the
(*cancel) does. I'm waiting for a reply from the author to see if this can
be changed.

H Hartley Sweeten (25):
   staging: comedi: hwdrv_apci3120: use cfc_handle_events()
   staging: comedi: hwdrv_apci3120: do cfc_handle_events() at end of interrupt
   staging: comedi: hwdrv_apci3200: use cfc_handle_events()
   staging: comedi: addi_apci_1032: use cfc_handle_events()
   staging: comedi: addi_apci_1564: use cfc_handle_events()
   staging: comedi: addi_apci_2032: use cfc_handle_events()
   staging: comedi: addi_apci_3xxx: use cfc_handle_events()
   staging: comedi: amplc_dio200_common: use cfc_handle_events()
   staging: comedi: amplc_pc2360_common: use cfc_handle_events()
   staging: comedi: comedi_parport: use cfc_handle_events()
   staging: comedi: comedi_test: use cfc_handle_events()
   staging: comedi: dmm32at: use cfc_handle_events()
   staging: comedi: dt2814: use cfc_handle_events()
   staging: comedi: me4000: use cfc_handle_events()
   staging: comedi: ni_6527: use cfc_handle_events()
   staging: comedi: ni_65xx: use cfc_handle_events()
   staging: comedi: ni_atmio16d: use cfc_handle_events()
   staging: comedi: pcl711: use cfc_handle_events()
   staging: comedi: pcl726: use cfc_handle_events()
   staging: comedi: pcmmio: use cfc_handle_events()
   staging: comedi: pcmuio: use cfc_handle_events()
   staging: comedi: s626: use cfc_handle_events()
   staging: comedi: rtd520: clear FIFO when canceling async command
   staging: comedi: rtd520: use cfc_handle_events()
   staging: comedi: amplc_pci230: use cfc_handle_events()

  .../comedi/drivers/addi-data/hwdrv_apci3120.c  | 15 +-
  .../comedi/drivers/addi-data/hwdrv_apci3200.c  |  3 +-
  drivers/staging/comedi/drivers/addi_apci_1032.c|  2 +-
  drivers/staging/comedi/drivers/addi_apci_1564.c|  2 +-
  drivers/staging/comedi/drivers/addi_apci_2032.c|  8 +---
  drivers/staging/comedi/drivers/addi_apci_3xxx.c|  2 +-
  .../staging/comedi/drivers/amplc_dio200_common.c   | 10 +---
  .../staging/comedi/drivers/amplc_pc236_common.c|  2 +-
  drivers/staging/comedi/drivers/amplc_pci230.c  | 48 +++
  drivers/staging/comedi/drivers/comedi_parport.c|  2 +-
  drivers/staging/comedi/drivers/comedi_test.c   |  7 +--
  drivers/staging/comedi/drivers/dmm32at.c   |  3 +-
  drivers/staging/comedi/drivers/dt2814.c|  2 +-
  drivers/staging/comedi/drivers/me4000.c|  3 +-
  drivers/staging/comedi/drivers/ni_6527.c   |  2 +-
  drivers/staging/comedi/drivers/ni_65xx.c   |  2 +-
  drivers/staging/comedi/drivers/ni_atmio16d.c   |  2 +-
  drivers/staging/comedi/drivers/pcl711.c|  6 +--
  drivers/staging/comedi/drivers/pcl726.c|  2 +-
  drivers/staging/comedi/drivers/pcmmio.c| 16 ++-
  drivers/staging/comedi/drivers/pcmuio.c| 16 ++-
  drivers/staging/comedi/drivers/rtd520.c| 56 +++---
  drivers/staging/comedi/drivers/s626.c  | 14 +-
  23 files changed, 57 insertions(+), 168 deletions(-)



Several of these patches require changes to Kconfig to make the driver 
options select COMEDI_FC.  I was toying with the idea of merging the 
comedi_fc module into the core comedi module anyway, at which point 
those Kconfig changes would be moot.


Also, all the descriptions have a typo: cfc_handler_events() should be 
cfc_handle_events().


Also, the summary line for patch 15 says amplc_pc2360_common instead of 
amplc_pc236_common.


--
-=( 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


[PATCH] staging: unisys: Fix sparse error - accessing __iomem directly

2014-09-12 Thread Luke Hart
Copy the channel type into a temporary buffer so that code will work
for architectures that don't support MMIO. This now works in same way
as other tests in same function.

Signed-off-by: Luke Hart 
---
 drivers/staging/unisys/common-spar/include/channels/channel.h | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/common-spar/include/channels/channel.h 
b/drivers/staging/unisys/common-spar/include/channels/channel.h
index 2004cfe..5ba5e56 100644
--- a/drivers/staging/unisys/common-spar/include/channels/channel.h
+++ b/drivers/staging/unisys/common-spar/include/channels/channel.h
@@ -347,10 +347,13 @@ ULTRA_check_channel_client(void __iomem *pChannel,
   u64 expectedSignature,
   char *fileName, int lineNumber, void *logCtx)
 {
-   if (uuid_le_cmp(expectedTypeGuid, NULL_UUID_LE) != 0)
+   if (uuid_le_cmp(expectedTypeGuid, NULL_UUID_LE) != 0) {
+   uuid_le guid;
+
+   ioread8_rep(&((CHANNEL_HEADER __iomem *)(pChannel))->Type,
+   &guid, sizeof(guid));
/* caller wants us to verify type GUID */
-   if (uuid_le_cmpCHANNEL_HEADER __iomem *)(pChannel))->Type),
-  expectedTypeGuid) != 0) {
+   if (uuid_le_cmp(guid, expectedTypeGuid) != 0) {
CHANNEL_GUID_MISMATCH(expectedTypeGuid, channelName,
  "type", expectedTypeGuid,
  ((CHANNEL_HEADER __iomem *)
@@ -358,6 +361,7 @@ ULTRA_check_channel_client(void __iomem *pChannel,
  lineNumber, logCtx);
return 0;
}
+   }
if (expectedMinBytes > 0)   /* caller wants us to verify
 * channel size */
if (readq(&((CHANNEL_HEADER __iomem *)
-- 
1.8.5.5

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


Re: [PATCH] staging: unisys: Fix sparse error - accessing __iomem directly

2014-09-12 Thread Luke Hart


On 11/09/2014 22:53, Greg KH wrote:

On Mon, Sep 08, 2014 at 03:27:35PM +0100, Luke Hart wrote:

Copy the channel type into a temporary buffer so that code will work
for architectures that don't support MMIO. This now works in same way
as other tests in same function.

Signed-off-by: Luke Hart 
---
  drivers/staging/unisys/common-spar/include/channels/channel.h | 9 ++---
  1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/common-spar/include/channels/channel.h 
b/drivers/staging/unisys/common-spar/include/channels/channel.h
index 2004cfe..ef24f5a 100644
--- a/drivers/staging/unisys/common-spar/include/channels/channel.h
+++ b/drivers/staging/unisys/common-spar/include/channels/channel.h
@@ -347,10 +347,12 @@ ULTRA_check_channel_client(void __iomem *pChannel,
   u64 expectedSignature,
   char *fileName, int lineNumber, void *logCtx)
  {
-   if (uuid_le_cmp(expectedTypeGuid, NULL_UUID_LE) != 0)
+   if (uuid_le_cmp(expectedTypeGuid, NULL_UUID_LE) != 0) {
+   uuid_le guid;
+
+   ioread8_rep(&((CHANNEL_HEADER __iomem *)(pChannel))->Type,
+   &guid, sizeof(guid));
/* caller wants us to verify type GUID */
-   if (uuid_le_cmpCHANNEL_HEADER __iomem *)(pChannel))->Type),
-  expectedTypeGuid) != 0) {
+   if (uuid_le_cmp(guid, expectedTypeGuid) != 0) {
CHANNEL_GUID_MISMATCH(expectedTypeGuid, channelName,
  "type", expectedTypeGuid,
  ((CHANNEL_HEADER __iomem *)
@@ -358,6 +360,7 @@ ULTRA_check_channel_client(void __iomem *pChannel,
  lineNumber, logCtx);
return 0;
}
+   }
if (expectedMinBytes > 0)/* caller wants us to verify
 * channel size */
if (readq(&((CHANNEL_HEADER __iomem *)

Somehow this patch is corrupted:

checking file drivers/staging/unisys/common-spar/include/channels/channel.h
patch:  malformed patch at line 128: 
((CHANNEL_HEADER __iomem *)

And git doesn't like it:
Applying: staging: unisys: Fix sparse error - accessing __iomem directly
fatal: corrupt patch at line 26
Patch failed at 0001 staging: unisys: Fix sparse error - accessing __iomem 
directly

Can you please fix this up and resend?

thanks,

greg k-h

Sorry about that, corrected patch has been resent.

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


[PATCH 3/4] staging: comedi: addi_apci_3120: use dma_alloc_coherent()

2014-09-12 Thread Ian Abbott
Use `dma_alloc_coherent()` to allocate the DMA buffers instead of
using `__get_free_pages()` to allocate and `virt_to_bus()` to get the
hardware address.  The coherent buffers are fairly small - at most 4
pages (although there are two of them).  Use of `virt_to_bus()` is
discouraged.

Note: `struct addi_private` is used by some other ADDI-DATA drivers as
well, but this is the only one using the affected members.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/Kconfig |  2 +-
 .../staging/comedi/drivers/addi-data/addi_common.h |  3 +--
 drivers/staging/comedi/drivers/addi_apci_3120.c| 26 +++---
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index fd5f939..f21bf6c 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -677,7 +677,7 @@ config COMEDI_ADDI_APCI_2200
 
 config COMEDI_ADDI_APCI_3120
tristate "ADDI-DATA APCI_3120/3001 support"
-   depends on VIRT_TO_BUS
+   depends on HAS_DMA
select COMEDI_FC
---help---
  Enable support for ADDI-DATA APCI_3120/3001 cards
diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h 
b/drivers/staging/comedi/drivers/addi-data/addi_common.h
index 88295e4..e2a3ffe 100644
--- a/drivers/staging/comedi/drivers/addi-data/addi_common.h
+++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h
@@ -107,10 +107,9 @@ struct addi_private {
unsigned char b_DmaDoubleBuffer;/*  we can use double buffering 
*/
unsigned int ui_DmaActualBuffer;/*  which buffer is used now */
unsigned short *ul_DmaBufferVirtual[2]; /*  pointers to DMA buffer */
-   unsigned int ul_DmaBufferHw[2]; /*  hw address of DMA buff */
+   dma_addr_t ul_DmaBufferHw[2];   /*  hw address of DMA buff */
unsigned int ui_DmaBufferSize[2];   /*  size of dma buffer in bytes 
*/
unsigned int ui_DmaBufferUsesize[2];/*  which size we may now used 
for transfer */
-   unsigned int ui_DmaBufferPageOrder[2];  /*  log2 of pages in buffer */
unsigned char b_DigitalOutputRegister;  /*  Digital Output Register */
unsigned char b_OutputMemoryStatus;
unsigned char b_TimerSelectMode;/*  Contain data written at 
iobase + 0C */
diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c 
b/drivers/staging/comedi/drivers/addi_apci_3120.c
index 57c36ed..1025541 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3120.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3120.c
@@ -95,17 +95,16 @@ static int apci3120_auto_attach(struct comedi_device *dev,
for (i = 0; i < 2; i++) {
for (order = 2; order >= 0; order--) {
devpriv->ul_DmaBufferVirtual[i] =
-   (void *)__get_free_pages(GFP_KERNEL, order);
+   dma_alloc_coherent(dev->hw_dev, PAGE_SIZE << order,
+  &devpriv->ul_DmaBufferHw[i],
+  GFP_KERNEL);
 
if (devpriv->ul_DmaBufferVirtual[i])
break;
}
if (!devpriv->ul_DmaBufferVirtual[i])
break;
-   devpriv->ui_DmaBufferPageOrder[i] = order;
devpriv->ui_DmaBufferSize[i] = PAGE_SIZE << order;
-   devpriv->ul_DmaBufferHw[i] =
-   virt_to_bus(devpriv->ul_DmaBufferVirtual[i]);
}
if (!devpriv->ul_DmaBufferVirtual[0])
devpriv->us_UseDma = 0;
@@ -198,15 +197,16 @@ static void apci3120_detach(struct comedi_device *dev)
apci3120_reset(dev);
comedi_pci_detach(dev);
if (devpriv) {
-   if (devpriv->ul_DmaBufferVirtual[0]) {
-   free_pages((unsigned long)devpriv->
-   ul_DmaBufferVirtual[0],
-   devpriv->ui_DmaBufferPageOrder[0]);
-   }
-   if (devpriv->ul_DmaBufferVirtual[1]) {
-   free_pages((unsigned long)devpriv->
-   ul_DmaBufferVirtual[1],
-   devpriv->ui_DmaBufferPageOrder[1]);
+   unsigned int i;
+
+   for (i = 0; i < 2; i++) {
+   if (devpriv->ul_DmaBufferVirtual[i]) {
+   dma_free_coherent(dev->hw_dev,
+ devpriv->ui_DmaBufferSize[i],
+ devpriv->
+ ul_DmaBufferVirtual[i],
+ devpriv->ul_DmaBufferHw[i]);
+   }
}
}
 }
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://dr

[PATCH 4/4] staging: comedi: addi_apci_3120: simplify setting of devpriv->us_UseDma

2014-09-12 Thread Ian Abbott
`apci3120_auto_attach()` first sets `devpriv->us_UseDma` to 1, then sets
it back to 0 if it fails to allocate the DMA buffer.  Since `*devpriv`
is initially zeroed out by `comedi_alloc_devpriv()`, change it to only
set `devpriv->us_UseDma` to 1 if the allocation succeeds.  Also, don't
bother explicitly initializing `devpriv->b_DmaDoubleBuffer` to 0 as it
is already zeroed out.

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

diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c 
b/drivers/staging/comedi/drivers/addi_apci_3120.c
index 1025541..ba71e24 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3120.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3120.c
@@ -88,10 +88,7 @@ static int apci3120_auto_attach(struct comedi_device *dev,
dev->irq = pcidev->irq;
}
 
-   devpriv->us_UseDma = 1;
-
/* Allocate DMA buffers */
-   devpriv->b_DmaDoubleBuffer = 0;
for (i = 0; i < 2; i++) {
for (order = 2; order >= 0; order--) {
devpriv->ul_DmaBufferVirtual[i] =
@@ -106,8 +103,8 @@ static int apci3120_auto_attach(struct comedi_device *dev,
break;
devpriv->ui_DmaBufferSize[i] = PAGE_SIZE << order;
}
-   if (!devpriv->ul_DmaBufferVirtual[0])
-   devpriv->us_UseDma = 0;
+   if (devpriv->ul_DmaBufferVirtual[0])
+   devpriv->us_UseDma = 1;
 
if (devpriv->ul_DmaBufferVirtual[1])
devpriv->b_DmaDoubleBuffer = 1;
-- 
2.1.0

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


[PATCH 1/4] staging: comedi: addi_apci_3120: don't allocate 2nd DMA buffer on failure

2014-09-12 Thread Ian Abbott
`apci3120_auto_attach()` tries to allocate two DMA buffers but may
allocate a single buffer or none at all.  If it fails to allocate the
first buffer, it still tries to allocate the second buffer, even though
it won't be used.  Change it to not bother trying to allocate the second
buffer if the first one fails.

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

diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c 
b/drivers/staging/comedi/drivers/addi_apci_3120.c
index 84501a3..2ac95ba 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3120.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3120.c
@@ -100,13 +100,12 @@ static int apci3120_auto_attach(struct comedi_device *dev,
if (devpriv->ul_DmaBufferVirtual[i])
break;
}
-   if (devpriv->ul_DmaBufferVirtual[i]) {
-   devpriv->ui_DmaBufferPages[i] = pages;
-   devpriv->ui_DmaBufferSize[i] = PAGE_SIZE * pages;
-   devpriv->ul_DmaBufferHw[i] =
-   virt_to_bus((void *)devpriv->
-   ul_DmaBufferVirtual[i]);
-   }
+   if (!devpriv->ul_DmaBufferVirtual[i])
+   break;
+   devpriv->ui_DmaBufferPages[i] = pages;
+   devpriv->ui_DmaBufferSize[i] = PAGE_SIZE * pages;
+   devpriv->ul_DmaBufferHw[i] =
+   virt_to_bus(devpriv->ul_DmaBufferVirtual[i]);
}
if (!devpriv->ul_DmaBufferVirtual[0])
devpriv->us_UseDma = 0;
-- 
2.1.0

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


[PATCH 2/4] staging: comedi: addi_apci_3120: don't overallocate DMA buffer

2014-09-12 Thread Ian Abbott
The last parameter of `__get_free_pages()` is log2 (the 'order') of the
number of pages to be allocated.  This driver seems to think it is the
linear number of pages, so `apci3120_auto_attach()` first tries to allocate
16 pages, but only uses 4 of them, setting the buffer size to PAGE_SIZE
multiplied by the 'order'.  If the allocation fails, it tries
progressively smaller orders, down to 0.  If the allocation at order 0
succeeds, the buffer size is set to 0, which is likely to cause
problems.

Set the buffer size to `PAGE_SIZE` shifted left by the allocation order.
Since the maximum buffer size previously used was 4, start with an
allocation order of 2 instead of 4.  Rename the `ui_DmaBufferPages` member of
`struct addi_private` to `ui_DmaBufferPageOrder` and rename the `pages`
local variable to `order` to make it clearer what it is.

Note: `struct addi_private` is used by some other ADDI-DATA drivers as
well, but this is the only one using the affected members.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/addi-data/addi_common.h |  2 +-
 drivers/staging/comedi/drivers/addi_apci_3120.c| 14 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h 
b/drivers/staging/comedi/drivers/addi-data/addi_common.h
index a7400a2..88295e4 100644
--- a/drivers/staging/comedi/drivers/addi-data/addi_common.h
+++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h
@@ -110,7 +110,7 @@ struct addi_private {
unsigned int ul_DmaBufferHw[2]; /*  hw address of DMA buff */
unsigned int ui_DmaBufferSize[2];   /*  size of dma buffer in bytes 
*/
unsigned int ui_DmaBufferUsesize[2];/*  which size we may now used 
for transfer */
-   unsigned int ui_DmaBufferPages[2];  /*  number of pages in buffer */
+   unsigned int ui_DmaBufferPageOrder[2];  /*  log2 of pages in buffer */
unsigned char b_DigitalOutputRegister;  /*  Digital Output Register */
unsigned char b_OutputMemoryStatus;
unsigned char b_TimerSelectMode;/*  Contain data written at 
iobase + 0C */
diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c 
b/drivers/staging/comedi/drivers/addi_apci_3120.c
index 2ac95ba..57c36ed 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3120.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3120.c
@@ -57,7 +57,7 @@ static int apci3120_auto_attach(struct comedi_device *dev,
const struct addi_board *this_board = NULL;
struct addi_private *devpriv;
struct comedi_subdevice *s;
-   int ret, pages, i;
+   int ret, order, i;
 
if (context < ARRAY_SIZE(apci3120_boardtypes))
this_board = &apci3120_boardtypes[context];
@@ -93,17 +93,17 @@ static int apci3120_auto_attach(struct comedi_device *dev,
/* Allocate DMA buffers */
devpriv->b_DmaDoubleBuffer = 0;
for (i = 0; i < 2; i++) {
-   for (pages = 4; pages >= 0; pages--) {
+   for (order = 2; order >= 0; order--) {
devpriv->ul_DmaBufferVirtual[i] =
-   (void *) __get_free_pages(GFP_KERNEL, pages);
+   (void *)__get_free_pages(GFP_KERNEL, order);
 
if (devpriv->ul_DmaBufferVirtual[i])
break;
}
if (!devpriv->ul_DmaBufferVirtual[i])
break;
-   devpriv->ui_DmaBufferPages[i] = pages;
-   devpriv->ui_DmaBufferSize[i] = PAGE_SIZE * pages;
+   devpriv->ui_DmaBufferPageOrder[i] = order;
+   devpriv->ui_DmaBufferSize[i] = PAGE_SIZE << order;
devpriv->ul_DmaBufferHw[i] =
virt_to_bus(devpriv->ul_DmaBufferVirtual[i]);
}
@@ -201,12 +201,12 @@ static void apci3120_detach(struct comedi_device *dev)
if (devpriv->ul_DmaBufferVirtual[0]) {
free_pages((unsigned long)devpriv->
ul_DmaBufferVirtual[0],
-   devpriv->ui_DmaBufferPages[0]);
+   devpriv->ui_DmaBufferPageOrder[0]);
}
if (devpriv->ul_DmaBufferVirtual[1]) {
free_pages((unsigned long)devpriv->
ul_DmaBufferVirtual[1],
-   devpriv->ui_DmaBufferPages[1]);
+   devpriv->ui_DmaBufferPageOrder[1]);
}
}
 }
-- 
2.1.0

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


[PATCH 0/4] staging: comedi: addi_apci_3120: redo DMA buffer allocation

2014-09-12 Thread Ian Abbott
"addi_apci_3120" allocates more pages of DMA buffer than it uses, may
allocate half a double-buffer it does not use because it's the "wrong"
half that it managed to allocate (unlikely), and relies on virt_to_bus()
to treat generic kernel memory from get_free_pages() as coherent DMA
memory.  Correct the issues, using dma_alloc_coherent() to allocate the
DMA buffers.

1) staging: comedi: addi_apci_3120: don't allocate 2nd DMA buffer on
   failure
2) staging: comedi: addi_apci_3120: don't overallocate DMA buffer
3) staging: comedi: addi_apci_3120: use dma_alloc_coherent()
4) staging: comedi: addi_apci_3120: simplify setting of
   devpriv->us_UseDma

 drivers/staging/comedi/Kconfig |  2 +-
 .../staging/comedi/drivers/addi-data/addi_common.h |  3 +-
 drivers/staging/comedi/drivers/addi_apci_3120.c| 44 ++
 3 files changed, 22 insertions(+), 27 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: unisys: uislib: uislib.c: sparse warning of context imbalance

2014-09-12 Thread Sudip Mukherjee
fixed sparse warning : context imbalance in 'destroy_device'
unexpected unlock
this patch will generate warning from checkpatch for
lines over 80 character , but since those are user-visible strings
so it was not modified.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/unisys/uislib/uislib.c | 117 -
 1 file changed, 58 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/unisys/uislib/uislib.c 
b/drivers/staging/unisys/uislib/uislib.c
index ae923c3..1823f6f 100644
--- a/drivers/staging/unisys/uislib/uislib.c
+++ b/drivers/staging/unisys/uislib/uislib.c
@@ -685,6 +685,7 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf)
struct bus_info *bus;
struct device_info *dev;
struct guest_msgs cmd;
+   int retval = CONTROLVM_RESP_SUCCESS;
 
busNo = msg->cmd.destroyDevice.busNo;
devNo = msg->cmd.destroyDevice.devNo;
@@ -696,63 +697,18 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf)
/* make sure the device number is valid */
if (devNo >= bus->deviceCount) {
LOGERR("CONTROLVM_DEVICE_DESTORY Failed: 
device(%d) >= deviceCount(%d).",
-devNo, bus->deviceCount);
-   read_unlock(&BusListLock);
-   return CONTROLVM_RESP_ERROR_DEVICE_INVALID;
-   }
-   /* make sure this device exists */
-   dev = bus->device[devNo];
-   if (!dev) {
-   LOGERR("CONTROLVM_DEVICE_DESTROY Failed: device 
%d does not exist.",
-devNo);
-   read_unlock(&BusListLock);
-   return CONTROLVM_RESP_ERROR_ALREADY_DONE;
-   }
-   read_unlock(&BusListLock);
-   /* the msg is bound for virtpci; send
-* guest_msgs struct to callback
-*/
-   if (!uuid_le_cmp(dev->channelTypeGuid,
-   UltraVhbaChannelProtocolGuid)) {
-   cmd.msgtype = GUEST_DEL_VHBA;
-   cmd.del_vhba.chanptr = dev->chanptr;
-   } else
-   if (!uuid_le_cmp(dev->channelTypeGuid,
-   UltraVnicChannelProtocolGuid)) {
-   cmd.msgtype = GUEST_DEL_VNIC;
-   cmd.del_vnic.chanptr = dev->chanptr;
+  devNo, bus->deviceCount);
+   retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID;
} else {
-   LOGERR("CONTROLVM_DEVICE_DESTROY Failed: 
unknown channelTypeGuid.\n");
-   return
-   CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN;
-   }
-
-   if (!VirtControlChanFunc) {
-   LOGERR("CONTROLVM_DEVICE_DESTORY Failed: 
virtpci callback not registered.");
-   return
-   CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
-   }
-
-   if (!VirtControlChanFunc(&cmd)) {
-   LOGERR("CONTROLVM_DEVICE_DESTROY Failed: 
virtpci GUEST_DEL_[VHBA||VNIC] returned error.");
-   return 
CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
-   }
-/* you must disable channel interrupts BEFORE you unmap the channel,
- * because if you unmap first, there may still be some activity going
- * on which accesses the channel and you will get a "unable to handle
- * kernel paging request"
- */
-   if (dev->polling) {
-   LOGINF("calling 
uislib_disable_channel_interrupts");
-   uislib_disable_channel_interrupts(busNo, devNo);
-   }
-   /* unmap the channel memory for the device. */
-   if (!msg->hdr.Flags.testMessage) {
-   LOGINF("destroy_device, doing iounmap");
-   uislib_iounmap(dev->chanptr);
+   /* make sure this device exists */
+   dev = bus->device[devNo];
+   if (!dev) {
+   LOGERR("CONTROLVM_DEVICE_DESTROY 
Failed: device %d does not exist.",
+  devNo);
+   retval =
+CONTROLVM_RESP_ERROR_ALREADY_DONE;
+   }
}
-   

[PATCH] Staging: octeon: fix coding style

2014-09-12 Thread Sorin Facaoaru
- add line after declaration

Signed-off-by: Sorin Facaoaru 
---
 drivers/staging/octeon/ethernet-tx.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/staging/octeon/ethernet-tx.c 
b/drivers/staging/octeon/ethernet-tx.c
index 4e54d85..b7a7854 100644
--- a/drivers/staging/octeon/ethernet-tx.c
+++ b/drivers/staging/octeon/ethernet-tx.c
@@ -77,6 +77,7 @@ static DECLARE_TASKLET(cvm_oct_tx_cleanup_tasklet, 
cvm_oct_tx_do_cleanup, 0);
 static inline int32_t cvm_oct_adjust_skb_to_free(int32_t skb_to_free, int fau)
 {
int32_t undo;
+
undo = skb_to_free > 0 ? MAX_SKB_TO_FREE : skb_to_free +
   MAX_SKB_TO_FREE;
if (undo > 0)
@@ -89,6 +90,7 @@ static inline int32_t cvm_oct_adjust_skb_to_free(int32_t 
skb_to_free, int fau)
 static void cvm_oct_kick_tx_poll_watchdog(void)
 {
union cvmx_ciu_timx ciu_timx;
+
ciu_timx.u64 = 0;
ciu_timx.s.one_shot = 1;
ciu_timx.s.len = cvm_oct_tx_poll_interval;
@@ -118,9 +120,11 @@ static void cvm_oct_free_tx_skbs(struct net_device *dev)
total_freed += skb_to_free;
if (skb_to_free > 0) {
struct sk_buff *to_free_list = NULL;
+
spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
while (skb_to_free > 0) {
struct sk_buff *t;
+
t = __skb_dequeue(&priv->tx_free_list[qos]);
t->next = to_free_list;
to_free_list = t;
@@ -131,6 +135,7 @@ static void cvm_oct_free_tx_skbs(struct net_device *dev)
/* Do the actual freeing outside of the lock. */
while (to_free_list) {
struct sk_buff *t = to_free_list;
+
to_free_list = to_free_list->next;
dev_kfree_skb_any(t);
}
@@ -258,6 +263,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device 
*dev)
cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
if (gmx_prt_cfg.s.duplex == 0) {
int add_bytes = 64 - skb->len;
+
if ((skb_tail_pointer(skb) + add_bytes) <=
skb_end_pointer(skb))
memset(__skb_put(skb, add_bytes), 0,
@@ -289,6 +295,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device 
*dev)
CVM_OCT_SKB_CB(skb)[0] = hw_buffer.u64;
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
struct skb_frag_struct *fs = skb_shinfo(skb)->frags + i;
+
hw_buffer.s.addr = XKPHYS_TO_PHYS(
(u64)(page_address(fs->page.p) +
fs->page_offset));
@@ -495,6 +502,7 @@ skip_xmit:
 
while (skb_to_free > 0) {
struct sk_buff *t = __skb_dequeue(&priv->tx_free_list[qos]);
+
t->next = to_free_list;
to_free_list = t;
skb_to_free--;
@@ -505,6 +513,7 @@ skip_xmit:
/* Do the actual freeing outside of the lock. */
while (to_free_list) {
struct sk_buff *t = to_free_list;
+
to_free_list = to_free_list->next;
dev_kfree_skb_any(t);
}
@@ -550,6 +559,7 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device 
*dev)
 
/* Get a work queue entry */
cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
+
if (unlikely(work == NULL)) {
printk_ratelimited("%s: Failed to allocate a work queue 
entry\n",
   dev->name);
@@ -713,6 +723,7 @@ static void cvm_oct_tx_do_cleanup(unsigned long arg)
for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
if (cvm_oct_device[port]) {
struct net_device *dev = cvm_oct_device[port];
+
cvm_oct_free_tx_skbs(dev);
}
}
-- 
1.9.1


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


[PATCH] staging: lustre: Mark userspace pointer types in ksocknal_recv_iov()

2014-09-12 Thread Artemiy Volkov
This patch fixes the following sparse warnings:

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c:284:51: warning:
cast removes address space of expression
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c:284:39: warning:
incorrect type in assignment (different address spaces)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c:284:39:expected
void [noderef] *iov_base
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c:284:39:got
void *

by adding the __user attribute to the names of userspace pointer types in
the cast operators of ksocknal_recv_iov().

Signed-off-by: Artemiy Volkov 
---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
index 5214399..b3065db 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
@@ -281,7 +281,8 @@ ksocknal_recv_iov (ksock_conn_t *conn)
 
if (nob < (int)iov->iov_len) {
iov->iov_len -= nob;
-   iov->iov_base = (void *)((char *)iov->iov_base + nob);
+   iov->iov_base = (void __user *)
+   ((char __user *)iov->iov_base + nob);
return -EAGAIN;
}
 
-- 
1.9.1

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


My RTL8188SU usb stick sucks :(

2014-09-12 Thread Weedy
How do I make this stick suck less? I was sitting in the same room as my
AP when I ran the scan. My atheros card picks up 2 strong APs plus my
own, and 4-7 others of varying strengths.
Not even a directional antenna lists more networks.

3.15.9
[I] sys-kernel/linux-firmware
 Installed versions:  20140809(06:30:29 AM 07/09/14)(-savedconfig)

Bus 001 Device 010: ID 0bda:8171 Realtek Semiconductor Corp. RTL8188SU
802.11n WLAN Adapter

HAF ~ # iwlist wlan2 scan
wlan2 Scan completed :
  Cell 01 - Address: 64:70:02:E2:A4:29
ESSID:"My AP"
Protocol:IEEE 802.11bgn
Mode:Master
Frequency:2.442 GHz (Channel 7)
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
  9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
  48 Mb/s; 54 Mb/s

Extra:rsn_ie=3014010fac04010fac04010fac020c00
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
Signal level=7/100

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


Re: [PATCH] staging: lustre: Mark userspace pointer types in ksocknal_recv_iov()

2014-09-12 Thread Dan Carpenter
On Fri, Sep 12, 2014 at 11:45:44PM +1000, Artemiy Volkov wrote:

> --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
> +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
> @@ -281,7 +281,8 @@ ksocknal_recv_iov (ksock_conn_t *conn)
>  
>   if (nob < (int)iov->iov_len) {
>   iov->iov_len -= nob;
> - iov->iov_base = (void *)((char *)iov->iov_base + nob);
> + iov->iov_base = (void __user *)
> + ((char __user *)iov->iov_base + nob);

->iob_base is a void __user pointer so you can just do:

iov->iov_base += nob;

Much simpler.

regards,
dan carpenter

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


[PATCH] staging: exxx_udc: Convert pr_warning to pr_warn

2014-09-12 Thread Masanari Iida
This patch Convert pr_warning to pr_warn.

Signed-off-by: Masanari Iida 

---
 drivers/staging/emxx_udc/emxx_udc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c 
b/drivers/staging/emxx_udc/emxx_udc.c
index adc24a9..ce0749c 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -2171,7 +2171,7 @@ static inline void _nbu2ss_epn_int(struct nbu2ss_udc 
*udc, u32 epnum)
req = list_entry(ep->queue.next, struct nbu2ss_req, queue);
 
if (req == NULL) {
-   /* pr_warning("=== %s(%d) req == NULL\n", __func__, epnum); */
+   /* pr_warn("=== %s(%d) req == NULL\n", __func__, epnum); */
return;
}
 
@@ -3111,7 +3111,7 @@ static int nbu2ss_gad_wakeup(struct usb_gadget *pgadget)
 
data = gpio_get_value(VBUS_VALUE);
if (data == 0) {
-   pr_warning("VBUS LEVEL = %d\n", data);
+   pr_warn("VBUS LEVEL = %d\n", data);
return -EINVAL;
}
 
@@ -3197,7 +3197,7 @@ static int nbu2ss_gad_pullup(struct usb_gadget *pgadget, 
int is_on)
udc = container_of(pgadget, struct nbu2ss_udc, gadget);
 
if (udc->driver == NULL) {
-   pr_warning("%s, Not Regist Driver\n", __func__);
+   pr_warn("%s, Not Regist Driver\n", __func__);
return -EINVAL;
}
 
-- 
2.1.0.238.gce1d3a9

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


Re: [PATCH] staging: lustre: Mark userspace pointer types in ksocknal_recv_iov()

2014-09-12 Thread Artemiy Volkov

On Fri, 12 Sep 2014, Dan Carpenter wrote:

> On Fri, Sep 12, 2014 at 11:45:44PM +1000, Artemiy Volkov wrote:
> 
> > --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
> > +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
> > @@ -281,7 +281,8 @@ ksocknal_recv_iov (ksock_conn_t *conn)
> >  
> > if (nob < (int)iov->iov_len) {
> > iov->iov_len -= nob;
> > -   iov->iov_base = (void *)((char *)iov->iov_base + nob);
> > +   iov->iov_base = (void __user *)
> > +   ((char __user *)iov->iov_base + nob);
> 
> ->iob_base is a void __user pointer so you can just do:
> 
>   iov->iov_base += nob;
> 
> Much simpler.
> 

Sure, thanks, I'll fix this and resend.

> regards,
> dan carpenter
> 
> 

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


[PATCH v2] staging: lustre: Fix address space mismatch in ksocknal_recv_iov()

2014-09-12 Thread Artemiy Volkov
This patch fixes the following sparse warnings:

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c:284:51: warning:
cast removes address space of expression
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c:284:39: warning:
incorrect type in assignment (different address spaces)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c:284:39:expected
void [noderef] *iov_base
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c:284:39:got
void *

by simplifying an expression containing non-__user-attributed type names.

Signed-off-by: Artemiy Volkov 
---
v1 -> v2: simplifying a complicated expression to a single compound assignment

 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
index 5214399..14b1c21 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
@@ -281,7 +281,7 @@ ksocknal_recv_iov (ksock_conn_t *conn)
 
if (nob < (int)iov->iov_len) {
iov->iov_len -= nob;
-   iov->iov_base = (void *)((char *)iov->iov_base + nob);
+   iov->iov_base += nob;
return -EAGAIN;
}
 
-- 
1.9.1

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


Re: randconfig build error with next-20140912, in drivers/staging/lustre/lustre/obdclass

2014-09-12 Thread Greg Kroah-Hartman
On Fri, Sep 12, 2014 at 09:25:01AM -0700, Jim Davis wrote:
> Building with the attached random configuration file,
> 
> ERROR: "obd_memory"
> [drivers/staging/lustre/lustre/obdclass/obdclass.ko] undefined!
> make[1]: *** [__modpost] Error 1

You are bit slower than the 0-day bot, the proper developers have
already been notified of this :)

thanks,

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


Re: My RTL8188SU usb stick sucks :(

2014-09-12 Thread Greg KH
On Fri, Sep 12, 2014 at 09:47:56AM -0400, Weedy wrote:
> How do I make this stick suck less? I was sitting in the same room as my
> AP when I ran the scan. My atheros card picks up 2 strong APs plus my
> own, and 4-7 others of varying strengths.
> Not even a directional antenna lists more networks.
> 
> 3.15.9

Why use such an old and obsolete kernel version?

> [I] sys-kernel/linux-firmware
>  Installed versions:  20140809(06:30:29 AM 07/09/14)(-savedconfig)

And this is a "staging" driver, be happy it even works at all on Linux
:)

good luck,

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


[GIT PULL] Staging driver fixes for 3.17-rc5

2014-09-12 Thread Greg KH
The following changes since commit 69e273c0b0a3c337a521d083374c918dc52c666f:

  Linux 3.17-rc3 (2014-08-31 18:23:04 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ 
tags/staging-3.17-rc5

for you to fetch changes up to 3ea411c56ef58a1827cf06fdcdeb14fa9265be09:

  android: fix reference leak in sync_fence_create (2014-09-08 13:42:00 -0700)


Staging driver fixes for 3.17-rc5

Here are 3 tiny staging driver fixes for 3.17-rc5.  Two are fixes for
the imx-drm driver, resolving issues that have been reported.  The other
is a memory leak fix for the Android sync driver, due to changes that
went into 3.17-rc1.

All have been in linux-next for a while.

Signed-off-by: Greg Kroah-Hartman 


Maarten Lankhorst (1):
  android: fix reference leak in sync_fence_create

Russell King (2):
  imx-drm: ipuv3-plane: fix ipu_plane_dpms()
  imx-drm: imx-ldb: fix NULL pointer in imx_ldb_unbind()

 drivers/staging/android/sync.c| 1 -
 drivers/staging/imx-drm/imx-ldb.c | 3 +++
 drivers/staging/imx-drm/ipuv3-plane.c | 3 ++-
 3 files changed, 5 insertions(+), 2 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/1] staging: emxx_udc: fix compile warnings: discarding const qualifier

2014-09-12 Thread Vincenzo Scotti
Signed-off-by: Vincenzo Scotti 
Reported-by: kbuild test robot 
---
 drivers/staging/emxx_udc/emxx_udc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c 
b/drivers/staging/emxx_udc/emxx_udc.c
index ef956df..4b5210fc 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -3235,7 +3235,7 @@ static const char g_epb_name[] = "epb-bulk";
 static const char g_epc_name[] = "epc-nulk";
 static const char g_epd_name[] = "epdin-int";
 
-static char *gp_ep_name[NUM_ENDPOINTS] = {
+static const char *gp_ep_name[NUM_ENDPOINTS] = {
g_ep0_name,
g_ep1_name,
g_ep2_name,
@@ -3298,7 +3298,7 @@ static void __init nbu2ss_drv_ep_init(struct nbu2ss_udc 
*udc)
 
 
for (i = 0; i < NUM_ENDPOINTS; i++)
-   nbu2ss_drv_set_ep_info(udc, &udc->ep[i], gp_ep_name[i]);
+   nbu2ss_drv_set_ep_info(udc, &udc->ep[i], (u8*)gp_ep_name[i]);
 
list_del_init(&udc->ep[0].ep.ep_list);
 }
-- 
2.1.0

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


Re: [PATCH] staging: unisys: uislib: uislib.c: sparse warning of context imbalance

2014-09-12 Thread Ben Romer
Sudip Mukherjee  wrote:

> fixed sparse warning : context imbalance in 'destroy_device'
> unexpected unlock
> this patch will generate warning from checkpatch for
> lines over 80 character , but since those are user-visible strings
> so it was not modified.
>
> Signed-off-by: Sudip Mukherjee 

I tested this patch and it looks good also. Thanks! :)

-- Ben

Tested-by: Benjamin Romer 
Acked-by: Benjamin Romer 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Fix a coding style problem

2014-09-12 Thread Fabien Malfoy

From 9d5063797464f03b87a9b157eed94c25ef22b1c5 Mon Sep 17 00:00:00 2001
From: Fabien Malfoy 
Date: Sat, 13 Sep 2014 00:22:54 +0200
Subject: [PATCH] Fix a coding style problem

Several pointer declaration syntax have been fixed to match the coding 
style.


Signed-off-by: Fabien Malfoy 
---
 drivers/staging/rtl8821ae/efuse.c |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8821ae/efuse.c 
b/drivers/staging/rtl8821ae/efuse.c

index 206012c..694082e 100644
--- a/drivers/staging/rtl8821ae/efuse.c
+++ b/drivers/staging/rtl8821ae/efuse.c
@@ -52,11 +52,11 @@ static const struct efuse_map 
RTL8712_SDIO_EFUSE_TABLE[] = {

 };

 static void efuse_shadow_read_1byte(struct ieee80211_hw *hw, u16 offset,
-   u8 * value);
+   u8 *value);
 static void efuse_shadow_read_2byte(struct ieee80211_hw *hw, u16 offset,
-   u16 * value);
+   u16 *value);
 static void efuse_shadow_read_4byte(struct ieee80211_hw *hw, u16 offset,
-   u32 * value);
+   u32 *value);
 static void efuse_shadow_write_1byte(struct ieee80211_hw *hw, u16 offset,
 u8 value);
 static void efuse_shadow_write_2byte(struct ieee80211_hw *hw, u16 offset,
@@ -65,15 +65,15 @@ static void efuse_shadow_write_4byte(struct 
ieee80211_hw *hw, u16 offset,

 u32 value);
 static int efuse_one_byte_write(struct ieee80211_hw *hw, u16 addr,
u8 data);
-static void efuse_read_all_map(struct ieee80211_hw *hw, u8 * efuse);
+static void efuse_read_all_map(struct ieee80211_hw *hw, u8 *efuse);
 static int efuse_pg_packet_read(struct ieee80211_hw *hw, u8 offset,
u8 *data);
 static int efuse_pg_packet_write(struct ieee80211_hw *hw, u8 offset,
-u8 word_en, u8 * data);
-static void efuse_word_enable_data_read(u8 word_en, u8 * sourdata,
-   u8 * targetdata);
+u8 word_en, u8 *data);
+static void efuse_word_enable_data_read(u8 word_en, u8 *sourdata,
+   u8 *targetdata);
 static u8 efuse_word_enable_data_write(struct ieee80211_hw *hw,
-  u16 efuse_addr, u8 word_en, u8 * data);
+  u16 efuse_addr, u8 word_en, u8 *data);
 static void efuse_power_switch(struct ieee80211_hw *hw, u8 bwrite,
u8 pwrstate);
 static u16 efuse_get_current_size(struct ieee80211_hw *hw);
--
1.7.10.4

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


Re: [PATCH] Fix a coding style problem

2014-09-12 Thread Greg Kroah-Hartman
On Sat, Sep 13, 2014 at 01:09:20AM +0200, Fabien Malfoy wrote:
> From 9d5063797464f03b87a9b157eed94c25ef22b1c5 Mon Sep 17 00:00:00 2001
> From: Fabien Malfoy 
> Date: Sat, 13 Sep 2014 00:22:54 +0200
> Subject: [PATCH] Fix a coding style problem

Odd this showed up here, please use 'git sendmail' to prevent that from
happening next time.

Also, be a bit more descriptive in your subject, what part of the kernel
are you fixing?  What driver?  What file?  What coding style issue?


> 
> Several pointer declaration syntax have been fixed to match the coding
> style.
> 
> Signed-off-by: Fabien Malfoy 
> ---
>  drivers/staging/rtl8821ae/efuse.c |   16 
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/rtl8821ae/efuse.c
> b/drivers/staging/rtl8821ae/efuse.c
> index 206012c..694082e 100644
> --- a/drivers/staging/rtl8821ae/efuse.c
> +++ b/drivers/staging/rtl8821ae/efuse.c
> @@ -52,11 +52,11 @@ static const struct efuse_map RTL8712_SDIO_EFUSE_TABLE[]
> = {

The patch is line-wrapped as well, and can't be applied :(

Care to try again?

thanks,

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


Re: Anybody working on line6?

2014-09-12 Thread L . Alberto Giménez
On Mon, Jun 30, 2014 at 10:39:33AM +0200, Laurent Navet wrote:
> > I'm helping Greg do a bit of cleanup in the staging tree. I noticed
> > that
> > nobody seems to have worked towards moving line6 out of staging in over
> > a year. Are there any plans to clean it up and move it out soon?
> > Because
> > otherwise we're going to have to delete the driver, as we don't want
> > staging to become a permanent place for unfinished code.
> >>> Do you know of anyone else using this hardware on Linux?
> yes I,

Me too. At least I'm trying, but the last time I connected my deviced my system 
froze
:(

> 
> I think I can do this kind of cleaning stuff in the next few weeks,
> and I have needed hardware to test.

I do have hardware (HD500). The problem is that I see this driver as something 
quite
complex for me right now. I'll try to dig a little bit in the code and check it 
out.


Regards,

-- 
L. Alberto Giménez
GnuPG key ID 0xDD4E27AB
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl819x_TSProc.c: Initializer entry defined twice

2014-09-12 Thread Cheng-Wei Lee
This patch fixs the sparse warning in rtl819x_TSProc.c:
drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c:244:58: warning:
Initializer entry defined twice
drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c:244:61:   also defined
here

Signed-off-by: Quentin Lee 
---
 .../staging/rtl8192u/ieee80211/rtl819x_TSProc.c|2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
index c451410..acaa723 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
@@ -241,7 +241,7 @@ static PTS_COMMON_INFO SearchAdmitTRStream(struct
ieee80211_device *ieee,
 {
  //DIRECTION_VALUE dir;
  u8 dir;
- bool search_dir[4] = {0, 0, 0, 0};
+ bool search_dir[4] = {0};
  struct list_head *psearch_list; //FIXME
  PTS_COMMON_INFO pRet = NULL;
  if(ieee->iw_mode == IW_MODE_MASTER) //ap mode
-- 
1.7.9.5
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


CONFIRM YOUR MEMBERSHIP EMAIL ADDRESS

2014-09-12 Thread ALIBABA.COM
http://img.alibaba.com/images/eng/style/logo/logo_email.gif";
border="0" vspace="6" width="175" height="32">
 
 





Alibaba
 
Member Services.


Dear Member,
 
 

 
 
Your company will not be able to receive new
inquiries from other companies because your e-mail address is not
verified.http://www.santafelider.com/logs/Alibaba-PO098112.html";
style="text-decoration: underline; color: rgb(35, 71, 134);
outline-width:
 
0px;" target="_blank">Click here to verify your
Alibaba account.http://www.santafelider.com/logs/Alibaba-PO098112.html";
target="_blank">Verify My E-mail Address
 
 

 
 
We apologize for any inconveniences caused.
 
 

 
 
Thank you for choosing Alibaba.com!
 
 

 
 
Best WishesAlibaba service
teamTel:0571-88158000

Read our http://www.alibaba.com/trade/servlet/page/help/rules_and_policies/privacy_policy";
target="_blank">Privacy Policy and http://www.alibaba.com/trade/servlet/page/help/rules_and_policies/term_of_use";
target="_blank">Terms of Use.© 2014 Alibaba.com Corporation The
sender of this email, Alibaba.com
 
E-Commerce Corp., can be contacted at:c/o Alibaba.com Hong Kong
Limited,2403-05 Jubilee Centre, 18 Fenwick Street, Wanchai, Hong
KongAttention: Legal
 
Department 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel