[PATCH 2/2] mmc: rtsx: add support for async request

2014-06-06 Thread micky_ching
From: Micky Ching 

Add support for non-blocking request, pre_req() runs dma_map_sg() and
post_req() runs dma_unmap_sg(). This patch can increase card read/write
speed, especially for high speed card and slow speed CPU.

Test on intel i3(800MHz - 2.3GHz) performance mode(2.3GHz), SD card
clock 208MHz

run dd if=/dev/mmcblk0 of=/dev/null bs=64k count=1024
before:
67108864 bytes (67 MB) copied, 0.85427 s, 78.6 MB/s
after:
67108864 bytes (67 MB) copied, 0.74799 s, 89.7 MB/s

Signed-off-by: Micky Ching 
---
 drivers/mmc/host/rtsx_pci_sdmmc.c |  133 +++--
 1 file changed, 127 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c 
b/drivers/mmc/host/rtsx_pci_sdmmc.c
index 1c68e0d..a2c0858 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -36,7 +37,10 @@ struct realtek_pci_sdmmc {
struct rtsx_pcr *pcr;
struct mmc_host *mmc;
struct mmc_request  *mrq;
+   struct workqueue_struct *workq;
+#define SDMMC_WORKQ_NAME   "rtsx_pci_sdmmc_workq"
 
+   struct work_struct  work;
struct mutexhost_mutex;
 
u8  ssc_depth;
@@ -48,6 +52,11 @@ struct realtek_pci_sdmmc {
int power_state;
 #define SDMMC_POWER_ON 1
 #define SDMMC_POWER_OFF0
+
+   unsigned intsg_count;
+   s32 cookie;
+   unsigned intcookie_sg_count;
+   boolusing_cookie;
 };
 
 static inline struct device *sdmmc_dev(struct realtek_pci_sdmmc *host)
@@ -86,6 +95,77 @@ static void sd_print_debug_regs(struct realtek_pci_sdmmc 
*host)
 #define sd_print_debug_regs(host)
 #endif /* DEBUG */
 
+/*
+ * sd_pre_dma_transfer - do dma_map_sg() or using cookie
+ *
+ * @pre: if called in pre_req()
+ * return:
+ * 0 - do dma_map_sg()
+ * 1 - using cookie
+ */
+static int sd_pre_dma_transfer(struct realtek_pci_sdmmc *host,
+   struct mmc_data *data, bool pre)
+{
+   struct rtsx_pcr *pcr = host->pcr;
+   int read = data->flags & MMC_DATA_READ;
+   int count = 0;
+   int using_cookie = 0;
+
+   if (!pre && data->host_cookie && data->host_cookie != host->cookie) {
+   dev_err(sdmmc_dev(host),
+   "error: data->host_cookie = %d, host->cookie = %d\n",
+   data->host_cookie, host->cookie);
+   data->host_cookie = 0;
+   }
+
+   if (pre || data->host_cookie != host->cookie) {
+   count = rtsx_pci_dma_map_sg(pcr, data->sg, data->sg_len, read);
+   } else {
+   count = host->cookie_sg_count;
+   using_cookie = 1;
+   }
+
+   if (pre) {
+   host->cookie_sg_count = count;
+   if (++host->cookie < 0)
+   host->cookie = 1;
+   data->host_cookie = host->cookie;
+   } else {
+   host->sg_count = count;
+   }
+
+   return using_cookie;
+}
+
+static void sdmmc_pre_req(struct mmc_host *mmc, struct mmc_request *mrq,
+   bool is_first_req)
+{
+   struct realtek_pci_sdmmc *host = mmc_priv(mmc);
+   struct mmc_data *data = mrq->data;
+
+   if (data->host_cookie) {
+   dev_err(sdmmc_dev(host),
+   "error: reset data->host_cookie = %d\n",
+   data->host_cookie);
+   data->host_cookie = 0;
+   }
+
+   sd_pre_dma_transfer(host, data, true);
+   dev_dbg(sdmmc_dev(host), "pre dma sg: %d\n", host->cookie_sg_count);
+}
+
+static void sdmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq,
+   int err)
+{
+   struct realtek_pci_sdmmc *host = mmc_priv(mmc);
+   struct rtsx_pcr *pcr = host->pcr;
+   struct mmc_data *data = mrq->data;
+   int read = data->flags & MMC_DATA_READ;
+
+   rtsx_pci_dma_unmap_sg(pcr, data->sg, data->sg_len, read);
+   data->host_cookie = 0;
+}
+
 static int sd_read_data(struct realtek_pci_sdmmc *host, u8 *cmd, u16 byte_cnt,
u8 *buf, int buf_len, int timeout)
 {
@@ -415,7 +495,7 @@ static int sd_rw_multi(struct realtek_pci_sdmmc *host, 
struct mmc_request *mrq)
 
rtsx_pci_send_cmd_no_wait(pcr);
 
-   err = rtsx_pci_transfer_data(pcr, data->sg, data->sg_len, read, 1);
+   err = rtsx_pci_dma_transfer(pcr, data->sg, host->sg_count, read, 1);
if (err < 0) {
sd_clear_error(host);
return err;
@@ -640,12 +720,24 @@ static int sd_tuning_rx(struct realtek_pci_sdmmc *host, 
u8 opcode)
return 0;
 }
 
-static void sdmmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
+static inline int sd_rw_cmd(struct mmc_command *cmd)
 {
-   struct realtek_pci_sdmmc *host = mmc_priv(mmc);
+   return mmc_op_multi(cmd->opc

[PATCH 0/2] mmc: rtsx: add support for async request

2014-06-06 Thread micky_ching
From: Micky Ching 

Add support for sd/mmc async request, which makes next request do dma_map_sg()
while previous request transfering data. This behaviour can improve card io
performance more than 10%.

Since rtsx mfd driver only provide a single function for transfering data,
so add three split functions for rtsx mmc driver.

Micky Ching (2):
  mfd: rtsx: add dma transfer function
  mmc: rtsx: add support for async request

 drivers/mfd/rtsx_pcr.c|   76 +
 drivers/mmc/host/rtsx_pci_sdmmc.c |  133 +++--
 include/linux/mfd/rtsx_pci.h  |6 ++
 3 files changed, 181 insertions(+), 34 deletions(-)

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


[PATCH 1/2] mfd: rtsx: add dma transfer function

2014-06-06 Thread micky_ching
From: Micky Ching 

rtsx driver using a single function for transfer data, dma map/unmap are
placed in one fix function. We need map/unmap dma in different place(for
mmc async driver), so add three function for dma map, dma transfer and
dma unmap.

Signed-off-by: Micky Ching 
---
 drivers/mfd/rtsx_pcr.c   |   76 ++
 include/linux/mfd/rtsx_pci.h |6 
 2 files changed, 54 insertions(+), 28 deletions(-)

diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index 1d15735..d01b8c2 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -337,40 +337,64 @@ static void rtsx_pci_add_sg_tbl(struct rtsx_pcr *pcr,
 int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist,
int num_sg, bool read, int timeout)
 {
-   struct completion trans_done;
-   u8 dir;
-   int err = 0, i, count;
-   long timeleft;
-   unsigned long flags;
-   struct scatterlist *sg;
-   enum dma_data_direction dma_dir;
-   u32 val;
-   dma_addr_t addr;
-   unsigned int len;
+   int err = 0, count;
 
dev_dbg(&(pcr->pci->dev), "--> %s: num_sg = %d\n", __func__, num_sg);
+   count = rtsx_pci_dma_map_sg(pcr, sglist, num_sg, read);
+   if (count < 1)
+   return -EINVAL;
+   dev_dbg(&(pcr->pci->dev), "DMA mapping count: %d\n", count);
+
+   err = rtsx_pci_dma_transfer(pcr, sglist, count, read, timeout);
+
+   rtsx_pci_dma_unmap_sg(pcr, sglist, num_sg, read);
+
+   return err;
+}
+EXPORT_SYMBOL_GPL(rtsx_pci_transfer_data);
+
+int rtsx_pci_dma_map_sg(struct rtsx_pcr *pcr, struct scatterlist *sglist,
+   int num_sg, bool read)
+{
+   enum dma_data_direction dir = read ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
 
-   /* don't transfer data during abort processing */
if (pcr->remove_pci)
return -EINVAL;
 
if ((sglist == NULL) || (num_sg <= 0))
return -EINVAL;
 
-   if (read) {
-   dir = DEVICE_TO_HOST;
-   dma_dir = DMA_FROM_DEVICE;
-   } else {
-   dir = HOST_TO_DEVICE;
-   dma_dir = DMA_TO_DEVICE;
-   }
+   return dma_map_sg(&(pcr->pci->dev), sglist, num_sg, dir);
+}
+EXPORT_SYMBOL_GPL(rtsx_pci_dma_map_sg);
 
-   count = dma_map_sg(&(pcr->pci->dev), sglist, num_sg, dma_dir);
-   if (count < 1) {
-   dev_err(&(pcr->pci->dev), "scatterlist map failed\n");
+void rtsx_pci_dma_unmap_sg(struct rtsx_pcr *pcr, struct scatterlist *sglist,
+   int num_sg, bool read)
+{
+   enum dma_data_direction dir = read ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
+
+   dma_unmap_sg(&(pcr->pci->dev), sglist, num_sg, dir);
+}
+EXPORT_SYMBOL_GPL(rtsx_pci_dma_unmap_sg);
+
+int rtsx_pci_dma_transfer(struct rtsx_pcr *pcr, struct scatterlist *sglist,
+   int count, bool read, int timeout)
+{
+   struct completion trans_done;
+   struct scatterlist *sg;
+   dma_addr_t addr;
+   long timeleft;
+   unsigned long flags;
+   unsigned int len;
+   int i, err = 0;
+   u32 val;
+   u8 dir = read ? DEVICE_TO_HOST : HOST_TO_DEVICE;
+
+   if (pcr->remove_pci)
+   return -ENODEV;
+
+   if ((sglist == NULL) || (count < 1))
return -EINVAL;
-   }
-   dev_dbg(&(pcr->pci->dev), "DMA mapping count: %d\n", count);
 
val = ((u32)(dir & 0x01) << 29) | TRIG_DMA | ADMA_MODE;
pcr->sgi = 0;
@@ -400,12 +424,10 @@ int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct 
scatterlist *sglist,
}
 
spin_lock_irqsave(&pcr->lock, flags);
-
if (pcr->trans_result == TRANS_RESULT_FAIL)
err = -EINVAL;
else if (pcr->trans_result == TRANS_NO_DEVICE)
err = -ENODEV;
-
spin_unlock_irqrestore(&pcr->lock, flags);
 
 out:
@@ -413,8 +435,6 @@ out:
pcr->done = NULL;
spin_unlock_irqrestore(&pcr->lock, flags);
 
-   dma_unmap_sg(&(pcr->pci->dev), sglist, num_sg, dma_dir);
-
if ((err < 0) && (err != -ENODEV))
rtsx_pci_stop_cmd(pcr);
 
@@ -423,7 +443,7 @@ out:
 
return err;
 }
-EXPORT_SYMBOL_GPL(rtsx_pci_transfer_data);
+EXPORT_SYMBOL_GPL(rtsx_pci_dma_transfer);
 
 int rtsx_pci_read_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len)
 {
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index a383597..74346d5 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -943,6 +943,12 @@ void rtsx_pci_send_cmd_no_wait(struct rtsx_pcr *pcr);
 int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout);
 int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist,
int num_sg, bool read, int timeout);
+int rtsx_pci_dma_map_sg(struct rtsx_pcr *pcr, struct scatterlist *sglist,
+   int num_sg, bool read);
+void rtsx_pci_dma_unmap_sg(struct rtsx_pcr *pcr, struct scatterlist *sglist,
+

[PATCH v3 00/05] staging: Emma Mobile USB driver and KZM9D board code V3

2014-06-06 Thread Magnus Damm
staging: Emma Mobile USB driver and KZM9D board code V3

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

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

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

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

Changes since V2:
- Added CONFIG_OF_ADDRESS dependency for the board staging bits

Changes since V1:
- Added TODO file for emxx_udc
- Broke out board staging base support, included TODO file
- Added code to avoid registering platform device if DT node exists
- Modified KZM9D board code build condition to use SoC Kconfig entry

Many thanks to Dan Carpenter, Geert Uytterhoeven, Greg KH and
Paul Bolle for feedback!

Please let me know if you would like me to rebase this code somehow.

Signed-off-by: Magnus Damm 
---

 Written against renesas git repo at kernel.org using tag
 renesas-devel-v3.15-rc8-20140606

 drivers/staging/Kconfig |4 
 drivers/staging/Makefile|2 
 drivers/staging/board/Kconfig   |8 
 drivers/staging/board/Makefile  |2 
 drivers/staging/board/TODO  |2 
 drivers/staging/board/board.c   |   41 
 drivers/staging/board/board.h   |   20 
 drivers/staging/board/kzm9d.c   |   19 
 drivers/staging/emxx_udc/Kconfig|   10 
 drivers/staging/emxx_udc/Makefile   |1 
 drivers/staging/emxx_udc/TODO   |4 
 drivers/staging/emxx_udc/emxx_udc.c | 3616 ++-
 drivers/staging/emxx_udc/emxx_udc.h |  671 ++
 13 files changed, 4352 insertions(+), 48 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 04/05] staging: board: Initial board staging support

2014-06-06 Thread Magnus Damm
From: Magnus Damm 

Add staging board base support to allow continuous upstream
in-tree development and integration of platform devices.

Helps developers integrate devices as platform devices for
device drivers that only provide platform device bindings.
This in turn allows for incremental development of both
hardware feature support and DT binding work in parallel.

Two separate pieces of board staging functionality is
provided to ease per-board staging board support:
 - The board_staging() macro allows easy per-board callbacks
 - The board_staging_dt_node_available() provides DT node checking

Tested on the KZM9D board with the emxx_udc staging driver.

Signed-off-by: Magnus Damm 
---

 Changes since V2:
 - Added CONFIG_OF_ADDRESS dependency

 Changes since V1:
 - New broken out staging board base support
 - Added the function board_staging_dt_node_available()
 - Added a TODO file

 drivers/staging/Kconfig|2 +
 drivers/staging/Makefile   |1 
 drivers/staging/board/Kconfig  |8 +++
 drivers/staging/board/Makefile |1 
 drivers/staging/board/TODO |2 +
 drivers/staging/board/board.c  |   41 
 drivers/staging/board/board.h  |   20 +++
 7 files changed, 75 insertions(+)

--- 0001/drivers/staging/Kconfig
+++ work/drivers/staging/Kconfig2014-06-06 18:50:38.0 +0900
@@ -110,6 +110,8 @@ source "drivers/staging/media/Kconfig"
 
 source "drivers/staging/android/Kconfig"
 
+source "drivers/staging/board/Kconfig"
+
 source "drivers/staging/ozwpan/Kconfig"
 
 source "drivers/staging/gdm72xx/Kconfig"
--- 0001/drivers/staging/Makefile
+++ work/drivers/staging/Makefile   2014-06-06 18:50:38.0 +0900
@@ -48,6 +48,7 @@ obj-$(CONFIG_TOUCHSCREEN_CLEARPAD_TM1217
 obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4)   += ste_rmi4/
 obj-$(CONFIG_MFD_NVEC) += nvec/
 obj-$(CONFIG_ANDROID)  += android/
+obj-$(CONFIG_STAGING_BOARD)+= board/
 obj-$(CONFIG_USB_WPAN_HCD) += ozwpan/
 obj-$(CONFIG_WIMAX_GDM72XX)+= gdm72xx/
 obj-$(CONFIG_LTE_GDM724X)  += gdm724x/
--- /dev/null
+++ work/drivers/staging/board/Kconfig  2014-06-06 19:25:24.0 +0900
@@ -0,0 +1,8 @@
+config STAGING_BOARD
+   boolean "Staging Board Support"
+   depends on OF_ADDRESS
+   help
+ Select to enable per-board staging support code.
+
+ If in doubt, say N here.
+
--- /dev/null
+++ work/drivers/staging/board/Makefile 2014-06-06 18:50:39.0 +0900
@@ -0,0 +1 @@
+obj-y  := board.o
--- /dev/null
+++ work/drivers/staging/board/TODO 2014-06-06 18:50:39.0 +0900
@@ -0,0 +1,2 @@
+* replace platform device code with DT nodes once the driver supports DT
+* remove staging board code when no more platform devices are needed
--- /dev/null
+++ work/drivers/staging/board/board.c  2014-06-06 18:50:39.0 +0900
@@ -0,0 +1,41 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "board.h"
+
+static bool find_by_address(u64 base_address)
+{
+   struct device_node *dn = of_find_all_nodes(NULL);
+   struct resource res;
+
+   while (dn) {
+   if (of_can_translate_address(dn)
+   && !of_address_to_resource(dn, 0, &res)) {
+   if (res.start == base_address) {
+   of_node_put(dn);
+   return true;
+   }
+   }
+   dn = of_find_all_nodes(dn);
+   }
+
+   return false;
+}
+
+bool __init board_staging_dt_node_available(const struct resource *resource,
+   unsigned int num_resources)
+{
+   unsigned int i;
+
+   for (i = 0; i < num_resources; i++) {
+   const struct resource *r = resource + i;
+
+   if (resource_type(r) == IORESOURCE_MEM)
+   if (find_by_address(r->start))
+   return true; /* DT node available */
+   }
+
+   return false; /* Nothing found */
+}
--- /dev/null
+++ work/drivers/staging/board/board.h  2014-06-06 18:50:39.0 +0900
@@ -0,0 +1,20 @@
+#ifndef __BOARD_H__
+#define __BOARD_H__
+#include 
+#include 
+
+bool board_staging_dt_node_available(const struct resource *resource,
+unsigned int num_resources);
+
+#define board_staging(str, fn) \
+static int __init runtime_board_check(void)\
+{  \
+   if (of_machine_is_compatible(str))  \
+   fn();   \
+   \
+   return 0;   \
+}  \
+   \
+late_initcall(runtime_board_check)
+
+#endif /* __BOARD_H__ */
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverp

[PATCH] list: Fix order of arguments for hlist_add_after(_rcu)

2014-06-06 Thread Ken Helias
All other add functions for lists have the new item as first argument and the
position where it is added as second argument. This was changed for no good
reason in this function and makes using it unnecessary confusing.

Also the naming of the arguments in hlist_add_after was confusing. It was
changed to use the same names as hlist_add_after_rcu.

Signed-off-by: Ken Helias 
Cc: David Airlie 
Cc: Jeff Kirsher 
Cc: Jesse Brandeburg 
Cc: Bruce Allan 
Cc: Carolyn Wyborny 
Cc: Don Skidmore 
Cc: Greg Rose 
Cc: Alex Duyck 
Cc: John Ronciak 
Cc: Mitch Williams 
Cc: Linux NICS 
Cc: Alexander Viro 
Cc: Dipankar Sarma 
Cc: "Paul E. McKenney" 
Cc: Marek Lindner 
Cc: Simon Wunderlich 
Cc: Antonio Quartulli 
Cc: "David S. Miller" 
Cc: Stephen Hemminger 
Cc: Alexey Kuznetsov 
Cc: James Morris 
Cc: Hideaki YOSHIFUJI 
Cc: Patrick McHardy 
Cc: Steffen Klassert 
Cc: Herbert Xu 
Cc: dri-de...@lists.freedesktop.org
Cc: e1000-de...@lists.sourceforge.net
Cc: net...@vger.kernel.org
Cc: de...@driverdev.osuosl.org
Cc: linux-fsde...@vger.kernel.org
Cc: b.a.t.m@lists.open-mesh.org
Cc: bri...@lists.linux-foundation.org
---
Patch based on "Add linux-next specific files for 20140606"

 drivers/gpu/drm/drm_hashtab.c|  2 +-
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c   |  2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |  2 +-
 drivers/staging/lustre/lustre/libcfs/hash.c  |  4 ++--
 fs/namespace.c   |  2 +-
 fs/notify/inode_mark.c   |  2 +-
 fs/notify/vfsmount_mark.c|  2 +-
 include/linux/list.h | 12 ++--
 include/linux/rculist.h  |  6 +++---
 net/batman-adv/fragmentation.c   |  2 +-
 net/bridge/br_multicast.c|  2 +-
 net/ipv4/fib_trie.c  |  2 +-
 net/ipv6/addrlabel.c |  2 +-
 net/xfrm/xfrm_policy.c   |  4 ++--
 14 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/drm_hashtab.c b/drivers/gpu/drm/drm_hashtab.c
index 7e4bae7..4077a35 100644
--- a/drivers/gpu/drm/drm_hashtab.c
+++ b/drivers/gpu/drm/drm_hashtab.c
@@ -125,7 +125,7 @@ int drm_ht_insert_item(struct drm_open_hash *ht, struct 
drm_hash_item *item)
parent = &entry->head;
}
if (parent) {
-   hlist_add_after_rcu(parent, &item->head);
+   hlist_add_after_rcu(&item->head, parent);
} else {
hlist_add_head_rcu(&item->head, h_list);
}
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c 
b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 1bb470b..db0a7e1 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -1437,7 +1437,7 @@ static int i40e_update_ethtool_fdir_entry(struct i40e_vsi 
*vsi,
 
/* add filter to the list */
if (parent)
-   hlist_add_after(&parent->fdir_node, &input->fdir_node);
+   hlist_add_after(&input->fdir_node, &parent->fdir_node);
else
hlist_add_head(&input->fdir_node,
   &pf->fdir_filter_list);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index 23e4e6a..23f4ff3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -2518,7 +2518,7 @@ static int ixgbe_update_ethtool_fdir_entry(struct 
ixgbe_adapter *adapter,
 
/* add filter to the list */
if (parent)
-   hlist_add_after(&parent->fdir_node, &input->fdir_node);
+   hlist_add_after(&input->fdir_node, &parent->fdir_node);
else
hlist_add_head(&input->fdir_node,
   &adapter->fdir_filter_list);
diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c 
b/drivers/staging/lustre/lustre/libcfs/hash.c
index 6d2b455..35835e5 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -351,7 +351,7 @@ cfs_hash_dh_hnode_add(struct cfs_hash *hs, struct 
cfs_hash_bd *bd,
cfs_hash_dhead_t, dh_head);
 
if (dh->dh_tail != NULL) /* not empty */
-   hlist_add_after(dh->dh_tail, hnode);
+   hlist_add_after(hnode, dh->dh_tail);
else /* empty list */
hlist_add_head(hnode, &dh->dh_head);
dh->dh_tail = hnode;
@@ -406,7 +406,7 @@ cfs_hash_dd_hnode_add(struct cfs_hash *hs, struct 
cfs_hash_bd *bd,
cfs_hash_dhead_dep_t, dd_head);
 
if (dh->dd_tail != NULL) /* not empty */
-

[PATCH v3 05/05] staging: board: kzm9d: Board staging support for emxx_udc

2014-06-06 Thread Magnus Damm
From: Magnus Damm 

Add staging board support for the KZM9D board and add
an emxx_udc platform device to allow in-tree continous 
development of the driver on the KZM9D board.

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

Signed-off-by: Magnus Damm 
---

 Changes since V2:
 - None

 Changes since V1:
 - Broke out staging board base patch
 - Compile in if CONFIG_ARCH_EMEV2 is selected
 - Make use of board_staging_dt_node_available()

 drivers/staging/board/Makefile |1 +
 drivers/staging/board/kzm9d.c  |   19 +++
 2 files changed, 20 insertions(+)

--- 0011/drivers/staging/board/Makefile
+++ work/drivers/staging/board/Makefile 2014-05-29 21:40:49.0 +0900
@@ -1 +1,2 @@
 obj-y  := board.o
+obj-$(CONFIG_ARCH_EMEV2)  += kzm9d.o
--- /dev/null
+++ work/drivers/staging/board/kzm9d.c  2014-05-29 21:42:34.0 +0900
@@ -0,0 +1,19 @@
+/* Staging board support for KZM9D. Enable not-yet-DT-capable devices here. */
+
+#include 
+#include 
+#include "board.h"
+
+static const struct resource usbs1_res[] __initconst = {
+   DEFINE_RES_MEM(0xe280, 0x2000),
+   DEFINE_RES_IRQ(159),
+};
+
+static void __init kzm9d_init(void)
+{
+   if (!board_staging_dt_node_available(usbs1_res, ARRAY_SIZE(usbs1_res)))
+   platform_device_register_simple("emxx_udc", -1, usbs1_res,
+   ARRAY_SIZE(usbs1_res));
+}
+
+board_staging("renesas,kzm9d", kzm9d_init);
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 02/05] staging: emxx_udc: I/O memory and IRQ resource support

2014-06-06 Thread Magnus Damm
From: Magnus Damm 

Adjust the emxx_udc driver to make use of the standard
driver model to pass I/O memory and IRQ as resources
instead of hard coding those things in the driver.

Needs more work - the VBUS signal is yet not handled.

Signed-off-by: Magnus Damm 
---

 Changes since V2:
 - None

 Changes since V1:
 - None

 drivers/staging/emxx_udc/emxx_udc.c |   57 +++
 drivers/staging/emxx_udc/emxx_udc.h |9 -
 2 files changed, 18 insertions(+), 48 deletions(-)

--- 0002/drivers/staging/emxx_udc/emxx_udc.c
+++ work/drivers/staging/emxx_udc/emxx_udc.c2014-05-22 16:20:02.0 
+0900
@@ -3356,37 +3356,38 @@ static int nbu2ss_drv_probe(struct platf
 {
int status = -ENODEV;
struct nbu2ss_udc   *udc;
+   struct resource *r;
+   int irq;
+   void __iomem *mmio_base;
 
udc = &udc_controller;
memset(udc, 0, sizeof(struct nbu2ss_udc));
 
platform_set_drvdata(pdev, udc);
 
-   /* IO Memory Region */
-   if (!request_mem_region(USB_BASE_ADDRESS, USB_BASE_SIZE
-   , driver_name)) {
+   /* require I/O memory and IRQ to be provided as resources */
+   r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   mmio_base = devm_request_and_ioremap(&pdev->dev, r);
+   if (IS_ERR(mmio_base)) {
+   dev_err(&pdev->dev, "failed to map I/O memory\n");
+   return PTR_ERR(mmio_base);
+   }
 
-   ERR("request_mem_region failed\n");
-   return -EBUSY;
+   irq = platform_get_irq(pdev, 0);
+   if (irq < 0) {
+   dev_err(&pdev->dev, "failed to get IRQ\n");
+   return irq;
}
+   status = devm_request_irq(&pdev->dev, irq, _nbu2ss_udc_irq,
+ 0, driver_name, udc);
 
/* IO Memory */
-   udc->p_regs = (PT_FC_REGS)ioremap(USB_BASE_ADDRESS, USB_BASE_SIZE);
-   if (!udc->p_regs) {
-   ERR("request_io_mem failed\n");
-   goto cleanup3;
-   }
+   udc->p_regs = (PT_FC_REGS)mmio_base;
 
/* USB Function Controller Interrupt */
-   status = request_irq(USB_UDC_IRQ_1,
-   _nbu2ss_udc_irq,
-   IRQF_DISABLED,
-   driver_name,
-   udc);
-
if (status != 0) {
ERR("request_irq(USB_UDC_IRQ_1) failed\n");
-   goto cleanup2;
+   goto cleanup1;
}
 
/* Driver Initialization */
@@ -3412,18 +3413,6 @@ static int nbu2ss_drv_probe(struct platf
return status;
 
 cleanup1:
-   /* Interrupt Handler - Release */
-   free_irq(USB_UDC_IRQ_1, udc);
-
-cleanup2:
-   /* IO Memory - Release */
-   if (udc->p_regs)
-   iounmap(udc->p_regs);
-
-cleanup3:
-   /* IO Memory Region - Release */
-   release_mem_region(USB_BASE_ADDRESS, USB_BASE_SIZE);
-
return status;
 }
 
@@ -3456,18 +3445,8 @@ static int __exit nbu2ss_drv_remove(stru
}
 
/* Interrupt Handler - Release */
-   free_irq(USB_UDC_IRQ_1, udc);
-
-   /* Interrupt Handler - Release */
free_irq(INT_VBUS, udc);
 
-   /* IO Memory - Release */
-   if (udc->p_regs)
-   iounmap(udc->p_regs);
-
-   /* IO Memory Region - Release */
-   release_mem_region(USB_BASE_ADDRESS, USB_BASE_SIZE);
-
return 0;
 }
 
--- 0002/drivers/staging/emxx_udc/emxx_udc.h
+++ work/drivers/staging/emxx_udc/emxx_udc.h2014-05-22 16:20:02.0 
+0900
@@ -47,20 +47,11 @@
 
 
 /* Board dependence(Resource) */
-#define USB_BASE_ADDRESS   EMXX_USBS1_BASE
-#define USB_BASE_SIZE  0x2000
-
-#define USB_UDC_IRQ_0  INT_USBF0
-#define USB_UDC_IRQ_1  INT_USBF1
 #defineVBUS_VALUE  GPIO_VBUS
 
 /* below hacked up for staging integration */
 #define GPIO_VBUS 0 /* GPIO_P153 on KZM9D */
 #define INT_VBUS 0 /* IRQ for GPIO_P153 */
-#define INT_USBF0 158
-#define INT_USBF1 159
-#define EMXX_USBS0_BASE 0xe270
-#define EMXX_USBS1_BASE 0xe280
 
 /* Board dependence(Wait) */
 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 03/05] staging: emxx_udc: Add TODO file

2014-06-06 Thread Magnus Damm
From: Magnus Damm 

Add a TODO file for emxx_udc to show what is left to do.

Signed-off-by: Magnus Damm 
---

 Changes since V2:
 - None

 Changes since V1:
 - New patch

 drivers/staging/emxx_udc/TODO |4 
 1 file changed, 4 insertions(+)

--- /dev/null
+++ work/drivers/staging/emxx_udc/TODO  2014-05-29 18:08:58.0 +0900
@@ -0,0 +1,4 @@
+* add clock framework support (platform device with CCF needs special care)
+* break out board-specific VBUS GPIO to work with multiplatform
+* DT bindings
+* move driver into drivers/usb/gadget/
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 1/4] dma-mapping: Add devm_ interface for dma_map_single()

2014-06-06 Thread Eli Billauer

Hello Joerg.


On 05/06/14 00:25, Joerg Roedel wrote:


What you are trying to do should work with dma_alloc_noncoherent(). The
API allows partial syncs on this memory, so you should be fine.
   
Please try to put yourself in my position: I have a driver that I care 
about, which works fine for a few years. It's based upon 
dma_map_single(), which seems to be the common way to get non-coherent 
memory, even for the driver's entire lifespan. I realize that 
dma_alloc_* was the intended way to do it, but fact is that dma_map_* 
has become the common choice.


Now I need to switch to dma_alloc_noncoherent(), which isn't used by 
many drivers, it seems. It should work the same, but there's always the 
worry if I'll cover all the corners. So will I take this risk of a nasty 
DMA bug on some esoteric platform, just to cut some lines in the code?


And if I choose to keep the unmanaged dma_map_single(), maybe I'll mess 
up if I convert other allocations to the managed API? Hmmm, maybe it's 
best to forget all about it.

The problem with a devm variant of dma_map_* is that it is too easy to
misuse or to use it wrong so that a driver could eat up all available
DMA handles on some platforms.
   
I suppose you mean that those who use dma_map_* for a one-off DMA 
session will drop the unmapping, thinking that it's "managed anyhow"...? 
Well, you can say that about any of the managed functions. For example, 
when devm_kzalloc() was introduced, someone maybe argued that people 
would drop kfree()s where they shouldn't, causing memory leaks.


So I think it boils down to whether devres is a good idea or not. 
Someone who thinks it's bad, will reject any new API, referring to 
memory efficiency, additional causes of failure and the risk of 
misleading the herd.


But if devres is to become commonly used in the future, I think drop-in 
replacements are necessary. In my opinion, telling people to adopt 
another methodology (e.g. dma_alloc_noncoherent vs. mapping), even if 
functionally equivalent, is a good way to make sure devres is never adopted.


Regards,
   Eli

Joerg


   



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


Re: [PATCH v2 04/05] staging: board: Initial board staging support

2014-06-06 Thread Magnus Damm
On Fri, May 30, 2014 at 8:10 AM, Simon Horman  wrote:
> On Thu, May 29, 2014 at 10:27:30PM +0900, Magnus Damm wrote:
>> Hi Dan,
>>
>> On Thu, May 29, 2014 at 10:20 PM, Dan Carpenter
>>  wrote:
>> > On Thu, May 29, 2014 at 10:17:32PM +0900, Magnus Damm wrote:
>> >> --- /dev/null
>> >> +++ work/drivers/staging/board/Kconfig2014-05-29 
>> >> 21:40:41.0 +0900
>> >> @@ -0,0 +1,7 @@
>> >> +config STAGING_BOARD
>> >> + boolean "Staging Board Support"
>> >> + help
>> >> +   Select to enable per-board staging support code.
>> >> +
>> >> +   If in doubt, say N here.
>> >> +
>> >
>> > Actually, you're probably going to need to add a bunch of dependencies
>> > here or it will break "make randconfig" right away.  Sorry that I forgot
>> > about this in the first review.
>>
>> Good point, thanks for checking. I will have a look at this and add
>> dependencies to make sure it builds on a wide range of platforms.
>
> Hi Magnus,
>
> let me know if you would like me to perform some build-testing.

Hey Simon,

Thanks for the offer. When you have time, can you please feed V3 into
your build test setup?

[PATCH v3 00/05] staging: Emma Mobile USB driver and KZM9D board code V3
[PATCH v3 01/05] staging: emxx_udc: Add Emma Mobile USB Gadget driver
[PATCH v3 02/05] staging: emxx_udc: I/O memory and IRQ resource support
[PATCH v3 03/05] staging: emxx_udc: Add TODO file
[PATCH v3 04/05] staging: board: Initial board staging support
[PATCH v3 05/05] staging: board: kzm9d: Board staging support for emxx_udc

Cheers,

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


Re: [PATCH] staging: omap4iss: copy paste error in iss_get_clocks

2014-06-06 Thread Laurent Pinchart
Hi Vitaly,

Thank you for the patch.

On Thursday 05 June 2014 17:07:48 Vitaly Osipov wrote:
> It makes more sense to return PTR_ERR(iss->iss_ctrlclk) here. The
> current code looks like an oversight in pasting the block just above
> this one.
> 
> Signed-off-by: Vitaly Osipov 

Acked-by: Laurent Pinchart 

and applied to my tree.

> ---
>  drivers/staging/media/omap4iss/iss.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/omap4iss/iss.c
> b/drivers/staging/media/omap4iss/iss.c index 2e422dd..4a9e444 100644
> --- a/drivers/staging/media/omap4iss/iss.c
> +++ b/drivers/staging/media/omap4iss/iss.c
> @@ -1029,7 +1029,7 @@ static int iss_get_clocks(struct iss_device *iss)
>   if (IS_ERR(iss->iss_ctrlclk)) {
>   dev_err(iss->dev, "Unable to get iss_ctrlclk clock info\n");
>   iss_put_clocks(iss);
> - return PTR_ERR(iss->iss_fck);
> + return PTR_ERR(iss->iss_ctrlclk);
>   }
> 
>   return 0;

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-06 Thread Greg Kroah-Hartman
On Fri, Jun 06, 2014 at 02:56:43PM +0100, Russell King wrote:
> The initial state at boot is assumed to be disconnected, and we hope
> to receive an interrupt to update the status.  Let's be more explicit
> about the current state - reading the PHY status register tells us
> the current level of the hotplug signal, which we can report back in
> the _detect() method.
> 
> Signed-off-by: Russell King 
> ---
> This fix should go in for -rc - though it's probably too late to get it
> in for 3.15, it may be considered as a potential stable candidate.  If
> not, can we get this in for 3.16-rc1 please?

Yes, it's too late for 3.15, but I can mark it for -stable and get it in
for 3.16-rc1.

thanks,

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


[PATCH] imx-drm: imx-hdmi: fix hdmi hotplug detection initial state

2014-06-06 Thread Russell King
The initial state at boot is assumed to be disconnected, and we hope
to receive an interrupt to update the status.  Let's be more explicit
about the current state - reading the PHY status register tells us
the current level of the hotplug signal, which we can report back in
the _detect() method.

Signed-off-by: Russell King 
---
This fix should go in for -rc - though it's probably too late to get it
in for 3.15, it may be considered as a potential stable candidate.  If
not, can we get this in for 3.16-rc1 please?

Thanks.

 drivers/staging/imx-drm/imx-hdmi.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/imx-drm/imx-hdmi.c 
b/drivers/staging/imx-drm/imx-hdmi.c
index d47dedd2cdb4..6f5efcc89880 100644
--- a/drivers/staging/imx-drm/imx-hdmi.c
+++ b/drivers/staging/imx-drm/imx-hdmi.c
@@ -120,8 +120,6 @@ 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;
 
@@ -1382,7 +1380,9 @@ 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;
+
+   return hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_HPD ?
+   connector_status_connected : connector_status_disconnected;
 }
 
 static int imx_hdmi_connector_get_modes(struct drm_connector *connector)
