[PATCH v6 1/4] [v6 fix] mfd/rtsx_usb: fix possible race condition

2014-04-09 Thread rogerable
From: Roger Tseng rogera...@realtek.com

Fix two possible race condition generated by misuse of del_timer in
rtsx_usb_bulk_transfer_sglist() and uninitialized timers before mfd_add_devices
in rtsx_usb_probe().

Signed-off-by: Roger Tseng rogera...@realtek.com
---
 drivers/mfd/rtsx_usb.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
index b53b9d4..0ca7973 100644
--- a/drivers/mfd/rtsx_usb.c
+++ b/drivers/mfd/rtsx_usb.c
@@ -67,7 +67,7 @@ static int rtsx_usb_bulk_transfer_sglist(struct rtsx_ucr *ucr,
ucr-sg_timer.expires = jiffies + msecs_to_jiffies(timeout);
add_timer(ucr-sg_timer);
usb_sg_wait(ucr-current_sg);
-   del_timer(ucr-sg_timer);
+   del_timer_sync(ucr-sg_timer);
 
if (act_len)
*act_len = ucr-current_sg.bytes;
@@ -644,14 +644,14 @@ static int rtsx_usb_probe(struct usb_interface *intf,
if (ret)
goto out_init_fail;
 
+   /* initialize USB SG transfer timer */
+   setup_timer(ucr-sg_timer, rtsx_usb_sg_timed_out, (unsigned long) ucr);
+
ret = mfd_add_devices(intf-dev, usb_dev-devnum, rtsx_usb_cells,
ARRAY_SIZE(rtsx_usb_cells), NULL, 0, NULL);
if (ret)
goto out_init_fail;
 
-   /* initialize USB SG transfer timer */
-   init_timer(ucr-sg_timer);
-   setup_timer(ucr-sg_timer, rtsx_usb_sg_timed_out, (unsigned long) ucr);
 #ifdef CONFIG_PM
intf-needs_remote_wakeup = 1;
usb_enable_autosuspend(usb_dev);
-- 
1.8.2

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


[PATCH v6 3/4] mmc: Add realtek USB sdmmc host driver

2014-04-09 Thread rogerable
From: Roger Tseng rogera...@realtek.com

Realtek USB SD/MMC host driver provides mmc host support based on the Realtek
USB card reader MFD driver.

Signed-off-by: Roger Tseng rogera...@realtek.com
---
 drivers/mmc/host/Kconfig  |7 +
 drivers/mmc/host/Makefile |1 +
 drivers/mmc/host/rtsx_usb_sdmmc.c | 1462 +
 3 files changed, 1470 insertions(+)
 create mode 100644 drivers/mmc/host/rtsx_usb_sdmmc.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 1384f67..1c01df4 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -689,3 +689,10 @@ config MMC_REALTEK_PCI
help
  Say Y here to include driver code to support SD/MMC card interface
  of Realtek PCI-E card reader
+
+config MMC_REALTEK_USB
+   tristate Realtek USB SD/MMC Card Interface Driver
+   depends on MFD_RTSX_USB
+   help
+ Say Y here to include driver code to support SD/MMC card interface
+ of Realtek RTS5129/39 series card reader
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 3483b6b..8194317 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -53,6 +53,7 @@ obj-$(CONFIG_MMC_USHC)+= ushc.o
 obj-$(CONFIG_MMC_WMT)  += wmt-sdmmc.o
 
 obj-$(CONFIG_MMC_REALTEK_PCI)  += rtsx_pci_sdmmc.o
+obj-$(CONFIG_MMC_REALTEK_USB)  += rtsx_usb_sdmmc.o
 
 obj-$(CONFIG_MMC_SDHCI_PLTFM)  += sdhci-pltfm.o
 obj-$(CONFIG_MMC_SDHCI_CNS3XXX)+= sdhci-cns3xxx.o
diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c 
b/drivers/mmc/host/rtsx_usb_sdmmc.c
new file mode 100644
index 000..37f58b5
--- /dev/null
+++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
@@ -0,0 +1,1462 @@
+/* Realtek USB SD/MMC 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 http://www.gnu.org/licenses/.
+ *
+ * Author:
+ *   Roger Tseng rogera...@realtek.com
+ */
+
+#include linux/module.h
+#include linux/slab.h
+#include linux/delay.h
+#include linux/platform_device.h
+#include linux/usb.h
+#include linux/mmc/host.h
+#include linux/mmc/mmc.h
+#include linux/mmc/sd.h
+#include linux/mmc/sdio.h
+#include linux/mmc/card.h
+#include linux/scatterlist.h
+#include linux/pm_runtime.h
+
+#include linux/mfd/rtsx_usb.h
+#include asm/unaligned.h
+
+#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
+#include linux/leds.h
+#include linux/workqueue.h
+#define RTSX_USB_USE_LEDS_CLASS
+#endif
+
+struct rtsx_usb_sdmmc {
+   struct platform_device  *pdev;
+   struct rtsx_ucr *ucr;
+   struct mmc_host *mmc;
+   struct mmc_request  *mrq;
+
+   struct mutexhost_mutex;
+
+   u8  ssc_depth;
+   unsigned intclock;
+   boolvpclk;
+   booldouble_clk;
+   boolhost_removal;
+   boolcard_exist;
+   boolinitial_mode;
+   boolddr_mode;
+
+   unsigned char   power_mode;
+
+#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
+   struct led_classdev led;
+   charled_name[32];
+   struct work_struct  led_work;
+#endif
+};
+
+static inline struct device *sdmmc_dev(struct rtsx_usb_sdmmc *host)
+{
+   return (host-pdev-dev);
+}
+
+static inline void sd_clear_error(struct rtsx_usb_sdmmc *host)
+{
+   struct rtsx_ucr *ucr = host-ucr;
+   rtsx_usb_ep0_write_register(ucr, CARD_STOP,
+ SD_STOP | SD_CLR_ERR,
+ SD_STOP | SD_CLR_ERR);
+
+   rtsx_usb_clear_dma_err(ucr);
+   rtsx_usb_clear_fsm_err(ucr);
+}
+
+#ifdef DEBUG
+static void sd_print_debug_regs(struct rtsx_usb_sdmmc *host)
+{
+   struct rtsx_ucr *ucr = host-ucr;
+   u8 val = 0;
+
+   rtsx_usb_ep0_read_register(ucr, SD_STAT1, val);
+   dev_dbg(sdmmc_dev(host), SD_STAT1: 0x%x\n, val);
+   rtsx_usb_ep0_read_register(ucr, SD_STAT2, val);
+   dev_dbg(sdmmc_dev(host), SD_STAT2: 0x%x\n, val);
+   rtsx_usb_ep0_read_register(ucr, SD_BUS_STAT, val);
+   dev_dbg(sdmmc_dev(host), SD_BUS_STAT: 0x%x\n, val);
+}
+#else
+#define sd_print_debug_regs(host)
+#endif /* DEBUG */
+
+static int sd_read_data(struct rtsx_usb_sdmmc *host, struct mmc_command *cmd,
+  

[PATCH v6 4/4] memstick: Add realtek USB memstick host driver

2014-04-09 Thread rogerable
From: Roger Tseng rogera...@realtek.com

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

Signed-off-by: Roger Tseng rogera...@realtek.com
---
 drivers/memstick/host/Kconfig   |  10 +
 drivers/memstick/host/Makefile  |   1 +
 drivers/memstick/host/rtsx_usb_ms.c | 839 
 3 files changed, 850 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..a7282b7
--- /dev/null
+++ b/drivers/memstick/host/rtsx_usb_ms.c
@@ -0,0 +1,839 @@
+/* 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 http://www.gnu.org/licenses/.
+ *
+ * Author:
+ *   Roger Tseng rogera...@realtek.com
+ */
+
+#include linux/module.h
+#include linux/highmem.h
+#include linux/delay.h
+#include linux/platform_device.h
+#include linux/workqueue.h
+#include linux/memstick.h
+#include linux/kthread.h
+#include linux/mfd/rtsx_usb.h
+#include linux/pm_runtime.h
+#include linux/mutex.h
+#include linux/sched.h
+#include linux/completion.h
+#include asm/unaligned.h
+
+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, CARD_CLK_EN, 0, 0);
+   rtsx_usb_add_cmd(ucr, READ_REG_CMD, 

Re: [PATCH v12][ 06/12] ARM: dts: imx5*, imx6*: correct display-timings nodes.

2014-04-09 Thread Lothar Waßmann
Hi,

Shawn Guo wrote:
 On Mon, Apr 07, 2014 at 02:44:45PM +0200, Denis Carikli wrote:
  The imx-drm driver can't use the de-active and
  pixelclk-active display-timings properties yet.
  
  Instead the data-enable and the pixel data clock
  polarity are hardcoded in the imx-drm driver.
  
  So theses properties are now set to keep
  the same behaviour when imx-drm will start
  using them.
  
  Signed-off-by: Denis Carikli de...@eukrea.com
  ---
  ChangeLog v9-v10:
  - New patch that was splitted out of:
staging imx-drm: Use de-active and pixelclk-active
display-timings.
  ---
   arch/arm/boot/dts/imx51-babbage.dts   |2 ++
   arch/arm/boot/dts/imx53-m53evk.dts|2 ++
   arch/arm/boot/dts/imx53-tx53-x03x.dts |2 +-
   arch/arm/boot/dts/imx6qdl-gw53xx.dtsi |2 ++
   arch/arm/boot/dts/imx6qdl-gw54xx.dtsi |2 ++
   arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi |2 ++
   arch/arm/boot/dts/imx6qdl-sabreauto.dtsi  |2 ++
   arch/arm/boot/dts/imx6qdl-sabrelite.dtsi  |2 ++
   arch/arm/boot/dts/imx6qdl-sabresd.dtsi|2 ++
   9 files changed, 17 insertions(+), 1 deletion(-)
 
 ...
 
  diff --git a/arch/arm/boot/dts/imx53-tx53-x03x.dts 
  b/arch/arm/boot/dts/imx53-tx53-x03x.dts
  index 0217dde3..4092a81 100644
  --- a/arch/arm/boot/dts/imx53-tx53-x03x.dts
  +++ b/arch/arm/boot/dts/imx53-tx53-x03x.dts
  @@ -93,7 +93,7 @@
  hsync-active = 0;
  vsync-active = 0;
  de-active = 1;
  -   pixelclk-active = 1;
  +   pixelclk-active = 0;
 
 @Lothar, is this change correct?
 
No, the ET0430 display which is affected by this patch actually has an
inverted clock wrt the other displays of the family.

'pixelclk-active = 1' is the correct setting for this display!

Thanks, Shawn for the reminder.


Lothar Waßmann
-- 
___

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | i...@karo-electronics.de
___
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8187se: fix pointer and return statement's syntax

2014-04-09 Thread Martin Kepplinger
Use the common kernel coding style.

Signed-off-by: Martin Kepplinger mart...@posteo.de
---
noise from the eudyptula challenge. applies to next-20140408 as well as
linus' current tree.

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

diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c 
b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
index 0dc5ae4..e6257b3 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
@@ -180,7 +180,7 @@ static inline int ieee80211_put_snap(u8 *data, u16 h_proto)
 int ieee80211_encrypt_fragment(struct ieee80211_device *ieee,
   struct sk_buff *frag, int hdr_len)
 {
-   struct ieee80211_crypt_data* crypt = ieee-crypt[ieee-tx_keyidx];
+   struct ieee80211_crypt_data *crypt = ieee-crypt[ieee-tx_keyidx];
int res;
 
/*
@@ -285,7 +285,7 @@ static int ieee80211_classify(struct sk_buff *skb,
 
if (!network-QoS_Enable) {
skb-priority = 0;
-   return(wme_UP);
+   return wme_UP;
}
 
if (eh-ether_type == __constant_htons(ETHERTYPE_IP)) {
@@ -304,7 +304,7 @@ static int ieee80211_classify(struct sk_buff *skb,
}
 
skb-priority = wme_UP;
-   return(wme_UP);
+   return wme_UP;
 }
 
 /* SKBs are added to the ieee-tx_queue. */
-- 
1.7.10.4

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


staging/rtl8187se should be removed

2014-04-09 Thread Xose Vazquez Perez
hi,

Support for RTL8187SE devices(0x8199) was added to
rtl8180 recently. See 1eba648f998ef9c31b8cf062754a4a7b4ab9001f
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v6 3/4] mmc: Add realtek USB sdmmc host driver

2014-04-09 Thread Ulf Hansson
On 9 April 2014 08:16,  rogera...@realtek.com wrote:
 From: Roger Tseng rogera...@realtek.com

 Realtek USB SD/MMC host driver provides mmc host support based on the Realtek
 USB card reader MFD driver.

 Signed-off-by: Roger Tseng rogera...@realtek.com
 ---
  drivers/mmc/host/Kconfig  |7 +
  drivers/mmc/host/Makefile |1 +
  drivers/mmc/host/rtsx_usb_sdmmc.c | 1462 
 +
  3 files changed, 1470 insertions(+)
  create mode 100644 drivers/mmc/host/rtsx_usb_sdmmc.c

 diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
 index 1384f67..1c01df4 100644
 --- a/drivers/mmc/host/Kconfig
 +++ b/drivers/mmc/host/Kconfig
 @@ -689,3 +689,10 @@ config MMC_REALTEK_PCI
 help
   Say Y here to include driver code to support SD/MMC card interface
   of Realtek PCI-E card reader
 +
 +config MMC_REALTEK_USB
 +   tristate Realtek USB SD/MMC Card Interface Driver
 +   depends on MFD_RTSX_USB
 +   help
 + Say Y here to include driver code to support SD/MMC card interface
 + of Realtek RTS5129/39 series card reader
 diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
 index 3483b6b..8194317 100644
 --- a/drivers/mmc/host/Makefile
 +++ b/drivers/mmc/host/Makefile
 @@ -53,6 +53,7 @@ obj-$(CONFIG_MMC_USHC)+= ushc.o
  obj-$(CONFIG_MMC_WMT)  += wmt-sdmmc.o

  obj-$(CONFIG_MMC_REALTEK_PCI)  += rtsx_pci_sdmmc.o
 +obj-$(CONFIG_MMC_REALTEK_USB)  += rtsx_usb_sdmmc.o

  obj-$(CONFIG_MMC_SDHCI_PLTFM)  += sdhci-pltfm.o
  obj-$(CONFIG_MMC_SDHCI_CNS3XXX)+= sdhci-cns3xxx.o
 diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c 
 b/drivers/mmc/host/rtsx_usb_sdmmc.c
 new file mode 100644
 index 000..37f58b5
 --- /dev/null
 +++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
 @@ -0,0 +1,1462 @@
 +/* Realtek USB SD/MMC 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 http://www.gnu.org/licenses/.
 + *
 + * Author:
 + *   Roger Tseng rogera...@realtek.com
 + */
 +
 +#include linux/module.h
 +#include linux/slab.h
 +#include linux/delay.h
 +#include linux/platform_device.h
 +#include linux/usb.h
 +#include linux/mmc/host.h
 +#include linux/mmc/mmc.h
 +#include linux/mmc/sd.h
 +#include linux/mmc/sdio.h
 +#include linux/mmc/card.h
 +#include linux/scatterlist.h
 +#include linux/pm_runtime.h
 +
 +#include linux/mfd/rtsx_usb.h
 +#include asm/unaligned.h
 +
 +#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
 +#include linux/leds.h
 +#include linux/workqueue.h
 +#define RTSX_USB_USE_LEDS_CLASS
 +#endif
 +
 +struct rtsx_usb_sdmmc {
 +   struct platform_device  *pdev;
 +   struct rtsx_ucr *ucr;
 +   struct mmc_host *mmc;
 +   struct mmc_request  *mrq;
 +
 +   struct mutexhost_mutex;
 +
 +   u8  ssc_depth;
 +   unsigned intclock;
 +   boolvpclk;
 +   booldouble_clk;
 +   boolhost_removal;
 +   boolcard_exist;
 +   boolinitial_mode;
 +   boolddr_mode;
 +
 +   unsigned char   power_mode;
 +
 +#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
 +   struct led_classdev led;
 +   charled_name[32];
 +   struct work_struct  led_work;
 +#endif
 +};
 +
 +static inline struct device *sdmmc_dev(struct rtsx_usb_sdmmc *host)
 +{
 +   return (host-pdev-dev);
 +}
 +
 +static inline void sd_clear_error(struct rtsx_usb_sdmmc *host)
 +{
 +   struct rtsx_ucr *ucr = host-ucr;
 +   rtsx_usb_ep0_write_register(ucr, CARD_STOP,
 + SD_STOP | SD_CLR_ERR,
 + SD_STOP | SD_CLR_ERR);
 +
 +   rtsx_usb_clear_dma_err(ucr);
 +   rtsx_usb_clear_fsm_err(ucr);
 +}
 +
 +#ifdef DEBUG
 +static void sd_print_debug_regs(struct rtsx_usb_sdmmc *host)
 +{
 +   struct rtsx_ucr *ucr = host-ucr;
 +   u8 val = 0;
 +
 +   rtsx_usb_ep0_read_register(ucr, SD_STAT1, val);
 +   dev_dbg(sdmmc_dev(host), SD_STAT1: 0x%x\n, val);
 +   rtsx_usb_ep0_read_register(ucr, SD_STAT2, val);
 +   dev_dbg(sdmmc_dev(host), SD_STAT2: 0x%x\n, val);
 +   rtsx_usb_ep0_read_register(ucr, SD_BUS_STAT, val);
 +   

Re: staging-next: r8723au: Kconfig related nitpicks

2014-04-09 Thread Paul Bolle
On Tue, 2014-04-08 at 20:21 +0200, Jes Sorensen wrote:
  0) I stumbled on two minor Kconfig related issues in the r8723au driver
  in staging-next.

These have hit mainline now.

 I have fixed these two and pushed the changes into my git tree on
 kernel.org. The tree tracks Greg's staging-next branch, you can find all
 my current changes there (unless I managed to mess it up somehow :):
 
[...]

 I plan to push these to Greg for the next -rc round.

So they'll hit mainline in due course. Thanks for picking this up!


Paul Bolle

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


Re: [PATCH] staging: rtl8187se: fix pointer and return statement's syntax

2014-04-09 Thread Josh Triplett
On Wed, Apr 09, 2014 at 09:25:55AM +0200, Martin Kepplinger wrote:
 Use the common kernel coding style.
 
 Signed-off-by: Martin Kepplinger mart...@posteo.de

Reviewed-by: Josh Triplett j...@joshtriplett.org
 
  drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c 
 b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
 index 0dc5ae4..e6257b3 100644
 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
 +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
 @@ -180,7 +180,7 @@ static inline int ieee80211_put_snap(u8 *data, u16 
 h_proto)
  int ieee80211_encrypt_fragment(struct ieee80211_device *ieee,
  struct sk_buff *frag, int hdr_len)
  {
 - struct ieee80211_crypt_data* crypt = ieee-crypt[ieee-tx_keyidx];
 + struct ieee80211_crypt_data *crypt = ieee-crypt[ieee-tx_keyidx];
   int res;
  
   /*
 @@ -285,7 +285,7 @@ static int ieee80211_classify(struct sk_buff *skb,
  
   if (!network-QoS_Enable) {
   skb-priority = 0;
 - return(wme_UP);
 + return wme_UP;
   }
  
   if (eh-ether_type == __constant_htons(ETHERTYPE_IP)) {
 @@ -304,7 +304,7 @@ static int ieee80211_classify(struct sk_buff *skb,
   }
  
   skb-priority = wme_UP;
 - return(wme_UP);
 + return wme_UP;
  }
  
  /* SKBs are added to the ieee-tx_queue. */
 -- 
 1.7.10.4
 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: speakup: fix misuse of kstrtol() in handle_goto()

2014-04-09 Thread Daeseok Youn

A string of goto_buf has a number followed by x or y.
e.g. 3x means move 3 lines down.
The kstrtol() returns an error(-EINVAL) with this string so
go_pos has unsigned a value of that error.
And also *cp has not expected value.

And fix sparse warnings:
 drivers/staging/speakup/main.c:1901 handle_goto() warn:
unsigned '(speakup_console[vc-vc_num]-go_pos)' is never less than zero.
 drivers/staging/speakup/main.c:1911 handle_goto() warn:
unsigned '(speakup_console[vc-vc_num]-go_pos)' is never less than zero.

Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
---
 drivers/staging/speakup/main.c |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index ef5933b..3b6e535 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1855,8 +1855,9 @@ static int handle_goto(struct vc_data *vc, u_char type, 
u_char ch, u_short key)
 {
static u_char goto_buf[8];
static int num;
-   int maxlen, go_pos;
+   int maxlen;
char *cp;
+
if (type == KT_SPKUP  ch == SPEAKUP_GOTO)
goto do_goto;
if (type == KT_LATIN  ch == '\n')
@@ -1891,25 +1892,24 @@ oops:
spk_special_handler = NULL;
return 1;
}
-   go_pos = kstrtol(goto_buf, 10, (long *)cp);
-   goto_pos = (u_long) go_pos;
+
+   goto_pos = simple_strtoul(goto_buf, cp, 10);
+
if (*cp == 'x') {
if (*goto_buf  '0')
goto_pos += spk_x;
-   else
+   else if (goto_pos  0)
goto_pos--;
-   if (goto_pos  0)
-   goto_pos = 0;
+
if (goto_pos = vc-vc_cols)
goto_pos = vc-vc_cols - 1;
goto_x = 1;
} else {
if (*goto_buf  '0')
goto_pos += spk_y;
-   else
+   else if (goto_pos  0)
goto_pos--;
-   if (goto_pos  0)
-   goto_pos = 0;
+
if (goto_pos = vc-vc_rows)
goto_pos = vc-vc_rows - 1;
goto_x = 0;
-- 
1.7.4.4


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


[PATCH] staging: comedi: adl_pci9118: fix whitespace issues

2014-04-09 Thread Richard Leitner

Removed not needed spaces and fixed too long lines

PS: this is an exercise to get into the patch submitting workflow

Signed-off-by: Richard Leitner m...@g0hl1n.net
---
 drivers/staging/comedi/drivers/adl_pci9118.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c

index 3cfa175..d028d6b 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -96,7 +96,7 @@ Configuration options:
 * correct channel number on every 12 bit sample
 */

-#define IORANGE_9118   64  /* I hope */
+#define IORANGE_9118   64  /* I hope */
 #define PCI9118_CHANLEN255 /*
 * len of chanlist, some source say 256,
 * but reality looks like 255 :-(
@@ -356,7 +356,7 @@ struct pci9118_private {
unsigned int ai_data_len;
unsigned short ao_data[2];  /* data output buffer */
unsigned int ai_scans;  /* number of scans to do */
-   char dma_doublebuf; /* we can use double buffering 
*/
+   char dma_doublebuf; /* we can use double buffering*/
unsigned int dma_actbuf;/* which buffer is used now */
unsigned short *dmabuf_virt[2]; /*
 * pointers to begin of
@@ -383,7 +383,7 @@ struct pci9118_private {
 * users(0-AI, 1-AO, 2-DI, 3-DO)
 */
unsigned int cnt0_divisor;  /* actual CNT0 divisor */
-	void (*int_ai_func) (struct comedi_device *, struct comedi_subdevice 
*,

+   void (*int_ai_func)(struct comedi_device *, struct comedi_subdevice *,
unsigned short,
unsigned int,
unsigned short);/*
@@ -1045,7 +1045,7 @@ static void interrupt_pci9118_ai_dma(struct 
comedi_device *dev,

move_block_from_dma(dev, s,
devpriv-dmabuf_virt[devpriv-dma_actbuf],
samplesinbuf);
-   m = m - sampls; /* m= how many samples was transferred 
*/
+   m = m - sampls; /* m=how many samples was transferred */
}

if (!devpriv-ai_neverending) {
--
1.7.10.4

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


[PATCH 1/8] imx-drm: Move IPU_PIX_FMT_GBR24 definition into imx-ipu-v3.h

2014-04-09 Thread Russell King
From: Philipp Zabel p.za...@pengutronix.de
To: linux-arm-ker...@lists.infradead.org

The IPU display controller supports a non-standard green-red-blue ordered
format that is used on the connection between IPU display interface 1 and
the TV encoder on i.MX53.
In preparation for the move of IPU core code out of staging, place the
IPU_PIX_FMT_GBR24 definition in imx-ipu-v3.h, so that both the IPU
display interface driver and the TVE encoder driver can access it.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
---
 drivers/staging/imx-drm/imx-drm.h   | 4 
 drivers/staging/imx-drm/imx-tve.c   | 1 +
 drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h | 2 ++
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/imx-drm/imx-drm.h 
b/drivers/staging/imx-drm/imx-drm.h
index a24d46ad3dce..a322bac55414 100644
--- a/drivers/staging/imx-drm/imx-drm.h
+++ b/drivers/staging/imx-drm/imx-drm.h
@@ -1,10 +1,6 @@
 #ifndef _IMX_DRM_H_
 #define _IMX_DRM_H_
 
-#include linux/videodev2.h
-
-#define IPU_PIX_FMT_GBR24  v4l2_fourcc('G', 'B', 'R', '3')
-
 struct device_node;
 struct drm_crtc;
 struct drm_connector;
diff --git a/drivers/staging/imx-drm/imx-tve.c 
b/drivers/staging/imx-drm/imx-tve.c
index 7002ae0a08ca..575533f4fd64 100644
--- a/drivers/staging/imx-drm/imx-tve.c
+++ b/drivers/staging/imx-drm/imx-tve.c
@@ -31,6 +31,7 @@
 #include drm/drm_fb_helper.h
 #include drm/drm_crtc_helper.h
 
+#include ipu-v3/imx-ipu-v3.h
 #include imx-drm.h
 
 #define TVE_COM_CONF_REG   0x00
diff --git a/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h 
b/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
index 4826b5c0249d..c4d14ead5837 100644
--- a/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
+++ b/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
@@ -25,6 +25,8 @@ enum ipuv3_type {
IPUV3H,
 };
 
+#define IPU_PIX_FMT_GBR24  v4l2_fourcc('G', 'B', 'R', '3')
+
 /*
  * Bitfield of Display Interface signal polarities.
  */
-- 
1.8.3.1

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


[PATCH 2/8] imx-drm: ipu-dc: Use usleep_range instead of msleep

2014-04-09 Thread Russell King
From: Philipp Zabel p.za...@pengutronix.de
To: linux-arm-ker...@lists.infradead.org

Since msleep(2) can sleep up to 20ms anyway, make this explicit by using
usleep_range(2000, 2).

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
---
 drivers/staging/imx-drm/ipu-v3/ipu-dc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dc.c 
b/drivers/staging/imx-drm/ipu-v3/ipu-dc.c
index d0e3bc3c53e7..d5de8bb5c803 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-dc.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-dc.c
@@ -262,7 +262,7 @@ void ipu_dc_disable_channel(struct ipu_dc *dc)
 
/* Wait for DC triple buffer to empty */
while ((readl(priv-dc_reg + DC_STAT)  val) != val) {
-   msleep(2);
+   usleep_range(2000, 2);
timeout -= 2;
if (timeout = 0)
break;
-- 
1.8.3.1

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


[PATCH 3/8] imx-drm: ipu-dmfc: Remove unneeded 'dmfc' check

2014-04-09 Thread Russell King
From: Fabio Estevam fabio.este...@freescale.com
To: linux-arm-ker...@lists.infradead.org

Fix the following static checker warning:

drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c:164 ipu_dmfc_setup_channel() warn: 
variable dereferenced before check 'dmfc' (see line 157)

As 'dmfc' could never be null, there is no need to do such check.

Reported-by: Dan Carpenter dan.carpen...@oracle.com
Signed-off-by: Fabio Estevam fabio.este...@freescale.com
Signed-off-by: Fabio Estevam feste...@gmail.com
Acked-by: Philipp Zabel p.za...@pengutronix.de
Signed-off-by: Russell King rmk+ker...@arm.linux.org.uk
---
 drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c 
b/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
index 98070dd8c920..45213017fa4b 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
@@ -161,9 +161,6 @@ static int ipu_dmfc_setup_channel(struct dmfc_channel 
*dmfc, int slots,
dmfc: using %d slots starting from segment %d for IPU 
channel %d\n,
slots, segment, dmfc-data-ipu_channel);
 
-   if (!dmfc)
-   return -EINVAL;
-
switch (slots) {
case 1:
field = DMFC_FIFO_SIZE_64;
-- 
1.8.3.1

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


[PATCH 3/3] staging: r8712u: Fix case where ethtype was never obtained and always be checked against 0

2014-04-09 Thread Larry Finger
Zero-initializing ether_type masked that the ether type would never be
obtained for 8021x packets and the comparition against eapol_type
would always fail.

Reported-by: Jes Sorensen jes.soren...@redhat.com
Signed-off-by: Larry Finger larry.fin...@lwfinger.net
Cc: Stable sta...@vger.kernel.org
---
 drivers/staging/rtl8712/rtl871x_recv.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_recv.c 
b/drivers/staging/rtl8712/rtl871x_recv.c
index 23ec684..d8d1a76 100644
--- a/drivers/staging/rtl8712/rtl871x_recv.c
+++ b/drivers/staging/rtl8712/rtl871x_recv.c
@@ -254,7 +254,7 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter,
struct sta_info *psta;
struct  sta_priv *pstapriv;
union recv_frame *prtnframe;
-   u16 ether_type = 0;
+   u16 ether_type;
 
pstapriv = adapter-stapriv;
ptr = get_recvframe_data(precv_frame);
@@ -262,16 +262,15 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter,
psta_addr = pfhdr-attrib.ta;
psta = r8712_get_stainfo(pstapriv, psta_addr);
auth_alg = adapter-securitypriv.AuthAlgrthm;
-   if (auth_alg == 2) {
+   if (auth_alg == dot11AuthAlgrthm_8021X) {
+   /* get ether_type */
+   ptr = ptr + pfhdr-attrib.hdrlen + LLC_HEADER_SIZE;
+   memcpy(ether_type, ptr, 2);
+   ether_type = ntohs((unsigned short)ether_type);
+
if ((psta != NULL)  (psta-ieee8021x_blocked)) {
/* blocked
 * only accept EAPOL frame */
-   prtnframe = precv_frame;
-   /*get ether_type */
-   ptr = ptr + pfhdr-attrib.hdrlen +
- pfhdr-attrib.iv_len + LLC_HEADER_SIZE;
-   memcpy(ether_type, ptr, 2);
-   ether_type = ntohs((unsigned short)ether_type);
if (ether_type == 0x888e)
prtnframe = precv_frame;
else {
-- 
1.8.1.4

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


[PATCH 0/3] Fix some bugs in staging drivers

2014-04-09 Thread Larry Finger
While analyzing parts of the recently merged r8723au driver, Jes Sorensen
found two bugs that are found in other Reaktek drivers in staging. This
set of patches fixes them.

Signed-off-by: Larry Finger larry.fin...@lwfinger.net


Larry Finger (3):
  staging: r8188eu: Calling rtw_get_stainfo() with a NULL sta_addr will
return NULL
  staging: r8188eu: Fix case where ethtype was never obtained and always
be checked against 0
  staging: r8712u: Fix case where ethtype was never obtained and always
be checked against 0

 drivers/staging/rtl8188eu/core/rtw_recv.c | 24 ++--
 drivers/staging/rtl8712/rtl871x_recv.c| 15 +++
 2 files changed, 17 insertions(+), 22 deletions(-)

-- 
1.8.1.4

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


[PATCH 2/3] staging: r8188eu: Fix case where ethtype was never obtained and always be checked against 0

2014-04-09 Thread Larry Finger
Zero-initializing ether_type masked that the ether type would never be
obtained for 8021x packets and the comparition against eapol_type
would always fail.

Reported-by: Jes Sorensen jes.soren...@redhat.com
Signed-off-by: Larry Finger larry.fin...@lwfinger.net
Cc: Stable sta...@vger.kernel.org
---
 drivers/staging/rtl8188eu/core/rtw_recv.c | 20 
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 01fcabc..61084d6 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -551,7 +551,7 @@ static struct recv_frame *portctrl(struct adapter *adapter,
struct sta_info *psta;
struct sta_priv *pstapriv;
struct recv_frame *prtnframe;
-   u16 ether_type = 0;
+   u16 ether_type;
u16  eapol_type = 0x888e;/* for Funia BD's WPA issue */
struct rx_pkt_attrib *pattrib;
__be16 be_tmp;
@@ -571,19 +571,17 @@ static struct recv_frame *portctrl(struct adapter 
*adapter,
 
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, 
(portctrl:adapter-securitypriv.dot11AuthAlgrthm=%d\n, 
adapter-securitypriv.dot11AuthAlgrthm));
 
-   if (auth_alg == 2) {
+   if (auth_alg == dot11AuthAlgrthm_8021X) {
+   /* get ether_type */
+   ptr = ptr + pfhdr-attrib.hdrlen + LLC_HEADER_SIZE;
+   memcpy(ether_type, ptr, 2);
+   ether_type = ntohs((unsigned short)ether_type);
+
if ((psta != NULL)  (psta-ieee8021x_blocked)) {
/* blocked */
/* only accept EAPOL frame */
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, 
(portctrl:psta-ieee8021x_blocked==1\n));
 
-   prtnframe = precv_frame;
-
-   /* get ether_type */
-   ptr = 
ptr+pfhdr-attrib.hdrlen+pfhdr-attrib.iv_len+LLC_HEADER_SIZE;
-   memcpy(be_tmp, ptr, 2);
-   ether_type = ntohs(be_tmp);
-
if (ether_type == eapol_type) {
prtnframe = precv_frame;
} else {
@@ -616,9 +614,7 @@ static struct recv_frame *portctrl(struct adapter *adapter,
} else {
prtnframe = precv_frame;
}
-
-
-   return prtnframe;
+   return prtnframe;
 }
 
 static int recv_decache(struct recv_frame *precv_frame, u8 bretry,
-- 
1.8.1.4

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


Re: [PATCH 2/3] staging: r8188eu: Fix case where ethtype was never obtained and always be checked against 0

2014-04-09 Thread Sergei Shtylyov

On 04/09/2014 08:12 PM, Larry Finger wrote:


Zero-initializing ether_type masked that the ether type would never be
obtained for 8021x packets and the comparition against eapol_type
would always fail.



Reported-by: Jes Sorensen jes.soren...@redhat.com
Signed-off-by: Larry Finger larry.fin...@lwfinger.net
Cc: Stable sta...@vger.kernel.org
---
  drivers/staging/rtl8188eu/core/rtw_recv.c | 20 
  1 file changed, 8 insertions(+), 12 deletions(-)



diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 01fcabc..61084d6 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -551,7 +551,7 @@ static struct recv_frame *portctrl(struct adapter *adapter,
struct sta_info *psta;
struct sta_priv *pstapriv;
struct recv_frame *prtnframe;
-   u16 ether_type = 0;
+   u16 ether_type;


   I suggest:

u16 ethertype;


u16  eapol_type = 0x888e;/* for Funia BD's WPA issue */
struct rx_pkt_attrib *pattrib;
__be16 be_tmp;
@@ -571,19 +571,17 @@ static struct recv_frame *portctrl(struct adapter 
*adapter,

RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, 
(portctrl:adapter-securitypriv.dot11AuthAlgrthm=%d\n, 
adapter-securitypriv.dot11AuthAlgrthm));

-   if (auth_alg == 2) {
+   if (auth_alg == dot11AuthAlgrthm_8021X) {
+   /* get ether_type */
+   ptr = ptr + pfhdr-attrib.hdrlen + LLC_HEADER_SIZE;


   Why not:

ptr += pfhdr-attrib.hdrlen + LLC_HEADER_SIZE;

WBR, Sergei


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


[PATCH net, V1 3/3] Drivers: net: hyperv: Address UDP checksum issues

2014-04-09 Thread K. Y. Srinivasan
ws2008r2 does not support UDP checksum offload. Thus, we cannnot turn on
UDP offload in the host. Also, on ws2012 and ws2012 r2, there appear to be
an issue with UDP checksum offload.
Fix this issue by computing the UDP checksum in the Hyper-V driver.

Based on Dave Miller's comments, in this version, I have COWed the skb
before modifying the UDP header (the checksum field).

Signed-off-by: K. Y. Srinivasan k...@microsoft.com
Reviewed-by: Haiyang Zhang haiya...@microsoft.com
---
 drivers/net/hyperv/hyperv_net.h   |1 +
 drivers/net/hyperv/netvsc_drv.c   |   26 +-
 drivers/net/hyperv/rndis_filter.c |   12 +++-
 3 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 13010b4..d18f711d 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -747,6 +747,7 @@ struct ndis_oject_header {
 #define NDIS_TCP_LARGE_SEND_OFFLOAD_IPV4   0
 #define NDIS_TCP_LARGE_SEND_OFFLOAD_IPV6   1
 
+#define VERSION_4_OFFLOAD_SIZE 22
 /*
  * New offload OIDs for NDIS 6
  */
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 6f39baa..31e55fb 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -398,7 +398,30 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct 
net_device *net)
csum_info-transmit.tcp_checksum = 1;
csum_info-transmit.tcp_header_offset = hdr_offset;
} else if (net_trans_info  INFO_UDP) {
-   csum_info-transmit.udp_checksum = 1;
+   /* UDP checksum offload is not supported on ws2008r2.
+* Furthermore, on ws2012 and ws2012r2, there are some
+* issues with udp checksum offload from Linux guests.
+* (these are host issues).
+* For now compute the checksum here.
+*/
+   struct udphdr *uh;
+   u16 udp_len;
+
+   ret = skb_cow_head(skb, 0);
+   if (ret)
+   goto drop;
+
+   uh = udp_hdr(skb);
+   udp_len = ntohs(uh-len);
+   uh-check = 0;
+   uh-check = csum_tcpudp_magic(ip_hdr(skb)-saddr,
+ ip_hdr(skb)-daddr,
+ udp_len, IPPROTO_UDP,
+ csum_partial(uh, udp_len, 0));
+   if (uh-check == 0)
+   uh-check = CSUM_MANGLED_0;
+
+   csum_info-transmit.udp_checksum = 0;
}
goto do_send;
 
@@ -438,6 +461,7 @@ do_send:
 
ret = netvsc_send(net_device_ctx-device_ctx, packet);
 
+drop:
if (ret == 0) {
net-stats.tx_bytes += skb-len;
net-stats.tx_packets++;
diff --git a/drivers/net/hyperv/rndis_filter.c 
b/drivers/net/hyperv/rndis_filter.c
index 4a37e3d..143a98c 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -641,6 +641,16 @@ int rndis_filter_set_offload_params(struct hv_device *hdev,
struct rndis_set_complete *set_complete;
u32 extlen = sizeof(struct ndis_offload_params);
int ret, t;
+   u32 vsp_version = nvdev-nvsp_version;
+
+   if (vsp_version = NVSP_PROTOCOL_VERSION_4) {
+   extlen = VERSION_4_OFFLOAD_SIZE;
+   /* On NVSP_PROTOCOL_VERSION_4 and below, we do not support
+* UDP checksum offload.
+*/
+   req_offloads-udp_ip_v4_csum = 0;
+   req_offloads-udp_ip_v6_csum = 0;
+   }
 
request = get_rndis_request(rdev, RNDIS_MSG_SET,
RNDIS_MESSAGE_SIZE(struct rndis_set_request) + extlen);
@@ -674,7 +684,7 @@ int rndis_filter_set_offload_params(struct hv_device *hdev,
} else {
set_complete = request-response_msg.msg.set_complete;
if (set_complete-status != RNDIS_STATUS_SUCCESS) {
-   netdev_err(ndev, Fail to set MAC on host side:0x%x\n,
+   netdev_err(ndev, Fail to set offload on host 
side:0x%x\n,
   set_complete-status);
ret = -EINVAL;
}
-- 
1.7.4.1

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


[PATCH net, V1 1/3] Drivers: net: hyperv: Allocate memory for all possible per-pecket information

2014-04-09 Thread K. Y. Srinivasan
An outgoing packet can potentially need per-packet information for
all the offloads and VLAN tagging. Fix this issue.

Signed-off-by: K. Y. Srinivasan k...@microsoft.com
Reviewed-by: Haiyang Zhang haiya...@microsoft.com
---
 drivers/net/hyperv/netvsc_drv.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 4e4cf9e..6f39baa 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -319,7 +319,9 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct 
net_device *net)
packet = kzalloc(sizeof(struct hv_netvsc_packet) +
 (num_data_pgs * sizeof(struct hv_page_buffer)) +
 sizeof(struct rndis_message) +
-NDIS_VLAN_PPI_SIZE, GFP_ATOMIC);
+NDIS_VLAN_PPI_SIZE +
+NDIS_CSUM_PPI_SIZE +
+NDIS_LSO_PPI_SIZE, GFP_ATOMIC);
if (!packet) {
/* out of memory, drop packet */
netdev_err(net, unable to allocate hv_netvsc_packet\n);
-- 
1.7.4.1

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


[PATCH 1/1] Tools: hv: Handle the case when the target file exists correctly

2014-04-09 Thread K. Y. Srinivasan
Return the appropriate error code and handle the case when the target
file exists correctly. This fixes a bug.

Signed-off-by: K. Y. Srinivasan k...@microsoft.com
Cc: sta...@vger.kernel.org [3.14]
---
 include/uapi/linux/hyperv.h |1 +
 tools/hv/hv_fcopy_daemon.c  |4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h
index 9beb7c9..78e4a86 100644
--- a/include/uapi/linux/hyperv.h
+++ b/include/uapi/linux/hyperv.h
@@ -305,6 +305,7 @@ enum hv_kvp_exchg_pool {
 #define HV_ERROR_DEVICE_NOT_CONNECTED  0x8007048F
 #define HV_INVALIDARG  0x80070057
 #define HV_GUID_NOTFOUND   0x80041002
+#define HV_ERROR_ALREADY_EXISTS0x80070050
 
 #define ADDR_FAMILY_NONE   0x00
 #define ADDR_FAMILY_IPV4   0x01
diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c
index 4ecc4fd..fba1c75 100644
--- a/tools/hv/hv_fcopy_daemon.c
+++ b/tools/hv/hv_fcopy_daemon.c
@@ -82,8 +82,10 @@ static int hv_start_fcopy(struct hv_start_fcopy *smsg)
 
if (!access(target_fname, F_OK)) {
syslog(LOG_INFO, File: %s exists, target_fname);
-   if (!smsg-copy_flags  OVER_WRITE)
+   if (!(smsg-copy_flags  OVER_WRITE)) {
+   error = HV_ERROR_ALREADY_EXISTS;
goto done;
+   }
}
 
target_fd = open(target_fname, O_RDWR | O_CREAT | O_CLOEXEC, 0744);
-- 
1.7.4.1

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


[PATCH] staging: rtl2832_sdr: fixup checkpatch/style issues

2014-04-09 Thread Anthony DeStefano
rtl2832_sdr.c: fixup checkpatch issues about long lines

Signed-off-by: Anthony DeStefano a...@fastmail.fm
---
 drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c | 23 ---
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c 
b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
index 104ee8a..0e6c6fa 100644
--- a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
+++ b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
@@ -935,7 +935,9 @@ static int rtl2832_sdr_set_tuner_freq(struct 
rtl2832_sdr_state *s)
/*
 * bandwidth (Hz)
 */
-   bandwidth_auto = v4l2_ctrl_find(s-hdl, 
V4L2_CID_RF_TUNER_BANDWIDTH_AUTO);
+   bandwidth_auto = v4l2_ctrl_find(s-hdl,
+   V4L2_CID_RF_TUNER_BANDWIDTH_AUTO);
+
bandwidth = v4l2_ctrl_find(s-hdl, V4L2_CID_RF_TUNER_BANDWIDTH);
if (v4l2_ctrl_g_ctrl(bandwidth_auto)) {
c-bandwidth_hz = s-f_adc;
@@ -1332,9 +1334,11 @@ static int rtl2832_sdr_s_ctrl(struct v4l2_ctrl *ctrl)
/* Round towards the closest legal value */
s32 val = s-f_adc + s-bandwidth-step / 2;
u32 offset;
-   val = clamp(val, s-bandwidth-minimum, 
s-bandwidth-maximum);
+   val = clamp(val, s-bandwidth-minimum,
+   s-bandwidth-maximum);
offset = val - s-bandwidth-minimum;
-   offset = s-bandwidth-step * (offset / 
s-bandwidth-step);
+   offset = s-bandwidth-step *
+   (offset / s-bandwidth-step);
s-bandwidth-val = s-bandwidth-minimum + offset;
}
 
@@ -1423,15 +1427,20 @@ struct dvb_frontend *rtl2832_sdr_attach(struct 
dvb_frontend *fe,
break;
case RTL2832_TUNER_R820T:
v4l2_ctrl_handler_init(s-hdl, 2);
-   s-bandwidth_auto = v4l2_ctrl_new_std(s-hdl, ops, 
V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1);
-   s-bandwidth = v4l2_ctrl_new_std(s-hdl, ops, 
V4L2_CID_RF_TUNER_BANDWIDTH, 0, 800, 10, 0);
+   s-bandwidth_auto = v4l2_ctrl_new_std(s-hdl, ops,
+   V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1);
+   s-bandwidth = v4l2_ctrl_new_std(s-hdl, ops,
+   V4L2_CID_RF_TUNER_BANDWIDTH, 0, 800, 10, 0);
v4l2_ctrl_auto_cluster(2, s-bandwidth_auto, 0, false);
break;
case RTL2832_TUNER_FC0012:
case RTL2832_TUNER_FC0013:
v4l2_ctrl_handler_init(s-hdl, 2);
-   s-bandwidth_auto = v4l2_ctrl_new_std(s-hdl, ops, 
V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1);
-   s-bandwidth = v4l2_ctrl_new_std(s-hdl, ops, 
V4L2_CID_RF_TUNER_BANDWIDTH, 600, 800, 100, 600);
+   s-bandwidth_auto = v4l2_ctrl_new_std(s-hdl, ops,
+   V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1);
+   s-bandwidth = v4l2_ctrl_new_std(s-hdl, ops,
+   V4L2_CID_RF_TUNER_BANDWIDTH, 600, 800, 100,
+   600);
v4l2_ctrl_auto_cluster(2, s-bandwidth_auto, 0, false);
break;
default:
-- 
1.9.0

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


Re: [PATCH] staging: rtl2832_sdr: fixup checkpatch/style issues

2014-04-09 Thread Greg Kroah-Hartman
On Wed, Apr 09, 2014 at 08:07:28PM -0400, Anthony DeStefano wrote:
 rtl2832_sdr.c: fixup checkpatch issues about long lines
 
 Signed-off-by: Anthony DeStefano a...@fastmail.fm
 ---
  drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c | 23 ---
  1 file changed, 16 insertions(+), 7 deletions(-)
 
 diff --git a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c 
 b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
 index 104ee8a..0e6c6fa 100644
 --- a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
 +++ b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
 @@ -935,7 +935,9 @@ static int rtl2832_sdr_set_tuner_freq(struct 
 rtl2832_sdr_state *s)
   /*
* bandwidth (Hz)
*/
 - bandwidth_auto = v4l2_ctrl_find(s-hdl, 
 V4L2_CID_RF_TUNER_BANDWIDTH_AUTO);
 + bandwidth_auto = v4l2_ctrl_find(s-hdl,
 + V4L2_CID_RF_TUNER_BANDWIDTH_AUTO);

Please line stuff up under the (, so for this line it would be:

bandwidth_auto = v4l2_ctrl_find(s-hdl,
V4L2_CID_RF_TUNER_BANDWIDTH_AUTO);

Please fix the rest of these all up.

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


[PATCHv2] staging: rtl2832_sdr: fixup checkpatch/style issues

2014-04-09 Thread Anthony DeStefano
rtl2832_sdr.c: fixup checkpatch issues about long lines

Aligned stuff under the ( for this version.

Signed-off-by: Anthony DeStefano a...@fastmail.fm
---
 drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c | 26 +---
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c 
b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
index 104ee8a..a9ec75d 100644
--- a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
+++ b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
@@ -935,7 +935,8 @@ static int rtl2832_sdr_set_tuner_freq(struct 
rtl2832_sdr_state *s)
/*
 * bandwidth (Hz)
 */
-   bandwidth_auto = v4l2_ctrl_find(s-hdl, 
V4L2_CID_RF_TUNER_BANDWIDTH_AUTO);
+   bandwidth_auto = v4l2_ctrl_find(s-hdl,
+   V4L2_CID_RF_TUNER_BANDWIDTH_AUTO);
bandwidth = v4l2_ctrl_find(s-hdl, V4L2_CID_RF_TUNER_BANDWIDTH);
if (v4l2_ctrl_g_ctrl(bandwidth_auto)) {
c-bandwidth_hz = s-f_adc;
@@ -1332,9 +1333,11 @@ static int rtl2832_sdr_s_ctrl(struct v4l2_ctrl *ctrl)
/* Round towards the closest legal value */
s32 val = s-f_adc + s-bandwidth-step / 2;
u32 offset;
-   val = clamp(val, s-bandwidth-minimum, 
s-bandwidth-maximum);
+   val = clamp(val, s-bandwidth-minimum,
+   s-bandwidth-maximum);
offset = val - s-bandwidth-minimum;
-   offset = s-bandwidth-step * (offset / 
s-bandwidth-step);
+   offset = s-bandwidth-step *
+   (offset / s-bandwidth-step);
s-bandwidth-val = s-bandwidth-minimum + offset;
}
 
@@ -1423,15 +1426,24 @@ struct dvb_frontend *rtl2832_sdr_attach(struct 
dvb_frontend *fe,
break;
case RTL2832_TUNER_R820T:
v4l2_ctrl_handler_init(s-hdl, 2);
-   s-bandwidth_auto = v4l2_ctrl_new_std(s-hdl, ops, 
V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1);
-   s-bandwidth = v4l2_ctrl_new_std(s-hdl, ops, 
V4L2_CID_RF_TUNER_BANDWIDTH, 0, 800, 10, 0);
+   s-bandwidth_auto = v4l2_ctrl_new_std(s-hdl, ops,
+ 
V4L2_CID_RF_TUNER_BANDWIDTH_AUTO,
+ 0, 1, 1, 1);
+   s-bandwidth = v4l2_ctrl_new_std(s-hdl, ops,
+V4L2_CID_RF_TUNER_BANDWIDTH,
+0, 800, 10, 0);
v4l2_ctrl_auto_cluster(2, s-bandwidth_auto, 0, false);
break;
case RTL2832_TUNER_FC0012:
case RTL2832_TUNER_FC0013:
v4l2_ctrl_handler_init(s-hdl, 2);
-   s-bandwidth_auto = v4l2_ctrl_new_std(s-hdl, ops, 
V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1);
-   s-bandwidth = v4l2_ctrl_new_std(s-hdl, ops, 
V4L2_CID_RF_TUNER_BANDWIDTH, 600, 800, 100, 600);
+   s-bandwidth_auto = v4l2_ctrl_new_std(s-hdl, ops,
+ 
V4L2_CID_RF_TUNER_BANDWIDTH_AUTO,
+ 0, 1, 1, 1);
+   s-bandwidth = v4l2_ctrl_new_std(s-hdl, ops,
+V4L2_CID_RF_TUNER_BANDWIDTH,
+600, 800, 100,
+600);
v4l2_ctrl_auto_cluster(2, s-bandwidth_auto, 0, false);
break;
default:
-- 
1.9.0

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


Message From The QUEEN!!!

2014-04-09 Thread Queen Of England
I am Leopold Victoria, i need your aid on something vital and important.

Best Regards
Leopold Victoria (Queen).

Queen Elizabeth House
3 Mansfield Road
Oxford OX1 3TB
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel