Re: fs/binfmt_em86.c:73:35: error: passing argument 2 of 'copy_strings_kernel' from incompatible pointer type

2016-06-05 Thread Daniel Wagner
> All errors (new ones prefixed by >>):
> 
>fs/binfmt_em86.c: In function 'load_em86':
>>> fs/binfmt_em86.c:73:35: error: passing argument 2 of 'copy_strings_kernel' 
>>> from incompatible pointer type [-Werror=incompatible-pointer-types]
>   retval = copy_strings_kernel(1, _arg, bprm);
>   ^

I'll redo my patch for this error. I didn't get any direct feedback, but
saw someone was complaining that my patch does too much and not just
fixing the error.


Re: fs/binfmt_em86.c:73:35: error: passing argument 2 of 'copy_strings_kernel' from incompatible pointer type

2016-06-05 Thread Daniel Wagner
> All errors (new ones prefixed by >>):
> 
>fs/binfmt_em86.c: In function 'load_em86':
>>> fs/binfmt_em86.c:73:35: error: passing argument 2 of 'copy_strings_kernel' 
>>> from incompatible pointer type [-Werror=incompatible-pointer-types]
>   retval = copy_strings_kernel(1, _arg, bprm);
>   ^

I'll redo my patch for this error. I didn't get any direct feedback, but
saw someone was complaining that my patch does too much and not just
fixing the error.


[PATCH v2] usb: dwc3: host: Set the dma_ops for xhci device

2016-06-05 Thread Baolin Wang
On ARM64 platform, it will set 'dummy_dma_ops' for device dma_ops if
it did not call 'arch_setup_dma_ops' at device creation time, that will
cause failure when setting the dma mask for device.

Thus this patch set the xhci device dma_ops from the parent device if
the xhci device dma_ops is 'dummy_dma_ops'.

Changes since v1:
 - Add CONFIG_ARM64 macro.

Signed-off-by: Baolin Wang 
---
 drivers/usb/dwc3/host.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index c679f63..edb666d 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -32,6 +32,11 @@ int dwc3_host_init(struct dwc3 *dwc)
return -ENOMEM;
}
 
+#ifdef CONFIG_ARM64
+   if (get_dma_ops(>dev) == get_dma_ops(NULL))
+   xhci->dev.archdata.dma_ops = get_dma_ops(dwc->dev);
+#endif
+
dma_set_coherent_mask(>dev, dwc->dev->coherent_dma_mask);
 
xhci->dev.parent= dwc->dev;
-- 
1.7.9.5



[PATCH v2] usb: dwc3: host: Set the dma_ops for xhci device

2016-06-05 Thread Baolin Wang
On ARM64 platform, it will set 'dummy_dma_ops' for device dma_ops if
it did not call 'arch_setup_dma_ops' at device creation time, that will
cause failure when setting the dma mask for device.

Thus this patch set the xhci device dma_ops from the parent device if
the xhci device dma_ops is 'dummy_dma_ops'.

Changes since v1:
 - Add CONFIG_ARM64 macro.

Signed-off-by: Baolin Wang 
---
 drivers/usb/dwc3/host.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index c679f63..edb666d 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -32,6 +32,11 @@ int dwc3_host_init(struct dwc3 *dwc)
return -ENOMEM;
}
 
+#ifdef CONFIG_ARM64
+   if (get_dma_ops(>dev) == get_dma_ops(NULL))
+   xhci->dev.archdata.dma_ops = get_dma_ops(dwc->dev);
+#endif
+
dma_set_coherent_mask(>dev, dwc->dev->coherent_dma_mask);
 
xhci->dev.parent= dwc->dev;
-- 
1.7.9.5



Re: [PATCH 0/4] mtd: nand: Add support for Evatronix NANDFLASH-CTRL

2016-06-05 Thread Ricard Wanderlof

On Thu, 2 Jun 2016, Boris Brezillon wrote:

> Hi Ricard,
> 
> I was not in Cc of this series, so you're either developing an old
> kernel version, or you didn't check the MAINTAINERS file (or didn't run
> get_maintainer.pl on your series).

The patch is intended to apply to the mtd l2 tree, and I did check 
MAINTAINERS, however, for whatever reason I failed to notice that the NAND 
flash subsystem has its own entry (going for the general MTD entry), so 
both you and Richard got left off the CC list. Sorry about that. I'll 
rectify it on subsequent patch submissions.

> And please, next time make sure patches 1 to X are sent in replies to 
> your cover letter.

Ok. Will do.

> I'll to review the driver soon.

Much appreciated.

/Ricard
-- 
Ricard Wolf Wanderlöf   ricardw(at)axis.com
Axis Communications AB, Lund, Swedenwww.axis.com
Phone +46 46 272 2016   Fax +46 46 13 61 30


Re: [PATCH 0/4] mtd: nand: Add support for Evatronix NANDFLASH-CTRL

2016-06-05 Thread Ricard Wanderlof

On Thu, 2 Jun 2016, Boris Brezillon wrote:

> Hi Ricard,
> 
> I was not in Cc of this series, so you're either developing an old
> kernel version, or you didn't check the MAINTAINERS file (or didn't run
> get_maintainer.pl on your series).

The patch is intended to apply to the mtd l2 tree, and I did check 
MAINTAINERS, however, for whatever reason I failed to notice that the NAND 
flash subsystem has its own entry (going for the general MTD entry), so 
both you and Richard got left off the CC list. Sorry about that. I'll 
rectify it on subsequent patch submissions.

> And please, next time make sure patches 1 to X are sent in replies to 
> your cover letter.

Ok. Will do.

> I'll to review the driver soon.

Much appreciated.

/Ricard
-- 
Ricard Wolf Wanderlöf   ricardw(at)axis.com
Axis Communications AB, Lund, Swedenwww.axis.com
Phone +46 46 272 2016   Fax +46 46 13 61 30


[PATCH V4 2/5] irqchip/gicv3-its: Add a new function for parsing device table BASERn

2016-06-05 Thread Shanker Donthineni
Only the device table BASERn needs to be handled differently as
compared to all other tables. So, adding a separate function for
easy code maintenance and improved code readability.

Signed-off-by: Shanker Donthineni 
---
 drivers/irqchip/irq-gic-v3-its.c | 49 +---
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 6392c82..4bd9381 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -836,6 +836,30 @@ static void its_write_baser(struct its_node *its, struct 
its_baser *baser,
writeq_relaxed(val, its->base + GITS_BASER + (baser->idx << 3));
 }
 
+static void its_parse_baser_device(struct its_node *its, struct its_baser 
*baser,
+  u32 *order)
+{
+   u64 esz = GITS_BASER_ENTRY_SIZE(its_read_baser(its, baser));
+   u32 ids = its->device_ids;
+   u32 new_order = *order;
+
+   /*
+* Allocate as many entries as required to fit the
+* range of device IDs that the ITS can grok... The ID
+* space being incredibly sparse, this results in a
+* massive waste of memory.
+*/
+   new_order = max_t(u32, get_order(esz << ids), new_order);
+   if (new_order >= MAX_ORDER) {
+   new_order = MAX_ORDER - 1;
+   ids = ilog2(PAGE_ORDER_TO_SIZE(new_order) / esz);
+   pr_warn("ITS@%pa: Device Table too large, reduce ids %u->%u\n",
+   >phys_base, its->device_ids, ids);
+   }
+
+   *order = new_order;
+}
+
 static void its_free_tables(struct its_node *its)
 {
int i;
@@ -892,29 +916,8 @@ static int its_alloc_tables(const char *node_name, struct 
its_node *its)
if (type == GITS_BASER_TYPE_NONE)
continue;
 
-   /*
-* Allocate as many entries as required to fit the
-* range of device IDs that the ITS can grok... The ID
-* space being incredibly sparse, this results in a
-* massive waste of memory.
-*
-* For other tables, only allocate a single page.
-*/
-   if (type == GITS_BASER_TYPE_DEVICE) {
-   /*
-* 'order' was initialized earlier to the default page
-* granule of the the ITS.  We can't have an allocation
-* smaller than that.  If the requested allocation
-* is smaller, round up to the default page granule.
-*/
-   order = max(get_order((1UL << ids) * entry_size),
-   order);
-   if (order >= MAX_ORDER) {
-   order = MAX_ORDER - 1;
-   pr_warn("%s: Device Table too large, reduce its 
page order to %u\n",
-   node_name, order);
-   }
-   }
+   if (type == GITS_BASER_TYPE_DEVICE)
+   its_parse_baser_device(its, baser, );
 
 retry_alloc_baser:
alloc_pages = (PAGE_ORDER_TO_SIZE(order) / psz);
-- 
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project



[PATCH V4 2/5] irqchip/gicv3-its: Add a new function for parsing device table BASERn

2016-06-05 Thread Shanker Donthineni
Only the device table BASERn needs to be handled differently as
compared to all other tables. So, adding a separate function for
easy code maintenance and improved code readability.

Signed-off-by: Shanker Donthineni 
---
 drivers/irqchip/irq-gic-v3-its.c | 49 +---
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 6392c82..4bd9381 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -836,6 +836,30 @@ static void its_write_baser(struct its_node *its, struct 
its_baser *baser,
writeq_relaxed(val, its->base + GITS_BASER + (baser->idx << 3));
 }
 
+static void its_parse_baser_device(struct its_node *its, struct its_baser 
*baser,
+  u32 *order)
+{
+   u64 esz = GITS_BASER_ENTRY_SIZE(its_read_baser(its, baser));
+   u32 ids = its->device_ids;
+   u32 new_order = *order;
+
+   /*
+* Allocate as many entries as required to fit the
+* range of device IDs that the ITS can grok... The ID
+* space being incredibly sparse, this results in a
+* massive waste of memory.
+*/
+   new_order = max_t(u32, get_order(esz << ids), new_order);
+   if (new_order >= MAX_ORDER) {
+   new_order = MAX_ORDER - 1;
+   ids = ilog2(PAGE_ORDER_TO_SIZE(new_order) / esz);
+   pr_warn("ITS@%pa: Device Table too large, reduce ids %u->%u\n",
+   >phys_base, its->device_ids, ids);
+   }
+
+   *order = new_order;
+}
+
 static void its_free_tables(struct its_node *its)
 {
int i;
@@ -892,29 +916,8 @@ static int its_alloc_tables(const char *node_name, struct 
its_node *its)
if (type == GITS_BASER_TYPE_NONE)
continue;
 
-   /*
-* Allocate as many entries as required to fit the
-* range of device IDs that the ITS can grok... The ID
-* space being incredibly sparse, this results in a
-* massive waste of memory.
-*
-* For other tables, only allocate a single page.
-*/
-   if (type == GITS_BASER_TYPE_DEVICE) {
-   /*
-* 'order' was initialized earlier to the default page
-* granule of the the ITS.  We can't have an allocation
-* smaller than that.  If the requested allocation
-* is smaller, round up to the default page granule.
-*/
-   order = max(get_order((1UL << ids) * entry_size),
-   order);
-   if (order >= MAX_ORDER) {
-   order = MAX_ORDER - 1;
-   pr_warn("%s: Device Table too large, reduce its 
page order to %u\n",
-   node_name, order);
-   }
-   }
+   if (type == GITS_BASER_TYPE_DEVICE)
+   its_parse_baser_device(its, baser, );
 
 retry_alloc_baser:
alloc_pages = (PAGE_ORDER_TO_SIZE(order) / psz);
-- 
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project



[PATCH V4 0/5] Add two-level support for ITS device table

2016-06-05 Thread Shanker Donthineni
This patchset contains necessary code changes to support two-level
(Indirection) table walk feature for device table.

Shanker Donthineni (5):
  irqchip/gicv3-its: Introduce two helper functions for accessing BASERn
  irqchip/gicv3-its: Add a new function for parsing device table BASERn
  irqchip/gicv3-its: Split its_alloc_tables() into two functions
  irqchip/gicv3-its: Remove an unused argument 'node_name'
  irqchip/gicv3-its: Implement two-level(indirect) device table support

 drivers/irqchip/irq-gic-v3-its.c   | 414 +++--
 include/linux/irqchip/arm-gic-v3.h |   4 +
 2 files changed, 266 insertions(+), 152 deletions(-)

-- 
This patchset created on top of Marc Zyngier's branch 
https://git.kernel.org/cgit/linux/kernel/git/maz/arm-platforms.git/log/?h=irq/irqchip-4.7-rc1

I have tested the Indirection feature on Qualcomm Technologies QDF2XXX server 
platform. See the below ITS driver log mesaages.
[0.00] GICv3: GIC: Using split EOI/Deactivate mode
[0.00] ITS@0x397e
[0.00] ITS@0x397e: allocated 524288 Devices @47c040 
(indirect, esz 8, psz 64K, shr 1)
[0.00] ITS@0x397e: allocated 8192 Interrupt Collections 
@47c005 (flat, esz 8, psz 64K, shr 1)
[0.00] ITS@0x397e: allocated 8192 Virtual CPUs @47c006 
(flat, esz 8, psz 64K, shr 1)

Changes since v3:
  Added pathces 1/5, 2/5 and 4/5.

Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project



[PATCH V4 0/5] Add two-level support for ITS device table

2016-06-05 Thread Shanker Donthineni
This patchset contains necessary code changes to support two-level
(Indirection) table walk feature for device table.

Shanker Donthineni (5):
  irqchip/gicv3-its: Introduce two helper functions for accessing BASERn
  irqchip/gicv3-its: Add a new function for parsing device table BASERn
  irqchip/gicv3-its: Split its_alloc_tables() into two functions
  irqchip/gicv3-its: Remove an unused argument 'node_name'
  irqchip/gicv3-its: Implement two-level(indirect) device table support

 drivers/irqchip/irq-gic-v3-its.c   | 414 +++--
 include/linux/irqchip/arm-gic-v3.h |   4 +
 2 files changed, 266 insertions(+), 152 deletions(-)

-- 
This patchset created on top of Marc Zyngier's branch 
https://git.kernel.org/cgit/linux/kernel/git/maz/arm-platforms.git/log/?h=irq/irqchip-4.7-rc1

I have tested the Indirection feature on Qualcomm Technologies QDF2XXX server 
platform. See the below ITS driver log mesaages.
[0.00] GICv3: GIC: Using split EOI/Deactivate mode
[0.00] ITS@0x397e
[0.00] ITS@0x397e: allocated 524288 Devices @47c040 
(indirect, esz 8, psz 64K, shr 1)
[0.00] ITS@0x397e: allocated 8192 Interrupt Collections 
@47c005 (flat, esz 8, psz 64K, shr 1)
[0.00] ITS@0x397e: allocated 8192 Virtual CPUs @47c006 
(flat, esz 8, psz 64K, shr 1)

Changes since v3:
  Added pathces 1/5, 2/5 and 4/5.

Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project



[PATCH V4 4/5] irqchip/gicv3-its: Remove an unused argument 'node_name'

2016-06-05 Thread Shanker Donthineni
No references to argument 'node_name' after modifying pr_xxx()
messages to include ITS base address instead of 'node_name'.

Signed-off-by: Shanker Donthineni 
---
 drivers/irqchip/irq-gic-v3-its.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 9c6ecc8..4f9e288 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -984,7 +984,7 @@ static void its_free_tables(struct its_node *its)
}
 }
 
-static int its_alloc_tables(const char *node_name, struct its_node *its)
+static int its_alloc_tables(struct its_node *its)
 {
u64 typer = readq_relaxed(its->base + GITS_TYPER);
u32 ids = GITS_TYPER_DEVBITS(typer);
@@ -1606,7 +1606,7 @@ static int __init its_probe(struct device_node *node,
 
its_enable_quirks(its);
 
-   err = its_alloc_tables(node->full_name, its);
+   err = its_alloc_tables(its);
if (err)
goto out_free_cmd;
 
-- 
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project



[PATCH V4 5/5] irqchip/gicv3-its: Implement two-level(indirect) device table support

2016-06-05 Thread Shanker Donthineni
Since device IDs are extremely sparse, the single, a.k.a flat table is
not sufficient for the following two reasons.

1) According to ARM-GIC spec, ITS hw can access maximum of 256(pages)*
   64K(pageszie) bytes. In the best case, it supports upto DEVid=21
   sparse with minimum device table entry size 8bytes.

2) The maximum memory size that is possible without memblock depends on
   MAX_ORDER. 4MB on 4K page size kernel with default MAX_ORDER, so it
   supports DEVid range 19bits.

The two-level device table feature brings us two advantages, the first
is a very high possibility of supporting upto 32bit sparse, and the
second one is the best utilization of memory allocation.

The feature is enabled automatically during driver probe if the memory
requirement is more than 2*ITS-pages and the hardware is capable of
two-level table walk.

Signed-off-by: Shanker Donthineni 
---
Changes since v3:
  Changed level-one table pointer type from 'u64 *' to '__le64 *'
  Addressed Marc's review omments.

Changes since v2:
  Fixed a porting bug device 'id' validation check in its_alloc_device_table()

Changes since v1:
  Most of this patch has been rewritten after refactoring its_alloc_tables().
  Always enable device two-level if the memory requirement is more than 
PAGE_SIZE.
  Fixed the coding bug that breaks on the BE machine.
  Edited the commit text.

 drivers/irqchip/irq-gic-v3-its.c   | 105 +++--
 include/linux/irqchip/arm-gic-v3.h |   3 ++
 2 files changed, 92 insertions(+), 16 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 4f9e288..271c7f3 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -838,7 +838,7 @@ static void its_write_baser(struct its_node *its, struct 
its_baser *baser,
 }
 
 static int its_setup_baser(struct its_node *its, struct its_baser *baser,
-  u32 order)
+  u32 order, bool indirect)
 {
u64 val = its_read_baser(its, baser);
u64 esz = GITS_BASER_ENTRY_SIZE(val);
@@ -875,6 +875,8 @@ retry_baser:
shr  |
GITS_BASER_VALID);
 
