Re: [PATCH v4 3/3] memstick: Add realtek USB memstick host driver

2014-03-20 Thread Roger

On 02/12/2014 06:00 PM, rogera...@realtek.com wrote:

From: Roger Tseng 

Realtek USB memstick host driver provides memstick host support based on the
Realtek USB card reader MFD driver.

Signed-off-by: Roger Tseng 

Andrew,

Would you please Ack or comment this patch(3/3) to let the 3 patches be 
merged together? I have been making the same request at the message 
thread of "[PATCH v4 2/3]" since several weeks ago but got no response. 
Thus I re-post here and hope I could get something.


Best regards,
Roger Tseng

---
  drivers/memstick/host/Kconfig   |  10 +
  drivers/memstick/host/Makefile  |   1 +
  drivers/memstick/host/rtsx_usb_ms.c | 836 
  3 files changed, 847 insertions(+)
  create mode 100644 drivers/memstick/host/rtsx_usb_ms.c

diff --git a/drivers/memstick/host/Kconfig b/drivers/memstick/host/Kconfig
index 1b37cf8..7310e32 100644
--- a/drivers/memstick/host/Kconfig
+++ b/drivers/memstick/host/Kconfig
@@ -52,3 +52,13 @@ config MEMSTICK_REALTEK_PCI

  To compile this driver as a module, choose M here: the module will
  be called rtsx_pci_ms.
+
+config MEMSTICK_REALTEK_USB
+   tristate "Realtek USB Memstick Card Interface Driver"
+   depends on MFD_RTSX_USB
+   help
+ Say Y here to include driver code to support Memstick card interface
+ of Realtek RTS5129/39 series USB card reader
+
+ To compile this driver as a module, choose M here: the module will
+ be called rts5139_ms.
diff --git a/drivers/memstick/host/Makefile b/drivers/memstick/host/Makefile
index af3459d..491c955 100644
--- a/drivers/memstick/host/Makefile
+++ b/drivers/memstick/host/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_MEMSTICK_TIFM_MS)  += tifm_ms.o
  obj-$(CONFIG_MEMSTICK_JMICRON_38X)+= jmb38x_ms.o
  obj-$(CONFIG_MEMSTICK_R592)   += r592.o
  obj-$(CONFIG_MEMSTICK_REALTEK_PCI)+= rtsx_pci_ms.o
+obj-$(CONFIG_MEMSTICK_REALTEK_USB) += rtsx_usb_ms.o
diff --git a/drivers/memstick/host/rtsx_usb_ms.c 
b/drivers/memstick/host/rtsx_usb_ms.c
new file mode 100644
index 000..eb4c75d
--- /dev/null
+++ b/drivers/memstick/host/rtsx_usb_ms.c
@@ -0,0 +1,836 @@
+/* Realtek USB Memstick Card Interface driver
+ *
+ * Copyright(c) 2009-2013 Realtek Semiconductor Corp. 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 version 2
+ * as published by the Free Software Foundation.
+ *
+ * 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.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see .
+ *
+ * Author:
+ *   Roger Tseng 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct rtsx_usb_ms {
+   struct platform_device  *pdev;
+   struct rtsx_ucr *ucr;
+   struct memstick_host*msh;
+   struct memstick_request *req;
+
+   struct mutexhost_mutex;
+   struct work_struct  handle_req;
+
+   struct task_struct  *detect_ms;
+   struct completion   detect_ms_exit;
+
+   u8  ssc_depth;
+   unsigned intclock;
+   int power_mode;
+   unsigned char   ifmode;
+   booleject;
+};
+
+static inline struct device *ms_dev(struct rtsx_usb_ms *host)
+{
+   return &(host->pdev->dev);
+}
+
+static inline void ms_clear_error(struct rtsx_usb_ms *host)
+{
+   struct rtsx_ucr *ucr = host->ucr;
+   rtsx_usb_ep0_write_register(ucr, CARD_STOP,
+ MS_STOP | MS_CLR_ERR,
+ MS_STOP | MS_CLR_ERR);
+
+   rtsx_usb_clear_dma_err(ucr);
+   rtsx_usb_clear_fsm_err(ucr);
+}
+
+#ifdef DEBUG
+
+static void ms_print_debug_regs(struct rtsx_usb_ms *host)
+{
+   struct rtsx_ucr *ucr = host->ucr;
+   u16 i;
+   u8 *ptr;
+
+   /* Print MS host internal registers */
+   rtsx_usb_init_cmd(ucr);
+
+   /* MS_CFG to MS_INT_REG */
+   for (i = 0xFD40; i <= 0xFD44; i++)
+   rtsx_usb_add_cmd(ucr, READ_REG_CMD, i, 0, 0);
+
+   /* CARD_SHARE_MODE to CARD_GPIO */
+   for (i = 0xFD51; i <= 0xFD56; i++)
+   rtsx_usb_add_cmd(ucr, READ_REG_CMD, i, 0, 0);
+
+   /* CARD_PULL_CTLx */
+   for (i = 0xFD60; i <= 0xFD65; i++)
+   rtsx_usb_add_cmd(ucr, READ_REG_CMD, i, 0, 0);
+
+   /* CARD_DATA_SOURCE, CARD_SELECT, CARD_CLK_EN, CARD_PWR_CTL */
+   rtsx_usb_add_cmd(ucr, READ_REG_CMD, CARD_DATA_SOURCE, 0, 0);
+   rtsx_usb_add_cmd(ucr, READ_REG_CMD, CARD_SELECT, 0, 0);
+   rtsx_usb_add_cmd(ucr, READ_REG_CMD, CA

RE: [PATCH] staging: octeon-usb: prevent memory corruption

2014-03-20 Thread David Laight
From: Aaro Koskinen
> octeon-hcd will crash the kernel when SLOB is used. This usually happens
> after the 18-byte control transfer when a device descriptor is read.
> The DMA engine is always transfering full 32-bit words and if the
> transfer is shorter, some random garbage appears after the buffer.
> The problem is not visible with SLUB since it rounds up the allocations
> to word boundary, and the extra bytes will go undetected.
> 
> Fix by providing quirk functions for DMA map/unmap that allocate a bigger
> temporary buffer when necessary. Tested by booting EdgeRouter Lite
> to USB stick root file system with SLAB, SLOB and SLUB kernels.

Wouldn't it be simpler to just round up the existing allocation?
(With a comment that some DMA controllers write whole words.)

David



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


Re: [PATCH 1/2] coding style: fix quoted string split across lines

2014-03-20 Thread Joe Perches
On Wed, 2014-03-19 at 23:04 +0100, Cédric Cabessa wrote:
[]
> diff --git a/drivers/staging/usbip/usbip_common.c 
> b/drivers/staging/usbip/usbip_common.c
[]
> @@ -178,8 +178,8 @@ static void usbip_dump_usb_ctrlrequest(struct 
> usb_ctrlrequest *cmd)
>   }
>  
>   pr_debug("   ");
> - pr_debug("bRequestType(%02X) bRequest(%02X) wValue(%04X) wIndex(%04X) "
> -  "wLength(%04X) ", cmd->bRequestType, cmd->bRequest,
> + pr_debug("bRequestType(%02X) bRequest(%02X) wValue(%04X) wIndex(%04X) 
> wLength(%04X) ",
> +  cmd->bRequestType, cmd->bRequest,
>cmd->wValue, cmd->wIndex, cmd->wLength);
>   pr_debug("\n   ");

While you didn't change it, these uses are broken.

pr_debug always starts a new line so the continuations
attempted in this block don't work.

Likely this was originally converted from some non pr_debug
mechanism without an understanding of how pr_debug varies
from a normal printf.


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


RE: [PATCH] staging: octeon-usb: prevent memory corruption

2014-03-20 Thread Alan Stern
On Thu, 20 Mar 2014, David Laight wrote:

> From: Aaro Koskinen
> > octeon-hcd will crash the kernel when SLOB is used. This usually happens
> > after the 18-byte control transfer when a device descriptor is read.
> > The DMA engine is always transfering full 32-bit words and if the
> > transfer is shorter, some random garbage appears after the buffer.
> > The problem is not visible with SLUB since it rounds up the allocations
> > to word boundary, and the extra bytes will go undetected.
> > 
> > Fix by providing quirk functions for DMA map/unmap that allocate a bigger
> > temporary buffer when necessary. Tested by booting EdgeRouter Lite
> > to USB stick root file system with SLAB, SLOB and SLUB kernels.
> 
> Wouldn't it be simpler to just round up the existing allocation?
> (With a comment that some DMA controllers write whole words.)

No doubt it would be simpler.  The problem is that octeon-hcd doesn't 
make these allocations; they are carried out by other parts of the 
kernel.

Alan Stern

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


Financial Assistane / Loan Offer

2014-03-20 Thread finance01
We offer all purpose loan at 3% interest rate. Contact Us for more details by 
Email:santanderfinancegr...@gmail.com
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [RFC PATCH] staging: imx-drm: add suspend / resume

2014-03-20 Thread Fabio Estevam
Hi Martin,

On Thu, Mar 20, 2014 at 12:17 PM, Martin Fuzzey  wrote:
> Currently i.MX53 boards with the imx-drm display driver active
> fail an intensive suspend to ram / resume test.
>
> After around 5 - 50 cycles it is no longer possible to resume
> the board.
>
> The culprit is the imx-drm driver which does not stop DMA
> before suspending. Removing the driver "fixes" the problem.
>
> This patch provides a minimal suspend / resume implementation
> enabling the intensive test to work (500 cycles ok).
>
> I am only sending this as RFC for the moment since I don't
> really know the hardware or driver code well enough to be
> sure this is the "right" way of doing it.

Does this patch still cause the visual artifacts you mentioned earlier?

Regards,

Fabio Estevam

>
> Signed-off-by: Martin Fuzzey 
> ---
>  drivers/staging/imx-drm/ipu-v3/ipu-common.c |   47 
> +++
>  drivers/staging/imx-drm/ipu-v3/ipu-prv.h|1 +
>  2 files changed, 48 insertions(+)
>
> diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-common.c 
> b/drivers/staging/imx-drm/ipu-v3/ipu-common.c
> index 97ca692..484a90a 100644
> --- a/drivers/staging/imx-drm/ipu-v3/ipu-common.c
> +++ b/drivers/staging/imx-drm/ipu-v3/ipu-common.c
> @@ -692,6 +692,8 @@ int ipu_idmac_enable_channel(struct ipuv3_channel 
> *channel)
> val |= idma_mask(channel->num);
> ipu_idmac_write(ipu, val, IDMAC_CHA_EN(channel->num));
>
> +   channel->enabled = true;
> +
> spin_unlock_irqrestore(&ipu->lock, flags);
>
> return 0;
> @@ -750,6 +752,8 @@ int ipu_idmac_disable_channel(struct ipuv3_channel 
> *channel)
> val &= ~idma_mask(channel->num);
> ipu_cm_write(ipu, val, IPU_CHA_DB_MODE_SEL(channel->num));
>
> +   channel->enabled = false;
> +
> spin_unlock_irqrestore(&ipu->lock, flags);
>
> return 0;
> @@ -1245,10 +1249,53 @@ static int ipu_remove(struct platform_device *pdev)
> return 0;
>  }
>
> +#ifdef CONFIG_PM_SLEEP
> +
> +static int ipu_suspend(struct device *dev)
> +{
> +   struct ipu_soc *ipu = dev_get_drvdata(dev);
> +   struct ipuv3_channel *channel;
> +   int i;
> +
> +   channel = ipu->channel;
> +   for (i = 0; i < ARRAY_SIZE(ipu->channel); i++, channel++) {
> +   channel->suspended = false;
> +   if (channel->enabled) {
> +   if (ipu_idmac_wait_busy(channel, 50))
> +   dev_warn(dev,
> +   "%s: Timeout channel %d idle\n",
> +   __func__, i);
> +   ipu_idmac_disable_channel(channel);
> +   channel->suspended = true;
> +   }
> +   }
> +   return 0;
> +}
> +
> +static int ipu_resume(struct device *dev)
> +{
> +   struct ipu_soc *ipu = dev_get_drvdata(dev);
> +   struct ipuv3_channel *channel;
> +   int i;
> +
> +   channel = ipu->channel;
> +   for (i = 0; i < ARRAY_SIZE(ipu->channel); i++, channel++) {
> +   if (channel->suspended) {
> +   ipu_idmac_enable_channel(channel);
> +   channel->suspended = false;
> +   }
> +   }
> +   return 0;
> +}
> +#endif
> +
> +static SIMPLE_DEV_PM_OPS(ipu_pm_ops, ipu_suspend, ipu_resume);
> +
>  static struct platform_driver imx_ipu_driver = {
> .driver = {
> .name = "imx-ipuv3",
> .of_match_table = imx_ipu_dt_ids,
> +   .pm = &ipu_pm_ops,
> },
> .probe = ipu_probe,
> .remove = ipu_remove,
> diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-prv.h 
> b/drivers/staging/imx-drm/ipu-v3/ipu-prv.h
> index 4df0050..233749a 100644
> --- a/drivers/staging/imx-drm/ipu-v3/ipu-prv.h
> +++ b/drivers/staging/imx-drm/ipu-v3/ipu-prv.h
> @@ -144,6 +144,7 @@ struct ipuv3_channel {
>
> bool enabled;
> bool busy;
> +   bool suspended;
>
> struct ipu_soc *ipu;
>  };
>
>
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RFC PATCH] staging: imx-drm: add suspend / resume