@@ -1524,7 +1524,6 @@ static irqreturn_t imx_hdmi_irq(int irq, void *dev_id)
 
hdmi_modb(hdmi, 0, HDMI_PHY_HPD, HDMI_PHY_POL0);
 
-   hdmi->connector_status = connector_status_connected;
imx_hdmi_poweron(hdmi);
} else {
dev_dbg(hdmi->dev, "EVENT=plugout\n");
@@ -1532,7 +1531,6 @@ static irqreturn_t imx_hdmi_irq(int irq, void *dev_id)
hdmi_modb(hdmi, HDMI_PHY_HPD, HDMI_PHY_HPD,
HDMI_PHY_POL0);
 
-   hdmi->connector_status = connector_status_disconnected;
imx_hdmi_poweroff(hdmi);
}
drm_helper_hpd_irq_event(hdmi->connector.dev);
@@ -1606,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;
 
-- 
1.8.3.1

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


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

2014-06-06 Thread Greg KH
On Fri, Jun 06, 2014 at 07:44:08PM +0900, Magnus Damm wrote:
> staging: Emma Mobile USB driver and KZM9D board code V3
> 
> [PATCH v3 01/05] staging: emxx_udc: Add Emma Mobile USB Gadget driver
> [PATCH v3 02/05] staging: emxx_udc: I/O memory and IRQ resource support
> [PATCH v3 03/05] staging: emxx_udc: Add TODO file
> [PATCH v3 04/05] staging: board: Initial board staging support
> [PATCH v3 05/05] staging: board: kzm9d: Board staging support for emxx_udc
> 
> This patch series is V3 of the old USB Gadget driver for Emma Mobile
> that gets slightly adjusted to make use of the platform device interface
> which in turn is used to add USB Gadget support to the KZM9D board.
> 
> Two separate staging components are included in this series:
> 1) the emxx_udc driver - from out-of-tree Android 2.6.35.7
> 2) board staging support for KZM9D - platform device for DT-only KZM9D
> 
> The two components above will be used to continously improve the driver
> and board integration code until the driver can be moved out of staging
> and/or DT bindings are available so the board staging platform device code
> can be replaced with a DT node.
> 
> Changes since V2:
> - Added CONFIG_OF_ADDRESS dependency for the board staging bits
> 
> Changes since V1:
> - Added TODO file for emxx_udc
> - Broke out board staging base support, included TODO file
> - Added code to avoid registering platform device if DT node exists
> - Modified KZM9D board code build condition to use SoC Kconfig entry
> 
> Many thanks to Dan Carpenter, Geert Uytterhoeven, Greg KH and
> Paul Bolle for feedback!
> 
> Please let me know if you would like me to rebase this code somehow.

At quick glance, this looks good.  I'll queue it up after 3.16-rc1 is
out as it's too late for this merge window.

thanks,

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


Re: [PATCH] list: Fix order of arguments for hlist_add_after(_rcu)

2014-06-06 Thread Greg KH
On Fri, Jun 06, 2014 at 11:42:23AM +0200, Ken Helias wrote:
> All other add functions for lists have the new item as first argument and the
> position where it is added as second argument. This was changed for no good
> reason in this function and makes using it unnecessary confusing.
> 
> Also the naming of the arguments in hlist_add_after was confusing. It was
> changed to use the same names as hlist_add_after_rcu.
> 
> Signed-off-by: Ken Helias 
> Cc: David Airlie 
> Cc: Jeff Kirsher 
> Cc: Jesse Brandeburg 
> Cc: Bruce Allan 
> Cc: Carolyn Wyborny 
> Cc: Don Skidmore 
> Cc: Greg Rose 
> Cc: Alex Duyck 
> Cc: John Ronciak 
> Cc: Mitch Williams 
> Cc: Linux NICS 
> Cc: Alexander Viro 
> Cc: Dipankar Sarma 
> Cc: "Paul E. McKenney" 
> Cc: Marek Lindner 
> Cc: Simon Wunderlich 
> Cc: Antonio Quartulli 
> Cc: "David S. Miller" 
> Cc: Stephen Hemminger 
> Cc: Alexey Kuznetsov 
> Cc: James Morris 
> Cc: Hideaki YOSHIFUJI 
> Cc: Patrick McHardy 
> Cc: Steffen Klassert 
> Cc: Herbert Xu 
> Cc: dri-de...@lists.freedesktop.org
> Cc: e1000-de...@lists.sourceforge.net
> Cc: net...@vger.kernel.org
> Cc: de...@driverdev.osuosl.org
> Cc: linux-fsde...@vger.kernel.org
> Cc: b.a.t.m@lists.open-mesh.org
> Cc: bri...@lists.linux-foundation.org
> ---
> Patch based on "Add linux-next specific files for 20140606"
> 
>  drivers/gpu/drm/drm_hashtab.c|  2 +-
>  drivers/net/ethernet/intel/i40e/i40e_ethtool.c   |  2 +-
>  drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |  2 +-
>  drivers/staging/lustre/lustre/libcfs/hash.c  |  4 ++--
>  fs/namespace.c   |  2 +-
>  fs/notify/inode_mark.c   |  2 +-
>  fs/notify/vfsmount_mark.c|  2 +-
>  include/linux/list.h | 12 ++--
>  include/linux/rculist.h  |  6 +++---
>  net/batman-adv/fragmentation.c   |  2 +-
>  net/bridge/br_multicast.c|  2 +-
>  net/ipv4/fib_trie.c  |  2 +-
>  net/ipv6/addrlabel.c |  2 +-
>  net/xfrm/xfrm_policy.c   |  4 ++--
>  14 files changed, 23 insertions(+), 23 deletions(-)


drivers/staging/ portion:
Acked-by: Greg Kroah-Hartman 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH] list: Fix order of arguments for hlist_add_after(_rcu)

2014-06-06 Thread David Laight
From: Behalf Of Ken Helias
> All other add functions for lists have the new item as first argument and the
> position where it is added as second argument. This was changed for no good
> reason in this function and makes using it unnecessary confusing.
> 
> Also the naming of the arguments in hlist_add_after was confusing. It was
> changed to use the same names as hlist_add_after_rcu.
...
> -static inline void hlist_add_after_rcu(struct hlist_node *prev,
> -struct hlist_node *n)
> +static inline void hlist_add_after_rcu(struct hlist_node *n,
> +struct hlist_node *prev)

It is rather a shame that the change doesn't generate a compilation
error for old source files.

David



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


Re: [PATCH v2 1/4] dma-mapping: Add devm_ interface for dma_map_single()

2014-06-06 Thread Greg KH
On Fri, Jun 06, 2014 at 02:45:06PM +0300, Eli Billauer wrote:
> Hello Joerg.
> 
> 
> On 05/06/14 00:25, Joerg Roedel wrote:
> >
> >What you are trying to do should work with dma_alloc_noncoherent(). The
> >API allows partial syncs on this memory, so you should be fine.
> Please try to put yourself in my position: I have a driver that I care
> about, which works fine for a few years. It's based upon dma_map_single(),
> which seems to be the common way to get non-coherent memory, even for the
> driver's entire lifespan. I realize that dma_alloc_* was the intended way to
> do it, but fact is that dma_map_* has become the common choice.

Is your driver in the kernel tree?  If not, you really are on your own :(

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


[PATCH 04/13] staging: rtl8188eu:Move rtw_hw_[suspend, resume]() to rtw_pwrctrl.c

2014-06-06 Thread navin patidar
rtw_hw_[suspend,resume]() functions are used only in rtw_pwrctrl.c,
so move these functions there.

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c   |  103 
 drivers/staging/rtl8188eu/include/osdep_intf.h |2 -
 drivers/staging/rtl8188eu/os_dep/usb_intf.c|  102 ---
 3 files changed, 103 insertions(+), 104 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
index 599f2b6..be4c094 100644
--- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
@@ -23,6 +23,109 @@
 #include 
 #include 
 #include 
+#include 
+
+static int rtw_hw_suspend(struct adapter *padapter)
+{
+   struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
+   struct net_device *pnetdev = padapter->pnetdev;
+
+
+   if ((!padapter->bup) || (padapter->bDriverStopped) ||
+   (padapter->bSurpriseRemoved)) {
+   DBG_88E("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = 
%d\n",
+   padapter->bup, padapter->bDriverStopped,
+   padapter->bSurpriseRemoved);
+   goto error_exit;
+   }
+
+   /* system suspend */
+   LeaveAllPowerSaveMode(padapter);
+
+   DBG_88E("==> rtw_hw_suspend\n");
+   _enter_pwrlock(&pwrpriv->lock);
+   pwrpriv->bips_processing = true;
+   /* s1. */
+   if (pnetdev) {
+   netif_carrier_off(pnetdev);
+   netif_tx_stop_all_queues(pnetdev);
+   }
+
+   /* s2. */
+   rtw_disassoc_cmd(padapter, 500, false);
+
+   /* s2-2.  indicate disconnect to os */
+   {
+   struct  mlme_priv *pmlmepriv = &padapter->mlmepriv;
+
+   if (check_fwstate(pmlmepriv, _FW_LINKED)) {
+   _clr_fwstate_(pmlmepriv, _FW_LINKED);
+
+   rtw_led_control(padapter, LED_CTL_NO_LINK);
+
+   rtw_os_indicate_disconnect(padapter);
+
+   /* donnot enqueue cmd */
+   rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_DISCONNECT, 0);
+   }
+   }
+   /* s2-3. */
+   rtw_free_assoc_resources(padapter, 1);
+
+   /* s2-4. */
+   rtw_free_network_queue(padapter, true);
+   rtw_ips_dev_unload(padapter);
+   pwrpriv->rf_pwrstate = rf_off;
+   pwrpriv->bips_processing = false;
+
+   _exit_pwrlock(&pwrpriv->lock);
+
+   return 0;
+
+error_exit:
+   DBG_88E("%s, failed\n", __func__);
+   return -1;
+}
+
+static int rtw_hw_resume(struct adapter *padapter)
+{
+   struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
+   struct net_device *pnetdev = padapter->pnetdev;
+
+
+   /* system resume */
+   DBG_88E("==> rtw_hw_resume\n");
+   _enter_pwrlock(&pwrpriv->lock);
+   pwrpriv->bips_processing = true;
+   rtw_reset_drv_sw(padapter);
+
+   if (pm_netdev_open(pnetdev, false) != 0) {
+   _exit_pwrlock(&pwrpriv->lock);
+   goto error_exit;
+   }
+
+   netif_device_attach(pnetdev);
+   netif_carrier_on(pnetdev);
+
+   if (!netif_queue_stopped(pnetdev))
+   netif_start_queue(pnetdev);
+   else
+   netif_wake_queue(pnetdev);
+
+   pwrpriv->bkeepfwalive = false;
+   pwrpriv->brfoffbyhw = false;
+
+   pwrpriv->rf_pwrstate = rf_on;
+   pwrpriv->bips_processing = false;
+
+   _exit_pwrlock(&pwrpriv->lock);
+
+
+   return 0;
+error_exit:
+   DBG_88E("%s, Open net dev failed\n", __func__);
+   return -1;
+}
 
 void ips_enter(struct adapter *padapter)
 {
diff --git a/drivers/staging/rtl8188eu/include/osdep_intf.h 
b/drivers/staging/rtl8188eu/include/osdep_intf.h
index c4599c5..a5b3bd3 100644
--- a/drivers/staging/rtl8188eu/include/osdep_intf.h
+++ b/drivers/staging/rtl8188eu/include/osdep_intf.h
@@ -77,7 +77,5 @@ void rtw_ips_dev_unload(struct adapter *padapter);
 
 int rtw_ips_pwr_up(struct adapter *padapter);
 void rtw_ips_pwr_down(struct adapter *padapter);
-int rtw_hw_suspend(struct adapter *padapter);
-int rtw_hw_resume(struct adapter *padapter);
 
 #endif /* _OSDEP_INTF_H_ */
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index a84ee97..25a931a 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -234,108 +234,6 @@ static void rtw_dev_unload(struct adapter *padapter)
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-rtw_dev_unload\n"));
 }
 
