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

2014-04-11 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 v7 2/4] [v6 fix] mfd/rtsx_usb: add comment in rtsx_usb_suspend

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

Explain why there is no need to have a symmetric LED turn-on in resume handler
while calling rtsx_usb_turn_off_led() in suspend handler.

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

diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
index 0ca7973..141ea52 100644
--- a/drivers/mfd/rtsx_usb.c
+++ b/drivers/mfd/rtsx_usb.c
@@ -687,9 +687,15 @@ static int rtsx_usb_suspend(struct usb_interface *intf, 
pm_message_t message)
dev_dbg(intf-dev, %s called with pm message 0x%04u\n,
__func__, message.event);
 
+   /*
+* Call to make sure LED is off during suspend to save more power.
+* It is NOT a permanent state and could be turned on anytime later.
+* Thus no need to call turn_on when resunming.
+*/
mutex_lock(ucr-dev_mutex);
rtsx_usb_turn_off_led(ucr);
mutex_unlock(ucr-dev_mutex);
+
return 0;
 }
 
-- 
1.8.2

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


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

2014-04-11 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
Acked-by: Ulf Hansson ulf.hans...@linaro.org
---
 drivers/mmc/host/Kconfig  |7 +
 drivers/mmc/host/Makefile |1 +
 drivers/mmc/host/rtsx_usb_sdmmc.c | 1455 +
 3 files changed, 1463 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..e11fafa
--- /dev/null
+++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
@@ -0,0 +1,1455 @@
+/* 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 

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

2014-04-11 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, 

[PATCH v7 0/4] Add modules for realtek USB card reader

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

This patchset adds modules to support Realtek USB vendor specific class flash
card reader: one base module in MFD subsystem and two host modules in both mmc
and memstick subsystems. The architecture is similar to rtsx_pci.

This work is done primarily to replace the staging driver: staging/rts5139,
which doesn't utilize mmc nor memstick subsystems. Once the patchset or its
revision is applied, we may need Greg's help to remove the staging one.

v2:
1. Fix potential buffer overflow in rtsx_usb_seq_write_register()
2. Remove unnecessary casting and messages
3. Revise coding style and white spaces

v3:
1. Fix MMC detection fail when under xhci
2. Minor change of pm_runtime behavior in rtsx_usb_ms to prevent some rare
   freeze due to erroneous Memstick card(not MS-Pro)
3. Further revise coding style as suggested in the thread of v2
4. Using managed resources: devm_*
5. Change license from GPL v2 and later to GPL v2

v4:
1. Remove invocations to deprecated/removed mmc_suspend|resume_host APIs and
   unnecessary platform device pm routines
2. Support CRC-ignored R1 response for CMD13 in response to commit:
   a27fbf2f067b0cd6f172c8b696b9a44c58bfaa7a: mmc: add ignorance case for 
   CMD13 CRC error
3. Remove unnecessary #ifdef CONFIG_PM_RUNTIME

v5:
1. rtsx_usb_ms.c: adding header inclusion, removing unnecessary NULL checking,
   and add cancel_work_sync in removal handler to wait possible pending
   works.
(Changes only rtsx_usb_ms. Other files remain the same to v4)

v6:
NOTE:since the v3 of patch 1/3 (rtsx_usb) has been merged, only diffs are
submitted and splitted into two.
1. rtsx_usb.c: fix possible race conditions:
   rtsx_usb_bulk_transfer_sglist(): del_timer() = del_timer_sync()
   rtsx_usb_probe(): move setup_timer() before mfd_add_devices() and also
 remove unnecessary init_timer()
2. rtsx_usb.c: rtsx_usb_suspend(): add comments to LED turn-off
(Changes only rtsx_usb.c. Other files remain the same to v5)

v7:
1. rtsx_usb_sdmmc: remove unnecessary pm usage balancing during removal
2. rtsx_usb_sdmmc: add Acked-by: Ulf Hansson ulf.hans...@linaro.org

Roger Tseng (4):
  [v6 fix] mfd/rtsx_usb: fix possible race condition
  [v6 fix] mfd/rtsx_usb: add comment in rtsx_usb_suspend
  mmc: Add realtek USB sdmmc host driver
  memstick: Add realtek USB memstick host driver

 drivers/memstick/host/Kconfig   |   10 +
 drivers/memstick/host/Makefile  |1 +
 drivers/memstick/host/rtsx_usb_ms.c |  839 
 drivers/mfd/rtsx_usb.c  |   14 +-
 drivers/mmc/host/Kconfig|7 +
 drivers/mmc/host/Makefile   |1 +
 drivers/mmc/host/rtsx_usb_sdmmc.c   | 1455 +++
 7 files changed, 2323 insertions(+), 4 deletions(-)
 create mode 100644 drivers/memstick/host/rtsx_usb_ms.c
 create mode 100644 drivers/mmc/host/rtsx_usb_sdmmc.c

-- 
1.8.2

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


[PATCH] [media] Prefer gspca_sonixb over sn9c102 for all devices

2014-04-11 Thread Jean Delvare
The sn9c102 driver is deprecated. It was moved to staging in
anticipation of its removal in a future kernel version. However, USB
devices 0C45:6024 and 0C45:6025 are still handled by sn9c102 when
both sn9c102 and gspca_sonixb are enabled.

We must migrate all the users of these devices to the gspca_sonixb
driver now, so that it gets sufficient testing before the sn9c102
driver is finally phased out.

Signed-off-by: Jean Delvare jdelv...@suse.de
Cc: Hans de Goede hdego...@redhat.com
Cc: Mauro Carvalho Chehab m.che...@samsung.com
Cc: Luca Risolia luca.riso...@studio.unibo.it
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
I consider this a bug fix, I believe it should go upstream ASAP.

 drivers/media/usb/gspca/sonixb.c |2 --
 drivers/staging/media/sn9c102/sn9c102_devtable.h |2 --
 2 files changed, 4 deletions(-)

--- linux-3.15-rc0.orig/drivers/media/usb/gspca/sonixb.c2014-04-11 
08:57:26.932408285 +0200
+++ linux-3.15-rc0/drivers/media/usb/gspca/sonixb.c 2014-04-11 
09:02:32.151943578 +0200
@@ -1430,10 +1430,8 @@ static const struct usb_device_id device
{USB_DEVICE(0x0c45, 0x600d), SB(PAS106, 101)},
{USB_DEVICE(0x0c45, 0x6011), SB(OV6650, 101)},
{USB_DEVICE(0x0c45, 0x6019), SB(OV7630, 101)},
-#if !IS_ENABLED(CONFIG_USB_SN9C102)
{USB_DEVICE(0x0c45, 0x6024), SB(TAS5130CXX, 102)},
{USB_DEVICE(0x0c45, 0x6025), SB(TAS5130CXX, 102)},
-#endif
{USB_DEVICE(0x0c45, 0x6027), SB(OV7630, 101)}, /* Genius Eye 310 */
{USB_DEVICE(0x0c45, 0x6028), SB(PAS202, 102)},
{USB_DEVICE(0x0c45, 0x6029), SB(PAS106, 102)},
--- linux-3.15-rc0.orig/drivers/staging/media/sn9c102/sn9c102_devtable.h
2014-04-11 08:57:26.932408285 +0200
+++ linux-3.15-rc0/drivers/staging/media/sn9c102/sn9c102_devtable.h 
2014-04-11 09:02:32.151943578 +0200
@@ -48,10 +48,8 @@ static const struct usb_device_id sn9c10
{ SN9C102_USB_DEVICE(0x0c45, 0x600d, BRIDGE_SN9C102), },
 /* { SN9C102_USB_DEVICE(0x0c45, 0x6011, BRIDGE_SN9C102), }, OV6650 */
{ SN9C102_USB_DEVICE(0x0c45, 0x6019, BRIDGE_SN9C102), },
-#endif
{ SN9C102_USB_DEVICE(0x0c45, 0x6024, BRIDGE_SN9C102), },
{ SN9C102_USB_DEVICE(0x0c45, 0x6025, BRIDGE_SN9C102), },
-#if !defined CONFIG_USB_GSPCA_SONIXB  !defined CONFIG_USB_GSPCA_SONIXB_MODULE
{ SN9C102_USB_DEVICE(0x0c45, 0x6028, BRIDGE_SN9C102), },
{ SN9C102_USB_DEVICE(0x0c45, 0x6029, BRIDGE_SN9C102), },
{ SN9C102_USB_DEVICE(0x0c45, 0x602a, BRIDGE_SN9C102), },


-- 
Jean Delvare
SUSE L3 Support
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging:bcm: Fixes coding style issues in drivers/staging/bcm/Qos.c

2014-04-11 Thread Dan Carpenter
This isn't the right way to send a v2 patch.  Please resend it.

https://www.google.com/search?q=how+to+send+a+v2+patch

regards,
dan carpenter

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


Re: [PATCH v7 0/4] Add modules for realtek USB card reader

2014-04-11 Thread Oliver Neukum
On Fri, 2014-04-11 at 14:53 +0800, rogera...@realtek.com wrote:
 From: Roger Tseng rogera...@realtek.com
 
 This patchset adds modules to support Realtek USB vendor specific class flash
 card reader: one base module in MFD subsystem and two host modules in both mmc
 and memstick subsystems. The architecture is similar to rtsx_pci.
 
 This work is done primarily to replace the staging driver: staging/rts5139,
 which doesn't utilize mmc nor memstick subsystems. Once the patchset or its
 revision is applied, we may need Greg's help to remove the staging one.

Looks good to me.

Regards
Oliver


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


Re: [PATCH v7 0/4] Add modules for realtek USB card reader

2014-04-11 Thread Lee Jones
  From: Roger Tseng rogera...@realtek.com
  
  This patchset adds modules to support Realtek USB vendor specific class 
  flash
  card reader: one base module in MFD subsystem and two host modules in both 
  mmc
  and memstick subsystems. The architecture is similar to rtsx_pci.
  
  This work is done primarily to replace the staging driver: staging/rts5139,
  which doesn't utilize mmc nor memstick subsystems. Once the patchset or its
  revision is applied, we may need Greg's help to remove the staging one.
 
 Looks good to me.

Is that an Ack?

   Regards
   Oliver
 
 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v7 0/4] Add modules for realtek USB card reader

2014-04-11 Thread Oliver Neukum
On Fri, 2014-04-11 at 11:28 +0100, Lee Jones wrote:
   From: Roger Tseng rogera...@realtek.com
   
   This patchset adds modules to support Realtek USB vendor specific class 
   flash
   card reader: one base module in MFD subsystem and two host modules in 
   both mmc
   and memstick subsystems. The architecture is similar to rtsx_pci.
   
   This work is done primarily to replace the staging driver: 
   staging/rts5139,
   which doesn't utilize mmc nor memstick subsystems. Once the patchset or 
   its
   revision is applied, we may need Greg's help to remove the staging one.
  
  Looks good to me.
 
 Is that an Ack?
Acked-by: Oliver oneu...@suse.de

Sorry
Oliver


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


[PATCH] staging: vt6656: fix bad symbol declaration

2014-04-11 Thread Neil Armstrong
With sparse, the following error appears :
  CHECK   drivers/staging/vt6656/aes_ccmp.c
drivers/staging/vt6656/aes_ccmp.c:221:6: warning: symbol 'AESbGenCCMP' was not 
declared. Should it be static?

Add correct include header in order to have function declaration.

Signed-off-by: Neil 'Superna' Armstrong superna9...@gmail.com
---
 drivers/staging/vt6656/aes_ccmp.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/vt6656/aes_ccmp.c 
b/drivers/staging/vt6656/aes_ccmp.c
index e2bfa8d..a9d5168 100644
--- a/drivers/staging/vt6656/aes_ccmp.c
+++ b/drivers/staging/vt6656/aes_ccmp.c
@@ -32,6 +32,7 @@
 
 #include device.h
 #include 80211hdr.h
+#include aes_ccmp.h
 
 /*
  * SBOX Table
-- 
1.7.10.4
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: wlan-ng: fix bad symbol declaration

2014-04-11 Thread Neil Armstrong
With sparse, the following error appears :
  CHECK   drivers/staging/wlan-ng/p80211netdev.c
drivers/staging/wlan-ng/cfg80211.c:710:6: warning: symbol 
'prism2_connect_result' was not declared. Should it be static?
drivers/staging/wlan-ng/cfg80211.c:719:6: warning: symbol 'prism2_disconnected' 
was not declared. Should it be static?
drivers/staging/wlan-ng/cfg80211.c:725:6: warning: symbol 'prism2_roamed' was 
not declared. Should it be static?

Move functions declaration to coherent internal header file.

Signed-off-by: Neil 'Superna' Armstrong superna9...@gmail.com
---
 drivers/staging/wlan-ng/prism2mgmt.h |5 +
 drivers/staging/wlan-ng/prism2sta.c  |4 
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wlan-ng/prism2mgmt.h 
b/drivers/staging/wlan-ng/prism2mgmt.h
index 190d390..b62fdcb 100644
--- a/drivers/staging/wlan-ng/prism2mgmt.h
+++ b/drivers/staging/wlan-ng/prism2mgmt.h
@@ -109,4 +109,9 @@ void prism2sta_processing_defer(struct work_struct *data);
 void prism2sta_commsqual_defer(struct work_struct *data);
 void prism2sta_commsqual_timer(unsigned long data);
 
+/* Interface callback functions, passing data back up to the cfg80211 layer */
+void prism2_connect_result(wlandevice_t *wlandev, u8 failed);
+void prism2_disconnected(wlandevice_t *wlandev);
+void prism2_roamed(wlandevice_t *wlandev);
+
 #endif
diff --git a/drivers/staging/wlan-ng/prism2sta.c 
b/drivers/staging/wlan-ng/prism2sta.c
index f9ccf23..3fd4538 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -120,10 +120,6 @@ MODULE_PARM_DESC(prism2_reset_settletime, reset settle 
time in ms);
 
 MODULE_LICENSE(Dual MPL/GPL);
 
-void prism2_connect_result(wlandevice_t *wlandev, u8 failed);
-void prism2_disconnected(wlandevice_t *wlandev);
-void prism2_roamed(wlandevice_t *wlandev);
-
 static int prism2sta_open(wlandevice_t *wlandev);
 static int prism2sta_close(wlandevice_t *wlandev);
 static void prism2sta_reset(wlandevice_t *wlandev);
-- 
1.7.10.4
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: wlan-ng: fix bad symbol declaration

2014-04-11 Thread Josh Triplett
On Fri, Apr 11, 2014 at 03:00:49PM +0200, Neil Armstrong wrote:
 With sparse, the following error appears :
   CHECK   drivers/staging/wlan-ng/p80211netdev.c
 drivers/staging/wlan-ng/cfg80211.c:710:6: warning: symbol 
 'prism2_connect_result' was not declared. Should it be static?
 drivers/staging/wlan-ng/cfg80211.c:719:6: warning: symbol 
 'prism2_disconnected' was not declared. Should it be static?
 drivers/staging/wlan-ng/cfg80211.c:725:6: warning: symbol 'prism2_roamed' was 
 not declared. Should it be static?
 
 Move functions declaration to coherent internal header file.
 
 Signed-off-by: Neil 'Superna' Armstrong superna9...@gmail.com

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

  drivers/staging/wlan-ng/prism2mgmt.h |5 +
  drivers/staging/wlan-ng/prism2sta.c  |4 
  2 files changed, 5 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/staging/wlan-ng/prism2mgmt.h 
 b/drivers/staging/wlan-ng/prism2mgmt.h
 index 190d390..b62fdcb 100644
 --- a/drivers/staging/wlan-ng/prism2mgmt.h
 +++ b/drivers/staging/wlan-ng/prism2mgmt.h
 @@ -109,4 +109,9 @@ void prism2sta_processing_defer(struct work_struct *data);
  void prism2sta_commsqual_defer(struct work_struct *data);
  void prism2sta_commsqual_timer(unsigned long data);
  
 +/* Interface callback functions, passing data back up to the cfg80211 layer 
 */
 +void prism2_connect_result(wlandevice_t *wlandev, u8 failed);
 +void prism2_disconnected(wlandevice_t *wlandev);
 +void prism2_roamed(wlandevice_t *wlandev);
 +
  #endif
 diff --git a/drivers/staging/wlan-ng/prism2sta.c 
 b/drivers/staging/wlan-ng/prism2sta.c
 index f9ccf23..3fd4538 100644
 --- a/drivers/staging/wlan-ng/prism2sta.c
 +++ b/drivers/staging/wlan-ng/prism2sta.c
 @@ -120,10 +120,6 @@ MODULE_PARM_DESC(prism2_reset_settletime, reset settle 
 time in ms);
  
  MODULE_LICENSE(Dual MPL/GPL);
  
 -void prism2_connect_result(wlandevice_t *wlandev, u8 failed);
 -void prism2_disconnected(wlandevice_t *wlandev);
 -void prism2_roamed(wlandevice_t *wlandev);
 -
  static int prism2sta_open(wlandevice_t *wlandev);
  static int prism2sta_close(wlandevice_t *wlandev);
  static void prism2sta_reset(wlandevice_t *wlandev);
 -- 
 1.7.10.4
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/4] imx-drm: imx-hdmi: don't erroneously detect HDMI displays

2014-04-11 Thread Lucas Stach
While having a CEA mode is one prerequisite for using
HDMI transmit mode, we also have to check if the display
is actually capable of HDMI input. Fall back to DVI mode
otherwise.

Signed-off-by: Lucas Stach l.st...@pengutronix.de
---
 drivers/staging/imx-drm/imx-hdmi.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/imx-drm/imx-hdmi.c 
b/drivers/staging/imx-drm/imx-hdmi.c
index 7d407e917786..28d1cdd12cb4 100644
--- a/drivers/staging/imx-drm/imx-hdmi.c
+++ b/drivers/staging/imx-drm/imx-hdmi.c
@@ -1218,13 +1218,10 @@ static int imx_hdmi_setup(struct imx_hdmi *hdmi, struct 
drm_display_mode *mode)
 
hdmi-vic = drm_match_cea_mode(mode);
 
-   if (!hdmi-vic) {
-   dev_dbg(hdmi-dev, Non-CEA mode used in HDMI\n);
-   hdmi-hdmi_data.video_mode.mdvi = true;
-   } else {
-   dev_dbg(hdmi-dev, CEA mode used vic=%d\n, hdmi-vic);
+   if (drm_detect_hdmi_monitor(hdmi-edid)  hdmi-vic)
hdmi-hdmi_data.video_mode.mdvi = false;
-   }
+   else
+   hdmi-hdmi_data.video_mode.mdvi = true;
 
if ((hdmi-vic == 6) || (hdmi-vic == 7) ||
(hdmi-vic == 21) || (hdmi-vic == 22) ||
@@ -1273,7 +1270,7 @@ static int imx_hdmi_setup(struct imx_hdmi *hdmi, struct 
drm_display_mode *mode)
if (hdmi-hdmi_data.video_mode.mdvi)
dev_dbg(hdmi-dev, %s DVI mode\n, __func__);
else {
-   dev_dbg(hdmi-dev, %s CEA mode\n, __func__);
+   dev_dbg(hdmi-dev, %s CEA mode VIC=%d\n, __func__, hdmi-vic);
 
/* HDMI Initialization Step E - Configure audio */
hdmi_clk_regenerator_update_pixel_clock(hdmi);
-- 
1.9.1

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


[PATCH 2/4] staging: imx-hdmi: correct connector detect and hotplug

2014-04-11 Thread Lucas Stach
Make sure that we probe for a display on detect regardless
of previous hotplug events. Don't handle connector
hotplug state ourselves, but let DRM do the right thing
for us. This brings our hotplug handling in line with
what other DRM drivers do.

Signed-off-by: Lucas Stach l.st...@pengutronix.de
---
 drivers/staging/imx-drm/imx-hdmi.c | 73 +-
 1 file changed, 33 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/imx-drm/imx-hdmi.c 
b/drivers/staging/imx-drm/imx-hdmi.c
index 80b91b1e225c..22cfdfc5ef74 100644
--- a/drivers/staging/imx-drm/imx-hdmi.c
+++ b/drivers/staging/imx-drm/imx-hdmi.c
@@ -32,8 +32,6 @@
 #include imx-hdmi.h
 #include imx-drm.h
 
-#define HDMI_EDID_LEN  512
-
 #define RGB0
 #define YCBCR444   1
 #define YCBCR422_16BITS2
@@ -120,12 +118,10 @@ struct imx_hdmi {
struct clk *isfr_clk;
struct clk *iahb_clk;
 
-   enum drm_connector_status connector_status;
-
struct hdmi_data_info hdmi_data;
int vic;
 
-   u8 edid[HDMI_EDID_LEN];
+   struct edid *edid;
bool cable_plugin;
 
bool phy_enabled;
@@ -1386,32 +1382,46 @@ static enum drm_connector_status 
imx_hdmi_connector_detect(struct drm_connector
struct imx_hdmi *hdmi = container_of(connector, struct imx_hdmi,
 connector);
 
-   return hdmi-connector_status;
+   /* free previous EDID block */
+   if (hdmi-edid) {
+   drm_mode_connector_update_edid_property(connector, NULL);
+   kfree(hdmi-edid);
+   }
+
+   if (hdmi-ddc  drm_probe_ddc(hdmi-ddc)) {
+   hdmi-edid = drm_get_edid(connector, hdmi-ddc);
+   if (hdmi-edid) {
+   drm_mode_connector_update_edid_property(connector,
+   hdmi-edid);
+   dev_dbg(hdmi-dev, got edid: width[%d] x height[%d]\n,
+   hdmi-edid-width_cm, hdmi-edid-height_cm);
+
+   return connector_status_connected;
+   }
+   }
+
+   /* if EDID probing fails, try if we can sense an attached display */
+   if (hdmi_readb(hdmi, HDMI_PHY_STAT0)  0xf0)
+   return connector_status_connected;
+
+   return connector_status_disconnected;
 }
 
 static int imx_hdmi_connector_get_modes(struct drm_connector *connector)
 {
struct imx_hdmi *hdmi = container_of(connector, struct imx_hdmi,
 connector);
-   struct edid *edid;
-   int ret;
+   int ret = 0;
 
-   if (!hdmi-ddc)
-   return 0;
-
-   edid = drm_get_edid(connector, hdmi-ddc);
-   if (edid) {
-   dev_dbg(hdmi-dev, got edid: width[%d] x height[%d]\n,
-   edid-width_cm, edid-height_cm);
-
-   drm_mode_connector_update_edid_property(connector, edid);
-   ret = drm_add_edid_modes(connector, edid);
-   kfree(edid);
+   if (hdmi-edid) {
+   ret = drm_add_edid_modes(connector, hdmi-edid);
+   /* Store the ELD */
+   drm_edid_to_eld(connector, hdmi-edid);
} else {
-   dev_dbg(hdmi-dev, failed to get edid\n);
+   dev_dbg(hdmi-dev, failed to get edid modes\n);
}
 
-   return 0;
+   return ret;
 }
 
 static struct drm_encoder *imx_hdmi_connector_best_encoder(struct drm_connector
@@ -1519,27 +1529,10 @@ static irqreturn_t imx_hdmi_irq(int irq, void *dev_id)
u8 phy_int_pol;
 
intr_stat = hdmi_readb(hdmi, HDMI_IH_PHY_STAT0);
-
phy_int_pol = hdmi_readb(hdmi, HDMI_PHY_POL0);
 
if (intr_stat  hdmi-sink_detect_status) {
-   int pol_bit = hdmi-sink_detect_polarity;
-
-   if (phy_int_pol  pol_bit) {
-   dev_dbg(hdmi-dev, EVENT=plugin\n);
-
-   hdmi_modb(hdmi, 0, pol_bit, HDMI_PHY_POL0);
-
-   hdmi-connector_status = connector_status_connected;
-   imx_hdmi_poweron(hdmi);
-   } else {
-   dev_dbg(hdmi-dev, EVENT=plugout\n);
-
-   hdmi_modb(hdmi, pol_bit, pol_bit, HDMI_PHY_POL0);
-
-   hdmi-connector_status = connector_status_disconnected;
-   imx_hdmi_poweroff(hdmi);
-   }
+   hdmi_modb(hdmi, ~phy_int_pol, ~hdmi-sink_detect_mask, 
HDMI_PHY_POL0);
drm_helper_hpd_irq_event(hdmi-connector.dev);
}
 
@@ -1611,7 +1604,6 @@ static int imx_hdmi_bind(struct device *dev, struct 
device *master, void *data)
return -ENOMEM;
 
hdmi-dev = dev;
-   hdmi-connector_status = connector_status_disconnected;
hdmi-sample_rate = 48000;
hdmi-ratio = 100;
 
@@ -1752,6 +1744,7 @@ static void imx_hdmi_unbind(struct device 

[PATCH 1/4] staging: imx-hdmi: use rx sense pins for plug detection if hpd is unreliable

2014-04-11 Thread Lucas Stach
From: Philipp Zabel p.za...@pengutronix.de

Due to the voltage divider on the HPD line, the HDMI connector on
imx6q-sabrelite doesn't reliably detect connected DVI monitors.
This patch allows to use the RX_SENSE0 signal as a workaround when
enabled by a boolean device tree property 'hpd-unreliable'.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
Signed-off-by: Lucas Stach l.st...@pengutronix.de
---
 drivers/staging/imx-drm/imx-hdmi.c | 37 ++---
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/imx-drm/imx-hdmi.c 
b/drivers/staging/imx-drm/imx-hdmi.c
index d47dedd2cdb4..80b91b1e225c 100644
--- a/drivers/staging/imx-drm/imx-hdmi.c
+++ b/drivers/staging/imx-drm/imx-hdmi.c
@@ -134,6 +134,9 @@ struct imx_hdmi {
struct regmap *regmap;
struct i2c_adapter *ddc;
void __iomem *regs;
+   u8 sink_detect_polarity;
+   u8 sink_detect_status;
+   u8 sink_detect_mask;
 
unsigned int sample_rate;
int ratio;
@@ -1307,10 +1310,10 @@ static int imx_hdmi_fb_registered(struct imx_hdmi *hdmi)
HDMI_PHY_I2CM_CTLINT_ADDR);
 
/* enable cable hot plug irq */
-   hdmi_writeb(hdmi, (u8)~HDMI_PHY_HPD, HDMI_PHY_MASK0);
+   hdmi_writeb(hdmi, hdmi-sink_detect_mask, HDMI_PHY_MASK0);
 
/* Clear Hotplug interrupts */
-   hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0);
+   hdmi_writeb(hdmi, hdmi-sink_detect_status, HDMI_IH_PHY_STAT0);
 
return 0;
 }
@@ -1382,6 +1385,7 @@ static enum drm_connector_status 
imx_hdmi_connector_detect(struct drm_connector
 {
struct imx_hdmi *hdmi = container_of(connector, struct imx_hdmi,
 connector);
+
return hdmi-connector_status;
 }
 
@@ -1518,19 +1522,20 @@ static irqreturn_t imx_hdmi_irq(int irq, void *dev_id)
 
phy_int_pol = hdmi_readb(hdmi, HDMI_PHY_POL0);
 
-   if (intr_stat  HDMI_IH_PHY_STAT0_HPD) {
-   if (phy_int_pol  HDMI_PHY_HPD) {
+   if (intr_stat  hdmi-sink_detect_status) {
+   int pol_bit = hdmi-sink_detect_polarity;
+
+   if (phy_int_pol  pol_bit) {
dev_dbg(hdmi-dev, EVENT=plugin\n);
 
-   hdmi_modb(hdmi, 0, HDMI_PHY_HPD, HDMI_PHY_POL0);
+   hdmi_modb(hdmi, 0, pol_bit, HDMI_PHY_POL0);
 
hdmi-connector_status = connector_status_connected;
imx_hdmi_poweron(hdmi);
} else {
dev_dbg(hdmi-dev, EVENT=plugout\n);
 
-   hdmi_modb(hdmi, HDMI_PHY_HPD, HDMI_PHY_HPD,
-   HDMI_PHY_POL0);
+   hdmi_modb(hdmi, pol_bit, pol_bit, HDMI_PHY_POL0);
 
hdmi-connector_status = connector_status_disconnected;
imx_hdmi_poweroff(hdmi);
@@ -1539,7 +1544,7 @@ static irqreturn_t imx_hdmi_irq(int irq, void *dev_id)
}
 
hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0);
-   hdmi_writeb(hdmi, ~HDMI_IH_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0);
+   hdmi_writeb(hdmi, ~hdmi-sink_detect_status, HDMI_IH_MUTE_PHY_STAT0);
 
return IRQ_HANDLED;
 }
@@ -1691,14 +1696,24 @@ static int imx_hdmi_bind(struct device *dev, struct 
device *master, void *data)
 */
hdmi_init_clk_regenerator(hdmi);
 
+   hdmi-sink_detect_status = HDMI_IH_PHY_STAT0_HPD;
+   hdmi-sink_detect_polarity = HDMI_PHY_HPD;
+   hdmi-sink_detect_mask = ~HDMI_PHY_HPD;
+
+   if (of_property_read_bool(np, hpd-unreliable)) {
+   hdmi-sink_detect_status = HDMI_IH_PHY_STAT0_RX_SENSE0;
+   hdmi-sink_detect_polarity = HDMI_PHY_RX_SENSE0;
+   hdmi-sink_detect_mask = ~HDMI_PHY_RX_SENSE0;
+   }
+
/*
 * Configure registers related to HDMI interrupt
 * generation before registering IRQ.
 */
-   hdmi_writeb(hdmi, HDMI_PHY_HPD, HDMI_PHY_POL0);
+   hdmi_writeb(hdmi, hdmi-sink_detect_polarity, HDMI_PHY_POL0);
 
/* Clear Hotplug interrupts */
-   hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD, HDMI_IH_PHY_STAT0);
+   hdmi_writeb(hdmi, hdmi-sink_detect_status, HDMI_IH_PHY_STAT0);
 
ret = imx_hdmi_fb_registered(hdmi);
if (ret)
@@ -1709,7 +1724,7 @@ static int imx_hdmi_bind(struct device *dev, struct 
device *master, void *data)
goto err_iahb;
 
/* Unmute interrupts */
-   hdmi_writeb(hdmi, ~HDMI_IH_PHY_STAT0_HPD, HDMI_IH_MUTE_PHY_STAT0);
+   hdmi_writeb(hdmi, ~hdmi-sink_detect_status, HDMI_IH_MUTE_PHY_STAT0);
 
dev_set_drvdata(dev, hdmi);
 
-- 
1.9.1

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


[PATCH 3/4] staging: imx-hdmi: clear all hotplug IRQs on bind

2014-04-11 Thread Lucas Stach
Makes sure we don't receive a stray IRQ on startup.

Signed-off-by: Lucas Stach l.st...@pengutronix.de
---
 drivers/staging/imx-drm/imx-hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/imx-drm/imx-hdmi.c 
b/drivers/staging/imx-drm/imx-hdmi.c
index 22cfdfc5ef74..7d407e917786 100644
--- a/drivers/staging/imx-drm/imx-hdmi.c
+++ b/drivers/staging/imx-drm/imx-hdmi.c
@@ -1705,7 +1705,7 @@ static int imx_hdmi_bind(struct device *dev, struct 
device *master, void *data)
hdmi_writeb(hdmi, hdmi-sink_detect_polarity, HDMI_PHY_POL0);
 
/* Clear Hotplug interrupts */
-   hdmi_writeb(hdmi, hdmi-sink_detect_status, HDMI_IH_PHY_STAT0);
+   hdmi_writeb(hdmi, 0x3d, HDMI_IH_PHY_STAT0);
 
ret = imx_hdmi_fb_registered(hdmi);
if (ret)
-- 
1.9.1

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


[PATCH v2] Staging:bcm: Fixes coding style issues in drivers/staging/bcm/Qos.c

2014-04-11 Thread Marcos A. Di Pietro
Fixes code style errors in drivers/staging/bcm/Qos.c

Patch submitted as part of the Eudyptula Challenge

Signed-off-by: Marcos A. Di Pietro marcos...@gmail.com
---
 drivers/staging/bcm/Qos.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/bcm/Qos.c b/drivers/staging/bcm/Qos.c
index 4f31583..9ddb20c 100644
--- a/drivers/staging/bcm/Qos.c
+++ b/drivers/staging/bcm/Qos.c
@@ -4,8 +4,11 @@ This file contains the routines related to Quality of Service.
 */
 #include headers.h

-static void EThCSGetPktInfo(struct bcm_mini_adapter *Adapter, PVOID 
pvEthPayload, struct bcm_eth_packet_info *pstEthCsPktInfo);
-static bool EThCSClassifyPkt(struct bcm_mini_adapter *Adapter, struct sk_buff* 
skb, struct bcm_eth_packet_info *pstEthCsPktInfo, struct bcm_classifier_rule 
*pstClassifierRule, B_UINT8 EthCSCupport);
+static void EThCSGetPktInfo(struct bcm_mini_adapter *Adapter,
+   PVOID pvEthPayload, struct bcm_eth_packet_info *pstEthCsPktInfo);
+static bool EThCSClassifyPkt(struct bcm_mini_adapter *Adapter,
+   struct sk_buff *skb, struct bcm_eth_packet_info *pstEthCsPktInfo,
+   struct bcm_classifier_rule *pstClassifierRule, B_UINT8 EthCSCupport);

 static USHORT  IpVersion4(struct bcm_mini_adapter *Adapter, struct iphdr *iphd,
   struct bcm_classifier_rule *pstClassifierRule);
-- 1.8.3.2 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net, V1 0/3] Fix issues with Heper-V network offload code

2014-04-11 Thread David Miller
From: K. Y. Srinivasan k...@microsoft.com
Date: Wed,  9 Apr 2014 15:00:10 -0700

 WS2008 R2 does not support udp checksum offload. Furthermore, ws2012 and
 ws2012 r2 have issues offloading udp checksum from Linux guests.
 This patch-set addresses these issues as well as other bug fixes.
 Please apply.
 
 In this version, I have addressed the comment from David Miller with reagards
 to COWing the skb prior to modifying the header (patch 3/3).

This looks a lot better, series applied, thanks.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/1] X86: Probe for PIC and set legacy_pic appropriately

2014-04-11 Thread K. Y. Srinivasan
Probe for the existance of legacy PIC, if one does not exist, use the
null_legacy_pic.

This patch implements the proposal put forth by H. Peter Anvin 
h...@linux.intel.com.


Signed-off-by: K. Y. Srinivasan k...@microsoft.com
---
 arch/x86/kernel/cpu/mshyperv.c |2 --
 arch/x86/kernel/i8259.c|   11 +++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 47359f7..9ca9587 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -133,8 +133,6 @@ static void __init ms_hyperv_init_platform(void)
printk(KERN_INFO HyperV: LAPIC Timer Frequency: %#x\n,
lapic_timer_frequency);
 
-   printk(KERN_INFO HyperV: Using null_legacy_pic\n);
-   legacy_pic = null_legacy_pic;
}
 #endif
 
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
index 2e977b5..0a57a19 100644
--- a/arch/x86/kernel/i8259.c
+++ b/arch/x86/kernel/i8259.c
@@ -299,11 +299,22 @@ static void unmask_8259A(void)
 static void init_8259A(int auto_eoi)
 {
unsigned long flags;
+   unsigned char probe_val = 0xfb;
 
i8259A_auto_eoi = auto_eoi;
 
raw_spin_lock_irqsave(i8259A_lock, flags);
 
+   /* Check to see if we have a PIC */
+   outb(probe_val, PIC_MASTER_IMR);
+   probe_val = inb(PIC_MASTER_IMR);
+   if (probe_val == 0xff) {
+   printk(KERN_INFO Using NULL legacy PIC\n);
+   legacy_pic = null_legacy_pic;
+   raw_spin_unlock_irqrestore(i8259A_lock, flags);
+   return;
+   }
+
outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
outb(0xff, PIC_SLAVE_IMR);  /* mask all of 8259A-2 */
 
-- 
1.7.4.1

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


Re: [PATCH 1/1] X86: Probe for PIC and set legacy_pic appropriately

2014-04-11 Thread H. Peter Anvin
On 04/11/2014 04:02 PM, K. Y. Srinivasan wrote:
  
 diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
 index 2e977b5..0a57a19 100644
 --- a/arch/x86/kernel/i8259.c
 +++ b/arch/x86/kernel/i8259.c
 @@ -299,11 +299,22 @@ static void unmask_8259A(void)
  static void init_8259A(int auto_eoi)
  {
   unsigned long flags;
 + unsigned char probe_val = 0xfb;
  
   i8259A_auto_eoi = auto_eoi;
  
   raw_spin_lock_irqsave(i8259A_lock, flags);
  
 + /* Check to see if we have a PIC */
 + outb(probe_val, PIC_MASTER_IMR);
 + probe_val = inb(PIC_MASTER_IMR);
 + if (probe_val == 0xff) {
 + printk(KERN_INFO Using NULL legacy PIC\n);
 + legacy_pic = null_legacy_pic;
 + raw_spin_unlock_irqrestore(i8259A_lock, flags);
 + return;
 + }
 +
   outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
   outb(0xff, PIC_SLAVE_IMR);  /* mask all of 8259A-2 */
  

I think it is important to document what this actually means here.  0xfb
is mask all except for the cascade.

Arguably, we should do this after masking the slave PIC.

On a whole other subject... the whole __byte() logic is a just plain
horrific piece of crap.  Clearly whomever wrote it had never heard of a
union.

I'm still horrifically confused, though, why we mask IRQ 2 (the cascade
interrupt) in i8259.c, but we explicitly do *not* mask IRQ 2 in
boot/pm.c (nor in the assembly code on which boot/pm.c was based.)  In
fact, it looks like we never unmask it.  I'm guessing that the masking
status of the cascade input simply doesn't matter.

At the very least, though, we shouldn't have 0xfb as a magic number, but
use ~(1U  PIC_CASCADE_IR).

-hpa





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


RE: [PATCH 1/1] X86: Probe for PIC and set legacy_pic appropriately

2014-04-11 Thread KY Srinivasan


 -Original Message-
 From: H. Peter Anvin [mailto:h...@zytor.com]
 Sent: Friday, April 11, 2014 3:36 PM
 To: KY Srinivasan; x...@kernel.org; gre...@linuxfoundation.org; linux-
 ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de;
 a...@canonical.com; jasow...@redhat.com; t...@linutronix.de;
 jbeul...@suse.com; b...@alien8.de
 Cc: Thomas Gleixner
 Subject: Re: [PATCH 1/1] X86: Probe for PIC and set legacy_pic appropriately
 
 On 04/11/2014 04:02 PM, K. Y. Srinivasan wrote:
 
  diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c index
  2e977b5..0a57a19 100644
  --- a/arch/x86/kernel/i8259.c
  +++ b/arch/x86/kernel/i8259.c
  @@ -299,11 +299,22 @@ static void unmask_8259A(void)  static void
  init_8259A(int auto_eoi)  {
  unsigned long flags;
  +   unsigned char probe_val = 0xfb;
 
  i8259A_auto_eoi = auto_eoi;
 
  raw_spin_lock_irqsave(i8259A_lock, flags);
 
  +   /* Check to see if we have a PIC */
  +   outb(probe_val, PIC_MASTER_IMR);
  +   probe_val = inb(PIC_MASTER_IMR);
  +   if (probe_val == 0xff) {
  +   printk(KERN_INFO Using NULL legacy PIC\n);
  +   legacy_pic = null_legacy_pic;
  +   raw_spin_unlock_irqrestore(i8259A_lock, flags);
  +   return;
  +   }
  +
  outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
  outb(0xff, PIC_SLAVE_IMR);  /* mask all of 8259A-2 */
 
 
 I think it is important to document what this actually means here.  0xfb is
 mask all except for the cascade.
 
 Arguably, we should do this after masking the slave PIC.
 
 On a whole other subject... the whole __byte() logic is a just plain horrific
 piece of crap.  Clearly whomever wrote it had never heard of a union.
 
 I'm still horrifically confused, though, why we mask IRQ 2 (the cascade
 interrupt) in i8259.c, but we explicitly do *not* mask IRQ 2 in boot/pm.c (nor
 in the assembly code on which boot/pm.c was based.)  In fact, it looks like we
 never unmask it.  I'm guessing that the masking status of the cascade input
 simply doesn't matter.
 
 At the very least, though, we shouldn't have 0xfb as a magic number, but use
 ~(1U  PIC_CASCADE_IR).

I will get rid of this magic number as you have suggested.

K. Y
 

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


[PATCH V1 1/1] X86: Probe for PIC and set legacy_pic appropriately

2014-04-11 Thread K. Y. Srinivasan
Probe for the existance of legacy PIC, if one does not exist, use the
null_legacy_pic.

This patch implements the proposal put forth by H. Peter Anvin 
h...@linux.intel.com.

In this version of the patch I have cleaned up the code based on comments from
Peter.

Signed-off-by: K. Y. Srinivasan k...@microsoft.com
---
 arch/x86/kernel/cpu/mshyperv.c |2 --
 arch/x86/kernel/i8259.c|   17 +
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 47359f7..9ca9587 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -133,8 +133,6 @@ static void __init ms_hyperv_init_platform(void)
printk(KERN_INFO HyperV: LAPIC Timer Frequency: %#x\n,
lapic_timer_frequency);
 
-   printk(KERN_INFO HyperV: Using null_legacy_pic\n);
-   legacy_pic = null_legacy_pic;
}
 #endif
 
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
index 2e977b5..89c7313 100644
--- a/arch/x86/kernel/i8259.c
+++ b/arch/x86/kernel/i8259.c
@@ -299,11 +299,28 @@ static void unmask_8259A(void)
 static void init_8259A(int auto_eoi)
 {
unsigned long flags;
+   unsigned char probe_val = ~(1  PIC_CASCADE_IR);
 
i8259A_auto_eoi = auto_eoi;
 
raw_spin_lock_irqsave(i8259A_lock, flags);
 
+   /*
+* Check to see if we have a PIC.
+* Mask all except the cascade and read
+* back the value we just wrote. If we don't
+* have a PIC, we will read 0xff as opposed to the
+* value we wrote.
+*/
+   outb(probe_val, PIC_MASTER_IMR);
+   probe_val = inb(PIC_MASTER_IMR);
+   if (probe_val == 0xff) {
+   printk(KERN_INFO Using NULL legacy PIC\n);
+   legacy_pic = null_legacy_pic;
+   raw_spin_unlock_irqrestore(i8259A_lock, flags);
+   return;
+   }
+
outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
outb(0xff, PIC_SLAVE_IMR);  /* mask all of 8259A-2 */
 
-- 
1.7.4.1

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


Re: [PATCH V1 1/1] X86: Probe for PIC and set legacy_pic appropriately

2014-04-11 Thread H. Peter Anvin
On 04/11/2014 05:50 PM, K. Y. Srinivasan wrote:
  
 + /*
 +  * Check to see if we have a PIC.
 +  * Mask all except the cascade and read
 +  * back the value we just wrote. If we don't
 +  * have a PIC, we will read 0xff as opposed to the
 +  * value we wrote.
 +  */
 + outb(probe_val, PIC_MASTER_IMR);
 + probe_val = inb(PIC_MASTER_IMR);
 + if (probe_val == 0xff) {
 + printk(KERN_INFO Using NULL legacy PIC\n);
 + legacy_pic = null_legacy_pic;
 + raw_spin_unlock_irqrestore(i8259A_lock, flags);
 + return;
 + }
 +
   outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
   outb(0xff, PIC_SLAVE_IMR);  /* mask all of 8259A-2 */
  

Again, I would do at least the slave masking above the probe.

Also, I would compare to make sure we get the probe_val back and compare
with != instead of comparing with ==.

-hpa


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


[PATCH v3 3/3] staging: vt6655: removed incorrect casting in iwctl.c

2014-04-11 Thread Silvio Fricke
This patch fixes the following type of sparse warning:

drivers/staging/vt6655/iwctl.c:1846:35: warning: cast from restricted gfp_t

Signed-off-by: Silvio Fricke silvio.fri...@gmail.com
---
 drivers/staging/vt6655/iwctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c
index ac3fc16..5e25535 100644
--- a/drivers/staging/vt6655/iwctl.c
+++ b/drivers/staging/vt6655/iwctl.c
@@ -1843,7 +1843,7 @@ int iwctl_siwencodeext(struct net_device *dev,
PRINT_K(SIOCSIWENCODEEXT.. \n);
 
blen = sizeof(*param);
-   buf = kmalloc((int)blen, (int)GFP_KERNEL);
+   buf = kmalloc((int)blen, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;
memset(buf, 0, blen);
-- 
1.9.2

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


[PATCH v3 1/3] staging: vt6655: removed incorrect casting in wpactl.c

2014-04-11 Thread Silvio Fricke
This patch fixes the following type of sparse warnings:

drivers/staging/vt6655/wpactl.c:596:47: warning: cast from restricted gfp_t
drivers/staging/vt6655/wpactl.c:638:68: warning: cast from restricted gfp_t
drivers/staging/vt6655/wpactl.c:860:42: warning: cast from restricted gfp_t

Signed-off-by: Silvio Fricke silvio.fri...@gmail.com
---
 drivers/staging/vt6655/wpactl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c
index d17224f..4745429 100644
--- a/drivers/staging/vt6655/wpactl.c
+++ b/drivers/staging/vt6655/wpactl.c
@@ -593,7 +593,7 @@ static int wpa_get_scan(PSDevice pDevice,
 
unsigned char *ptempBSS;
 
-   ptempBSS = kmalloc(sizeof(KnownBSS), (int)GFP_ATOMIC);
+   ptempBSS = kmalloc(sizeof(KnownBSS), GFP_ATOMIC);
 
if (ptempBSS == NULL) {
printk(KERN_ERR bubble sort kmalloc memory fail@@@\n);
@@ -635,7 +635,7 @@ static int wpa_get_scan(PSDevice pDevice,
count++;
}
 
-   pBuf = kcalloc(count, sizeof(struct viawget_scan_result), 
(int)GFP_ATOMIC);
+   pBuf = kcalloc(count, sizeof(struct viawget_scan_result), GFP_ATOMIC);
 
if (pBuf == NULL) {
ret = -ENOMEM;
@@ -857,7 +857,7 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p)
p-length  VIAWGET_WPA_MAX_BUF_SIZE || !p-pointer)
return -EINVAL;
 
-   param = kmalloc((int)p-length, (int)GFP_KERNEL);
+   param = kmalloc((int)p-length, GFP_KERNEL);
if (param == NULL)
return -ENOMEM;
 
-- 
1.9.2

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


[PATCH v3 0/3] remove wrong cast of gfp_t flags

2014-04-11 Thread Silvio Fricke
Hi,

  thanks for your review.
  Attached second version of this series.
 
 I don't understand what the [WIP] marking is.  Please just resend these
 as real patches if you feel they are ready to be merged.  If we have
 issues with them, we will be sure to let you know :)

I removed it. 


Bye,
Silvio


v3: * no 'WIP'! Don't do that!

v2: * signed-off and message are not the same address



Silvio Fricke (3):
  staging: vt6655: removed incorrect casting in wpactl.c
  staging: vt6655: removed incorrect casting in ioctl.c
  staging: vt6655: removed incorrect casting in iwctl.c

 drivers/staging/vt6655/ioctl.c  | 6 --
 drivers/staging/vt6655/iwctl.c  | 2 +-
 drivers/staging/vt6655/wpactl.c | 6 +++---
 3 files changed, 8 insertions(+), 6 deletions(-)

-- 
1.9.2

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


[PATCH v3 2/3] staging: vt6655: removed incorrect casting in ioctl.c

2014-04-11 Thread Silvio Fricke
This patch fixes the following type of sparse warnings:

drivers/staging/vt6655/ioctl.c:308:104: warning: cast from restricted gfp_t
drivers/staging/vt6655/ioctl.c:579:109: warning: cast from restricted gfp_t

Signed-off-by: Silvio Fricke silvio.fri...@gmail.com
---
 drivers/staging/vt6655/ioctl.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vt6655/ioctl.c b/drivers/staging/vt6655/ioctl.c
index b5cd2e4..1de5d2c9 100644
--- a/drivers/staging/vt6655/ioctl.c
+++ b/drivers/staging/vt6655/ioctl.c
@@ -305,7 +305,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
result = -EINVAL;
break;
}
-   pList = (PSBSSIDList)kmalloc(sizeof(SBSSIDList) + (sList.uItem 
* sizeof(SBSSIDItem)), (int)GFP_ATOMIC);
+   pList = (PSBSSIDList)kmalloc(sizeof(SBSSIDList) + (sList.uItem 
* sizeof(SBSSIDItem)),
+GFP_ATOMIC);
if (pList == NULL) {
result = -ENOMEM;
break;
@@ -576,7 +577,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
result = -EINVAL;
break;
}
-   pNodeList = (PSNodeList)kmalloc(sizeof(SNodeList) + 
(sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC);
+   pNodeList = (PSNodeList)kmalloc(sizeof(SNodeList) + 
(sNodeList.uItem * sizeof(SNodeItem)),
+   GFP_ATOMIC);
if (pNodeList == NULL) {
result = -ENOMEM;
break;
-- 
1.9.2

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


[PATCH] staging: keucr: fix sparse warning

2014-04-11 Thread Rui Miguel Silva
fix sparse warning:
drivers/staging/keucr/smilmain.c:163:5: warning: symbol 'Check_D_MediaFmt' was 
not declared. Should it be static?

by declaring it in the right header. And remove duplication of definition of
SM_INIT

Signed-off-by: Rui Miguel Silva rmf...@gmail.com
---
 drivers/staging/keucr/init.c | 1 +
 drivers/staging/keucr/init.h | 1 -
 drivers/staging/keucr/smil.h | 3 +--
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/keucr/init.c b/drivers/staging/keucr/init.c
index e611839..1e7449d 100644
--- a/drivers/staging/keucr/init.c
+++ b/drivers/staging/keucr/init.c
@@ -9,6 +9,7 @@
 #include usb.h
 #include scsiglue.h
 #include transport.h
+#include smil.h
 #include init.h
 
 /*
diff --git a/drivers/staging/keucr/init.h b/drivers/staging/keucr/init.h
index 98d2e3b..32c724d 100644
--- a/drivers/staging/keucr/init.h
+++ b/drivers/staging/keucr/init.h
@@ -1,7 +1,6 @@
 #include common.h
 
 extern u32 MediaChange;
-extern int Check_D_MediaFmt(struct us_data *);
 
 
 
diff --git a/drivers/staging/keucr/smil.h b/drivers/staging/keucr/smil.h
index 3995173..f938759 100644
--- a/drivers/staging/keucr/smil.h
+++ b/drivers/staging/keucr/smil.h
@@ -204,6 +204,7 @@ extern struct keucr_media_areaCisArea;
 int Init_D_SmartMedia(void);
 int Pwoff_D_SmartMedia(void);
 int Check_D_SmartMedia(void);
+int Check_D_MediaFmt(struct us_data *);
 int Check_D_Parameter(struct us_data *, u16 *, u8 *, u8 *);
 int Media_D_ReadSector(struct us_data *, u32, u16, u8 *);
 int Media_D_WriteSector(struct us_data *, u32, u16, u8 *);
@@ -284,6 +285,4 @@ u8 correct_data(u8 *, u8 *, u8,   u8,   u8);
 int  _Correct_D_SwECC(u8 *, u8 *, u8 *);
 void _Calculate_D_SwECC(u8 *, u8 *);
 
-void SM_Init(void);
-
 #endif /* already included */
-- 
1.9.1

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


RE: [PATCH V1 1/1] X86: Probe for PIC and set legacy_pic appropriately

2014-04-11 Thread KY Srinivasan


 -Original Message-
 From: H. Peter Anvin [mailto:h...@zytor.com]
 Sent: Friday, April 11, 2014 4:59 PM
 To: KY Srinivasan; x...@kernel.org; gre...@linuxfoundation.org; linux-
 ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de;
 a...@canonical.com; jasow...@redhat.com; t...@linutronix.de;
 jbeul...@suse.com
 Subject: Re: [PATCH V1 1/1] X86: Probe for PIC and set legacy_pic
 appropriately
 
 On 04/11/2014 05:50 PM, K. Y. Srinivasan wrote:
 
  +   /*
  +* Check to see if we have a PIC.
  +* Mask all except the cascade and read
  +* back the value we just wrote. If we don't
  +* have a PIC, we will read 0xff as opposed to the
  +* value we wrote.
  +*/
  +   outb(probe_val, PIC_MASTER_IMR);
  +   probe_val = inb(PIC_MASTER_IMR);
  +   if (probe_val == 0xff) {
  +   printk(KERN_INFO Using NULL legacy PIC\n);
  +   legacy_pic = null_legacy_pic;
  +   raw_spin_unlock_irqrestore(i8259A_lock, flags);
  +   return;
  +   }
  +
  outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
  outb(0xff, PIC_SLAVE_IMR);  /* mask all of 8259A-2 */
 
 
 Again, I would do at least the slave masking above the probe.
 
 Also, I would compare to make sure we get the probe_val back and compare
 with != instead of comparing with ==.

Will do.

Thanks,

K. Y

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


[PATCH V2 1/1] X86: Probe for PIC and set legacy_pic appropriately

2014-04-11 Thread K. Y. Srinivasan
Probe for the existance of legacy PIC, if one does not exist, use the
null_legacy_pic.

This patch implements the proposal put forth by H. Peter Anvin 
h...@linux.intel.com.

In  version V1 of the patch, I had cleaned up the code based on comments from
Peter.

In this version of the patch, I have addressed additional comments from Peter.

Signed-off-by: K. Y. Srinivasan k...@microsoft.com
---
 arch/x86/kernel/cpu/mshyperv.c |2 --
 arch/x86/kernel/i8259.c|   19 +++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 47359f7..9ca9587 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -133,8 +133,6 @@ static void __init ms_hyperv_init_platform(void)
printk(KERN_INFO HyperV: LAPIC Timer Frequency: %#x\n,
lapic_timer_frequency);
 
-   printk(KERN_INFO HyperV: Using null_legacy_pic\n);
-   legacy_pic = null_legacy_pic;
}
 #endif
 
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
index 2e977b5..7f7bd02 100644
--- a/arch/x86/kernel/i8259.c
+++ b/arch/x86/kernel/i8259.c
@@ -299,11 +299,30 @@ static void unmask_8259A(void)
 static void init_8259A(int auto_eoi)
 {
unsigned long flags;
+   unsigned char probe_val = ~(1  PIC_CASCADE_IR);
+   unsigned char new_val;
 
i8259A_auto_eoi = auto_eoi;
 
raw_spin_lock_irqsave(i8259A_lock, flags);
 
+   /*
+* Check to see if we have a PIC.
+* Mask all except the cascade and read
+* back the value we just wrote. If we don't
+* have a PIC, we will read 0xff as opposed to the
+* value we wrote.
+*/
+   outb(0xff, PIC_SLAVE_IMR);  /* mask all of 8259A-2 */
+   outb(probe_val, PIC_MASTER_IMR);
+   new_val = inb(PIC_MASTER_IMR);
+   if (probe_val != new_val) {
+   printk(KERN_INFO Using NULL legacy PIC\n);
+   legacy_pic = null_legacy_pic;
+   raw_spin_unlock_irqrestore(i8259A_lock, flags);
+   return;
+   }
+
outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
outb(0xff, PIC_SLAVE_IMR);  /* mask all of 8259A-2 */
 
-- 
1.7.4.1

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