+   val |=  indirect ? GITS_BASER_INDIRECT : 0x0;
+
switch (psz) {
case SZ_4K:
val |= GITS_BASER_PAGE_SIZE_4K;
@@ -937,28 +939,56 @@ retry_baser:
baser->base = base;
baser->psz = psz;
baser->val = val;
+   tmp = indirect ? GITS_LVL1_ENTRY_SIZE : esz;
 
-   pr_info("ITS@%pa: allocated %d %s @%lx (psz %dK, shr %d)\n",
-   >phys_base, (int)(PAGE_ORDER_TO_SIZE(order) / esz),
+   pr_info("ITS@%pa: allocated %d %s @%lx (%s, esz %d, psz %dK, shr %d)\n",
+   >phys_base, (int)(PAGE_ORDER_TO_SIZE(order) / tmp),
its_base_type_string[type],
(unsigned long)virt_to_phys(base),
+   indirect ? "indirect" : "flat", (int)esz,
psz / SZ_1K, (int)shr >> GITS_BASER_SHAREABILITY_SHIFT);
 
return 0;
 }
 
-static void its_parse_baser_device(struct its_node *its, struct its_baser 
*baser,
+static bool its_parse_baser_device(struct its_node *its, struct its_baser 
*baser,
   u32 *order)
 {
u64 esz = GITS_BASER_ENTRY_SIZE(its_read_baser(its, baser));
+   u64 val = GITS_BASER_InnerShareable | GITS_BASER_WaWb;
u32 ids = its->device_ids;
u32 new_order = *order;
+   bool indirect = false;
+
+   /* No need to enable Indirection if memory requirement < (psz*2)bytes */
+   if ((esz << ids) > (baser->psz * 2)) {
+   /*
+* Find out whether hw supports a single or two-level table by
+* table by reading bit at offset '62' after writing '1' to it.
+*/
+   its_write_baser(its, baser, val | GITS_BASER_INDIRECT);
+   val = its_read_baser(its, baser);
+   indirect = !!(val & GITS_BASER_INDIRECT);
+
+   if (indirect) {
+   /*
+* The size of the lvl2 table is equal to ITS page size
+* which is 'psz'. For computing lvl1 table size,
+* subtract ID bits that sparse lvl2 table from 'ids'
+* which is reported by ITS hardware times lvl1 table
+* entry size.
+*/
+   ids -= ilog2(baser->psz / esz);
+   esz = GITS_LVL1_ENTRY_SIZE;
+   }
+   }
 
/*
 * Allocate as many entries as required to fit the
 * range of device IDs that the ITS can grok... The ID
 * space being incredibly sparse, this results in a
-* massive waste of memory.
+* massive waste of memory if two-level device table
+* feature is not supported by hardware.
 */
 

[PATCH V4 3/5] irqchip/gicv3-its: Split its_alloc_tables() into two functions

2016-06-05 Thread Shanker Donthineni
The function is getting out of control, it has too many goto
statements and would be too complicated for adding a feature
two-level device table. So, it is time for us to cleanup and
move some of the logic to a separate function without affecting
the existing functionality.

Signed-off-by: Shanker Donthineni 
---
Changes since v3:
   Moved all changes that are related to Indirection to patch 5/5.

 drivers/irqchip/irq-gic-v3-its.c   | 250 -
 include/linux/irqchip/arm-gic-v3.h |   1 +
 2 files changed, 134 insertions(+), 117 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 4bd9381..9c6ecc8 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -57,13 +57,14 @@ struct its_collection {
 
 /*
  * The ITS_BASER structure - contains memory information, cached value
- * of BASER register configuration and register idx.
+ * of BASER register configuration, register idx and page size.
  */
 struct its_baser {
void*base;
u64 val;
u32 order;
u32 idx;
+   u32 psz;
 };
 
 /*
@@ -836,6 +837,116 @@ static void its_write_baser(struct its_node *its, struct 
its_baser *baser,
writeq_relaxed(val, its->base + GITS_BASER + (baser->idx << 3));
 }
 
+static int its_setup_baser(struct its_node *its, struct its_baser *baser,
+  u32 order)
+{
+   u64 val = its_read_baser(its, baser);
+   u64 esz = GITS_BASER_ENTRY_SIZE(val);
+   u64 type = GITS_BASER_TYPE(val);
+   int psz, alloc_pages;
+   u64 cache, shr, tmp;
+   void *base;
+
+   /* Do first attempt with the requested attributes */
+   cache = baser->val & GITS_BASER_CACHEABILITY_MASK;
+   shr = baser->val & GITS_BASER_SHAREABILITY_MASK;
+   psz = baser->psz;
+
+retry_alloc_baser:
+   alloc_pages = (PAGE_ORDER_TO_SIZE(order) / psz);
+   if (alloc_pages > GITS_BASER_PAGES_MAX) {
+   pr_warn("ITS@%pa: %s too large, reduce ITS pages %u->%u\n",
+   >phys_base, its_base_type_string[type],
+   alloc_pages, GITS_BASER_PAGES_MAX);
+   alloc_pages = GITS_BASER_PAGES_MAX;
+   order = get_order(GITS_BASER_PAGES_MAX * psz);
+   }
+
+   base = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, order);
+   if (!base)
+   return -ENOMEM;
+
+retry_baser:
+   val = (virt_to_phys(base)|
+   (type << GITS_BASER_TYPE_SHIFT)  |
+   ((esz - 1) << GITS_BASER_ENTRY_SIZE_SHIFT)   |
+   ((alloc_pages - 1) << GITS_BASER_PAGES_SHIFT)|
+   cache|
+   shr  |
+   GITS_BASER_VALID);
+
+   switch (psz) {
+   case SZ_4K:
+   val |= GITS_BASER_PAGE_SIZE_4K;
+   break;
+   case SZ_16K:
+   val |= GITS_BASER_PAGE_SIZE_16K;
+   break;
+   case SZ_64K:
+   val |= GITS_BASER_PAGE_SIZE_64K;
+   break;
+   }
+
+   its_write_baser(its, baser, val);
+   tmp = its_read_baser(its, baser);
+
+   if ((val ^ tmp) & GITS_BASER_SHAREABILITY_MASK) {
+   /*
+* Shareability didn't stick. Just use
+* whatever the read reported, which is likely
+* to be the only thing this redistributor
+* supports. If that's zero, make it
+* non-cacheable as well.
+*/
+   shr = tmp & GITS_BASER_SHAREABILITY_MASK;
+   if (!shr) {
+   cache = GITS_BASER_nC;
+   __flush_dcache_area(base, PAGE_ORDER_TO_SIZE(order));
+   }
+   goto retry_baser;
+   }
+
+   if ((val ^ tmp) & GITS_BASER_PAGE_SIZE_MASK) {
+   /*
+* Page size didn't stick. Let's try a smaller
+* size and retry. If we reach 4K, then
+* something is horribly wrong...
+*/
+   free_pages((unsigned long)base, order);
+   baser->base = NULL;
+
+   switch (psz) {
+   case SZ_16K:
+   psz = SZ_4K;
+   goto retry_alloc_baser;
+   case SZ_64K:
+   psz = SZ_16K;
+   goto retry_alloc_baser;
+   }
+   }
+
+   if (val != tmp) {
+   pr_err("ITS@%pa: %s doesn't stick: %lx %lx\n",
+  >phys_base, its_base_type_string[type],
+  (unsigned long) val, (unsigned long) tmp);
+   free_pages((unsigned long)base, order);
+   return -ENXIO;
+   }
+
+   baser->order = order;

[PATCH V4 1/5] irqchip/gicv3-its: Introduce two helper functions for accessing BASERn

2016-06-05 Thread Shanker Donthineni
This patch adds the two handy helper functions for reading and writing
ITS BASERn register.

Signed-off-by: Shanker Donthineni 
---
 drivers/irqchip/irq-gic-v3-its.c | 32 +---
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 5eb1f9e..6392c82 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -56,13 +56,14 @@ struct its_collection {
 };
 
 /*
- * The ITS_BASER structure - contains memory information and cached
- * value of BASER register configuration.
+ * The ITS_BASER structure - contains memory information, cached value
+ * of BASER register configuration and register idx.
  */
 struct its_baser {
void*base;
u64 val;
u32 order;
+   u32 idx;
 };
 
 /*
@@ -824,6 +825,17 @@ static const char *its_base_type_string[] = {
[GITS_BASER_TYPE_RESERVED7] = "Reserved (7)",
 };
 
+static u64 its_read_baser(struct its_node *its, struct its_baser *baser)
+{
+   return readq_relaxed(its->base + GITS_BASER + (baser->idx << 3));
+}
+
+static void its_write_baser(struct its_node *its, struct its_baser *baser,
+   u64 val)
+{
+   writeq_relaxed(val, its->base + GITS_BASER + (baser->idx << 3));
+}
+
 static void its_free_tables(struct its_node *its)
 {
int i;
@@ -863,14 +875,20 @@ static int its_alloc_tables(const char *node_name, struct 
its_node *its)
its->device_ids = ids;
 
for (i = 0; i < GITS_BASER_NR_REGS; i++) {
-   u64 val = readq_relaxed(its->base + GITS_BASER + i * 8);
-   u64 type = GITS_BASER_TYPE(val);
-   u64 entry_size = GITS_BASER_ENTRY_SIZE(val);
+   struct its_baser *baser = its->tables + i;
int order = get_order(psz);
+   u64 val, type, entry_size;
int alloc_pages;
u64 tmp;
void *base;
 
+   /* Record the register index */
+   baser->idx = i;
+
+   val = its_read_baser(its, baser);
+   type = GITS_BASER_TYPE(val);
+   entry_size = GITS_BASER_ENTRY_SIZE(val);
+
if (type == GITS_BASER_TYPE_NONE)
continue;
 
@@ -939,8 +957,8 @@ retry_baser:
val |= alloc_pages - 1;
its->tables[i].val = val;
 
-   writeq_relaxed(val, its->base + GITS_BASER + i * 8);
-   tmp = readq_relaxed(its->base + GITS_BASER + i * 8);
+   its_write_baser(its, baser, val);
+   tmp = its_read_baser(its, baser);
 
if ((val ^ tmp) & GITS_BASER_SHAREABILITY_MASK) {
/*
-- 
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project



[PATCH V4 4/5] irqchip/gicv3-its: Remove an unused argument 'node_name'

2016-06-05 Thread Shanker Donthineni
No references to argument 'node_name' after modifying pr_xxx()
messages to include ITS base address instead of 'node_name'.

Signed-off-by: Shanker Donthineni 
---
 drivers/irqchip/irq-gic-v3-its.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 9c6ecc8..4f9e288 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -984,7 +984,7 @@ static void its_free_tables(struct its_node *its)
}
 }
 
-static int its_alloc_tables(const char *node_name, struct its_node *its)
+static int its_alloc_tables(struct its_node *its)
 {
u64 typer = readq_relaxed(its->base + GITS_TYPER);
u32 ids = GITS_TYPER_DEVBITS(typer);
@@ -1606,7 +1606,7 @@ static int __init its_probe(struct device_node *node,
 
its_enable_quirks(its);
 
-   err = its_alloc_tables(node->full_name, its);
+   err = its_alloc_tables(its);
if (err)
goto out_free_cmd;
 
-- 
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project



[PATCH V4 5/5] irqchip/gicv3-its: Implement two-level(indirect) device table support

2016-06-05 Thread Shanker Donthineni
Since device IDs are extremely sparse, the single, a.k.a flat table is
not sufficient for the following two reasons.

1) According to ARM-GIC spec, ITS hw can access maximum of 256(pages)*
   64K(pageszie) bytes. In the best case, it supports upto DEVid=21
   sparse with minimum device table entry size 8bytes.

2) The maximum memory size that is possible without memblock depends on
   MAX_ORDER. 4MB on 4K page size kernel with default MAX_ORDER, so it
   supports DEVid range 19bits.

The two-level device table feature brings us two advantages, the first
is a very high possibility of supporting upto 32bit sparse, and the
second one is the best utilization of memory allocation.

The feature is enabled automatically during driver probe if the memory
requirement is more than 2*ITS-pages and the hardware is capable of
two-level table walk.

Signed-off-by: Shanker Donthineni 
---
Changes since v3:
  Changed level-one table pointer type from 'u64 *' to '__le64 *'
  Addressed Marc's review omments.

Changes since v2:
  Fixed a porting bug device 'id' validation check in its_alloc_device_table()

Changes since v1:
  Most of this patch has been rewritten after refactoring its_alloc_tables().
  Always enable device two-level if the memory requirement is more than 
PAGE_SIZE.
  Fixed the coding bug that breaks on the BE machine.
  Edited the commit text.

 drivers/irqchip/irq-gic-v3-its.c   | 105 +++--
 include/linux/irqchip/arm-gic-v3.h |   3 ++
 2 files changed, 92 insertions(+), 16 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 4f9e288..271c7f3 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -838,7 +838,7 @@ static void its_write_baser(struct its_node *its, struct 
its_baser *baser,
 }
 
 static int its_setup_baser(struct its_node *its, struct its_baser *baser,
-  u32 order)
+  u32 order, bool indirect)
 {
u64 val = its_read_baser(its, baser);
u64 esz = GITS_BASER_ENTRY_SIZE(val);
@@ -875,6 +875,8 @@ retry_baser:
shr  |
GITS_BASER_VALID);
 
+   val |=  indirect ? GITS_BASER_INDIRECT : 0x0;
+
switch (psz) {
case SZ_4K:
val |= GITS_BASER_PAGE_SIZE_4K;
@@ -937,28 +939,56 @@ retry_baser:
baser->base = base;
baser->psz = psz;
baser->val = val;
+   tmp = indirect ? GITS_LVL1_ENTRY_SIZE : esz;
 
-   pr_info("ITS@%pa: allocated %d %s @%lx (psz %dK, shr %d)\n",
-   >phys_base, (int)(PAGE_ORDER_TO_SIZE(order) / esz),
+   pr_info("ITS@%pa: allocated %d %s @%lx (%s, esz %d, psz %dK, shr %d)\n",
+   >phys_base, (int)(PAGE_ORDER_TO_SIZE(order) / tmp),
its_base_type_string[type],
(unsigned long)virt_to_phys(base),
+   indirect ? "indirect" : "flat", (int)esz,
psz / SZ_1K, (int)shr >> GITS_BASER_SHAREABILITY_SHIFT);
 
return 0;
 }
 
-static void its_parse_baser_device(struct its_node *its, struct its_baser 
*baser,
+static bool its_parse_baser_device(struct its_node *its, struct its_baser 
*baser,
   u32 *order)
 {
u64 esz = GITS_BASER_ENTRY_SIZE(its_read_baser(its, baser));
+   u64 val = GITS_BASER_InnerShareable | GITS_BASER_WaWb;
u32 ids = its->device_ids;
u32 new_order = *order;
+   bool indirect = false;
+
+   /* No need to enable Indirection if memory requirement < (psz*2)bytes */
+   if ((esz << ids) > (baser->psz * 2)) {
+   /*
+* Find out whether hw supports a single or two-level table by
+* table by reading bit at offset '62' after writing '1' to it.
+*/
+   its_write_baser(its, baser, val | GITS_BASER_INDIRECT);
+   val = its_read_baser(its, baser);
+   indirect = !!(val & GITS_BASER_INDIRECT);
+
+   if (indirect) {
+   /*
+* The size of the lvl2 table is equal to ITS page size
+* which is 'psz'. For computing lvl1 table size,
+* subtract ID bits that sparse lvl2 table from 'ids'
+* which is reported by ITS hardware times lvl1 table
+* entry size.
+*/
+   ids -= ilog2(baser->psz / esz);
+   esz = GITS_LVL1_ENTRY_SIZE;
+   }
+   }
 
/*
 * Allocate as many entries as required to fit the
 * range of device IDs that the ITS can grok... The ID
 * space being incredibly sparse, this results in a
-* massive waste of memory.
+* massive waste of memory if two-level device table
+* feature is not supported by hardware.
 */
new_order = 

[PATCH V4 3/5] irqchip/gicv3-its: Split its_alloc_tables() into two functions

2016-06-05 Thread Shanker Donthineni
The function is getting out of control, it has too many goto
statements and would be too complicated for adding a feature
two-level device table. So, it is time for us to cleanup and
move some of the logic to a separate function without affecting
the existing functionality.

Signed-off-by: Shanker Donthineni 
---
Changes since v3:
   Moved all changes that are related to Indirection to patch 5/5.

 drivers/irqchip/irq-gic-v3-its.c   | 250 -
 include/linux/irqchip/arm-gic-v3.h |   1 +
 2 files changed, 134 insertions(+), 117 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 4bd9381..9c6ecc8 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -57,13 +57,14 @@ struct its_collection {
 
 /*
  * The ITS_BASER structure - contains memory information, cached value
- * of BASER register configuration and register idx.
+ * of BASER register configuration, register idx and page size.
  */
 struct its_baser {
void*base;
u64 val;
u32 order;
u32 idx;
+   u32 psz;
 };
 
 /*
@@ -836,6 +837,116 @@ static void its_write_baser(struct its_node *its, struct 
its_baser *baser,
writeq_relaxed(val, its->base + GITS_BASER + (baser->idx << 3));
 }
 
+static int its_setup_baser(struct its_node *its, struct its_baser *baser,
+  u32 order)
+{
+   u64 val = its_read_baser(its, baser);
+   u64 esz = GITS_BASER_ENTRY_SIZE(val);
+   u64 type = GITS_BASER_TYPE(val);
+   int psz, alloc_pages;
+   u64 cache, shr, tmp;
+   void *base;
+
+   /* Do first attempt with the requested attributes */
+   cache = baser->val & GITS_BASER_CACHEABILITY_MASK;
+   shr = baser->val & GITS_BASER_SHAREABILITY_MASK;
+   psz = baser->psz;
+
+retry_alloc_baser:
+   alloc_pages = (PAGE_ORDER_TO_SIZE(order) / psz);
+   if (alloc_pages > GITS_BASER_PAGES_MAX) {
+   pr_warn("ITS@%pa: %s too large, reduce ITS pages %u->%u\n",
+   >phys_base, its_base_type_string[type],
+   alloc_pages, GITS_BASER_PAGES_MAX);
+   alloc_pages = GITS_BASER_PAGES_MAX;
+   order = get_order(GITS_BASER_PAGES_MAX * psz);
+   }
+
+   base = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, order);
+   if (!base)
+   return -ENOMEM;
+
+retry_baser:
+   val = (virt_to_phys(base)|
+   (type << GITS_BASER_TYPE_SHIFT)  |
+   ((esz - 1) << GITS_BASER_ENTRY_SIZE_SHIFT)   |
+   ((alloc_pages - 1) << GITS_BASER_PAGES_SHIFT)|
+   cache|
+   shr  |
+   GITS_BASER_VALID);
+
+   switch (psz) {
+   case SZ_4K:
+   val |= GITS_BASER_PAGE_SIZE_4K;
+   break;
+   case SZ_16K:
+   val |= GITS_BASER_PAGE_SIZE_16K;
+   break;
+   case SZ_64K:
+   val |= GITS_BASER_PAGE_SIZE_64K;
+   break;
+   }
+
+   its_write_baser(its, baser, val);
+   tmp = its_read_baser(its, baser);
+
+   if ((val ^ tmp) & GITS_BASER_SHAREABILITY_MASK) {
+   /*
+* Shareability didn't stick. Just use
+* whatever the read reported, which is likely
+* to be the only thing this redistributor
+* supports. If that's zero, make it
+* non-cacheable as well.
+*/
+   shr = tmp & GITS_BASER_SHAREABILITY_MASK;
+   if (!shr) {
+   cache = GITS_BASER_nC;
+   __flush_dcache_area(base, PAGE_ORDER_TO_SIZE(order));
+   }
+   goto retry_baser;
+   }
+
+   if ((val ^ tmp) & GITS_BASER_PAGE_SIZE_MASK) {
+   /*
+* Page size didn't stick. Let's try a smaller
+* size and retry. If we reach 4K, then
+* something is horribly wrong...
+*/
+   free_pages((unsigned long)base, order);
+   baser->base = NULL;
+
+   switch (psz) {
+   case SZ_16K:
+   psz = SZ_4K;
+   goto retry_alloc_baser;
+   case SZ_64K:
+   psz = SZ_16K;
+   goto retry_alloc_baser;
+   }
+   }
+
+   if (val != tmp) {
+   pr_err("ITS@%pa: %s doesn't stick: %lx %lx\n",
+  >phys_base, its_base_type_string[type],
+  (unsigned long) val, (unsigned long) tmp);
+   free_pages((unsigned long)base, order);
+   return -ENXIO;
+   }
+
+   baser->order = order;
+   baser->base = 

[PATCH V4 1/5] irqchip/gicv3-its: Introduce two helper functions for accessing BASERn

2016-06-05 Thread Shanker Donthineni
This patch adds the two handy helper functions for reading and writing
ITS BASERn register.

Signed-off-by: Shanker Donthineni 
---
 drivers/irqchip/irq-gic-v3-its.c | 32 +---
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 5eb1f9e..6392c82 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -56,13 +56,14 @@ struct its_collection {
 };
 
 /*
- * The ITS_BASER structure - contains memory information and cached
- * value of BASER register configuration.
+ * The ITS_BASER structure - contains memory information, cached value
+ * of BASER register configuration and register idx.
  */
 struct its_baser {
void*base;
u64 val;
u32 order;
+   u32 idx;
 };
 
 /*
@@ -824,6 +825,17 @@ static const char *its_base_type_string[] = {
[GITS_BASER_TYPE_RESERVED7] = "Reserved (7)",
 };
 
+static u64 its_read_baser(struct its_node *its, struct its_baser *baser)
+{
+   return readq_relaxed(its->base + GITS_BASER + (baser->idx << 3));
+}
+
+static void its_write_baser(struct its_node *its, struct its_baser *baser,
+   u64 val)
+{
+   writeq_relaxed(val, its->base + GITS_BASER + (baser->idx << 3));
+}
+
 static void its_free_tables(struct its_node *its)
 {
int i;
@@ -863,14 +875,20 @@ static int its_alloc_tables(const char *node_name, struct 
its_node *its)
its->device_ids = ids;
 
for (i = 0; i < GITS_BASER_NR_REGS; i++) {
-   u64 val = readq_relaxed(its->base + GITS_BASER + i * 8);
-   u64 type = GITS_BASER_TYPE(val);
-   u64 entry_size = GITS_BASER_ENTRY_SIZE(val);
+   struct its_baser *baser = its->tables + i;
int order = get_order(psz);
+   u64 val, type, entry_size;
int alloc_pages;
u64 tmp;
void *base;
 
+   /* Record the register index */
+   baser->idx = i;
+
+   val = its_read_baser(its, baser);
+   type = GITS_BASER_TYPE(val);
+   entry_size = GITS_BASER_ENTRY_SIZE(val);
+
if (type == GITS_BASER_TYPE_NONE)
continue;
 
@@ -939,8 +957,8 @@ retry_baser:
val |= alloc_pages - 1;
its->tables[i].val = val;
 
-   writeq_relaxed(val, its->base + GITS_BASER + i * 8);
-   tmp = readq_relaxed(its->base + GITS_BASER + i * 8);
+   its_write_baser(its, baser, val);
+   tmp = its_read_baser(its, baser);
 
if ((val ^ tmp) & GITS_BASER_SHAREABILITY_MASK) {
/*
-- 
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project



Re: powerpc/nvram: Fix an incorrect partition merge

2016-06-05 Thread xinhui



On 2016年06月03日 19:47, Michael Ellerman wrote:

On Thu, 2015-10-12 at 07:30:02 UTC, xinhui wrote:

From: Pan Xinhui 

When we merge two contiguous partitions whose signatures are marked
NVRAM_SIG_FREE, We need update prev's length and checksum, then write it
to nvram, not cur's. So lets fix this mistake now.

Also use memset instead of strncpy to set the partition's name. It's
more readable if we want to fill up with duplicate chars .


Does this ever happen in practice? ie. should we backport the fix to stable
kernels?



I did not see that nvram warning in practice. BUT I suggest to backport it to 
stable kernel. :)

Let me recall the story. :)
In past days, I was using pstore to keep some kernel logs. and sometimes I 
found my own logs and the panic logs did not show.
pstore use a fixed-address reserved memory In x86 while nvram instead in ppc.

Then I spent some days to review the nvram codes.
And worked out three patches to fix all issues that I found in nvram. BUT looks 
like I only sent out two of them. :)
I lost the third patch maybe...


Has it always been broken?



no. after nvram partition corruption hit, all nvram partitions will be erased 
and re-alloc after the second machine reboot.
I don't know who does it but i guess it is the firmware. :)

thanks
xinhui

cheers





Re: powerpc/nvram: Fix an incorrect partition merge

2016-06-05 Thread xinhui



On 2016年06月03日 19:47, Michael Ellerman wrote:

On Thu, 2015-10-12 at 07:30:02 UTC, xinhui wrote:

From: Pan Xinhui 

When we merge two contiguous partitions whose signatures are marked
NVRAM_SIG_FREE, We need update prev's length and checksum, then write it
to nvram, not cur's. So lets fix this mistake now.

Also use memset instead of strncpy to set the partition's name. It's
more readable if we want to fill up with duplicate chars .


Does this ever happen in practice? ie. should we backport the fix to stable
kernels?



I did not see that nvram warning in practice. BUT I suggest to backport it to 
stable kernel. :)

Let me recall the story. :)
In past days, I was using pstore to keep some kernel logs. and sometimes I 
found my own logs and the panic logs did not show.
pstore use a fixed-address reserved memory In x86 while nvram instead in ppc.

Then I spent some days to review the nvram codes.
And worked out three patches to fix all issues that I found in nvram. BUT looks 
like I only sent out two of them. :)
I lost the third patch maybe...


Has it always been broken?



no. after nvram partition corruption hit, all nvram partitions will be erased 
and re-alloc after the second machine reboot.
I don't know who does it but i guess it is the firmware. :)

thanks
xinhui

cheers





Re: [PATCH 2/3] hisi_sas: fix the inconsistent lock issue reported by CONFIG_PROVE_LOCKING

2016-06-05 Thread zhangfei



On 05/31/2016 08:38 PM, John Garry wrote:

It is not necessary to surround call to
notify_port_event(, PORTE_BROADCAST_RCVD) by spin_lock_irqsave(),
so remove.
This was causing a warn, as below:

 =
 [ INFO: inconsistent lock state ]
 4.4.8+ #12 Not tainted
 -
 inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
 kworker/u64:1/168 [HC0[0]:SC0[0]:HE1:SE1] takes:
  (&(_hba->lock)->rlock){?.}, at: [] 
alloc_dev_quirk_v2_hw+0x48/0xec
 {IN-HARDIRQ-W} state was registered at:
   [] mark_lock+0x19c/0x6a0
   [] __lock_acquire+0xa2c/0x1d00
   [] lock_acquire+0x58/0x7c
   [] _raw_spin_lock_irqsave+0x54/0x6c
   [] int_chnl_int_v2_hw+0x1c4/0x248
   [] handle_irq_event_percpu+0x9c/0x144
   [] handle_irq_event+0x44/0x74
   [] handle_fasteoi_irq+0xb4/0x188
   [] generic_handle_irq+0x24/0x38
   [] __handle_domain_irq+0x60/0xac
   [] gic_handle_irq+0xcc/0x168
   [] el1_irq+0x6c/0xe0
   [] default_idle_call+0x1c/0x34
   [] cpu_startup_entry+0x1d4/0x228
   [] rest_init+0x150/0x160
   [] start_kernel+0x3a4/0x3b8
   [<008bb000>] 0x8bb000
 irq event stamp: 32661
 hardirqs last  enabled at (32661): [] 
__mutex_unlock_slowpath+0x108/0x18c
 hardirqs last disabled at (32660): [] 
__mutex_unlock_slowpath+0x44/0x18c
 softirqs last  enabled at (25114): [] 
__do_softirq+0x210/0x27c
 softirqs last disabled at (25095): [] irq_exit+0x9c/0xe8

 other info that might help us debug this:
  Possible unsafe locking scenario:

CPU0

   lock(&(_hba->lock)->rlock);
   
 lock(&(_hba->lock)->rlock);

  *** DEADLOCK ***

 2 locks held by kworker/u64:1/168:
  #0:  ("%s"shost->work_q_name){.+}, at: [] 
process_one_work+0x134/0x3cc
  #1:  ((>work)#2){+.+.+.}, at: [] 
process_one_work+0x134/0x3cc

 stack backtrace:
 CPU: 4 PID: 168 Comm: kworker/u64:1 Not tainted 4.4.8+ #12
 Hardware name: Huawei Technologies Co., Ltd. D03/D03, BIOS 1.12 01/01/1900
 Workqueue: scsi_wq_1 sas_discover_domain
 Call trace:
 [] dump_backtrace+0x0/0x114
 [] show_stack+0x14/0x1c
 [] dump_stack+0xb4/0xf0
 [] print_usage_bug+0x210/0x2b4
 [] mark_lock+0x5fc/0x6a0
 [] __lock_acquire+0x800/0x1d00
 [] lock_acquire+0x58/0x7c
 [] _raw_spin_lock+0x44/0x58
 [] alloc_dev_quirk_v2_hw+0x48/0xec
 [] hisi_sas_dev_found+0x48/0x1b8
 [] sas_notify_lldd_dev_found+0x34/0xe0
 [] sas_discover_root_expander+0x58/0x128
 [] sas_discover_domain+0x4bc/0x564
 [] process_one_work+0x1a0/0x3cc
 [] worker_thread+0x138/0x438
 [] kthread+0xdc/0xf0
 [] ret_from_fork+0x10/0x40

Signed-off-by: Wei Xu 
Signed-off-by: John Garry 


Reviewed-by: Zhangfei Gao 


Re: [PATCH 1/3] hisi_sas: add v2 hw ACPI support

2016-06-05 Thread zhangfei



On 05/31/2016 08:38 PM, John Garry wrote:

Add support in v2 hw driver for ACPI.

A check on whether an ACPI handle is available for the device is used to
decide on whether to use ACPI reset handler or syscon for hw reset.

Signed-off-by: John Garry 
Signed-off-by: Wei Xu 


Reviewed-by: Zhangfei Gao 

Thanks


Re: [PATCH 2/3] hisi_sas: fix the inconsistent lock issue reported by CONFIG_PROVE_LOCKING

2016-06-05 Thread zhangfei



On 05/31/2016 08:38 PM, John Garry wrote:

It is not necessary to surround call to
notify_port_event(, PORTE_BROADCAST_RCVD) by spin_lock_irqsave(),
so remove.
This was causing a warn, as below:

 =
 [ INFO: inconsistent lock state ]
 4.4.8+ #12 Not tainted
 -
 inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
 kworker/u64:1/168 [HC0[0]:SC0[0]:HE1:SE1] takes:
  (&(_hba->lock)->rlock){?.}, at: [] 
alloc_dev_quirk_v2_hw+0x48/0xec
 {IN-HARDIRQ-W} state was registered at:
   [] mark_lock+0x19c/0x6a0
   [] __lock_acquire+0xa2c/0x1d00
   [] lock_acquire+0x58/0x7c
   [] _raw_spin_lock_irqsave+0x54/0x6c
   [] int_chnl_int_v2_hw+0x1c4/0x248
   [] handle_irq_event_percpu+0x9c/0x144
   [] handle_irq_event+0x44/0x74
   [] handle_fasteoi_irq+0xb4/0x188
   [] generic_handle_irq+0x24/0x38
   [] __handle_domain_irq+0x60/0xac
   [] gic_handle_irq+0xcc/0x168
   [] el1_irq+0x6c/0xe0
   [] default_idle_call+0x1c/0x34
   [] cpu_startup_entry+0x1d4/0x228
   [] rest_init+0x150/0x160
   [] start_kernel+0x3a4/0x3b8
   [<008bb000>] 0x8bb000
 irq event stamp: 32661
 hardirqs last  enabled at (32661): [] 
__mutex_unlock_slowpath+0x108/0x18c
 hardirqs last disabled at (32660): [] 
__mutex_unlock_slowpath+0x44/0x18c
 softirqs last  enabled at (25114): [] 
__do_softirq+0x210/0x27c
 softirqs last disabled at (25095): [] irq_exit+0x9c/0xe8

 other info that might help us debug this:
  Possible unsafe locking scenario:

CPU0

   lock(&(_hba->lock)->rlock);
   
 lock(&(_hba->lock)->rlock);

  *** DEADLOCK ***

 2 locks held by kworker/u64:1/168:
  #0:  ("%s"shost->work_q_name){.+}, at: [] 
process_one_work+0x134/0x3cc
  #1:  ((>work)#2){+.+.+.}, at: [] 
process_one_work+0x134/0x3cc

 stack backtrace:
 CPU: 4 PID: 168 Comm: kworker/u64:1 Not tainted 4.4.8+ #12
 Hardware name: Huawei Technologies Co., Ltd. D03/D03, BIOS 1.12 01/01/1900
 Workqueue: scsi_wq_1 sas_discover_domain
 Call trace:
 [] dump_backtrace+0x0/0x114
 [] show_stack+0x14/0x1c
 [] dump_stack+0xb4/0xf0
 [] print_usage_bug+0x210/0x2b4
 [] mark_lock+0x5fc/0x6a0
 [] __lock_acquire+0x800/0x1d00
 [] lock_acquire+0x58/0x7c
 [] _raw_spin_lock+0x44/0x58
 [] alloc_dev_quirk_v2_hw+0x48/0xec
 [] hisi_sas_dev_found+0x48/0x1b8
 [] sas_notify_lldd_dev_found+0x34/0xe0
 [] sas_discover_root_expander+0x58/0x128
 [] sas_discover_domain+0x4bc/0x564
 [] process_one_work+0x1a0/0x3cc
 [] worker_thread+0x138/0x438
 [] kthread+0xdc/0xf0
 [] ret_from_fork+0x10/0x40

Signed-off-by: Wei Xu 
Signed-off-by: John Garry 


Reviewed-by: Zhangfei Gao 


Re: [PATCH 1/3] hisi_sas: add v2 hw ACPI support

2016-06-05 Thread zhangfei



On 05/31/2016 08:38 PM, John Garry wrote:

Add support in v2 hw driver for ACPI.

A check on whether an ACPI handle is available for the device is used to
decide on whether to use ACPI reset handler or syscon for hw reset.

Signed-off-by: John Garry 
Signed-off-by: Wei Xu 


Reviewed-by: Zhangfei Gao 

Thanks


[PATCH v3 2/4] staging: r8188eu: Replace semaphore terminate_cmdthread_sema with completion

2016-06-05 Thread Binoy Jayan
The semaphore 'terminate_cmdthread_sema' is used as completion,
so convert it to struct completion.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
Acked-by: Larry Finger 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c| 6 +++---
 drivers/staging/rtl8188eu/include/rtw_cmd.h | 2 +-
 drivers/staging/rtl8188eu/os_dep/os_intfs.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index a2937e7..9e12588 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -28,7 +28,7 @@ No irqsave is necessary.
 int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
 {
init_completion(>cmd_queue_comp);
-   sema_init(&(pcmdpriv->terminate_cmdthread_sema), 0);
+   init_completion(>terminate_cmdthread_comp);
 
_rtw_init_queue(&(pcmdpriv->cmd_queue));
return _SUCCESS;
@@ -162,7 +162,7 @@ int rtw_cmd_thread(void *context)
allow_signal(SIGTERM);
 
pcmdpriv->cmdthd_running = true;
-   up(>terminate_cmdthread_sema);
+   complete(>terminate_cmdthread_comp);
 
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("start r871x 
rtw_cmd_thread \n"));
 
@@ -234,7 +234,7 @@ _next:
rtw_free_cmd_obj(pcmd);
}
 
-   up(>terminate_cmdthread_sema);
+   complete(>terminate_cmdthread_comp);
 
 
complete_and_exit(NULL, 0);
diff --git a/drivers/staging/rtl8188eu/include/rtw_cmd.h 
b/drivers/staging/rtl8188eu/include/rtw_cmd.h
index 3532dd1..2b53f58 100644
--- a/drivers/staging/rtl8188eu/include/rtw_cmd.h
+++ b/drivers/staging/rtl8188eu/include/rtw_cmd.h
@@ -40,7 +40,7 @@ struct cmd_obj {
 
 struct cmd_priv {
struct completion cmd_queue_comp;
-   struct semaphore terminate_cmdthread_sema;
+   struct completion terminate_cmdthread_comp;
struct __queue cmd_queue;
u8 cmdthd_running;
struct adapter *padapter;
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c 
b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index a696d2b..c494845 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -762,7 +762,7 @@ static int rtw_start_drv_threads(struct adapter *padapter)
err = PTR_ERR(padapter->cmdThread);
else
/* wait for cmd_thread to run */
-   _rtw_down_sema(>cmdpriv.terminate_cmdthread_sema);
+   
wait_for_completion_interruptible(>cmdpriv.terminate_cmdthread_comp);
 
return err;
 }
@@ -774,7 +774,7 @@ void rtw_stop_drv_threads(struct adapter *padapter)
/* Below is to terminate rtw_cmd_thread & event_thread... */
complete(>cmdpriv.cmd_queue_comp);
if (padapter->cmdThread)
-   _rtw_down_sema(>cmdpriv.terminate_cmdthread_sema);
+   
wait_for_completion_interruptible(>cmdpriv.terminate_cmdthread_comp);
 
 }
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v3 2/4] staging: r8188eu: Replace semaphore terminate_cmdthread_sema with completion

2016-06-05 Thread Binoy Jayan
The semaphore 'terminate_cmdthread_sema' is used as completion,
so convert it to struct completion.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
Acked-by: Larry Finger 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c| 6 +++---
 drivers/staging/rtl8188eu/include/rtw_cmd.h | 2 +-
 drivers/staging/rtl8188eu/os_dep/os_intfs.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index a2937e7..9e12588 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -28,7 +28,7 @@ No irqsave is necessary.
 int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
 {
init_completion(>cmd_queue_comp);
-   sema_init(&(pcmdpriv->terminate_cmdthread_sema), 0);
+   init_completion(>terminate_cmdthread_comp);
 
_rtw_init_queue(&(pcmdpriv->cmd_queue));
return _SUCCESS;
@@ -162,7 +162,7 @@ int rtw_cmd_thread(void *context)
allow_signal(SIGTERM);
 
pcmdpriv->cmdthd_running = true;
-   up(>terminate_cmdthread_sema);
+   complete(>terminate_cmdthread_comp);
 
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("start r871x 
rtw_cmd_thread \n"));
 
@@ -234,7 +234,7 @@ _next:
rtw_free_cmd_obj(pcmd);
}
 
-   up(>terminate_cmdthread_sema);
+   complete(>terminate_cmdthread_comp);
 
 
complete_and_exit(NULL, 0);
diff --git a/drivers/staging/rtl8188eu/include/rtw_cmd.h 
b/drivers/staging/rtl8188eu/include/rtw_cmd.h
index 3532dd1..2b53f58 100644
--- a/drivers/staging/rtl8188eu/include/rtw_cmd.h
+++ b/drivers/staging/rtl8188eu/include/rtw_cmd.h
@@ -40,7 +40,7 @@ struct cmd_obj {
 
 struct cmd_priv {
struct completion cmd_queue_comp;
-   struct semaphore terminate_cmdthread_sema;
+   struct completion terminate_cmdthread_comp;
struct __queue cmd_queue;
u8 cmdthd_running;
struct adapter *padapter;
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c 
b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index a696d2b..c494845 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -762,7 +762,7 @@ static int rtw_start_drv_threads(struct adapter *padapter)
err = PTR_ERR(padapter->cmdThread);
else
/* wait for cmd_thread to run */
-   _rtw_down_sema(>cmdpriv.terminate_cmdthread_sema);
+   
wait_for_completion_interruptible(>cmdpriv.terminate_cmdthread_comp);
 
return err;
 }
@@ -774,7 +774,7 @@ void rtw_stop_drv_threads(struct adapter *padapter)
/* Below is to terminate rtw_cmd_thread & event_thread... */
complete(>cmdpriv.cmd_queue_comp);
if (padapter->cmdThread)
-   _rtw_down_sema(>cmdpriv.terminate_cmdthread_sema);
+   
wait_for_completion_interruptible(>cmdpriv.terminate_cmdthread_comp);
 
 }
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v3 3/4] staging: r8188eu: pwrctrl_priv: Replace semaphore 'lock' with mutex

2016-06-05 Thread Binoy Jayan
The semaphore 'lock' in pwrctrl_priv is a simple mutex, so it should
be written as one. Semaphores are going away in the future.
_enter_pwrlock was using down_interruptible(), so the lock could be broken
by sending a signal. This could be a bug, because nothing checks the return
code here. Hence, using mutex_lock instead of the interruptible version.
Also, remove the now unused wrappers _init_pwrlock, _enter_pwrlock,
_exit_pwrlock and _rtw_down_sema.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
Acked-by: Larry Finger 
---
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c  | 20 ++--
 drivers/staging/rtl8188eu/include/osdep_service.h |  3 +--
 drivers/staging/rtl8188eu/include/rtw_event.h |  1 +
 drivers/staging/rtl8188eu/include/rtw_pwrctrl.h   | 17 +
 drivers/staging/rtl8188eu/os_dep/osdep_service.c  |  7 ---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c   |  8 
 6 files changed, 17 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
index 59c6d8a..0b70fe7 100644
--- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
@@ -38,7 +38,7 @@ static int rtw_hw_suspend(struct adapter *padapter)
LeaveAllPowerSaveMode(padapter);
 
DBG_88E("==> rtw_hw_suspend\n");
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
pwrpriv->bips_processing = true;
/* s1. */
if (pnetdev) {
@@ -73,7 +73,7 @@ static int rtw_hw_suspend(struct adapter *padapter)
pwrpriv->rf_pwrstate = rf_off;
pwrpriv->bips_processing = false;
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 
return 0;
 
@@ -90,12 +90,12 @@ static int rtw_hw_resume(struct adapter *padapter)
 
/* system resume */
DBG_88E("==> rtw_hw_resume\n");
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
pwrpriv->bips_processing = true;
rtw_reset_drv_sw(padapter);
 
if (pm_netdev_open(pnetdev, false) != 0) {
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
goto error_exit;
}
 
@@ -113,7 +113,7 @@ static int rtw_hw_resume(struct adapter *padapter)
pwrpriv->rf_pwrstate = rf_on;
pwrpriv->bips_processing = false;
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 
 
return 0;
@@ -138,7 +138,7 @@ void ips_enter(struct adapter *padapter)
return;
}
 
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
 
pwrpriv->bips_processing = true;
 
@@ -159,7 +159,7 @@ void ips_enter(struct adapter *padapter)
}
pwrpriv->bips_processing = false;
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 }
 
 int ips_leave(struct adapter *padapter)