2014-03-20 Thread Martin Fuzzey
Currently i.MX53 boards with the imx-drm display driver active
fail an intensive suspend to ram / resume test.

After around 5 - 50 cycles it is no longer possible to resume
the board.

The culprit is the imx-drm driver which does not stop DMA
before suspending. Removing the driver "fixes" the problem.

This patch provides a minimal suspend / resume implementation
enabling the intensive test to work (500 cycles ok).

I am only sending this as RFC for the moment since I don't
really know the hardware or driver code well enough to be
sure this is the "right" way of doing it.

Signed-off-by: Martin Fuzzey 
---
 drivers/staging/imx-drm/ipu-v3/ipu-common.c |   47 +++
 drivers/staging/imx-drm/ipu-v3/ipu-prv.h|1 +
 2 files changed, 48 insertions(+)

diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-common.c 
b/drivers/staging/imx-drm/ipu-v3/ipu-common.c
index 97ca692..484a90a 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-common.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-common.c
@@ -692,6 +692,8 @@ int ipu_idmac_enable_channel(struct ipuv3_channel *channel)
val |= idma_mask(channel->num);
ipu_idmac_write(ipu, val, IDMAC_CHA_EN(channel->num));
 
+   channel->enabled = true;
+
spin_unlock_irqrestore(&ipu->lock, flags);
 
return 0;
@@ -750,6 +752,8 @@ int ipu_idmac_disable_channel(struct ipuv3_channel *channel)
val &= ~idma_mask(channel->num);
ipu_cm_write(ipu, val, IPU_CHA_DB_MODE_SEL(channel->num));
 
+   channel->enabled = false;
+
spin_unlock_irqrestore(&ipu->lock, flags);
 
