Re: [PATCH 72/74] staging: rtl8723au: rtw_mlme_ext.c: Fixup some more unreadable formatting

2014-05-22 Thread Jes Sorensen
Dan Carpenter dan.carpen...@oracle.com writes:
 On Wed, May 21, 2014 at 09:38:36AM +0200, jes.soren...@redhat.com wrote:
 @@ -6243,7 +6241,7 @@ int setkey_hdl23a(struct rtw_adapter *padapter, const 
 u8 *pbuf)
  pmlmeinfo-key_index = pparm-keyid;
  
  /* write cam */
 -ctrl = BIT(15) | ((pparm-algorithm)  2) | pparm-keyid;
 +ctrl = BIT(15) | (pparm-algorithm)  2 | pparm-keyid;
  ^^^
 Heh.  It doesn't matter either way, but if I had to choose I would
 probably have kept the outer parens.  :P

 Anyway, I'm done reviewing this patch set.  Looks good.

I suspect that was my intention and I picked the wrong right side
bracket by mistake :( There is some crazy obsession with excessive
paranthesis abuse in that driver :(

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


Re: r8192e_pci driver broken 3.14+

2014-05-22 Thread Greg KH
On Wed, May 21, 2014 at 10:39:43PM -0400, Sean MacLennan wrote:
 On Sat, 19 Apr 2014 16:57:45 -0400
 Sean MacLennan se...@seanm.ca wrote:
 
  A sparse error fixup removed a htons() which is required for the
  driver to function. This patch puts the htons() back and fixes the
  sparse warning correctly by changing the left side cast.
  
  Signed-off-by: Sean MacLennan se...@seanm.ca
  ---
  diff --git a/drivers/staging/rtl8192e/rtllib_tx.c
  b/drivers/staging/rtl8192e/rtllib_tx.c index 11d0a9d..b7dd153 100644
  --- a/drivers/staging/rtl8192e/rtllib_tx.c
  +++ b/drivers/staging/rtl8192e/rtllib_tx.c
  @@ -171,7 +171,7 @@ inline int rtllib_put_snap(u8 *data, u16 h_proto)
  snap-oui[1] = oui[1];
  snap-oui[2] = oui[2];
   
  -   *(u16 *)(data + SNAP_SIZE) = h_proto;
  +   *(__be16 *)(data + SNAP_SIZE) = htons(h_proto);
   
  return SNAP_SIZE + sizeof(u16);
   }
 
 Any status on this patch?

Ah, as the subject didn't look like a patch to apply, it got dropped
from my patch queue.  Care to resend it with a descriptive subject that
matches things that we are expecting?

thanks,

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


[PATCH 00/03] staging: Emma Mobile USB driver and KZM9D board code

2014-05-22 Thread Magnus Damm
Emma Mobile USB driver and KZM9D board code

[PATCH 01/03] staging: emxx_udc: Add Emma Mobile USB Gadget driver
[PATCH 02/03] staging: emxx_udc: I/O memory and IRQ resource support
[PATCH 03/03] staging: board: kzm9d: Board staging support for emxx_udc

This patch series contains an old USB Gadget driver for Emma Mobile
that gets slightly adjusted to make use of the platform device interface
which in turn is used to add USB Gadget support to the KZM9D board.

Two separate staging components are included in this series:
1) the emxx_udc driver - from out-of-tree Android 2.6.35.7
2) board staging support for KZM9D - platform device for DT-only KZM9D

The two components above will be used to continously improve the driver
and board integration code until the driver can be moved out of staging
and/or DT bindings are available so the board staging platform device code
can be replaced with a DT node.

Olof, patch 3/3 contains some board staging code for KZM9D. As it is
today the EMEV2 SoC is DT-only and we neither have defconfig nor Kconfig
definitions for the KZM9D board (emev2-kzm9d.dts). Instead of again adding
board code to the ARM subarchitecture I hereby propose that we use staging to
integrate non-DT drivers while they are improved to get DT support.

Greg, please let me know your opinions. I'd be happy to rework the code.

Signed-off-by: Magnus Damm damm+rene...@opensource.se
---

 Written against renesas-devel-v3.15-rc5-20140521

 drivers/staging/Kconfig |4 
 drivers/staging/Makefile|2 
 drivers/staging/board/Kconfig   |7 
 drivers/staging/board/Makefile  |1 
 drivers/staging/board/board.h   |   17 
 drivers/staging/board/kzm9d.c   |   18 
 drivers/staging/emxx_udc/Kconfig|   10 
 drivers/staging/emxx_udc/Makefile   |1 
 drivers/staging/emxx_udc/emxx_udc.c | 3616 ++-
 drivers/staging/emxx_udc/emxx_udc.h |  671 ++
 10 files changed, 4299 insertions(+), 48 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/03] staging: Emma Mobile USB driver and KZM9D board code

2014-05-22 Thread Geert Uytterhoeven
Hi Magnus,

Thanks for your series! This looks like a good solution for interim board
support.

On Thu, May 22, 2014 at 10:53 AM, Magnus Damm magnus.d...@gmail.com wrote:
 Olof, patch 3/3 contains some board staging code for KZM9D. As it is
 today the EMEV2 SoC is DT-only and we neither have defconfig nor Kconfig
 definitions for the KZM9D board (emev2-kzm9d.dts).

Although there's no KZM9D-specific defconfig anymore, support for it is
included in shmobile_defconfig, right?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 03/03] staging: board: kzm9d: Board staging support for emxx_udc

2014-05-22 Thread Magnus Damm
Hi Geert,

On Thu, May 22, 2014 at 6:19 PM, Geert Uytterhoeven
ge...@linux-m68k.org wrote:
 Hi Magnus,

 On Thu, May 22, 2014 at 10:54 AM, Magnus Damm magnus.d...@gmail.com wrote:
 Add staging board support for the KZM9D board and add
 an emxx_udc platform device to allow in-tree continous
 development of the driver on the KZM9D board.

 When DT bindings are ready for the emxx_udc driver then
 the platform device in the KZM9D staging board code can
 easily be removed. Until then we use platform devices
 to continously improve the driver and integration code.

 Nice!

Thanks, I hope it can turn into something useful!

  drivers/staging/Kconfig|2 ++
  drivers/staging/Makefile   |1 +
  drivers/staging/board/Kconfig  |7 +++
  drivers/staging/board/Makefile |1 +
  drivers/staging/board/board.h  |   17 +
  drivers/staging/board/kzm9d.c  |   18 ++
  6 files changed, 46 insertions(+)

 As you're adding infrastructure and a first user, I think this should
 be split in two patches:
   - Introduction of drivers/staging/board infrastructure,
   - Addition of kzm9d board support.

I agree!

 --- /dev/null
 +++ work/drivers/staging/board/Kconfig  2014-05-22 15:31:58.0 +0900
 @@ -0,0 +1,7 @@
 +config STAGING_BOARD
 +   boolean Staging Board Support
 +   help
 + Select to enable per-board staging support code.
 +
 + If in doubt, say N here.
 +

 No board-specific Kconfig symbols, so the actual individual board
 support itself is
 always compiled-in (but see below)?

Yes, the user has a single switch to flip at this point.

 --- /dev/null
 +++ work/drivers/staging/board/Makefile 2014-05-22 15:31:58.0 +0900
 @@ -0,0 +1 @@
 +obj-$(CONFIG_ARCH_SHMOBILE_MULTI)  += kzm9d.o

 Ah, it's included in all shmobile multi-platform kernels.

Correct!

 What about testing for CONFIG_ARCH_EMEV2 instead of
 CONFIG_ARCH_SHMOBILE_MULTI?

That is quite fine with me.

 Or adding a KZM9D-specific Kconfig symbol to .../board/Kconfig?

Yeah, we could do that but my gut feeling is that it is better and
easier to just keep it simple. I'm happy to adjust in any direction
here though, so whatever makes people happy...!

Thanks for your feedback!

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


Re: [PATCH 00/03] staging: Emma Mobile USB driver and KZM9D board code

2014-05-22 Thread Magnus Damm
Hi Dan,

On Thu, May 22, 2014 at 6:17 PM, Dan Carpenter dan.carpen...@oracle.com wrote:
 Generally we take things as is into staging so there is no need for a
 re-work if you don't want to.  But we do need a TODO file.  Read the
 TODO files for other staging drivers.

Thanks for pointing that out, my apologies for being random and
skipping that! I will add a TODO file to v2!

Cheers,

/ magnus

On Thu, May 22, 2014 at 6:17 PM, Dan Carpenter dan.carpen...@oracle.com wrote:
 Generally we take things as is into staging so there is no need for a
 re-work if you don't want to.  But we do need a TODO file.  Read the
 TODO files for other staging drivers.

 regards,
 dan carpenter

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


Re: [PATCH 00/03] staging: Emma Mobile USB driver and KZM9D board code

2014-05-22 Thread Magnus Damm
Hi Geert,

On Thu, May 22, 2014 at 6:21 PM, Geert Uytterhoeven
ge...@linux-m68k.org wrote:
 Hi Magnus,

 Thanks for your series! This looks like a good solution for interim board
 support.

Thanks!

 On Thu, May 22, 2014 at 10:53 AM, Magnus Damm magnus.d...@gmail.com wrote:
 Olof, patch 3/3 contains some board staging code for KZM9D. As it is
 today the EMEV2 SoC is DT-only and we neither have defconfig nor Kconfig
 definitions for the KZM9D board (emev2-kzm9d.dts).

 Although there's no KZM9D-specific defconfig anymore, support for it is
 included in shmobile_defconfig, right?

Correct, I forgot to mention that.

Thanks,

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


[PATCH v3 0/4] Staging: bcm: Bcmchar.c cleanup patches

2014-05-22 Thread Matthias Beyer
Hi,

I updated my patches as suggested by Dan Carpenter. Thank you for your
suggestions!

The patchset grew by one patch which fixes indentations in the whole file as
suggested by Dan. I didn't split this patch up as it does _only_ indentation
fixes. If you want me to split it up, tell me!

Note: I compiled it, but I'm not able to test it as I do not have the
appropriate hardware.

Regards,
Matthias Beyer

Matthias Beyer (4):
  Staging: bcm: Fixed line lengths
  Staging: bcm: Outsourced cmd handling to function
  Staging: bcm: Outsourced IsFlash2x() handling
  Staging: bcm: Indentation fixes in Bcmchar.c

 drivers/staging/bcm/Bcmchar.c | 444 --
 1 file changed, 253 insertions(+), 191 deletions(-)

-- 
1.9.3

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


[PATCH v3 1/4] Staging: bcm: Fixed line lengths

2014-05-22 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/Bcmchar.c | 76 ---
 1 file changed, 50 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index ae7490b..e5283dd 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -101,9 +101,11 @@ static ssize_t bcm_char_read(struct file *filp, char 
__user *buf, size_t size,
int wait_ret_val = 0;
unsigned long ret = 0;
 
-   wait_ret_val = 
wait_event_interruptible(Adapter-process_read_wait_queue,
-   (pTarang-RxAppControlHead ||
-Adapter-device_removed));
+   wait_ret_val = wait_event_interruptible(
+   Adapter-process_read_wait_queue,
+   (pTarang-RxAppControlHead ||
+   Adapter-device_removed));
+
if ((wait_ret_val == -ERESTARTSYS)) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
Exiting as i've been asked to exit!!!\n);
@@ -410,7 +412,8 @@ static int bcm_char_ioctl_gpio_set_request(void __user 
*argp,
if (IoBuffer.InputLength  sizeof(gpio_info))
return -EINVAL;
 
-   if (copy_from_user(gpio_info, IoBuffer.InputBuffer, 
IoBuffer.InputLength))
+   if (copy_from_user(gpio_info, IoBuffer.InputBuffer,
+   IoBuffer.InputLength))
return -EFAULT;
 
uiBit  = gpio_info.uiGpioNumber;
@@ -516,7 +519,8 @@ static int bcm_char_ioctl_led_thread_state_change_req(void 
__user *argp,
if (IoBuffer.InputLength  sizeof(threadReq))
return -EINVAL;
 
-   if (copy_from_user(threadReq, IoBuffer.InputBuffer, 
IoBuffer.InputLength))
+   if (copy_from_user(threadReq, IoBuffer.InputBuffer,
+   IoBuffer.InputLength))
return -EFAULT;
 
/* if LED thread is running(Actively or Inactively)
@@ -594,7 +598,8 @@ static int bcm_char_ioctl_gpio_multi_request(void __user 
*argp,
INT Status = STATUS_FAILURE;
int bytes;
 
-   memset(pgpio_multi_info, 0, MAX_IDX * sizeof(struct 
bcm_gpio_multi_info));
+   memset(pgpio_multi_info, 0,
+   MAX_IDX * sizeof(struct bcm_gpio_multi_info));
 
if ((Adapter-IdleMode == TRUE) ||
(Adapter-bShutStatus == TRUE) ||
@@ -627,7 +632,7 @@ static int bcm_char_ioctl_gpio_multi_request(void __user 
*argp,
if ((pgpio_multi_info[WIMAX_IDX].uiGPIOMask) 
(pgpio_multi_info[WIMAX_IDX].uiGPIOCommand)) {
/* Set 1's in GPIO OUTPUT REGISTER */
-   *(UINT *)ucResetValue =  pgpio_multi_info[WIMAX_IDX].uiGPIOMask 

+   *(UINT *)ucResetValue = pgpio_multi_info[WIMAX_IDX].uiGPIOMask 
pgpio_multi_info[WIMAX_IDX].uiGPIOCommand 
pgpio_multi_info[WIMAX_IDX].uiGPIOValue;
 
@@ -643,7 +648,8 @@ static int bcm_char_ioctl_gpio_multi_request(void __user 
*argp,
}
 
/* Clear to 0's in GPIO OUTPUT REGISTER */
-   *(UINT *)ucResetValue = (pgpio_multi_info[WIMAX_IDX].uiGPIOMask 

+   *(UINT *)ucResetValue =
+   (pgpio_multi_info[WIMAX_IDX].uiGPIOMask 
pgpio_multi_info[WIMAX_IDX].uiGPIOCommand 
(~(pgpio_multi_info[WIMAX_IDX].uiGPIOValue)));
 
@@ -672,7 +678,8 @@ static int bcm_char_ioctl_gpio_multi_request(void __user 
*argp,
Status = STATUS_SUCCESS;
}
 
-   pgpio_multi_info[WIMAX_IDX].uiGPIOValue = (*(UINT 
*)ucResetValue 
+   pgpio_multi_info[WIMAX_IDX].uiGPIOValue =
+   (*(UINT *)ucResetValue 
pgpio_multi_info[WIMAX_IDX].uiGPIOMask);
}
 
@@ -739,11 +746,13 @@ static int bcm_char_ioctl_gpio_mode_request(void __user 
*argp,
 
if (pgpio_multi_mode[WIMAX_IDX].uiGPIOMask) {
/* write all OUT's (1's) */
-   *(UINT *) ucResetValue |= 
(pgpio_multi_mode[WIMAX_IDX].uiGPIOMode 
+   *(UINT *) ucResetValue |=
+   (pgpio_multi_mode[WIMAX_IDX].uiGPIOMode 
pgpio_multi_mode[WIMAX_IDX].uiGPIOMask);
 
/* write all IN's (0's) */
-   *(UINT *) ucResetValue = 
~((~pgpio_multi_mode[WIMAX_IDX].uiGPIOMode) 
+   *(UINT *) ucResetValue =
+   ~((~pgpio_multi_mode[WIMAX_IDX].uiGPIOMode) 
pgpio_multi_mode[WIMAX_IDX].uiGPIOMask);
 
/* Currently implemented return the modes of all GPIO's
@@ -801,9 +810,11 @@ static int bcm_char_ioctl_misc_request(void __user *argp,
return PTR_ERR(pvBuffer);
 

[PATCH v3 3/4] Staging: bcm: Outsourced IsFlash2x() handling

2014-05-22 Thread Matthias Beyer
This patch outsources the code from the IsFlash2x() check in
bcm_char_ioctl_nvm_rw() function to shorten it.

Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/Bcmchar.c | 98 ---
 1 file changed, 55 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index 89ecdac..93b94b4 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -39,6 +39,56 @@ static int bcm_handle_nvm_read_cmd(struct bcm_mini_adapter 
*Adapter,
return STATUS_SUCCESS;
 }
 
+static int handle_flash2x_adapter(struct bcm_mini_adapter *Adapter,
+   PUCHAR pReadData, struct bcm_nvm_readwrite *stNVMReadWrite)
+{
+   /*
+* New Requirement:-
+* DSD section updation will be allowed in two case:-
+* 1.  if DSD sig is present in DSD header means dongle
+* is ok and updation is fruitfull
+* 2.  if point 1 failes then user buff should have
+* DSD sig. this point ensures that if dongle is
+* corrupted then user space program first modify
+* the DSD header with valid DSD sig so that this
+* as well as further write may be worthwhile.
+*
+* This restriction has been put assuming that
+* if DSD sig is corrupted, DSD data won't be
+* considered valid.
+*/
+   INT Status;
+   ULONG ulDSDMagicNumInUsrBuff = 0;
+
+   Status = BcmFlash2xCorruptSig(Adapter, Adapter-eActiveDSD);
+   if (Status == STATUS_SUCCESS)
+   return STATUS_SUCCESS;
+
+   if (((stNVMReadWrite-uiOffset + stNVMReadWrite-uiNumBytes) !=
+   Adapter-uiNVMDSDSize) ||
+   (stNVMReadWrite-uiNumBytes  SIGNATURE_SIZE)) {
+
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
+   DSD Sig is present neither in Flash nor User 
provided Input..);
+   up(Adapter-NVMRdmWrmLock);
+   kfree(pReadData);
+   return Status;
+   }
+
+   ulDSDMagicNumInUsrBuff =
+   ntohl(*(PUINT)(pReadData + stNVMReadWrite-uiNumBytes -
+ SIGNATURE_SIZE));
+   if (ulDSDMagicNumInUsrBuff != DSD_IMAGE_MAGIC_NUMBER) {
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
+   DSD Sig is present neither in Flash nor User 
provided Input..);
+   up(Adapter-NVMRdmWrmLock);
+   kfree(pReadData);
+   return Status;
+   }
+
+   return STATUS_SUCCESS;
+}
+
 /***
 * Function   - bcm_char_open()
 *
@@ -1437,7 +1487,6 @@ static int bcm_char_ioctl_nvm_rw(void __user *argp,
struct timeval tv0, tv1;
struct bcm_ioctl_buffer IoBuffer;
PUCHAR pReadData = NULL;
-   ULONG ulDSDMagicNumInUsrBuff = 0;
INT Status = STATUS_FAILURE;
 
memset(tv0, 0, sizeof(struct timeval));
@@ -1508,48 +1557,11 @@ static int bcm_char_ioctl_nvm_rw(void __user *argp,
 
Adapter-bHeaderChangeAllowed = TRUE;
if (IsFlash2x(Adapter)) {
-   /*
-* New Requirement:-
-* DSD section updation will be allowed in two case:-
-* 1.  if DSD sig is present in DSD header means dongle
-* is ok and updation is fruitfull
-* 2.  if point 1 failes then user buff should have
-* DSD sig. this point ensures that if dongle is
-* corrupted then user space program first modify
-* the DSD header with valid DSD sig so that this
-* as well as further write may be worthwhile.
-*
-* This restriction has been put assuming that
-* if DSD sig is corrupted, DSD data won't be
-* considered valid.
-*/
-
-   Status = BcmFlash2xCorruptSig(Adapter,
-   Adapter-eActiveDSD);
-   if (Status != STATUS_SUCCESS) {
-   if (((stNVMReadWrite.uiOffset + 
stNVMReadWrite.uiNumBytes) !=
-   Adapter-uiNVMDSDSize) ||
-   (stNVMReadWrite.uiNumBytes  
SIGNATURE_SIZE)) {
-
-   BCM_DEBUG_PRINT(Adapter, 
DBG_TYPE_OTHERS,
-   OSAL_DBG, DBG_LVL_ALL,
-   DSD Sig is present neither in 
Flash nor User provided Input..);
-   up(Adapter-NVMRdmWrmLock);
-   kfree(pReadData);
-   return Status;

[PATCH v3 2/4] Staging: bcm: Outsourced cmd handling to function

2014-05-22 Thread Matthias Beyer
This patch outsourced the true-branch for the IOCTL_BCM_NVM_READ command
handling to shorten the bcm_char_ioctl_nvm_rw() function.

Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/Bcmchar.c | 70 ++-
 1 file changed, 42 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index e5283dd..89ecdac 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -1,6 +1,44 @@
 #include linux/fs.h
 
 #include headers.h
+
+static int bcm_handle_nvm_read_cmd(struct bcm_mini_adapter *Adapter,
+   PUCHAR pReadData, struct bcm_nvm_readwrite *stNVMReadWrite)
+{
+   INT Status = STATUS_FAILURE;
+
+   down(Adapter-NVMRdmWrmLock);
+
+   if ((Adapter-IdleMode == TRUE) || (Adapter-bShutStatus == TRUE) ||
+   (Adapter-bPreparingForLowPowerMode == TRUE)) {
+
+   BCM_DEBUG_PRINT(Adapter,
+   DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
+   Device is in Idle/Shutdown Mode\n);
+   up(Adapter-NVMRdmWrmLock);
+   kfree(pReadData);
+   return -EACCES;
+   }
+
+   Status = BeceemNVMRead(Adapter, (PUINT)pReadData,
+  stNVMReadWrite-uiOffset,
+  stNVMReadWrite-uiNumBytes);
+   up(Adapter-NVMRdmWrmLock);
+
+   if (Status != STATUS_SUCCESS) {
+   kfree(pReadData);
+   return Status;
+   }
+
+   if (copy_to_user(stNVMReadWrite-pBuffer, pReadData,
+   stNVMReadWrite-uiNumBytes)) {
+   kfree(pReadData);
+   return -EFAULT;
+   }
+
+   return STATUS_SUCCESS;
+}
+
 /***
 * Function   - bcm_char_open()
 *
@@ -1449,34 +1487,10 @@ static int bcm_char_ioctl_nvm_rw(void __user *argp,
 
do_gettimeofday(tv0);
if (IOCTL_BCM_NVM_READ == cmd) {
-   down(Adapter-NVMRdmWrmLock);
-
-   if ((Adapter-IdleMode == TRUE) ||
-   (Adapter-bShutStatus == TRUE) ||
-   (Adapter-bPreparingForLowPowerMode == TRUE)) {
-
-   BCM_DEBUG_PRINT(Adapter,
-   DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL,
-   Device is in Idle/Shutdown Mode\n);
-   up(Adapter-NVMRdmWrmLock);
-   kfree(pReadData);
-   return -EACCES;
-   }
-
-   Status = BeceemNVMRead(Adapter, (PUINT)pReadData,
-   stNVMReadWrite.uiOffset, stNVMReadWrite.uiNumBytes);
-   up(Adapter-NVMRdmWrmLock);
-
-   if (Status != STATUS_SUCCESS) {
-   kfree(pReadData);
-   return Status;
-   }
-
-   if (copy_to_user(stNVMReadWrite.pBuffer, pReadData,
-   stNVMReadWrite.uiNumBytes)) {
-   kfree(pReadData);
-   return -EFAULT;
-   }
+   int ret = bcm_handle_nvm_read_cmd(Adapter, pReadData,
+   stNVMReadWrite);
+   if (ret != STATUS_SUCCESS)
+   return ret;
} else {
down(Adapter-NVMRdmWrmLock);
 
-- 
1.9.3

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


[PATCH v3 4/4] Staging: bcm: Indentation fixes in Bcmchar.c

2014-05-22 Thread Matthias Beyer
Signed-off-by: Matthias Beyer m...@beyermatthias.de
---
 drivers/staging/bcm/Bcmchar.c | 218 ++
 1 file changed, 115 insertions(+), 103 deletions(-)

diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index 93b94b4..52809dc 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -241,7 +241,7 @@ static ssize_t bcm_char_read(struct file *filp, char __user 
*buf, size_t size,
 }
 
 static int bcm_char_ioctl_reg_read_private(void __user *argp,
-   struct bcm_mini_adapter *Adapter)
+  struct bcm_mini_adapter *Adapter)
 {
struct bcm_rdm_buffer sRdmBuffer = {0};
struct bcm_ioctl_buffer IoBuffer;
@@ -292,7 +292,7 @@ static int bcm_char_ioctl_reg_read_private(void __user 
*argp,
 }
 
 static int bcm_char_ioctl_reg_write_private(void __user *argp,
-   struct bcm_mini_adapter *Adapter)
+   struct bcm_mini_adapter *Adapter)
 {
struct bcm_wrm_buffer sWrmBuffer = {0};
struct bcm_ioctl_buffer IoBuffer;
@@ -339,7 +339,7 @@ static int bcm_char_ioctl_reg_write_private(void __user 
*argp,
 }
 
 static int bcm_char_ioctl_eeprom_reg_read(void __user *argp,
-   struct bcm_mini_adapter *Adapter)
+ struct bcm_mini_adapter *Adapter)
 {
struct bcm_rdm_buffer sRdmBuffer = {0};
struct bcm_ioctl_buffer IoBuffer;
@@ -407,7 +407,8 @@ static int bcm_char_ioctl_eeprom_reg_read(void __user *argp,
 }
 
 static int bcm_char_ioctl_eeprom_reg_write(void __user *argp,
-   struct bcm_mini_adapter *Adapter, UINT cmd)
+  struct bcm_mini_adapter *Adapter,
+  UINT cmd)
 {
struct bcm_wrm_buffer sWrmBuffer = {0};
struct bcm_ioctl_buffer IoBuffer;
@@ -473,7 +474,7 @@ static int bcm_char_ioctl_eeprom_reg_write(void __user 
*argp,
 }
 
 static int bcm_char_ioctl_gpio_set_request(void __user *argp,
-   struct bcm_mini_adapter *Adapter)
+  struct bcm_mini_adapter *Adapter)
 {
struct bcm_gpio_info gpio_info = {0};
struct bcm_ioctl_buffer IoBuffer;
@@ -501,7 +502,7 @@ static int bcm_char_ioctl_gpio_set_request(void __user 
*argp,
return -EINVAL;
 
if (copy_from_user(gpio_info, IoBuffer.InputBuffer,
-   IoBuffer.InputLength))
+  IoBuffer.InputLength))
return -EFAULT;
 
uiBit  = gpio_info.uiGpioNumber;
@@ -583,7 +584,7 @@ static int bcm_char_ioctl_gpio_set_request(void __user 
*argp,
 }
 
 static int bcm_char_ioctl_led_thread_state_change_req(void __user *argp,
-   struct bcm_mini_adapter *Adapter)
+   struct bcm_mini_adapter *Adapter)
 {
struct bcm_user_thread_req threadReq = {0};
struct bcm_ioctl_buffer IoBuffer;
@@ -608,7 +609,7 @@ static int bcm_char_ioctl_led_thread_state_change_req(void 
__user *argp,
return -EINVAL;
 
if (copy_from_user(threadReq, IoBuffer.InputBuffer,
-   IoBuffer.InputLength))
+  IoBuffer.InputLength))
return -EFAULT;
 
/* if LED thread is running(Actively or Inactively)
@@ -634,7 +635,7 @@ static int bcm_char_ioctl_led_thread_state_change_req(void 
__user *argp,
 }
 
 static int bcm_char_ioctl_gpio_status_request(void __user *argp,
-   struct bcm_mini_adapter *Adapter)
+   struct bcm_mini_adapter *Adapter)
 {
struct bcm_gpio_info gpio_info = {0};
struct bcm_ioctl_buffer IoBuffer;
@@ -676,7 +677,7 @@ static int bcm_char_ioctl_gpio_status_request(void __user 
*argp,
 }
 
 static int bcm_char_ioctl_gpio_multi_request(void __user *argp,
-   struct bcm_mini_adapter *Adapter)
+   struct bcm_mini_adapter *Adapter)
 {
struct bcm_gpio_multi_info gpio_multi_info[MAX_IDX];
struct bcm_gpio_multi_info *pgpio_multi_info =
@@ -687,7 +688,7 @@ static int bcm_char_ioctl_gpio_multi_request(void __user 
*argp,
int bytes;
 
memset(pgpio_multi_info, 0,
-   MAX_IDX * sizeof(struct bcm_gpio_multi_info));
+  MAX_IDX * sizeof(struct bcm_gpio_multi_info));
 
if ((Adapter-IdleMode == TRUE) ||
(Adapter-bShutStatus == TRUE) ||
@@ -703,11 +704,11 @@ static int bcm_char_ioctl_gpio_multi_request(void __user 
*argp,
IoBuffer.OutputLength = sizeof(gpio_multi_info);
 
if (copy_from_user(gpio_multi_info, IoBuffer.InputBuffer,
-   IoBuffer.InputLength))
+  IoBuffer.InputLength))
return -EFAULT;
 
-   if (IsReqGpioIsLedInNVM(Adapter,
-   pgpio_multi_info[WIMAX_IDX].uiGPIOMask) == false) {
+   if (IsReqGpioIsLedInNVM(Adapter, pgpio_multi_info[WIMAX_IDX].uiGPIOMask)
+   == 

Re: [PATCH v3 0/4] Staging: bcm: Bcmchar.c cleanup patches

2014-05-22 Thread Dan Carpenter
Looks ok now.  Thanks.  :)

regards,
dan carpenter

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


RE: [PATCH 0/2] scsi: hyper-v storvsc changes by Ubuntu

2014-05-22 Thread KY Srinivasan


 -Original Message-
 From: Andy Whitcroft [mailto:a...@canonical.com]
 Sent: Wednesday, May 21, 2014 7:25 AM
 To: Ian Abbott
 Cc: linux-s...@vger.kernel.org; de...@linuxdriverproject.org; KY Srinivasan;
 Haiyang Zhang; James E.J. Bottomley; Tim Gardner
 Subject: Re: [PATCH 0/2] scsi: hyper-v storvsc changes by Ubuntu
 
 On 16 May 2014 16:39, Ian Abbott abbo...@mev.co.uk wrote:
  These changes to the Microsoft Hyper-V storage driver in Ubuntu
  Saucy's
  3.13 kernel look useful for the mainline kernel, especially as they
  enable 'TRIM' support.
 
  Andy Whitcroft (2):
scsi: hyper-v storvsc switch up to SPC-3
scsi: hyper-v storvsc -- host takes MAINTENANCE_IN commands badly --
  elide them
 
   drivers/scsi/storvsc_drv.c | 10 ++
   1 file changed, 10 insertions(+)
 
 
 The back story here is a little complex.  The main issue is that the Hyper-V
 drives claim to be SPC-2, and yet implement the SPC-3 extensions for TRIM.
 We did attempt to upstream quirks to allow these features to be negotiated
 specifically for the Hyper-V virtual drives (minimum regression potential) but
 these were NAKd, and it was suggested that just overriding the Hyper-V
 drives to SPC-3 unconditionally was more appropriate.  The first of the
 patches here does does this.  This has been sitting in our tree for some time
 as it was not clear that this would be entirely safe, though the SPC-3 bits 
 are
 in theory at least mostly detected.  That said this change has been in Ubuntu
 for a full cycle now and does not seem to have caused any issues.  If KY is
 happy we should likely submit it formally.  The second fix I believed was
 already being submitted to mainline.
 
 KY?

The Windows guys are not currently comfortable claiming conformance to SPC-3, 
as they have not done
the necessary testing. This will change hopefully soon.

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


[PATCH] staging: rtl8723au: Use kmemdup() instead of memcpy() to duplicate memory

2014-05-22 Thread Benoit Taine
This issue was reported by coccicheck using the semantic patch 
at scripts/coccinelle/api/memdup.cocci, and tested by compilation.

Signed-off-by: Benoit Taine benoit.ta...@lip6.fr
---
 drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c |3 +--
 drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c |   17 +++--
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c 
b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
index e2d426a..f917edd 100644
--- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
+++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
@@ -339,12 +339,11 @@ int rtl8723a_FirmwareDownload(struct rtw_adapter 
*padapter)
rtStatus = _FAIL;
goto Exit;
}
-   firmware_buf = kzalloc(fw-size, GFP_KERNEL);
+   firmware_buf = kmemdup(fw-data, fw-size, GFP_KERNEL);
if (!firmware_buf) {
rtStatus = _FAIL;
goto Exit;
}
-   memcpy(firmware_buf, fw-data, fw-size);
buf = firmware_buf;
fw_size = fw-size;
release_firmware(fw);
diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
index 182f57c..c88a416 100644
--- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
@@ -1426,14 +1426,14 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct 
rtw_adapter *padapter,
pmlmepriv-wps_probe_req_ie = NULL;
}
 
-   pmlmepriv-wps_probe_req_ie =
-   kmalloc(wps_ielen, GFP_KERNEL);
+   pmlmepriv-wps_probe_req_ie = kmemdup(wps_ie,
+ wps_ielen,
+ GFP_KERNEL);
if (pmlmepriv-wps_probe_req_ie == NULL) {
DBG_8723A(%s()-%d: kmalloc() ERROR!\n,
  __func__, __LINE__);
return -EINVAL;
}
-   memcpy(pmlmepriv-wps_probe_req_ie, wps_ie, wps_ielen);
pmlmepriv-wps_probe_req_ie_len = wps_ielen;
}
}
@@ -1697,12 +1697,11 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter 
*padapter, const u8 *pie,
ret = -EINVAL;
goto exit;
}
-   buf = kzalloc(ielen, GFP_KERNEL);
+   buf = kmemdup(pie, ielen, GFP_KERNEL);
if (buf == NULL) {
ret = -ENOMEM;
goto exit;
}
-   memcpy(buf, pie, ielen);
 
/* dump */
DBG_8723A(set wpa_ie(length:%zu):\n, ielen);
@@ -3178,14 +3177,13 @@ static int rtw_cfg80211_set_beacon_wpsp2pie(struct 
net_device *ndev, char *buf,
pmlmepriv-wps_beacon_ie = NULL;
}
 
-   pmlmepriv-wps_beacon_ie =
-   kmalloc(wps_ielen, GFP_KERNEL);
+   pmlmepriv-wps_beacon_ie = kmemdup(wps_ie, wps_ielen,
+  GFP_KERNEL);
if (pmlmepriv-wps_beacon_ie == NULL) {
DBG_8723A(%s()-%d: kmalloc() ERROR!\n,
  __func__, __LINE__);
return -EINVAL;
}
-   memcpy(pmlmepriv-wps_beacon_ie, wps_ie, wps_ielen);
pmlmepriv-wps_beacon_ie_len = wps_ielen;
 
 #ifdef CONFIG_8723AU_AP_MODE
@@ -3270,14 +3268,13 @@ static int rtw_cfg80211_set_assoc_resp_wpsp2pie(struct 
net_device *net,
pmlmepriv-wps_assoc_resp_ie = NULL;
}
 
-   pmlmepriv-wps_assoc_resp_ie = kmalloc(len, GFP_KERNEL);
+   pmlmepriv-wps_assoc_resp_ie = kmemdup(buf, len, GFP_KERNEL);
if (pmlmepriv-wps_assoc_resp_ie == NULL) {
DBG_8723A(%s()-%d: kmalloc() ERROR!\n,
  __func__, __LINE__);
return -EINVAL;
 
}
-   memcpy(pmlmepriv-wps_assoc_resp_ie, buf, len);
pmlmepriv-wps_assoc_resp_ie_len = len;
}
 

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


Re: [PATCH 0/2] scsi: hyper-v storvsc changes by Ubuntu

2014-05-22 Thread James Bottomley
On Thu, 2014-05-22 at 10:49 +, KY Srinivasan wrote:
 
 
  -Original Message-
  From: Andy Whitcroft [mailto:a...@canonical.com]
  Sent: Wednesday, May 21, 2014 7:25 AM
  To: Ian Abbott
  Cc: linux-s...@vger.kernel.org; de...@linuxdriverproject.org; KY Srinivasan;
  Haiyang Zhang; James E.J. Bottomley; Tim Gardner
  Subject: Re: [PATCH 0/2] scsi: hyper-v storvsc changes by Ubuntu
  
  On 16 May 2014 16:39, Ian Abbott abbo...@mev.co.uk wrote:
   These changes to the Microsoft Hyper-V storage driver in Ubuntu
   Saucy's
   3.13 kernel look useful for the mainline kernel, especially as they
   enable 'TRIM' support.
  
   Andy Whitcroft (2):
 scsi: hyper-v storvsc switch up to SPC-3
 scsi: hyper-v storvsc -- host takes MAINTENANCE_IN commands badly --
   elide them
  
drivers/scsi/storvsc_drv.c | 10 ++
1 file changed, 10 insertions(+)
  
  
  The back story here is a little complex.  The main issue is that the Hyper-V
  drives claim to be SPC-2, and yet implement the SPC-3 extensions for TRIM.
  We did attempt to upstream quirks to allow these features to be negotiated
  specifically for the Hyper-V virtual drives (minimum regression potential) 
  but
  these were NAKd, and it was suggested that just overriding the Hyper-V
  drives to SPC-3 unconditionally was more appropriate.  The first of the
  patches here does does this.  This has been sitting in our tree for some 
  time
  as it was not clear that this would be entirely safe, though the SPC-3 bits 
  are
  in theory at least mostly detected.  That said this change has been in 
  Ubuntu
  for a full cycle now and does not seem to have caused any issues.  If KY is
  happy we should likely submit it formally.  The second fix I believed was
  already being submitted to mainline.
  
  KY?
 
 The Windows guys are not currently comfortable claiming conformance to
 SPC-3, as they have not done
 the necessary testing. This will change hopefully soon.

Any bounds on the value of soon are we talking weeks or months?  I
think trim is a feature, which means no huge rush to get this in, but it
is nice to respond in a timely fashion to a request from a distribution
to enable a useful feature.

James


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


RE: [PATCH 1/2] staging: comedi: addi_apci_1564: move apci1564_di_insn_bits() to addi_apci_1564.c

2014-05-22 Thread Hartley Sweeten
On Wednesday, May 21, 2014 5:40 PM, Chase Southwood wrote:

 This function is already compliant with the comedi API and is behaving as
 comedi core expects.  This patch moves it out of
 addi-data/hwdrv_apci1564.c and into the driver proper since no further
 work needs to be done on it.

 Cc: Ian Abbott abbo...@mev.co.uk
 Cc: H Hartley Sweeten hswee...@visionengravers.com
 Signed-off-by: Chase Southwood chase.southw...@gmail.com

Reviewed-by: H Hartley Sweeten hswee...@visionengravers.com

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


RE: [PATCH 2/2] staging: comedi: addi_apci_1564: move apci1564_do_insn_bits() to addi_apci_1564.c

2014-05-22 Thread Hartley Sweeten
On Wednesday, May 21, 2014 5:41 PM, Chase Southwood wrote:

 This function is already compliant with the comedi API and is behaving as
 comedi core expects.  This patch moves it out of
 addi-data/hwdrv_apci1564.c and into the driver proper since no further
 work needs to be done on it.

 Cc: Ian Abbott abbo...@mev.co.uk
 Cc: H Hartley Sweeten hswee...@visionengravers.com
 Signed-off-by: Chase Southwood chase.southw...@gmail.com

Reviewed-by: H Hartley Sweeten hswee...@visionengravers.com

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


Re: [PATCH 0/3] staging/skein: more cleanup

2014-05-22 Thread Jake Edge
On Wed, 21 May 2014 01:52:17 +0400 Anton Saraev wrote:
 On Tue, May 20, 2014 at 10:24:11AM -0600, Jake Edge wrote:
  On Tue, 20 May 2014 10:47:57 -0400 Jason Cooper wrote:
 
  but some kind of tests are needed to ensure nothing breaks before
  digging into that ...
 
 I have some test: slightly modified version of tests from
 https://github.com/wernerd/Skein3Fish. It works as debugfs entry
 and require some modification needed for module support
 (public function must be extern). As I can understand Jason
 has his own tests. That would be logical to share them but
 I don't know where.

well, it seems to me that we want tests that eventually can be added
into the crypto test framework once skein moves out of staging and into
crypto ... Jason's objdiff seems like it would be used as another
development tool ...

so do you have your tests anywhere that we can look at them?  or,
failing that, maybe you can just email me a copy off-list or something?

do you have patches pending for skein?  i might get a chance to hack on
this some over the weekend, and we may as well try to avoid duplicating
each other's efforts ...

jake

-- 
Jake Edge - LWN - j...@lwn.net - http://lwn.net
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/3] staging/skein: more cleanup

2014-05-22 Thread Jason Cooper
On Thu, May 22, 2014 at 10:52:06AM -0600, Jake Edge wrote:
 On Wed, 21 May 2014 01:52:17 +0400 Anton Saraev wrote:
  On Tue, May 20, 2014 at 10:24:11AM -0600, Jake Edge wrote:
   On Tue, 20 May 2014 10:47:57 -0400 Jason Cooper wrote:
  
   but some kind of tests are needed to ensure nothing breaks before
   digging into that ...
  
  I have some test: slightly modified version of tests from
  https://github.com/wernerd/Skein3Fish. It works as debugfs entry
  and require some modification needed for module support
  (public function must be extern). As I can understand Jason
  has his own tests. That would be logical to share them but
  I don't know where.
 
 well, it seems to me that we want tests that eventually can be added
 into the crypto test framework once skein moves out of staging and into
 crypto ... Jason's objdiff seems like it would be used as another
 development tool ...
 
 so do you have your tests anywhere that we can look at them?  or,
 failing that, maybe you can just email me a copy off-list or something?

https://github.com/wernerd/Skein3Fish/tree/master/c/test

This is the same repo I pulled the original source files from.  I looked
at integrating into the crypto test framework a few months back and
realized the crypto API needed to be modified to handle tweakable block
ciphers.

 do you have patches pending for skein?  i might get a chance to hack on
 this some over the weekend, and we may as well try to avoid duplicating
 each other's efforts ...

I do not, I'm unsure if Anton has anything pending capable of
upstreaming.

thx,

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


[PATCH 1/6] Staging: unisys: Fix sparse warnings

2014-05-22 Thread Ken Cox
Fix sparse warnings caused by incorrect references to IO space.

Signed-off-by: Ken Cox j...@redhat.com
---
 drivers/staging/unisys/uislib/uislib.c   | 2 +-
 drivers/staging/unisys/visorchannel/visorchannel.h   | 6 +++---
 drivers/staging/unisys/visorchannel/visorchannel_funcs.c | 4 ++--
 drivers/staging/unisys/visorutil/memregion.h | 2 +-
 drivers/staging/unisys/visorutil/memregion_direct.c  | 6 +++---
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/unisys/uislib/uislib.c 
b/drivers/staging/unisys/uislib/uislib.c
index 166a518..e3903ee 100644
--- a/drivers/staging/unisys/uislib/uislib.c
+++ b/drivers/staging/unisys/uislib/uislib.c
@@ -131,7 +131,7 @@ init_msg_header(CONTROLVM_MESSAGE *msg, U32 id, uint rsp, 
uint svr)
 static __iomem void *
 init_vbus_channel(U64 channelAddr, U32 channelBytes, int isServer)
 {
-   void *rc = NULL;
+   void __iomem *rc = NULL;
void __iomem *pChan = uislib_ioremap_cache(channelAddr, channelBytes);
if (!pChan) {
LOGERR(CONTROLVM_BUS_CREATE error: ioremap_cache of 
channelAddr:%Lx for channelBytes:%llu failed,
diff --git a/drivers/staging/unisys/visorchannel/visorchannel.h 
b/drivers/staging/unisys/visorchannel/visorchannel.h
index a00dfb5..784f03a 100644
--- a/drivers/staging/unisys/visorchannel/visorchannel.h
+++ b/drivers/staging/unisys/visorchannel/visorchannel.h
@@ -73,11 +73,11 @@ void visorchannel_debug(VISORCHANNEL *channel, int nQueues,
struct seq_file *seq, U32 off);
 void visorchannel_dump_section(VISORCHANNEL *chan, char *s,
   int off, int len, struct seq_file *seq);
-void *visorchannel_get_header(VISORCHANNEL *channel);
+void __iomem *visorchannel_get_header(VISORCHANNEL *channel);
 
 #defineVISORCHANNEL_CHANGE_SERVER_STATE(chan, chanId, newstate)
\
do {\
-   U8 *p = (U8 *)visorchannel_get_header(chan);\
+   U8 *p = (U8 __iomem *)visorchannel_get_header(chan);\
if (p) {\
ULTRA_CHANNEL_SERVER_TRANSITION(p, chanId, SrvState, \
newstate, logCtx); \
@@ -92,7 +92,7 @@ void *visorchannel_get_header(VISORCHANNEL *channel);
 
 #defineVISORCHANNEL_CHANGE_CLIENT_STATE(chan, chanId, newstate)
\
do {\
-   U8 *p = (U8 *)visorchannel_get_header(chan);\
+   U8 *p = (U8 __iomem *)visorchannel_get_header(chan);\
if (p) {\
ULTRA_CHANNEL_CLIENT_TRANSITION(p, chanId,  \
newstate, logCtx); \
diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c 
b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
index bc4fc67..a44da7c 100644
--- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
+++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c
@@ -279,10 +279,10 @@ Away:
 }
 EXPORT_SYMBOL_GPL(visorchannel_clear);
 
-void *
+void __iomem  *
 visorchannel_get_header(VISORCHANNEL *channel)
 {
-   return (void *) (channel-chan_hdr);
+   return (void __iomem *) (channel-chan_hdr);
 }
 EXPORT_SYMBOL_GPL(visorchannel_get_header);
 
diff --git a/drivers/staging/unisys/visorutil/memregion.h 
b/drivers/staging/unisys/visorutil/memregion.h
index 7966316..f4a65d2 100644
--- a/drivers/staging/unisys/visorutil/memregion.h
+++ b/drivers/staging/unisys/visorutil/memregion.h
@@ -38,6 +38,6 @@ HOSTADDRESS visor_memregion_get_physaddr(MEMREGION 
*memregion);
 ulong visor_memregion_get_nbytes(MEMREGION *memregion);
 void memregion_dump(MEMREGION *memregion, char *s,
ulong off, ulong len, struct seq_file *seq);
-void *visor_memregion_get_pointer(MEMREGION *memregion);
+void __iomem *visor_memregion_get_pointer(MEMREGION *memregion);
 
 #endif
diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c 
b/drivers/staging/unisys/visorutil/memregion_direct.c
index d39fde9..28dfba0 100644
--- a/drivers/staging/unisys/visorutil/memregion_direct.c
+++ b/drivers/staging/unisys/visorutil/memregion_direct.c
@@ -29,7 +29,7 @@
 struct MEMREGION_Tag {
HOSTADDRESS physaddr;
ulong nbytes;
-   void *mapped;
+   void __iomem *mapped;
BOOL requested;
BOOL overlapped;
 };
@@ -93,7 +93,7 @@ visor_memregion_create_overlapped(MEMREGION *parent, ulong 
offset, ulong nbytes)
 
memregion-physaddr = parent-physaddr + offset;
memregion-nbytes = nbytes;
-   memregion-mapped = ((u8 *) (parent-mapped)) + offset;
+   memregion-mapped = ((u8 __iomem *) (parent-mapped)) + offset;
memregion-requested = FALSE;
  

[PATCH 0/6] Staging: unisys: code cleanup patches

2014-05-22 Thread Ken Cox
This series of patches cleans up the unisys driver code in various ways:
-fix sparse warnings related to accessing I/O space
-fix sparse warnings related to dereferencing noderef types
-add static to function declration 
-remove unused functions and macros

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


[PATCH 3/6] Staging: unisys: virthba: declare virthba_queue_command as static

2014-05-22 Thread Ken Cox
virthba_queue_command() is only used inside virthba.c so declare it static.

Signed-off-by: Ken Cox j...@redhat.com
---
 drivers/staging/unisys/virthba/virthba.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/virthba/virthba.c 
b/drivers/staging/unisys/virthba/virthba.c
index d528388..5c5aa70 100644
--- a/drivers/staging/unisys/virthba/virthba.c
+++ b/drivers/staging/unisys/virthba/virthba.c
@@ -91,7 +91,7 @@ static const struct x86_cpu_id unisys_spar_ids[] = {
 MODULE_DEVICE_TABLE(x86cpu, unisys_spar_ids);
 
 #ifdef DEF_SCSI_QCMD
-DEF_SCSI_QCMD(virthba_queue_command)
+static DEF_SCSI_QCMD(virthba_queue_command)
 #else
 #define virthba_queue_command virthba_queue_command_lck
 #endif
-- 
1.8.5.3

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


[PATCH 2/6] Staging: unisys: Fix sparse warnings in uislib

2014-05-22 Thread Ken Cox
Added ULTRA_VBUS_IOinit_channel() and modified ULTRA_VBUS_init_channel()
function so that it can operate on both memory space and IO space
without getting sparse warnings.

Signed-off-by: Ken Cox j...@redhat.com
---
 .../unisys/common-spar/include/channels/vbuschannel.h| 12 ++--
 drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h  | 11 ++-
 drivers/staging/unisys/uislib/uislib.c   |  2 +-
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h 
b/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h
index 0dd3e2d..a624e9e 100644
--- a/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h
+++ b/drivers/staging/unisys/common-spar/include/channels/vbuschannel.h
@@ -94,8 +94,8 @@ typedef struct _ULTRA_VBUS_CHANNEL_PROTOCOL {
sizeof(ULTRA_VBUS_DEVICEINFO)))
 #define VBUS_CH_SIZE(MAXDEVICES) COVER(VBUS_CH_SIZE_EXACT(MAXDEVICES), 4096)
 
-static INLINE void
-ULTRA_VBUS_init_channel(ULTRA_VBUS_CHANNEL_PROTOCOL __iomem *x,
+static inline void
+ULTRA_VBUS_IOinit_channel(ULTRA_VBUS_CHANNEL_PROTOCOL __iomem *x,
int bytesAllocated)
 {
/* Please note that the memory at x does NOT necessarily have space
@@ -130,6 +130,14 @@ ULTRA_VBUS_init_channel(ULTRA_VBUS_CHANNEL_PROTOCOL 
__iomem *x,
   x-HdrInfo.devInfoCount);
 }
 
+static inline void
+ULTRA_VBUS_init_channel(ULTRA_VBUS_CHANNEL_PROTOCOL *x, int bytesAllocated)
+{
+   ULTRA_VBUS_IOinit_channel(
+   (__force ULTRA_VBUS_CHANNEL_PROTOCOL __iomem *)x,
+   bytesAllocated);
+}
+
 #pragma pack(pop)
 
 #endif
diff --git a/drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h 
b/drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h
index 8c0259a..4ae6960 100644
--- a/drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h
+++ b/drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h
@@ -146,7 +146,7 @@ VBUSCHANNEL_itoa(char *p, int remain, int num)
  * Returns the number of bytes written to p.
  */
 static inline int
-VBUSCHANNEL_devInfoToStringBuffer(ULTRA_VBUS_DEVICEINFO __iomem *devInfo,
+VBUSCHANNEL_IOdevInfoToStringBuffer(ULTRA_VBUS_DEVICEINFO __iomem *devInfo,
  char *p, int remain, int devix)
 {
char __iomem *psrc;
@@ -206,4 +206,13 @@ VBUSCHANNEL_devInfoToStringBuffer(ULTRA_VBUS_DEVICEINFO 
__iomem *devInfo,
return chars;
 }
 
+static inline int
+VBUSCHANNEL_devInfoToStringBuffer(ULTRA_VBUS_DEVICEINFO *devInfo,
+ char *p, int remain, int devix)
+{
+   return VBUSCHANNEL_IOdevInfoToStringBuffer(
+   (ULTRA_VBUS_DEVICEINFO __force __iomem *)devInfo,
+   p, remain, devix);
+}
+
 #endif
diff --git a/drivers/staging/unisys/uislib/uislib.c 
b/drivers/staging/unisys/uislib/uislib.c
index e3903ee..4ad0880 100644
--- a/drivers/staging/unisys/uislib/uislib.c
+++ b/drivers/staging/unisys/uislib/uislib.c
@@ -148,7 +148,7 @@ init_vbus_channel(U64 channelAddr, U32 channelBytes, int 
isServer)
rc = NULL;
goto Away;
}
-   ULTRA_VBUS_init_channel(pChan, channelBytes);
+   ULTRA_VBUS_IOinit_channel(pChan, channelBytes);
} else {
if (!ULTRA_VBUS_CHANNEL_OK_CLIENT(pChan, NULL)) {
ERRDRV(%s channel cannot be used, __func__);
-- 
1.8.5.3

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


[PATCH 5/6] Staging: unisys: Fixup sparse warnings for dereferencing noderef types.

2014-05-22 Thread Ken Cox
Fixed the usage of the following so they don't try to dereference
pointers to iomem.
CHANNEL_U64_MISMATCH
CHANNEL_U32_MISMATCH
wait_for_valid_guid

Signed-off-by: Ken Cox j...@redhat.com
---
 .../unisys/common-spar/include/channels/channel.h  | 16 ---
 drivers/staging/unisys/include/uisutils.h  | 23 ++
 drivers/staging/unisys/uislib/uislib.c |  4 ++--
 3 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/unisys/common-spar/include/channels/channel.h 
b/drivers/staging/unisys/common-spar/include/channels/channel.h
index 237a852..d19711d 100644
--- a/drivers/staging/unisys/common-spar/include/channels/channel.h
+++ b/drivers/staging/unisys/common-spar/include/channels/channel.h
@@ -333,8 +333,9 @@ ULTRA_check_channel_client(void __iomem *pChannel,
   (pChannel))-Size)  expectedMinBytes) {
CHANNEL_U64_MISMATCH(expectedTypeGuid, channelName,
 size, expectedMinBytes,
-((CHANNEL_HEADER __iomem *)
- (pChannel))-Size, fileName,
+readq(((CHANNEL_HEADER __iomem *)
+(pChannel))-Size),
+fileName,
 lineNumber, logCtx);
return 0;
}
@@ -344,9 +345,9 @@ ULTRA_check_channel_client(void __iomem *pChannel,
!= expectedVersionId) {
CHANNEL_U32_MISMATCH(expectedTypeGuid, channelName,
 version, expectedVersionId,
-((CHANNEL_HEADER __iomem *)
- (pChannel))-VersionId, fileName,
-lineNumber, logCtx);
+readl(((CHANNEL_HEADER __iomem *)
+(pChannel))-VersionId),
+fileName, lineNumber, logCtx);
return 0;
}
if (expectedSignature  0)  /* caller wants us to verify
@@ -355,8 +356,9 @@ ULTRA_check_channel_client(void __iomem *pChannel,
!= expectedSignature) {
CHANNEL_U64_MISMATCH(expectedTypeGuid, channelName,
 signature, expectedSignature,
-((CHANNEL_HEADER __iomem *)
- (pChannel))-Signature, fileName,
+readq(((CHANNEL_HEADER __iomem *)
+(pChannel))-Signature),
+fileName,
 lineNumber, logCtx);
return 0;
}
diff --git a/drivers/staging/unisys/include/uisutils.h 
b/drivers/staging/unisys/include/uisutils.h
index f4845f2..70776c9 100644
--- a/drivers/staging/unisys/include/uisutils.h
+++ b/drivers/staging/unisys/include/uisutils.h
@@ -194,14 +194,21 @@ struct chaninfo {
  * correctly at DEVICE_CREATE time, INSTEAD OF waiting until
  * DEVICE_CONFIGURE time.
  */
-#define WAIT_FOR_VALID_GUID(guid) \
-   do {   \
-   while (uuid_le_cmp(guid, NULL_UUID_LE) == 0) {  \
-   LOGERR(Waiting for non-0 GUID (why???)...\n); \
-   UIS_THREAD_WAIT_SEC(5); \
-   }   \
-   LOGERR(OK... GUID is non-0 now\n);\
-   } while (0)
+static inline void
+wait_for_valid_guid(uuid_le __iomem *guid)
+{
+   uuid_le tmpguid;
+
+   while (1) {
+   memcpy_fromio((void *)tmpguid,
+ (void __iomem *)guid, sizeof(uuid_le));
+   if (uuid_le_cmp(tmpguid, NULL_UUID_LE) != 0)
+   break;
+   LOGERR(Waiting for non-0 GUID (why???)...\n);
+   UIS_THREAD_WAIT_SEC(5);
+   }
+   LOGERR(OK... GUID is non-0 now\n);
+}
 
 /* CopyFragsInfoFromSkb returns the number of entries added to frags array
  * Returns -1 on failure.
diff --git a/drivers/staging/unisys/uislib/uislib.c 
b/drivers/staging/unisys/uislib/uislib.c
index 4ad0880..2afe441 100644
--- a/drivers/staging/unisys/uislib/uislib.c
+++ b/drivers/staging/unisys/uislib/uislib.c
@@ -447,7 +447,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
struct guest_msgs cmd;
if (!uuid_le_cmp(dev-channelTypeGuid,
 

[PATCH 6/6] Staging: unisys: visorchipset: Remove filexfer.c

2014-05-22 Thread Ken Cox
There is not any code using the functionality in filexfer.c so I removed it
and filexfer.h.

Signed-off-by: Ken Cox j...@redhat.com
---
 drivers/staging/unisys/visorchipset/Makefile   |   2 +-
 drivers/staging/unisys/visorchipset/filexfer.c | 506 -
 drivers/staging/unisys/visorchipset/filexfer.h | 147 --
 .../unisys/visorchipset/visorchipset_main.c|   8 -
 4 files changed, 1 insertion(+), 662 deletions(-)
 delete mode 100644 drivers/staging/unisys/visorchipset/filexfer.c
 delete mode 100644 drivers/staging/unisys/visorchipset/filexfer.h

diff --git a/drivers/staging/unisys/visorchipset/Makefile 
b/drivers/staging/unisys/visorchipset/Makefile
index f5e8650..ead4b9c 100644
--- a/drivers/staging/unisys/visorchipset/Makefile
+++ b/drivers/staging/unisys/visorchipset/Makefile
@@ -4,7 +4,7 @@
 
 obj-$(CONFIG_UNISYS_VISORCHIPSET)  += visorchipset.o
 
-visorchipset-y := visorchipset_main.o controlvm_direct.o file.o filexfer.o \
+visorchipset-y := visorchipset_main.o controlvm_direct.o file.o \
parser.o
 
 ccflags-y += -Idrivers/staging/unisys/include
diff --git a/drivers/staging/unisys/visorchipset/filexfer.c 
b/drivers/staging/unisys/visorchipset/filexfer.c
deleted file mode 100644
index f950d6e..000
--- a/drivers/staging/unisys/visorchipset/filexfer.c
+++ /dev/null
@@ -1,506 +0,0 @@
-/* filexfer.c
- *
- * Copyright � 2013 - 2013 UNISYS CORPORATION
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- */
-
-/* Code here-in is the glue that connects controlvm messages with the
- * sparfilexfer driver, which is used to transfer file contents as payload
- * across the controlvm channel.
- */
-
-#include globals.h
-#include controlvm.h
-#include visorchipset.h
-#include filexfer.h
-
-#ifdef ENABLE_SPARFILEXFER /* sparfilexfer kernel module enabled in build */
-#include sparfilexfer.h
-
-/* Driver-global memory */
-static LIST_HEAD(Request_list);/* list of struct any_request *, via
-* req_list memb */
-
-/* lock for above pool for allocation of any_request structs, and pool
-* name; note that kmem_cache_create requires that we keep the storage
-* for the pool name for the life of the pool
- */
-static DEFINE_SPINLOCK(Request_list_lock);
-
-static struct kmem_cache *Request_memory_pool;
-static const char Request_memory_pool_name[] = filexfer_request_pool;
-size_t Caller_req_context_bytes = 0;   /* passed to filexfer_constructor() */
-
-/* This structure defines a single controlvm GETFILE conversation, which
- * consists of a single controlvm request message and 1 or more controlvm
- * response messages.
- */
-struct getfile_request {
-   CONTROLVM_MESSAGE_HEADER controlvm_header;
-   atomic_t buffers_in_use;
-   GET_CONTIGUOUS_CONTROLVM_PAYLOAD_FUNC get_contiguous_controlvm_payload;
-   CONTROLVM_RESPOND_WITH_PAYLOAD_FUNC controlvm_respond_with_payload;
-};
-
-/* This structure defines a single controlvm PUTFILE conversation, which
- * consists of a single controlvm request with a filename, and additional
- * controlvm messages with file data.
- */
-struct putfile_request {
-   GET_CONTROLVM_FILEDATA_FUNC get_controlvm_filedata;
-   CONTROLVM_RESPOND_FUNC controlvm_end_putFile;
-};
-
-/* This structure defines a single file transfer operation, which can either
- * be a GETFILE or PUTFILE.
- */
-struct any_request {
-   struct list_head req_list;
-   ulong2 file_request_number;
-   ulong2 data_sequence_number;
-   TRANSMITFILE_DUMP_FUNC dump_func;
-   BOOL is_get;
-   union {
-   struct getfile_request get;
-   struct putfile_request put;
-   };
-   /* Size of caller_context_data will be
-* Caller_req_context_bytes bytes.  I aligned this because I
-* am paranoid about what happens when an arbitrary data
-* structure with unknown alignment requirements gets copied
-* here.  I want caller_context_data to be aligned to the
-* coarsest possible alignment boundary that could be required
-* for any user data structure.
-*/
-   u8 caller_context_data[1] __aligned(sizeof(ulong2));
-};
-
-/*
- * Links the any_request into the global list of allocated requests
- * (Request_list).
- */
-static void
-unit_tracking_create(struct list_head *dev_list_link)
-{
-   unsigned long flags;
-   spin_lock_irqsave(Request_list_lock, flags);
-   

[PATCH 4/6] Staging: unisys: Remove unused macros from visorchannel/visorchannel.h

2014-05-22 Thread Ken Cox
VISORCHANNEL_CHANGE_SERVER_STATE and VISORCHANNEL_CHANGE_CLIENT_STATE
are never used in any of the source so they have been removed.

VISORCHANNEL_CHANGE_CLIENT_STATE would have caused a broken kernel build
after commit  a8d7f21d, but since it was never used the kernel continued
to build.

Reported-by: Dan Carpenter dan.carpen...@oracle.com
Signed-off-by: Ken Cox j...@redhat.com
---
 drivers/staging/unisys/visorchannel/visorchannel.h | 30 --
 1 file changed, 30 deletions(-)

diff --git a/drivers/staging/unisys/visorchannel/visorchannel.h 
b/drivers/staging/unisys/visorchannel/visorchannel.h
index 784f03a..ecf0d11 100644
--- a/drivers/staging/unisys/visorchannel/visorchannel.h
+++ b/drivers/staging/unisys/visorchannel/visorchannel.h
@@ -75,34 +75,4 @@ void visorchannel_dump_section(VISORCHANNEL *chan, char *s,
   int off, int len, struct seq_file *seq);
 void __iomem *visorchannel_get_header(VISORCHANNEL *channel);
 
-#defineVISORCHANNEL_CHANGE_SERVER_STATE(chan, chanId, newstate)
\
-   do {\
-   U8 *p = (U8 __iomem *)visorchannel_get_header(chan);\
-   if (p) {\
-   ULTRA_CHANNEL_SERVER_TRANSITION(p, chanId, SrvState, \
-   newstate, logCtx); \
-   visorchannel_write  \
-   (chan,  \
-offsetof(ULTRA_CHANNEL_PROTOCOL, SrvState), \
-p +\
-offsetof(ULTRA_CHANNEL_PROTOCOL, SrvState), \
-sizeof(U32));  \
-   }   \
-   } while (0)
-
-#defineVISORCHANNEL_CHANGE_CLIENT_STATE(chan, chanId, newstate)
\
-   do {\
-   U8 *p = (U8 __iomem *)visorchannel_get_header(chan);\
-   if (p) {\
-   ULTRA_CHANNEL_CLIENT_TRANSITION(p, chanId,  \
-   newstate, logCtx); \
-   visorchannel_write  \
-   (chan,  \
-offsetof(ULTRA_CHANNEL_PROTOCOL, CliStateOS), \
-p +\
-offsetof(ULTRA_CHANNEL_PROTOCOL, CliStateOS), \
-sizeof(U32));  \
-   }   \
-   } while (0)
-
 #endif
-- 
1.8.5.3

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


[PATCH] staging/rtl8821ae: avoid format string leak to thread name

2014-05-22 Thread Kees Cook
This makes sure the cfg-name can never accidentally be processed as a
format string in the worker thread name.

Signed-off-by: Kees Cook keesc...@chromium.org
---
 drivers/staging/rtl8821ae/base.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8821ae/base.c b/drivers/staging/rtl8821ae/base.c
index a4c9cc437bc6..49ee311ddcd9 100644
--- a/drivers/staging/rtl8821ae/base.c
+++ b/drivers/staging/rtl8821ae/base.c
@@ -404,7 +404,8 @@ static int _rtl_init_deferred_work(struct ieee80211_hw *hw)
 /*delete in kernel start*/
 #if (LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 37))
 /*delete in kernel end*/
-   rtlpriv-works.rtl_wq = alloc_workqueue(rtlpriv-cfg-name, 0, 0);
+   rtlpriv-works.rtl_wq = alloc_workqueue(%s, 0, 0,
+   rtlpriv-cfg-name);
 /*delete in kernel start*/
 #else
rtlpriv-works.rtl_wq = create_workqueue(rtlpriv-cfg-name);
-- 
1.7.9.5


-- 
Kees Cook
Chrome OS Security
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8188eu: os_dep: usb_intf.c: Fix to remove null pointer checks that could never happen

2014-05-22 Thread Rickard Strandqvist
Removal of null pointer checks that could never happen

Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se
---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c |  110 +--
 1 file changed, 52 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index 2e49cd5..3454e1b 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -396,49 +396,47 @@ int rtw_hw_suspend(struct adapter *padapter)
goto error_exit;
}
 
-   if (padapter) { /* system suspend */
-   LeaveAllPowerSaveMode(padapter);
+   /* system suspend */
+   LeaveAllPowerSaveMode(padapter);
 
-   DBG_88E(== rtw_hw_suspend\n);
-   _enter_pwrlock(pwrpriv-lock);
-   pwrpriv-bips_processing = true;
-   /* s1. */
-   if (pnetdev) {
-   netif_carrier_off(pnetdev);
-   rtw_netif_stop_queue(pnetdev);
-   }
+   DBG_88E(== rtw_hw_suspend\n);
+   _enter_pwrlock(pwrpriv-lock);
+   pwrpriv-bips_processing = true;
+   /* s1. */
+   if (pnetdev) {
+   netif_carrier_off(pnetdev);
+   rtw_netif_stop_queue(pnetdev);
+   }
 
-   /* s2. */
-   rtw_disassoc_cmd(padapter, 500, false);
+   /* s2. */
+   rtw_disassoc_cmd(padapter, 500, false);
 
-   /* s2-2.  indicate disconnect to os */
-   {
-   struct  mlme_priv *pmlmepriv = padapter-mlmepriv;
+   /* s2-2.  indicate disconnect to os */
+   {
+   struct  mlme_priv *pmlmepriv = padapter-mlmepriv;
 
-   if (check_fwstate(pmlmepriv, _FW_LINKED)) {
-   _clr_fwstate_(pmlmepriv, _FW_LINKED);
+   if (check_fwstate(pmlmepriv, _FW_LINKED)) {
+   _clr_fwstate_(pmlmepriv, _FW_LINKED);
 
-   rtw_led_control(padapter, LED_CTL_NO_LINK);
+   rtw_led_control(padapter, LED_CTL_NO_LINK);
 
-   rtw_os_indicate_disconnect(padapter);
+   rtw_os_indicate_disconnect(padapter);
 
-   /* donnot enqueue cmd */
-   rtw_lps_ctrl_wk_cmd(padapter, 
LPS_CTRL_DISCONNECT, 0);
-   }
+   /* donnot enqueue cmd */
+   rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 0);
}
-   /* s2-3. */
-   rtw_free_assoc_resources(padapter, 1);
+   }
+   /* s2-3. */
+   rtw_free_assoc_resources(padapter, 1);
 
-   /* s2-4. */
-   rtw_free_network_queue(padapter, true);
-   rtw_ips_dev_unload(padapter);
-   pwrpriv-rf_pwrstate = rf_off;
-   pwrpriv-bips_processing = false;
+   /* s2-4. */
+   rtw_free_network_queue(padapter, true);
+   rtw_ips_dev_unload(padapter);
+   pwrpriv-rf_pwrstate = rf_off;
+   pwrpriv-bips_processing = false;
+
+   _exit_pwrlock(pwrpriv-lock);
 
-   _exit_pwrlock(pwrpriv-lock);
-   } else {
-   goto error_exit;
-   }
return 0;
 
 error_exit:
@@ -452,35 +450,32 @@ int rtw_hw_resume(struct adapter *padapter)
struct net_device *pnetdev = padapter-pnetdev;
 
 
-   if (padapter) { /* system resume */
-   DBG_88E(== rtw_hw_resume\n);
-   _enter_pwrlock(pwrpriv-lock);
-   pwrpriv-bips_processing = true;
-   rtw_reset_drv_sw(padapter);
+   /* system resume */
+   DBG_88E(== rtw_hw_resume\n);
+   _enter_pwrlock(pwrpriv-lock);
+   pwrpriv-bips_processing = true;
+   rtw_reset_drv_sw(padapter);
 
-   if (pm_netdev_open(pnetdev, false) != 0) {
-   _exit_pwrlock(pwrpriv-lock);
-   goto error_exit;
-   }
+   if (pm_netdev_open(pnetdev, false) != 0) {
+   _exit_pwrlock(pwrpriv-lock);
+   goto error_exit;
+   }
 
-   netif_device_attach(pnetdev);
-   netif_carrier_on(pnetdev);
+   netif_device_attach(pnetdev);
+   netif_carrier_on(pnetdev);
 
-   if (!netif_queue_stopped(pnetdev))
-   netif_start_queue(pnetdev);
-   else
-   netif_wake_queue(pnetdev);
+   if (!netif_queue_stopped(pnetdev))
+   netif_start_queue(pnetdev);
+   else
+   netif_wake_queue(pnetdev);
 
-   pwrpriv-bkeepfwalive = false;
-   pwrpriv-brfoffbyhw = false;
+   pwrpriv-bkeepfwalive = false;
+   pwrpriv-brfoffbyhw = false;
 
-   pwrpriv-rf_pwrstate = rf_on;
-   pwrpriv-bips_processing = false;
+   

[PATCH] staging: rtl8192u: r8192U_core.c: Fix to remove null pointer checks that could never happen

2014-05-22 Thread Rickard Strandqvist
Removal of null pointer checks that could never happen

Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se
---
 drivers/staging/rtl8192u/r8192U_core.c |3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 1bb6143..b709750 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -2045,9 +2045,6 @@ static void rtl8192_qos_activate(struct work_struct *work)
u32 u4bAcParam;
int i;
 
-   if (priv == NULL)
-   return;
-
mutex_lock(priv-mutex);
if (priv-ieee80211-state != IEEE80211_LINKED)
goto success;
-- 
1.7.10.4

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


Re: staging: dgap: Question about declaring variables

2014-05-22 Thread Dan Carpenter
On Thu, May 22, 2014 at 01:49:22PM -0400, Mark Hounschell wrote:
 I understand that unnecessarily initializing them is wrong. But if they
 do need initialized, is it preferred to do it in the declaration or in
 the code before it is used?

Which ever is more clear.  It's up to you.  Or do you mean code like
this?

1)
ret = -ENOMEM;
p = kmalloc();
if (!p)
goto err_free_x;

2)
p = kmalloc();
if (!p) {
ret = -ENOMEM;
goto err_free_x;
}

That's also up to the maintainer.  People debate which one is cleaner.
I normally do the second one, unless the rest of the file does the first
one.  The first one apparently is slightly better assembly on current
GCCs.

regards,
dan carpenter

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


Re: [PATCH] staging: rtl8188eu: os_dep: usb_intf.c: Fix to remove null pointer checks that could never happen

2014-05-22 Thread Dan Carpenter
Reviewed-by: Dan Carpenter dan.carpen...@oracle.com

regards,
dan carpenter

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


Re: staging: dgap: Question about declaring variables

2014-05-22 Thread Mark Hounschell
On 05/22/2014 04:38 PM, Dan Carpenter wrote:
 On Thu, May 22, 2014 at 01:49:22PM -0400, Mark Hounschell wrote:
 I understand that unnecessarily initializing them is wrong. But if they
 do need initialized, is it preferred to do it in the declaration or in
 the code before it is used?
 
 Which ever is more clear.  It's up to you.  Or do you mean code like
 this?
 
 1)
   ret = -ENOMEM;
   p = kmalloc();
   if (!p)
   goto err_free_x;
 
 2)
   p = kmalloc();
   if (!p) {
   ret = -ENOMEM;
   goto err_free_x;
   }
 
 That's also up to the maintainer.  People debate which one is cleaner.
 I normally do the second one, unless the rest of the file does the first
 one.  The first one apparently is slightly better assembly on current
 GCCs.
 

Actually something a little more basic. I'm removing unnecessary
initialization of variables in declarations. I guess they are all pretty
much unnecessary??

Should I change something like this:

int function(somevar)
{
int count = 0;

for (something) {
count++;
}

return count;
}

to something like this?

int function(somevar)
{
int count;

count = 0;
for (something) {
count++;
}

return count;
}

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


Re: [PATCH] staging: rtl8188eu: os_dep: usb_intf.c: Fix to remove null pointer checks that could never happen

2014-05-22 Thread Josh Triplett
On Thu, May 22, 2014 at 09:58:02PM +0200, Rickard Strandqvist wrote:
 Removal of null pointer checks that could never happen
 
 Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se

Reviewed-by: Josh Triplett j...@joshtriplett.org

  drivers/staging/rtl8188eu/os_dep/usb_intf.c |  110 
 +--
  1 file changed, 52 insertions(+), 58 deletions(-)
 
 diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
 b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
 index 2e49cd5..3454e1b 100644
 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
 +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
 @@ -396,49 +396,47 @@ int rtw_hw_suspend(struct adapter *padapter)
   goto error_exit;
   }
  
 - if (padapter) { /* system suspend */
 - LeaveAllPowerSaveMode(padapter);
 + /* system suspend */
 + LeaveAllPowerSaveMode(padapter);
  
 - DBG_88E(== rtw_hw_suspend\n);
 - _enter_pwrlock(pwrpriv-lock);
 - pwrpriv-bips_processing = true;
 - /* s1. */
 - if (pnetdev) {
 - netif_carrier_off(pnetdev);
 - rtw_netif_stop_queue(pnetdev);
 - }
 + DBG_88E(== rtw_hw_suspend\n);
 + _enter_pwrlock(pwrpriv-lock);
 + pwrpriv-bips_processing = true;
 + /* s1. */
 + if (pnetdev) {
 + netif_carrier_off(pnetdev);
 + rtw_netif_stop_queue(pnetdev);
 + }
  
 - /* s2. */
 - rtw_disassoc_cmd(padapter, 500, false);
 + /* s2. */
 + rtw_disassoc_cmd(padapter, 500, false);
  
 - /* s2-2.  indicate disconnect to os */
 - {
 - struct  mlme_priv *pmlmepriv = padapter-mlmepriv;
 + /* s2-2.  indicate disconnect to os */
 + {
 + struct  mlme_priv *pmlmepriv = padapter-mlmepriv;
  
 - if (check_fwstate(pmlmepriv, _FW_LINKED)) {
 - _clr_fwstate_(pmlmepriv, _FW_LINKED);
 + if (check_fwstate(pmlmepriv, _FW_LINKED)) {
 + _clr_fwstate_(pmlmepriv, _FW_LINKED);
  
 - rtw_led_control(padapter, LED_CTL_NO_LINK);
 + rtw_led_control(padapter, LED_CTL_NO_LINK);
  
 - rtw_os_indicate_disconnect(padapter);
 + rtw_os_indicate_disconnect(padapter);
  
 - /* donnot enqueue cmd */
 - rtw_lps_ctrl_wk_cmd(padapter, 
 LPS_CTRL_DISCONNECT, 0);
 - }
 + /* donnot enqueue cmd */
 + rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 0);
   }
 - /* s2-3. */
 - rtw_free_assoc_resources(padapter, 1);
 + }
 + /* s2-3. */
 + rtw_free_assoc_resources(padapter, 1);
  
 - /* s2-4. */
 - rtw_free_network_queue(padapter, true);
 - rtw_ips_dev_unload(padapter);
 - pwrpriv-rf_pwrstate = rf_off;
 - pwrpriv-bips_processing = false;
 + /* s2-4. */
 + rtw_free_network_queue(padapter, true);
 + rtw_ips_dev_unload(padapter);
 + pwrpriv-rf_pwrstate = rf_off;
 + pwrpriv-bips_processing = false;
 +
 + _exit_pwrlock(pwrpriv-lock);
  
 - _exit_pwrlock(pwrpriv-lock);
 - } else {
 - goto error_exit;
 - }
   return 0;
  
  error_exit:
 @@ -452,35 +450,32 @@ int rtw_hw_resume(struct adapter *padapter)
   struct net_device *pnetdev = padapter-pnetdev;
  
  
 - if (padapter) { /* system resume */
 - DBG_88E(== rtw_hw_resume\n);
 - _enter_pwrlock(pwrpriv-lock);
 - pwrpriv-bips_processing = true;
 - rtw_reset_drv_sw(padapter);
 + /* system resume */
 + DBG_88E(== rtw_hw_resume\n);
 + _enter_pwrlock(pwrpriv-lock);
 + pwrpriv-bips_processing = true;
 + rtw_reset_drv_sw(padapter);
  
 - if (pm_netdev_open(pnetdev, false) != 0) {
 - _exit_pwrlock(pwrpriv-lock);
 - goto error_exit;
 - }
 + if (pm_netdev_open(pnetdev, false) != 0) {
 + _exit_pwrlock(pwrpriv-lock);
 + goto error_exit;
 + }
  
 - netif_device_attach(pnetdev);
 - netif_carrier_on(pnetdev);
 + netif_device_attach(pnetdev);
 + netif_carrier_on(pnetdev);
  
 - if (!netif_queue_stopped(pnetdev))
 - netif_start_queue(pnetdev);
 - else
 - netif_wake_queue(pnetdev);
 + if (!netif_queue_stopped(pnetdev))
 + netif_start_queue(pnetdev);
 + else
 + netif_wake_queue(pnetdev);
  
 - pwrpriv-bkeepfwalive = false;
 - pwrpriv-brfoffbyhw = false;
 + pwrpriv-bkeepfwalive = false;
 + pwrpriv-brfoffbyhw = false;
  
 - pwrpriv-rf_pwrstate = rf_on;
 - 

RE: [PATCH 0/2] scsi: hyper-v storvsc changes by Ubuntu

2014-05-22 Thread KY Srinivasan


 -Original Message-
 From: James Bottomley [mailto:james.bottom...@hansenpartnership.com]
 Sent: Thursday, May 22, 2014 7:38 AM
 To: KY Srinivasan
 Cc: Andy Whitcroft; Ian Abbott; linux-s...@vger.kernel.org;
 de...@linuxdriverproject.org; Haiyang Zhang; Tim Gardner
 Subject: Re: [PATCH 0/2] scsi: hyper-v storvsc changes by Ubuntu
 
 On Thu, 2014-05-22 at 10:49 +, KY Srinivasan wrote:
 
 
   -Original Message-
   From: Andy Whitcroft [mailto:a...@canonical.com]
   Sent: Wednesday, May 21, 2014 7:25 AM
   To: Ian Abbott
   Cc: linux-s...@vger.kernel.org; de...@linuxdriverproject.org; KY
   Srinivasan; Haiyang Zhang; James E.J. Bottomley; Tim Gardner
   Subject: Re: [PATCH 0/2] scsi: hyper-v storvsc changes by Ubuntu
  
   On 16 May 2014 16:39, Ian Abbott abbo...@mev.co.uk wrote:
These changes to the Microsoft Hyper-V storage driver in Ubuntu
Saucy's
3.13 kernel look useful for the mainline kernel, especially as
they enable 'TRIM' support.
   
Andy Whitcroft (2):
  scsi: hyper-v storvsc switch up to SPC-3
  scsi: hyper-v storvsc -- host takes MAINTENANCE_IN commands badly
 --
elide them
   
 drivers/scsi/storvsc_drv.c | 10 ++
 1 file changed, 10 insertions(+)
  
  
   The back story here is a little complex.  The main issue is that the
   Hyper-V drives claim to be SPC-2, and yet implement the SPC-3
 extensions for TRIM.
   We did attempt to upstream quirks to allow these features to be
   negotiated specifically for the Hyper-V virtual drives (minimum
   regression potential) but these were NAKd, and it was suggested that
   just overriding the Hyper-V drives to SPC-3 unconditionally was more
   appropriate.  The first of the patches here does does this.  This
   has been sitting in our tree for some time as it was not clear that
   this would be entirely safe, though the SPC-3 bits are in theory at
   least mostly detected.  That said this change has been in Ubuntu for
   a full cycle now and does not seem to have caused any issues.  If KY
   is happy we should likely submit it formally.  The second fix I believed 
   was
 already being submitted to mainline.
  
   KY?
 
  The Windows guys are not currently comfortable claiming conformance to
  SPC-3, as they have not done the necessary testing. This will change
  hopefully soon.
 
 Any bounds on the value of soon are we talking weeks or months?  I think
 trim is a feature, which means no huge rush to get this in, but it is nice to
 respond in a timely fashion to a request from a distribution to enable a 
 useful
 feature.

James,

I know they have been testing for SPC-3 compliance. I have pinged them to see 
when they may give me
the go ahead. I will keep you posted.

Thanks,

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


[PATCH] Staging: Media: sn9c102: Fixed a pointer declaration coding style issue

2014-05-22 Thread Chaitanya
Fixed the ERROR thrown off by checkpatch.pl.

Signed-off-by: Chaitanya Hazarey c...@24.io
---
 drivers/staging/media/sn9c102/sn9c102_tas5130d1b.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/media/sn9c102/sn9c102_tas5130d1b.c
b/drivers/staging/media/sn9c102/sn9c102_tas5130d1b.c
index a30bbc4..725de85 100644
--- a/drivers/staging/media/sn9c102/sn9c102_tas5130d1b.c
+++ b/drivers/staging/media/sn9c102/sn9c102_tas5130d1b.c
@@ -23,7 +23,7 @@
 #include sn9c102_devtable.h


-static int tas5130d1b_init(struct sn9c102_device* cam)
+static int tas5130d1b_init(struct sn9c102_device *cam)
 {
  int err;

@@ -36,8 +36,8 @@ static int tas5130d1b_init(struct sn9c102_device* cam)
 }


-static int tas5130d1b_set_ctrl(struct sn9c102_device* cam,
-   const struct v4l2_control* ctrl)
+static int tas5130d1b_set_ctrl(struct sn9c102_device *cam,
+   const struct v4l2_control *ctrl)
 {
  int err = 0;

@@ -56,10 +56,10 @@ static int tas5130d1b_set_ctrl(struct sn9c102_device* cam,
 }


-static int tas5130d1b_set_crop(struct sn9c102_device* cam,
-   const struct v4l2_rect* rect)
+static int tas5130d1b_set_crop(struct sn9c102_device *cam,
+   const struct v4l2_rect *rect)
 {
- struct sn9c102_sensor* s = sn9c102_get_sensor(cam);
+ struct sn9c102_sensor *s = sn9c102_get_sensor(cam);
  u8 h_start = (u8)(rect-left - s-cropcap.bounds.left) + 104,
v_start = (u8)(rect-top - s-cropcap.bounds.top) + 12;
  int err = 0;
@@ -76,8 +76,8 @@ static int tas5130d1b_set_crop(struct sn9c102_device* cam,
 }


-static int tas5130d1b_set_pix_format(struct sn9c102_device* cam,
- const struct v4l2_pix_format* pix)
+static int tas5130d1b_set_pix_format(struct sn9c102_device *cam,
+ const struct v4l2_pix_format *pix)
 {
  int err = 0;

@@ -146,7 +146,7 @@ static const struct sn9c102_sensor tas5130d1b = {
 };


-int sn9c102_probe_tas5130d1b(struct sn9c102_device* cam)
+int sn9c102_probe_tas5130d1b(struct sn9c102_device *cam)
 {
  const struct usb_device_id tas5130d1b_id_table[] = {
  { USB_DEVICE(0x0c45, 0x6024), },
-- 
1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/1] Drivers: scsi: storvsc: Change the limits to reflect the values on the host

2014-05-22 Thread K. Y. Srinivasan
Hyper-V hosts can support multiple targets and multiple channels and larger 
number of
LUNs per target. Update the code to reflect this. With this patch we can 
correctly
enumerate all the paths in a multi-path storage environment.

MS-TFS: 173725

Signed-off-by: K. Y. Srinivasan k...@microsoft.com
Cc: sta...@vger.kernel.org
---
 drivers/scsi/storvsc_drv.c |   36 ++--
 1 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 9969fa1..5a63772 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -331,16 +331,15 @@ static int storvsc_timeout = 180;
 static void storvsc_on_channel_callback(void *context);
 
 /*
- * In Hyper-V, each port/path/target maps to 1 scsi host adapter.  In
- * reality, the path/target is not used (ie always set to 0) so our
- * scsi host adapter essentially has 1 bus with 1 target that contains
- * up to 256 luns.
+ * In Hyper-V, each port/path/target maps to 1 scsi host adapter.
  */
-#define STORVSC_MAX_LUNS_PER_TARGET64
-#define STORVSC_MAX_TARGETS1
-#define STORVSC_MAX_CHANNELS   1
-
+#define STORVSC_MAX_LUNS_PER_TARGET255
+#define STORVSC_MAX_TARGETS2
+#define STORVSC_MAX_CHANNELS   8
 
+#define STORVSC_FC_MAX_LUNS_PER_TARGET 255
+#define STORVSC_FC_MAX_TARGETS 128
+#define STORVSC_FC_MAX_CHANNELS8
 
 struct storvsc_cmd_request {
struct list_head entry;
@@ -1789,12 +1788,21 @@ static int storvsc_probe(struct hv_device *device,
host_dev-path = stor_device-path_id;
host_dev-target = stor_device-target_id;
 
-   /* max # of devices per target */
-   host-max_lun = STORVSC_MAX_LUNS_PER_TARGET;
-   /* max # of targets per channel */
-   host-max_id = STORVSC_MAX_TARGETS;
-   /* max # of channels */
-   host-max_channel = STORVSC_MAX_CHANNELS - 1;
+   if (dev_id-driver_data == SFC_GUID) {
+   /* max # of devices per target */
+   host-max_lun = STORVSC_FC_MAX_LUNS_PER_TARGET;
+   /* max # of targets per channel */
+   host-max_id = STORVSC_FC_MAX_TARGETS;
+   /* max # of channels */
+   host-max_channel = STORVSC_FC_MAX_CHANNELS - 1;
+   } else {
+   /* max # of devices per target */
+   host-max_lun = STORVSC_MAX_LUNS_PER_TARGET;
+   /* max # of targets per channel */
+   host-max_id = STORVSC_MAX_TARGETS;
+   /* max # of channels */
+   host-max_channel = STORVSC_MAX_CHANNELS - 1;
+   }
/* max cmd length */
host-max_cmd_len = STORVSC_MAX_CMD_LEN;
 
-- 
1.7.4.1

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


Re: [PATCH 00/03] staging: Emma Mobile USB driver and KZM9D board code

2014-05-22 Thread Greg KH
On Thu, May 22, 2014 at 06:32:03PM +0900, Magnus Damm wrote:
 Hi Dan,
 
 On Thu, May 22, 2014 at 6:17 PM, Dan Carpenter dan.carpen...@oracle.com 
 wrote:
  Generally we take things as is into staging so there is no need for a
  re-work if you don't want to.  But we do need a TODO file.  Read the
  TODO files for other staging drivers.
 
 Thanks for pointing that out, my apologies for being random and
 skipping that! I will add a TODO file to v2!

Other than the missing TODO file, the idea looks good, I don't have any
objections to taking this.

thanks,

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


[PATCH] staging: slicoss: clean up use of dev_err

2014-05-22 Thread David Matlack
First, don't print pci device information or driver prefixes, this
is already printed by dev_err. Next, don't report error messages
via dev_err when the failing function already reports all errors
via dev_err.

Signed-off-by: David Matlack matlackda...@gmail.com
---
 drivers/staging/slicoss/slicoss.c | 28 +---
 1 file changed, 9 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index 0165899..1278de8 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -395,7 +395,7 @@ static int slic_card_download_gbrcv(struct adapter *adapter)
ret = request_firmware(fw, file, adapter-pcidev-dev);
if (ret) {
dev_err(adapter-pcidev-dev,
-   SLICOSS: Failed to load firmware %s\n, file);
+   Failed to load firmware %s\n, file);
return ret;
}
 
@@ -473,7 +473,7 @@ static int slic_card_download(struct adapter *adapter)
ret = request_firmware(fw, file, adapter-pcidev-dev);
if (ret) {
dev_err(adapter-pcidev-dev,
-   SLICOSS: Failed to load firmware %s\n, file);
+   Failed to load firmware %s\n, file);
return ret;
}
numsects = *(u32 *)(fw-data + index);
@@ -2783,13 +2783,8 @@ static int slic_card_init(struct sliccard *card, struct 
adapter *adapter)
 
/* Download the microcode */
status = slic_card_download(adapter);
-
-   if (status != 0) {
-   dev_err(adapter-pcidev-dev,
-   download failed bus %d slot %d\n,
-   adapter-busnumber, adapter-slotnumber);
+   if (status)
return status;
-   }
 
if (!card-config_set) {
peeprom = pci_alloc_consistent(adapter-pcidev,
@@ -2801,8 +2796,7 @@ static int slic_card_init(struct sliccard *card, struct 
adapter *adapter)
 
if (!peeprom) {
dev_err(adapter-pcidev-dev,
-   eeprom read failed to get memory bus %d slot 
%d\n, adapter-busnumber,
-   adapter-slotnumber);
+   Failed to allocate DMA memory for EEPROM.\n);
return -ENOMEM;
} else {
memset(peeprom, 0, sizeof(struct slic_eeprom));
@@ -2846,8 +2840,7 @@ static int slic_card_init(struct sliccard *card, struct 
adapter *adapter)
i++;
if (i  5000) {
dev_err(adapter-pcidev-dev,
-   %d config data fetch timed 
out!\n,
-   adapter-port);
+   Fetch of config data timed 
out.\n);
slic_reg64_write(adapter,
slic_regs-slic_isp, 0,
slic_regs-slic_addr_upper,
@@ -2931,19 +2924,16 @@ static int slic_card_init(struct sliccard *card, struct 
adapter *adapter)
slic_reg64_write(adapter, slic_regs-slic_isp, 0,
 slic_regs-slic_addr_upper,
 0, FLUSH);
-   dev_err(adapter-pcidev-dev,
-   unsupported CONFIGURATION EEPROM invalid\n);
+   dev_err(adapter-pcidev-dev, EEPROM invalid.\n);
return -EINVAL;
}
 
card-config_set = 1;
}
 
-   if (slic_card_download_gbrcv(adapter)) {
-   dev_err(adapter-pcidev-dev,
-   unable to download GB receive microcode\n);
-   return -EINVAL;
-   }
+   status = slic_card_download_gbrcv(adapter);
+   if (status)
+   return status;
 
if (slic_global.dynamic_intagg)
slic_intagg_set(adapter, 0);
-- 
1.9.2

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


[PATCH] staging: slicoss: remove unused members of struct adapter

2014-05-22 Thread David Matlack
Removes two fields from the private struct adapter.

memorybase  duplicate of slic_regs

memorylengthwritten once and never read. This field is trivially
computed with pci_resource_len if it's ever needed in
the future.

This patch has no noticable effect.

Signed-off-by: David Matlack matlackda...@gmail.com
---
This patch was originally sent here https://lkml.org/lkml/2014/5/6/9 with
my google.com email address. But due to Google's recent change in DMARC
policies, that patchset was silently dropped for at least some users
(including my personal gmail account). So I'm sending it out now with
my gmail.com account. Let me know if this is an issue. Thanks.

 drivers/staging/slicoss/slic.h| 2 --
 drivers/staging/slicoss/slicoss.c | 4 +---
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index 702902c..379c4f7 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -420,8 +420,6 @@ struct adapter {
ushort  devid;
ushort  subsysid;
u32 irq;
-   void __iomem *memorybase;
-   u32 memorylength;
u32 drambase;
u32 dramlength;
uintqueues_initialized;
diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index 452aa02..b0b8544 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -3422,7 +3422,6 @@ static void slic_init_adapter(struct net_device *netdev,
adapter-busnumber = pcidev-bus-number;
adapter-slotnumber = ((pcidev-devfn  3)  0x1F);
adapter-functionnumber = (pcidev-devfn  0x7);
-   adapter-memorylength = pci_resource_len(pcidev, 0);
adapter-slic_regs = (__iomem struct slic_regs *)memaddr;
adapter-irq = pcidev-irq;
 /* adapter-netdev = netdev;*/
@@ -3431,7 +3430,6 @@ static void slic_init_adapter(struct net_device *netdev,
adapter-chipid = chip_idx;
adapter-port = 0;  /*adapter-functionnumber;*/
adapter-cardindex = adapter-port;
-   adapter-memorybase = memaddr;
spin_lock_init(adapter-upr_lock.lock);
spin_lock_init(adapter-bit64reglock.lock);
spin_lock_init(adapter-adapter_lock.lock);
@@ -3683,7 +3681,7 @@ static int slic_entry_probe(struct pci_dev *pcidev,
 
slic_adapter_set_hwaddr(adapter);
 
-   netdev-base_addr = (unsigned long)adapter-memorybase;
+   netdev-base_addr = (unsigned long) memmapped_ioaddr;
netdev-irq = adapter-irq;
netdev-netdev_ops = slic_netdev_ops;
 
-- 
1.9.2

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


[PATCH] staging: slicoss: fix use-after-free in slic_entry_probe

2014-05-22 Thread David Matlack
Fix a use-after-free bug that can cause a kernel oops. If
slic_card_init fails then slic_entry_probe() (the pci probe()
function for this device) will return error without cleaning
up memory (including the registered netdev struct).

Signed-off-by: David Matlack matlackda...@gmail.com
---
This patch was originally sent here https://lkml.org/lkml/2014/5/6/10 with
my google.com email address. But due to Google's recent change in DMARC
policies, that patchset was silently dropped for at least some users
(including my personal gmail account). So I'm sending it out now with
my gmail.com account. Let me know if this is an issue. Thanks.

 drivers/staging/slicoss/slicoss.c | 16 +---
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index e27b88f..6113b90 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -3595,7 +3595,6 @@ static int slic_entry_probe(struct pci_dev *pcidev,
struct net_device *netdev;
struct adapter *adapter;
void __iomem *memmapped_ioaddr = NULL;
-   u32 status = 0;
ulong mmio_start = 0;
ulong mmio_len = 0;
struct sliccard *card = NULL;
@@ -3686,16 +3685,11 @@ static int slic_entry_probe(struct pci_dev *pcidev,
adapter-allocated = 1;
}
 
-   status = slic_card_init(card, adapter);
+   err = slic_card_init(card, adapter);
+   if (err)
+   goto err_out_unmap;
 
-   if (status != 0) {
-   card-state = CARD_FAIL;
-   adapter-state = ADAPT_FAIL;
-   adapter-linkstate = LINK_DOWN;
-   dev_err(pcidev-dev, FAILED status[%x]\n, status);
-   } else {
-   slic_adapter_set_hwaddr(adapter);
-   }
+   slic_adapter_set_hwaddr(adapter);
 
netdev-base_addr = (unsigned long)adapter-memorybase;
netdev-irq = adapter-irq;
@@ -3712,7 +3706,7 @@ static int slic_entry_probe(struct pci_dev *pcidev,
 
cards_found++;
 
-   return status;
+   return 0;
 
 err_out_unmap:
iounmap(memmapped_ioaddr);
-- 
1.9.2

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


[PATCH] staging: slicoss: fix free-after-free in slic_entry_remove

2014-05-22 Thread David Matlack
Fix two trivial free-after-free bugs in slic_entry_remove.

1. Don't iounmap() the same address twice. adapter-slic_regs
(iounmap()'ed in slic_unmap_mmio_space()) and dev-base_addr
(iounmap()'ed in slic_entry_remove()) are the same region.

2. Don't call release_mem_region() and pci_release_regions()
on the same pci_dev struct. They both free pci memory regions.

Signed-off-by: David Matlack matlackda...@gmail.com
---
This patch was originally sent here https://lkml.org/lkml/2014/5/6/3 with
my google.com email address. But due to Google's recent change in DMARC
policies, that patchset was silently dropped for at least some users
(including my personal gmail account). So I'm sending it out now with
my gmail.com account. Let me know if this is an issue. Thanks.

 drivers/staging/slicoss/slicoss.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index 6113b90..452aa02 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -2955,8 +2955,6 @@ static void slic_card_cleanup(struct sliccard *card)
 static void slic_entry_remove(struct pci_dev *pcidev)
 {
struct net_device *dev = pci_get_drvdata(pcidev);
-   u32 mmio_start = 0;
-   uint mmio_len = 0;
struct adapter *adapter = netdev_priv(dev);
struct sliccard *card;
struct mcast_address *mcaddr, *mlist;
@@ -2965,12 +2963,6 @@ static void slic_entry_remove(struct pci_dev *pcidev)
slic_unmap_mmio_space(adapter);
unregister_netdev(dev);
 
-   mmio_start = pci_resource_start(pcidev, 0);
-   mmio_len = pci_resource_len(pcidev, 0);
-
-   release_mem_region(mmio_start, mmio_len);
-
-   iounmap((void __iomem *)dev-base_addr);
/* free multicast addresses */
mlist = adapter-mcastaddrs;
while (mlist) {
-- 
1.9.2

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


[PATCH] staging: slicoss: fix use-after-free bug in slic_entry_remove

2014-05-22 Thread David Matlack
Fix a use-after-free bug that causes a null pointer dereference in
slic_entry_halt().

Since unregister_netdev() will ultimately call slic_entry_halt() (the
net_device ndo_stop() virtual function for this device), we should
call it before freeing the memory that is used by slic_entry_halt().
Specifically, slic_unmap_mmio_space() frees adapter-slic_regs, but
those registers are used in slic_entry_halt().

Signed-off-by: David Matlack matlackda...@gmail.com
---
This patch was originally sent here https://lkml.org/lkml/2014/5/6/5 with
my google.com email address. But due to Google's recent change in DMARC
policies, that patchset was silently dropped for at least some users
(including my personal gmail account). So I'm sending it out now with
my gmail.com account. Let me know if this is an issue. Thanks.

 drivers/staging/slicoss/slicoss.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index d670490..b8eeb3b 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -2526,9 +2526,10 @@ static void slic_entry_remove(struct pci_dev *pcidev)
struct sliccard *card;
struct mcast_address *mcaddr, *mlist;
 
+   unregister_netdev(dev);
+
slic_adapter_freeresources(adapter);
slic_unmap_mmio_space(adapter);
-   unregister_netdev(dev);
 
/* free multicast addresses */
mlist = adapter-mcastaddrs;
-- 
1.9.2

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


[PATCH] staging: slicoss: fix 64-bit isr address bug

2014-05-22 Thread David Matlack
Fix a bug that only manifests when the physical address of the
interrupt status register is 4GB. Specifically, the driver was only
telling the device about the lower 32 bits of the ISR. This patch adds
the upper 32 bits.

Without this patch, polling the ISR times out whenever the physical
address of the ISR is 4GB. This causes the driver to think it failed
to fetch config data from the device when it really didn't.

Note: The way 64-bit addresses are handled in this driver needs a
rework. There is an entry in the TODO file for this. That will be
a rather large patch set which will change a lot of the driver. So
for the time being, this patch will at least let the driver run
correctly on 64-bit machines with 4GB of physical memory.

Signed-off-by: David Matlack matlackda...@gmail.com
---
This patch was originally sent here https://lkml.org/lkml/2014/5/6/6 with
my google.com email address. But due to Google's recent change in DMARC
policies, that patchset was silently dropped for at least some users
(including my personal gmail account). So I'm sending it out now with
my gmail.com account. Let me know if this is an issue. Thanks.

 drivers/staging/slicoss/slicoss.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index 39e6489..d670490 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -2815,7 +2815,8 @@ static int slic_card_init(struct sliccard *card, struct 
adapter *adapter)
 
spin_lock_irqsave(adapter-bit64reglock.lock,
adapter-bit64reglock.flags);
-   slic_reg32_write(slic_regs-slic_addr_upper, 0, DONT_FLUSH);
+   slic_reg32_write(slic_regs-slic_addr_upper,
+SLIC_GET_ADDR_HIGH(pshmem-isr), DONT_FLUSH);
slic_reg32_write(slic_regs-slic_isp,
 SLIC_GET_ADDR_LOW(pshmem-isr), FLUSH);
spin_unlock_irqrestore(adapter-bit64reglock.lock,
-- 
1.9.2

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


[PATCH] staging: slicoss: remove gratuitous debug infrastructure

2014-05-22 Thread David Matlack
As per the TODO file, this patch removes the gratuitous debug
infrastructure. As an extra incentive for removing this code,
the debugfs files are not cleaned up properly. For example, if
register_netdev() fails in slic_entry_probe() then all debugfs
files get left behind, even after the driver module is unloaded.
Touching these files quickly leads to an oops.

The net effect of this patch is that the driver will no longer
create files in debugfs.

Signed-off-by: David Matlack matlackda...@gmail.com
---
This patch was originally sent here https://lkml.org/lkml/2014/5/6/4 with
my google.com email address. But due to Google's recent change in DMARC
policies, that patchset was silently dropped for at least some users
(including my personal gmail account). So I'm sending it out now with
my gmail.com account. Let me know if this is an issue. Thanks.

 drivers/staging/slicoss/TODO  |   1 -
 drivers/staging/slicoss/slic.h|   3 -
 drivers/staging/slicoss/slicoss.c | 450 +-
 3 files changed, 3 insertions(+), 451 deletions(-)

diff --git a/drivers/staging/slicoss/TODO b/drivers/staging/slicoss/TODO
index 62ff100..20cc9ab 100644
--- a/drivers/staging/slicoss/TODO
+++ b/drivers/staging/slicoss/TODO
@@ -18,7 +18,6 @@ TODO:
  use ethtool instead
- reorder code to elminate use of forward declarations
- don't keep private linked list of drivers.
-   - remove all the gratiutous debug infrastructure
- use PCI_DEVICE()
- do ethtool correctly using ethtool_ops
- NAPI?
diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index 379c4f7..7de57c4 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -310,8 +310,6 @@ struct sliccard {
u32   loadtimerset;
uint  config_set;
struct slic_config  config;
-   struct dentry  *debugfs_dir;
-   struct dentry  *debugfs_cardinfo;
struct adapter  *master;
struct adapter  *adapter[SLIC_MAX_PORTS];
struct sliccard *next;
@@ -450,7 +448,6 @@ struct adapter {
u32 pingtimerset;
struct timer_list   loadtimer;
u32 loadtimerset;
-   struct dentry  *debugfs_entry;
struct slic_spinlock upr_lock;
struct slic_spinlock bit64reglock;
struct slic_rspqueue rspqueue;
diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index b0b8544..39e6489 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -81,7 +81,6 @@
 #include linux/etherdevice.h
 #include linux/skbuff.h
 #include linux/delay.h
-#include linux/debugfs.h
 #include linux/seq_file.h
 #include linux/kthread.h
 #include linux/module.h
@@ -104,19 +103,13 @@ static char *slic_banner = Alacritech SLIC 
Technology(tm) Server 
and Storage Accelerator (Non-Accelerated);
 
 static char *slic_proc_version = 2.0.351  2006/07/14 12:26:00;
-static char *slic_product_name = SLIC Technology(tm) Server 
-   and Storage Accelerator (Non-Accelerated);
-static char *slic_vendor = Alacritech, Inc.;
 
-static int slic_debug = 1;
-static int debug = -1;
 static struct net_device *head_netdevice;
 
 static struct base_driver slic_global = { {}, 0, 0, 0, 1, NULL, NULL };
 static int intagg_delay = 100;
 static u32 dynamic_intagg;
 static unsigned int rcv_count;
-static struct dentry *slic_debugfs;
 
 #define DRV_NAME  slicoss
 #define DRV_VERSION   2.0.1
@@ -1802,430 +1795,6 @@ static u32 slic_rcvqueue_reinsert(struct adapter 
*adapter, struct sk_buff *skb)
return rcvq-count;
 }
 
-static int slic_debug_card_show(struct seq_file *seq, void *v)
-{
-#ifdef MOOKTODO
-   int i;
-   struct sliccard *card = seq-private;
-   struct slic_config *config = card-config;
-   unsigned char *fru = (unsigned char *)(card-config.atk_fru);
-   unsigned char *oemfru = (unsigned char *)(card-config.OemFru);
-#endif
-
-   seq_printf(seq, driver_version   : %s\n, slic_proc_version);
-   seq_puts(seq, Microcode versions:\n);
-   seq_printf(seq, Gigabit (gb) : %s %s\n,
-   MOJAVE_UCODE_VERS_STRING, MOJAVE_UCODE_VERS_DATE);
-   seq_printf(seq, Gigabit Receiver : %s %s\n,
-   GB_RCVUCODE_VERS_STRING, GB_RCVUCODE_VERS_DATE);
-   seq_printf(seq, Vendor   : %s\n, slic_vendor);
-   seq_printf(seq, Product Name : %s\n, slic_product_name);
-#ifdef MOOKTODO
-   seq_printf(seq, VendorId : %4.4X\n,
-   config-VendorId);
-   seq_printf(seq, DeviceId : %4.4X\n,
-   config-DeviceId);
-   seq_printf(seq, RevisionId   : %2.2x\n,
-   config-RevisionId);
-   seq_printf(seq, Bus# : %d\n, card-busnumber);
-   seq_printf(seq, 

[PATCH] staging: slicoss: remove private netdev list

2014-05-22 Thread David Matlack
Remove the private linked list of netdev structs. This list isn't
being used anyway.

This patch has no noticable effect.

Signed-off-by: David Matlack matlackda...@gmail.com
---
 drivers/staging/slicoss/slic.h| 1 -
 drivers/staging/slicoss/slicoss.c | 4 
 2 files changed, 5 deletions(-)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index 7de57c4..0dc73d5 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -407,7 +407,6 @@ struct adapter {
uintcard_size;
uintchipid;
struct net_device  *netdev;
-   struct net_device  *next_netdevice;
struct slic_spinlock adapter_lock;
struct slic_spinlock reset_lock;
struct pci_dev *pcidev;
diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index b8eeb3b..0165899 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -104,8 +104,6 @@ static char *slic_banner = Alacritech SLIC Technology(tm) 
Server 
 
 static char *slic_proc_version = 2.0.351  2006/07/14 12:26:00;
 
-static struct net_device *head_netdevice;
-
 static struct base_driver slic_global = { {}, 0, 0, 0, 1, NULL, NULL };
 static int intagg_delay = 100;
 static u32 dynamic_intagg;
@@ -2993,8 +2991,6 @@ static void slic_init_adapter(struct net_device *netdev,
adapter-slic_regs = (__iomem struct slic_regs *)memaddr;
adapter-irq = pcidev-irq;
 /* adapter-netdev = netdev;*/
-   adapter-next_netdevice = head_netdevice;
-   head_netdevice = netdev;
adapter-chipid = chip_idx;
adapter-port = 0;  /*adapter-functionnumber;*/
adapter-cardindex = adapter-port;
-- 
1.9.2

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


[PATCH 0/2] fix two bugs in slic_card_init

2014-05-22 Thread David Matlack
This patchset fixes two bugs in slic_card_init(). They are grouped in
a series because the second patch depends on the first (for a merge 
without conflicts). In content, they are completely separate changes.
They just touch a few of the same lines.

David Matlack (2):
  staging: slicoss: fix dma memory leak
  staging: slicoss: handle errors from slic_config_get

 drivers/staging/slicoss/slicoss.c | 25 -
 1 file changed, 16 insertions(+), 9 deletions(-)

-- 
1.9.2

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


[PATCH 1/2] staging: slicoss: fix dma memory leak

2014-05-22 Thread David Matlack
Fix memory leak in slic_card_init. If the driver fails to poll for an
interrupt after requesting config data from the device the dma memory
is never freed.

Signed-off-by: David Matlack matlackda...@gmail.com
---
This patch was originally sent here https://lkml.org/lkml/2014/5/6/7 with
my google.com email address. But due to Google's recent change in DMARC
policies, that patchset was silently dropped for at least some users
(including my personal gmail account). So I'm sending it out now with
my gmail.com account. Let me know if this is an issue. Thanks.

 drivers/staging/slicoss/slicoss.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index e27b88f..5b82455 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -3293,6 +3293,9 @@ static int slic_card_init(struct sliccard *card, struct 
adapter *adapter)
slic_regs-slic_isp, 0,
slic_regs-slic_addr_upper,
0, FLUSH);
+   pci_free_consistent(adapter-pcidev,
+   sizeof(struct slic_eeprom),
+   peeprom, phys_config);
return -EINVAL;
}
}
-- 
1.9.2

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


[PATCH 2/2] staging: slicoss: handle errors from slic_config_get

2014-05-22 Thread David Matlack
slic_config_get() can fail. Change the return type from void to
int and handle the error in slic_card_init(). So now, instead of
silently failing (and then timing out waiting for the config data),
the driver will fail loudly at request time.

Signed-off-by: David Matlack matlackda...@gmail.com
---
 drivers/staging/slicoss/slicoss.c | 28 
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index 5b82455..9c48cd8 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -1140,14 +1140,10 @@ static void slic_upr_request_complete(struct adapter 
*adapter, u32 isr)
adapter-upr_lock.flags);
 }
 
-static void slic_config_get(struct adapter *adapter, u32 config,
-   u32 config_h)
+static int slic_config_get(struct adapter *adapter, u32 config, u32 config_h)
 {
-   int status;
-
-   status = slic_upr_request(adapter,
- SLIC_UPR_RCONFIG,
- (u32) config, (u32) config_h, 0, 0);
+   return slic_upr_request(adapter, SLIC_UPR_RCONFIG, config, config_h,
+   0, 0);
 }
 
 /*
@@ -3262,7 +3258,12 @@ static int slic_card_init(struct sliccard *card, struct 
adapter *adapter)
spin_unlock_irqrestore(adapter-bit64reglock.lock,
adapter-bit64reglock.flags);
 
-   slic_config_get(adapter, phys_configl, phys_configh);
+   status = slic_config_get(adapter, phys_configl, phys_configh);
+   if (status) {
+   dev_err(adapter-pcidev-dev,
+   Failed to fetch config data from device.\n);
+   goto card_init_err;
+   }
 
for (;;) {
if (adapter-pshmem-isr) {
@@ -3293,10 +3294,8 @@ static int slic_card_init(struct sliccard *card, struct 
adapter *adapter)
slic_regs-slic_isp, 0,
slic_regs-slic_addr_upper,
0, FLUSH);
-   pci_free_consistent(adapter-pcidev,
-   sizeof(struct slic_eeprom),
-   peeprom, phys_config);
-   return -EINVAL;
+   status = -EINVAL;
+   goto card_init_err;
}
}
}
@@ -3406,6 +3405,11 @@ static int slic_card_init(struct sliccard *card, struct 
adapter *adapter)
card-reset_in_progress = 0;
 
return 0;
+
+card_init_err:
+   pci_free_consistent(adapter-pcidev, sizeof(struct slic_eeprom),
+   peeprom, phys_config);
+   return status;
 }
 
 static void slic_init_driver(void)
-- 
1.9.2

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