@@ -171,7 +171,7 @@ int ips_leave(struct adapter *padapter)
int keyid;
 
 
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
 
if ((pwrpriv->rf_pwrstate == rf_off) && (!pwrpriv->bips_processing)) {
pwrpriv->bips_processing = true;
@@ -205,7 +205,7 @@ int ips_leave(struct adapter *padapter)
pwrpriv->bpower_saving = false;
}
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 
return result;
 }
@@ -504,7 +504,7 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 {
struct pwrctrl_priv *pwrctrlpriv = >pwrctrlpriv;
 
-   _init_pwrlock(>lock);
+   mutex_init(>mutex_lock);
pwrctrlpriv->rf_pwrstate = rf_on;
pwrctrlpriv->ips_enter_cnts = 0;
pwrctrlpriv->ips_leave_cnts = 0;
diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h 
b/drivers/staging/rtl8188eu/include/osdep_service.h
index 5475956..c53c9ea 100644
--- a/drivers/staging/rtl8188eu/include/osdep_service.h
+++ b/drivers/staging/rtl8188eu/include/osdep_service.h
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -78,8 +79,6 @@ u8 *_rtw_malloc(u32 sz);
 
 void *rtw_malloc2d(int h, int w, int size);
 
-u32  _rtw_down_sema(struct semaphore *sema);
-
 void _rtw_init_queue(struct __queue *pqueue);
 
 struct rtw_netdev_priv_indicator {
diff --git a/drivers/staging/rtl8188eu/include/rtw_event.h 
b/drivers/staging/rtl8188eu/include/rtw_event.h
index 5c34e56..0dc63f2 100644
--- a/drivers/staging/rtl8188eu/include/rtw_event.h
+++ b/drivers/staging/rtl8188eu/include/rtw_event.h
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 /*
diff --git a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h 
b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h
index 9680e2e..18a9e74 100644
--- a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h
@@ -92,21 +92,6 @@ struct reportpwrstate_parm {
unsigned short rsvd;
 

[PATCH v3 1/4] staging: r8188eu: Replace semaphore cmd_queue_sema with completion

2016-06-05 Thread Binoy Jayan
The semaphore 'cmd_queue_sema' is used as completion,
so convert it to struct completion.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
Acked-by: Larry Finger 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c| 6 +++---
 drivers/staging/rtl8188eu/include/rtw_cmd.h | 2 +-
 drivers/staging/rtl8188eu/os_dep/os_intfs.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 7748523..a2937e7 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -27,7 +27,7 @@ No irqsave is necessary.
 
 int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
 {
-   sema_init(&(pcmdpriv->cmd_queue_sema), 0);
+   init_completion(>cmd_queue_comp);
sema_init(&(pcmdpriv->terminate_cmdthread_sema), 0);
 
_rtw_init_queue(&(pcmdpriv->cmd_queue));
@@ -122,7 +122,7 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct 
cmd_obj *cmd_obj)
res = _rtw_enqueue_cmd(>cmd_queue, cmd_obj);
 
if (res == _SUCCESS)
-   up(>cmd_queue_sema);
+   complete(>cmd_queue_comp);
 
 exit:
 
@@ -167,7 +167,7 @@ int rtw_cmd_thread(void *context)
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("start r871x 
rtw_cmd_thread \n"));
 
while (1) {
-   if (_rtw_down_sema(>cmd_queue_sema) == _FAIL)
+   if 
(wait_for_completion_interruptible(>cmd_queue_comp))
break;
 
if (padapter->bDriverStopped ||
diff --git a/drivers/staging/rtl8188eu/include/rtw_cmd.h 
b/drivers/staging/rtl8188eu/include/rtw_cmd.h
index 08ca592..3532dd1 100644
--- a/drivers/staging/rtl8188eu/include/rtw_cmd.h
+++ b/drivers/staging/rtl8188eu/include/rtw_cmd.h
@@ -39,7 +39,7 @@ struct cmd_obj {
 };
 
 struct cmd_priv {
-   struct semaphore cmd_queue_sema;
+   struct completion cmd_queue_comp;
struct semaphore terminate_cmdthread_sema;
struct __queue cmd_queue;
u8 cmdthd_running;
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c 
b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index ae2caff..a696d2b 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -772,7 +772,7 @@ void rtw_stop_drv_threads(struct adapter *padapter)
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+rtw_stop_drv_threads\n"));
 
/* Below is to terminate rtw_cmd_thread & event_thread... */
-   up(>cmdpriv.cmd_queue_sema);
+   complete(>cmdpriv.cmd_queue_comp);
if (padapter->cmdThread)
_rtw_down_sema(>cmdpriv.terminate_cmdthread_sema);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v3 0/4] *** staging: r8188eu: Replace semaphores with mutexes or completions ***

2016-06-05 Thread Binoy Jayan
Hi,

These are a set of patches [v3] which removes semaphores from:

drivers/staging/rtl8188eu

These are part of a bigger effort to eliminate all semaphores 
from the linux kernel.

They build correctly (individually and as a whole).
NB: I have not tested this as I do not have the following hardware:

"Realtek RTL8188EU Wireless LAN NIC driver"

Incorporated changes w.r.t. review comments
 - Changed changelog in patch 3/4
 - Changed subject line to have driver name r8188eu
 - Removed misplaced 'i' in subject of patch 1/4

Thanks,
Binoy

Binoy Jayan (4):
  staging: r8188eu: Replace semaphore cmd_queue_sema with completion
  staging: r8188eu: Replace semaphore terminate_cmdthread_sema with
completion
  staging: r8188eu: pwrctrl_priv: Replace semaphore 'lock' with mutex
  staging: r8188eu: Remove unused semaphores

 drivers/staging/rtl8188eu/core/rtw_cmd.c  | 12 ++--
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c  | 20 ++--
 drivers/staging/rtl8188eu/core/rtw_xmit.c |  4 
 drivers/staging/rtl8188eu/include/osdep_service.h |  4 +---
 drivers/staging/rtl8188eu/include/rtw_cmd.h   |  4 ++--
 drivers/staging/rtl8188eu/include/rtw_event.h |  2 +-
 drivers/staging/rtl8188eu/include/rtw_pwrctrl.h   | 17 +
 drivers/staging/rtl8188eu/include/rtw_xmit.h  |  3 ---
 drivers/staging/rtl8188eu/os_dep/os_intfs.c   |  6 +++---
 drivers/staging/rtl8188eu/os_dep/osdep_service.c  |  7 ---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c   |  8 
 11 files changed, 28 insertions(+), 59 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v3 4/4] staging: r8188eu: Remove unused semaphores

2016-06-05 Thread Binoy Jayan
The semaphores xmit_sema, terminate_xmitthread_sema and tx_retevt
have no users, hence remove all references to them.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
Acked-by: Larry Finger 
---
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 
 drivers/staging/rtl8188eu/include/osdep_service.h | 1 -
 drivers/staging/rtl8188eu/include/rtw_event.h | 1 -
 drivers/staging/rtl8188eu/include/rtw_xmit.h  | 3 ---
 4 files changed, 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c 
b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index e0a5567..1e1b6d8 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -57,8 +57,6 @@ s32   _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct 
adapter *padapter)
/*  We don't need to memset padapter->XXX to zero, because adapter is 
allocated by vzalloc(). */
 
spin_lock_init(>lock);
-   sema_init(>xmit_sema, 0);
-   sema_init(>terminate_xmitthread_sema, 0);
 
/*
Please insert all the queue initializaiton using _rtw_init_queue below
@@ -199,8 +197,6 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct 
adapter *padapter)
 
pxmitpriv->txirp_cnt = 1;
 
-   sema_init(&(pxmitpriv->tx_retevt), 0);
-
/* per AC pending irp */
pxmitpriv->beq_cnt = 0;
pxmitpriv->bkq_cnt = 0;
diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h 
b/drivers/staging/rtl8188eu/include/osdep_service.h
index c53c9ea..6f6a8f8 100644
--- a/drivers/staging/rtl8188eu/include/osdep_service.h
+++ b/drivers/staging/rtl8188eu/include/osdep_service.h
@@ -35,7 +35,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/staging/rtl8188eu/include/rtw_event.h 
b/drivers/staging/rtl8188eu/include/rtw_event.h
index 0dc63f2..2a45581 100644
--- a/drivers/staging/rtl8188eu/include/rtw_event.h
+++ b/drivers/staging/rtl8188eu/include/rtw_event.h
@@ -18,7 +18,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/drivers/staging/rtl8188eu/include/rtw_xmit.h 
b/drivers/staging/rtl8188eu/include/rtw_xmit.h
index a0853ba..7895008 100644
--- a/drivers/staging/rtl8188eu/include/rtw_xmit.h
+++ b/drivers/staging/rtl8188eu/include/rtw_xmit.h
@@ -263,8 +263,6 @@ struct agg_pkt_info {
 
 struct xmit_priv {
spinlock_t lock;
-   struct semaphore xmit_sema;
-   struct semaphore terminate_xmitthread_sema;
struct __queue be_pending;
struct __queue bk_pending;
struct __queue vi_pending;
@@ -289,7 +287,6 @@ struct  xmit_priv {
u8  wmm_para_seq[4];/* sequence for wmm ac parameter strength
 * from large to small. it's value is 0->vo,
 * 1->vi, 2->be, 3->bk. */
-   struct semaphore tx_retevt;/* all tx return event; */
u8  txirp_cnt;/*  */
struct tasklet_struct xmit_tasklet;
/* per AC pending irp */
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v3 3/4] staging: r8188eu: pwrctrl_priv: Replace semaphore 'lock' with mutex

2016-06-05 Thread Binoy Jayan
The semaphore 'lock' in pwrctrl_priv is a simple mutex, so it should
be written as one. Semaphores are going away in the future.
_enter_pwrlock was using down_interruptible(), so the lock could be broken
by sending a signal. This could be a bug, because nothing checks the return
code here. Hence, using mutex_lock instead of the interruptible version.
Also, remove the now unused wrappers _init_pwrlock, _enter_pwrlock,
_exit_pwrlock and _rtw_down_sema.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
Acked-by: Larry Finger 
---
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c  | 20 ++--
 drivers/staging/rtl8188eu/include/osdep_service.h |  3 +--
 drivers/staging/rtl8188eu/include/rtw_event.h |  1 +
 drivers/staging/rtl8188eu/include/rtw_pwrctrl.h   | 17 +
 drivers/staging/rtl8188eu/os_dep/osdep_service.c  |  7 ---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c   |  8 
 6 files changed, 17 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
index 59c6d8a..0b70fe7 100644
--- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
@@ -38,7 +38,7 @@ static int rtw_hw_suspend(struct adapter *padapter)
LeaveAllPowerSaveMode(padapter);
 
DBG_88E("==> rtw_hw_suspend\n");
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
pwrpriv->bips_processing = true;
/* s1. */
if (pnetdev) {
@@ -73,7 +73,7 @@ static int rtw_hw_suspend(struct adapter *padapter)
pwrpriv->rf_pwrstate = rf_off;
pwrpriv->bips_processing = false;
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 
return 0;
 
@@ -90,12 +90,12 @@ static int rtw_hw_resume(struct adapter *padapter)
 
/* system resume */
DBG_88E("==> rtw_hw_resume\n");
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
pwrpriv->bips_processing = true;
rtw_reset_drv_sw(padapter);
 
if (pm_netdev_open(pnetdev, false) != 0) {
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
goto error_exit;
}
 
@@ -113,7 +113,7 @@ static int rtw_hw_resume(struct adapter *padapter)
pwrpriv->rf_pwrstate = rf_on;
pwrpriv->bips_processing = false;
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 
 
return 0;
@@ -138,7 +138,7 @@ void ips_enter(struct adapter *padapter)
return;
}
 
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
 
pwrpriv->bips_processing = true;
 
@@ -159,7 +159,7 @@ void ips_enter(struct adapter *padapter)
}
pwrpriv->bips_processing = false;
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 }
 
 int ips_leave(struct adapter *padapter)
@@ -171,7 +171,7 @@ int ips_leave(struct adapter *padapter)
int keyid;
 
 
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
 
if ((pwrpriv->rf_pwrstate == rf_off) && (!pwrpriv->bips_processing)) {
pwrpriv->bips_processing = true;
@@ -205,7 +205,7 @@ int ips_leave(struct adapter *padapter)
pwrpriv->bpower_saving = false;
}
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 
return result;
 }
@@ -504,7 +504,7 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 {
struct pwrctrl_priv *pwrctrlpriv = >pwrctrlpriv;
 
-   _init_pwrlock(>lock);
+   mutex_init(>mutex_lock);
pwrctrlpriv->rf_pwrstate = rf_on;
pwrctrlpriv->ips_enter_cnts = 0;
pwrctrlpriv->ips_leave_cnts = 0;
diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h 
b/drivers/staging/rtl8188eu/include/osdep_service.h
index 5475956..c53c9ea 100644
--- a/drivers/staging/rtl8188eu/include/osdep_service.h
+++ b/drivers/staging/rtl8188eu/include/osdep_service.h
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -78,8 +79,6 @@ u8 *_rtw_malloc(u32 sz);
 
 void *rtw_malloc2d(int h, int w, int size);
 
-u32  _rtw_down_sema(struct semaphore *sema);
-
 void _rtw_init_queue(struct __queue *pqueue);
 
 struct rtw_netdev_priv_indicator {
diff --git a/drivers/staging/rtl8188eu/include/rtw_event.h 
b/drivers/staging/rtl8188eu/include/rtw_event.h
index 5c34e56..0dc63f2 100644
--- a/drivers/staging/rtl8188eu/include/rtw_event.h
+++ b/drivers/staging/rtl8188eu/include/rtw_event.h
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 /*
diff --git a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h 
b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h
index 9680e2e..18a9e74 100644
--- a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h
@@ -92,21 +92,6 @@ struct reportpwrstate_parm {
unsigned short rsvd;
 };
 
-static inline void _init_pwrlock(struct semaphore  *plock)

[PATCH v3 1/4] staging: r8188eu: Replace semaphore cmd_queue_sema with completion

2016-06-05 Thread Binoy Jayan
The semaphore 'cmd_queue_sema' is used as completion,
so convert it to struct completion.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
Acked-by: Larry Finger 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c| 6 +++---
 drivers/staging/rtl8188eu/include/rtw_cmd.h | 2 +-
 drivers/staging/rtl8188eu/os_dep/os_intfs.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 7748523..a2937e7 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -27,7 +27,7 @@ No irqsave is necessary.
 
 int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
 {
-   sema_init(&(pcmdpriv->cmd_queue_sema), 0);
+   init_completion(>cmd_queue_comp);
sema_init(&(pcmdpriv->terminate_cmdthread_sema), 0);
 
_rtw_init_queue(&(pcmdpriv->cmd_queue));
@@ -122,7 +122,7 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct 
cmd_obj *cmd_obj)
res = _rtw_enqueue_cmd(>cmd_queue, cmd_obj);
 
if (res == _SUCCESS)
-   up(>cmd_queue_sema);
+   complete(>cmd_queue_comp);
 
 exit:
 
@@ -167,7 +167,7 @@ int rtw_cmd_thread(void *context)
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("start r871x 
rtw_cmd_thread \n"));
 
while (1) {
-   if (_rtw_down_sema(>cmd_queue_sema) == _FAIL)
+   if 
(wait_for_completion_interruptible(>cmd_queue_comp))
break;
 
if (padapter->bDriverStopped ||
diff --git a/drivers/staging/rtl8188eu/include/rtw_cmd.h 
b/drivers/staging/rtl8188eu/include/rtw_cmd.h
index 08ca592..3532dd1 100644
--- a/drivers/staging/rtl8188eu/include/rtw_cmd.h
+++ b/drivers/staging/rtl8188eu/include/rtw_cmd.h
@@ -39,7 +39,7 @@ struct cmd_obj {
 };
 
 struct cmd_priv {
-   struct semaphore cmd_queue_sema;
+   struct completion cmd_queue_comp;
struct semaphore terminate_cmdthread_sema;
struct __queue cmd_queue;
u8 cmdthd_running;
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c 
b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index ae2caff..a696d2b 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -772,7 +772,7 @@ void rtw_stop_drv_threads(struct adapter *padapter)
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+rtw_stop_drv_threads\n"));
 
/* Below is to terminate rtw_cmd_thread & event_thread... */
-   up(>cmdpriv.cmd_queue_sema);
+   complete(>cmdpriv.cmd_queue_comp);
if (padapter->cmdThread)
_rtw_down_sema(>cmdpriv.terminate_cmdthread_sema);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v3 0/4] *** staging: r8188eu: Replace semaphores with mutexes or completions ***

2016-06-05 Thread Binoy Jayan
Hi,

These are a set of patches [v3] which removes semaphores from:

drivers/staging/rtl8188eu

These are part of a bigger effort to eliminate all semaphores 
from the linux kernel.

They build correctly (individually and as a whole).
NB: I have not tested this as I do not have the following hardware:

"Realtek RTL8188EU Wireless LAN NIC driver"

Incorporated changes w.r.t. review comments
 - Changed changelog in patch 3/4
 - Changed subject line to have driver name r8188eu
 - Removed misplaced 'i' in subject of patch 1/4

Thanks,
Binoy

Binoy Jayan (4):
  staging: r8188eu: Replace semaphore cmd_queue_sema with completion
  staging: r8188eu: Replace semaphore terminate_cmdthread_sema with
completion
  staging: r8188eu: pwrctrl_priv: Replace semaphore 'lock' with mutex
  staging: r8188eu: Remove unused semaphores

 drivers/staging/rtl8188eu/core/rtw_cmd.c  | 12 ++--
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c  | 20 ++--
 drivers/staging/rtl8188eu/core/rtw_xmit.c |  4 
 drivers/staging/rtl8188eu/include/osdep_service.h |  4 +---
 drivers/staging/rtl8188eu/include/rtw_cmd.h   |  4 ++--
 drivers/staging/rtl8188eu/include/rtw_event.h |  2 +-
 drivers/staging/rtl8188eu/include/rtw_pwrctrl.h   | 17 +
 drivers/staging/rtl8188eu/include/rtw_xmit.h  |  3 ---
 drivers/staging/rtl8188eu/os_dep/os_intfs.c   |  6 +++---
 drivers/staging/rtl8188eu/os_dep/osdep_service.c  |  7 ---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c   |  8 
 11 files changed, 28 insertions(+), 59 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v3 4/4] staging: r8188eu: Remove unused semaphores

2016-06-05 Thread Binoy Jayan
The semaphores xmit_sema, terminate_xmitthread_sema and tx_retevt
have no users, hence remove all references to them.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
Acked-by: Larry Finger 
---
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 
 drivers/staging/rtl8188eu/include/osdep_service.h | 1 -
 drivers/staging/rtl8188eu/include/rtw_event.h | 1 -
 drivers/staging/rtl8188eu/include/rtw_xmit.h  | 3 ---
 4 files changed, 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c 
b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index e0a5567..1e1b6d8 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -57,8 +57,6 @@ s32   _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct 
adapter *padapter)
/*  We don't need to memset padapter->XXX to zero, because adapter is 
allocated by vzalloc(). */
 
spin_lock_init(>lock);
-   sema_init(>xmit_sema, 0);
-   sema_init(>terminate_xmitthread_sema, 0);
 