-int rtw_hw_suspend(struct adapter *padapter)
-{
-   struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
-   struct net_device *pnetdev = padapter->pnetdev;
-
-
-   if ((!padapter->bup) || (padapter->bDriverStopped) ||
-   (padapter->bSurpriseRemoved)) {
-   DBG_88E("padapter->bup=%d bDriverStopped=%d bSurpriseRemoved = 
%d\n",
-   pad

[PATCH 05/13] staging: rtl8188eu: Remove unused struct intf_priv

2014-06-06 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/include/osdep_intf.h |   33 
 1 file changed, 33 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/osdep_intf.h 
b/drivers/staging/rtl8188eu/include/osdep_intf.h
index a5b3bd3..523141a 100644
--- a/drivers/staging/rtl8188eu/include/osdep_intf.h
+++ b/drivers/staging/rtl8188eu/include/osdep_intf.h
@@ -24,39 +24,6 @@
 #include 
 #include 
 
-struct intf_priv {
-   u8 *intf_dev;
-   u32 max_iosz;   /* USB2.0: 128, USB1.1: 64, SDIO:64 */
-   u32 max_xmitsz; /* USB2.0: unlimited, SDIO:512 */
-   u32 max_recvsz; /* USB2.0: unlimited, SDIO:512 */
-
-   u8 *io_rwmem;
-   u8 *allocated_io_rwmem;
-   u32 io_wsz; /* unit: 4bytes */
-   u32 io_rsz;/* unit: 4bytes */
-   u8 intf_status;
-
-   void (*_bus_io)(u8 *priv);
-
-/*
-Under Sync. IRP (SDIO/USB)
-A protection mechanism is necessary for the io_rwmem(read/write protocol)
-
-Under Async. IRP (SDIO/USB)
-The protection mechanism is through the pending queue.
-*/
-   struct mutex ioctl_mutex;
-   /*  when in USB, IO is through interrupt in/out endpoints */
-   struct usb_device   *udev;
-   struct urb *piorw_urb;
-   u8 io_irp_cnt;
-   u8 bio_irp_pending;
-   struct semaphore  io_retevt;
-   struct timer_list io_timer;
-   u8 bio_irp_timeout;
-   u8 bio_timer_cancel;
-};
-
 u8 rtw_init_drv_sw(struct adapter *padapter);
 u8 rtw_free_drv_sw(struct adapter *padapter);
 u8 rtw_reset_drv_sw(struct adapter *padapter);
-- 
1.7.10.4

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


[PATCH 02/13] staging: rtl8188eu: Remove rtw_deinit_intf_priv()

2014-06-06 Thread navin patidar
Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c |   13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index c2e5276..f874270 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -62,15 +62,6 @@ static u8 rtw_init_intf_priv(struct dvobj_priv *dvobj)
return _SUCCESS;
 }

-static u8 rtw_deinit_intf_priv(struct dvobj_priv *dvobj)
-{
-   u8 rst = _SUCCESS;
-
-   kfree(dvobj->usb_vendor_req_buf);
-   mutex_destroy(&dvobj->usb_vendor_req_mutex);
-   return rst;
-}
-
 static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
 {
int i;
@@ -175,7 +166,9 @@ static void usb_dvobj_deinit(struct usb_interface *usb_intf)
usb_reset_device(interface_to_usbdev(usb_intf));
}
}
-   rtw_deinit_intf_priv(dvobj);
+
+   kfree(dvobj->usb_vendor_req_buf);
+   mutex_destroy(&dvobj->usb_vendor_req_mutex);
kfree(dvobj);
}

--
1.7.10.4

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


[PATCH 09/13] staging: rtl8188eu: rtw_io.h: Remove unused structures

2014-06-06 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/include/rtw_io.h |   85 
 1 file changed, 85 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_io.h 
b/drivers/staging/rtl8188eu/include/rtw_io.h
index e30b84b..e56c52b 100644
--- a/drivers/staging/rtl8188eu/include/rtw_io.h
+++ b/drivers/staging/rtl8188eu/include/rtw_io.h
@@ -142,91 +142,6 @@ struct intf_hdl {
struct _io_ops  io_ops;
 };
 
-struct reg_protocol_rd {
-#ifdef __LITTLE_ENDIAN
-   /* DW1 */
-   u32 NumOfTrans:4;
-   u32 Reserved1:4;
-   u32 Reserved2:24;
-   /* DW2 */
-   u32 ByteCount:7;
-   u32 WriteEnable:1;  /* 0:read, 1:write */
-   u32 FixOrContinuous:1;  /* 0:continuous, 1: Fix */
-   u32 BurstMode:1;
-   u32 Byte1Access:1;
-   u32 Byte2Access:1;
-   u32 Byte4Access:1;
-   u32 Reserved3:3;
-   u32 Reserved4:16;
-   /* DW3 */
-   u32 BusAddress;
-   /* DW4 */
-   /* u32  Value; */
-#else
-/* DW1 */
-   u32 Reserved1:4;
-   u32 NumOfTrans:4;
-   u32 Reserved2:24;
-   /* DW2 */
-   u32 WriteEnable:1;
-   u32 ByteCount:7;
-   u32 Reserved3:3;
-   u32 Byte4Access:1;
-
-   u32 Byte2Access:1;
-   u32 Byte1Access:1;
-   u32 BurstMode:1;
-   u32 FixOrContinuous:1;
-   u32 Reserved4:16;
-   /* DW3 */
-   u32 BusAddress;
-
-   /* DW4 */
-#endif
-};
-
-struct reg_protocol_wt {
-#ifdef __LITTLE_ENDIAN
-   /* DW1 */
-   u32 NumOfTrans:4;
-   u32 Reserved1:4;
-   u32 Reserved2:24;
-   /* DW2 */
-   u32 ByteCount:7;
-   u32 WriteEnable:1;  /* 0:read, 1:write */
-   u32 FixOrContinuous:1;  /* 0:continuous, 1: Fix */
-   u32 BurstMode:1;
-   u32 Byte1Access:1;
-   u32 Byte2Access:1;
-   u32 Byte4Access:1;
-   u32 Reserved3:3;
-   u32 Reserved4:16;
-   /* DW3 */
-   u32 BusAddress;
-   /* DW4 */
-   u32 Value;
-#else
-   /* DW1 */
-   u32 Reserved1:4;
-   u32 NumOfTrans:4;
-   u32 Reserved2:24;
-   /* DW2 */
-   u32 WriteEnable:1;
-   u32 ByteCount:7;
-   u32 Reserved3:3;
-   u32 Byte4Access:1;
-   u32 Byte2Access:1;
-   u32 Byte1Access:1;
-   u32 BurstMode:1;
-   u32 FixOrContinuous:1;
-   u32 Reserved4:16;
-   /* DW3 */
-   u32 BusAddress;
-   /* DW4 */
-   u32 Value;
-#endif
-};
-
 /*
 Below is the data structure used by _io_handler
 */
-- 
1.7.10.4

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


[PATCH 03/13] staging: rtl8188eu: Remove rtw_init_intf_priv()

2014-06-06 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c |   15 ---
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index f874270..a84ee97 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -52,16 +52,6 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
 
 MODULE_DEVICE_TABLE(usb, rtw_usb_id_tbl);
 
-static u8 rtw_init_intf_priv(struct dvobj_priv *dvobj)
-{
-   mutex_init(&dvobj->usb_vendor_req_mutex);
-   dvobj->usb_vendor_req_buf = rtw_zmalloc(MAX_USB_IO_CTL_SIZE);
-   if (!dvobj->usb_vendor_req_buf)
-   return _FAIL;
-
-   return _SUCCESS;
-}
-
 static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf)
 {
int i;
@@ -125,7 +115,10 @@ static struct dvobj_priv *usb_dvobj_init(struct 
usb_interface *usb_intf)
else
pdvobjpriv->ishighspeed = false;
 
-   if (rtw_init_intf_priv(pdvobjpriv) == _FAIL)
+   mutex_init(&pdvobjpriv->usb_vendor_req_mutex);
+   pdvobjpriv->usb_vendor_req_buf = rtw_zmalloc(MAX_USB_IO_CTL_SIZE);
+
+   if (!pdvobjpriv->usb_vendor_req_buf)
goto free_dvobj;
 
rtw_reset_continual_urb_error(pdvobjpriv);
-- 
1.7.10.4

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


[PATCH 07/13] staging: rtl8188eu: Remove unused function _rtw_write_mem()

2014-06-06 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/core/rtw_io.c  |   14 --
 drivers/staging/rtl8188eu/hal/usb_ops_linux.c|1 -
 drivers/staging/rtl8188eu/include/rtw_io.h   |5 -
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c |4 
 4 files changed, 24 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_io.c 
b/drivers/staging/rtl8188eu/core/rtw_io.c
index 934370e..292b6a1 100644
--- a/drivers/staging/rtl8188eu/core/rtw_io.c
+++ b/drivers/staging/rtl8188eu/core/rtw_io.c
@@ -177,20 +177,6 @@ int _rtw_write32_async(struct adapter *adapter, u32 addr, 
u32 val)
return RTW_STATUS_CODE(ret);
 }
 
-
-void _rtw_write_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
-{
-   void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 
*pmem);
-   struct io_priv *pio_priv = &adapter->iopriv;
-   struct  intf_hdl*pintfhdl = &(pio_priv->intf);
-
-
-   _write_mem = pintfhdl->io_ops._write_mem;
-
-   _write_mem(pintfhdl, addr, cnt, pmem);
-
-}
-
 void _rtw_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
 {
u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 
*pmem);
diff --git a/drivers/staging/rtl8188eu/hal/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/hal/usb_ops_linux.c
index c39dc0c..6a1be6e 100644
--- a/drivers/staging/rtl8188eu/hal/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/hal/usb_ops_linux.c
@@ -676,7 +676,6 @@ void rtl8188eu_set_intf_ops(struct _io_ops  *pops)
pops->_write16 = &usb_write16;
pops->_write32 = &usb_write32;
pops->_writeN = &usb_writeN;
-   pops->_write_mem = &usb_write_mem;
pops->_write_port = &usb_write_port;
pops->_read_port_cancel = &usb_read_port_cancel;
pops->_write_port_cancel = &usb_write_port_cancel;
diff --git a/drivers/staging/rtl8188eu/include/rtw_io.h 
b/drivers/staging/rtl8188eu/include/rtw_io.h
index 04338ee..958fc52 100644
--- a/drivers/staging/rtl8188eu/include/rtw_io.h
+++ b/drivers/staging/rtl8188eu/include/rtw_io.h
@@ -112,8 +112,6 @@ struct _io_ops {
int (*_write8_async)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
-   void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
-  u8 *pmem);
u32 (*_read_interrupt)(struct intf_hdl *pintfhdl, u32 addr);
u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
  u8 *pmem);
@@ -254,7 +252,6 @@ int _rtw_write8_async(struct adapter *adapter, u32 addr, u8 
val);
 int _rtw_write16_async(struct adapter *adapter, u32 addr, u16 val);
 int _rtw_write32_async(struct adapter *adapter, u32 addr, u32 val);
 
-void _rtw_write_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
 u32 _rtw_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
 u32 _rtw_write_port_and_wait(struct adapter *adapter, u32 addr, u32 cnt,
 u8 *pmem, int timeout_ms);
@@ -283,8 +280,6 @@ void _rtw_write_port_cancel(struct adapter *adapter);
_rtw_write16_async((adapter), (addr), (val))
 #define rtw_write32_async(adapter, addr, val)  \
_rtw_write32_async((adapter), (addr), (val))
-#define rtw_write_mem(adapter, addr, cnt, mem) \
-   _rtw_write_mem((adapter), (addr), (cnt), (mem))
 #define rtw_write_port(adapter, addr, cnt, mem)
\
_rtw_write_port((adapter), (addr), (cnt), (mem))
 #define rtw_write_port_and_wait(adapter, addr, cnt, mem, timeout_ms)   \
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index 27dd7cd..5bac414 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -39,10 +39,6 @@ unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 
addr)
return pipe;
 }
 
-void usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
-{
-}
-
 void usb_read_port_cancel(struct intf_hdl *pintfhdl)
 {
int i;
-- 
1.7.10.4

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


[PATCH 08/13] staging: rtl8188eu: Remove unused function declaration and macro

2014-06-06 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/include/rtw_io.h |3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_io.h 
b/drivers/staging/rtl8188eu/include/rtw_io.h
index 958fc52..e30b84b 100644
--- a/drivers/staging/rtl8188eu/include/rtw_io.h
+++ b/drivers/staging/rtl8188eu/include/rtw_io.h
@@ -239,7 +239,6 @@ struct io_priv {
 u8 _rtw_read8(struct adapter *adapter, u32 addr);
 u16 _rtw_read16(struct adapter *adapter, u32 addr);
 u32 _rtw_read32(struct adapter *adapter, u32 addr);
-void _rtw_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
 void _rtw_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
 void _rtw_read_port_cancel(struct adapter *adapter);
 
@@ -260,8 +259,6 @@ void _rtw_write_port_cancel(struct adapter *adapter);
 #define rtw_read8(adapter, addr) _rtw_read8((adapter), (addr))
 #define rtw_read16(adapter, addr) _rtw_read16((adapter), (addr))
 #define rtw_read32(adapter, addr) _rtw_read32((adapter), (addr))
-#define rtw_read_mem(adapter, addr, cnt, mem)  \
-   _rtw_read_mem((adapter), (addr), (cnt), (mem))
 #define rtw_read_port(adapter, addr, cnt, mem) \
_rtw_read_port((adapter), (addr), (cnt), (mem))
 #define rtw_read_port_cancel(adapter) _rtw_read_port_cancel((adapter))
-- 
1.7.10.4

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


[PATCH 10/13] staging: rtl8188eu: HalPhyRf_8188e.c: Remove unused macro

2014-06-06 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/hal/HalPhyRf_8188e.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/hal/HalPhyRf_8188e.c 
b/drivers/staging/rtl8188eu/hal/HalPhyRf_8188e.c
index fafb18c..5afaad2 100644
--- a/drivers/staging/rtl8188eu/hal/HalPhyRf_8188e.c
+++ b/drivers/staging/rtl8188eu/hal/HalPhyRf_8188e.c
@@ -489,7 +489,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
 
 /* 1 7.IQK */
 #define MAX_TOLERANCE  5
-#define IQK_DELAY_TIME 1   /* ms */
 
 static u8 /* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */
 phy_PathA_IQK_8188E(struct adapter *adapt, bool configPathB)
-- 
1.7.10.4

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


[PATCH 11/13] staging: rtl8188eu: HalPhyRf_8188e.c: Remove unnecessary comments

2014-06-06 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/hal/HalPhyRf_8188e.c |   37 
 1 file changed, 6 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/HalPhyRf_8188e.c 
b/drivers/staging/rtl8188eu/hal/HalPhyRf_8188e.c
index 5afaad2..c951616 100644
--- a/drivers/staging/rtl8188eu/hal/HalPhyRf_8188e.c
+++ b/drivers/staging/rtl8188eu/hal/HalPhyRf_8188e.c
@@ -1,5 +1,4 @@
-
-/**
+/*
  *
  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
  *
@@ -15,17 +14,13 @@
  * You should have received a copy of the GNU General Public License along with
  * this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- 
**/
+ */
 
 #include "odm_precomp.h"
 
-/*---Define Local Constant---*/
 /*  2010/04/25 MH Define the max tx power tracking tx agc power. */
 #defineODM_TXPWRTRACK_MAX_IDX_88E  6
 
-/*---Define Local Constant---*/
 
 u8 ODM_GetRightChnlPlaceforIQK(u8 chnl)
 {
@@ -47,27 +42,19 @@ u8 ODM_GetRightChnlPlaceforIQK(u8 chnl)
return 0;
 }
 
-/* 3 */
 /* 3 Tx Power Tracking */
-/* 3 */
-/*-
+/*
  * Function:   ODM_TxPwrTrackAdjust88E()
  *
  * Overview:   88E we can not write 0xc80/c94/c4c/ 0xa2x. Instead of write TX 
agc.
  * No matter OFDM & CCK use the same method.
  *
- * Input:  NONE
- *
- * Output: NONE
- *
- * Return: NONE
- *
  * Revised History:
  * WhenWho Remark
  * 04/23/2012  MHC Create Version 0.
  * 04/23/2012  MHC Adjust TX agc directly not throughput 
BB digital.
  *
- *---*/
+ */
 void ODM_TxPwrTrackAdjust88E(struct odm_dm_struct *dm_odm, u8 Type,/*  0 = 
OFDM, 1 = CCK */
u8 *pDirection, /*  1 = +(increase) 2 = -(decrease) */
u32 *pOutWriteVal   /*  Tx tracking CCK/OFDM BB swing index 
adjust */
@@ -116,23 +103,12 @@ void ODM_TxPwrTrackAdjust88E(struct odm_dm_struct 
*dm_odm, u8 Type,/*  0 = OFDM,
*pOutWriteVal = pwr_value | (pwr_value<<8) | (pwr_value<<16) | 
(pwr_value<<24);
 }  /*  ODM_TxPwrTrackAdjust88E */
 
-/*-
+/*
  * Function:   odm_TxPwrTrackSetPwr88E()
  *
  * Overview:   88E change all channel tx power accordign to flag.
  * OFDM & CCK are all different.
- *
- * Input:  NONE
- *
- * Output: NONE
- *
- * Return: NONE
- *
- * Revised History:
- * WhenWho Remark
- * 04/23/2012  MHC Create Version 0.
- *
- *---*/
+ */
 static void odm_TxPwrTrackSetPwr88E(struct odm_dm_struct *dm_odm)
 {
if (dm_odm->BbSwingFlagOfdm || dm_odm->BbSwingFlagCck) {
@@ -143,7 +119,6 @@ static void odm_TxPwrTrackSetPwr88E(struct odm_dm_struct 
*dm_odm)
}
 }  /*  odm_TxPwrTrackSetPwr88E */
 
-/* 091212 chiyokolin */
 void
 odm_TXPowerTrackingCallback_ThermalMeter_8188E(
struct adapter *Adapter
-- 
1.7.10.4

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


[PATCH] staging: rtl8188eu: os_dep: usb_intf.c: Cleaning up unnecessary code

2014-06-06 Thread navin patidar
From: Rickard Strandqvist 

Removes unnecessary code that does not do anything useful.

This was partly found using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c |8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index 2e49cd5..fb3789e 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -563,14 +563,8 @@ static int rtw_resume(struct usb_interface *pusb_intf)
 {
struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf);
struct adapter *padapter = dvobj->if1;
-   struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
-int ret = 0;
 
-   if (pwrpriv->bInternalAutoSuspend)
-   ret = rtw_resume_process(padapter);
-   else
-   ret = rtw_resume_process(padapter);
-   return ret;
+   return rtw_resume_process(padapter);
 }
 
 int rtw_resume_process(struct adapter *padapter)
-- 
1.7.10.4
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 1/4] dma-mapping: Add devm_ interface for dma_map_single()

2014-06-06 Thread Eli Billauer

On 06/06/14 19:01, Greg KH wrote:

Please try to put yourself in my position: I have a driver that I care
>  about, which works fine for a few years. It's based upon dma_map_single(),
>  which seems to be the common way to get non-coherent memory, even for the
>  driver's entire lifespan. I realize that dma_alloc_* was the intended way to
>  do it, but fact is that dma_map_* has become the common choice.


Is your driver in the kernel tree?  If not, you really are on your own :(

It's the Xillybus driver in the staging area. I don't know if this 
counts for being in the kernel tree...


The suggested patchset would allow replacing my use of dma_map_single() 
with a managed version of that function. This will clean the driver's 
code considerably.


But I think that the discussion here is if it's valid to use 
dma_map_single() for a device-permanent DMA mapping, or if 
dma_alloc_noncoherent() is the only way. If the answer is no, there's 
quite obviously no point in a devres version for that function.


Regards,
   Eli

greg k-h





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


[PATCH 06/13] staging: rtl8188eu: Remove unused funtion _rtw_read_mem()

2014-06-06 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/core/rtw_io.c  |   15 ---
 drivers/staging/rtl8188eu/hal/usb_ops_linux.c|1 -
 drivers/staging/rtl8188eu/include/rtw_io.h   |2 --
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c |4 
 4 files changed, 22 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_io.c 
b/drivers/staging/rtl8188eu/core/rtw_io.c
index 7530532..934370e 100644
--- a/drivers/staging/rtl8188eu/core/rtw_io.c
+++ b/drivers/staging/rtl8188eu/core/rtw_io.c
@@ -177,21 +177,6 @@ int _rtw_write32_async(struct adapter *adapter, u32 addr, 
u32 val)
return RTW_STATUS_CODE(ret);
 }
 
-void _rtw_read_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
-{
-   void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 
*pmem);
-   struct io_priv *pio_priv = &adapter->iopriv;
-   struct  intf_hdl*pintfhdl = &(pio_priv->intf);
-
-   if (adapter->bDriverStopped || adapter->bSurpriseRemoved) {
-   RT_TRACE(_module_rtl871x_io_c_, _drv_info_,
-("rtw_read_mem:bDriverStopped(%d) OR 
bSurpriseRemoved(%d)",
-adapter->bDriverStopped, adapter->bSurpriseRemoved));
-return;
-   }
-   _read_mem = pintfhdl->io_ops._read_mem;
-   _read_mem(pintfhdl, addr, cnt, pmem);
-}
 
 void _rtw_write_mem(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
 {
diff --git a/drivers/staging/rtl8188eu/hal/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/hal/usb_ops_linux.c
index 3aadf56..c39dc0c 100644
--- a/drivers/staging/rtl8188eu/hal/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/hal/usb_ops_linux.c
@@ -671,7 +671,6 @@ void rtl8188eu_set_intf_ops(struct _io_ops  *pops)
pops->_read8 = &usb_read8;
pops->_read16 = &usb_read16;
pops->_read32 = &usb_read32;
-   pops->_read_mem = &usb_read_mem;
pops->_read_port = &usb_read_port;
pops->_write8 = &usb_write8;
pops->_write16 = &usb_write16;
diff --git a/drivers/staging/rtl8188eu/include/rtw_io.h 
b/drivers/staging/rtl8188eu/include/rtw_io.h
index e8790f8..04338ee 100644
--- a/drivers/staging/rtl8188eu/include/rtw_io.h
+++ b/drivers/staging/rtl8188eu/include/rtw_io.h
@@ -112,8 +112,6 @@ struct _io_ops {
int (*_write8_async)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
-   void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
- u8 *pmem);
void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
   u8 *pmem);
u32 (*_read_interrupt)(struct intf_hdl *pintfhdl, u32 addr);
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index 0b5fbb9..27dd7cd 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -39,10 +39,6 @@ unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 
addr)
return pipe;
 }
 
-void usb_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
-{
-}
-
 void usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
 {
 }
-- 
1.7.10.4

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


Re: [PATCH] staging: rtl8188eu: os_dep: usb_intf.c: Cleaning up unnecessary code

2014-06-06 Thread navin patidar
sorry,  my script picked up Rickard's patch and send it out again
along my patches.
I need to fix my script.

regards,
navin patidar

On Fri, Jun 6, 2014 at 9:45 PM, navin patidar  wrote:
> From: Rickard Strandqvist 
>
> Removes unnecessary code that does not do anything useful.
>
> This was partly found using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist 
> ---
>  drivers/staging/rtl8188eu/os_dep/usb_intf.c |8 +---
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
> b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
> index 2e49cd5..fb3789e 100644
> --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
> +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
> @@ -563,14 +563,8 @@ static int rtw_resume(struct usb_interface *pusb_intf)
>  {
> struct dvobj_priv *dvobj = usb_get_intfdata(pusb_intf);
> struct adapter *padapter = dvobj->if1;
> -   struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
> -int ret = 0;
>
> -   if (pwrpriv->bInternalAutoSuspend)
> -   ret = rtw_resume_process(padapter);
> -   else
> -   ret = rtw_resume_process(padapter);
> -   return ret;
> +   return rtw_resume_process(padapter);
>  }
>
>  int rtw_resume_process(struct adapter *padapter)
> --
> 1.7.10.4
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 1/4] dma-mapping: Add devm_ interface for dma_map_single()

2014-06-06 Thread Shuah Khan

On 06/06/2014 10:21 AM, Eli Billauer wrote:

On 06/06/14 19:01, Greg KH wrote:

Please try to put yourself in my position: I have a driver that I care
>  about, which works fine for a few years. It's based upon
dma_map_single(),
>  which seems to be the common way to get non-coherent memory, even
for the
>  driver's entire lifespan. I realize that dma_alloc_* was the
intended way to
>  do it, but fact is that dma_map_* has become the common choice.


Is your driver in the kernel tree?  If not, you really are on your own :(


It's the Xillybus driver in the staging area. I don't know if this
counts for being in the kernel tree...

The suggested patchset would allow replacing my use of dma_map_single()
with a managed version of that function. This will clean the driver's
code considerably.

But I think that the discussion here is if it's valid to use
dma_map_single() for a device-permanent DMA mapping, or if
dma_alloc_noncoherent() is the only way. If the answer is no, there's
quite obviously no point in a devres version for that function.



Eli,

dma_map_single() and dma_unmap_single() are streaming DMA APIs. These
are intended for one DMA transfer and unmapped right after it is done.

dma buffers are limited shared resources for streaming that are
shared by several drivers. Hence the need for use and release
model.

Please refer to the Using Streaming DMA mappings in DMA-API-HOWTO.txt

"- Streaming DMA mappings which are usually mapped for one DMA
  transfer, unmapped right after it (unless you use dma_sync_* below)
  and for which hardware can optimize for sequential accesses.

  This of "streaming" as "asynchronous" or "outside the coherency
  domain".

  Good examples of what to use streaming mappings for are:

- Networking buffers transmitted/received by a device.
- Filesystem buffers written/read by a SCSI device."


If I understand your intended usage correctly, you are looking to
allocate and hold the buffers for the lifetime of the driver. For
such cases, dma_alloc_*() interfaces are the ones to use.

Please also refer to DMA-API.txt as well. Hope this helps.

-- Shuah


--
Shuah Khan
Senior Linux Kernel Developer - Open Source Group
Samsung Research America(Silicon Valley)
shuah...@samsung.com | (970) 672-0658
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 12/13] staging: rtl8188eu: rtw_io.h: Remove unused macros

2014-06-06 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/include/rtw_io.h |   57 
 1 file changed, 57 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_io.h 
b/drivers/staging/rtl8188eu/include/rtw_io.h
index e56c52b..9c6384b 100644
--- a/drivers/staging/rtl8188eu/include/rtw_io.h
+++ b/drivers/staging/rtl8188eu/include/rtw_io.h
@@ -39,63 +39,6 @@
 #define rtw_usb_buffer_free(dev, size, addr, dma)  \
usb_free_coherent((dev), (size), (addr), (dma))

-#define NUM_IOREQ  8
-
-#define MAX_PROT_SZ(64-16)
-
-#define _IOREADY   0
-#define _IO_WAIT_COMPLETE  1
-#define _IO_WAIT_RSP   2
-
-/*  IO COMMAND TYPE */
-#define _IOSZ_MASK_(0x7F)
-#define _IO_WRITE_ BIT(7)
-#define _IO_FIXED_ BIT(8)
-#define _IO_BURST_ BIT(9)
-#define _IO_BYTE_  BIT(10)
-#define _IO_HW_BIT(11)
-#define _IO_WORD_  BIT(12)
-#define _IO_SYNC_  BIT(13)
-#define _IO_CMDMASK_   (0x1F80)
-
-/*
-   For prompt mode accessing, caller shall free io_req
-   Otherwise, io_handler will free io_req
-*/
-
-/*  IO STATUS TYPE */
-#define _IO_ERR_   BIT(2)
-#define _IO_SUCCESS_   BIT(1)
-#define _IO_DONE_  BIT(0)
-
-#define IO_RD32(_IO_SYNC_ | _IO_WORD_)
-#define IO_RD16(_IO_SYNC_ | _IO_HW_)
-#define IO_RD8 (_IO_SYNC_ | _IO_BYTE_)
-
-#define IO_RD32_ASYNC  (_IO_WORD_)
-#define IO_RD16_ASYNC  (_IO_HW_)
-#define IO_RD8_ASYNC   (_IO_BYTE_)
-
-#define IO_WR32(_IO_WRITE_ | _IO_SYNC_ | _IO_WORD_)
-#define IO_WR16(_IO_WRITE_ | _IO_SYNC_ | _IO_HW_)
-#define IO_WR8 (_IO_WRITE_ | _IO_SYNC_ | _IO_BYTE_)
-
-#define IO_WR32_ASYNC  (_IO_WRITE_ | _IO_WORD_)
-#define IO_WR16_ASYNC  (_IO_WRITE_ | _IO_HW_)
-#define IO_WR8_ASYNC   (_IO_WRITE_ | _IO_BYTE_)
-
-/*
-   Only Sync. burst accessing is provided.
-*/
-
-#define IO_WR_BURST(x) \
-   (_IO_WRITE_ | _IO_SYNC_ | _IO_BURST_ | ((x) & _IOSZ_MASK_))
-#define IO_RD_BURST(x) \
-   (_IO_SYNC_ | _IO_BURST_ | ((x) & _IOSZ_MASK_))
-
-/* below is for the intf_option bit defition... */
-
-#define _INTF_ASYNC_   BIT(0)  /* support async io */

 struct intf_priv;
 struct intf_hdl;
--
1.7.10.4

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


Re: [PATCH 1/1] [SCSI] Fix a bug in deriving the FLUSH_TIMEOUT from the basic I/O timeout

2014-06-06 Thread Mike Christie

On 6/5/14, 9:53 PM, KY Srinivasan wrote:




-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu]
Sent: Thursday, June 5, 2014 6:33 PM
To: KY Srinivasan
Cc: James Bottomley; linux-ker...@vger.kernel.org; a...@canonical.com;
de...@linuxdriverproject.org; h...@infradead.org; linux-
s...@vger.kernel.org; oher...@suse.com; gre...@linuxfoundation.org;
jasow...@redhat.com
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving the FLUSH_TIMEOUT
from the basic I/O timeout

On 06/04/2014 12:15 PM, KY Srinivasan wrote:




-Original Message-
From: James Bottomley [mailto:jbottom...@parallels.com]
Sent: Wednesday, June 4, 2014 10:02 AM
To: KY Srinivasan
Cc: linux-ker...@vger.kernel.org; a...@canonical.com;
de...@linuxdriverproject.org; h...@infradead.org; linux-
s...@vger.kernel.org; oher...@suse.com; gre...@linuxfoundation.org;
jasow...@redhat.com
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving the
FLUSH_TIMEOUT from the basic I/O timeout

On Wed, 2014-06-04 at 09:33 -0700, K. Y. Srinivasan wrote:

Commit ID: 7e660100d85af860e7ad763202fff717adcdaacd added code to
derive the FLUSH_TIMEOUT from the basic I/O timeout. However, this
patch did not use the basic I/O timeout of the device. Fix this bug.

Signed-off-by: K. Y. Srinivasan 
---
  drivers/scsi/sd.c |4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index
e9689d5..54150b1 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -832,7 +832,9 @@ static int sd_setup_write_same_cmnd(struct
scsi_device *sdp, struct request *rq)

  static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct
request *rq)  {
-   rq->timeout *= SD_FLUSH_TIMEOUT_MULTIPLIER;
+   int timeout = sdp->request_queue->rq_timeout;
+
+   rq->timeout = (timeout * SD_FLUSH_TIMEOUT_MULTIPLIER);


Could you share where you found this to be a problem?  It looks like
a bug in block because all inbound requests being prepared should
have a timeout set, so block would be the place to fix it.


Perhaps; what I found was that the value in rq->timeout was 0 coming
into this function and thus multiplying obviously has no effect.



I think you are right. We hit this problem because we are doing:

scsi_request_fn -> blk_peek_request -> sd_prep_fn ->
scsi_setup_flush_cmnd.

At this time request->timeout is zero so the multiplication does nothing. See
how sd_setup_write_same_cmnd will set the request->timeout at this time.

Then in scsi_request_fn we do:

scsi_request_fn -> blk_start_request -> blk_add_timer.

At this time it will set the request->timeout if something like req block pc
users (like scsi_execute() or block/scsi_ioctl.c) or the write same code
mentioned above have not set the timeout.


I don't think this is a recent change. Prior to this commit, we were setting 
the timeout
value in this function; it just happened to be a different constant unrelated 
to the I/O
timeout.



Yeah, it looks like when 7e660100d85af860e7ad763202fff717adcdaacd was 
merged we were supposed to initialize it like in your patch in this thread.


I guess we could do your patch in this thread, or if we want the block 
layer to initialize the timeout before the prep_fn callout is called 
then we would need to have the blk-flush.c code to that when it sets up 
the request. If we do the latter, do we want the discard and write same 
code to initialize the request's timeout before the prep_fn callout is 
called too?


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


Re: [PATCH] list: Fix order of arguments for hlist_add_after(_rcu)

2014-06-06 Thread Paul E. McKenney
On Fri, Jun 06, 2014 at 03:56:52PM +, David Laight wrote:
> From: Behalf Of Ken Helias
> > All other add functions for lists have the new item as first argument and 
> > the
> > position where it is added as second argument. This was changed for no good
> > reason in this function and makes using it unnecessary confusing.
> > 
> > Also the naming of the arguments in hlist_add_after was confusing. It was
> > changed to use the same names as hlist_add_after_rcu.
> ...
> > -static inline void hlist_add_after_rcu(struct hlist_node *prev,
> > -  struct hlist_node *n)
> > +static inline void hlist_add_after_rcu(struct hlist_node *n,
> > +  struct hlist_node *prev)
> 
> It is rather a shame that the change doesn't generate a compilation
> error for old source files.

I am also a bit concerned by this.

Thanx, Paul

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


[PATCH 01/13] staging: rtl8188eu: usb_halinit.c: Remove ReadAdapterInfo8188EU()

2014-06-06 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/hal/usb_halinit.c |   11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index e60b5e9..316c821 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -1187,7 +1187,7 @@ static void _ReadRFType(struct adapter *Adapter)
haldata->rf_chip = RF_6052;
 }

-static int _ReadAdapterInfo8188EU(struct adapter *Adapter)
+static void _ReadAdapterInfo8188EU(struct adapter *Adapter)
 {
u32 start = jiffies;

@@ -1197,13 +1197,6 @@ static int _ReadAdapterInfo8188EU(struct adapter 
*Adapter)
_ReadPROMContent(Adapter);

MSG_88E("< %s in %d ms\n", __func__, 
rtw_get_passing_time_ms(start));
-
-   return _SUCCESS;
-}
-
-static void ReadAdapterInfo8188EU(struct adapter *Adapter)
-{
-   _ReadAdapterInfo8188EU(Adapter);
 }

 #define GPIO_DEBUG_PORT_NUM 0
@@ -2249,7 +2242,7 @@ void rtl8188eu_set_hal_ops(struct adapter *adapt)

halfunc->init_default_value = &rtl8188eu_init_default_value;
halfunc->intf_chip_configure = &rtl8188eu_interface_configure;
-   halfunc->read_adapter_info = &ReadAdapterInfo8188EU;
+   halfunc->read_adapter_info = &_ReadAdapterInfo8188EU;

halfunc->SetHwRegHandler = &SetHwReg8188EU;
halfunc->GetHwRegHandler = &GetHwReg8188EU;
--
1.7.10.4

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


[PATCHv2 02/13] list: Fix order of arguments for hlist_add_after(_rcu)

2014-06-06 Thread Ken Helias
From: Ken Helias 

All other add functions for lists have the new item as first argument and the
position where it is added as second argument. This was changed for no good
reason in this function and makes using it unnecessary confusing.

Signed-off-by: Ken Helias 
Cc: Linux NICS 
Cc: "Paul E. McKenney" 
Cc: dri-de...@lists.freedesktop.org
Cc: e1000-de...@lists.sourceforge.net
Cc: net...@vger.kernel.org
Cc: de...@driverdev.osuosl.org
Cc: linux-fsde...@vger.kernel.org
Cc: b.a.t.m@lists.open-mesh.org
Cc: bri...@lists.linux-foundation.org
---
Patch based on "Add linux-next specific files for 20140606"

v2:
Splitted into two patches
reduced number of Cc

 drivers/gpu/drm/drm_hashtab.c| 2 +-
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c   | 2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 2 +-
 drivers/staging/lustre/lustre/libcfs/hash.c  | 4 ++--
 fs/namespace.c   | 2 +-
 fs/notify/inode_mark.c   | 2 +-
 fs/notify/vfsmount_mark.c| 2 +-
 include/linux/list.h | 4 ++--
 include/linux/rculist.h  | 6 +++---
 net/batman-adv/fragmentation.c   | 2 +-
 net/bridge/br_multicast.c| 2 +-
 net/ipv4/fib_trie.c  | 2 +-
 net/ipv6/addrlabel.c | 2 +-
 net/xfrm/xfrm_policy.c   | 4 ++--
 14 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/drm_hashtab.c b/drivers/gpu/drm/drm_hashtab.c
index 7e4bae7..4077a35 100644
--- a/drivers/gpu/drm/drm_hashtab.c
+++ b/drivers/gpu/drm/drm_hashtab.c
@@ -125,7 +125,7 @@ int drm_ht_insert_item(struct drm_open_hash *ht, struct 
drm_hash_item *item)
parent = &entry->head;
}
if (parent) {
-   hlist_add_after_rcu(parent, &item->head);
+   hlist_add_after_rcu(&item->head, parent);
} else {
hlist_add_head_rcu(&item->head, h_list);
}
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c 
b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 1bb470b..db0a7e1 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -1437,7 +1437,7 @@ static int i40e_update_ethtool_fdir_entry(struct i40e_vsi 
*vsi,
 
/* add filter to the list */
if (parent)
-   hlist_add_after(&parent->fdir_node, &input->fdir_node);
+   hlist_add_after(&input->fdir_node, &parent->fdir_node);
else
hlist_add_head(&input->fdir_node,
   &pf->fdir_filter_list);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index 23e4e6a..23f4ff3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -2518,7 +2518,7 @@ static int ixgbe_update_ethtool_fdir_entry(struct 
ixgbe_adapter *adapter,
 
/* add filter to the list */
if (parent)
-   hlist_add_after(&parent->fdir_node, &input->fdir_node);
+   hlist_add_after(&input->fdir_node, &parent->fdir_node);
else
hlist_add_head(&input->fdir_node,
   &adapter->fdir_filter_list);
diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c 
b/drivers/staging/lustre/lustre/libcfs/hash.c
index 6d2b455..35835e5 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -351,7 +351,7 @@ cfs_hash_dh_hnode_add(struct cfs_hash *hs, struct 
cfs_hash_bd *bd,
cfs_hash_dhead_t, dh_head);
 
if (dh->dh_tail != NULL) /* not empty */
-   hlist_add_after(dh->dh_tail, hnode);
+   hlist_add_after(hnode, dh->dh_tail);
else /* empty list */
hlist_add_head(hnode, &dh->dh_head);
dh->dh_tail = hnode;
@@ -406,7 +406,7 @@ cfs_hash_dd_hnode_add(struct cfs_hash *hs, struct 
cfs_hash_bd *bd,
cfs_hash_dhead_dep_t, dd_head);
 
if (dh->dd_tail != NULL) /* not empty */
-   hlist_add_after(dh->dd_tail, hnode);
+   hlist_add_after(hnode, dh->dd_tail);
else /* empty list */
hlist_add_head(hnode, &dh->dd_head);
dh->dd_tail = hnode;
diff --git a/fs/namespace.c b/fs/namespace.c
index b10db3d..14b751f 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -845,7 +845,7 @@ static void commit_tree(struct mount *mnt, struct mount 
*shadows)
list_splice(&head, n->list.prev);
 
if (shadows)
-   hlist_add_after

[PATCH 13/13] staging: tidspbridge: Use list_add_(before|after) macros

2014-06-06 Thread Ken Helias
From: Ken Helias 

Many places in the code uses list_add_tail/list_add to insert an entry
before/after another entry. This confuses the reader because these are usually
used to add an item to a list_head and not an entry. Better use the self
explaining function name.

Signed-off-by: Ken Helias 
Cc: de...@driverdev.osuosl.org
---
 drivers/staging/tidspbridge/rmgr/rmm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/tidspbridge/rmgr/rmm.c 
b/drivers/staging/tidspbridge/rmgr/rmm.c
index 52187bd..7e1ba84 100644
--- a/drivers/staging/tidspbridge/rmgr/rmm.c
+++ b/drivers/staging/tidspbridge/rmgr/rmm.c
@@ -139,7 +139,7 @@ int rmm_alloc(struct rmm_target_obj *target, u32 segid, u32 
size,
&target->ovly_list);
else
/* Put new section just before sect */
-   list_add_tail(&new_sect->list_elem,
+   list_add_before(&new_sect->list_elem,
§->list_elem);
}
}
-- 
2.0.0

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


[PATCH 13/13] staging: rtl8188eu: rtw_io.h: Remove unused members from struct _io_ops

2014-06-06 Thread navin patidar

Signed-off-by: navin patidar 
---
 drivers/staging/rtl8188eu/include/rtw_io.h |2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_io.h 
b/drivers/staging/rtl8188eu/include/rtw_io.h
index 9c6384b..bc36129 100644
--- a/drivers/staging/rtl8188eu/include/rtw_io.h
+++ b/drivers/staging/rtl8188eu/include/rtw_io.h
@@ -55,12 +55,10 @@ struct _io_ops {
int (*_write8_async)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
-   u32 (*_read_interrupt)(struct intf_hdl *pintfhdl, u32 addr);
u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
  u8 *pmem);
u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
   u8 *pmem);
-   u32 (*_write_scsi)(struct intf_hdl *pintfhdl, u32 cnt, u8 *pmem);
void (*_read_port_cancel)(struct intf_hdl *pintfhdl);
void (*_write_port_cancel)(struct intf_hdl *pintfhdl);
 };
--
1.7.10.4

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


Re: [PATCH 1/1] [SCSI] Fix a bug in deriving the FLUSH_TIMEOUT from the basic I/O timeout

2014-06-06 Thread James Bottomley
On Fri, 2014-06-06 at 12:18 -0500, Mike Christie wrote:
> On 6/5/14, 9:53 PM, KY Srinivasan wrote:
> >
> >
> >> -Original Message-
> >> From: Mike Christie [mailto:micha...@cs.wisc.edu]
> >> Sent: Thursday, June 5, 2014 6:33 PM
> >> To: KY Srinivasan
> >> Cc: James Bottomley; linux-ker...@vger.kernel.org; a...@canonical.com;
> >> de...@linuxdriverproject.org; h...@infradead.org; linux-
> >> s...@vger.kernel.org; oher...@suse.com; gre...@linuxfoundation.org;
> >> jasow...@redhat.com
> >> Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving the FLUSH_TIMEOUT
> >> from the basic I/O timeout
> >>
> >> On 06/04/2014 12:15 PM, KY Srinivasan wrote:
> >>>
> >>>
>  -Original Message-
>  From: James Bottomley [mailto:jbottom...@parallels.com]
>  Sent: Wednesday, June 4, 2014 10:02 AM
>  To: KY Srinivasan
>  Cc: linux-ker...@vger.kernel.org; a...@canonical.com;
>  de...@linuxdriverproject.org; h...@infradead.org; linux-
>  s...@vger.kernel.org; oher...@suse.com; gre...@linuxfoundation.org;
>  jasow...@redhat.com
>  Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving the
>  FLUSH_TIMEOUT from the basic I/O timeout
> 
>  On Wed, 2014-06-04 at 09:33 -0700, K. Y. Srinivasan wrote:
> > Commit ID: 7e660100d85af860e7ad763202fff717adcdaacd added code to
> > derive the FLUSH_TIMEOUT from the basic I/O timeout. However, this
> > patch did not use the basic I/O timeout of the device. Fix this bug.
> >
> > Signed-off-by: K. Y. Srinivasan 
> > ---
> >   drivers/scsi/sd.c |4 +++-
> >   1 files changed, 3 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index
> > e9689d5..54150b1 100644
> > --- a/drivers/scsi/sd.c
> > +++ b/drivers/scsi/sd.c
> > @@ -832,7 +832,9 @@ static int sd_setup_write_same_cmnd(struct
> > scsi_device *sdp, struct request *rq)
> >
> >   static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct
> > request *rq)  {
> > -   rq->timeout *= SD_FLUSH_TIMEOUT_MULTIPLIER;
> > +   int timeout = sdp->request_queue->rq_timeout;
> > +
> > +   rq->timeout = (timeout * SD_FLUSH_TIMEOUT_MULTIPLIER);
> 
>  Could you share where you found this to be a problem?  It looks like
>  a bug in block because all inbound requests being prepared should
>  have a timeout set, so block would be the place to fix it.
> >>>
> >>> Perhaps; what I found was that the value in rq->timeout was 0 coming
> >>> into this function and thus multiplying obviously has no effect.
> >>>
> >>
> >> I think you are right. We hit this problem because we are doing:
> >>
> >> scsi_request_fn -> blk_peek_request -> sd_prep_fn ->
> >> scsi_setup_flush_cmnd.
> >>
> >> At this time request->timeout is zero so the multiplication does nothing. 
> >> See
> >> how sd_setup_write_same_cmnd will set the request->timeout at this time.
> >>
> >> Then in scsi_request_fn we do:
> >>
> >> scsi_request_fn -> blk_start_request -> blk_add_timer.
> >>
> >> At this time it will set the request->timeout if something like req block 
> >> pc
> >> users (like scsi_execute() or block/scsi_ioctl.c) or the write same code
> >> mentioned above have not set the timeout.
> >
> > I don't think this is a recent change. Prior to this commit, we were 
> > setting the timeout
> > value in this function; it just happened to be a different constant 
> > unrelated to the I/O
> > timeout.
> >
> 
> Yeah, it looks like when 7e660100d85af860e7ad763202fff717adcdaacd was 
> merged we were supposed to initialize it like in your patch in this thread.
> 
> I guess we could do your patch in this thread, or if we want the block 
> layer to initialize the timeout before the prep_fn callout is called 
> then we would need to have the blk-flush.c code to that when it sets up 
> the request. If we do the latter, do we want the discard and write same 
> code to initialize the request's timeout before the prep_fn callout is 
> called too?

I looked through the call chain; it seems to be intentional behaviour on
the part of block.  Just from an mq point of view, it would make better
code if we unconditionally initialised rq->timeout early and allowed
prep to modify it and then dumped the if(!req->timeout) in
blk_add_timer(), but it's a marginal if condition that would compile to
a conditional store on sensible architectures, so losing the conditional
probably isn't worth worrying about.

Cc'd Jens for his opinion with the block patch

James

---

diff --git a/block/blk-core.c b/block/blk-core.c
index a0e3096..cad6b2a 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -111,6 +111,7 @@ void blk_rq_init(struct request_queue *q, struct request 
*rq)
rq->cmd = rq->__cmd;
rq->cmd_len = BLK_MAX_CDB;
rq->tag = -1;
+   rq->timeout = q->rq_timeout;
rq->start_time = jiffies;
set_start_time_ns(rq);
rq->part = NULL;
diff --git a/block/blk-time

[PATCH] drivers/staging/bcm: Added a space after a comma.

2014-06-06 Thread Chuong Ngo
Signed-off-by: Chuong Ngo 
---
 drivers/staging/bcm/CmHost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c
index fb1d932..3dbdf0e 100644
--- a/drivers/staging/bcm/CmHost.c
+++ b/drivers/staging/bcm/CmHost.c
@@ -1418,7 +1418,7 @@ static inline ULONG RestoreSFParam(struct 
bcm_mini_adapter *Adapter,
ulAddrSFParamSet = ntohl(ulAddrSFParamSet);
 
/* Read out the SF Param Set At the indicated Location */
-   if (rdm(Adapter, ulAddrSFParamSet,(PUCHAR)pucDestBuffer, nBytesToRead) 
< 0)
+   if (rdm(Adapter, ulAddrSFParamSet, (PUCHAR)pucDestBuffer, nBytesToRead) 
< 0)
return STATUS_FAILURE;
 
return 1;
-- 
2.0.0

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


Re: [PATCH 1/1] [SCSI] Fix a bug in deriving the FLUSH_TIMEOUT from the basic I/O timeout

2014-06-06 Thread Jens Axboe

On 2014-06-06 11:52, James Bottomley wrote:

On Fri, 2014-06-06 at 12:18 -0500, Mike Christie wrote:

On 6/5/14, 9:53 PM, KY Srinivasan wrote:




-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu]
Sent: Thursday, June 5, 2014 6:33 PM
To: KY Srinivasan
Cc: James Bottomley; linux-ker...@vger.kernel.org; a...@canonical.com;
de...@linuxdriverproject.org; h...@infradead.org; linux-
s...@vger.kernel.org; oher...@suse.com; gre...@linuxfoundation.org;
jasow...@redhat.com
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving the FLUSH_TIMEOUT
from the basic I/O timeout

On 06/04/2014 12:15 PM, KY Srinivasan wrote:




-Original Message-
From: James Bottomley [mailto:jbottom...@parallels.com]
Sent: Wednesday, June 4, 2014 10:02 AM
To: KY Srinivasan
Cc: linux-ker...@vger.kernel.org; a...@canonical.com;
de...@linuxdriverproject.org; h...@infradead.org; linux-
s...@vger.kernel.org; oher...@suse.com; gre...@linuxfoundation.org;
jasow...@redhat.com
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving the
FLUSH_TIMEOUT from the basic I/O timeout

On Wed, 2014-06-04 at 09:33 -0700, K. Y. Srinivasan wrote:

Commit ID: 7e660100d85af860e7ad763202fff717adcdaacd added code to
derive the FLUSH_TIMEOUT from the basic I/O timeout. However, this
patch did not use the basic I/O timeout of the device. Fix this bug.

Signed-off-by: K. Y. Srinivasan 
---
   drivers/scsi/sd.c |4 +++-
   1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index
e9689d5..54150b1 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -832,7 +832,9 @@ static int sd_setup_write_same_cmnd(struct
scsi_device *sdp, struct request *rq)

   static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct
request *rq)  {
-   rq->timeout *= SD_FLUSH_TIMEOUT_MULTIPLIER;
+   int timeout = sdp->request_queue->rq_timeout;
+
+   rq->timeout = (timeout * SD_FLUSH_TIMEOUT_MULTIPLIER);


Could you share where you found this to be a problem?  It looks like
a bug in block because all inbound requests being prepared should
have a timeout set, so block would be the place to fix it.


Perhaps; what I found was that the value in rq->timeout was 0 coming
into this function and thus multiplying obviously has no effect.



I think you are right. We hit this problem because we are doing:

scsi_request_fn -> blk_peek_request -> sd_prep_fn ->
scsi_setup_flush_cmnd.

At this time request->timeout is zero so the multiplication does nothing. See
how sd_setup_write_same_cmnd will set the request->timeout at this time.

Then in scsi_request_fn we do:

scsi_request_fn -> blk_start_request -> blk_add_timer.

At this time it will set the request->timeout if something like req block pc
users (like scsi_execute() or block/scsi_ioctl.c) or the write same code
mentioned above have not set the timeout.


I don't think this is a recent change. Prior to this commit, we were setting 
the timeout
value in this function; it just happened to be a different constant unrelated 
to the I/O
timeout.



Yeah, it looks like when 7e660100d85af860e7ad763202fff717adcdaacd was
merged we were supposed to initialize it like in your patch in this thread.

I guess we could do your patch in this thread, or if we want the block
layer to initialize the timeout before the prep_fn callout is called
then we would need to have the blk-flush.c code to that when it sets up
the request. If we do the latter, do we want the discard and write same
code to initialize the request's timeout before the prep_fn callout is
called too?


I looked through the call chain; it seems to be intentional behaviour on
the part of block.  Just from an mq point of view, it would make better
code if we unconditionally initialised rq->timeout early and allowed
prep to modify it and then dumped the if(!req->timeout) in
blk_add_timer(), but it's a marginal if condition that would compile to
a conditional store on sensible architectures, so losing the conditional
probably isn't worth worrying about.

Cc'd Jens for his opinion with the block patch


I just committed this one earlier today:

http://git.kernel.dk/?p=linux-block.git;a=commit;h=f6be4fb4bcb396fc3b1c134b7863351972de081f

since I ran into the same thing on nvme. Either approach is fine with 
me, as they both allow override of the timeout before insertion. But 
we've always done the rq->timeout = 0 init, so I think we should just 
reinstate that behavior.


--
Jens Axboe

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


[PATCH] vme_tsi148: Allow setting VMEbus Global Timeout

2014-06-06 Thread Aaron Sierra
Add a "gto" parameter to this driver so that the VMEbus Global Timeout
value can be lowered from the default (8h -> 2048 us) or disabled
completely.

This patch also updates the TSI148_LCSR_VCTRL_GTO_* defines to match
the Tsi148 User Reference Manual, which shows these values to be 4-bits
instead of 3-bits.

Signed-off-by: Aaron Sierra 
---
 drivers/vme/bridges/vme_tsi148.c |   12 
 drivers/vme/bridges/vme_tsi148.h |   14 --
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c
index 61e706c..5fec483 100644
--- a/drivers/vme/bridges/vme_tsi148.c
+++ b/drivers/vme/bridges/vme_tsi148.c
@@ -42,6 +42,7 @@ static void tsi148_remove(struct pci_dev *);
 /* Module parameter */
 static bool err_chk;
 static int geoid;
+static int gto = -1;
 
 static const char driver_name[] = "vme_tsi148";
 
@@ -2414,6 +2415,14 @@ static int tsi148_probe(struct pci_dev *pdev, const 
struct pci_device_id *id)
goto err_test;
}
 
+   /* Setup VMEbus Global Timeout based on "gto" module parameter */
+   if (!gto || ((gto > 2) && (gto < 12))) {
+   data = ioread32be(tsi148_device->base + TSI148_LCSR_VCTRL);
+   data &= ~TSI148_LCSR_VCTRL_GTO_M;
+   data |= gto ? (gto - 3) : TSI148_LCSR_VCTRL_GTO_DIS;
+   iowrite32be(data, tsi148_device->base + TSI148_LCSR_VCTRL);
+   }
+
/* Initialize wait queues & mutual exclusion flags */
init_waitqueue_head(&tsi148_device->dma_queue[0]);
init_waitqueue_head(&tsi148_device->dma_queue[1]);
@@ -2760,5 +2769,8 @@ module_param(err_chk, bool, 0);
 MODULE_PARM_DESC(geoid, "Override geographical addressing");
 module_param(geoid, int, 0);
 
+MODULE_PARM_DESC(gto, "VMEbus Global Timeout, 0=disabled, 3-11 (2^x usec)");
+module_param(gto, int, 0);
+
 MODULE_DESCRIPTION("VME driver for the Tundra Tempe VME bridge");
 MODULE_LICENSE("GPL");
diff --git a/drivers/vme/bridges/vme_tsi148.h b/drivers/vme/bridges/vme_tsi148.h
index f5ed143..ad48a7c 100644
--- a/drivers/vme/bridges/vme_tsi148.h
+++ b/drivers/vme/bridges/vme_tsi148.h
@@ -779,16 +779,18 @@ static const int TSI148_GCSR_MBOX[4] = { 
TSI148_GCSR_MBOX0,
 #define TSI148_LCSR_VCTRL_ATOEN(1<<7)  /* Arbiter Time-out Enable */
 #define TSI148_LCSR_VCTRL_ROBIN(1<<6)  /* VMEbus Round Robin */
 
-#define TSI148_LCSR_VCTRL_GTO_M(7<<0)  /* VMEbus Global Time-out Mask
+#define TSI148_LCSR_VCTRL_GTO_M(0xf<<0)/* VMEbus Global 
Time-out Mask
 */
-#define TSI148_LCSR_VCTRL_GTO_8  (0<<0)/* 8 us */
-#define TSI148_LCSR_VCTRL_GTO_16 (1<<0)/* 16 us */
-#define TSI148_LCSR_VCTRL_GTO_32 (2<<0)/* 32 us */
-#define TSI148_LCSR_VCTRL_GTO_64 (3<<0)/* 64 us */
+#define TSI148_LCSR_VCTRL_GTO_8   (0<<0)   /* 8 us */
+#define TSI148_LCSR_VCTRL_GTO_16   (1<<0)  /* 16 us */
+#define TSI148_LCSR_VCTRL_GTO_32   (2<<0)  /* 32 us */
+#define TSI148_LCSR_VCTRL_GTO_64   (3<<0)  /* 64 us */
 #define TSI148_LCSR_VCTRL_GTO_128  (4<<0)  /* 128 us */
 #define TSI148_LCSR_VCTRL_GTO_256  (5<<0)  /* 256 us */
 #define TSI148_LCSR_VCTRL_GTO_512  (6<<0)  /* 512 us */
-#define TSI148_LCSR_VCTRL_GTO_DIS  (7<<0)  /* Disabled */
+#define TSI148_LCSR_VCTRL_GTO_1024 (7<<0)  /* 1024 us */
+#define TSI148_LCSR_VCTRL_GTO_2048 (8<<0)  /* 2048 us (default) */
+#define TSI148_LCSR_VCTRL_GTO_DIS  (0xf<<0)/* Disabled */
 
 /*
  *  VMEbus Status Register  CRG + $23C
-- 
1.7.9.5

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


Save the Children Summit Invitation

2014-06-06 Thread hannahpaul5u
Dear,

   On behalf of Save the Children Summit/Children Foundation (SCS/CF), It is a 
great privilege for us to invite you to global Congress meeting on War affected 
Children/Child abuse,war against abducted school girls in Nigeria and human 
trafficking. The aims of the congress are to bring together researchers and 
Charitable protection of human rights and risks of those victimized by war and 
commercial sex industry and to deliberate on how to abolish the abduction of 
school girls in Nigeria and some other parts of Africa/rest of the world. Also 
to encourage our boys and girls to acquire sound education and to help correct 
the impression that "western education is sinful in the lives of our children" 
said by Boko Haram leader in Nigeria.

 The Save the Children Summit/Children Foundation (SCS/CF) Congress meeting 
against War affected Children/Child abuse,war against abducted school girls in 
Nigeria and human trafficking is scheduled to take place from JULY 21ST-25TH at 
United State and in Dakar-Senegal, from JULY 28TH–AUG 1ST 2014 West-Africa.

 If you are interested in attending and for fast respond contact the contact 
the Save Children Foundation(SCF) secretariat via email: 
world.con.secre...@qq.com as soon as possible.

Please share the information with your colleagues.

Sincerely,
Ms. Hannah Paul
Email: hannahpau...@gmail.com
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 5/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Misc. fixes.

2014-06-06 Thread Thomas Wood
Remove initialization of static value.
Invert the empty if statement's test to replace the else statement.
Remove parentheses from a return statement.
Fix some code indentation.

Signed-off-by: Thomas Wood 
---

I'm pretty sure that the indentation was caused by a mistake by me earlier on 
in the patch set, so I'm fixing it now.

 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 89 
 1 file changed, 44 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 94fb9f9..ef08db9 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -38,7 +38,7 @@
 #include 
 #include "ft1000_usb.h"
 
-static int ft1000_flarion_cnt = 0;
+static int ft1000_flarion_cnt;
 
 static int ft1000_open(struct inode *inode, struct file *file);
 static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait);
@@ -389,7 +389,7 @@ static unsigned int ft1000_poll_dev(struct file *file, 
poll_table *wait)
poll_wait(file, &dev->app_info[i].wait_dpram_msg, wait);
/* DEBUG("FT1000:ft1000_poll_dev:Polling for data from DSP\n"); */
 
-   return (0);
+   return 0;
 }
 
 /*
@@ -592,70 +592,69 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
/* Check message qtype type which is 
the lower byte within qos_class */
qtype = 
ntohs(dpram_data->pseudohdr.qos_class) & 0xff;
/* DEBUG("FT1000_ft1000_ioctl: qtype = 
%d\n", qtype); */
-   if (qtype) {
-   } else {
+   if (!qtype) {
/* Put message into Slow Queue 
*/
/* Only put a message into the 
DPRAM if msg doorbell is available */
status = 
ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
/* DEBUG("FT1000_ft1000_ioctl: 
READ REGISTER tempword=%x\n", tempword); */
if (tempword & 
FT1000_DB_DPRAM_TX) {
-   /* Suspend for 2ms and try 
again due to DSP doorbell busy */
-   mdelay(2);
-   status = 
ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
-   if (tempword & 
FT1000_DB_DPRAM_TX) {
-   /* Suspend for 1ms and 
try again due to DSP doorbell busy */
-   mdelay(1);
+   /* Suspend for 2ms and 
try again due to DSP doorbell busy */
+   mdelay(2);
status = 
ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
if (tempword & 
FT1000_DB_DPRAM_TX) {
+   /* Suspend for 
1ms and try again due to DSP doorbell busy */
+   mdelay(1);
status = 
ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
if (tempword & 
FT1000_DB_DPRAM_TX) {
-   /* 
Suspend for 3ms and try again due to DSP doorbell busy */
-   
mdelay(3);
status 
= ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL);
if 
(tempword & FT1000_DB_DPRAM_TX) {
-   
DEBUG("FT1000:ft1000_ioctl:Doorbell not available\n");
-   
result = -ENOTTY;
-   
kfree(dpram_data);
-   
break;
+   
/* Suspend for 3ms and try again due to DSP doorbell busy */
+   
mdelay(3);
+   
status = ft1000_re

[PATCH v2 0/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Fix style errors and warnings.

2014-06-06 Thread Thomas Wood
Changes since v1:
 * Made single patch into a patch set.
 * Added better commit messages.

Is this better, or do I still have to split up my first patch?

>8--8<

Remove all style errors from ft1000_debug.c and some warnings.

Thomas Wood (5):
  staging: ft1000: ft1000-usb: ft1000_debug.c: Replace spaces with tabs.
  staging: ft1000: ft1000-usb: ft1000_debug.c: Add required spaces.
  staging: ft1000: ft1000-usb: ft1000_debug.c: Remove unnecessary
whitespace.
  staging: ft1000: ft1000-usb: ft1000_debug.c: Remove unnecessary
braces.
  staging: ft1000: ft1000-usb: ft1000_debug.c: Misc. fixes.

 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 968 +++
 1 file changed, 480 insertions(+), 488 deletions(-)

-- 
1.9.1

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


[PATCH v2 3/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Remove unnecessary whitespace.

2014-06-06 Thread Thomas Wood
Remove whitespace before a quoted newline.
Remove space between function name and it's parameter list.

Signed-off-by: Thomas Wood 
---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 1395c2b..5e371b7 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -556,7 +556,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
 
if (info->CardReady) {
 
-   /* DEBUG("FT1000:ft1000_ioctl: try to SET_DPRAM 
\n"); */
+   /* DEBUG("FT1000:ft1000_ioctl: try to 
SET_DPRAM\n"); */
 
/* Get the length field to see how many bytes 
to copy */
result = get_user(msgsz, (__u16 __user *)argp);
@@ -712,7 +712,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
break;
msglen = htons(msglen);
/* DEBUG("FT1000:ft1000_ioctl:msg length = 
%x\n", msglen); */
-   if (copy_to_user (&pioctl_dpram->pseudohdr, 
pdpram_blk->pbuffer, msglen)) {
+   if (copy_to_user(&pioctl_dpram->pseudohdr, 
pdpram_blk->pbuffer, msglen)) {
DEBUG("FT1000:ft1000_ioctl: copy fault 
occurred\n");
result = -EFAULT;
break;
-- 
1.9.1

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


[PATCH v2 2/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Add required spaces.

2014-06-06 Thread Thomas Wood
Add spaces around operators, after commas, and between (foo*).

Signed-off-by: Thomas Wood 
---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 48 
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 338f91e..1395c2b 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -193,7 +193,7 @@ int ft1000_create_dev(struct ft1000_usb *dev)
 
/* initialize application information */
dev->appcnt = 0;
-   for (i=0; iapp_info[i].nTxMsg = 0;
dev->app_info[i].nRxMsg = 0;
dev->app_info[i].nTxMsgReject = 0;
@@ -260,7 +260,7 @@ void ft1000_destroy_dev(struct net_device *netdev)
dev->DeviceName);
 
/* Make sure we free any memory reserve for slow Queue */
-   for (i=0; iapp_info[i].app_sqlist) == 0) {
pdpram_blk = 
list_entry(dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
list_del(&pdpram_blk->list);
@@ -301,7 +301,7 @@ static int ft1000_open(struct inode *inode, struct file 
*file)
 {
struct ft1000_info *info;
struct ft1000_usb *dev = (struct ft1000_usb *)inode->i_private;
-   int i,num;
+   int i, num;
 
DEBUG("%s called\n", __func__);
num = (MINOR(inode->i_rdev) & 0xf);
@@ -318,7 +318,7 @@ static int ft1000_open(struct inode *inode, struct file 
*file)
}
 
/* Search for available application info block */
-   for (i=0; iapp_info[i].fileobject == NULL)) {
break;
}
@@ -369,7 +369,7 @@ static unsigned int ft1000_poll_dev(struct file *file, 
poll_table *wait)
}
 
/* Search for matching file object */
-   for (i=0; iapp_info[i].fileobject == &file->f_owner) {
/* DEBUG("FT1000:ft1000_ioctl: Message is for AppId = 
%d\n", dev->app_info[i].app_id); */
break;
@@ -411,7 +411,7 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
void __user *argp = (void __user *)argument;
struct ft1000_info *info;
struct ft1000_usb *ft1000dev;
-   int result=0;
+   int result = 0;
int cmd;
int i;
u16 tempword;
@@ -419,15 +419,15 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
struct timeval tv;
struct IOCTL_GET_VER get_ver_data;
struct IOCTL_GET_DSP_STAT get_stat_data;
-   u8 ConnectionMsg[] = 
{0x00,0x44,0x10,0x20,0x80,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x93,0x64,
- 
0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x0a,
- 
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 
0x00,0x00,0x02,0x37,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x01,0x00,0x01,0x7f,0x00,
- 0x00,0x01,0x00,0x00};
+   u8 ConnectionMsg[] = {0x00, 0x44, 0x10, 0x20, 0x80, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x93, 0x64,
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x0a,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x37, 0x00, 0x00, 0x00, 0x08, 
0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x7f, 0x00,
+ 0x00, 0x01, 0x00, 0x00};
 
-   unsigned short ledStat=0;
-   unsigned short conStat=0;
+   unsigned short ledStat = 0;
+   unsigned short conStat = 0;
 
/* DEBUG("ft1000_ioctl called\n"); */
 
@@ -447,14 +447,14 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
switch (cmd) {
case IOCTL_REGISTER_CMD:
DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_REGISTER called\n");
-   result = get_user(tempword, (__u16 __user*)argp);
+   result = get_user(tempword, (__u16 __user *)argp);
if (result) {
DEBUG("result = %d failed to get_user\n", result);
break;
}
if (tempword == DSPBCMSGID) {
/* Search for matching file object */
-   for (i=0; iapp_info[i].fileobject == 
&file->f_owner) {
ft1000dev->app_info[i].DspBCMsgFlag = 1;
DEBUG("FT1000:ft1000_ioctl:Registered 
for

[PATCH v2 1/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Replace spaces with tabs.

2014-06-06 Thread Thomas Wood
Replace the spaces that were used as tabs with actual tabs.

Signed-off-by: Thomas Wood 
---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 974 +++
 1 file changed, 487 insertions(+), 487 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index a8945b7..338f91e 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -43,7 +43,7 @@ static int ft1000_flarion_cnt = 0;
 static int ft1000_open(struct inode *inode, struct file *file);
 static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait);
 static long ft1000_ioctl(struct file *file, unsigned int command,
-   unsigned long argument);
+   unsigned long argument);
 static int ft1000_release(struct inode *inode, struct file *file);
 
 /* List to free receive command buffer pool */
@@ -81,23 +81,23 @@ static const struct file_operations ft1000fops = {
 */
 struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist)
 {
-unsigned long flags;
+   unsigned long flags;
struct dpram_blk *ptr;
 
-spin_lock_irqsave(&free_buff_lock, flags);
-/* Check if buffer is available */
-if (list_empty(bufflist)) {
-DEBUG("ft1000_get_buffer:  No more buffer - %d\n", numofmsgbuf);
-ptr = NULL;
-} else {
-numofmsgbuf--;
-   ptr = list_entry(bufflist->next, struct dpram_blk, list);
-list_del(&ptr->list);
-/* DEBUG("ft1000_get_buffer: number of free msg buffers = %d\n", 
numofmsgbuf); */
-}
-spin_unlock_irqrestore(&free_buff_lock, flags);
-
-return ptr;
+   spin_lock_irqsave(&free_buff_lock, flags);
+   /* Check if buffer is available */
+   if (list_empty(bufflist)) {
+   DEBUG("ft1000_get_buffer:  No more buffer - %d\n", numofmsgbuf);
+   ptr = NULL;
+   } else {
+   numofmsgbuf--;
+   ptr = list_entry(bufflist->next, struct dpram_blk, list);
+   list_del(&ptr->list);
+   /* DEBUG("ft1000_get_buffer: number of free msg buffers = 
%d\n", numofmsgbuf); */
+   }
+   spin_unlock_irqrestore(&free_buff_lock, flags);
+
+   return ptr;
 }
 
 
@@ -119,14 +119,14 @@ struct dpram_blk *ft1000_get_buffer(struct list_head 
*bufflist)
 */
 void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist)
 {
-unsigned long flags;
-
-spin_lock_irqsave(&free_buff_lock, flags);
-/* Put memory back to list */
-list_add_tail(&pdpram_blk->list, plist);
-numofmsgbuf++;
-/*DEBUG("ft1000_free_buffer: number of free msg buffers = %d\n", 
numofmsgbuf); */
-spin_unlock_irqrestore(&free_buff_lock, flags);
+   unsigned long flags;
+
+   spin_lock_irqsave(&free_buff_lock, flags);
+   /* Put memory back to list */
+   list_add_tail(&pdpram_blk->list, plist);
+   numofmsgbuf++;
+   /*DEBUG("ft1000_free_buffer: number of free msg buffers = %d\n", 
numofmsgbuf); */
+   spin_unlock_irqrestore(&free_buff_lock, flags);
 }
 
 /*
@@ -145,25 +145,25 @@ void ft1000_free_buffer(struct dpram_blk *pdpram_blk, 
struct list_head *plist)
 */
 int ft1000_create_dev(struct ft1000_usb *dev)
 {
-int result;
-int i;
+   int result;
+   int i;
struct dentry *dir, *file;
struct ft1000_debug_dirs *tmp;
 
-/* make a new device name */
-sprintf(dev->DeviceName, "%s%d", "FT1000_", dev->CardNumber);
+   /* make a new device name */
+   sprintf(dev->DeviceName, "%s%d", "FT1000_", dev->CardNumber);
 
-DEBUG("%s: number of instance = %d\n", __func__, ft1000_flarion_cnt);
-DEBUG("DeviceCreated = %x\n", dev->DeviceCreated);
+   DEBUG("%s: number of instance = %d\n", __func__, ft1000_flarion_cnt);
+   DEBUG("DeviceCreated = %x\n", dev->DeviceCreated);
 
-if (dev->DeviceCreated) {
-   DEBUG("%s: \"%s\" already registered\n", __func__, dev->DeviceName);
-   return -EIO;
-}
+   if (dev->DeviceCreated) {
+   DEBUG("%s: \"%s\" already registered\n", __func__, 
dev->DeviceName);
+   return -EIO;
+   }
 
 
-/* register the device */
-DEBUG("%s: \"%s\" debugfs device registration\n", __func__, 
dev->DeviceName);
+   /* register the device */
+   DEBUG("%s: \"%s\" debugfs device registration\n", __func__, 
dev->DeviceName);
 
tmp = kmalloc(sizeof(struct ft1000_debug_dirs), GFP_KERNEL);
if (tmp == NULL) {
@@ -189,25 +189,25 @@ int ft1000_create_dev(struct ft1000_usb *dev)
tmp->int_number = dev->CardNumber;
list_add(&(tmp->list), &(dev->nodes.list));
 
-DEBUG("%s: registered debugfs directory \"%s\"\n", __func__, 
dev->DeviceName);
-
-/* initialize application information */
-dev->appcnt = 0;
-for (i=0; iapp_info[i].nTxMsg = 0;
-dev->app_info[i].nRxMsg = 0;
-dev->app_info[i].nTxMsgReject = 0;
-

[PATCH v2 4/5] staging: ft1000: ft1000-usb: ft1000_debug.c: Remove unnecessary braces.

2014-06-06 Thread Thomas Wood
Remove unnecessary braces from single statement if blocks.

Signed-off-by: Thomas Wood 
---
 drivers/staging/ft1000/ft1000-usb/ft1000_debug.c | 21 +++--
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c 
b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
index 5e371b7..94fb9f9 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
@@ -319,9 +319,8 @@ static int ft1000_open(struct inode *inode, struct file 
*file)
 
/* Search for available application info block */
for (i = 0; i < MAX_NUM_APP; i++) {
-   if ((dev->app_info[i].fileobject == NULL)) {
+   if ((dev->app_info[i].fileobject == NULL))
break;
-   }
}
 
/* Fail due to lack of application info block */
@@ -540,17 +539,14 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_SET_DPRAM 
called\n");*/
 
 
-   if (ft1000_flarion_cnt == 0) {
+   if (ft1000_flarion_cnt == 0)
return (-EBADF);
-   }
 
-   if (ft1000dev->DrvMsgPend) {
+   if (ft1000dev->DrvMsgPend)
return (-ENOTTY);
-   }
 
-   if (ft1000dev->fProvComplete == 0) {
+   if (ft1000dev->fProvComplete == 0)
return (-EACCES);
-   }
 
ft1000dev->fAppMsgPend = 1;
 
@@ -582,9 +578,8 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
} else {
/* Check if this message came from a 
registered application */
for (i = 0; i < MAX_NUM_APP; i++) {
-   if 
(ft1000dev->app_info[i].fileobject == &file->f_owner) {
+   if 
(ft1000dev->app_info[i].fileobject == &file->f_owner)
break;
-   }
}
if (i == MAX_NUM_APP) {
DEBUG("FT1000:No matching 
application fileobject\n");
@@ -636,9 +631,8 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
pmsg = (u16 
*)&dpram_data->pseudohdr;
ppseudo_hdr = (struct 
pseudo_hdr *)pmsg;
total_len = msgsz+2;
-   if (total_len & 0x1) {
+   if (total_len & 0x1)
total_len++;
-   }
 
/* Insert slow queue sequence 
number */
ppseudo_hdr->seq_num = 
info->squeseqnum++;
@@ -677,9 +671,8 @@ static long ft1000_ioctl(struct file *file, unsigned int 
command,
 
/* DEBUG("FT1000:ft1000_ioctl: IOCTL_FT1000_GET_DPRAM 
called\n"); */
 
-   if (ft1000_flarion_cnt == 0) {
+   if (ft1000_flarion_cnt == 0)
return (-EBADF);
-   }
 
/* Search for matching file object */
for (i = 0; i < MAX_NUM_APP; i++) {
-- 
1.9.1

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


Re: [PATCH] list: Fix order of arguments for hlist_add_after(_rcu)

2014-06-06 Thread Andrew Morton
On Fri, 6 Jun 2014 10:22:51 -0700 "Paul E. McKenney" 
 wrote:

> On Fri, Jun 06, 2014 at 03:56:52PM +, David Laight wrote:
> > From: Behalf Of Ken Helias
> > > All other add functions for lists have the new item as first argument and 
> > > the
> > > position where it is added as second argument. This was changed for no 
> > > good
> > > reason in this function and makes using it unnecessary confusing.
> > > 
> > > Also the naming of the arguments in hlist_add_after was confusing. It was
> > > changed to use the same names as hlist_add_after_rcu.
> > ...
> > > -static inline void hlist_add_after_rcu(struct hlist_node *prev,
> > > -struct hlist_node *n)
> > > +static inline void hlist_add_after_rcu(struct hlist_node *n,
> > > +struct hlist_node *prev)
> > 
> > It is rather a shame that the change doesn't generate a compilation
> > error for old source files.
> 
> I am also a bit concerned by this.
> 

yup.  hlist_add_behind()?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel