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

2013-12-23 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.

Roger Tseng (3):
  mfd: Add realtek USB card reader driver
  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 |  856 
 drivers/mfd/Kconfig |   10 +
 drivers/mfd/Makefile|1 +
 drivers/mfd/rtsx_usb.c  |  794 ++
 drivers/mmc/host/Kconfig|7 +
 drivers/mmc/host/Makefile   |1 +
 drivers/mmc/host/rtsx_usb_sdmmc.c   | 1511 +++
 include/linux/mfd/rtsx_usb.h|  609 ++
 10 files changed, 3800 insertions(+)
 create mode 100644 drivers/memstick/host/rtsx_usb_ms.c
 create mode 100644 drivers/mfd/rtsx_usb.c
 create mode 100644 drivers/mmc/host/rtsx_usb_sdmmc.c
 create mode 100644 include/linux/mfd/rtsx_usb.h

-- 
1.8.2

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


[PATCH 1/3] mfd: Add realtek USB card reader driver

2013-12-23 Thread rogerable
From: Roger Tseng rogera...@realtek.com

Realtek USB card reader provides a channel to transfer command or data to flash
memory cards. This driver exports host instances for mmc and memstick subsystems
and handles basic works.

Signed-off-by: Roger Tseng rogera...@realtek.com
---
 drivers/mfd/Kconfig  |  10 +
 drivers/mfd/Makefile |   1 +
 drivers/mfd/rtsx_usb.c   | 794 +++
 include/linux/mfd/rtsx_usb.h | 609 +
 4 files changed, 1414 insertions(+)
 create mode 100644 drivers/mfd/rtsx_usb.c
 create mode 100644 include/linux/mfd/rtsx_usb.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index b7c74a7..4c99ebd 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -507,6 +507,16 @@ config MFD_RTSX_PCI
  types of memory cards, such as Memory Stick, Memory Stick Pro,
  Secure Digital and MultiMediaCard.
 
+config MFD_RTSX_USB
+   tristate Realtek USB card reader
+   depends on USB
+   select MFD_CORE
+   help
+   Select this option to get support for Realtek USB 2.0 card readers
+   including RTS5129, RTS5139, RTS5179 and RTS5170.
+   Realtek card reader supports access to many types of memory cards,
+   such as Memory Stick Pro, Secure Digital and MultiMediaCard.
+
 config MFD_RC5T583
bool Ricoh RC5T583 Power Management system device
depends on I2C=y
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 8a28dc9..33b8de6 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o
 
 rtsx_pci-objs  := rtsx_pcr.o rts5209.o rts5229.o rtl8411.o 
rts5227.o rts5249.o
 obj-$(CONFIG_MFD_RTSX_PCI) += rtsx_pci.o
+obj-$(CONFIG_MFD_RTSX_USB) += rtsx_usb.o
 
 obj-$(CONFIG_HTC_EGPIO)+= htc-egpio.o
 obj-$(CONFIG_HTC_PASIC3)   += htc-pasic3.o
diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
new file mode 100644
index 000..e4171ad
--- /dev/null
+++ b/drivers/mfd/rtsx_usb.c
@@ -0,0 +1,794 @@
+/* Driver for Realtek USB card reader
+ *
+ * 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 as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  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/mutex.h
+#include linux/usb.h
+#include linux/platform_device.h
+#include linux/mfd/core.h
+#include asm/unaligned.h
+#include linux/mfd/rtsx_usb.h
+
+static int polling_pipe = 1;
+module_param(polling_pipe, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(polling_pipe, polling pipe (0: ctl, 1: bulk));
+static struct mfd_cell rtsx_usb_cells[] = {
+   [RTSX_USB_SD_CARD] = {
+   .name = DRV_NAME_RTSX_USB_SDMMC,
+   },
+   [RTSX_USB_MS_CARD] = {
+   .name = DRV_NAME_RTSX_USB_MS,
+   },
+};
+
+static void rtsx_usb_sg_timed_out(unsigned long data)
+{
+   struct rtsx_ucr *ucr = (struct rtsx_ucr *)data;
+
+   dev_dbg(ucr-pusb_intf-dev, %s: sg transfer timed out, __func__);
+   usb_sg_cancel(ucr-current_sg);
+
+   /* we know the cancellation is caused by time-out */
+   ucr-current_sg.status = -ETIMEDOUT;
+}
+
+static int rtsx_usb_bulk_transfer_sglist(struct rtsx_ucr *ucr,
+   unsigned int pipe, struct scatterlist *sg, int num_sg,
+   unsigned int length, unsigned int *act_len, int timeout)
+{
+   int ret;
+
+   dev_dbg(ucr-pusb_intf-dev, %s: xfer %u bytes, %d entries\n,
+   __func__, length, num_sg);
+   ret = usb_sg_init(ucr-current_sg, ucr-pusb_dev, pipe, 0,
+   sg, num_sg, length, GFP_NOIO);
+   if (ret)
+   return ret;
+
+   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);
+
+   if (act_len)
+   *act_len = ucr-current_sg.bytes;
+
+   return ucr-current_sg.status;
+}
+
+int rtsx_usb_transfer_data(struct rtsx_ucr *ucr, unsigned int pipe,
+ void *buf, unsigned int len, int num_sg,
+ unsigned int *act_len, int timeout)
+{
+   if (timeout  600)
+   timeout = 600;
+
+   if (num_sg)
+   return 

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

2013-12-23 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 | 1511 +
 3 files changed, 1519 insertions(+)
 create mode 100644 drivers/mmc/host/rtsx_usb_sdmmc.c

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 7fc5099..16f9a23 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -665,3 +665,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 c41d0c3..9d8d765 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -51,6 +51,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..65a9a27
--- /dev/null
+++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
@@ -0,0 +1,1511 @@
+/* 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 as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  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_ep0_write_register(ucr, MC_FIFO_CTL,
+   FIFO_FLUSH, FIFO_FLUSH);
+   rtsx_usb_ep0_write_register(ucr, MC_DMA_RST, DMA_RESET, DMA_RESET);
+   rtsx_usb_ep0_write_register(ucr, SFSM_ED, 0xf8, 0xf8);
+}
+
+#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, 

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

2013-12-23 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 | 856 
 3 files changed, 867 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..c146507
--- /dev/null
+++ b/drivers/memstick/host/rtsx_usb_ms.c
@@ -0,0 +1,856 @@
+/* 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 as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  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 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_ep0_write_register(ucr, MC_FIFO_CTL, FIFO_FLUSH, FIFO_FLUSH);
+   rtsx_usb_ep0_write_register(ucr, MC_DMA_RST, DMA_RESET, DMA_RESET);
+   rtsx_usb_ep0_write_register(ucr, SFSM_ED, 0xf8, 0xf8);
+}
+
+#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, 

Please I really need you to stand as my Guardian.

2013-12-23 Thread jordia...@ono.com



Please I really need you to stand as my Guardian.
I am contacting you because i needed your help in the management of a sum of 
fund that my late father Mr. Johnson Qattara. Left for me before he died.

The fund is deposited in one of the finical house ($8.5 million u.s dollars ). 
I will offer you 25% of the total amount for helping me to transfer the fund 
into your account. I want you to stand as my guardian and appointed beneficiary 
and the fund will be transfer into your account in your country.  Since i am 
only 20 year old age and without mother and father.

Please i will like you to reply to this email so that i will tell you all the 
information details, on how you will help me here is my private email where you 
will reply me for more information. I am waiting for your urgently reply. 
Thanks and god bless you and your family.

Your sincerely,
Miss Nora Qattara
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: patch to add a success/failure message to comedi autoconfig

2013-12-23 Thread Bernd Porr

Hi Hartley,

it's essentially what I've also written within the patch but I can make 
the comment in the patch a bit meatier if you want. However, I'm 
travelling now and won't be able to work on it till new year probably.


Best,
/Bernd

Hartley Sweeten wrote:

On Sunday, December 22, 2013 1:30 PM, Bernd Porr wrote:

Hi all,

I've added a success / fail message to comedi autoconfig. That's badly 
needed to see which driver has been associated with which comedi dev in 
udev. Also, as far as I know an error in the USB probe callback won't 
cause the kernel to print any errors so tracking down failures in 
autoconfig would be really tricky.


Bernd,

Please re-post this with the patch inline. The comment above is not required
since the commit message should provide the necessary information about
the patch.

Thanks,
Hartley


--
http://www.berndporr.me.uk
http://www.linux-usb-daq.co.uk
http://www.imdb.com/name/nm3293421/
+44 (0)7840 340069
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: usbip: add support for viewing imported devices

2013-12-23 Thread Valentina Manea
As of Matt Mooney's major refactoring in 2011, usbip port
option was left out. Add support for this option in
a manner similar to the old implementation.

Sample output:

Imported USB devices

Port 00: Port in Use at Full Speed(12Mbps)
   unknown vendor : unknown product (1687:6211)
   2-1 - usbip://192.168.122.152:3240/1-1 (remote devid 00010002 (bus/dev 
001/002))

Signed-off-by: Valentina Manea valentina.mane...@gmail.com
---
 .../staging/usbip/userspace/libsrc/vhci_driver.c   | 59 ++
 .../staging/usbip/userspace/libsrc/vhci_driver.h   |  2 +
 drivers/staging/usbip/userspace/src/Makefile.am|  2 +-
 drivers/staging/usbip/userspace/src/usbip.c|  6 +++
 drivers/staging/usbip/userspace/src/usbip.h|  1 +
 drivers/staging/usbip/userspace/src/usbip_port.c   | 59 ++
 6 files changed, 128 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/usbip/userspace/src/usbip_port.c

diff --git a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c 
b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c
index 241006a..5abc567 100644
--- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c
+++ b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c
@@ -4,6 +4,8 @@
 
 #include usbip_common.h
 #include vhci_driver.h
+#include limits.h
+#include netdb.h
 
 #undef  PROGNAME
 #define PROGNAME libusbip
@@ -337,6 +339,29 @@ err:
return -1;
 }
 
+static int read_record(int rhport, char *host, char *port, char *busid)
+{
+   FILE *file;
+   char path[PATH_MAX+1];
+
+   snprintf(path, PATH_MAX, VHCI_STATE_PATH/port%d, rhport);
+
+   file = fopen(path, r);
+   if (!file) {
+   err(fopen);
+   return -1;
+   }
+
+   if (fscanf(file, %s %s %s\n, host, port, busid) != 3) {
+   err(fscanf);
+   fclose(file);
+   return -1;
+   }
+
+   fclose(file);
+
+   return 0;
+}
 
 /* -- */
 
@@ -535,3 +560,37 @@ int usbip_vhci_detach_device(uint8_t port)
 
return 0;
 }
+
+int usbip_vhci_imported_device_dump(struct usbip_imported_device *idev)
+{
+   char product_name[100];
+   char host[NI_MAXHOST] = unknown host;
+   char serv[NI_MAXSERV] = unknown port;
+   char remote_busid[SYSFS_BUS_ID_SIZE];
+   int ret;
+
+   if (idev-status == VDEV_ST_NULL || idev-status == VDEV_ST_NOTASSIGNED)
+   return 0;
+
+   ret = read_record(idev-port, host, serv, remote_busid);
+   if (ret) {
+   err(read_record);
+   return -1;
+   }
+
+   printf(Port %02d: %s at %s\n, idev-port,
+  usbip_status_string(idev-status),
+  usbip_speed_string(idev-udev.speed));
+
+   usbip_names_get_product(product_name, sizeof(product_name),
+   idev-udev.idVendor, idev-udev.idProduct);
+
+   printf(   %s\n,  product_name);
+
+   printf(%10s - usbip://%s:%s/%s (remote devid %08x (bus/dev 
%03d/%03d))\n,
+  idev-udev.busid, host, serv, remote_busid,
+  idev-devid,
+  idev-busnum, idev-devnum);
+
+   return 0;
+}
diff --git a/drivers/staging/usbip/userspace/libsrc/vhci_driver.h 
b/drivers/staging/usbip/userspace/libsrc/vhci_driver.h
index 89949aa..e071f80 100644
--- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.h
+++ b/drivers/staging/usbip/userspace/libsrc/vhci_driver.h
@@ -64,4 +64,6 @@ int usbip_vhci_attach_device(uint8_t port, int sockfd, 
uint8_t busnum,
 
 int usbip_vhci_detach_device(uint8_t port);
 
+int usbip_vhci_imported_device_dump(struct usbip_imported_device *idev);
+
 #endif /* __VHCI_DRIVER_H */
diff --git a/drivers/staging/usbip/userspace/src/Makefile.am 
b/drivers/staging/usbip/userspace/src/Makefile.am
index a113003..b4f8c4b 100644
--- a/drivers/staging/usbip/userspace/src/Makefile.am
+++ b/drivers/staging/usbip/userspace/src/Makefile.am
@@ -6,7 +6,7 @@ sbin_PROGRAMS := usbip usbipd
 
 usbip_SOURCES := usbip.h utils.h usbip.c utils.c usbip_network.c \
 usbip_attach.c usbip_detach.c usbip_list.c \
-usbip_bind.c usbip_unbind.c
+usbip_bind.c usbip_unbind.c usbip_port.c
 
 
 usbipd_SOURCES := usbip_network.h usbipd.c usbip_network.c
diff --git a/drivers/staging/usbip/userspace/src/usbip.c 
b/drivers/staging/usbip/userspace/src/usbip.c
index 04a5f20..d7599d9 100644
--- a/drivers/staging/usbip/userspace/src/usbip.c
+++ b/drivers/staging/usbip/userspace/src/usbip.c
@@ -93,6 +93,12 @@ static const struct command cmds[] = {
.help  = Unbind device from  USBIP_HOST_DRV_NAME .ko,
.usage = usbip_unbind_usage
},
+   {
+   .name  = port,
+   .fn= usbip_port_show,
+   .help  = Show imported USB devices,
+   .usage = NULL
+   },
{ NULL, NULL, NULL, NULL }
 };
 
diff 

Re: [PATCH] staging: usbip: add support for viewing imported devices

2013-12-23 Thread Ilija Hadzic



On Mon, 23 Dec 2013, Valentina Manea wrote:


As of Matt Mooney's major refactoring in 2011, usbip port
option was left out. Add support for this option in
a manner similar to the old implementation.



Yeah, I guess most people (incluing myself) have been just happy with
just cat-ing the files in /var/run/vhci_hcd. Anyway, I guess it doesn't 
hurt to have it in the tool.



Sample output:

Imported USB devices

Port 00: Port in Use at Full Speed(12Mbps)
  unknown vendor : unknown product (1687:6211)
  2-1 - usbip://192.168.122.152:3240/1-1 (remote devid 00010002 (bus/dev 
001/002))



I don't find devid very useful when you are already printing bus and 
device number; devid is just a different format for the same thing. Just 
bus number and device number should suffice.




[SNIP]


+int usbip_vhci_imported_device_dump(struct usbip_imported_device *idev)
+{

[SNIP]

+
+   ret = read_record(idev-port, host, serv, remote_busid);
+   if (ret) {
+   err(read_record);
+   return -1;
+   }
+


If the caller is looping over the ports and dumping one port fails because 
some bozo has rm-ed the record file, is it the right thing to bail out of 
completely? You may want to consider continuing with the loop and still 
show what can be shown (and mark unshowable ports as such).


In that sense, you probably don't want to return an error here.



+   printf(Port %02d: %s at %s\n, idev-port,
+  usbip_status_string(idev-status),
+  usbip_speed_string(idev-udev.speed));

[SNIP]

+int usbip_port_show(int argc, char *argv[])
+{
+   (void) argc;
+   (void) argv;
+


This is an ugly way to suppress the warning. Consider using 
__attribute__((unused)) instead.



-- Ilija

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


[PATCH 0/7] Eliminate uses of __DATE__ and __TIME__

2013-12-23 Thread Josh Triplett
Using the __DATE__ and __TIME macros makes the kernel build non-deterministic.
The kernel already optionally records this information at build time, so random
kernel code shouldn't duplicate that.  Eliminate all uses of __DATE__ and
__TIME__, and then turn on a new GCC warning if available to make sure no new
uses get added.

Josh Triplett (7):
  mtd: denali: Drop print of build date/time
  net: wireless: brcm80211: Drop debug version with build date/time
  staging: rtl8188eu: Drop print of build date/time
  staging: rts5139: Drop print of build time
  staging: wlags49_h2: Drop debug macro recording build date/time
  x86: math-emu: Drop already-disabled print of build date
  Makefile: Build with -Werror=date-time if the compiler supports it

 Makefile | 3 +++
 arch/x86/math-emu/errors.c   | 5 -
 drivers/mtd/nand/denali_pci.c| 1 -
 drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c | 7 ---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c  | 1 -
 drivers/staging/rts5139/rts51x_scsi.c| 1 -
 drivers/staging/wlags49_h2/wl_version.h  | 4 
 7 files changed, 3 insertions(+), 19 deletions(-)

-- 
1.8.5.2

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


[PATCH 4/7] staging: rts5139: Drop print of build time

2013-12-23 Thread Josh Triplett
The kernel already has this information, and individual drivers
shouldn't duplicate that.  This also eliminates the use of __TIME__,
which makes the build non-deterministic.  (And, without __DATE__,
__TIME__ provided little useful information to begin with.)

Signed-off-by: Josh Triplett j...@joshtriplett.org
---
 drivers/staging/rts5139/rts51x_scsi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rts5139/rts51x_scsi.c 
b/drivers/staging/rts5139/rts51x_scsi.c
index a474eed..3a99025 100644
--- a/drivers/staging/rts5139/rts51x_scsi.c
+++ b/drivers/staging/rts5139/rts51x_scsi.c
@@ -1985,7 +1985,6 @@ static int show_info(struct seq_file *m, struct Scsi_Host 
*host)
SPRINTF(   Vendor: Realtek Corp.\n);
SPRINTF(  Product: RTS51xx USB Card Reader\n);
SPRINTF(  Version: %s\n, DRIVER_VERSION);
-   SPRINTF(Build: %s\n, __TIME__);
return 0;
 }
 
-- 
1.8.5.2

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


[PATCH 5/7] staging: wlags49_h2: Drop debug macro recording build date/time

2013-12-23 Thread Josh Triplett
The kernel already has this information, and individual drivers
shouldn't duplicate that.  This also eliminates the use of __DATE__ and
__TIME__, which make the build non-deterministic.

Signed-off-by: Josh Triplett j...@joshtriplett.org
---
 drivers/staging/wlags49_h2/wl_version.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/wlags49_h2/wl_version.h 
b/drivers/staging/wlags49_h2/wl_version.h
index 037b526..019ebb2 100644
--- a/drivers/staging/wlags49_h2/wl_version.h
+++ b/drivers/staging/wlags49_h2/wl_version.h
@@ -129,11 +129,7 @@ err: define bus type;
 #endif  /* HERMES25 */
 #endif  /* BUS_XXX */
 
-#ifdef DBG
-#define MODULE_DATE __DATE__   __TIME__
-#else
 #define MODULE_DATE 07/18/2004 13:30:00
-#endif // DBG
 
 //#define STR2(m) #m
 //#define STR1(m) STR2(m)
-- 
1.8.5.2

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


[PATCH -next] Staging: silicom: fix sparse non static symbol warnings

2013-12-23 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn

Fixes the following sparse warnings:

drivers/staging/silicom/bypasslib/bypass.c:528:12: warning:
 symbol 'init_lib_module' was not declared. Should it be static?
drivers/staging/silicom/bypasslib/bypass.c:534:13: warning:
 symbol 'cleanup_lib_module' was not declared. Should it be static?

Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
---
 drivers/staging/silicom/bypasslib/bypass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/silicom/bypasslib/bypass.c 
b/drivers/staging/silicom/bypasslib/bypass.c
index 9b771c9..09e00da 100644
--- a/drivers/staging/silicom/bypasslib/bypass.c
+++ b/drivers/staging/silicom/bypasslib/bypass.c
@@ -525,13 +525,13 @@ static int get_bypass_info(int if_index, struct bp_info 
*bp_info)
 }
 EXPORT_SYMBOL(get_bypass_info);
 
-int __init init_lib_module(void)
+static int __init init_lib_module(void)
 {
printk(VERSION);
return 0;
 }
 
-void __exit cleanup_lib_module(void)
+static void __exit cleanup_lib_module(void)
 {
 }
 

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


Re: [PATCH 3/7] staging: rtl8188eu: Drop print of build date/time

2013-12-23 Thread Larry Finger

On 12/23/2013 03:55 PM, Josh Triplett wrote:

The kernel already has this information, and individual drivers
shouldn't duplicate that.  This also eliminates the use of __DATE__ and
__TIME__, which make the build non-deterministic.

Signed-off-by: Josh Triplett j...@joshtriplett.org
---
  drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 -
  1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index 7d14779..d44f606 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -865,7 +865,6 @@ static int __init rtw_drv_entry(void)
RT_TRACE(_module_hci_intfs_c_, _drv_err_, (+rtw_drv_entry\n));

DBG_88E(DRV_NAME  driver version=%s\n, DRIVERVERSION);
-   DBG_88E(build time: %s %s\n, __DATE__, __TIME__);

rtw_suspend_lock_init();


Acked-by: Larry Finger larry.fin...@lwfinger.net

Larry






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


[PATCH v2] staging: imx-drm: imx-tve: Fix a sparse warning

2013-12-23 Thread Liu Ying
This patch declares the function of_get_tve_mode
as a static one to fix this sparse warning:
drivers/staging/imx-drm/imx-tve.c:563:11: warning: \
symbol 'of_get_tve_mode' was not declared. \
Should it be static?

Acked-by: Shawn Guo shawn@linaro.org
Signed-off-by: Liu Ying ying@freescale.com
---
Changes from v2:
-Just added Shawn Guo's ack.

 drivers/staging/imx-drm/imx-tve.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/imx-drm/imx-tve.c 
b/drivers/staging/imx-drm/imx-tve.c
index 2c44fef..9abc7ca 100644
--- a/drivers/staging/imx-drm/imx-tve.c
+++ b/drivers/staging/imx-drm/imx-tve.c
@@ -560,7 +560,7 @@ static const char *imx_tve_modes[] = {
[TVE_MODE_VGA] = vga,
 };
 
-const int of_get_tve_mode(struct device_node *np)
+static const int of_get_tve_mode(struct device_node *np)
 {
const char *bm;
int ret, i;
-- 
1.7.9.5


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


Re: [PATCH v2] staging: usbip: add support for viewing imported devices

2013-12-23 Thread Ilija Hadzic


This looks better, but there are still two minor issues:

You have one trailing whtespace error. Please the scripts/checkpatch.pl 
script on the patch and correct the error.


The title of the commit message should indicate that this is an userspace 
patch (this seems to be the convention that other patches have adhered 
to). So:


'staging: usbip: userspace: blah blah'

not

'staging: usbip: blah blah;

-- Ilija


On Tue, 24 Dec 2013, Valentina Manea wrote:


As of Matt Mooney's major refactoring in 2011, usbip port
option was left out. Add support for this option in
a manner similar to the old implementation.

Sample output:

Imported USB devices

Port 00: Port in Use at Full Speed(12Mbps)
  unknown vendor : unknown product (1687:6211)
  2-1 - usbip://192.168.122.152:3240/1-1
  - remote bus/dev 001/002

Signed-off-by: Valentina Manea valentina.mane...@gmail.com
---
Changes since v1:
* remove devid from the printed info
* arrange formatting a bit
* don't bail out when port file doesn't exist, just print whatever info 
is available
* replace void cast with __attribute__((unused))

.../staging/usbip/userspace/libsrc/vhci_driver.c   | 67 ++
.../staging/usbip/userspace/libsrc/vhci_driver.h   |  2 +
drivers/staging/usbip/userspace/src/Makefile.am|  2 +-
drivers/staging/usbip/userspace/src/usbip.c|  6 ++
drivers/staging/usbip/userspace/src/usbip.h|  1 +
drivers/staging/usbip/userspace/src/usbip_port.c   | 57 ++
6 files changed, 134 insertions(+), 1 deletion(-)
create mode 100644 drivers/staging/usbip/userspace/src/usbip_port.c

diff --git a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c 
b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c
index 241006a..65ea5cf 100644
--- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c
+++ b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c
@@ -4,6 +4,8 @@

#include usbip_common.h
#include vhci_driver.h
+#include limits.h
+#include netdb.h

#undef  PROGNAME
#define PROGNAME libusbip
@@ -337,6 +339,29 @@ err:
return -1;
}

+static int read_record(int rhport, char *host, char *port, char *busid)
+{
+   FILE *file;
+   char path[PATH_MAX+1];
+
+   snprintf(path, PATH_MAX, VHCI_STATE_PATH/port%d, rhport);
+
+   file = fopen(path, r);
+   if (!file) {
+   err(fopen);
+   return -1;
+   }
+
+   if (fscanf(file, %s %s %s\n, host, port, busid) != 3) {
+   err(fscanf);
+   fclose(file);
+   return -1;
+   }
+
+   fclose(file);
+
+   return 0;
+}

/* -- */

@@ -535,3 +560,45 @@ int usbip_vhci_detach_device(uint8_t port)

return 0;
}
+
+int usbip_vhci_imported_device_dump(struct usbip_imported_device *idev)
+{
+   char product_name[100];
+   char host[NI_MAXHOST] = unknown host;
+   char serv[NI_MAXSERV] = unknown port;
+   char remote_busid[SYSFS_BUS_ID_SIZE];
+   int ret;
+   int read_record_error = 0;
+
+   if (idev-status == VDEV_ST_NULL || idev-status == VDEV_ST_NOTASSIGNED)
+   return 0;
+
+   ret = read_record(idev-port, host, serv, remote_busid);
+   if (ret) {
+   err(read_record);
+   read_record_error = 1;
+   }
+
+   printf(Port %02d: %s at %s\n, idev-port,
+  usbip_status_string(idev-status),
+  usbip_speed_string(idev-udev.speed));
+
+   usbip_names_get_product(product_name, sizeof(product_name),
+   idev-udev.idVendor, idev-udev.idProduct);
+
+   printf(   %s\n,  product_name);
+
+   if (!read_record_error) {
+   printf(%10s - usbip://%s:%s/%s\n, idev-udev.busid,
+  host, serv, remote_busid);
+   printf(%10s - remote bus/dev %03d/%03d\n,  ,
+  idev-busnum, idev-devnum);
+   } else {
+   printf(%10s - unknown host, remote port and remote busid\n,
+  idev-udev.busid);
+   printf(%10s - remote bus/dev %03d/%03d\n,  ,
+  idev-busnum, idev-devnum);
+   }
+
+   return 0;
+}
diff --git a/drivers/staging/usbip/userspace/libsrc/vhci_driver.h 
b/drivers/staging/usbip/userspace/libsrc/vhci_driver.h
index 89949aa..e071f80 100644
--- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.h
+++ b/drivers/staging/usbip/userspace/libsrc/vhci_driver.h
@@ -64,4 +64,6 @@ int usbip_vhci_attach_device(uint8_t port, int sockfd, 
uint8_t busnum,

int usbip_vhci_detach_device(uint8_t port);

+int usbip_vhci_imported_device_dump(struct usbip_imported_device *idev);
+
#endif /* __VHCI_DRIVER_H */
diff --git a/drivers/staging/usbip/userspace/src/Makefile.am 
b/drivers/staging/usbip/userspace/src/Makefile.am
index a113003..b4f8c4b 100644
--- a/drivers/staging/usbip/userspace/src/Makefile.am
+++