/*
Please insert all the queue initializaiton using _rtw_init_queue below
@@ -199,8 +197,6 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct 
adapter *padapter)
 
pxmitpriv->txirp_cnt = 1;
 
-   sema_init(&(pxmitpriv->tx_retevt), 0);
-
/* per AC pending irp */
pxmitpriv->beq_cnt = 0;
pxmitpriv->bkq_cnt = 0;
diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h 
b/drivers/staging/rtl8188eu/include/osdep_service.h
index c53c9ea..6f6a8f8 100644
--- a/drivers/staging/rtl8188eu/include/osdep_service.h
+++ b/drivers/staging/rtl8188eu/include/osdep_service.h
@@ -35,7 +35,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/staging/rtl8188eu/include/rtw_event.h 
b/drivers/staging/rtl8188eu/include/rtw_event.h
index 0dc63f2..2a45581 100644
--- a/drivers/staging/rtl8188eu/include/rtw_event.h
+++ b/drivers/staging/rtl8188eu/include/rtw_event.h
@@ -18,7 +18,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/drivers/staging/rtl8188eu/include/rtw_xmit.h 
b/drivers/staging/rtl8188eu/include/rtw_xmit.h
index a0853ba..7895008 100644
--- a/drivers/staging/rtl8188eu/include/rtw_xmit.h
+++ b/drivers/staging/rtl8188eu/include/rtw_xmit.h
@@ -263,8 +263,6 @@ struct agg_pkt_info {
 
 struct xmit_priv {
spinlock_t lock;
-   struct semaphore xmit_sema;
-   struct semaphore terminate_xmitthread_sema;
struct __queue be_pending;
struct __queue bk_pending;
struct __queue vi_pending;
@@ -289,7 +287,6 @@ struct  xmit_priv {
u8  wmm_para_seq[4];/* sequence for wmm ac parameter strength
 * from large to small. it's value is 0->vo,
 * 1->vi, 2->be, 3->bk. */
-   struct semaphore tx_retevt;/* all tx return event; */
u8  txirp_cnt;/*  */
struct tasklet_struct xmit_tasklet;
/* per AC pending irp */
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



Re: [PATCH 1/1 linux-next] ASoC: cs53l30: include gpio/consumer.h

2016-06-05 Thread Nicolin Chen
On Sun, Jun 05, 2016 at 03:11:00PM +0200, Fabian Frederick wrote:
> cs53l30 breaks kernel compilation when CONFIG_GPIOLIB is disabled.
> 
> sound/soc/codecs/cs53l30.c:931:2: error: implicit declaration of
> function devm_gpiod_get_optional [-Werror=implicit-function-declaration]
>   cs53l30->reset_gpio = devm_gpiod_get_optional(dev, "reset",
>   ^
> sound/soc/codecs/cs53l30.c:932:13: error: GPIOD_OUT_LOW undeclared
> (first use in this function)
> 
> Including gpio/consumer.h declares minimal functions in that case.
> 
> Signed-off-by: Fabian Frederick 
> ---
>  sound/soc/codecs/cs53l30.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sound/soc/codecs/cs53l30.c b/sound/soc/codecs/cs53l30.c
> index ac90dd7..4818324 100644
> --- a/sound/soc/codecs/cs53l30.c
> +++ b/sound/soc/codecs/cs53l30.c
> @@ -15,6 +15,7 @@
>  #include 
>  #include 
>  #include 
> +#include 

Could you put it before i2c.h to order them alphabetically?

Thank you

>  #include 
>  #include 
>  #include 
> -- 
> 2.1.4
> 


Re: [PATCH 1/1 linux-next] ASoC: cs53l30: include gpio/consumer.h

2016-06-05 Thread Nicolin Chen
On Sun, Jun 05, 2016 at 03:11:00PM +0200, Fabian Frederick wrote:
> cs53l30 breaks kernel compilation when CONFIG_GPIOLIB is disabled.
> 
> sound/soc/codecs/cs53l30.c:931:2: error: implicit declaration of
> function devm_gpiod_get_optional [-Werror=implicit-function-declaration]
>   cs53l30->reset_gpio = devm_gpiod_get_optional(dev, "reset",
>   ^
> sound/soc/codecs/cs53l30.c:932:13: error: GPIOD_OUT_LOW undeclared
> (first use in this function)
> 
> Including gpio/consumer.h declares minimal functions in that case.
> 
> Signed-off-by: Fabian Frederick 
> ---
>  sound/soc/codecs/cs53l30.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sound/soc/codecs/cs53l30.c b/sound/soc/codecs/cs53l30.c
> index ac90dd7..4818324 100644
> --- a/sound/soc/codecs/cs53l30.c
> +++ b/sound/soc/codecs/cs53l30.c
> @@ -15,6 +15,7 @@
>  #include 
>  #include 
>  #include 
> +#include 

Could you put it before i2c.h to order them alphabetically?

Thank you

>  #include 
>  #include 
>  #include 
> -- 
> 2.1.4
> 


Re: [RFC v2 1/3] block: Introduce blk_bio_map_sg() to map one bio

2016-06-05 Thread Baolin Wang
On 3 June 2016 at 22:35, Jens Axboe  wrote:
> On 05/27/2016 05:11 AM, Baolin Wang wrote:
>>
>> In dm-crypt, it need to map one bio to scatterlist for improving the
>> hardware engine encryption efficiency. Thus this patch introduces the
>> blk_bio_map_sg() function to map one bio with scatterlists.
>>
>> For avoiding the duplicated code in __blk_bios_map_sg() function, add
>> one parameter to distinguish bio map or request map.
>
>
> Just detach the bio in blk_bio_map_sg() instead of adding a separate case
> (and argument) for it in __blk_bios_map_sg().

Make sense.

>
> --
> Jens Axboe
>



-- 
Baolin.wang
Best Regards


Re: [RFC v2 1/3] block: Introduce blk_bio_map_sg() to map one bio

2016-06-05 Thread Baolin Wang
On 3 June 2016 at 22:35, Jens Axboe  wrote:
> On 05/27/2016 05:11 AM, Baolin Wang wrote:
>>
>> In dm-crypt, it need to map one bio to scatterlist for improving the
>> hardware engine encryption efficiency. Thus this patch introduces the
>> blk_bio_map_sg() function to map one bio with scatterlists.
>>
>> For avoiding the duplicated code in __blk_bios_map_sg() function, add
>> one parameter to distinguish bio map or request map.
>
>
> Just detach the bio in blk_bio_map_sg() instead of adding a separate case
> (and argument) for it in __blk_bios_map_sg().

Make sense.

>
> --
> Jens Axboe
>



-- 
Baolin.wang
Best Regards


Re: [RFC v2 1/3] block: Introduce blk_bio_map_sg() to map one bio

2016-06-05 Thread Baolin Wang
On 3 June 2016 at 22:38, Jens Axboe  wrote:
> On 05/27/2016 05:11 AM, Baolin Wang wrote:
>>
>> +/*
>> + * Map a bio to scatterlist, return number of sg entries setup. Caller
>> must
>> + * make sure sg can hold bio segments entries.
>> + */
>> +int blk_bio_map_sg(struct request_queue *q, struct bio *bio,
>> +  struct scatterlist *sglist)
>> +{
>> +   struct scatterlist *sg = NULL;
>> +   int nsegs = 0;
>> +
>> +   if (bio)
>> +   nsegs = __blk_bios_map_sg(q, bio, sglist, , true);
>> +
>> +   if (sg)
>> +   sg_mark_end(sg);
>
>
> Put that if (sg) inside the if (bio) section, 'sg' isn't going to be
> non-NULL outside of that.
>
> Additionally, who would call this with a NULL bio? That seems odd, I'd
> get rid of that check completely.

OK. I'll fix these in next version. Thanks for your comments.

-- 
Baolin.wang
Best Regards


Re: [RFC v2 1/3] block: Introduce blk_bio_map_sg() to map one bio

2016-06-05 Thread Baolin Wang
On 3 June 2016 at 22:38, Jens Axboe  wrote:
> On 05/27/2016 05:11 AM, Baolin Wang wrote:
>>
>> +/*
>> + * Map a bio to scatterlist, return number of sg entries setup. Caller
>> must
>> + * make sure sg can hold bio segments entries.
>> + */
>> +int blk_bio_map_sg(struct request_queue *q, struct bio *bio,
>> +  struct scatterlist *sglist)
>> +{
>> +   struct scatterlist *sg = NULL;
>> +   int nsegs = 0;
>> +
>> +   if (bio)
>> +   nsegs = __blk_bios_map_sg(q, bio, sglist, , true);
>> +
>> +   if (sg)
>> +   sg_mark_end(sg);
>
>
> Put that if (sg) inside the if (bio) section, 'sg' isn't going to be
> non-NULL outside of that.
>
> Additionally, who would call this with a NULL bio? That seems odd, I'd
> get rid of that check completely.

OK. I'll fix these in next version. Thanks for your comments.

-- 
Baolin.wang
Best Regards


undefined reference to `dma_common_mmap'

2016-06-05 Thread kbuild test robot
Hi,

It's probably a bug fix that unveils the link errors.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   af8c34ce6ae32addda3788d54a7e340cad22516b
commit: 420520766a796d3607639ba1e4fb1aadeadd [media] media: Kconfig: add 
dependency of HAS_DMA
date:   in the future
config: m32r-allyesconfig (attached as .config)
compiler: m32r-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 420520766a796d3607639ba1e4fb1aadeadd
# save the attached .config to linux build tree
make.cross ARCH=m32r 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `td_free':
   ohci-hcd.c:(.text+0x5f6cbc): undefined reference to `dma_pool_free'
   drivers/built-in.o: In function `ohci_endpoint_disable':
   ohci-hcd.c:(.text+0x5f7b28): undefined reference to `dma_pool_free'
   drivers/built-in.o: In function `td_alloc':
   ohci-hcd.c:(.text+0x5f7c40): undefined reference to `dma_pool_alloc'
   drivers/built-in.o: In function `ohci_stop':
   ohci-hcd.c:(.text+0x5f99e4): undefined reference to `dma_pool_destroy'
   ohci-hcd.c:(.text+0x5f99f4): undefined reference to `dma_pool_destroy'
   drivers/built-in.o: In function `ohci_setup':
   (.text+0x5f9c80): undefined reference to `dma_pool_create'
   drivers/built-in.o: In function `ohci_setup':
   (.text+0x5f9ca0): undefined reference to `dma_pool_create'
   drivers/built-in.o: In function `ohci_setup':
   (.text+0x5f9cb0): undefined reference to `dma_pool_destroy'
   drivers/built-in.o: In function `ohci_urb_enqueue':
   ohci-hcd.c:(.text+0x5fa6dc): undefined reference to `dma_pool_alloc'
   ohci-hcd.c:(.text+0x5fa728): undefined reference to `dma_pool_free'
   drivers/built-in.o: In function `ohci_platform_probe':
   ohci-platform.c:(.text+0x5fb1f8): undefined reference to `bad_dma_ops'
   ohci-platform.c:(.text+0x5fb200): undefined reference to `bad_dma_ops'
   drivers/built-in.o: In function `xhci_gen_setup':
   (.text+0x5fd1e0): undefined reference to `bad_dma_ops'
   drivers/built-in.o: In function `xhci_gen_setup':
   (.text+0x5fd1e8): undefined reference to `bad_dma_ops'
   drivers/built-in.o: In function `scratchpad_alloc':
   xhci-mem.c:(.text+0x600ce0): undefined reference to `bad_dma_ops'
   drivers/built-in.o:xhci-mem.c:(.text+0x600ce8): more undefined references to 
`bad_dma_ops' follow
   drivers/built-in.o: In function `xhci_segment_free':
   xhci-mem.c:(.text+0x600b34): undefined reference to `dma_pool_free'
   drivers/built-in.o: In function `xhci_free_container_ctx':
   xhci-mem.c:(.text+0x600b70): undefined reference to `dma_pool_free'
   drivers/built-in.o: In function `xhci_segment_alloc':
   xhci-mem.c:(.text+0x600f74): undefined reference to `dma_pool_alloc'
   drivers/built-in.o: In function `xhci_alloc_container_ctx':
   xhci-mem.c:(.text+0x601130): undefined reference to `dma_pool_alloc'
   drivers/built-in.o: In function `xhci_alloc_stream_info':
   (.text+0x603490): undefined reference to `dma_pool_alloc'
   drivers/built-in.o: In function `xhci_free_stream_info':
   (.text+0x603740): undefined reference to `dma_pool_free'
   drivers/built-in.o: In function `xhci_mem_cleanup':
   (.text+0x603d28): undefined reference to `dma_pool_destroy'
   drivers/built-in.o: In function `xhci_mem_cleanup':
   (.text+0x603d48): undefined reference to `dma_pool_destroy'
   drivers/built-in.o: In function `xhci_mem_cleanup':
   (.text+0x603d68): undefined reference to `dma_pool_destroy'
   drivers/built-in.o: In function `xhci_mem_cleanup':
   (.text+0x603d88): undefined reference to `dma_pool_destroy'
   drivers/built-in.o: In function `xhci_mem_init':
   (.text+0x604160): undefined reference to `dma_pool_create'
   drivers/built-in.o: In function `xhci_mem_init':
   (.text+0x604180): undefined reference to `dma_pool_create'
   drivers/built-in.o: In function `xhci_mem_init':
   (.text+0x6041a8): undefined reference to `dma_pool_create'
   drivers/built-in.o: In function `xhci_mem_init':
   (.text+0x6041c8): undefined reference to `dma_pool_create'
   drivers/built-in.o: In function `xhci_plat_probe':
   xhci-plat.c:(.text+0x60e774): undefined reference to `bad_dma_ops'
   xhci-plat.c:(.text+0x60e77c): undefined reference to `bad_dma_ops'
   drivers/built-in.o: In function `xhci_mtk_probe':
   xhci-mtk.c:(.text+0x60f390): undefined reference to `bad_dma_ops'
   xhci-mtk.c:(.text+0x60f394): undefined reference to `bad_dma_ops'
   drivers/built-in.o: In function `fotg210_mem_cleanup':
   fotg210-hcd.c:(.text+0x61cbac): undefined reference to `bad_dma_ops'
   drivers/built-in.o:fotg210-hcd.c:(.text+0x61cbb0): more undefined references 
to `bad_dma_ops' follow
   drivers/built-in.o: In function `end_free_itds':
   fotg210-hcd.c:(.text+0x61c764): undefined reference to `dma_pool_free'
   drivers/built-in.o: In function `qh_destroy':
   

undefined reference to `dma_common_mmap'

2016-06-05 Thread kbuild test robot
Hi,

It's probably a bug fix that unveils the link errors.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   af8c34ce6ae32addda3788d54a7e340cad22516b
commit: 420520766a796d3607639ba1e4fb1aadeadd [media] media: Kconfig: add 
dependency of HAS_DMA
date:   in the future
config: m32r-allyesconfig (attached as .config)
compiler: m32r-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 420520766a796d3607639ba1e4fb1aadeadd
# save the attached .config to linux build tree
make.cross ARCH=m32r 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `td_free':
   ohci-hcd.c:(.text+0x5f6cbc): undefined reference to `dma_pool_free'
   drivers/built-in.o: In function `ohci_endpoint_disable':
   ohci-hcd.c:(.text+0x5f7b28): undefined reference to `dma_pool_free'
   drivers/built-in.o: In function `td_alloc':
   ohci-hcd.c:(.text+0x5f7c40): undefined reference to `dma_pool_alloc'
   drivers/built-in.o: In function `ohci_stop':
   ohci-hcd.c:(.text+0x5f99e4): undefined reference to `dma_pool_destroy'
   ohci-hcd.c:(.text+0x5f99f4): undefined reference to `dma_pool_destroy'
   drivers/built-in.o: In function `ohci_setup':
   (.text+0x5f9c80): undefined reference to `dma_pool_create'
   drivers/built-in.o: In function `ohci_setup':
   (.text+0x5f9ca0): undefined reference to `dma_pool_create'
   drivers/built-in.o: In function `ohci_setup':
   (.text+0x5f9cb0): undefined reference to `dma_pool_destroy'
   drivers/built-in.o: In function `ohci_urb_enqueue':
   ohci-hcd.c:(.text+0x5fa6dc): undefined reference to `dma_pool_alloc'
   ohci-hcd.c:(.text+0x5fa728): undefined reference to `dma_pool_free'
   drivers/built-in.o: In function `ohci_platform_probe':
   ohci-platform.c:(.text+0x5fb1f8): undefined reference to `bad_dma_ops'
   ohci-platform.c:(.text+0x5fb200): undefined reference to `bad_dma_ops'
   drivers/built-in.o: In function `xhci_gen_setup':
   (.text+0x5fd1e0): undefined reference to `bad_dma_ops'
   drivers/built-in.o: In function `xhci_gen_setup':
   (.text+0x5fd1e8): undefined reference to `bad_dma_ops'
   drivers/built-in.o: In function `scratchpad_alloc':
   xhci-mem.c:(.text+0x600ce0): undefined reference to `bad_dma_ops'
   drivers/built-in.o:xhci-mem.c:(.text+0x600ce8): more undefined references to 
`bad_dma_ops' follow
   drivers/built-in.o: In function `xhci_segment_free':
   xhci-mem.c:(.text+0x600b34): undefined reference to `dma_pool_free'
   drivers/built-in.o: In function `xhci_free_container_ctx':
   xhci-mem.c:(.text+0x600b70): undefined reference to `dma_pool_free'
   drivers/built-in.o: In function `xhci_segment_alloc':
   xhci-mem.c:(.text+0x600f74): undefined reference to `dma_pool_alloc'
   drivers/built-in.o: In function `xhci_alloc_container_ctx':
   xhci-mem.c:(.text+0x601130): undefined reference to `dma_pool_alloc'
   drivers/built-in.o: In function `xhci_alloc_stream_info':
   (.text+0x603490): undefined reference to `dma_pool_alloc'
   drivers/built-in.o: In function `xhci_free_stream_info':
   (.text+0x603740): undefined reference to `dma_pool_free'
   drivers/built-in.o: In function `xhci_mem_cleanup':
   (.text+0x603d28): undefined reference to `dma_pool_destroy'
   drivers/built-in.o: In function `xhci_mem_cleanup':
   (.text+0x603d48): undefined reference to `dma_pool_destroy'
   drivers/built-in.o: In function `xhci_mem_cleanup':
   (.text+0x603d68): undefined reference to `dma_pool_destroy'
   drivers/built-in.o: In function `xhci_mem_cleanup':
   (.text+0x603d88): undefined reference to `dma_pool_destroy'
   drivers/built-in.o: In function `xhci_mem_init':
   (.text+0x604160): undefined reference to `dma_pool_create'
   drivers/built-in.o: In function `xhci_mem_init':
   (.text+0x604180): undefined reference to `dma_pool_create'
   drivers/built-in.o: In function `xhci_mem_init':
   (.text+0x6041a8): undefined reference to `dma_pool_create'
   drivers/built-in.o: In function `xhci_mem_init':
   (.text+0x6041c8): undefined reference to `dma_pool_create'
   drivers/built-in.o: In function `xhci_plat_probe':
   xhci-plat.c:(.text+0x60e774): undefined reference to `bad_dma_ops'
   xhci-plat.c:(.text+0x60e77c): undefined reference to `bad_dma_ops'
   drivers/built-in.o: In function `xhci_mtk_probe':
   xhci-mtk.c:(.text+0x60f390): undefined reference to `bad_dma_ops'
   xhci-mtk.c:(.text+0x60f394): undefined reference to `bad_dma_ops'
   drivers/built-in.o: In function `fotg210_mem_cleanup':
   fotg210-hcd.c:(.text+0x61cbac): undefined reference to `bad_dma_ops'
   drivers/built-in.o:fotg210-hcd.c:(.text+0x61cbb0): more undefined references 
to `bad_dma_ops' follow
   drivers/built-in.o: In function `end_free_itds':
   fotg210-hcd.c:(.text+0x61c764): undefined reference to `dma_pool_free'
   drivers/built-in.o: In function `qh_destroy':
   

Re: [v2] powerpc: spinlock: Fix spin_unlock_wait()

2016-06-05 Thread Boqun Feng
On Mon, Jun 06, 2016 at 02:52:05PM +1000, Michael Ellerman wrote:
> On Fri, 2016-03-06 at 03:49:48 UTC, Boqun Feng wrote:
> > There is an ordering issue with spin_unlock_wait() on powerpc, because
> > the spin_lock primitive is an ACQUIRE and an ACQUIRE is only ordering
> > the load part of the operation with memory operations following it.
> 
> ...
> > diff --git a/arch/powerpc/include/asm/spinlock.h 
> > b/arch/powerpc/include/asm/spinlock.h
> > index 523673d7583c..2ed893662866 100644
> > --- a/arch/powerpc/include/asm/spinlock.h
> > +++ b/arch/powerpc/include/asm/spinlock.h
> > @@ -162,12 +181,23 @@ static inline void arch_spin_unlock(arch_spinlock_t 
> > *lock)
> > lock->slock = 0;
> >  }
> >  
> > -#ifdef CONFIG_PPC64
> > -extern void arch_spin_unlock_wait(arch_spinlock_t *lock);
> > -#else
> > -#define arch_spin_unlock_wait(lock) \
> > -   do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
> > -#endif
> > +static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
> > +{
> > +   smp_mb();
> > +
> > +   if (!arch_spin_is_locked_sync(lock))
> > +   goto out;
> > +
> > +   while (!arch_spin_value_unlocked(*lock)) {
> > +   HMT_low();
> > +   if (SHARED_PROCESSOR)
> > +   __spin_yield(lock);
> > +   }
> > +   HMT_medium();
> > +
> > +out:
> > +   smp_mb();
> > +}
> 
> I think this would actually be easier to follow if it was all just in one 
> routine:
> 
> static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
> {
>   arch_spinlock_t lock_val;
> 
>   smp_mb();
> 
>   /*
>* Atomically load and store back the lock value (unchanged). This
>* ensures that our observation of the lock value is ordered with
>* respect to other lock operations.
>*/
>   __asm__ __volatile__(
> "1:   " PPC_LWARX(%0, 0, %2, 1) "\n"
> " stwcx. %0, 0, %2\n"
> " bne- 1b\n"
>   : "=" (lock_val), "+m" (*lock)
>   : "r" (lock)
>   : "cr0", "xer");
> 
>   if (arch_spin_value_unlocked(lock_val))
>   goto out;
> 
>   while (!arch_spin_value_unlocked(*lock)) {
>   HMT_low();
>   if (SHARED_PROCESSOR)
>   __spin_yield(lock);
>   }
>   HMT_medium();
> 
> out:
>   smp_mb();
> }
> 
> 
> Thoughts?
> 

Make sense. I admit that I sort of overdesigned by introducing
arch_spin_is_locked_sync().

This version is better, thank you!

Regards,
Boqun

> cheers


signature.asc
Description: PGP signature


Re: [PATCH 3/3] ARM: configs: keystone: Enable PINCTRL_SINGLE Config

2016-06-05 Thread Keerthy



On Monday 06 June 2016 09:07 AM, Keerthy wrote:



On Wednesday 25 May 2016 08:51 AM, Keerthy wrote:

Hi Santosh,

On Tuesday 24 May 2016 09:59 PM, Santosh Shilimkar wrote:

Hi Keerthy,

On 5/23/2016 8:56 PM, Keerthy wrote:



On Tuesday 24 May 2016 09:07 AM, Lokesh Vutla wrote:



On Monday 23 May 2016 05:59 PM, Keerthy wrote:

keystone-k2l devices use pinmux and are compliant with
PINCTRL_SINGLE.
Hence enable the config option.

Signed-off-by: Keerthy 


A similar patch[1] is already posted.

[1]https://patchwork.kernel.org/patch/8958091/


Ah I had not seen them. If they are already reviewed and closer to be
merged then Patch 2 and Patch 3 of this series can be dropped.


Once the 4.7-rc2 is out, please rebase these floating patches
against it and post a consolidated patches. I will line them
up for 4.8


Thanks for the quick response. I will wait for 4.7-rc2 and send the
re-based series.


Now the 4.7-rc2 is tagged i will be sending a consolidated series.


Santosh,

I posted a consolidated series for k2l.

Franklin,

Could you re-post k2g series on top of the series i posted today.

Regards,
Keerthy






Regards,
Keerthy



Regards,
Santosh


Re: [v2] powerpc: spinlock: Fix spin_unlock_wait()

2016-06-05 Thread Boqun Feng
On Mon, Jun 06, 2016 at 02:52:05PM +1000, Michael Ellerman wrote:
> On Fri, 2016-03-06 at 03:49:48 UTC, Boqun Feng wrote:
> > There is an ordering issue with spin_unlock_wait() on powerpc, because
> > the spin_lock primitive is an ACQUIRE and an ACQUIRE is only ordering
> > the load part of the operation with memory operations following it.
> 
> ...
> > diff --git a/arch/powerpc/include/asm/spinlock.h 
> > b/arch/powerpc/include/asm/spinlock.h
> > index 523673d7583c..2ed893662866 100644
> > --- a/arch/powerpc/include/asm/spinlock.h
> > +++ b/arch/powerpc/include/asm/spinlock.h
> > @@ -162,12 +181,23 @@ static inline void arch_spin_unlock(arch_spinlock_t 
> > *lock)
> > lock->slock = 0;
> >  }
> >  
> > -#ifdef CONFIG_PPC64
> > -extern void arch_spin_unlock_wait(arch_spinlock_t *lock);
> > -#else
> > -#define arch_spin_unlock_wait(lock) \
> > -   do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
> > -#endif
> > +static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
> > +{
> > +   smp_mb();
> > +
> > +   if (!arch_spin_is_locked_sync(lock))
> > +   goto out;
> > +
> > +   while (!arch_spin_value_unlocked(*lock)) {
> > +   HMT_low();
> > +   if (SHARED_PROCESSOR)
> > +   __spin_yield(lock);
> > +   }
> > +   HMT_medium();
> > +
> > +out:
> > +   smp_mb();
> > +}
> 
> I think this would actually be easier to follow if it was all just in one 
> routine:
> 
> static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
> {
>   arch_spinlock_t lock_val;
> 
>   smp_mb();
> 
>   /*
>* Atomically load and store back the lock value (unchanged). This
>* ensures that our observation of the lock value is ordered with
>* respect to other lock operations.
>*/
>   __asm__ __volatile__(
> "1:   " PPC_LWARX(%0, 0, %2, 1) "\n"
> " stwcx. %0, 0, %2\n"
> " bne- 1b\n"
>   : "=" (lock_val), "+m" (*lock)
>   : "r" (lock)
>   : "cr0", "xer");
> 
>   if (arch_spin_value_unlocked(lock_val))
>   goto out;
> 
>   while (!arch_spin_value_unlocked(*lock)) {
>   HMT_low();
>   if (SHARED_PROCESSOR)
>   __spin_yield(lock);
>   }
>   HMT_medium();
> 
> out:
>   smp_mb();
> }
> 
> 
> Thoughts?
> 

Make sense. I admit that I sort of overdesigned by introducing
arch_spin_is_locked_sync().

This version is better, thank you!

Regards,
Boqun

> cheers


signature.asc
Description: PGP signature


Re: [PATCH 3/3] ARM: configs: keystone: Enable PINCTRL_SINGLE Config

2016-06-05 Thread Keerthy



On Monday 06 June 2016 09:07 AM, Keerthy wrote:



On Wednesday 25 May 2016 08:51 AM, Keerthy wrote:

Hi Santosh,

On Tuesday 24 May 2016 09:59 PM, Santosh Shilimkar wrote:

Hi Keerthy,

On 5/23/2016 8:56 PM, Keerthy wrote:



On Tuesday 24 May 2016 09:07 AM, Lokesh Vutla wrote:



On Monday 23 May 2016 05:59 PM, Keerthy wrote:

keystone-k2l devices use pinmux and are compliant with
PINCTRL_SINGLE.
Hence enable the config option.

Signed-off-by: Keerthy 


A similar patch[1] is already posted.

[1]https://patchwork.kernel.org/patch/8958091/


Ah I had not seen them. If they are already reviewed and closer to be
merged then Patch 2 and Patch 3 of this series can be dropped.


Once the 4.7-rc2 is out, please rebase these floating patches
against it and post a consolidated patches. I will line them
up for 4.8


Thanks for the quick response. I will wait for 4.7-rc2 and send the
re-based series.


Now the 4.7-rc2 is tagged i will be sending a consolidated series.


Santosh,

I posted a consolidated series for k2l.

Franklin,

Could you re-post k2g series on top of the series i posted today.

Regards,
Keerthy






Regards,
Keerthy



Regards,
Santosh


Re: [PATCH net-next 1/3] arm64: bpf: implement bpf_tail_call() helper

2016-06-05 Thread Z Lim
Hi Daniel,

On Sun, Jun 5, 2016 at 12:53 AM, Daniel Borkmann <dan...@iogearbox.net> wrote:
> On 06/05/2016 01:46 AM, kbuild test robot wrote:
>>
>> Hi,
>>
>> [auto build test ERROR on net-next/master]
>>
>> url:
>> https://github.com/0day-ci/linux/commits/Zi-Shen-Lim/arm64-bpf-implement-bpf_tail_call-helper/20160605-060435
>> config: arm64-defconfig (attached as .config)
>> compiler: aarch64-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
>> reproduce:
>>  wget
>> https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
>> -O ~/bin/make.cross
>>  chmod +x ~/bin/make.cross
>>  # save the attached .config to linux build tree
>>  make.cross ARCH=arm64
>>
>> All errors (new ones prefixed by >>):
>>
>> In file included from arch/arm64/net/bpf_jit_comp.c:21:0:
>> include/linux/bpf.h: In function 'bpf_prog_get':
>>>>
>>>> include/linux/bpf.h:235:9: error: implicit declaration of function
>>>> 'ERR_PTR' [-Werror=implicit-function-declaration]
>>
>>   return ERR_PTR(-EOPNOTSUPP);
>>  ^
>> include/linux/bpf.h:235:9: warning: return makes pointer from integer
>> without a cast [-Wint-conversion]
>> In file included from include/linux/rwsem.h:17:0,
>>  from include/linux/mm_types.h:10,
>>  from include/linux/sched.h:27,
>>  from arch/arm64/include/asm/compat.h:25,
>>  from arch/arm64/include/asm/stat.h:23,
>>  from include/linux/stat.h:5,
>>  from include/linux/compat.h:12,
>>  from include/linux/filter.h:10,
>>  from arch/arm64/net/bpf_jit_comp.c:22:
>> include/linux/err.h: At top level:
>>>>
>>>> include/linux/err.h:23:35: error: conflicting types for 'ERR_PTR'
>>
>>  static inline void * __must_check ERR_PTR(long error)
>>^
>> In file included from arch/arm64/net/bpf_jit_comp.c:21:0:
>> include/linux/bpf.h:235:9: note: previous implicit declaration of
>> 'ERR_PTR' was here
>>   return ERR_PTR(-EOPNOTSUPP);
>>  ^
>> cc1: some warnings being treated as errors
>
>
> Looks like including linux/bpf.h at the very beginning causes issues when
> bpf
> syscall is disabled. We should probably just include linux/err.h from bpf.h.

How about the attached patch? Fixes compilation error on build
!CONFIG_BPF_SYSCALL.

Also, should this patch be sent to net or net-next (along with this series)?

Thanks,
z
From 0633e3e528e11b09691fbf533ba7fdaf4c52f772 Mon Sep 17 00:00:00 2001
From: Zi Shen Lim <zlim@gmail.com>
Date: Sun, 5 Jun 2016 21:43:14 -0700
Subject: [PATCH] bpf: fix missing header inclusion

Commit 0fc174dea545 ("ebpf: make internal bpf API independent of
CONFIG_BPF_SYSCALL ifdefs") introduced usage of ERR_PTR() in
bpf_prog_get(), however did not include linux/err.h.

Without this patch, when compiling arm64 BPF without CONFIG_BPF_SYSCALL:
...
In file included from arch/arm64/net/bpf_jit_comp.c:21:0:
include/linux/bpf.h: In function 'bpf_prog_get':
include/linux/bpf.h:235:9: error: implicit declaration of function 'ERR_PTR' [-Werror=implicit-function-declaration]
  return ERR_PTR(-EOPNOTSUPP);
 ^
include/linux/bpf.h:235:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
In file included from include/linux/rwsem.h:17:0,
 from include/linux/mm_types.h:10,
 from include/linux/sched.h:27,
 from arch/arm64/include/asm/compat.h:25,
 from arch/arm64/include/asm/stat.h:23,
 from include/linux/stat.h:5,
 from include/linux/compat.h:12,
 from include/linux/filter.h:10,
 from arch/arm64/net/bpf_jit_comp.c:22:
include/linux/err.h: At top level:
include/linux/err.h:23:35: error: conflicting types for 'ERR_PTR'
 static inline void * __must_check ERR_PTR(long error)
   ^
In file included from arch/arm64/net/bpf_jit_comp.c:21:0:
include/linux/bpf.h:235:9: note: previous implicit declaration of 'ERR_PTR' was here
  return ERR_PTR(-EOPNOTSUPP);
 ^
...

Fixes: 0fc174dea545 ("ebpf: make internal bpf API independent of CONFIG_BPF_SYSCALL ifdefs")
Suggested-by: Daniel Borkmann <dan...@iogearbox.net>
Signed-off-by: Zi Shen Lim <zlim@gmail.com>
---
 include/linux/bpf.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 8ee27b8..1bcae82 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct bpf_map;
 
-- 
1.9.1



Re: [PATCH net-next 1/3] arm64: bpf: implement bpf_tail_call() helper

2016-06-05 Thread Z Lim
Hi Daniel,

On Sun, Jun 5, 2016 at 12:53 AM, Daniel Borkmann  wrote:
> On 06/05/2016 01:46 AM, kbuild test robot wrote:
>>
>> Hi,
>>
>> [auto build test ERROR on net-next/master]
>>
>> url:
>> https://github.com/0day-ci/linux/commits/Zi-Shen-Lim/arm64-bpf-implement-bpf_tail_call-helper/20160605-060435
>> config: arm64-defconfig (attached as .config)
>> compiler: aarch64-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
>> reproduce:
>>  wget
>> https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
>> -O ~/bin/make.cross
>>  chmod +x ~/bin/make.cross
>>  # save the attached .config to linux build tree
>>  make.cross ARCH=arm64
>>
>> All errors (new ones prefixed by >>):
>>
>> In file included from arch/arm64/net/bpf_jit_comp.c:21:0:
>> include/linux/bpf.h: In function 'bpf_prog_get':
>>>>
>>>> include/linux/bpf.h:235:9: error: implicit declaration of function
>>>> 'ERR_PTR' [-Werror=implicit-function-declaration]
>>
>>   return ERR_PTR(-EOPNOTSUPP);
>>  ^
>> include/linux/bpf.h:235:9: warning: return makes pointer from integer
>> without a cast [-Wint-conversion]
>> In file included from include/linux/rwsem.h:17:0,
>>  from include/linux/mm_types.h:10,
>>  from include/linux/sched.h:27,
>>  from arch/arm64/include/asm/compat.h:25,
>>  from arch/arm64/include/asm/stat.h:23,
>>  from include/linux/stat.h:5,
>>  from include/linux/compat.h:12,
>>  from include/linux/filter.h:10,
>>  from arch/arm64/net/bpf_jit_comp.c:22:
>> include/linux/err.h: At top level:
>>>>
>>>> include/linux/err.h:23:35: error: conflicting types for 'ERR_PTR'
>>
>>  static inline void * __must_check ERR_PTR(long error)
>>^
>> In file included from arch/arm64/net/bpf_jit_comp.c:21:0:
>> include/linux/bpf.h:235:9: note: previous implicit declaration of
>> 'ERR_PTR' was here
>>   return ERR_PTR(-EOPNOTSUPP);
>>  ^
>> cc1: some warnings being treated as errors
>
>
> Looks like including linux/bpf.h at the very beginning causes issues when
> bpf
> syscall is disabled. We should probably just include linux/err.h from bpf.h.

How about the attached patch? Fixes compilation error on build
!CONFIG_BPF_SYSCALL.

Also, should this patch be sent to net or net-next (along with this series)?

Thanks,
z
From 0633e3e528e11b09691fbf533ba7fdaf4c52f772 Mon Sep 17 00:00:00 2001
From: Zi Shen Lim 
Date: Sun, 5 Jun 2016 21:43:14 -0700
Subject: [PATCH] bpf: fix missing header inclusion

Commit 0fc174dea545 ("ebpf: make internal bpf API independent of
CONFIG_BPF_SYSCALL ifdefs") introduced usage of ERR_PTR() in
bpf_prog_get(), however did not include linux/err.h.

Without this patch, when compiling arm64 BPF without CONFIG_BPF_SYSCALL:
...
In file included from arch/arm64/net/bpf_jit_comp.c:21:0:
include/linux/bpf.h: In function 'bpf_prog_get':
include/linux/bpf.h:235:9: error: implicit declaration of function 'ERR_PTR' [-Werror=implicit-function-declaration]
  return ERR_PTR(-EOPNOTSUPP);
 ^
include/linux/bpf.h:235:9: warning: return makes pointer from integer without a cast [-Wint-conversion]
In file included from include/linux/rwsem.h:17:0,
 from include/linux/mm_types.h:10,
 from include/linux/sched.h:27,
 from arch/arm64/include/asm/compat.h:25,
 from arch/arm64/include/asm/stat.h:23,
 from include/linux/stat.h:5,
 from include/linux/compat.h:12,
 from include/linux/filter.h:10,
 from arch/arm64/net/bpf_jit_comp.c:22:
include/linux/err.h: At top level:
include/linux/err.h:23:35: error: conflicting types for 'ERR_PTR'
 static inline void * __must_check ERR_PTR(long error)
   ^
In file included from arch/arm64/net/bpf_jit_comp.c:21:0:
include/linux/bpf.h:235:9: note: previous implicit declaration of 'ERR_PTR' was here
  return ERR_PTR(-EOPNOTSUPP);
 ^
...

Fixes: 0fc174dea545 ("ebpf: make internal bpf API independent of CONFIG_BPF_SYSCALL ifdefs")
Suggested-by: Daniel Borkmann 
Signed-off-by: Zi Shen Lim 
---
 include/linux/bpf.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 8ee27b8..1bcae82 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct bpf_map;
 
-- 
1.9.1



Re: [PATCH 00/18] Add support for FDMA DMA controller and xp70 rproc found on STi chipsets

2016-06-05 Thread Vinod Koul
On Wed, May 25, 2016 at 05:06:33PM +0100, Peter Griffin wrote:
> 
> Peter Griffin (18):
>   dmaengine: st_fdma: Add STMicroelectronics FDMA DT binding
> documentation
>   dmaengine: st_fdma:  Add STMicroelectronics FDMA driver header file
>   dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support
>   dmaengine: st_fdma: Add xp70 firmware loading mechanism.
>   dmaengine: st_fdma: Add fdma suspend and resume callbacks.

I do not see the latter two patches in this series. Something is missed here
from cover to actual patches which is bit bizarre as one tends to generate
patches and cover together

>   ARM: STi: DT: STiH407: Add FDMA driver dt nodes.
>   MAINTAINERS: Add FDMA driver files to STi section.
>   ARM: multi_v7_defconfig: Enable STi FDMA driver
>   ASoC: sti: Update DT example to match the driver code
>   ASoC: sti: Update example to include assigned-clocks and mclk-fs
>   ARM: multi_v7_defconfig: Enable STi and simple-card drivers.
>   ARM: DT: STiH407: Add i2s_out pinctrl configuration
>   ARM: DT: STiH407: Add i2s_in pinctrl configuration
>   ARM: DT: STiH407: Add spdif_out pinctrl config
>   ARM: STi: DT: STiH407: Add sti-sasg-codec dt node
>   ARM: STi: DT: STiH407: Add uniperif player dt nodes
>   ARM: STi: DT: STiH407: Add uniperif reader dt nodes
>   ARM: DT: STi: stihxxx-b2120: Add DT nodes for STi audio card
> 
>  Documentation/devicetree/bindings/dma/st_fdma.txt  |   87 ++
>  .../devicetree/bindings/sound/st,sti-asoc-card.txt |   22 +-
>  MAINTAINERS|1 +
>  arch/arm/boot/dts/stih407-family.dtsi  |  164 +++
>  arch/arm/boot/dts/stih407-pinctrl.dtsi |   55 +
>  arch/arm/boot/dts/stihxxx-b2120.dtsi   |   40 +
>  arch/arm/configs/multi_v7_defconfig|4 +
>  drivers/dma/Kconfig|   12 +
>  drivers/dma/Makefile   |1 +
>  drivers/dma/st_fdma.c  | 1203 
> 
>  drivers/dma/st_fdma.h  |  281 +
>  11 files changed, 1863 insertions(+), 7 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/dma/st_fdma.txt
>  create mode 100644 drivers/dma/st_fdma.c
>  create mode 100644 drivers/dma/st_fdma.h

-- 
~Vinod


Re: [PATCH 00/18] Add support for FDMA DMA controller and xp70 rproc found on STi chipsets

2016-06-05 Thread Vinod Koul
On Wed, May 25, 2016 at 05:06:33PM +0100, Peter Griffin wrote:
> 
> Peter Griffin (18):
>   dmaengine: st_fdma: Add STMicroelectronics FDMA DT binding
> documentation
>   dmaengine: st_fdma:  Add STMicroelectronics FDMA driver header file
>   dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support
>   dmaengine: st_fdma: Add xp70 firmware loading mechanism.
>   dmaengine: st_fdma: Add fdma suspend and resume callbacks.

I do not see the latter two patches in this series. Something is missed here
from cover to actual patches which is bit bizarre as one tends to generate
patches and cover together

>   ARM: STi: DT: STiH407: Add FDMA driver dt nodes.
>   MAINTAINERS: Add FDMA driver files to STi section.
>   ARM: multi_v7_defconfig: Enable STi FDMA driver
>   ASoC: sti: Update DT example to match the driver code
>   ASoC: sti: Update example to include assigned-clocks and mclk-fs
>   ARM: multi_v7_defconfig: Enable STi and simple-card drivers.
>   ARM: DT: STiH407: Add i2s_out pinctrl configuration
>   ARM: DT: STiH407: Add i2s_in pinctrl configuration
>   ARM: DT: STiH407: Add spdif_out pinctrl config
>   ARM: STi: DT: STiH407: Add sti-sasg-codec dt node
>   ARM: STi: DT: STiH407: Add uniperif player dt nodes
>   ARM: STi: DT: STiH407: Add uniperif reader dt nodes
>   ARM: DT: STi: stihxxx-b2120: Add DT nodes for STi audio card
> 
>  Documentation/devicetree/bindings/dma/st_fdma.txt  |   87 ++
>  .../devicetree/bindings/sound/st,sti-asoc-card.txt |   22 +-
>  MAINTAINERS|1 +
>  arch/arm/boot/dts/stih407-family.dtsi  |  164 +++
>  arch/arm/boot/dts/stih407-pinctrl.dtsi |   55 +
>  arch/arm/boot/dts/stihxxx-b2120.dtsi   |   40 +
>  arch/arm/configs/multi_v7_defconfig|4 +
>  drivers/dma/Kconfig|   12 +
>  drivers/dma/Makefile   |1 +
>  drivers/dma/st_fdma.c  | 1203 
> 
>  drivers/dma/st_fdma.h  |  281 +
>  11 files changed, 1863 insertions(+), 7 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/dma/st_fdma.txt
>  create mode 100644 drivers/dma/st_fdma.c
>  create mode 100644 drivers/dma/st_fdma.h

-- 
~Vinod


Re: [v2] powerpc: spinlock: Fix spin_unlock_wait()

2016-06-05 Thread Michael Ellerman
On Fri, 2016-03-06 at 03:49:48 UTC, Boqun Feng wrote:
> There is an ordering issue with spin_unlock_wait() on powerpc, because
> the spin_lock primitive is an ACQUIRE and an ACQUIRE is only ordering
> the load part of the operation with memory operations following it.

...
> diff --git a/arch/powerpc/include/asm/spinlock.h 
> b/arch/powerpc/include/asm/spinlock.h
> index 523673d7583c..2ed893662866 100644
> --- a/arch/powerpc/include/asm/spinlock.h
> +++ b/arch/powerpc/include/asm/spinlock.h
> @@ -162,12 +181,23 @@ static inline void arch_spin_unlock(arch_spinlock_t 
> *lock)
>   lock->slock = 0;
>  }
>  
> -#ifdef CONFIG_PPC64
> -extern void arch_spin_unlock_wait(arch_spinlock_t *lock);
> -#else
> -#define arch_spin_unlock_wait(lock) \
> - do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
> -#endif
> +static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
> +{
> + smp_mb();
> +
> + if (!arch_spin_is_locked_sync(lock))
> + goto out;
> +
> + while (!arch_spin_value_unlocked(*lock)) {
> + HMT_low();
> + if (SHARED_PROCESSOR)
> + __spin_yield(lock);
> + }
> + HMT_medium();
> +
> +out:
> + smp_mb();
> +}

I think this would actually be easier to follow if it was all just in one 
routine:

static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
{
arch_spinlock_t lock_val;

smp_mb();

/*
 * Atomically load and store back the lock value (unchanged). This
 * ensures that our observation of the lock value is ordered with
 * respect to other lock operations.
 */
__asm__ __volatile__(
"1: " PPC_LWARX(%0, 0, %2, 1) "\n"
"   stwcx. %0, 0, %2\n"
"   bne- 1b\n"
: "=" (lock_val), "+m" (*lock)
: "r" (lock)
: "cr0", "xer");

if (arch_spin_value_unlocked(lock_val))
goto out;

while (!arch_spin_value_unlocked(*lock)) {
HMT_low();
if (SHARED_PROCESSOR)
__spin_yield(lock);
}
HMT_medium();

out:
smp_mb();
}


Thoughts?

cheers


Re: [v2] powerpc: spinlock: Fix spin_unlock_wait()

2016-06-05 Thread Michael Ellerman
On Fri, 2016-03-06 at 03:49:48 UTC, Boqun Feng wrote:
> There is an ordering issue with spin_unlock_wait() on powerpc, because
> the spin_lock primitive is an ACQUIRE and an ACQUIRE is only ordering
> the load part of the operation with memory operations following it.

...
> diff --git a/arch/powerpc/include/asm/spinlock.h 
> b/arch/powerpc/include/asm/spinlock.h
> index 523673d7583c..2ed893662866 100644
> --- a/arch/powerpc/include/asm/spinlock.h
> +++ b/arch/powerpc/include/asm/spinlock.h
> @@ -162,12 +181,23 @@ static inline void arch_spin_unlock(arch_spinlock_t 
> *lock)
>   lock->slock = 0;
>  }
>  
> -#ifdef CONFIG_PPC64
> -extern void arch_spin_unlock_wait(arch_spinlock_t *lock);
> -#else
> -#define arch_spin_unlock_wait(lock) \
> - do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0)
> -#endif
> +static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
> +{
> + smp_mb();
> +
> + if (!arch_spin_is_locked_sync(lock))
> + goto out;
> +
> + while (!arch_spin_value_unlocked(*lock)) {
> + HMT_low();
> + if (SHARED_PROCESSOR)
> + __spin_yield(lock);
> + }
> + HMT_medium();
> +
> +out:
> + smp_mb();
> +}

I think this would actually be easier to follow if it was all just in one 
routine:

static inline void arch_spin_unlock_wait(arch_spinlock_t *lock)
{
arch_spinlock_t lock_val;

smp_mb();

/*
 * Atomically load and store back the lock value (unchanged). This
 * ensures that our observation of the lock value is ordered with
 * respect to other lock operations.
 */
__asm__ __volatile__(
"1: " PPC_LWARX(%0, 0, %2, 1) "\n"
"   stwcx. %0, 0, %2\n"
"   bne- 1b\n"
: "=" (lock_val), "+m" (*lock)
: "r" (lock)
: "cr0", "xer");

if (arch_spin_value_unlocked(lock_val))
goto out;

while (!arch_spin_value_unlocked(*lock)) {
HMT_low();
if (SHARED_PROCESSOR)
__spin_yield(lock);
}
HMT_medium();

out:
smp_mb();
}


Thoughts?

cheers


Re: [v2, 2/2] phy: rockchip-inno-usb2: add a new driver for Rockchip usb2phy

2016-06-05 Thread Frank Wang

Hi Heiko & Guenter,

On 2016/6/4 5:24, Heiko Stübner wrote:

Am Freitag, 3. Juni 2016, 12:59:22 schrieb Guenter Roeck:

On Thu, Jun 02, 2016 at 02:48:10PM +0800, Frank Wang wrote:

The newer SoCs (rk3366, rk3399) take a different usb-phy IP block
than rk3288 and before, and most of phy-related registers are also
different from the past, so a new phy driver is required necessarily.

Signed-off-by: Frank Wang 
---

Changes in v2:
  - Changed vbus_host operation from gpio to regulator in *_probe.
  - Improved the fault treatment relate to 480m clock register.
  - Cleaned up some meaningless codes in *_clk480m_disable.
  - made more clear the comment of *_sm_work.
  
[...]


+static struct clk *
+rockchip_usb2phy_clk480m_register(struct rockchip_usb2phy *rphy)
+{
+   struct device_node *node = rphy->dev->of_node;
+   struct clk *clk;
+   struct clk_init_data init;
+   int ret;
+
+   init.name = "clk_usbphy_480m";
+   init.ops = _usb2phy_clkout_ops;
+   init.flags = CLK_IS_ROOT;

One more comment:

include/linux/clk-provider.h:#define CLK_IS_ROOTBIT(4) /*
Deprecated: Don't use */

... and the definition has been removed in linux-next.

also, the created clock should be a child of the phy-supply clock. Please take
a look at the picophy-variant (phy-rockchip-usb) that already handles that
parent assignment.



Okay, I will refer and correct them in the next patch (patch v3) .

BR.
Frank



Re: [v2, 2/2] phy: rockchip-inno-usb2: add a new driver for Rockchip usb2phy

2016-06-05 Thread Frank Wang

Hi Heiko & Guenter,

On 2016/6/4 5:24, Heiko Stübner wrote:

Am Freitag, 3. Juni 2016, 12:59:22 schrieb Guenter Roeck:

On Thu, Jun 02, 2016 at 02:48:10PM +0800, Frank Wang wrote:

The newer SoCs (rk3366, rk3399) take a different usb-phy IP block
than rk3288 and before, and most of phy-related registers are also
different from the past, so a new phy driver is required necessarily.

Signed-off-by: Frank Wang 
---

Changes in v2:
  - Changed vbus_host operation from gpio to regulator in *_probe.
  - Improved the fault treatment relate to 480m clock register.
  - Cleaned up some meaningless codes in *_clk480m_disable.
  - made more clear the comment of *_sm_work.
  
[...]


+static struct clk *
+rockchip_usb2phy_clk480m_register(struct rockchip_usb2phy *rphy)
+{
+   struct device_node *node = rphy->dev->of_node;
+   struct clk *clk;
+   struct clk_init_data init;
+   int ret;
+
+   init.name = "clk_usbphy_480m";
+   init.ops = _usb2phy_clkout_ops;
+   init.flags = CLK_IS_ROOT;

One more comment:

include/linux/clk-provider.h:#define CLK_IS_ROOTBIT(4) /*
Deprecated: Don't use */

... and the definition has been removed in linux-next.

also, the created clock should be a child of the phy-supply clock. Please take
a look at the picophy-variant (phy-rockchip-usb) that already handles that
parent assignment.



Okay, I will refer and correct them in the next patch (patch v3) .

BR.
Frank



Re: [PATCH] locking/qspinlock: Use this_cpu_ptr instead of this_cpu_dec

2016-06-05 Thread xinhui



On 2016年06月04日 05:35, Peter Zijlstra wrote:

On Fri, Jun 03, 2016 at 05:20:10PM -0400, Waiman Long wrote:

On 06/03/2016 05:48 AM, Pan Xinhui wrote:

queued_spin_lock_slowpath should not worry about interrupt change
node->count by accident because ->count is inc and dec when we
enter/leave queued_spin_lock_slowpath.

So this_cpu_dec() does some no point things here, lets use this_cpu_ptr
for a small optimization.

Signed-off-by: Pan Xinhui
---
  kernel/locking/qspinlock.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
index 99f31e4..2b4daac 100644
--- a/kernel/locking/qspinlock.c
+++ b/kernel/locking/qspinlock.c
@@ -492,7 +492,7 @@ release:
/*
 * release the node
 */
-   this_cpu_dec(mcs_nodes[0].count);
+   this_cpu_ptr(_nodes[0])->count--;
  }
  EXPORT_SYMBOL(queued_spin_lock_slowpath);



Is this going to generate better code for PPC? For x86, I think it will
cause more instruction to be issued.



yes, ppc will do some check when restore irq flags. it's really heavy.

and yes, such change cause more instructions to be issued.

there is a RELOC_HIDE macro in this_cpu_ptr and gcc can't do optimization.
How about ICC. I once used ICC when I was in intel but i forgot the result.


It does; I think he wants __this_cpu_dec() instead, but the Changelog
needs improvement to explain why that is ok.



oh, great. __this_cpu_dec() is fine. thanks
no any irq flags save/restore again. :)

thanks
xinhui



RE: [PATCH] net: fec: fix spelling mistake "coalesed" -> "coalesced"

2016-06-05 Thread Fugang Duan
From: Colin King  Sent: Sunday, June 05, 2016 3:01 AM
> To: Fugang Duan ; net...@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Subject: [PATCH] net: fec: fix spelling mistake "coalesed" -> "coalesced"
> 
> From: Colin Ian King 
> 
> trivial fix to spelling mistake in pr_err message
> 
> Signed-off-by: Colin Ian King 
> ---
>  drivers/net/ethernet/freescale/fec_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 3c0255e..96bd210 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -2427,13 +2427,13 @@ fec_enet_set_coalesce(struct net_device *ndev,
> struct ethtool_coalesce *ec)
> 
>   cycle = fec_enet_us_to_itr_clock(ndev, fep->rx_time_itr);
>   if (cycle > 0x) {
> - pr_err("Rx coalesed usec exceeed hardware limiation");
> + pr_err("Rx coalesced usec exceeed hardware limiation");

coalesed -> coalesced, Exceeed -> exceed,  limitation-> limitation

So:
pr_err("Rx coalesced usec exceed hardware limitation \n");

>   return -EINVAL;
>   }
> 
>   cycle = fec_enet_us_to_itr_clock(ndev, fep->tx_time_itr);
>   if (cycle > 0x) {
> - pr_err("Rx coalesed usec exceeed hardware limiation");
> + pr_err("Rx coalesced usec exceeed hardware limiation");

pr_err("Rx coalesced usec exceed hardware limitation \n");

Of course, pls add "\n" terminate char for all pr_err() in . 
fec_enet_set_coalesce() function.
Thanks.

>   return -EINVAL;
>   }
> 
> --
> 2.8.1


Re: [PATCH] locking/qspinlock: Use this_cpu_ptr instead of this_cpu_dec

2016-06-05 Thread xinhui



On 2016年06月04日 05:35, Peter Zijlstra wrote:

On Fri, Jun 03, 2016 at 05:20:10PM -0400, Waiman Long wrote:

On 06/03/2016 05:48 AM, Pan Xinhui wrote:

queued_spin_lock_slowpath should not worry about interrupt change
node->count by accident because ->count is inc and dec when we
enter/leave queued_spin_lock_slowpath.

So this_cpu_dec() does some no point things here, lets use this_cpu_ptr
for a small optimization.

Signed-off-by: Pan Xinhui
---
  kernel/locking/qspinlock.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
index 99f31e4..2b4daac 100644
--- a/kernel/locking/qspinlock.c
+++ b/kernel/locking/qspinlock.c
@@ -492,7 +492,7 @@ release:
/*
 * release the node
 */
-   this_cpu_dec(mcs_nodes[0].count);
+   this_cpu_ptr(_nodes[0])->count--;
  }
  EXPORT_SYMBOL(queued_spin_lock_slowpath);



Is this going to generate better code for PPC? For x86, I think it will
cause more instruction to be issued.



yes, ppc will do some check when restore irq flags. it's really heavy.

and yes, such change cause more instructions to be issued.

there is a RELOC_HIDE macro in this_cpu_ptr and gcc can't do optimization.
How about ICC. I once used ICC when I was in intel but i forgot the result.


It does; I think he wants __this_cpu_dec() instead, but the Changelog
needs improvement to explain why that is ok.



oh, great. __this_cpu_dec() is fine. thanks
no any irq flags save/restore again. :)

thanks
xinhui



RE: [PATCH] net: fec: fix spelling mistake "coalesed" -> "coalesced"

2016-06-05 Thread Fugang Duan
From: Colin King  Sent: Sunday, June 05, 2016 3:01 AM
> To: Fugang Duan ; net...@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Subject: [PATCH] net: fec: fix spelling mistake "coalesed" -> "coalesced"
> 
> From: Colin Ian King 
> 
> trivial fix to spelling mistake in pr_err message
> 
> Signed-off-by: Colin Ian King 
> ---
>  drivers/net/ethernet/freescale/fec_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 3c0255e..96bd210 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -2427,13 +2427,13 @@ fec_enet_set_coalesce(struct net_device *ndev,
> struct ethtool_coalesce *ec)
> 
>   cycle = fec_enet_us_to_itr_clock(ndev, fep->rx_time_itr);
>   if (cycle > 0x) {
> - pr_err("Rx coalesed usec exceeed hardware limiation");
> + pr_err("Rx coalesced usec exceeed hardware limiation");

coalesed -> coalesced, Exceeed -> exceed,  limitation-> limitation

So:
pr_err("Rx coalesced usec exceed hardware limitation \n");

>   return -EINVAL;
>   }
> 
>   cycle = fec_enet_us_to_itr_clock(ndev, fep->tx_time_itr);
>   if (cycle > 0x) {
> - pr_err("Rx coalesed usec exceeed hardware limiation");
> + pr_err("Rx coalesced usec exceeed hardware limiation");

pr_err("Rx coalesced usec exceed hardware limitation \n");

Of course, pls add "\n" terminate char for all pr_err() in . 
fec_enet_set_coalesce() function.
Thanks.

>   return -EINVAL;
>   }
> 
> --
> 2.8.1


Re: [PATCH v3] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-06-05 Thread Sumit Semwal
Hi Thierry,

On 2 June 2016 at 08:44, Vinay Simha BN  wrote:
> Add support for the JDI lt070me05000 WUXGA DSI panel used in
> Nexus 7 2013 devices.
>
> Programming sequence for the panel is was originally found in the
> android-msm-flo-3.4-lollipop-release branch from:
> https://android.googlesource.com/kernel/msm.git
>
> And video mode setting is from dsi-panel-jdi-dualmipi1-video.dtsi
> file in:
> git://codeaurora.org/kernel/msm-3.10.git  LNX.LA.3.6_rb1.27
>
> Other fixes folded in were provided
> by Archit Taneja 
>
> Cc: Archit Taneja 
> [sumit.semwal: Ported to the drm/panel framework]
> Signed-off-by: Sumit Semwal 
> [jstultz: Cherry-picked to mainline, folded down other fixes
>  from Vinay and Archit]
> Signed-off-by: John Stultz 
> [vinay simha bn: removed interface setting cmd mode, video
> mode panel setting selection]
> Cc: Rob Clark 
> Signed-off-by: Vinay Simha BN 

If there aren't any more objections, could you please pick this set of
patches for your next pull request?
> --
> v2:
>  * incorporated code reviews from theiry, archit
>code style, alphabetical soring in Makefile, Kconfig, regulator_bulk,
>arrays of u8, generic helper function, documentation bindings,
>
> v3:
>  * dcs backlight support added
>  * tested this panel driver in nexus7 2013 device
> ---
BR,
Sumit.

-- 
Thanks and regards,

Sumit Semwal
Linaro Mobile Group - Kernel Team Lead
Linaro.org │ Open source software for ARM SoCs


[PATCH 1/3] ARM: dts: keystone-k2l: Add pinctrl node

2016-06-05 Thread Keerthy
Add pinctrl node and populate the pinctrl registers with the default
values.

Signed-off-by: Keerthy 
---
 arch/arm/boot/dts/keystone-k2l.dtsi | 149 
 1 file changed, 149 insertions(+)

diff --git a/arch/arm/boot/dts/keystone-k2l.dtsi 
b/arch/arm/boot/dts/keystone-k2l.dtsi
index ff22ffc..2ee3d0a 100644
--- a/arch/arm/boot/dts/keystone-k2l.dtsi
+++ b/arch/arm/boot/dts/keystone-k2l.dtsi
@@ -54,6 +54,155 @@
interrupts = ;
};
 
+   k2l_pmx: pinmux@02620690 {
+   compatible = "pinctrl-single";
+   reg = <0x02620690 0xc>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   pinctrl-single,bit-per-mux;
+   pinctrl-single,register-width = <32>;
+   pinctrl-single,function-mask = <0x1>;
+   status = "disabled";
+
+   uart3_emifa_pins: pinmux_uart3_emifa_pins {
+   pinctrl-single,bits = <
+   /* UART3_EMIFA_SEL */
+   0x0 0x0  0xc0
+   >;
+   };
+
+   uart2_emifa_pins: pinmux_uart2_emifa_pins {
+   pinctrl-single,bits = <
+   /* UART2_EMIFA_SEL */
+   0x0 0x0  0x30
+   >;
+   };
+
+   uart01_spi2_pins: pinmux_uart01_spi2_pins {
+   pinctrl-single,bits = <
+   /* UART01_SPI2_SEL */
+   0x0 0x0 0x4
+   >;
+   };
+
+   dfesync_rp1_pins: pinmux_dfesync_rp1_pins{
+   pinctrl-single,bits = <
+   /* DFESYNC_RP1_SEL */
+   0x0 0x0 0x2
+   >;
+   };
+
+   avsif_pins: pinmux_avsif_pins {
+   pinctrl-single,bits = <
+   /* AVSIF_SEL */
+   0x0 0x0 0x1
+   >;
+   };
+
+   gpio_emu_pins: pinmux_gpio_emu_pins {
+   pinctrl-single,bits = <
+   /*
+* GPIO_EMU_SEL[31]: 0-GPIO31, 1-EMU33
+* GPIO_EMU_SEL[30]: 0-GPIO30, 1-EMU32
+* GPIO_EMU_SEL[29]: 0-GPIO29, 1-EMU31
+* GPIO_EMU_SEL[28]: 0-GPIO28, 1-EMU30
+* GPIO_EMU_SEL[27]: 0-GPIO27, 1-EMU29
+* GPIO_EMU_SEL[26]: 0-GPIO26, 1-EMU28
+* GPIO_EMU_SEL[25]: 0-GPIO25, 1-EMU27
+* GPIO_EMU_SEL[24]: 0-GPIO24, 1-EMU26
+* GPIO_EMU_SEL[23]: 0-GPIO23, 1-EMU25
+* GPIO_EMU_SEL[22]: 0-GPIO22, 1-EMU24
+* GPIO_EMU_SEL[21]: 0-GPIO21, 1-EMU23
+* GPIO_EMU_SEL[20]: 0-GPIO20, 1-EMU22
+* GPIO_EMU_SEL[19]: 0-GPIO19, 1-EMU21
+* GPIO_EMU_SEL[18]: 0-GPIO18, 1-EMU20
+* GPIO_EMU_SEL[17]: 0-GPIO17, 1-EMU19
+*/
+   0x4 0x 0xFFFE
+   >;
+   };
+
+   gpio_timio_pins: pinmux_gpio_timio_pins {
+   pinctrl-single,bits = <
+   /*
+* GPIO_TIMIO_SEL[15]: 0-GPIO15, 1-TIMO7
+* GPIO_TIMIO_SEL[14]: 0-GPIO14, 1-TIMO6
+* GPIO_TIMIO_SEL[13]: 0-GPIO13, 1-TIMO5
+* GPIO_TIMIO_SEL[12]: 0-GPIO12, 1-TIMO4
+* GPIO_TIMIO_SEL[11]: 0-GPIO11, 1-TIMO3
+* GPIO_TIMIO_SEL[10]: 0-GPIO10, 1-TIMO2
+* GPIO_TIMIO_SEL[9]: 0-GPIO9, 1-TIMI7
+* GPIO_TIMIO_SEL[8]: 0-GPIO8, 1-TIMI6
+* GPIO_TIMIO_SEL[7]: 0-GPIO7, 1-TIMI5
+* GPIO_TIMIO_SEL[6]: 0-GPIO6, 1-TIMI4
+* GPIO_TIMIO_SEL[5]: 0-GPIO5, 1-TIMI3
+* GPIO_TIMIO_SEL[4]: 0-GPIO4, 1-TIMI2
+*/
+   0x4 0x0 0xFFF0
+   >;
+

Re: [PATCH v3] drm/panel: Add JDI LT070ME05000 WUXGA DSI Panel

2016-06-05 Thread Sumit Semwal
Hi Thierry,

On 2 June 2016 at 08:44, Vinay Simha BN  wrote:
> Add support for the JDI lt070me05000 WUXGA DSI panel used in
> Nexus 7 2013 devices.
>
> Programming sequence for the panel is was originally found in the
> android-msm-flo-3.4-lollipop-release branch from:
> https://android.googlesource.com/kernel/msm.git
>
> And video mode setting is from dsi-panel-jdi-dualmipi1-video.dtsi
> file in:
> git://codeaurora.org/kernel/msm-3.10.git  LNX.LA.3.6_rb1.27
>
> Other fixes folded in were provided
> by Archit Taneja 
>
> Cc: Archit Taneja 
> [sumit.semwal: Ported to the drm/panel framework]
> Signed-off-by: Sumit Semwal 
> [jstultz: Cherry-picked to mainline, folded down other fixes
>  from Vinay and Archit]
> Signed-off-by: John Stultz 
> [vinay simha bn: removed interface setting cmd mode, video
> mode panel setting selection]
> Cc: Rob Clark 
> Signed-off-by: Vinay Simha BN 

If there aren't any more objections, could you please pick this set of
patches for your next pull request?
> --
> v2:
>  * incorporated code reviews from theiry, archit
>code style, alphabetical soring in Makefile, Kconfig, regulator_bulk,
>arrays of u8, generic helper function, documentation bindings,
>
> v3:
>  * dcs backlight support added
>  * tested this panel driver in nexus7 2013 device
> ---
BR,
Sumit.

-- 
Thanks and regards,

Sumit Semwal
Linaro Mobile Group - Kernel Team Lead
Linaro.org │ Open source software for ARM SoCs


[PATCH 1/3] ARM: dts: keystone-k2l: Add pinctrl node

2016-06-05 Thread Keerthy
Add pinctrl node and populate the pinctrl registers with the default
values.

Signed-off-by: Keerthy 
---
 arch/arm/boot/dts/keystone-k2l.dtsi | 149 
 1 file changed, 149 insertions(+)

diff --git a/arch/arm/boot/dts/keystone-k2l.dtsi 
b/arch/arm/boot/dts/keystone-k2l.dtsi
index ff22ffc..2ee3d0a 100644
--- a/arch/arm/boot/dts/keystone-k2l.dtsi
+++ b/arch/arm/boot/dts/keystone-k2l.dtsi
@@ -54,6 +54,155 @@
interrupts = ;
};
 
+   k2l_pmx: pinmux@02620690 {
+   compatible = "pinctrl-single";
+   reg = <0x02620690 0xc>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   pinctrl-single,bit-per-mux;
+   pinctrl-single,register-width = <32>;
+   pinctrl-single,function-mask = <0x1>;
+   status = "disabled";
+
+   uart3_emifa_pins: pinmux_uart3_emifa_pins {
+   pinctrl-single,bits = <
+   /* UART3_EMIFA_SEL */
+   0x0 0x0  0xc0
+   >;
+   };
+
+   uart2_emifa_pins: pinmux_uart2_emifa_pins {
+   pinctrl-single,bits = <
+   /* UART2_EMIFA_SEL */
+   0x0 0x0  0x30
+   >;
+   };
+
+   uart01_spi2_pins: pinmux_uart01_spi2_pins {
+   pinctrl-single,bits = <
+   /* UART01_SPI2_SEL */
+   0x0 0x0 0x4
+   >;
+   };
+
+   dfesync_rp1_pins: pinmux_dfesync_rp1_pins{
+   pinctrl-single,bits = <
+   /* DFESYNC_RP1_SEL */
+   0x0 0x0 0x2
+   >;
+   };
+
+   avsif_pins: pinmux_avsif_pins {
+   pinctrl-single,bits = <
+   /* AVSIF_SEL */
+   0x0 0x0 0x1
+   >;
+   };
+
+   gpio_emu_pins: pinmux_gpio_emu_pins {
+   pinctrl-single,bits = <
+   /*
+* GPIO_EMU_SEL[31]: 0-GPIO31, 1-EMU33
+* GPIO_EMU_SEL[30]: 0-GPIO30, 1-EMU32
+* GPIO_EMU_SEL[29]: 0-GPIO29, 1-EMU31
+* GPIO_EMU_SEL[28]: 0-GPIO28, 1-EMU30
+* GPIO_EMU_SEL[27]: 0-GPIO27, 1-EMU29
+* GPIO_EMU_SEL[26]: 0-GPIO26, 1-EMU28
+* GPIO_EMU_SEL[25]: 0-GPIO25, 1-EMU27
+* GPIO_EMU_SEL[24]: 0-GPIO24, 1-EMU26
+* GPIO_EMU_SEL[23]: 0-GPIO23, 1-EMU25
+* GPIO_EMU_SEL[22]: 0-GPIO22, 1-EMU24
+* GPIO_EMU_SEL[21]: 0-GPIO21, 1-EMU23
+* GPIO_EMU_SEL[20]: 0-GPIO20, 1-EMU22
+* GPIO_EMU_SEL[19]: 0-GPIO19, 1-EMU21
+* GPIO_EMU_SEL[18]: 0-GPIO18, 1-EMU20
+* GPIO_EMU_SEL[17]: 0-GPIO17, 1-EMU19
+*/
+   0x4 0x 0xFFFE
+   >;
+   };
+
+   gpio_timio_pins: pinmux_gpio_timio_pins {
+   pinctrl-single,bits = <
+   /*
+* GPIO_TIMIO_SEL[15]: 0-GPIO15, 1-TIMO7
+* GPIO_TIMIO_SEL[14]: 0-GPIO14, 1-TIMO6
+* GPIO_TIMIO_SEL[13]: 0-GPIO13, 1-TIMO5
+* GPIO_TIMIO_SEL[12]: 0-GPIO12, 1-TIMO4
+* GPIO_TIMIO_SEL[11]: 0-GPIO11, 1-TIMO3
+* GPIO_TIMIO_SEL[10]: 0-GPIO10, 1-TIMO2
+* GPIO_TIMIO_SEL[9]: 0-GPIO9, 1-TIMI7
+* GPIO_TIMIO_SEL[8]: 0-GPIO8, 1-TIMI6
+* GPIO_TIMIO_SEL[7]: 0-GPIO7, 1-TIMI5
+* GPIO_TIMIO_SEL[6]: 0-GPIO6, 1-TIMI4
+* GPIO_TIMIO_SEL[5]: 0-GPIO5, 1-TIMI3
+* GPIO_TIMIO_SEL[4]: 0-GPIO4, 1-TIMI2
+*/
+   0x4 0x0 0xFFF0
+   >;
+  

Re: [PATCH v4 06/18] dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support

2016-06-05 Thread Vinod Koul
On Wed, May 25, 2016 at 05:06:40PM +0100, Peter Griffin wrote:

> @@ -527,6 +527,18 @@ config ZX_DMA
>   help
> Support the DMA engine for ZTE ZX296702 platform devices.
>  
> +config ST_FDMA
> + tristate "ST FDMA dmaengine support"
> + depends on ARCH_STI || COMPILE_TEST
> +depends on ST_XP70_REMOTEPROC
> + select DMA_ENGINE
> + select DMA_VIRTUAL_CHANNELS
> + help
> +   Enable support for ST FDMA controller.
> +   It supports 16 independent DMA channels, accepts up to 32 DMA requests
> +
> +   Say Y here if you have such a chipset.
> +   If unsure, say N.

Alphabetical order in Kconfig and makefile please...

> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

that seems to be quite a lot of headers, am sure some of them are not
required..


> +static int st_fdma_dreq_get(struct st_fdma_chan *fchan)
> +{
> + struct st_fdma_dev *fdev = fchan->fdev;
> + u32 req_line_cfg = fchan->cfg.req_line;
> + u32 dreq_line;
> + int try = 0;
> +
> + /*
> +  * dreq_mask is shared for n channels of fdma, so all accesses must be
> +  * atomic. if the dreq_mask it change between ffz ant set_bit,

s/ant/and

> + switch (ch_sta) {
> + case FDMA_CH_CMD_STA_PAUSED:
> + fchan->status = DMA_PAUSED;
> + break;

empty line here please

> +static void st_fdma_free_chan_res(struct dma_chan *chan)
> +{
> + struct st_fdma_chan *fchan = to_st_fdma_chan(chan);
> + unsigned long flags;
> +
> + LIST_HEAD(head);
> +
> + dev_dbg(fchan->fdev->dev, "%s: freeing chan:%d\n",
> + __func__, fchan->vchan.chan.chan_id);
> +
> + if (fchan->cfg.type != ST_FDMA_TYPE_FREE_RUN)
> + st_fdma_dreq_put(fchan);
> +
> + spin_lock_irqsave(>vchan.lock, flags);
> + fchan->fdesc = NULL;
> + vchan_get_all_descriptors(>vchan, );

and what are you doing with all these descriptors?

> + spin_unlock_irqrestore(>vchan.lock, flags);
> +
> + dma_pool_destroy(fchan->node_pool);
> + fchan->node_pool = NULL;
> + memset(>cfg, 0, sizeof(struct st_fdma_cfg));
> +
> + rproc_shutdown(fchan->fdev->rproc);
> +}

> +static enum dma_status st_fdma_tx_status(struct dma_chan *chan,
> +  dma_cookie_t cookie,
> +  struct dma_tx_state *txstate)
> +{
> + struct st_fdma_chan *fchan = to_st_fdma_chan(chan);
> + struct virt_dma_desc *vd;
> + enum dma_status ret;
> + unsigned long flags;
> +
> + ret = dma_cookie_status(chan, cookie, txstate);
> + if (ret == DMA_COMPLETE)

check for txtstate here, that can be NULL and in that case no need to
calculate residue

> +
> + dma_cap_set(DMA_SLAVE, fdev->dma_device.cap_mask);

why slave, you only support cyclic

> + dma_cap_set(DMA_CYCLIC, fdev->dma_device.cap_mask);
> + dma_cap_set(DMA_MEMCPY, fdev->dma_device.cap_mask);


helps to print the 'ret' too

-- 
~Vinod


Re: [PATCH v4 06/18] dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support

2016-06-05 Thread Vinod Koul
On Wed, May 25, 2016 at 05:06:40PM +0100, Peter Griffin wrote:

> @@ -527,6 +527,18 @@ config ZX_DMA
>   help
> Support the DMA engine for ZTE ZX296702 platform devices.
>  
> +config ST_FDMA
> + tristate "ST FDMA dmaengine support"
> + depends on ARCH_STI || COMPILE_TEST
> +depends on ST_XP70_REMOTEPROC
> + select DMA_ENGINE
> + select DMA_VIRTUAL_CHANNELS
> + help
> +   Enable support for ST FDMA controller.
> +   It supports 16 independent DMA channels, accepts up to 32 DMA requests
> +
> +   Say Y here if you have such a chipset.
> +   If unsure, say N.

Alphabetical order in Kconfig and makefile please...

> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

that seems to be quite a lot of headers, am sure some of them are not
required..


> +static int st_fdma_dreq_get(struct st_fdma_chan *fchan)
> +{
> + struct st_fdma_dev *fdev = fchan->fdev;
> + u32 req_line_cfg = fchan->cfg.req_line;
> + u32 dreq_line;
> + int try = 0;
> +
> + /*
> +  * dreq_mask is shared for n channels of fdma, so all accesses must be
> +  * atomic. if the dreq_mask it change between ffz ant set_bit,

s/ant/and

> + switch (ch_sta) {
> + case FDMA_CH_CMD_STA_PAUSED:
> + fchan->status = DMA_PAUSED;
> + break;

empty line here please

> +static void st_fdma_free_chan_res(struct dma_chan *chan)
> +{
> + struct st_fdma_chan *fchan = to_st_fdma_chan(chan);
> + unsigned long flags;
> +
> + LIST_HEAD(head);
> +
> + dev_dbg(fchan->fdev->dev, "%s: freeing chan:%d\n",
> + __func__, fchan->vchan.chan.chan_id);
> +
> + if (fchan->cfg.type != ST_FDMA_TYPE_FREE_RUN)
> + st_fdma_dreq_put(fchan);
> +
> + spin_lock_irqsave(>vchan.lock, flags);
> + fchan->fdesc = NULL;
> + vchan_get_all_descriptors(>vchan, );

and what are you doing with all these descriptors?

> + spin_unlock_irqrestore(>vchan.lock, flags);
> +
> + dma_pool_destroy(fchan->node_pool);
> + fchan->node_pool = NULL;
> + memset(>cfg, 0, sizeof(struct st_fdma_cfg));
> +
> + rproc_shutdown(fchan->fdev->rproc);
> +}

> +static enum dma_status st_fdma_tx_status(struct dma_chan *chan,
> +  dma_cookie_t cookie,
> +  struct dma_tx_state *txstate)
> +{
> + struct st_fdma_chan *fchan = to_st_fdma_chan(chan);
> + struct virt_dma_desc *vd;
> + enum dma_status ret;
> + unsigned long flags;
> +
> + ret = dma_cookie_status(chan, cookie, txstate);
> + if (ret == DMA_COMPLETE)

check for txtstate here, that can be NULL and in that case no need to
calculate residue

> +
> + dma_cap_set(DMA_SLAVE, fdev->dma_device.cap_mask);

why slave, you only support cyclic

> + dma_cap_set(DMA_CYCLIC, fdev->dma_device.cap_mask);
> + dma_cap_set(DMA_MEMCPY, fdev->dma_device.cap_mask);


helps to print the 'ret' too

-- 
~Vinod


[PATCH 0/3] ARM: keystone-k2l: Enable pinctrl support

2016-06-05 Thread Keerthy
The series enables pinctrl support for k2l devices.
Tested on keystone-k2l-evm board.

Franklin S Cooper Jr (1):
  ARM: configs: keystone: Enable PINCTRL_SINGLE Config

Keerthy (1):
  ARM: dts: keystone-k2l: Add pinctrl node

Lokesh Vutla (1):
  arm: mach-keystone: Enable PINCTRL config

 arch/arm/boot/dts/keystone-k2l.dtsi | 149 
 arch/arm/configs/keystone_defconfig |   1 +
 arch/arm/mach-keystone/Kconfig  |   1 +
 3 files changed, 151 insertions(+)

-- 
1.9.1



[PATCH 0/3] ARM: keystone-k2l: Enable pinctrl support

2016-06-05 Thread Keerthy
The series enables pinctrl support for k2l devices.
Tested on keystone-k2l-evm board.

Franklin S Cooper Jr (1):
  ARM: configs: keystone: Enable PINCTRL_SINGLE Config

Keerthy (1):
  ARM: dts: keystone-k2l: Add pinctrl node

Lokesh Vutla (1):
  arm: mach-keystone: Enable PINCTRL config

 arch/arm/boot/dts/keystone-k2l.dtsi | 149 
 arch/arm/configs/keystone_defconfig |   1 +
 arch/arm/mach-keystone/Kconfig  |   1 +
 3 files changed, 151 insertions(+)

-- 
1.9.1



[PATCH 3/3] ARM: configs: keystone: Enable PINCTRL_SINGLE Config

2016-06-05 Thread Keerthy
From: Franklin S Cooper Jr 

Newer Keystone 2 devices utilize pinmuxing. Enable PINCTRL SINGLE
which is used to handle pinmuxing.

Signed-off-by: Franklin S Cooper Jr 
Signed-off-by: Keerthy 
---
 arch/arm/configs/keystone_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/keystone_defconfig 
b/arch/arm/configs/keystone_defconfig
index faba04d..71b42e6 100644
--- a/arch/arm/configs/keystone_defconfig
+++ b/arch/arm/configs/keystone_defconfig
@@ -144,6 +144,7 @@ CONFIG_I2C_DAVINCI=y
 CONFIG_SPI=y
 CONFIG_SPI_DAVINCI=y
 CONFIG_SPI_SPIDEV=y
+CONFIG_PINCTRL_SINGLE=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_SYSFS=y
 CONFIG_GPIO_DAVINCI=y
-- 
1.9.1



[PATCH 2/3] arm: mach-keystone: Enable PINCTRL config

2016-06-05 Thread Keerthy
From: Lokesh Vutla 

Some Keystone 2 devices utilize pinmuxing which requires PINCTRL
to be enabled. Therefore, enable PINCTRL for all Keystone 2 devices.

Signed-off-by: Lokesh Vutla 
Signed-off-by: Franklin S Cooper Jr 
Signed-off-by: Dave Gerlach 
Signed-off-by: Keerthy 
---
 arch/arm/mach-keystone/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-keystone/Kconfig b/arch/arm/mach-keystone/Kconfig
index ea955f6db..7a432ee 100644
--- a/arch/arm/mach-keystone/Kconfig
+++ b/arch/arm/mach-keystone/Kconfig
@@ -11,6 +11,7 @@ config ARCH_KEYSTONE
select ZONE_DMA if ARM_LPAE
select MIGHT_HAVE_PCI
select PCI_DOMAINS if PCI
+   select PINCTRL
help
  Support for boards based on the Texas Instruments Keystone family of
  SoCs.
-- 
1.9.1



[PATCH 3/3] ARM: configs: keystone: Enable PINCTRL_SINGLE Config

2016-06-05 Thread Keerthy
From: Franklin S Cooper Jr 

Newer Keystone 2 devices utilize pinmuxing. Enable PINCTRL SINGLE
which is used to handle pinmuxing.

Signed-off-by: Franklin S Cooper Jr 
Signed-off-by: Keerthy 
---
 arch/arm/configs/keystone_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/keystone_defconfig 
b/arch/arm/configs/keystone_defconfig
index faba04d..71b42e6 100644
--- a/arch/arm/configs/keystone_defconfig
+++ b/arch/arm/configs/keystone_defconfig
@@ -144,6 +144,7 @@ CONFIG_I2C_DAVINCI=y
 CONFIG_SPI=y
 CONFIG_SPI_DAVINCI=y
 CONFIG_SPI_SPIDEV=y
+CONFIG_PINCTRL_SINGLE=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_SYSFS=y
 CONFIG_GPIO_DAVINCI=y
-- 
1.9.1



[PATCH 2/3] arm: mach-keystone: Enable PINCTRL config

2016-06-05 Thread Keerthy
From: Lokesh Vutla 

Some Keystone 2 devices utilize pinmuxing which requires PINCTRL
to be enabled. Therefore, enable PINCTRL for all Keystone 2 devices.

Signed-off-by: Lokesh Vutla 
Signed-off-by: Franklin S Cooper Jr 
Signed-off-by: Dave Gerlach 
Signed-off-by: Keerthy 
---
 arch/arm/mach-keystone/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-keystone/Kconfig b/arch/arm/mach-keystone/Kconfig
index ea955f6db..7a432ee 100644
--- a/arch/arm/mach-keystone/Kconfig
+++ b/arch/arm/mach-keystone/Kconfig
@@ -11,6 +11,7 @@ config ARCH_KEYSTONE
select ZONE_DMA if ARM_LPAE
select MIGHT_HAVE_PCI
select PCI_DOMAINS if PCI
+   select PINCTRL
help
  Support for boards based on the Texas Instruments Keystone family of
  SoCs.
-- 
1.9.1



Re: [v2, 2/2] phy: rockchip-inno-usb2: add a new driver for Rockchip usb2phy

2016-06-05 Thread Frank Wang

Hi Guenter,

On 2016/6/4 3:57, Guenter Roeck wrote:

On Thu, Jun 02, 2016 at 02:48:10PM +0800, Frank Wang wrote:

The newer SoCs (rk3366, rk3399) take a different usb-phy IP block
than rk3288 and before, and most of phy-related registers are also
different from the past, so a new phy driver is required necessarily.

Signed-off-by: Frank Wang 
---

Changes in v2:
  - Changed vbus_host operation from gpio to regulator in *_probe.
  - Improved the fault treatment relate to 480m clock register.
  - Cleaned up some meaningless codes in *_clk480m_disable.
  - made more clear the comment of *_sm_work.

  drivers/phy/Kconfig  |7 +
  drivers/phy/Makefile |1 +
  drivers/phy/phy-rockchip-inno-usb2.c |  604 ++
  3 files changed, 612 insertions(+)
  create mode 100644 drivers/phy/phy-rockchip-inno-usb2.c

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index b869b98..29ef15c 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -347,6 +347,13 @@ config PHY_ROCKCHIP_USB
help
  Enable this to support the Rockchip USB 2.0 PHY.

+config PHY_ROCKCHIP_INNO_USB2
+   tristate "Rockchip INNO USB2PHY Driver"
+   depends on ARCH_ROCKCHIP && OF
+   select GENERIC_PHY
+   help
+ Support for Rockchip USB2.0 PHY with Innosilicon IP block.
+
  config PHY_ROCKCHIP_EMMC
tristate "Rockchip EMMC PHY Driver"
depends on ARCH_ROCKCHIP && OF
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 9c3e73c..4963fbc 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -38,6 +38,7 @@ phy-exynos-usb2-$(CONFIG_PHY_S5PV210_USB2)+= 
phy-s5pv210-usb2.o
  obj-$(CONFIG_PHY_EXYNOS5_USBDRD)  += phy-exynos5-usbdrd.o
  obj-$(CONFIG_PHY_QCOM_APQ8064_SATA)   += phy-qcom-apq8064-sata.o
  obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o
+obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2)   += phy-rockchip-inno-usb2.o
  obj-$(CONFIG_PHY_ROCKCHIP_EMMC) += phy-rockchip-emmc.o
  obj-$(CONFIG_PHY_ROCKCHIP_DP) += phy-rockchip-dp.o
  obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)   += phy-qcom-ipq806x-sata.o
diff --git a/drivers/phy/phy-rockchip-inno-usb2.c 
b/drivers/phy/phy-rockchip-inno-usb2.c
new file mode 100644
index 000..eca46ff
--- /dev/null
+++ b/drivers/phy/phy-rockchip-inno-usb2.c
@@ -0,0 +1,604 @@
+/*
+ * Rockchip USB2.0 PHY with Innosilicon IP block driver
+ *
+ * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define BIT_WRITEABLE_SHIFT16
+#define SCHEDULE_DELAY (60 * HZ)
+
+enum rockchip_usb2phy_port_id {
+   USB2PHY_PORT_OTG,
+   USB2PHY_PORT_HOST,
+   USB2PHY_NUM_PORTS,
+};
+
+enum rockchip_usb2phy_host_state {
+   PHY_STATE_HS_ONLINE = 0,
+   PHY_STATE_DISCONNECT= 1,
+   PHY_STATE_HS_CONNECT= 2,
+   PHY_STATE_FS_CONNECT= 4,
+};
+
+struct usb2phy_reg {
+   unsigned intoffset;
+   unsigned intbitend;
+   unsigned intbitstart;
+   unsigned intdisable;
+   unsigned intenable;
+};
+
+/**
+ * struct rockchip_usb2phy_port_cfg: usb-phy port configuration.
+ * @phy_sus: phy suspend register.
+ * @ls_det_en: linestate detection enable register.
+ * @ls_det_st: linestate detection state register.
+ * @ls_det_clr: linestate detection clear register.
+ * @utmi_ls: utmi linestate state register.
+ * @utmi_hstdet: utmi host disconnect register.
+ */
+struct rockchip_usb2phy_port_cfg {
+   struct usb2phy_reg  phy_sus;
+   struct usb2phy_reg  ls_det_en;
+   struct usb2phy_reg  ls_det_st;
+   struct usb2phy_reg  ls_det_clr;
+   struct usb2phy_reg  utmi_ls;
+   struct usb2phy_reg  utmi_hstdet;
+};
+
+/**
+ * struct rockchip_usb2phy_cfg: usb-phy configuration.
+ * @num_ports: specify how many ports that the phy has.
+ * @clkout_ctl: keep on/turn off output clk of phy.
+ */
+struct rockchip_usb2phy_cfg {
+   unsigned intnum_ports;
+   struct usb2phy_reg  clkout_ctl;
+   const struct rockchip_usb2phy_port_cfg  *port_cfgs;
+};
+
+/**
+ * struct rockchip_usb2phy_port: usb-phy port data.
+ * @port_id: flag for otg port or host port.
+ * @suspended: phy suspended flag.
+ * @ls_irq: IRQ number assigned for linestate detection.
+ * @mutex: for register updating in 

Re: [v2, 2/2] phy: rockchip-inno-usb2: add a new driver for Rockchip usb2phy

2016-06-05 Thread Frank Wang

Hi Guenter,

On 2016/6/4 3:57, Guenter Roeck wrote:

On Thu, Jun 02, 2016 at 02:48:10PM +0800, Frank Wang wrote:

The newer SoCs (rk3366, rk3399) take a different usb-phy IP block
than rk3288 and before, and most of phy-related registers are also
different from the past, so a new phy driver is required necessarily.

Signed-off-by: Frank Wang 
---

Changes in v2:
  - Changed vbus_host operation from gpio to regulator in *_probe.
  - Improved the fault treatment relate to 480m clock register.
  - Cleaned up some meaningless codes in *_clk480m_disable.
  - made more clear the comment of *_sm_work.

  drivers/phy/Kconfig  |7 +
  drivers/phy/Makefile |1 +
  drivers/phy/phy-rockchip-inno-usb2.c |  604 ++
  3 files changed, 612 insertions(+)
  create mode 100644 drivers/phy/phy-rockchip-inno-usb2.c

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index b869b98..29ef15c 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -347,6 +347,13 @@ config PHY_ROCKCHIP_USB
help
  Enable this to support the Rockchip USB 2.0 PHY.

+config PHY_ROCKCHIP_INNO_USB2
+   tristate "Rockchip INNO USB2PHY Driver"
+   depends on ARCH_ROCKCHIP && OF
+   select GENERIC_PHY
+   help
+ Support for Rockchip USB2.0 PHY with Innosilicon IP block.
+
  config PHY_ROCKCHIP_EMMC
tristate "Rockchip EMMC PHY Driver"
depends on ARCH_ROCKCHIP && OF
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 9c3e73c..4963fbc 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -38,6 +38,7 @@ phy-exynos-usb2-$(CONFIG_PHY_S5PV210_USB2)+= 
phy-s5pv210-usb2.o
  obj-$(CONFIG_PHY_EXYNOS5_USBDRD)  += phy-exynos5-usbdrd.o
  obj-$(CONFIG_PHY_QCOM_APQ8064_SATA)   += phy-qcom-apq8064-sata.o
  obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o
+obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2)   += phy-rockchip-inno-usb2.o
  obj-$(CONFIG_PHY_ROCKCHIP_EMMC) += phy-rockchip-emmc.o
  obj-$(CONFIG_PHY_ROCKCHIP_DP) += phy-rockchip-dp.o
  obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)   += phy-qcom-ipq806x-sata.o
diff --git a/drivers/phy/phy-rockchip-inno-usb2.c 
b/drivers/phy/phy-rockchip-inno-usb2.c
new file mode 100644
index 000..eca46ff
--- /dev/null
+++ b/drivers/phy/phy-rockchip-inno-usb2.c
@@ -0,0 +1,604 @@
+/*
+ * Rockchip USB2.0 PHY with Innosilicon IP block driver
+ *
+ * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define BIT_WRITEABLE_SHIFT16
+#define SCHEDULE_DELAY (60 * HZ)
+
+enum rockchip_usb2phy_port_id {
+   USB2PHY_PORT_OTG,
+   USB2PHY_PORT_HOST,
+   USB2PHY_NUM_PORTS,
+};
+
+enum rockchip_usb2phy_host_state {
+   PHY_STATE_HS_ONLINE = 0,
+   PHY_STATE_DISCONNECT= 1,
+   PHY_STATE_HS_CONNECT= 2,
+   PHY_STATE_FS_CONNECT= 4,
+};
+
+struct usb2phy_reg {
+   unsigned intoffset;
+   unsigned intbitend;
+   unsigned intbitstart;
+   unsigned intdisable;
+   unsigned intenable;
+};
+
+/**
+ * struct rockchip_usb2phy_port_cfg: usb-phy port configuration.
+ * @phy_sus: phy suspend register.
+ * @ls_det_en: linestate detection enable register.
+ * @ls_det_st: linestate detection state register.
+ * @ls_det_clr: linestate detection clear register.
+ * @utmi_ls: utmi linestate state register.
+ * @utmi_hstdet: utmi host disconnect register.
+ */
+struct rockchip_usb2phy_port_cfg {
+   struct usb2phy_reg  phy_sus;
+   struct usb2phy_reg  ls_det_en;
+   struct usb2phy_reg  ls_det_st;
+   struct usb2phy_reg  ls_det_clr;
+   struct usb2phy_reg  utmi_ls;
+   struct usb2phy_reg  utmi_hstdet;
+};
+
+/**
+ * struct rockchip_usb2phy_cfg: usb-phy configuration.
+ * @num_ports: specify how many ports that the phy has.
+ * @clkout_ctl: keep on/turn off output clk of phy.
+ */
+struct rockchip_usb2phy_cfg {
+   unsigned intnum_ports;
+   struct usb2phy_reg  clkout_ctl;
+   const struct rockchip_usb2phy_port_cfg  *port_cfgs;
+};
+
+/**
+ * struct rockchip_usb2phy_port: usb-phy port data.
+ * @port_id: flag for otg port or host port.
+ * @suspended: phy suspended flag.
+ * @ls_irq: IRQ number assigned for linestate detection.
+ * @mutex: for register updating in sm_work.
+ * @sm_work: OTG 

[PATCH v2 3/4] rtl8188eu: pwrctrl_priv: Replace semaphore 'lock' with mutex

2016-06-05 Thread Binoy Jayan
The semaphore 'lock' in pwrctrl_priv is a simple mutex, so it should
be written as one. Semaphores are going away in the future.
_enter_pwrlock was using down_interruptible(), so the lock could be broken
by sending a signal. This could be a bug, because nothing checks the return
code here. Hence, using mutex_lock instead of the interruptible version.
Also, remove the now unused wrappers _init_pwrlock, _enter_pwrlock,
_exit_pwrlock and _rtw_down_sema.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
---
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c  | 20 ++--
 drivers/staging/rtl8188eu/include/osdep_service.h |  3 +--
 drivers/staging/rtl8188eu/include/rtw_event.h |  1 +
 drivers/staging/rtl8188eu/include/rtw_pwrctrl.h   | 17 +
 drivers/staging/rtl8188eu/os_dep/osdep_service.c  |  7 ---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c   |  8 
 6 files changed, 17 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
index 59c6d8a..0b70fe7 100644
--- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
@@ -38,7 +38,7 @@ static int rtw_hw_suspend(struct adapter *padapter)
LeaveAllPowerSaveMode(padapter);
 
DBG_88E("==> rtw_hw_suspend\n");
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
pwrpriv->bips_processing = true;
/* s1. */
if (pnetdev) {
@@ -73,7 +73,7 @@ static int rtw_hw_suspend(struct adapter *padapter)
pwrpriv->rf_pwrstate = rf_off;
pwrpriv->bips_processing = false;
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 
return 0;
 
@@ -90,12 +90,12 @@ static int rtw_hw_resume(struct adapter *padapter)
 
/* system resume */
DBG_88E("==> rtw_hw_resume\n");
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
pwrpriv->bips_processing = true;
rtw_reset_drv_sw(padapter);
 
if (pm_netdev_open(pnetdev, false) != 0) {
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
goto error_exit;
}
 
@@ -113,7 +113,7 @@ static int rtw_hw_resume(struct adapter *padapter)
pwrpriv->rf_pwrstate = rf_on;
pwrpriv->bips_processing = false;
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 
 
return 0;
@@ -138,7 +138,7 @@ void ips_enter(struct adapter *padapter)
return;
}
 
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
 
pwrpriv->bips_processing = true;
 
@@ -159,7 +159,7 @@ void ips_enter(struct adapter *padapter)
}
pwrpriv->bips_processing = false;
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 }
 
 int ips_leave(struct adapter *padapter)
@@ -171,7 +171,7 @@ int ips_leave(struct adapter *padapter)
int keyid;
 
 
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
 
if ((pwrpriv->rf_pwrstate == rf_off) && (!pwrpriv->bips_processing)) {
pwrpriv->bips_processing = true;
@@ -205,7 +205,7 @@ int ips_leave(struct adapter *padapter)
pwrpriv->bpower_saving = false;
}
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 
return result;
 }
@@ -504,7 +504,7 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 {
struct pwrctrl_priv *pwrctrlpriv = >pwrctrlpriv;
 
-   _init_pwrlock(>lock);
+   mutex_init(>mutex_lock);
pwrctrlpriv->rf_pwrstate = rf_on;
pwrctrlpriv->ips_enter_cnts = 0;
pwrctrlpriv->ips_leave_cnts = 0;
diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h 
b/drivers/staging/rtl8188eu/include/osdep_service.h
index 5475956..c53c9ea 100644
--- a/drivers/staging/rtl8188eu/include/osdep_service.h
+++ b/drivers/staging/rtl8188eu/include/osdep_service.h
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -78,8 +79,6 @@ u8 *_rtw_malloc(u32 sz);
 
 void *rtw_malloc2d(int h, int w, int size);
 
-u32  _rtw_down_sema(struct semaphore *sema);
-
 void _rtw_init_queue(struct __queue *pqueue);
 
 struct rtw_netdev_priv_indicator {
diff --git a/drivers/staging/rtl8188eu/include/rtw_event.h 
b/drivers/staging/rtl8188eu/include/rtw_event.h
index 5c34e56..0dc63f2 100644
--- a/drivers/staging/rtl8188eu/include/rtw_event.h
+++ b/drivers/staging/rtl8188eu/include/rtw_event.h
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 /*
diff --git a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h 
b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h
index 9680e2e..18a9e74 100644
--- a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h
@@ -92,21 +92,6 @@ struct reportpwrstate_parm {
unsigned short rsvd;
 };
 
-static inline void _init_pwrlock(struct 

[PATCH v2 3/4] rtl8188eu: pwrctrl_priv: Replace semaphore 'lock' with mutex

2016-06-05 Thread Binoy Jayan
The semaphore 'lock' in pwrctrl_priv is a simple mutex, so it should
be written as one. Semaphores are going away in the future.
_enter_pwrlock was using down_interruptible(), so the lock could be broken
by sending a signal. This could be a bug, because nothing checks the return
code here. Hence, using mutex_lock instead of the interruptible version.
Also, remove the now unused wrappers _init_pwrlock, _enter_pwrlock,
_exit_pwrlock and _rtw_down_sema.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
---
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c  | 20 ++--
 drivers/staging/rtl8188eu/include/osdep_service.h |  3 +--
 drivers/staging/rtl8188eu/include/rtw_event.h |  1 +
 drivers/staging/rtl8188eu/include/rtw_pwrctrl.h   | 17 +
 drivers/staging/rtl8188eu/os_dep/osdep_service.c  |  7 ---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c   |  8 
 6 files changed, 17 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
index 59c6d8a..0b70fe7 100644
--- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
@@ -38,7 +38,7 @@ static int rtw_hw_suspend(struct adapter *padapter)
LeaveAllPowerSaveMode(padapter);
 
DBG_88E("==> rtw_hw_suspend\n");
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
pwrpriv->bips_processing = true;
/* s1. */
if (pnetdev) {
@@ -73,7 +73,7 @@ static int rtw_hw_suspend(struct adapter *padapter)
pwrpriv->rf_pwrstate = rf_off;
pwrpriv->bips_processing = false;
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 
return 0;
 
@@ -90,12 +90,12 @@ static int rtw_hw_resume(struct adapter *padapter)
 
/* system resume */
DBG_88E("==> rtw_hw_resume\n");
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
pwrpriv->bips_processing = true;
rtw_reset_drv_sw(padapter);
 
if (pm_netdev_open(pnetdev, false) != 0) {
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
goto error_exit;
}
 
@@ -113,7 +113,7 @@ static int rtw_hw_resume(struct adapter *padapter)
pwrpriv->rf_pwrstate = rf_on;
pwrpriv->bips_processing = false;
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 
 
return 0;
@@ -138,7 +138,7 @@ void ips_enter(struct adapter *padapter)
return;
}
 
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
 
pwrpriv->bips_processing = true;
 
@@ -159,7 +159,7 @@ void ips_enter(struct adapter *padapter)
}
pwrpriv->bips_processing = false;
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 }
 
 int ips_leave(struct adapter *padapter)
@@ -171,7 +171,7 @@ int ips_leave(struct adapter *padapter)
int keyid;
 
 
-   _enter_pwrlock(>lock);
+   mutex_lock(>mutex_lock);
 
if ((pwrpriv->rf_pwrstate == rf_off) && (!pwrpriv->bips_processing)) {
pwrpriv->bips_processing = true;
@@ -205,7 +205,7 @@ int ips_leave(struct adapter *padapter)
pwrpriv->bpower_saving = false;
}
 
-   _exit_pwrlock(>lock);
+   mutex_unlock(>mutex_lock);
 
return result;
 }
@@ -504,7 +504,7 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 {
struct pwrctrl_priv *pwrctrlpriv = >pwrctrlpriv;
 
-   _init_pwrlock(>lock);
+   mutex_init(>mutex_lock);
pwrctrlpriv->rf_pwrstate = rf_on;
pwrctrlpriv->ips_enter_cnts = 0;
pwrctrlpriv->ips_leave_cnts = 0;
diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h 
b/drivers/staging/rtl8188eu/include/osdep_service.h
index 5475956..c53c9ea 100644
--- a/drivers/staging/rtl8188eu/include/osdep_service.h
+++ b/drivers/staging/rtl8188eu/include/osdep_service.h
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -78,8 +79,6 @@ u8 *_rtw_malloc(u32 sz);
 
 void *rtw_malloc2d(int h, int w, int size);
 
-u32  _rtw_down_sema(struct semaphore *sema);
-
 void _rtw_init_queue(struct __queue *pqueue);
 
 struct rtw_netdev_priv_indicator {
diff --git a/drivers/staging/rtl8188eu/include/rtw_event.h 
b/drivers/staging/rtl8188eu/include/rtw_event.h
index 5c34e56..0dc63f2 100644
--- a/drivers/staging/rtl8188eu/include/rtw_event.h
+++ b/drivers/staging/rtl8188eu/include/rtw_event.h
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 /*
diff --git a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h 
b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h
index 9680e2e..18a9e74 100644
--- a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h
@@ -92,21 +92,6 @@ struct reportpwrstate_parm {
unsigned short rsvd;
 };
 
-static inline void _init_pwrlock(struct semaphore  *plock)
-{
-   

[PATCH v2 4/4] rtl8188eu: Remove unused semaphores

2016-06-05 Thread Binoy Jayan
The semaphores xmit_sema, terminate_xmitthread_sema and tx_retevt
have no users, hence remove all references to them.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
---
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 
 drivers/staging/rtl8188eu/include/osdep_service.h | 1 -
 drivers/staging/rtl8188eu/include/rtw_event.h | 1 -
 drivers/staging/rtl8188eu/include/rtw_xmit.h  | 3 ---
 4 files changed, 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c 
b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index e0a5567..1e1b6d8 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -57,8 +57,6 @@ s32   _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct 
adapter *padapter)
/*  We don't need to memset padapter->XXX to zero, because adapter is 
allocated by vzalloc(). */
 
spin_lock_init(>lock);
-   sema_init(>xmit_sema, 0);
-   sema_init(>terminate_xmitthread_sema, 0);
 
/*
Please insert all the queue initializaiton using _rtw_init_queue below
@@ -199,8 +197,6 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct 
adapter *padapter)
 
pxmitpriv->txirp_cnt = 1;
 
-   sema_init(&(pxmitpriv->tx_retevt), 0);
-
/* per AC pending irp */
pxmitpriv->beq_cnt = 0;
pxmitpriv->bkq_cnt = 0;
diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h 
b/drivers/staging/rtl8188eu/include/osdep_service.h
index c53c9ea..6f6a8f8 100644
--- a/drivers/staging/rtl8188eu/include/osdep_service.h
+++ b/drivers/staging/rtl8188eu/include/osdep_service.h
@@ -35,7 +35,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/staging/rtl8188eu/include/rtw_event.h 
b/drivers/staging/rtl8188eu/include/rtw_event.h
index 0dc63f2..2a45581 100644
--- a/drivers/staging/rtl8188eu/include/rtw_event.h
+++ b/drivers/staging/rtl8188eu/include/rtw_event.h
@@ -18,7 +18,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/drivers/staging/rtl8188eu/include/rtw_xmit.h 
b/drivers/staging/rtl8188eu/include/rtw_xmit.h
index a0853ba..7895008 100644
--- a/drivers/staging/rtl8188eu/include/rtw_xmit.h
+++ b/drivers/staging/rtl8188eu/include/rtw_xmit.h
@@ -263,8 +263,6 @@ struct agg_pkt_info {
 
 struct xmit_priv {
spinlock_t lock;
-   struct semaphore xmit_sema;
-   struct semaphore terminate_xmitthread_sema;
struct __queue be_pending;
struct __queue bk_pending;
struct __queue vi_pending;
@@ -289,7 +287,6 @@ struct  xmit_priv {
u8  wmm_para_seq[4];/* sequence for wmm ac parameter strength
 * from large to small. it's value is 0->vo,
 * 1->vi, 2->be, 3->bk. */
-   struct semaphore tx_retevt;/* all tx return event; */
u8  txirp_cnt;/*  */
struct tasklet_struct xmit_tasklet;
/* per AC pending irp */
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 0/4] *** rtl8188eu: Replace semaphores with mutexes or completions ***

2016-06-05 Thread Binoy Jayan
Hi,

These are a set of patches [v2] which removes semaphores from:

drivers/staging/rtl8188eu

These are part of a bigger effort to eliminate all semaphores 
from the linux kernel.

They build correctly (individually and as a whole).
NB: I have not tested this as I do not have the following hardware:

"Realtek RTL8188EU Wireless LAN NIC driver"

Incorporated changes w.r.t. review comments:
 - Changed changelog in patch 3/4

Thanks,
Binoy

Binoy Jayan (4):
  irtl8188eu: Replace semaphore cmd_queue_sema with completion
  rtl8188eu: Replace semaphore terminate_cmdthread_sema with completion
  rtl8188eu: pwrctrl_priv: Replace semaphore 'lock' with mutex
  rtl8188eu: Remove unused semaphores

 drivers/staging/rtl8188eu/core/rtw_cmd.c  | 12 ++--
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c  | 20 ++--
 drivers/staging/rtl8188eu/core/rtw_xmit.c |  4 
 drivers/staging/rtl8188eu/include/osdep_service.h |  4 +---
 drivers/staging/rtl8188eu/include/rtw_cmd.h   |  4 ++--
 drivers/staging/rtl8188eu/include/rtw_event.h |  2 +-
 drivers/staging/rtl8188eu/include/rtw_pwrctrl.h   | 17 +
 drivers/staging/rtl8188eu/include/rtw_xmit.h  |  3 ---
 drivers/staging/rtl8188eu/os_dep/os_intfs.c   |  6 +++---
 drivers/staging/rtl8188eu/os_dep/osdep_service.c  |  7 ---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c   |  8 
 11 files changed, 28 insertions(+), 59 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 2/4] rtl8188eu: Replace semaphore terminate_cmdthread_sema with completion

2016-06-05 Thread Binoy Jayan
The semaphore 'terminate_cmdthread_sema' is used as completion,
so convert it to struct completion.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c| 6 +++---
 drivers/staging/rtl8188eu/include/rtw_cmd.h | 2 +-
 drivers/staging/rtl8188eu/os_dep/os_intfs.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index a2937e7..9e12588 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -28,7 +28,7 @@ No irqsave is necessary.
 int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
 {
init_completion(>cmd_queue_comp);
-   sema_init(&(pcmdpriv->terminate_cmdthread_sema), 0);
+   init_completion(>terminate_cmdthread_comp);
 
_rtw_init_queue(&(pcmdpriv->cmd_queue));
return _SUCCESS;
@@ -162,7 +162,7 @@ int rtw_cmd_thread(void *context)
allow_signal(SIGTERM);
 
pcmdpriv->cmdthd_running = true;
-   up(>terminate_cmdthread_sema);
+   complete(>terminate_cmdthread_comp);
 
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("start r871x 
rtw_cmd_thread \n"));
 
@@ -234,7 +234,7 @@ _next:
rtw_free_cmd_obj(pcmd);
}
 
-   up(>terminate_cmdthread_sema);
+   complete(>terminate_cmdthread_comp);
 
 
complete_and_exit(NULL, 0);
diff --git a/drivers/staging/rtl8188eu/include/rtw_cmd.h 
b/drivers/staging/rtl8188eu/include/rtw_cmd.h
index 3532dd1..2b53f58 100644
--- a/drivers/staging/rtl8188eu/include/rtw_cmd.h
+++ b/drivers/staging/rtl8188eu/include/rtw_cmd.h
@@ -40,7 +40,7 @@ struct cmd_obj {
 
 struct cmd_priv {
struct completion cmd_queue_comp;
-   struct semaphore terminate_cmdthread_sema;
+   struct completion terminate_cmdthread_comp;
struct __queue cmd_queue;
u8 cmdthd_running;
struct adapter *padapter;
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c 
b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index a696d2b..c494845 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -762,7 +762,7 @@ static int rtw_start_drv_threads(struct adapter *padapter)
err = PTR_ERR(padapter->cmdThread);
else
/* wait for cmd_thread to run */
-   _rtw_down_sema(>cmdpriv.terminate_cmdthread_sema);
+   
wait_for_completion_interruptible(>cmdpriv.terminate_cmdthread_comp);
 
return err;
 }
@@ -774,7 +774,7 @@ void rtw_stop_drv_threads(struct adapter *padapter)
/* Below is to terminate rtw_cmd_thread & event_thread... */
complete(>cmdpriv.cmd_queue_comp);
if (padapter->cmdThread)
-   _rtw_down_sema(>cmdpriv.terminate_cmdthread_sema);
+   
wait_for_completion_interruptible(>cmdpriv.terminate_cmdthread_comp);
 
 }
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 1/4] irtl8188eu: Replace semaphore cmd_queue_sema with completion

2016-06-05 Thread Binoy Jayan
The semaphore 'cmd_queue_sema' is used as completion,
so convert it to struct completion.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c| 6 +++---
 drivers/staging/rtl8188eu/include/rtw_cmd.h | 2 +-
 drivers/staging/rtl8188eu/os_dep/os_intfs.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 7748523..a2937e7 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -27,7 +27,7 @@ No irqsave is necessary.
 
 int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
 {
-   sema_init(&(pcmdpriv->cmd_queue_sema), 0);
+   init_completion(>cmd_queue_comp);
sema_init(&(pcmdpriv->terminate_cmdthread_sema), 0);
 
_rtw_init_queue(&(pcmdpriv->cmd_queue));
@@ -122,7 +122,7 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct 
cmd_obj *cmd_obj)
res = _rtw_enqueue_cmd(>cmd_queue, cmd_obj);
 
if (res == _SUCCESS)
-   up(>cmd_queue_sema);
+   complete(>cmd_queue_comp);
 
 exit:
 
@@ -167,7 +167,7 @@ int rtw_cmd_thread(void *context)
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("start r871x 
rtw_cmd_thread \n"));
 
while (1) {
-   if (_rtw_down_sema(>cmd_queue_sema) == _FAIL)
+   if 
(wait_for_completion_interruptible(>cmd_queue_comp))
break;
 
if (padapter->bDriverStopped ||
diff --git a/drivers/staging/rtl8188eu/include/rtw_cmd.h 
b/drivers/staging/rtl8188eu/include/rtw_cmd.h
index 08ca592..3532dd1 100644
--- a/drivers/staging/rtl8188eu/include/rtw_cmd.h
+++ b/drivers/staging/rtl8188eu/include/rtw_cmd.h
@@ -39,7 +39,7 @@ struct cmd_obj {
 };
 
 struct cmd_priv {
-   struct semaphore cmd_queue_sema;
+   struct completion cmd_queue_comp;
struct semaphore terminate_cmdthread_sema;
struct __queue cmd_queue;
u8 cmdthd_running;
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c 
b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index ae2caff..a696d2b 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -772,7 +772,7 @@ void rtw_stop_drv_threads(struct adapter *padapter)
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+rtw_stop_drv_threads\n"));
 
/* Below is to terminate rtw_cmd_thread & event_thread... */
-   up(>cmdpriv.cmd_queue_sema);
+   complete(>cmdpriv.cmd_queue_comp);
if (padapter->cmdThread)
_rtw_down_sema(>cmdpriv.terminate_cmdthread_sema);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 4/4] rtl8188eu: Remove unused semaphores

2016-06-05 Thread Binoy Jayan
The semaphores xmit_sema, terminate_xmitthread_sema and tx_retevt
have no users, hence remove all references to them.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
---
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 
 drivers/staging/rtl8188eu/include/osdep_service.h | 1 -
 drivers/staging/rtl8188eu/include/rtw_event.h | 1 -
 drivers/staging/rtl8188eu/include/rtw_xmit.h  | 3 ---
 4 files changed, 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c 
b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index e0a5567..1e1b6d8 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -57,8 +57,6 @@ s32   _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct 
adapter *padapter)
/*  We don't need to memset padapter->XXX to zero, because adapter is 
allocated by vzalloc(). */
 
spin_lock_init(>lock);
-   sema_init(>xmit_sema, 0);
-   sema_init(>terminate_xmitthread_sema, 0);
 
/*
Please insert all the queue initializaiton using _rtw_init_queue below
@@ -199,8 +197,6 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct 
adapter *padapter)
 
pxmitpriv->txirp_cnt = 1;
 
-   sema_init(&(pxmitpriv->tx_retevt), 0);
-
/* per AC pending irp */
pxmitpriv->beq_cnt = 0;
pxmitpriv->bkq_cnt = 0;
diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h 
b/drivers/staging/rtl8188eu/include/osdep_service.h
index c53c9ea..6f6a8f8 100644
--- a/drivers/staging/rtl8188eu/include/osdep_service.h
+++ b/drivers/staging/rtl8188eu/include/osdep_service.h
@@ -35,7 +35,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/staging/rtl8188eu/include/rtw_event.h 
b/drivers/staging/rtl8188eu/include/rtw_event.h
index 0dc63f2..2a45581 100644
--- a/drivers/staging/rtl8188eu/include/rtw_event.h
+++ b/drivers/staging/rtl8188eu/include/rtw_event.h
@@ -18,7 +18,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/drivers/staging/rtl8188eu/include/rtw_xmit.h 
b/drivers/staging/rtl8188eu/include/rtw_xmit.h
index a0853ba..7895008 100644
--- a/drivers/staging/rtl8188eu/include/rtw_xmit.h
+++ b/drivers/staging/rtl8188eu/include/rtw_xmit.h
@@ -263,8 +263,6 @@ struct agg_pkt_info {
 
 struct xmit_priv {
spinlock_t lock;
-   struct semaphore xmit_sema;
-   struct semaphore terminate_xmitthread_sema;
struct __queue be_pending;
struct __queue bk_pending;
struct __queue vi_pending;
@@ -289,7 +287,6 @@ struct  xmit_priv {
u8  wmm_para_seq[4];/* sequence for wmm ac parameter strength
 * from large to small. it's value is 0->vo,
 * 1->vi, 2->be, 3->bk. */
-   struct semaphore tx_retevt;/* all tx return event; */
u8  txirp_cnt;/*  */
struct tasklet_struct xmit_tasklet;
/* per AC pending irp */
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 0/4] *** rtl8188eu: Replace semaphores with mutexes or completions ***

2016-06-05 Thread Binoy Jayan
Hi,

These are a set of patches [v2] which removes semaphores from:

drivers/staging/rtl8188eu

These are part of a bigger effort to eliminate all semaphores 
from the linux kernel.

They build correctly (individually and as a whole).
NB: I have not tested this as I do not have the following hardware:

"Realtek RTL8188EU Wireless LAN NIC driver"

Incorporated changes w.r.t. review comments:
 - Changed changelog in patch 3/4

Thanks,
Binoy

Binoy Jayan (4):
  irtl8188eu: Replace semaphore cmd_queue_sema with completion
  rtl8188eu: Replace semaphore terminate_cmdthread_sema with completion
  rtl8188eu: pwrctrl_priv: Replace semaphore 'lock' with mutex
  rtl8188eu: Remove unused semaphores

 drivers/staging/rtl8188eu/core/rtw_cmd.c  | 12 ++--
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c  | 20 ++--
 drivers/staging/rtl8188eu/core/rtw_xmit.c |  4 
 drivers/staging/rtl8188eu/include/osdep_service.h |  4 +---
 drivers/staging/rtl8188eu/include/rtw_cmd.h   |  4 ++--
 drivers/staging/rtl8188eu/include/rtw_event.h |  2 +-
 drivers/staging/rtl8188eu/include/rtw_pwrctrl.h   | 17 +
 drivers/staging/rtl8188eu/include/rtw_xmit.h  |  3 ---
 drivers/staging/rtl8188eu/os_dep/os_intfs.c   |  6 +++---
 drivers/staging/rtl8188eu/os_dep/osdep_service.c  |  7 ---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c   |  8 
 11 files changed, 28 insertions(+), 59 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 2/4] rtl8188eu: Replace semaphore terminate_cmdthread_sema with completion

2016-06-05 Thread Binoy Jayan
The semaphore 'terminate_cmdthread_sema' is used as completion,
so convert it to struct completion.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c| 6 +++---
 drivers/staging/rtl8188eu/include/rtw_cmd.h | 2 +-
 drivers/staging/rtl8188eu/os_dep/os_intfs.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index a2937e7..9e12588 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -28,7 +28,7 @@ No irqsave is necessary.
 int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
 {
init_completion(>cmd_queue_comp);
-   sema_init(&(pcmdpriv->terminate_cmdthread_sema), 0);
+   init_completion(>terminate_cmdthread_comp);
 
_rtw_init_queue(&(pcmdpriv->cmd_queue));
return _SUCCESS;
@@ -162,7 +162,7 @@ int rtw_cmd_thread(void *context)
allow_signal(SIGTERM);
 
pcmdpriv->cmdthd_running = true;
-   up(>terminate_cmdthread_sema);
+   complete(>terminate_cmdthread_comp);
 
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("start r871x 
rtw_cmd_thread \n"));
 
@@ -234,7 +234,7 @@ _next:
rtw_free_cmd_obj(pcmd);
}
 
-   up(>terminate_cmdthread_sema);
+   complete(>terminate_cmdthread_comp);
 
 
complete_and_exit(NULL, 0);
diff --git a/drivers/staging/rtl8188eu/include/rtw_cmd.h 
b/drivers/staging/rtl8188eu/include/rtw_cmd.h
index 3532dd1..2b53f58 100644
--- a/drivers/staging/rtl8188eu/include/rtw_cmd.h
+++ b/drivers/staging/rtl8188eu/include/rtw_cmd.h
@@ -40,7 +40,7 @@ struct cmd_obj {
 
 struct cmd_priv {
struct completion cmd_queue_comp;
-   struct semaphore terminate_cmdthread_sema;
+   struct completion terminate_cmdthread_comp;
struct __queue cmd_queue;
u8 cmdthd_running;
struct adapter *padapter;
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c 
b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index a696d2b..c494845 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -762,7 +762,7 @@ static int rtw_start_drv_threads(struct adapter *padapter)
err = PTR_ERR(padapter->cmdThread);
else
/* wait for cmd_thread to run */
-   _rtw_down_sema(>cmdpriv.terminate_cmdthread_sema);
+   
wait_for_completion_interruptible(>cmdpriv.terminate_cmdthread_comp);
 
return err;
 }
@@ -774,7 +774,7 @@ void rtw_stop_drv_threads(struct adapter *padapter)
/* Below is to terminate rtw_cmd_thread & event_thread... */
complete(>cmdpriv.cmd_queue_comp);
if (padapter->cmdThread)
-   _rtw_down_sema(>cmdpriv.terminate_cmdthread_sema);
+   
wait_for_completion_interruptible(>cmdpriv.terminate_cmdthread_comp);
 
 }
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 1/4] irtl8188eu: Replace semaphore cmd_queue_sema with completion

2016-06-05 Thread Binoy Jayan
The semaphore 'cmd_queue_sema' is used as completion,
so convert it to struct completion.

Signed-off-by: Binoy Jayan 
Reviewed-by: Arnd Bergmann 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c| 6 +++---
 drivers/staging/rtl8188eu/include/rtw_cmd.h | 2 +-
 drivers/staging/rtl8188eu/os_dep/os_intfs.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 7748523..a2937e7 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -27,7 +27,7 @@ No irqsave is necessary.
 
 int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
 {
-   sema_init(&(pcmdpriv->cmd_queue_sema), 0);
+   init_completion(>cmd_queue_comp);
sema_init(&(pcmdpriv->terminate_cmdthread_sema), 0);
 
_rtw_init_queue(&(pcmdpriv->cmd_queue));
@@ -122,7 +122,7 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct 
cmd_obj *cmd_obj)
res = _rtw_enqueue_cmd(>cmd_queue, cmd_obj);
 
if (res == _SUCCESS)
-   up(>cmd_queue_sema);
+   complete(>cmd_queue_comp);
 
 exit:
 
@@ -167,7 +167,7 @@ int rtw_cmd_thread(void *context)
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("start r871x 
rtw_cmd_thread \n"));
 
while (1) {
-   if (_rtw_down_sema(>cmd_queue_sema) == _FAIL)
+   if 
(wait_for_completion_interruptible(>cmd_queue_comp))
break;
 
if (padapter->bDriverStopped ||
diff --git a/drivers/staging/rtl8188eu/include/rtw_cmd.h 
b/drivers/staging/rtl8188eu/include/rtw_cmd.h
index 08ca592..3532dd1 100644
--- a/drivers/staging/rtl8188eu/include/rtw_cmd.h
+++ b/drivers/staging/rtl8188eu/include/rtw_cmd.h
@@ -39,7 +39,7 @@ struct cmd_obj {
 };
 
 struct cmd_priv {
-   struct semaphore cmd_queue_sema;
+   struct completion cmd_queue_comp;
struct semaphore terminate_cmdthread_sema;
struct __queue cmd_queue;
u8 cmdthd_running;
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c 
b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index ae2caff..a696d2b 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -772,7 +772,7 @@ void rtw_stop_drv_threads(struct adapter *padapter)
RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+rtw_stop_drv_threads\n"));
 
/* Below is to terminate rtw_cmd_thread & event_thread... */
-   up(>cmdpriv.cmd_queue_sema);
+   complete(>cmdpriv.cmd_queue_comp);
if (padapter->cmdThread)
_rtw_down_sema(>cmdpriv.terminate_cmdthread_sema);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



Re: [v2, 1/2] Documentation: bindings: add DT documentation for Rockchip USB2PHY

2016-06-05 Thread Frank Wang

Hi Guenter,

On 2016/6/4 3:25, Guenter Roeck wrote:

On Thu, Jun 02, 2016 at 02:48:09PM +0800, Frank Wang wrote:

Signed-off-by: Frank Wang 
---

Changes in v2:
  - Changed vbus_host optional property from gpio to regulator.
  - Specified vbus_otg-supply optional property.
  - Specified otg_id and otg_bvalid property.

  .../bindings/phy/phy-rockchip-inno-usb2.txt|   55 
  1 file changed, 55 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt

diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt 
b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
new file mode 100644
index 000..132e707
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
@@ -0,0 +1,55 @@
+ROCKCHIP USB2.0 PHY WITH INNO IP BLOCK
+
+Required properties (phy (parent) node):
+ - compatible : should contain:
+   * "rockchip,rk3366-usb2phy"
+   * "rockchip,rk3399-usb2phy"
+ - #clock-cells : should be 0.
+ - clock-names : specify the 480m output clk name.
+
+Optional properties:
+ - vbus_host-supply : phandle to a regulator that supplies host vbus.
+ - vbus_otg-supply : phandle to a regulator that supplies otg vbus.
+
+Required nodes : a sub-node is required for each port the phy provides.
+The sub-node name is used to identify host or otg port.
+

Would it make sense to also specify the sub-node names ? The driver matches
"host-port", and presumably once supported "otg-port". Someone not knowing
this may specify "hostport" or some other name variant and wonder why nothing
works as expected.

Well, Yeah, I will correct it in the next patch (patch v3).

+Required properties (port (child) node):
+ - #phy-cells : must be 0. See ./phy-bindings.txt for details.
+ - interrupts : specify an interrupt for each entry in interrupt-names.
+ - interrupt-names : a list which shall be the following entries:
+   * "otg_id" : for the otg id interrupt.
+   * "otg_bvalid" : for the otg vbus interrupt.
+   * "linestate" : for the host or otg linestate interrupt.
+
+Example:
+
+grf: syscon@ff77 {
+   compatible = "rockchip,rk3366-grf", "syscon", "simple-mfd";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+...
+
+   u2phy: usb2-phy {
+   compatible = "rockchip,rk3366-usb2phy";
+   #clock-cells = <0>;
+   clock-output-names = "sclk_otgphy0_480m";
+
+   u2phy_otg: otg-port {
+   #phy-cells = <0>;
+   interrupts = ,
+,
+;
+   interrupt-names = "otg_id", "otg_bvalid", "linestate";
+   status = "okay";
+   };
+
+   u2phy_host: host-port {
+   #phy-cells = <0>;
+   interrupts = ;
+   interrupt-names = "linestate";
+   status = "okay";
+   };
+   };
+};








Re: [v2, 1/2] Documentation: bindings: add DT documentation for Rockchip USB2PHY

2016-06-05 Thread Frank Wang

Hi Guenter,

On 2016/6/4 3:25, Guenter Roeck wrote:

On Thu, Jun 02, 2016 at 02:48:09PM +0800, Frank Wang wrote:

Signed-off-by: Frank Wang 
---

Changes in v2:
  - Changed vbus_host optional property from gpio to regulator.
  - Specified vbus_otg-supply optional property.
  - Specified otg_id and otg_bvalid property.

  .../bindings/phy/phy-rockchip-inno-usb2.txt|   55 
  1 file changed, 55 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt

diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt 
b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
new file mode 100644
index 000..132e707
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
@@ -0,0 +1,55 @@
+ROCKCHIP USB2.0 PHY WITH INNO IP BLOCK
+
+Required properties (phy (parent) node):
+ - compatible : should contain:
+   * "rockchip,rk3366-usb2phy"
+   * "rockchip,rk3399-usb2phy"
+ - #clock-cells : should be 0.
+ - clock-names : specify the 480m output clk name.
+
+Optional properties:
+ - vbus_host-supply : phandle to a regulator that supplies host vbus.
+ - vbus_otg-supply : phandle to a regulator that supplies otg vbus.
+
+Required nodes : a sub-node is required for each port the phy provides.
+The sub-node name is used to identify host or otg port.
+

Would it make sense to also specify the sub-node names ? The driver matches
"host-port", and presumably once supported "otg-port". Someone not knowing
this may specify "hostport" or some other name variant and wonder why nothing
works as expected.

Well, Yeah, I will correct it in the next patch (patch v3).

+Required properties (port (child) node):
+ - #phy-cells : must be 0. See ./phy-bindings.txt for details.
+ - interrupts : specify an interrupt for each entry in interrupt-names.
+ - interrupt-names : a list which shall be the following entries:
+   * "otg_id" : for the otg id interrupt.
+   * "otg_bvalid" : for the otg vbus interrupt.
+   * "linestate" : for the host or otg linestate interrupt.
+
+Example:
+
+grf: syscon@ff77 {
+   compatible = "rockchip,rk3366-grf", "syscon", "simple-mfd";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+...
+
+   u2phy: usb2-phy {
+   compatible = "rockchip,rk3366-usb2phy";
+   #clock-cells = <0>;
+   clock-output-names = "sclk_otgphy0_480m";
+
+   u2phy_otg: otg-port {
+   #phy-cells = <0>;
+   interrupts = ,
+,
+;
+   interrupt-names = "otg_id", "otg_bvalid", "linestate";
+   status = "okay";
+   };
+
+   u2phy_host: host-port {
+   #phy-cells = <0>;
+   interrupts = ;
+   interrupt-names = "linestate";
+   status = "okay";
+   };
+   };
+};








Re: [PATCH v4 05/18] dmaengine: st_fdma: Add STMicroelectronics FDMA driver header file

2016-06-05 Thread Vinod Koul
On Wed, May 25, 2016 at 05:06:39PM +0100, Peter Griffin wrote:

> +/*
> + * request control bits
> + */
> +#define REQ_CTRL_NUM_OPS_MASKGENMASK(31, 24)
> +#define REQ_CTRL_NUM_OPS(n)  (REQ_CTRL_NUM_OPS_MASK & ((n) << 24))
> +#define REQ_CTRL_INITIATOR_MASK  BIT(22)
> +#define  REQ_CTRL_INIT0  (0x0 << 22)
> +#define  REQ_CTRL_INIT1  (0x1 << 22)

pls keep spaces or tabs, not both :(

> +#define REQ_CTRL_INC_ADDR_ON BIT(21)
> +#define REQ_CTRL_DATA_SWAP_ONBIT(17)
> +#define REQ_CTRL_WNR BIT(14)
> +#define REQ_CTRL_OPCODE_MASK GENMASK(7, 4)
> +#define REQ_CTRL_OPCODE_LD_ST1   (0x0 << 4)
> +#define REQ_CTRL_OPCODE_LD_ST2   (0x1 << 4)
> +#define REQ_CTRL_OPCODE_LD_ST4   (0x2 << 4)
> +#define REQ_CTRL_OPCODE_LD_ST8   (0x3 << 4)
> +#define REQ_CTRL_OPCODE_LD_ST16  (0x4 << 4)
> +#define REQ_CTRL_OPCODE_LD_ST32  (0x5 << 4)
> +#define REQ_CTRL_OPCODE_LD_ST64  (0x6 << 4)
> +#define REQ_CTRL_HOLDOFF_MASKGENMASK(2, 0)
> +#define REQ_CTRL_HOLDOFF(n)  ((n) & REQ_CTRL_HOLDOFF_MASK)

Everything here is FDMA_ so why not these as well

-- 
~Vinod


[PATCH] serial: 8250_uniphier: add COMPILE_TEST option

2016-06-05 Thread Masahiro Yamada
Add COMPILE_TEST for the compilation test coverage.

Signed-off-by: Masahiro Yamada 
---

 drivers/tty/serial/8250/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
index e46761d..b5a0f2e 100644
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -387,7 +387,8 @@ config SERIAL_8250_MT6577
 
 config SERIAL_8250_UNIPHIER
tristate "Support for UniPhier on-chip UART"
-   depends on SERIAL_8250 && ARCH_UNIPHIER
+   depends on SERIAL_8250
+   depends on ARCH_UNIPHIER || COMPILE_TEST
help
  If you have a UniPhier based board and want to use the on-chip
  serial ports, say Y to this option. If unsure, say N.
-- 
1.9.1



Re: [PATCH v4 05/18] dmaengine: st_fdma: Add STMicroelectronics FDMA driver header file

2016-06-05 Thread Vinod Koul
On Wed, May 25, 2016 at 05:06:39PM +0100, Peter Griffin wrote:

> +/*
> + * request control bits
> + */
> +#define REQ_CTRL_NUM_OPS_MASKGENMASK(31, 24)
> +#define REQ_CTRL_NUM_OPS(n)  (REQ_CTRL_NUM_OPS_MASK & ((n) << 24))
> +#define REQ_CTRL_INITIATOR_MASK  BIT(22)
> +#define  REQ_CTRL_INIT0  (0x0 << 22)
> +#define  REQ_CTRL_INIT1  (0x1 << 22)

pls keep spaces or tabs, not both :(

> +#define REQ_CTRL_INC_ADDR_ON BIT(21)
> +#define REQ_CTRL_DATA_SWAP_ONBIT(17)
> +#define REQ_CTRL_WNR BIT(14)
> +#define REQ_CTRL_OPCODE_MASK GENMASK(7, 4)
> +#define REQ_CTRL_OPCODE_LD_ST1   (0x0 << 4)
> +#define REQ_CTRL_OPCODE_LD_ST2   (0x1 << 4)
> +#define REQ_CTRL_OPCODE_LD_ST4   (0x2 << 4)
> +#define REQ_CTRL_OPCODE_LD_ST8   (0x3 << 4)
> +#define REQ_CTRL_OPCODE_LD_ST16  (0x4 << 4)
> +#define REQ_CTRL_OPCODE_LD_ST32  (0x5 << 4)
> +#define REQ_CTRL_OPCODE_LD_ST64  (0x6 << 4)
> +#define REQ_CTRL_HOLDOFF_MASKGENMASK(2, 0)
> +#define REQ_CTRL_HOLDOFF(n)  ((n) & REQ_CTRL_HOLDOFF_MASK)

Everything here is FDMA_ so why not these as well

-- 
~Vinod


[PATCH] serial: 8250_uniphier: add COMPILE_TEST option

2016-06-05 Thread Masahiro Yamada
Add COMPILE_TEST for the compilation test coverage.

Signed-off-by: Masahiro Yamada 
---

 drivers/tty/serial/8250/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
index e46761d..b5a0f2e 100644
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -387,7 +387,8 @@ config SERIAL_8250_MT6577
 
 config SERIAL_8250_UNIPHIER
tristate "Support for UniPhier on-chip UART"
-   depends on SERIAL_8250 && ARCH_UNIPHIER
+   depends on SERIAL_8250
+   depends on ARCH_UNIPHIER || COMPILE_TEST
help
  If you have a UniPhier based board and want to use the on-chip
  serial ports, say Y to this option. If unsure, say N.
-- 
1.9.1



linux-next: Tree for Jun 6

2016-06-05 Thread Stephen Rothwell
Hi all,

Changes since 20160603:

New tree: amlogic

Dropped tree: amlogic (build failure)

My fixes tree contains:

  of: silence warnings due to max() usage

The amlogic tree gained a build failure so I dropped it for today.

The samsung-krzk tree gained a conflict against the arm-soc tree.

The akpm-current tree gained a build failure for which I reverted
2 commits.

Non-merge commits (relative to Linus' tree): 1713
 1616 files changed, 67681 insertions(+), 31198 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc and an allmodconfig (with
CONFIG_BUILD_DOCSRC=n) for x86_64, a multi_v7_defconfig for arm and a
native build of tools/perf. After the final fixups (if any), I do an
x86_64 modules_install followed by builds for x86_64 allnoconfig,
powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig
(this fails its final link) and pseries_le_defconfig and i386, sparc
and sparc64 defconfig.

Below is a summary of the state of the merge.

I am currently merging 238 trees (counting Linus' and 35 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (af8c34ce6ae3 Linux 4.7-rc2)
Merging fixes/master (b31033aacbd0 of: silence warnings due to max() usage)
Merging kbuild-current/rc-fixes (3d1450d54a4f Makefile: Force gzip and xz on 
module install)
Merging arc-current/for-curr (ed6aefed726a Revert "ARCv2: 
spinlock/rwlock/atomics: Delayed retry of failed SCOND with exponential 
backoff")
Merging arm-current/fixes (e2dfb4b88014 ARM: fix PTRACE_SETVFPREGS on SMP 
systems)
Merging m68k-current/for-linus (9a6462763b17 m68k/mvme16x: Include generic 
)
Merging metag-fixes/fixes (0164a711c97b metag: Fix ioremap_wc/ioremap_cached 
build errors)
Merging powerpc-fixes/fixes (7cc851039d64 powerpc/pseries: Add POWER8NVL 
support to ibm,client-architecture-support call)
Merging powerpc-merge-mpe/fixes (bc0195aad0da Linux 4.2-rc2)
Merging sparc/master (6b15d6650c53 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging net/master (4ef36e156670 Merge tag 
'wireless-drivers-for-davem-2016-06-04' of 
git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers)
Merging ipsec/master (d6af1a31cc72 vti: Add pmtu handling to vti_xmit.)
Merging ipvs/master (f28f20da704d Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging wireless-drivers/master (182fd9eecb28 MAINTAINERS: Add file patterns 
for wireless device tree bindings)
Merging mac80211/master (6fe04128f158 mac80211: fix fast_tx header alignment)
Merging sound-current/for-linus (0358ccc8ffd8 ALSA: uapi: Add three missing 
header files to Kbuild file)
Merging pci-current/for-linus (1a695a905c18 Linux 4.7-rc1)
Merging driver-core.current/driver-core-linus (1a695a905c18 Linux 4.7-rc1)
Merging tty.current/tty-linus (1a695a905c18 Linux 4.7-rc1)
Merging usb.current/usb-linus (7b2c17f82954 usb: musb: Stop bulk endpoint while 
queue is rotated)
Merging usb-gadget-fixes/fixes (50c763f8c1ba usb: dwc3: Set the ClearPendIN bit 
on Clear Stall EP command)
Merging usb-serial-fixes/usb-linus (74d2a91aec97 USB: serial: option: add even 
more ZTE device ids)
Merging usb-chipidea-fixes/ci-for-usb-stable (d144dfea8af7 usb: chipidea: otg: 
change workqueue ci_otg as freezable)
Merging staging.current/staging-linus (1a695a905c18 Linux 4.7-rc1)
Merging char-misc.current/char-misc-linus (1a695a905c18 Linux 4.7-rc1)
Merging input-current/for-linus (540c26087bfb Input: xpad - fix rumble on Xbox 
One controllers with 2015 firmware)
Merging crypto-current/master (ab6a11a7c8ef crypto: ccp - Fix AES XTS error for 
request sizes above 4096)
Merging ide/master (1993b176a822 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide)
Merging devicetree-current/devicetree/merge (f76502aa9140 of/dynamic: Fix test 
for PPC_PSERIES)
Merging rr-fixes/fixes (8244062ef1e5 modules: fix longstanding 

linux-next: Tree for Jun 6

2016-06-05 Thread Stephen Rothwell
Hi all,

Changes since 20160603:

New tree: amlogic

Dropped tree: amlogic (build failure)

My fixes tree contains:

  of: silence warnings due to max() usage

The amlogic tree gained a build failure so I dropped it for today.

The samsung-krzk tree gained a conflict against the arm-soc tree.

The akpm-current tree gained a build failure for which I reverted
2 commits.

Non-merge commits (relative to Linus' tree): 1713
 1616 files changed, 67681 insertions(+), 31198 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc and an allmodconfig (with
CONFIG_BUILD_DOCSRC=n) for x86_64, a multi_v7_defconfig for arm and a
native build of tools/perf. After the final fixups (if any), I do an
x86_64 modules_install followed by builds for x86_64 allnoconfig,
powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig
(this fails its final link) and pseries_le_defconfig and i386, sparc
and sparc64 defconfig.

Below is a summary of the state of the merge.

I am currently merging 238 trees (counting Linus' and 35 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (af8c34ce6ae3 Linux 4.7-rc2)
Merging fixes/master (b31033aacbd0 of: silence warnings due to max() usage)
Merging kbuild-current/rc-fixes (3d1450d54a4f Makefile: Force gzip and xz on 
module install)
Merging arc-current/for-curr (ed6aefed726a Revert "ARCv2: 
spinlock/rwlock/atomics: Delayed retry of failed SCOND with exponential 
backoff")
Merging arm-current/fixes (e2dfb4b88014 ARM: fix PTRACE_SETVFPREGS on SMP 
systems)
Merging m68k-current/for-linus (9a6462763b17 m68k/mvme16x: Include generic 
)
Merging metag-fixes/fixes (0164a711c97b metag: Fix ioremap_wc/ioremap_cached 
build errors)
Merging powerpc-fixes/fixes (7cc851039d64 powerpc/pseries: Add POWER8NVL 
support to ibm,client-architecture-support call)
Merging powerpc-merge-mpe/fixes (bc0195aad0da Linux 4.2-rc2)
Merging sparc/master (6b15d6650c53 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging net/master (4ef36e156670 Merge tag 
'wireless-drivers-for-davem-2016-06-04' of 
git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers)
Merging ipsec/master (d6af1a31cc72 vti: Add pmtu handling to vti_xmit.)
Merging ipvs/master (f28f20da704d Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net)
Merging wireless-drivers/master (182fd9eecb28 MAINTAINERS: Add file patterns 
for wireless device tree bindings)
Merging mac80211/master (6fe04128f158 mac80211: fix fast_tx header alignment)
Merging sound-current/for-linus (0358ccc8ffd8 ALSA: uapi: Add three missing 
header files to Kbuild file)
Merging pci-current/for-linus (1a695a905c18 Linux 4.7-rc1)
Merging driver-core.current/driver-core-linus (1a695a905c18 Linux 4.7-rc1)
Merging tty.current/tty-linus (1a695a905c18 Linux 4.7-rc1)
Merging usb.current/usb-linus (7b2c17f82954 usb: musb: Stop bulk endpoint while 
queue is rotated)
Merging usb-gadget-fixes/fixes (50c763f8c1ba usb: dwc3: Set the ClearPendIN bit 
on Clear Stall EP command)
Merging usb-serial-fixes/usb-linus (74d2a91aec97 USB: serial: option: add even 
more ZTE device ids)
Merging usb-chipidea-fixes/ci-for-usb-stable (d144dfea8af7 usb: chipidea: otg: 
change workqueue ci_otg as freezable)
Merging staging.current/staging-linus (1a695a905c18 Linux 4.7-rc1)
Merging char-misc.current/char-misc-linus (1a695a905c18 Linux 4.7-rc1)
Merging input-current/for-linus (540c26087bfb Input: xpad - fix rumble on Xbox 
One controllers with 2015 firmware)
Merging crypto-current/master (ab6a11a7c8ef crypto: ccp - Fix AES XTS error for 
request sizes above 4096)
Merging ide/master (1993b176a822 Merge 
git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide)
Merging devicetree-current/devicetree/merge (f76502aa9140 of/dynamic: Fix test 
for PPC_PSERIES)
Merging rr-fixes/fixes (8244062ef1e5 modules: fix longstanding 

Re: [PATCH] dmaengine: bcm2835: Fix polling for completion of DMA with interrupts masked.

2016-06-05 Thread Vinod Koul
On Fri, Jun 03, 2016 at 07:29:11PM -0700, Eric Anholt wrote:
> The tx_status hook is supposed to be safe to call from interrupt
> context, but it wouldn't ever return completion for the last transfer,
> meaning you couldn't poll for DMA completion with interrupts masked.

and why is that?

> This fixes IRQ handling for bcm2835's DSI1, which requires using the
> DMA engine to write its registers due to a bug in the AXI bridge.
> 
> Signed-off-by: Eric Anholt 
> ---
>  drivers/dma/bcm2835-dma.c | 24 +++-
>  1 file changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
> index 6149b27c33ad..320461c578e3 100644
> --- a/drivers/dma/bcm2835-dma.c
> +++ b/drivers/dma/bcm2835-dma.c
> @@ -570,16 +570,16 @@ static enum dma_status bcm2835_dma_tx_status(struct 
> dma_chan *chan,
>   struct virt_dma_desc *vd;
>   enum dma_status ret;
>   unsigned long flags;
> + u32 residue;
>  
>   ret = dma_cookie_status(chan, cookie, txstate);
> - if (ret == DMA_COMPLETE || !txstate)
> + if (ret == DMA_COMPLETE)

Why do you change this? txstate can be NULL, so no point calculating reside
for those cases

>   return ret;
>  
>   spin_lock_irqsave(>vc.lock, flags);
>   vd = vchan_find_desc(>vc, cookie);
>   if (vd) {
> - txstate->residue =
> - bcm2835_dma_desc_size(to_bcm2835_dma_desc(>tx));
> + residue = bcm2835_dma_desc_size(to_bcm2835_dma_desc(>tx));
>   } else if (c->desc && c->desc->vd.tx.cookie == cookie) {
>   struct bcm2835_desc *d = c->desc;
>   dma_addr_t pos;
> @@ -591,11 +591,25 @@ static enum dma_status bcm2835_dma_tx_status(struct 
> dma_chan *chan,
>   else
>   pos = 0;
>  
> - txstate->residue = bcm2835_dma_desc_size_pos(d, pos);
> + residue = bcm2835_dma_desc_size_pos(d, pos);
> +
> + /*
> +  * If our non-cyclic transfer is done, then report
> +  * complete and trigger the next tx now.  This lets
> +  * the dmaengine API be used synchronously from an IRQ
> +  * handler.
> +  */
> + if (!d->cyclic && residue == 0) {
> + vchan_cookie_complete(>desc->vd);
> + bcm2835_dma_start_desc(c);
> + ret = dma_cookie_status(chan, cookie, txstate);
> + }
>   } else {
> - txstate->residue = 0;
> + residue = 0;
>   }
>  
> + dma_set_residue(txstate, residue);
> +
>   spin_unlock_irqrestore(>vc.lock, flags);
>  
>   return ret;
> -- 
> 2.8.0.rc3
> 

-- 
~Vinod


Re: [PATCH] dmaengine: bcm2835: Fix polling for completion of DMA with interrupts masked.

2016-06-05 Thread Vinod Koul
On Fri, Jun 03, 2016 at 07:29:11PM -0700, Eric Anholt wrote:
> The tx_status hook is supposed to be safe to call from interrupt
> context, but it wouldn't ever return completion for the last transfer,
> meaning you couldn't poll for DMA completion with interrupts masked.

and why is that?

> This fixes IRQ handling for bcm2835's DSI1, which requires using the
> DMA engine to write its registers due to a bug in the AXI bridge.
> 
> Signed-off-by: Eric Anholt 
> ---
>  drivers/dma/bcm2835-dma.c | 24 +++-
>  1 file changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
> index 6149b27c33ad..320461c578e3 100644
> --- a/drivers/dma/bcm2835-dma.c
> +++ b/drivers/dma/bcm2835-dma.c
> @@ -570,16 +570,16 @@ static enum dma_status bcm2835_dma_tx_status(struct 
> dma_chan *chan,
>   struct virt_dma_desc *vd;
>   enum dma_status ret;
>   unsigned long flags;
> + u32 residue;
>  
>   ret = dma_cookie_status(chan, cookie, txstate);
> - if (ret == DMA_COMPLETE || !txstate)
> + if (ret == DMA_COMPLETE)

Why do you change this? txstate can be NULL, so no point calculating reside
for those cases

>   return ret;
>  
>   spin_lock_irqsave(>vc.lock, flags);
>   vd = vchan_find_desc(>vc, cookie);
>   if (vd) {
> - txstate->residue =
> - bcm2835_dma_desc_size(to_bcm2835_dma_desc(>tx));
> + residue = bcm2835_dma_desc_size(to_bcm2835_dma_desc(>tx));
>   } else if (c->desc && c->desc->vd.tx.cookie == cookie) {
>   struct bcm2835_desc *d = c->desc;
>   dma_addr_t pos;
> @@ -591,11 +591,25 @@ static enum dma_status bcm2835_dma_tx_status(struct 
> dma_chan *chan,
>   else
>   pos = 0;
>  
> - txstate->residue = bcm2835_dma_desc_size_pos(d, pos);
> + residue = bcm2835_dma_desc_size_pos(d, pos);
> +
> + /*
> +  * If our non-cyclic transfer is done, then report
> +  * complete and trigger the next tx now.  This lets
> +  * the dmaengine API be used synchronously from an IRQ
> +  * handler.
> +  */
> + if (!d->cyclic && residue == 0) {
> + vchan_cookie_complete(>desc->vd);
> + bcm2835_dma_start_desc(c);
> + ret = dma_cookie_status(chan, cookie, txstate);
> + }
>   } else {
> - txstate->residue = 0;
> + residue = 0;
>   }
>  
> + dma_set_residue(txstate, residue);
> +
>   spin_unlock_irqrestore(>vc.lock, flags);
>  
>   return ret;
> -- 
> 2.8.0.rc3
> 

-- 
~Vinod


Re: [PATCH] dma: bcm2835: Fix compiler warning on arm64.

2016-06-05 Thread Vinod Koul
On Fri, Jun 03, 2016 at 07:23:33PM -0700, Eric Anholt wrote:
> The min() macro was complaining about mismatched types.  The max len
> is at most SZ_1G, so we can just put it in an unsigned int.
> 
> Signed-off-by: Eric Anholt 
> ---
> 
> Vinod, if you ack it, this one would be nice to be able to merge
> through the -soc tree, so that when we enable of arm64 builds of this
> driver we don't introduce a new compiler warning.
> 
>  drivers/dma/bcm2835-dma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
> index 6149b27c33ad..1fa11fc067c6 100644
> --- a/drivers/dma/bcm2835-dma.c
> +++ b/drivers/dma/bcm2835-dma.c
> @@ -393,7 +393,7 @@ static void bcm2835_dma_fill_cb_chain_with_sg(
>   unsigned int sg_len)
>  {
>   struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
> - size_t max_len = bcm2835_dma_max_frame_length(c);
> + unsigned int max_len = bcm2835_dma_max_frame_length(c);

bcm2835_dma_max_frame_length() returns size_t. so this should also add a
complain about type mismatch as well!

Also, wouldn't it be better to make both args of min()  as size_t then?

>   unsigned int i, len;
>   dma_addr_t addr;
>   struct scatterlist *sgent;
> -- 
> 2.8.0.rc3
> 

Thanks
-- 
~Vinod


Re: [PATCH] dma: bcm2835: Fix compiler warning on arm64.

2016-06-05 Thread Vinod Koul
On Fri, Jun 03, 2016 at 07:23:33PM -0700, Eric Anholt wrote:
> The min() macro was complaining about mismatched types.  The max len
> is at most SZ_1G, so we can just put it in an unsigned int.
> 
> Signed-off-by: Eric Anholt 
> ---
> 
> Vinod, if you ack it, this one would be nice to be able to merge
> through the -soc tree, so that when we enable of arm64 builds of this
> driver we don't introduce a new compiler warning.
> 
>  drivers/dma/bcm2835-dma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
> index 6149b27c33ad..1fa11fc067c6 100644
> --- a/drivers/dma/bcm2835-dma.c
> +++ b/drivers/dma/bcm2835-dma.c
> @@ -393,7 +393,7 @@ static void bcm2835_dma_fill_cb_chain_with_sg(
>   unsigned int sg_len)
>  {
>   struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
> - size_t max_len = bcm2835_dma_max_frame_length(c);
> + unsigned int max_len = bcm2835_dma_max_frame_length(c);

bcm2835_dma_max_frame_length() returns size_t. so this should also add a
complain about type mismatch as well!

Also, wouldn't it be better to make both args of min()  as size_t then?

>   unsigned int i, len;
>   dma_addr_t addr;
>   struct scatterlist *sgent;
> -- 
> 2.8.0.rc3
> 

Thanks
-- 
~Vinod


Re: [PATCH] tmpfs: don't undo fallocate past its last page

2016-06-05 Thread Brandon Philips
On Mon, May 16, 2016 at 4:59 AM, Vlastimil Babka  wrote:
> On 05/08/2016 03:16 PM, Anthony Romano wrote:
>>
>> When fallocate is interrupted it will undo a range that extends one byte
>> past its range of allocated pages. This can corrupt an in-use page by
>> zeroing out its first byte. Instead, undo using the inclusive byte range.
>
>
> Huh, good catch. So why is shmem_undo_range() adding +1 to the value in the
> first place? The only other caller is shmem_truncate_range() and all *its*
> callers do subtract 1 to avoid the same issue. So a nicer fix would be to
> remove all this +1/-1 madness. Or is there some subtle corner case I'm
> missing?

Bumping this thread as I don't think this patch has gotten picked up.
And cc'ing folks from 1635f6a74152f1dcd1b888231609d64875f0a81a.

Also, resending because I forgot to remove the HTML mime-type to make
vger happy.

Thank you,

Brandon


>> Signed-off-by: Anthony Romano 
>
>
> Looks like a stable candidate patch. Can you point out the commit that
> introduced the bug, for the Fixes: tag?
>
> Thanks,
> Vlastimil
>
>
>> ---
>>   mm/shmem.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/shmem.c b/mm/shmem.c
>> index 719bd6b..f0f9405 100644
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -2238,7 +2238,7 @@ static long shmem_fallocate(struct file *file, int
>> mode, loff_t offset,
>> /* Remove the !PageUptodate pages we added */
>> shmem_undo_range(inode,
>> (loff_t)start << PAGE_SHIFT,
>> -   (loff_t)index << PAGE_SHIFT, true);
>> +   ((loff_t)index << PAGE_SHIFT) - 1, true);
>> goto undone;
>> }
>>
>>
>


Re: [PATCH] tmpfs: don't undo fallocate past its last page

2016-06-05 Thread Brandon Philips
On Mon, May 16, 2016 at 4:59 AM, Vlastimil Babka  wrote:
> On 05/08/2016 03:16 PM, Anthony Romano wrote:
>>
>> When fallocate is interrupted it will undo a range that extends one byte
>> past its range of allocated pages. This can corrupt an in-use page by
>> zeroing out its first byte. Instead, undo using the inclusive byte range.
>
>
> Huh, good catch. So why is shmem_undo_range() adding +1 to the value in the
> first place? The only other caller is shmem_truncate_range() and all *its*
> callers do subtract 1 to avoid the same issue. So a nicer fix would be to
> remove all this +1/-1 madness. Or is there some subtle corner case I'm
> missing?

Bumping this thread as I don't think this patch has gotten picked up.
And cc'ing folks from 1635f6a74152f1dcd1b888231609d64875f0a81a.

Also, resending because I forgot to remove the HTML mime-type to make
vger happy.

Thank you,

Brandon


>> Signed-off-by: Anthony Romano 
>
>
> Looks like a stable candidate patch. Can you point out the commit that
> introduced the bug, for the Fixes: tag?
>
> Thanks,
> Vlastimil
>
>
>> ---
>>   mm/shmem.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/shmem.c b/mm/shmem.c
>> index 719bd6b..f0f9405 100644
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -2238,7 +2238,7 @@ static long shmem_fallocate(struct file *file, int
>> mode, loff_t offset,
>> /* Remove the !PageUptodate pages we added */
>> shmem_undo_range(inode,
>> (loff_t)start << PAGE_SHIFT,
>> -   (loff_t)index << PAGE_SHIFT, true);
>> +   ((loff_t)index << PAGE_SHIFT) - 1, true);
>> goto undone;
>> }
>>
>>
>


[PATCH v2 07/11] iommu/ipmmu-vmsa: IPMMU device is 64-bit bus master

2016-06-05 Thread Magnus Damm
From: Magnus Damm 

The r8a7795 IPMMU supports 64-bit bus mastering. Both
the coherent DMA mask and the streaming DMA mask are
set to unlock the 64-bit address space for coherent
allocations and streaming operations.

Signed-off-by: Magnus Damm 
---

 Changes since V1:
 - Updated the commit message

 drivers/iommu/ipmmu-vmsa.c |1 +
 1 file changed, 1 insertion(+)

--- 0019/drivers/iommu/ipmmu-vmsa.c
+++ work/drivers/iommu/ipmmu-vmsa.c 2016-06-06 11:01:28.730607110 +0900
@@ -1082,6 +1082,7 @@ static int ipmmu_probe(struct platform_d
spin_lock_init(>lock);
bitmap_zero(mmu->ctx, IPMMU_CTX_MAX);
mmu->features = match->data;
+   dma_set_mask_and_coherent(>dev, DMA_BIT_MASK(64));
 
/* Map I/O memory and request IRQ. */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);


[PATCH v2 08/11] iommu/ipmmu-vmsa: Write IMCTR twice

2016-06-05 Thread Magnus Damm
From: Magnus Damm 

Write IMCTR both in the root device and the leaf node.

Signed-off-by: Magnus Damm 
---

 Changes since V1:
 - None

 drivers/iommu/ipmmu-vmsa.c |   17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

--- 0021/drivers/iommu/ipmmu-vmsa.c
+++ work/drivers/iommu/ipmmu-vmsa.c 2016-06-06 11:03:22.610607110 +0900
@@ -261,6 +261,16 @@ static void ipmmu_ctx_write(struct ipmmu
ipmmu_write(domain->root, domain->context_id * IM_CTX_SIZE + reg, data);
 }
 
+static void ipmmu_ctx_write2(struct ipmmu_vmsa_domain *domain, unsigned int 
reg,
+u32 data)
+{
+   if (domain->mmu != domain->root)
+   ipmmu_write(domain->mmu,
+   domain->context_id * IM_CTX_SIZE + reg, data);
+
+   ipmmu_write(domain->root, domain->context_id * IM_CTX_SIZE + reg, data);
+}
+
 /* 
-
  * TLB and microTLB Management
  */
@@ -287,7 +297,7 @@ static void ipmmu_tlb_invalidate(struct
 
reg = ipmmu_ctx_read(domain, IMCTR);
reg |= IMCTR_FLUSH;
-   ipmmu_ctx_write(domain, IMCTR, reg);
+   ipmmu_ctx_write2(domain, IMCTR, reg);
 
ipmmu_tlb_sync(domain);
 }
@@ -445,7 +455,8 @@ static int ipmmu_domain_init_context(str
 * software management as we have no use for it. Flush the TLB as
 * required when modifying the context registers.
 */
-   ipmmu_ctx_write(domain, IMCTR, IMCTR_INTEN | IMCTR_FLUSH | IMCTR_MMUEN);
+   ipmmu_ctx_write2(domain, IMCTR,
+IMCTR_INTEN | IMCTR_FLUSH | IMCTR_MMUEN);
 
return 0;
 }
@@ -471,7 +482,7 @@ static void ipmmu_domain_destroy_context
 *
 * TODO: Is TLB flush really needed ?
 */
-   ipmmu_ctx_write(domain, IMCTR, IMCTR_FLUSH);
+   ipmmu_ctx_write2(domain, IMCTR, IMCTR_FLUSH);
ipmmu_tlb_sync(domain);
ipmmu_domain_free_context(domain->root, domain->context_id);
 }


[PATCH v2 07/11] iommu/ipmmu-vmsa: IPMMU device is 64-bit bus master

2016-06-05 Thread Magnus Damm
From: Magnus Damm 

The r8a7795 IPMMU supports 64-bit bus mastering. Both
the coherent DMA mask and the streaming DMA mask are
set to unlock the 64-bit address space for coherent
allocations and streaming operations.

Signed-off-by: Magnus Damm 
---

 Changes since V1:
 - Updated the commit message

 drivers/iommu/ipmmu-vmsa.c |1 +
 1 file changed, 1 insertion(+)

--- 0019/drivers/iommu/ipmmu-vmsa.c
+++ work/drivers/iommu/ipmmu-vmsa.c 2016-06-06 11:01:28.730607110 +0900
@@ -1082,6 +1082,7 @@ static int ipmmu_probe(struct platform_d
spin_lock_init(>lock);
bitmap_zero(mmu->ctx, IPMMU_CTX_MAX);
mmu->features = match->data;
+   dma_set_mask_and_coherent(>dev, DMA_BIT_MASK(64));
 
/* Map I/O memory and request IRQ. */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);


[PATCH v2 08/11] iommu/ipmmu-vmsa: Write IMCTR twice

2016-06-05 Thread Magnus Damm
From: Magnus Damm 

Write IMCTR both in the root device and the leaf node.

Signed-off-by: Magnus Damm 
---

 Changes since V1:
 - None

 drivers/iommu/ipmmu-vmsa.c |   17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

--- 0021/drivers/iommu/ipmmu-vmsa.c
+++ work/drivers/iommu/ipmmu-vmsa.c 2016-06-06 11:03:22.610607110 +0900
@@ -261,6 +261,16 @@ static void ipmmu_ctx_write(struct ipmmu
ipmmu_write(domain->root, domain->context_id * IM_CTX_SIZE + reg, data);
 }
 
+static void ipmmu_ctx_write2(struct ipmmu_vmsa_domain *domain, unsigned int 
reg,
+u32 data)
+{
+   if (domain->mmu != domain->root)
+   ipmmu_write(domain->mmu,
+   domain->context_id * IM_CTX_SIZE + reg, data);
+
+   ipmmu_write(domain->root, domain->context_id * IM_CTX_SIZE + reg, data);
+}
+
 /* 
-
  * TLB and microTLB Management
  */
@@ -287,7 +297,7 @@ static void ipmmu_tlb_invalidate(struct
 
reg = ipmmu_ctx_read(domain, IMCTR);
reg |= IMCTR_FLUSH;
-   ipmmu_ctx_write(domain, IMCTR, reg);
+   ipmmu_ctx_write2(domain, IMCTR, reg);
 
ipmmu_tlb_sync(domain);
 }
@@ -445,7 +455,8 @@ static int ipmmu_domain_init_context(str
 * software management as we have no use for it. Flush the TLB as
 * required when modifying the context registers.
 */
-   ipmmu_ctx_write(domain, IMCTR, IMCTR_INTEN | IMCTR_FLUSH | IMCTR_MMUEN);
+   ipmmu_ctx_write2(domain, IMCTR,
+IMCTR_INTEN | IMCTR_FLUSH | IMCTR_MMUEN);
 
return 0;
 }
@@ -471,7 +482,7 @@ static void ipmmu_domain_destroy_context
 *
 * TODO: Is TLB flush really needed ?
 */
-   ipmmu_ctx_write(domain, IMCTR, IMCTR_FLUSH);
+   ipmmu_ctx_write2(domain, IMCTR, IMCTR_FLUSH);
ipmmu_tlb_sync(domain);
ipmmu_domain_free_context(domain->root, domain->context_id);
 }


  1   2   3   4   5   6   7   8   9   10   >