return 0;
@@ -1245,10 +1249,53 @@ static int ipu_remove(struct platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+
+static int ipu_suspend(struct device *dev)
+{
+   struct ipu_soc *ipu = dev_get_drvdata(dev);
+   struct ipuv3_channel *channel;
+   int i;
+
+   channel = ipu->channel;
+   for (i = 0; i < ARRAY_SIZE(ipu->channel); i++, channel++) {
+   channel->suspended = false;
+   if (channel->enabled) {
+   if (ipu_idmac_wait_busy(channel, 50))
+   dev_warn(dev,
+   "%s: Timeout channel %d idle\n",
+   __func__, i);
+   ipu_idmac_disable_channel(channel);
+   channel->suspended = true;
+   }
+   }
+   return 0;
+}
+
+static int ipu_resume(struct device *dev)
+{
+   struct ipu_soc *ipu = dev_get_drvdata(dev);
+   struct ipuv3_channel *channel;
+   int i;
+
+   channel = ipu->channel;
+   for (i = 0; i < ARRAY_SIZE(ipu->channel); i++, channel++) {
+   if (channel->suspended) {
+   ipu_idmac_enable_channel(channel);
+   channel->suspended = false;
+   }
+   }
+   return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(ipu_pm_ops, ipu_suspend, ipu_resume);
+
 static struct platform_driver imx_ipu_driver = {
.driver = {
.name = "imx-ipuv3",
.of_match_table = imx_ipu_dt_ids,
+   .pm = &ipu_pm_ops,
},
.probe = ipu_probe,
.remove = ipu_remove,
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-prv.h 
b/drivers/staging/imx-drm/ipu-v3/ipu-prv.h
index 4df0050..233749a 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-prv.h
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-prv.h
@@ -144,6 +144,7 @@ struct ipuv3_channel {
 
bool enabled;
bool busy;
+   bool suspended;
 
struct ipu_soc *ipu;
 };

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


Re: [RFC PATCH] staging: imx-drm: add suspend / resume

2014-03-20 Thread Martin Fuzzey

Hi Fabio,
On 20/03/14 16:31, Fabio Estevam wrote:
Does this patch still cause the visual artifacts you mentioned 
earlier? Regards, Fabio Estevam 


No.

Since I switched from poking the registers to using the existing 
wrappers I have not observed any artifcats.


Regards,

Martin

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


Re: [PATCH 2/2] coding style: fix line over 80 characters

2014-03-20 Thread Sergei Shtylyov

On 03/21/2014 12:34 AM, Sergei Shtylyov wrote:


Signed-off-by: Cédric Cabessa 
---
  drivers/staging/usbip/vhci_hcd.c | 33 ++---
  1 file changed, 22 insertions(+), 11 deletions(-)



diff --git a/drivers/staging/usbip/vhci_hcd.c
b/drivers/staging/usbip/vhci_hcd.c
index f690668..1e84577 100644
--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c

[...]

@@ -1060,7 +1069,9 @@ static int vhci_hcd_suspend(struct platform_device
*pdev, pm_message_t state)
  spin_unlock(&the_controller->lock);

  if (connected > 0) {
-dev_info(&pdev->dev, "We have %d active connection%s. Do not
suspend.\n", connected, (connected == 1 ? "" : "s"));
+dev_info(&pdev->dev,
+ "We have %d active connection%s. Do not suspend.\n",
+ connected, (connected == 1 ? "" : "s"));
  ret =  -EBUSY;
  } else {
  dev_info(&pdev->dev, "suspend vhci_hcd");



Hm, I don't see checkpatch.pl complaints about these either in the
'usb-next' branch of Greg's tree.


   In fact, it does complain but says:

WARNING: quoted string split across lines

So, it looks like your patch is against the wrong tree.

WBR, Sergei

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


Re: [PATCH 2/2] coding style: fix line over 80 characters

2014-03-20 Thread Sergei Shtylyov

Hello.

On 03/20/2014 01:04 AM, Cédric Cabessa wrote:


Signed-off-by: Cédric Cabessa 
---
  drivers/staging/usbip/vhci_hcd.c | 33 ++---
  1 file changed, 22 insertions(+), 11 deletions(-)



diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c
index f690668..1e84577 100644
--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c
@@ -271,12 +271,14 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 
typeReq, u16 wValue,
}
break;
case USB_PORT_FEAT_POWER:
-   usbip_dbg_vhci_rh(" ClearPortFeature: 
USB_PORT_FEAT_POWER\n");
+   usbip_dbg_vhci_rh(
+   " ClearPortFeature: USB_PORT_FEAT_POWER\n");


   Your version of scripts/checkpatch.pl seems outdated. It shouldn't 
complain about strings violating 80-column limit (and I've just verified it 
doesn't).



@@ -539,7 +546,9 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb 
*urb,

default:
/* NOT REACHED */
-   dev_err(dev, "invalid request to devnum 0 bRequest %u, wValue 
%u\n", ctrlreq->bRequest,
+   dev_err(dev,
+   "invalid request to devnum 0 bRequest %u, wValue 
%u\n",
+   ctrlreq->bRequest,
ctrlreq->wValue);
ret =  -EINVAL;
goto no_need_xmit;
@@ -1060,7 +1069,9 @@ static int vhci_hcd_suspend(struct platform_device *pdev, 
pm_message_t state)
spin_unlock(&the_controller->lock);

if (connected > 0) {
-   dev_info(&pdev->dev, "We have %d active connection%s. Do not suspend.\n", 
connected, (connected == 1 ? "" : "s"));
+   dev_info(&pdev->dev,
+"We have %d active connection%s. Do not suspend.\n",
+connected, (connected == 1 ? "" : "s"));
ret =  -EBUSY;
} else {
dev_info(&pdev->dev, "suspend vhci_hcd");


   Hm, I don't see checkpatch.pl complaints about these either in the 
'usb-next' branch of Greg's tree.


WBR, Sergei

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


Re: [PATCH 2/2] coding style: fix line over 80 characters

2014-03-20 Thread Joe Perches
On Fri, 2014-03-21 at 00:34 +0300, Sergei Shtylyov wrote:
> On 03/20/2014 01:04 AM, Cédric Cabessa wrote:
> > diff --git a/drivers/staging/usbip/vhci_hcd.c 
> > b/drivers/staging/usbip/vhci_hcd.c
[]
> > @@ -271,12 +271,14 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 
> > typeReq, u16 wValue,
> > }
> > break;
> > case USB_PORT_FEAT_POWER:
> > -   usbip_dbg_vhci_rh(" ClearPortFeature: 
> > USB_PORT_FEAT_POWER\n");
> > +   usbip_dbg_vhci_rh(
> > +   " ClearPortFeature: USB_PORT_FEAT_POWER\n");
> 
> Your version of scripts/checkpatch.pl seems outdated. It shouldn't 
> complain about strings violating 80-column limit (and I've just verified it 
> doesn't).

checkpatch complains about > 80 char lines for lines with
a function where the function name isn't understood to be
a logging use.

uspip_dbg_ doesn't take the general form so if the
string at the EOL exceeds 80 chars, a message is emitted.

Long standalone strings on a single line do not get warnings.


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


Re: [PATCH 2/2] coding style: fix line over 80 characters

2014-03-20 Thread Sergei Shtylyov

On 03/20/2014 11:45 PM, Joe Perches wrote:


diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c

[]

@@ -271,12 +271,14 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 
typeReq, u16 wValue,
}
break;
case USB_PORT_FEAT_POWER:
-   usbip_dbg_vhci_rh(" ClearPortFeature: 
USB_PORT_FEAT_POWER\n");
+   usbip_dbg_vhci_rh(
+   " ClearPortFeature: USB_PORT_FEAT_POWER\n");



 Your version of scripts/checkpatch.pl seems outdated. It shouldn't
complain about strings violating 80-column limit (and I've just verified it
doesn't).



checkpatch complains about > 80 char lines for lines with
a function where the function name isn't understood to be
a logging use.



uspip_dbg_ doesn't take the general form so if the
string at the EOL exceeds 80 chars, a message is emitted.



Long standalone strings on a single line do not get warnings.


   OK, but there's still issue that the patch context doesn't correspond to 
what can be seen in Greg's tree. What I am seeing there is broken up string.


WBR, Sergei

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


[PATCH net-next, v4] hyperv: Add support for virtual Receive Side Scaling (vRSS)

2014-03-20 Thread Haiyang Zhang
This feature allows multiple channels to be used by each virtual NIC.
It is available on Hyper-V host 2012 R2.

Signed-off-by: Haiyang Zhang 
Reviewed-by: K. Y. Srinivasan 
---
 drivers/net/hyperv/hyperv_net.h   |  110 +-
 drivers/net/hyperv/netvsc.c   |  136 +-
 drivers/net/hyperv/netvsc_drv.c   |  103 +++-
 drivers/net/hyperv/rndis_filter.c |  189 -
 4 files changed, 504 insertions(+), 34 deletions(-)

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 13010b4..dcafa82 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -28,6 +28,96 @@
 #include 
 #include 
 
+/* RSS related */
+#define OID_GEN_RECEIVE_SCALE_CAPABILITIES 0x00010203  /* query only */
+#define OID_GEN_RECEIVE_SCALE_PARAMETERS 0x00010204  /* query and set */
+
+#define NDIS_OBJECT_TYPE_RSS_CAPABILITIES 0x88
+#define NDIS_OBJECT_TYPE_RSS_PARAMETERS 0x89
+
+#define NDIS_RECEIVE_SCALE_CAPABILITIES_REVISION_2 2
+#define NDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2 2
+
+struct ndis_obj_header {
+   u8 type;
+   u8 rev;
+   u16 size;
+} __packed;
+
+/* ndis_recv_scale_cap/cap_flag */
+#define NDIS_RSS_CAPS_MESSAGE_SIGNALED_INTERRUPTS 0x0100
+#define NDIS_RSS_CAPS_CLASSIFICATION_AT_ISR   0x0200
+#define NDIS_RSS_CAPS_CLASSIFICATION_AT_DPC   0x0400
+#define NDIS_RSS_CAPS_USING_MSI_X 0x0800
+#define NDIS_RSS_CAPS_RSS_AVAILABLE_ON_PORTS  0x1000
+#define NDIS_RSS_CAPS_SUPPORTS_MSI_X  0x2000
+#define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV4  0x0100
+#define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6  0x0200
+#define NDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6_EX   0x0400
+
+struct ndis_recv_scale_cap { /* NDIS_RECEIVE_SCALE_CAPABILITIES */
+   struct ndis_obj_header hdr;
+   u32 cap_flag;
+   u32 num_int_msg;
+   u32 num_recv_que;
+   u16 num_indirect_tabent;
+} __packed;
+
+
+/* ndis_recv_scale_param flags */
+#define NDIS_RSS_PARAM_FLAG_BASE_CPU_UNCHANGED 0x0001
+#define NDIS_RSS_PARAM_FLAG_HASH_INFO_UNCHANGED0x0002
+#define NDIS_RSS_PARAM_FLAG_ITABLE_UNCHANGED   0x0004
+#define NDIS_RSS_PARAM_FLAG_HASH_KEY_UNCHANGED 0x0008
+#define NDIS_RSS_PARAM_FLAG_DISABLE_RSS0x0010
+
+/* Hash info bits */
+#define NDIS_HASH_FUNC_TOEPLITZ 0x0001
+#define NDIS_HASH_IPV4  0x0100
+#define NDIS_HASH_TCP_IPV4  0x0200
+#define NDIS_HASH_IPV6  0x0400
+#define NDIS_HASH_IPV6_EX   0x0800
+#define NDIS_HASH_TCP_IPV6  0x1000
+#define NDIS_HASH_TCP_IPV6_EX   0x2000
+
+#define NDIS_RSS_INDIRECTION_TABLE_MAX_SIZE_REVISION_2 (128 * 4)
+#define NDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2   40
+
+#define ITAB_NUM 128
+#define HASH_KEYLEN NDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2
+extern u8 netvsc_hash_key[];
+
+struct ndis_recv_scale_param { /* NDIS_RECEIVE_SCALE_PARAMETERS */
+   struct ndis_obj_header hdr;
+
+   /* Qualifies the rest of the information */
+   u16 flag;
+
+   /* The base CPU number to do receive processing. not used */
+   u16 base_cpu_number;
+
+   /* This describes the hash function and type being enabled */
+   u32 hashinfo;
+
+   /* The size of indirection table array */
+   u16 indirect_tabsize;
+
+   /* The offset of the indirection table from the beginning of this
+* structure
+*/
+   u32 indirect_taboffset;
+
+   /* The size of the hash secret key */
+   u16 hashkey_size;
+
+   /* The offset of the secret key from the beginning of this structure */
+   u32 kashkey_offset;
+
+   u32 processor_masks_offset;
+   u32 num_processor_masks;
+   u32 processor_masks_entry_size;
+};
+
 /* Fwd declaration */
 struct hv_netvsc_packet;
 struct ndis_tcp_ip_checksum_info;
@@ -39,6 +129,8 @@ struct xferpage_packet {
 
/* # of netvsc packets this xfer packet contains */
u32 count;
+
+   struct vmbus_channel *channel;
 };
 
 /*
@@ -54,6 +146,9 @@ struct hv_netvsc_packet {
bool is_data_pkt;
u16 vlan_tci;
 
+   u16 q_idx;
+   struct vmbus_channel *channel;
+
/*
 * Valid only for receives when we break a xfer page packet
 * into multiple netvsc packets
@@ -120,6 +215,7 @@ void netvsc_linkstatus_callback(struct hv_device 
*device_obj,
 int netvsc_recv_callback(struct hv_device *device_obj,
struct hv_netvsc_packet *packet,
struct ndis_tcp_ip_checksum_info *csum_info);
+void netvsc_channel_cb(void *context);
 int rndis_filter_open(struct hv_device *dev);
 int rndis_filter_close(struct hv_device *dev);
 int rndis_filter_device_add(struct hv_device *dev,
@@ -522,6 +618,8 @@ struct nvsp_message {
 
 #define NETVSC_PACKET_SIZE  2048
 
+#define VRSS_SEND_TAB_SIZE 16
+
 /* Per netvsc channel-specific */
 struct netvsc_d

Re: [PATCH v4 3/3] memstick: Add realtek USB memstick host driver

2014-03-20 Thread Andrew Morton
On Wed, 12 Feb 2014 18:00:38 +0800  wrote:

> From: Roger Tseng 
> 
> Realtek USB memstick host driver provides memstick host support based on the
> Realtek USB card reader MFD driver.
> 
> ...
>
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct rtsx_usb_ms {
> + struct platform_device  *pdev;
> + struct rtsx_ucr *ucr;
> + struct memstick_host*msh;
> + struct memstick_request *req;
> +
> + struct mutexhost_mutex;

Should have included mutex.h.

> + struct work_struct  handle_req;
> +
> + struct task_struct  *detect_ms;

sched.h.

> + struct completion   detect_ms_exit;

completion.h.

> + u8  ssc_depth;
> + unsigned intclock;
> + int power_mode;
> + unsigned char   ifmode;
> + booleject;
> +};
> +
> 
> ...
>
> +
> +#else
> +
> +#define ms_print_debug_regs(host)

static void ms_print_debug_regs(struct rtsx_usb_ms *host)
{
}

It is good to have the same signature for either case.  And doing it in
C provides typechecking and can avoid variable-unused warnings.  

> +#endif
> 
> ...
>
> +static int ms_power_on(struct rtsx_usb_ms *host)
> +{
> + struct rtsx_ucr *ucr = host->ucr;
> + int err;
> +
> + dev_dbg(ms_dev(host), "%s\n", __func__);
> +
> + rtsx_usb_init_cmd(ucr);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_SELECT, 0x07, MS_MOD_SEL);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_SHARE_MODE,
> + CARD_SHARE_MASK, CARD_SHARE_MS);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_CLK_EN,
> + MS_CLK_EN, MS_CLK_EN);
> + err = rtsx_usb_send_cmd(ucr, MODE_C, 100);
> + if (err < 0)
> + return err;
> +
> + if (CHECK_PKG(ucr, LQFP48))
> + err = ms_pull_ctl_enable_lqfp48(ucr);
> + else
> + err = ms_pull_ctl_enable_qfn24(ucr);
> + if (err < 0)
> + return err;
> +
> + err = rtsx_usb_write_register(ucr, CARD_PWR_CTL,
> + POWER_MASK, PARTIAL_POWER_ON);
> + if (err)
> + return err;
> +
> + /* Wait ms power stable */

Comment is strange.

> + usleep_range(800, 1000);
> +
> + rtsx_usb_init_cmd(ucr);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PWR_CTL,
> + POWER_MASK, POWER_ON);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_OE,
> + MS_OUTPUT_EN, MS_OUTPUT_EN);
> +
> + return rtsx_usb_send_cmd(ucr, MODE_C, 100);
> +}
> +
> 
> ...
>
> +static int ms_transfer_data(struct rtsx_usb_ms *host, unsigned char data_dir,
> + u8 tpc, u8 cfg, struct scatterlist *sg)
> +{
> + struct rtsx_ucr *ucr = host->ucr;
> + int err;
> + unsigned int length = sg->length;
> + u16 sec_cnt = (u16)(length / 512);
> + u8 trans_mode, dma_dir, flag;
> + unsigned int pipe;
> + struct memstick_dev *card = host->msh->card;
> +
> + dev_dbg(ms_dev(host), "%s: tpc = 0x%02x, data_dir = %s, length = %d\n",

length = %u

> + __func__, tpc, (data_dir == READ) ? "READ" : "WRITE",
> + length);
> +
> + if (data_dir == READ) {
> + flag = MODE_CDIR;
> + dma_dir = DMA_DIR_FROM_CARD;
> + if (card->id.type != MEMSTICK_TYPE_PRO)
> + trans_mode = MS_TM_NORMAL_READ;
> + else
> + trans_mode = MS_TM_AUTO_READ;
> + pipe = usb_rcvbulkpipe(ucr->pusb_dev, EP_BULK_IN);
> + } else {
> + flag = MODE_CDOR;
> + dma_dir = DMA_DIR_TO_CARD;
> + if (card->id.type != MEMSTICK_TYPE_PRO)
> + trans_mode = MS_TM_NORMAL_WRITE;
> + else
> + trans_mode = MS_TM_AUTO_WRITE;
> + pipe = usb_sndbulkpipe(ucr->pusb_dev, EP_BULK_OUT);
> + }
> +
> + rtsx_usb_init_cmd(ucr);
> +
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_TPC, 0xFF, tpc);
> + if (card->id.type == MEMSTICK_TYPE_PRO) {
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_SECTOR_CNT_H,
> + 0xFF, (u8)(sec_cnt >> 8));
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_SECTOR_CNT_L,
> + 0xFF, (u8)sec_cnt);
> + }
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_TRANS_CFG, 0xFF, cfg);
> +
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_TC3,
> + 0xFF, (u8)(length >> 24));
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_TC2,
> + 0xFF, (u8)(length >> 16));
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_TC1,
> + 0xFF, (u8)(length >> 8));
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_TC0, 0xFF,
> + (u8)length);
> + rtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_CTL,
> + 0x03 | DMA_PACK_

Re: [PATCH v4 3/3] memstick: Add realtek USB memstick host driver

2014-03-20 Thread Andrew Morton
On Thu, 20 Mar 2014 16:38:03 +0800 Roger  wrote:

> On 02/12/2014 06:00 PM, rogera...@realtek.com wrote:
> > From: Roger Tseng 
> >
> > Realtek USB memstick host driver provides memstick host support based on the
> > Realtek USB card reader MFD driver.
> >
> > Signed-off-by: Roger Tseng 
> Andrew,
> 
> Would you please Ack or comment this patch(3/3) to let the 3 patches be 
> merged together? I have been making the same request at the message 
> thread of "[PATCH v4 2/3]" since several weeks ago but got no response. 
> Thus I re-post here and hope I could get something.
> 

Looks OK to me - I had a few minor quibbles.  Please proceed in that
way.

It would be nice if Alex and/or Maxim had time to look through the code.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging/rtl8821ae: Fix OOM handling in _rtl_init_deferred_work()

2014-03-20 Thread Richard Weinberger
alloc_workqueue() can fail, handle this case.

Signed-off-by: Richard Weinberger 
---
 drivers/staging/rtl8821ae/base.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8821ae/base.c b/drivers/staging/rtl8821ae/base.c
index fce9c3f..8dbe13c 100644
--- a/drivers/staging/rtl8821ae/base.c
+++ b/drivers/staging/rtl8821ae/base.c
@@ -388,7 +388,7 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
 
 }
 
-static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
+static int _rtl_init_deferred_work(struct ieee80211_hw *hw)
 {
struct rtl_priv *rtlpriv = rtl_priv(hw);
 
@@ -410,6 +410,9 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
rtlpriv->works.rtl_wq = create_workqueue(rtlpriv->cfg->name);
 #endif
 /**/
+   if (!rtlpriv->works.rtl_wq)
+   return -ENOMEM;
+
INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq,
  (void *)rtl_watchdog_wq_callback);
INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq,
@@ -421,6 +424,8 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq,
  (void *)rtl_fwevt_wq_callback);
 
+   return 0;
+
 }
 
 void rtl_deinit_deferred_work(struct ieee80211_hw *hw)
@@ -519,7 +524,8 @@ int rtl_init_core(struct ieee80211_hw *hw)
INIT_LIST_HEAD(&rtlpriv->entry_list);
 
/* <6> init deferred work */
-   _rtl_init_deferred_work(hw);
+   if (_rtl_init_deferred_work(hw))
+   return 1;
 
/* <7> */
 #ifdef VIF_TODO
-- 
1.8.1.4

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


[PATCH] Staging: vt6655: Fix sparse-indicated type mismatch to kmalloc

2014-03-20 Thread Conrad Meyer
Signed-off-by: Conrad Meyer 
---
Patch is against next-20140320. Fixes a minor sparse warning in the staging
driver vt6655. p->length is u16; implicit cast to size_t is fine. No reason to
cast GFP_KERNEL...
---
 drivers/staging/vt6655/wpactl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c
index d17224f..c27ed5d 100644
--- a/drivers/staging/vt6655/wpactl.c
+++ b/drivers/staging/vt6655/wpactl.c
@@ -855,11 +855,11 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p)
 
if (p->length < sizeof(struct viawget_wpa_param) ||
p->length > VIAWGET_WPA_MAX_BUF_SIZE || !p->pointer)
return -EINVAL;
 
-   param = kmalloc((int)p->length, (int)GFP_KERNEL);
+   param = kmalloc(p->length, GFP_KERNEL);
if (param == NULL)
return -ENOMEM;
 
if (copy_from_user(param, p->pointer, p->length)) {
ret = -EFAULT;
-- 
1.8.5.3

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


Re: [PATCH 2/2] coding style: fix line over 80 characters

2014-03-20 Thread Sergei Shtylyov

On 03/21/2014 12:34 AM, Sergei Shtylyov wrote:


Signed-off-by: Cédric Cabessa 
---
  drivers/staging/usbip/vhci_hcd.c | 33 ++---
  1 file changed, 22 insertions(+), 11 deletions(-)



diff --git a/drivers/staging/usbip/vhci_hcd.c
b/drivers/staging/usbip/vhci_hcd.c
index f690668..1e84577 100644
--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c

[...]

@@ -539,7 +546,9 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct
urb *urb,

  default:
  /* NOT REACHED */
-dev_err(dev, "invalid request to devnum 0 bRequest %u, wValue
%u\n", ctrlreq->bRequest,
+dev_err(dev,
+"invalid request to devnum 0 bRequest %u, wValue %u\n",
+ctrlreq->bRequest,
  ctrlreq->wValue);
  ret =  -EINVAL;
  goto no_need_xmit;
@@ -1060,7 +1069,9 @@ static int vhci_hcd_suspend(struct platform_device
*pdev, pm_message_t state)
  spin_unlock(&the_controller->lock);

  if (connected > 0) {
-dev_info(&pdev->dev, "We have %d active connection%s. Do not
suspend.\n", connected, (connected == 1 ? "" : "s"));
+dev_info(&pdev->dev,
+ "We have %d active connection%s. Do not suspend.\n",
+ connected, (connected == 1 ? "" : "s"));
  ret =  -EBUSY;
  } else {
  dev_info(&pdev->dev, "suspend vhci_hcd");



Hm, I don't see checkpatch.pl complaints about these either in the
'usb-next' branch of Greg's tree.


   Sorry, I forgot about Greg's separate staging.git repo. The patch looks 
correct in this context.


WBR, Sergei

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


[PATCH] staging: cxt1e1: replace kmalloc/kfree with OS_kmalloc/OS_kfree

2014-03-20 Thread Daeseok Youn

Replace kmalloc/kfree with OS_kmalloc/OS_kfree.
And also some allocation doesn't need to use GFP_DMA
so just use GFP_KERNEL.

c4_new() function is never called, remove it.

Signed-off-by: Daeseok Youn 
---
I'm not sure what GFP_DMA use correctly for km{,z}alloc().
Please review this. 
And this patch has coding style issues. coding style issues will be
fixed with another one. 

 drivers/staging/cxt1e1/hwprobe.c |2 +-
 drivers/staging/cxt1e1/linux.c   |   21 +--
 drivers/staging/cxt1e1/musycc.c  |   12 ---
 drivers/staging/cxt1e1/pmcc4_drv.c   |   47 +-
 drivers/staging/cxt1e1/sbecom_inline_linux.h |   23 +
 drivers/staging/cxt1e1/sbecrc.c  |5 ++-
 drivers/staging/cxt1e1/sbeproc.c |2 +-
 7 files changed, 32 insertions(+), 80 deletions(-)

diff --git a/drivers/staging/cxt1e1/hwprobe.c b/drivers/staging/cxt1e1/hwprobe.c
index 9b4198b..6e207f5 100644
--- a/drivers/staging/cxt1e1/hwprobe.c
+++ b/drivers/staging/cxt1e1/hwprobe.c
@@ -205,7 +205,7 @@ cleanup_devs(void)
 #ifdef CONFIG_SBE_PMCC4_NCOMM
free_irq(hi->pdev[1]->irq, hi->ndev);
 #endif
-   OS_kfree(hi->ndev);
+   kfree(hi->ndev);
}
 }
 
diff --git a/drivers/staging/cxt1e1/linux.c b/drivers/staging/cxt1e1/linux.c
index b02f5ade..4b4609d 100644
--- a/drivers/staging/cxt1e1/linux.c
+++ b/drivers/staging/cxt1e1/linux.c
@@ -60,7 +60,6 @@ status_tc4_chan_work_init(mpi_t *, mch_t *);
 voidmusycc_wq_chan_restart(void *);
 status_t __init c4_init(ci_t *, u_char *, u_char *);
 status_t __init c4_init2(ci_t *);
-ci_t   *__init c4_new(void *);
 int __init  c4hw_attach_all(void);
 void __init hdw_sn_get(hdw_info_t *, int);
 
@@ -418,7 +417,7 @@ create_chan(struct net_device *ndev, ci_t *ci,
struct c4_priv *priv;
 
/* allocate then fill in private data structure */
-   priv = OS_kmalloc(sizeof(struct c4_priv));
+   priv = kzalloc(sizeof(struct c4_priv), GFP_KERNEL);
if (!priv) {
pr_warning("%s: no memory for net_device !\n",
   ci->devname);
@@ -428,7 +427,7 @@ create_chan(struct net_device *ndev, ci_t *ci,
if (!dev) {
pr_warning("%s: no memory for hdlc_device !\n",
   ci->devname);
-   OS_kfree(priv);
+   kfree(priv);
return NULL;
}
priv->ci = ci;
@@ -972,8 +971,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, 
unsigned long f1,
 
if (register_netdev(ndev) ||
(c4_init(ci, (u_char *) f0, (u_char *) f1) != 
SBE_DRVR_SUCCESS)) {
-   OS_kfree(netdev_priv(ndev));
-   OS_kfree(ndev);
+   kfree(netdev_priv(ndev));
+   kfree(ndev);
error_flag = -ENODEV;
return NULL;
}
@@ -998,8 +997,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, 
unsigned long f1,
pr_warning("%s: MUSYCC could not get irq: %d\n",
   ndev->name, irq0);
unregister_netdev(ndev);
-   OS_kfree(netdev_priv(ndev));
-   OS_kfree(ndev);
+   kfree(netdev_priv(ndev));
+   kfree(ndev);
error_flag = -EIO;
return NULL;
}
@@ -1008,8 +1007,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, 
unsigned long f1,
pr_warning("%s: EBUS could not get irq: %d\n", hi->devname, 
irq1);
unregister_netdev(ndev);
free_irq(irq0, ndev);
-   OS_kfree(netdev_priv(ndev));
-   OS_kfree(ndev);
+   kfree(netdev_priv(ndev));
+   kfree(ndev);
error_flag = -EIO;
return NULL;
}
@@ -1068,8 +1067,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, 
unsigned long f1,
unregister_netdev(ndev);
free_irq(irq1, ndev);
free_irq(irq0, ndev);
-   OS_kfree(netdev_priv(ndev));
-   OS_kfree(ndev);
+   kfree(netdev_priv(ndev));
+   kfree(ndev);
/* failure, error_flag is set */
return NULL;
}
diff --git a/drivers/staging/cxt1e1/musycc.c b/drivers/staging/cxt1e1/musycc.c
index 7b4f6f2..c174f6d 100644
--- a/drivers/staging/cxt1e1/musycc.c
+++ b/drivers/staging/cxt1e1/musycc.c
@@ -744,7 +744,8 @@ musycc_init(ci_t *ci)
 
 #define INT_QUEUE_BOUNDARY  4
 
-regaddr = OS_kmalloc((INT_QUEUE_SIZE + 1) * sizeof(u_int32_t));
+   regaddr = kmalloc((INT_QUEUE_SIZE + 1) * sizeof(u_int32_t),
+ GFP_KERNEL | GFP_DMA);
 if (!regaddr)
return -ENOMEM;
 ci->iqd_p_saved = regaddr;  /* save orig val

Re: [PATCH] staging: cxt1e1: replace kmalloc/kfree with OS_kmalloc/OS_kfree

2014-03-20 Thread Greg KH
On Fri, Mar 21, 2014 at 10:41:39AM +0900, Daeseok Youn wrote:
> 
> Replace kmalloc/kfree with OS_kmalloc/OS_kfree.

I think you mean this the other way around, right?

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


Re: [PATCH] staging: cxt1e1: replace kmalloc/kfree with OS_kmalloc/OS_kfree

2014-03-20 Thread DaeSeok Youn
Yes. It was already noticed by Joe Perches.
I will send it again.

Thanks.
Daeseok Youn.

2014-03-21 11:35 GMT+09:00, Greg KH :
> On Fri, Mar 21, 2014 at 10:41:39AM +0900, Daeseok Youn wrote:
>>
>> Replace kmalloc/kfree with OS_kmalloc/OS_kfree.
>
> I think you mean this the other way around, right?
>
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: bcm: CmHost: remove temp bracing from switch/cases.

2014-03-20 Thread Gary Rookard
Remove the temp bracing afixed to case labels.

Properly indent switch/case breaks.

Signed-off-by: Gary Alan Rookard 

---
On branch staging-next
 drivers/staging/bcm/CmHost.c | 50 +++-
 1 file changed, 7 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c
index 632f81a..4564c63 100644
--- a/drivers/staging/bcm/CmHost.c
+++ b/drivers/staging/bcm/CmHost.c
@@ -460,42 +460,30 @@ static VOID CopyToAdapter(register struct 
bcm_mini_adapter *Adapter, /* u8CSSpecification);
switch (psfLocalSet->u8CSSpecification) {
case eCSPacketIPV4:
-   {
Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS;
break;
-   }
case eCSPacketIPV6:
-   {
Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV6_CS;
break;
-   }
case eCS802_3PacketEthernet:
case eCS802_1QPacketVLAN:
-   {
Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = 
ETH_CS_802_3;
break;
-   }
case eCSPacketIPV4Over802_1QVLAN:
case eCSPacketIPV4Over802_3Ethernet:
-   {
Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS;
Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = 
ETH_CS_802_3;
break;
-   }
case eCSPacketIPV6Over802_1QVLAN:
case eCSPacketIPV6Over802_3Ethernet:
-   {
Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV6_CS;
Adapter->PackInfo[uiSearchRuleIndex].bEthCSSupport = 
ETH_CS_802_3;
break;
-   }
default:
-   {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, 
DBG_LVL_ALL, "Error in value of CS Classification.. setting default to IP 
CS\n");
Adapter->PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS;
break;
}
-   }
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, 
"CopyToAdapter : Queue No : %X ETH CS Support :  %X  , IP CS Support : %X\n",
uiSearchRuleIndex,
@@ -542,32 +530,23 @@ static VOID CopyToAdapter(register struct 
bcm_mini_adapter *Adapter, /* u8ClassfierDSCAction) {
case 0: /* DSC Add Classifier */
-   {
eClassifierAction = eAddClassifier;
-   }
-   break;
+   break;
case 1: /* DSC Replace Classifier */
-   {
eClassifierAction = eReplaceClassifier;
-   }
-   break;
+   break;
case 2: /* DSC Delete Classifier */
-   {
eClassifierAction = eDeleteClassifier;
-   }
-   break;
+   break;
default:
-   {
eClassifierAction = eInvalidClassifierAction;
}
-   }
}
 
u16PacketClassificationRuleIndex = 
ntohs(psfCSType->cCPacketClassificationRule.u16PacketClassificationRuleIndex);
 
switch (eClassifierAction) {
case eAddClassifier:
-   {
/* Get a Free Classifier Index From Classifier table 
for this SF to add the Classifier */
/* Contained in this message */
nClassifierIndex = SearchClsid(Adapter, ulSFID, 
u16PacketClassificationRuleIndex);
@@ -587,10 +566,8 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter 
*Adapter, /* u8PhsDSCAction) {
case eDeleteAllPHSRules:
-   {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, 
DBG_LVL_ALL, "Deleting All PHS Rules For VCID: 0x%X\n", uVCID);
 
/* Delete All the PHS rules for this Service flow */
PhsDeleteSFRules(&Adapter->stBCMPhsContext, uVCID);
break;
-   }
case eDeletePHSRule:
-   {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, 
DBG_LVL_ALL, "PHS DSC Action = Delete PHS Rule\n");
 
if (psfCSType->cPhsRule.u8PHSI)
PhsDeletePHSRule(&Adapter->stBCMPhsContext, 
uVCID, psfCSType->cCPacketClassificationRule.u8AssociatedPHSI);
 
break;
-   }
default:
-   {
if (ucDsxType == DSC_ACK) {
/* BCM_DEBUG_PRINT(CONN_MSG,("Invalid PHS DSC 
Action For DSC\n",psfCSType->cPhsRule.u8PHSI)); */
break; /*

[PATCH v2] staging: cxt1e1: replace OS_kmalloc/OS_kfree with kmalloc/kfree

2014-03-20 Thread Daeseok Youn

Replace OS_kmalloc/OS_kfree with kmalloc/kfree.
And also some allocation doesn't need to use GFP_DMA
so just use GFP_KERNEL.

c4_new() function is never called, remove it.

Signed-off-by: Daeseok Youn 
---
v2: fix subject and comment correctly.

I'm not sure what GFP_DMA use correctly for km{,z}alloc().
Please review this. 
And this patch has coding style issues. coding style issues will be
fixed with another one. 

 drivers/staging/cxt1e1/hwprobe.c |2 +-
 drivers/staging/cxt1e1/linux.c   |   21 +--
 drivers/staging/cxt1e1/musycc.c  |   12 ---
 drivers/staging/cxt1e1/pmcc4_drv.c   |   47 +-
 drivers/staging/cxt1e1/sbecom_inline_linux.h |   23 +
 drivers/staging/cxt1e1/sbecrc.c  |5 ++-
 drivers/staging/cxt1e1/sbeproc.c |2 +-
 7 files changed, 32 insertions(+), 80 deletions(-)

diff --git a/drivers/staging/cxt1e1/hwprobe.c b/drivers/staging/cxt1e1/hwprobe.c
index 9b4198b..6e207f5 100644
--- a/drivers/staging/cxt1e1/hwprobe.c
+++ b/drivers/staging/cxt1e1/hwprobe.c
@@ -205,7 +205,7 @@ cleanup_devs(void)
 #ifdef CONFIG_SBE_PMCC4_NCOMM
free_irq(hi->pdev[1]->irq, hi->ndev);
 #endif
-   OS_kfree(hi->ndev);
+   kfree(hi->ndev);
}
 }
 
diff --git a/drivers/staging/cxt1e1/linux.c b/drivers/staging/cxt1e1/linux.c
index b02f5ade..4b4609d 100644
--- a/drivers/staging/cxt1e1/linux.c
+++ b/drivers/staging/cxt1e1/linux.c
@@ -60,7 +60,6 @@ status_tc4_chan_work_init(mpi_t *, mch_t *);
 voidmusycc_wq_chan_restart(void *);
 status_t __init c4_init(ci_t *, u_char *, u_char *);
 status_t __init c4_init2(ci_t *);
-ci_t   *__init c4_new(void *);
 int __init  c4hw_attach_all(void);
 void __init hdw_sn_get(hdw_info_t *, int);
 
@@ -418,7 +417,7 @@ create_chan(struct net_device *ndev, ci_t *ci,
struct c4_priv *priv;
 
/* allocate then fill in private data structure */
-   priv = OS_kmalloc(sizeof(struct c4_priv));
+   priv = kzalloc(sizeof(struct c4_priv), GFP_KERNEL);
if (!priv) {
pr_warning("%s: no memory for net_device !\n",
   ci->devname);
@@ -428,7 +427,7 @@ create_chan(struct net_device *ndev, ci_t *ci,
if (!dev) {
pr_warning("%s: no memory for hdlc_device !\n",
   ci->devname);
-   OS_kfree(priv);
+   kfree(priv);
return NULL;
}
priv->ci = ci;
@@ -972,8 +971,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, 
unsigned long f1,
 
if (register_netdev(ndev) ||
(c4_init(ci, (u_char *) f0, (u_char *) f1) != 
SBE_DRVR_SUCCESS)) {
-   OS_kfree(netdev_priv(ndev));
-   OS_kfree(ndev);
+   kfree(netdev_priv(ndev));
+   kfree(ndev);
error_flag = -ENODEV;
return NULL;
}
@@ -998,8 +997,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, 
unsigned long f1,
pr_warning("%s: MUSYCC could not get irq: %d\n",
   ndev->name, irq0);
unregister_netdev(ndev);
-   OS_kfree(netdev_priv(ndev));
-   OS_kfree(ndev);
+   kfree(netdev_priv(ndev));
+   kfree(ndev);
error_flag = -EIO;
return NULL;
}
@@ -1008,8 +1007,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, 
unsigned long f1,
pr_warning("%s: EBUS could not get irq: %d\n", hi->devname, 
irq1);
unregister_netdev(ndev);
free_irq(irq0, ndev);
-   OS_kfree(netdev_priv(ndev));
-   OS_kfree(ndev);
+   kfree(netdev_priv(ndev));
+   kfree(ndev);
error_flag = -EIO;
return NULL;
}
@@ -1068,8 +1067,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, 
unsigned long f1,
unregister_netdev(ndev);
free_irq(irq1, ndev);
free_irq(irq0, ndev);
-   OS_kfree(netdev_priv(ndev));
-   OS_kfree(ndev);
+   kfree(netdev_priv(ndev));
+   kfree(ndev);
/* failure, error_flag is set */
return NULL;
}
diff --git a/drivers/staging/cxt1e1/musycc.c b/drivers/staging/cxt1e1/musycc.c
index 7b4f6f2..c174f6d 100644
--- a/drivers/staging/cxt1e1/musycc.c
+++ b/drivers/staging/cxt1e1/musycc.c
@@ -744,7 +744,8 @@ musycc_init(ci_t *ci)
 
 #define INT_QUEUE_BOUNDARY  4
 
-regaddr = OS_kmalloc((INT_QUEUE_SIZE + 1) * sizeof(u_int32_t));
+   regaddr = kmalloc((INT_QUEUE_SIZE + 1) * sizeof(u_int32_t),
+ GFP_KERNEL | GFP_DMA);
 if (!regaddr)
return -ENOMEM;
 ci->iqd_

Re: [PATCH v2] staging: cxt1e1: replace OS_kmalloc/OS_kfree with kmalloc/kfree

2014-03-20 Thread Greg KH
On Fri, Mar 21, 2014 at 01:15:23PM +0900, Daeseok Youn wrote:
> 
> Replace OS_kmalloc/OS_kfree with kmalloc/kfree.

You should replace it with kzalloc, not kmalloc, as OS_kmalloc() zeroed
out the allocated data:


> -static inline void *
> -OS_kmalloc (size_t size)
> -{
> -char   *ptr = kmalloc (size, GFP_KERNEL | GFP_DMA);
> -
> -if (ptr)
> -memset (ptr, 0, size);
> -return ptr;
> -}

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


Re: [PATCH v2] staging: cxt1e1: replace OS_kmalloc/OS_kfree with kmalloc/kfree

2014-03-20 Thread DaeSeok Youn
2014-03-21 13:27 GMT+09:00 Greg KH :
> On Fri, Mar 21, 2014 at 01:15:23PM +0900, Daeseok Youn wrote:
>>
>> Replace OS_kmalloc/OS_kfree with kmalloc/kfree.
>
> You should replace it with kzalloc, not kmalloc, as OS_kmalloc() zeroed
> out the allocated data:

I think some case does not need to get zeroed memory. :-)
I will change that and send it again.

Thanks for review.
Daeseok Youn.

>
>
>> -static inline void *
>> -OS_kmalloc (size_t size)
>> -{
>> -char   *ptr = kmalloc (size, GFP_KERNEL | GFP_DMA);
>> -
>> -if (ptr)
>> -memset (ptr, 0, size);
>> -return ptr;
>> -}
>
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] fix some coding style in drivers/staging/iio

2014-03-20 Thread Jimmy Li
fix some coding style in drivers/staging/iio.

Signed-off-by: Jimmy Li
---
 drivers/staging/iio/accel/adis16220_core.c |3 ++-
 drivers/staging/iio/accel/sca3000_core.c   |3 ++-
 drivers/staging/iio/adc/ad7192.c   |3 ++-
 drivers/staging/iio/adc/ad7606_core.c  |2 +-
 drivers/staging/iio/adc/ad7816.c   |6 +++---
 drivers/staging/iio/adc/mxs-lradc.c|6 --
 drivers/staging/iio/addac/adt7316.c|3 +--
 drivers/staging/iio/frequency/ad5930.c |   23 +++
 drivers/staging/iio/frequency/ad9850.c |2 +-
 drivers/staging/iio/light/isl29018.c   |   10 ++
 drivers/staging/iio/light/tsl2583.c|2 +-
 drivers/staging/iio/light/tsl2x7x_core.c   |   12 ++--
 drivers/staging/iio/meter/ade7854-i2c.c|3 ++-
 drivers/staging/iio/resolver/ad2s1200.c|1 +
 14 files changed, 47 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16220_core.c 
b/drivers/staging/iio/accel/adis16220_core.c
index 6f38ca9..31c7a9d 100644
--- a/drivers/staging/iio/accel/adis16220_core.c
+++ b/drivers/staging/iio/accel/adis16220_core.c
@@ -392,7 +392,8 @@ static const struct iio_info adis16220_info = {
 };
 
 static const char * const adis16220_status_error_msgs[] = {
-   [ADIS16220_DIAG_STAT_VIOLATION_BIT] = "Capture period 
violation/interruption",
+   [ADIS16220_DIAG_STAT_VIOLATION_BIT] =
+   "Capture period violation/interruption",
[ADIS16220_DIAG_STAT_SPI_FAIL_BIT] = "SPI failure",
[ADIS16220_DIAG_STAT_FLASH_UPT_BIT] = "Flash update failed",
[ADIS16220_DIAG_STAT_POWER_HIGH_BIT] = "Power supply above 3.625V",
diff --git a/drivers/staging/iio/accel/sca3000_core.c 
b/drivers/staging/iio/accel/sca3000_core.c
index ed30e32..c099294 100644
--- a/drivers/staging/iio/accel/sca3000_core.c
+++ b/drivers/staging/iio/accel/sca3000_core.c
@@ -506,7 +506,8 @@ static int sca3000_read_raw(struct iio_dev *indio_dev,
mutex_unlock(&st->lock);
return ret;
}
-   *val = ((st->rx[0] & 0x3F) << 3) | ((st->rx[1] & 0xE0) 
>> 5);
+   *val = ((st->rx[0] & 0x3F) << 3) |
+   ((st->rx[1] & 0xE0) >> 5);
}
mutex_unlock(&st->lock);
return IIO_VAL_INT;
diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index 83bb44b..d1f9790 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -223,7 +223,8 @@ static int ad7192_setup(struct ad7192_state *st,
id &= AD7192_ID_MASK;
 
if (id != st->devid)
-   dev_warn(&st->sd.spi->dev, "device ID query failed (0x%X)\n", 
id);
+   dev_warn(&st->sd.spi->dev,
+   "device ID query failed (0x%X)\n", id);
 
switch (pdata->clock_source_sel) {
case AD7192_CLK_EXT_MCLK1_2:
diff --git a/drivers/staging/iio/adc/ad7606_core.c 
b/drivers/staging/iio/adc/ad7606_core.c
index f0f05f1..bf2c801 100644
--- a/drivers/staging/iio/adc/ad7606_core.c
+++ b/drivers/staging/iio/adc/ad7606_core.c
@@ -140,7 +140,7 @@ static ssize_t ad7606_store_range(struct device *dev,
return count;
 }
 
-static IIO_DEVICE_ATTR(in_voltage_range, S_IRUGO | S_IWUSR, \
+static IIO_DEVICE_ATTR(in_voltage_range, S_IRUGO | S_IWUSR,
   ad7606_show_range, ad7606_store_range, 0);
 static IIO_CONST_ATTR(in_voltage_range_available, "5000 1");
 
diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 2369cf2..ec86c01 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -153,7 +153,8 @@ static ssize_t ad7816_show_available_modes(struct device 
*dev,
return sprintf(buf, "full\npower-save\n");
 }
 
-static IIO_DEVICE_ATTR(available_modes, S_IRUGO, ad7816_show_available_modes, 
NULL, 0);
+static IIO_DEVICE_ATTR(available_modes, S_IRUGO,
+   ad7816_show_available_modes, NULL, 0);
 
 static ssize_t ad7816_show_channel(struct device *dev,
struct device_attribute *attr,
@@ -442,6 +443,5 @@ static struct spi_driver ad7816_driver = {
 module_spi_driver(ad7816_driver);
 
 MODULE_AUTHOR("Sonic Zhang ");
-MODULE_DESCRIPTION("Analog Devices AD7816/7/8 digital"
-   " temperature sensor driver");
+MODULE_DESCRIPTION("Analog Devices AD7816/7/8 digital temperature sensor 
driver");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/staging/iio/adc/mxs-lradc.c 
b/drivers/staging/iio/adc/mxs-lradc.c
index 11fb952..84f7177 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -462,7 +462,8 @@ static void mxs_lradc_setup_ts_channel(struct mxs_lradc 
*lradc, unsigned ch)
 * SoC's delay unit and start the conversion later
 * and automatically.
 */
-   mxs_lradc_reg_wr

Re: [PATCH v4 3/3] memstick: Add realtek USB memstick host driver

2014-03-20 Thread Roger

On 03/21/2014 07:18 AM, Andrew Morton wrote:

On Wed, 12 Feb 2014 18:00:38 +0800  wrote:


From: Roger Tseng 

Realtek USB memstick host driver provides memstick host support based on the
Realtek USB card reader MFD driver.


...

+static int rtsx_usb_ms_drv_probe(struct platform_device *pdev)
+{
+   struct memstick_host *msh;
+   struct rtsx_usb_ms *host;
+   struct rtsx_ucr *ucr;
+   int err;
+
+   ucr = usb_get_intfdata(to_usb_interface(pdev->dev.parent));
+   if (!ucr)
+   return -ENXIO;
+
+   dev_dbg(&(pdev->dev),
+   "Realtek USB Memstick controller found\n");
+
+   msh = memstick_alloc_host(sizeof(*host), &pdev->dev);
+   if (!msh)
+   return -ENOMEM;
+
+   host = memstick_priv(msh);
+   host->ucr = ucr;
+   host->msh = msh;
+   host->pdev = pdev;
+   host->power_mode = MEMSTICK_POWER_OFF;
+   platform_set_drvdata(pdev, host);
+
+   mutex_init(&host->host_mutex);
+   INIT_WORK(&host->handle_req, rtsx_usb_ms_handle_req);
+
+   init_completion(&host->detect_ms_exit);
+   host->detect_ms = kthread_create(rtsx_usb_detect_ms_card, host,
+   "rtsx_usb_ms_%d", pdev->id);
+   if (IS_ERR(host->detect_ms)) {
+   dev_dbg(&(pdev->dev),
+   "Unable to create polling thread.\n");
+   err = PTR_ERR(host->detect_ms);
+   goto err_out;
+   }
+
+   msh->request = rtsx_usb_ms_request;
+   msh->set_param = rtsx_usb_ms_set_param;
+   msh->caps = MEMSTICK_CAP_PAR4;
+
+   pm_runtime_enable(&pdev->dev);
+   err = memstick_add_host(msh);
+   if (err)
+   goto err_out;


Isn't that kernel thread still running?

The kernel thread is created(kthread_create) but should not start before 
the "goto".


Did I miss anything or will it be better to move all kthread things 
after here?

+   wake_up_process(host->detect_ms);
+   return 0;
+err_out:
+   memstick_free_host(msh);
+   return err;
+}


Best regards,
Roger Tseng
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel