Re: [BUG] might sleep functions in atomic context in stmmac_resume()

2014-05-18 Thread Giuseppe CAVALLARO

Hello Alexey

On 5/17/2014 1:15 AM, Alexey Khoroshilov wrote:

There are calls to might sleep functions in atomic context in
stmmac_resume():
- the first one is clk_prepare_enable(priv->stmmac_clk);
- the second one is stmmac_hw_setup()
-> init_dma_desc_rings()
   -> stmmac_init_rx_buffers()
 -> __netdev_alloc_skb(GFP_KERNEL)

What is the purpose of spin_lock_irqsave(&priv->lock, flags) section?
What does it protect against?


Some part of this driver, especially on PM stuff, has been reworked
time ago.
I have in plan to do further tests and investigations
also to understand and try to solve this kind of issues. I do not
want to see this kind of BUGs. Also I have some other patches on
other pending problem I will submit to be reviewed.
I hope to start doing this task in the incoming days.

BR
peppe



Found by Linux Driver Verification project (linuxtesting.org).

--
Alexey Khoroshilov
Linux Verification Center, ISPRAS
web: http://linuxtesting.org




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] clk: s2mps11: Simplify s2mps11_clk_probe unwind paths

2014-05-18 Thread Krzysztof Kozlowski
On nie, 2014-05-18 at 23:51 +0800, Axel Lin wrote:
> The devm_clk_unregister() in probe error paths are not necessary as it will be
> automatically called when probe fails.
> 
> Signed-off-by: Axel Lin 
> ---
>  drivers/clk/clk-s2mps11.c | 14 --
>  1 file changed, 4 insertions(+), 10 deletions(-)

Reviewed-by: Krzysztof Kozlowski 

Best regards,
Krzysztof



> diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
> index f2f62a1b..aeaa61c 100644
> --- a/drivers/clk/clk-s2mps11.c
> +++ b/drivers/clk/clk-s2mps11.c
> @@ -210,7 +210,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
>   sizeof(struct clk_lookup), GFP_KERNEL);
>   if (!s2mps11_clk->lookup) {
>   ret = -ENOMEM;
> - goto err_lup;
> + goto err_reg;
>   }
>  
>   s2mps11_clk->lookup->con_id = s2mps11_name(s2mps11_clk);
> @@ -231,16 +231,10 @@ static int s2mps11_clk_probe(struct platform_device 
> *pdev)
>   platform_set_drvdata(pdev, s2mps11_clks);
>  
>   return ret;
> -err_lup:
> - devm_clk_unregister(&pdev->dev, s2mps11_clk->clk);
> +
>  err_reg:
> - while (s2mps11_clk > s2mps11_clks) {
> - if (s2mps11_clk->lookup) {
> - clkdev_drop(s2mps11_clk->lookup);
> - devm_clk_unregister(&pdev->dev, s2mps11_clk->clk);
> - }
> - s2mps11_clk--;
> - }
> + while (--i >= 0)
> + clkdev_drop(s2mps11_clks[i].lookup);
>  
>   return ret;
>  }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] drm/gk20a/fb: fix huge memory leak

2014-05-18 Thread Alexandre Courbot
CMA-allocated memory must be freed by an exact mirror call to
dma_release_from_contiguous(). It cannot be freed page-by-page as was
previously believed without severe memory leakage.

This page records the address and size of every allocated memory chunk
so they can be properly freed when needed.

Signed-off-by: Alexandre Courbot 
---
 drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c | 74 ++-
 1 file changed, 46 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c 
b/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c
index 7effd1a63458..5904af52e6d6 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c
@@ -28,28 +28,34 @@
 #include 
 #include 
 
+struct gk20a_mem_chunk {
+   struct list_head list;
+   struct page *pages;
+   u32 npages;
+};
+
+struct gk20a_mem {
+   struct nouveau_mem base;
+   struct list_head head;
+};
+
 static void
 gk20a_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem)
 {
struct device *dev = nv_device_base(nv_device(pfb));
-   struct nouveau_mem *mem = *pmem;
-   int i;
+   struct gk20a_mem *mem = container_of(*pmem, struct gk20a_mem, base);
+   struct gk20a_mem_chunk *chunk, *n;
 
*pmem = NULL;
if (unlikely(mem == NULL))
return;
 
-   for (i = 0; i < mem->size; i++) {
-   struct page *page;
-
-   if (mem->pages[i] == 0)
-   break;
-
-   page = pfn_to_page(mem->pages[i] >> PAGE_SHIFT);
-   dma_release_from_contiguous(dev, page, 1);
+   list_for_each_entry_safe(chunk, n, &mem->head, list) {
+   dma_release_from_contiguous(dev, chunk->pages, chunk->npages);
+   kfree(chunk);
}
 
-   kfree(mem->pages);
+   kfree(mem->base.pages);
kfree(mem);
 }
 
@@ -58,9 +64,8 @@ gk20a_ram_get(struct nouveau_fb *pfb, u64 size, u32 align, 
u32 ncmin,
 u32 memtype, struct nouveau_mem **pmem)
 {
struct device *dev = nv_device_base(nv_device(pfb));
-   struct nouveau_mem *mem;
+   struct gk20a_mem *mem;
int type = memtype & 0xff;
-   dma_addr_t dma_addr;
int npages;
int order;
int i;
@@ -95,44 +100,57 @@ gk20a_ram_get(struct nouveau_fb *pfb, u64 size, u32 align, 
u32 ncmin,
if (!mem)
return -ENOMEM;
 
-   mem->size = npages;
-   mem->memtype = type;
+   mem->base.size = npages;
+   mem->base.memtype = type;
 
-   mem->pages = kzalloc(sizeof(dma_addr_t) * npages, GFP_KERNEL);
-   if (!mem) {
+   mem->base.pages = kzalloc(sizeof(dma_addr_t) * npages, GFP_KERNEL);
+   if (!mem->base.pages) {
kfree(mem);
return -ENOMEM;
}
 
+   INIT_LIST_HEAD(&mem->head);
+
+   *pmem = &mem->base;
+
while (npages) {
-   struct page *pages;
+   struct gk20a_mem_chunk *chunk;
+   dma_addr_t addr;
int pos = 0;
 
/* don't overflow in case size is not a multiple of ncmin */
if (ncmin > npages)
ncmin = npages;
 
-   pages = dma_alloc_from_contiguous(dev, ncmin, order);
-   if (!pages) {
-   gk20a_ram_put(pfb, &mem);
+   chunk = kzalloc(sizeof(*chunk), GFP_KERNEL);
+   if (!chunk) {
+   gk20a_ram_put(pfb, pmem);
return -ENOMEM;
}
 
-   dma_addr = (dma_addr_t)(page_to_pfn(pages) << PAGE_SHIFT);
+   chunk->pages = dma_alloc_from_contiguous(dev, ncmin, order);
+   if (!chunk->pages) {
+   kfree(chunk);
+   gk20a_ram_put(pfb, pmem);
+   return -ENOMEM;
+   }
 
-   nv_debug(pfb, "  alloc count: %x, order: %x, addr: %pad\n", 
ncmin,
-order, &dma_addr);
+   chunk->npages = ncmin;
+   list_add_tail(&chunk->list, &mem->head);
+
+   addr = (dma_addr_t)(page_to_pfn(chunk->pages) << PAGE_SHIFT);
+
+   nv_debug(pfb, "  alloc count: %x, order: %x, addr: %pad\n",
+ncmin, order, &addr);
 
for (i = 0; i < ncmin; i++)
-   mem->pages[pos + i] = dma_addr + (PAGE_SIZE * i);
+   mem->base.pages[pos + i] = addr + (PAGE_SIZE * i);
 
pos += ncmin;
npages -= ncmin;
}
 
-   mem->offset = (u64)mem->pages[0];
-
-   *pmem = mem;
+   mem->base.offset = (u64)mem->base.pages[0];
 
return 0;
 }
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please re

[PATCH 2/2] drm/gk20a/fb: fix compile error whith CMA and module

2014-05-18 Thread Alexandre Courbot
CMA functions are not available to kernel modules, but the GK20A FB
driver currently (and temporarily) relies on them.

This patch replaces the calls to CMA functions in problematic cases (CMA
enabled and Nouveau compiled as a module) with dummy stubs that will
make this particular driver fail, but at least won't produce a compile
error.

This is a temporary fix until a better memory allocation scheme is
devised.

Signed-off-by: Alexandre Courbot 
---
 drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c | 25 +--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c 
b/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c
index 5904af52e6d6..fa867ce5449e 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c
@@ -39,6 +39,27 @@ struct gk20a_mem {
struct list_head head;
 };
 
+/*
+ * CMA is not available to modules. Until we find a better solution, make
+ * memory allocations fail in that case.
+ */
+#if IS_ENABLED(CONFIG_CMA) && IS_MODULE(CONFIG_DRM_NOUVEAU)
+static inline struct page *
+alloc_contiguous_memory(struct device *dev, int count, unsigned int order)
+{
+   dev_err(dev, "cannot use CMA from a module - allocation failed\n");
+   return NULL;
+}
+
+static inline void
+release_contiguous_memory(struct device *dev, struct page *page, int count)
+{
+}
+#else
+#define alloc_contiguous_memory(d, c, o) dma_alloc_from_contiguous(d, c, o)
+#define release_contiguous_memory(d, p, c) dma_release_from_contiguous(d, p, c)
+#endif
+
 static void
 gk20a_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem)
 {
@@ -51,7 +72,7 @@ gk20a_ram_put(struct nouveau_fb *pfb, struct nouveau_mem 
**pmem)
return;
 
list_for_each_entry_safe(chunk, n, &mem->head, list) {
-   dma_release_from_contiguous(dev, chunk->pages, chunk->npages);
+   release_contiguous_memory(dev, chunk->pages, chunk->npages);
kfree(chunk);
}
 
@@ -128,7 +149,7 @@ gk20a_ram_get(struct nouveau_fb *pfb, u64 size, u32 align, 
u32 ncmin,
return -ENOMEM;
}
 
-   chunk->pages = dma_alloc_from_contiguous(dev, ncmin, order);
+   chunk->pages = alloc_contiguous_memory(dev, ncmin, order);
if (!chunk->pages) {
kfree(chunk);
gk20a_ram_put(pfb, pmem);
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/2] drm/gk20a: FB fixes

2014-05-18 Thread Alexandre Courbot
Fix a very shameful memory leak and a compilation error due to the use of
non-exported CMA functions. The workaround for the latter is not really elegant
(replace the CMA functions by a runtime failure if we are compiled as a
module), but is temporary and still an improvement over the current situation
(compile error).

Alexandre Courbot (2):
  drm/gk20a/fb: fix huge memory leak
  drm/gk20a/fb: fix compile error whith CMA and module

 drivers/gpu/drm/nouveau/core/subdev/fb/ramgk20a.c | 95 ---
 1 file changed, 67 insertions(+), 28 deletions(-)

-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] KVM: vmx: DR7 masking on task switch emulation is wrong

2014-05-18 Thread Nadav Amit
The DR7 masking which is done on task switch emulation should be in hex format
(clearing the local breakpoints enable bits 0,2,4 and 6).

Signed-off-by: Nadav Amit 
---
 arch/x86/kvm/vmx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 138ceff..286d510 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -5439,7 +5439,7 @@ static int handle_task_switch(struct kvm_vcpu *vcpu)
}
 
/* clear all local breakpoint enable flags */
-   vmcs_writel(GUEST_DR7, vmcs_readl(GUEST_DR7) & ~55);
+   vmcs_writel(GUEST_DR7, vmcs_readl(GUEST_DR7) & ~0x55);
 
/*
 * TODO: What about debug traps on tss switch?
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] pwm: i.MX: Avoid sample FIFO overflow for i.MX PWM version2

2014-05-18 Thread Liu Ying
Hi Lothar,

Thanks for your review.

On 05/19/2014 01:53 PM, Lothar Waßmann wrote:
> Hi,
> 
> Liu Ying wrote:
> [...]
>> @@ -30,6 +32,7 @@
>>  /* i.MX27, i.MX31, i.MX35 share the same PWM function block: */
>>  
>>  #define MX3_PWMCR 0x00/* PWM Control Register */
>> +#define MX3_PWMIR 0x08/* PWM Interrupt Register */
>>  #define MX3_PWMSAR0x0C/* PWM Sample Register */
>>  #define MX3_PWMPR 0x10/* PWM Period Register */
>>  #define MX3_PWMCR_PRESCALER(x)(((x - 1) & 0xFFF) << 4)
>> @@ -38,7 +41,12 @@
>>  #define MX3_PWMCR_DBGEN (1 << 22)
>>  #define MX3_PWMCR_CLKSRC_IPG_HIGH (2 << 16)
>>  #define MX3_PWMCR_CLKSRC_IPG  (1 << 16)
>> +#define MX3_PWMCR_SWR (1 << 3)
>>  #define MX3_PWMCR_EN  (1 << 0)
>> +#define MX3_PWMSR_ROV (1 << 4)
>> +#define MX3_PWMIR_RIE (1 << 1)
>> +
> You should decide whether to use tabs or spaces for indentation.
> And probably cleanup the indentation of the existing definitions to use
> all the same indentation style.

Ok, I will generate a separate patch to cleanup the indentation for
the existing register definitions of both i.MX PWMv1 and PWMv2.

> 
>> @@ -128,6 +160,13 @@ static int imx_pwm_config_v2(struct pwm_chip *chip,
>>  else
>>  period_cycles = 0;
>>  
>> +if (!enable || duty_cycles == 0)
>> +imx_pwm_software_reset_v2(chip);
>> +else if (readl(imx->mmio_base + MX3_PWMSAR))
>> +/* No rollover irq generated if duty peroid is zero. */
> typo: 'period'.

I will fix this.

> 
>> @@ -135,27 +174,55 @@ static int imx_pwm_config_v2(struct pwm_chip *chip,
>>  MX3_PWMCR_DOZEEN | MX3_PWMCR_WAITEN |
>>  MX3_PWMCR_DBGEN | MX3_PWMCR_CLKSRC_IPG_HIGH;
>>  
>> -if (test_bit(PWMF_ENABLED, &pwm->flags))
>> +if (enable)
>>  cr |= MX3_PWMCR_EN;
>>  
>>  writel(cr, imx->mmio_base + MX3_PWMCR);
>>  
>> +if (enable && duty_cycles)
>> +/* No rollover irq generated if duty peroid is zero. */
> dto.

I will fix this.

> 
> 
> Lothar Waßmann
> 

-- 
Liu Ying
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2 v4] ARM: imx: fix error handling in ipu device registration

2014-05-18 Thread Shawn Guo
On Mon, May 19, 2014 at 08:31:45AM +0200, Uwe Kleine-König wrote:
> On Sun, May 18, 2014 at 10:50:59PM +0200, Emil Goode wrote:
> > If we fail to allocate struct platform_device pdev we
> > dereference it after the goto label err.
> > 
> > This bug was found using coccinelle.
> > 
> > Signed-off-by: Emil Goode 
> Acked-by: Uwe Kleine-König 
> 
> Shawn, is it already to late for 3.15?

Let me try to see.

Shawn
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/22] atmel_mxt_ts patches, already signed-off

2014-05-18 Thread Dmitry Torokhov
Hi NIck,

On Thu, Apr 03, 2014 at 11:41:57AM +0100, Nick Dyer wrote:
> Hi Dmitry-
> 
> Nick Dyer  wrote:
> > Here is a set of patches for atmel_mxt_ts that you've already
> > signed-off. I've rebased them against the most recent mainline and made
> > some very minor changes such as INIT_COMPLETION->reinit_completion.
> 
> It would be useful to have some feedback about this patchset if you have time.
> 

I applied majority of the patches, but dropped 11 (firmware loader) as
it gives trouble in its current for when driver is compiled in and I
also had to drop 12 and 19 because of reject dues to dropping 11.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 07/20] perf ui: Get rid of callback from __hpp__fmt()

2014-05-18 Thread Namhyung Kim
The callback was used by TUI for determining color of folded sign
using percent of first field/column.  But it cannot be used anymore
since it now support dynamic reording of output field.

So move the logic to the hist_browser__show_entry().

Acked-by: Ingo Molnar 
Signed-off-by: Namhyung Kim 
---
 tools/perf/ui/browsers/hists.c | 62 --
 tools/perf/ui/gtk/hists.c  |  2 +-
 tools/perf/ui/hist.c   | 28 ++-
 tools/perf/util/hist.h |  4 +--
 4 files changed, 34 insertions(+), 62 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index b87d9baf237e..4e9b82b5fb1f 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -616,35 +616,6 @@ struct hpp_arg {
bool current_entry;
 };
 
-static int __hpp__overhead_callback(struct perf_hpp *hpp, bool front)
-{
-   struct hpp_arg *arg = hpp->ptr;
-
-   if (arg->current_entry && arg->b->navkeypressed)
-   ui_browser__set_color(arg->b, HE_COLORSET_SELECTED);
-   else
-   ui_browser__set_color(arg->b, HE_COLORSET_NORMAL);
-
-   if (front) {
-   if (!symbol_conf.use_callchain)
-   return 0;
-
-   slsmg_printf("%c ", arg->folded_sign);
-   return 2;
-   }
-
-   return 0;
-}
-
-static int __hpp__color_callback(struct perf_hpp *hpp, bool front 
__maybe_unused)
-{
-   struct hpp_arg *arg = hpp->ptr;
-
-   if (!arg->current_entry || !arg->b->navkeypressed)
-   ui_browser__set_color(arg->b, HE_COLORSET_NORMAL);
-   return 0;
-}
-
 static int __hpp__slsmg_color_printf(struct perf_hpp *hpp, const char *fmt, 
...)
 {
struct hpp_arg *arg = hpp->ptr;
@@ -665,7 +636,7 @@ static int __hpp__slsmg_color_printf(struct perf_hpp *hpp, 
const char *fmt, ...)
return ret;
 }
 
-#define __HPP_COLOR_PERCENT_FN(_type, _field, _cb) \
+#define __HPP_COLOR_PERCENT_FN(_type, _field)  \
 static u64 __hpp_get_##_field(struct hist_entry *he)   \
 {  \
return he->stat._field; \
@@ -676,15 +647,15 @@ hist_browser__hpp_color_##_type(struct perf_hpp_fmt *fmt 
__maybe_unused,\
struct perf_hpp *hpp,   \
struct hist_entry *he)  \
 {  \
-   return __hpp__fmt(hpp, he, __hpp_get_##_field, _cb, " %6.2f%%", \
+   return __hpp__fmt(hpp, he, __hpp_get_##_field, " %6.2f%%",  \
  __hpp__slsmg_color_printf, true); \
 }
 
-__HPP_COLOR_PERCENT_FN(overhead, period, __hpp__overhead_callback)
-__HPP_COLOR_PERCENT_FN(overhead_sys, period_sys, __hpp__color_callback)
-__HPP_COLOR_PERCENT_FN(overhead_us, period_us, __hpp__color_callback)
-__HPP_COLOR_PERCENT_FN(overhead_guest_sys, period_guest_sys, 
__hpp__color_callback)
-__HPP_COLOR_PERCENT_FN(overhead_guest_us, period_guest_us, 
__hpp__color_callback)
+__HPP_COLOR_PERCENT_FN(overhead, period)
+__HPP_COLOR_PERCENT_FN(overhead_sys, period_sys)
+__HPP_COLOR_PERCENT_FN(overhead_us, period_us)
+__HPP_COLOR_PERCENT_FN(overhead_guest_sys, period_guest_sys)
+__HPP_COLOR_PERCENT_FN(overhead_guest_us, period_guest_us)
 
 #undef __HPP_COLOR_PERCENT_FN
 
@@ -729,7 +700,7 @@ static int hist_browser__show_entry(struct hist_browser 
*browser,
 
if (row_offset == 0) {
struct hpp_arg arg = {
-   .b  = &browser->b,
+   .b  = &browser->b,
.folded_sign= folded_sign,
.current_entry  = current_entry,
};
@@ -742,11 +713,24 @@ static int hist_browser__show_entry(struct hist_browser 
*browser,
ui_browser__gotorc(&browser->b, row, 0);
 
perf_hpp__for_each_format(fmt) {
-   if (!first) {
+   if (current_entry && browser->b.navkeypressed) {
+   ui_browser__set_color(&browser->b,
+ HE_COLORSET_SELECTED);
+   } else {
+   ui_browser__set_color(&browser->b,
+ HE_COLORSET_NORMAL);
+   }
+
+   if (first) {
+   if (symbol_conf.use_callchain) {
+   slsmg_printf("%c ", folded_sign);
+   width -= 2;
+   }
+   first = false;
+   } else {
slsmg_printf("  ");
width -= 2;
 

Re: [PATCH 1/2 v4] ARM: imx: fix error handling in ipu device registration

2014-05-18 Thread Uwe Kleine-König
On Sun, May 18, 2014 at 10:50:59PM +0200, Emil Goode wrote:
> If we fail to allocate struct platform_device pdev we
> dereference it after the goto label err.
> 
> This bug was found using coccinelle.
> 
> Signed-off-by: Emil Goode 
Acked-by: Uwe Kleine-König 

Shawn, is it already to late for 3.15?

Thanks
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/20] perf tools: Support event grouping in hpp ->sort()

2014-05-18 Thread Namhyung Kim
Move logic of hist_entry__sort_on_period to __hpp__sort() in order to
support event group report.

Acked-by: Ingo Molnar 
Signed-off-by: Namhyung Kim 
---
 tools/perf/ui/hist.c | 64 +++-
 1 file changed, 58 insertions(+), 6 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index a6eea666b443..0299385284fd 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -116,6 +116,62 @@ int __hpp__fmt(struct perf_hpp *hpp, struct hist_entry *he,
return ret;
 }
 
+static int field_cmp(u64 field_a, u64 field_b)
+{
+   if (field_a > field_b)
+   return 1;
+   if (field_a < field_b)
+   return -1;
+   return 0;
+}
+
+static int __hpp__sort(struct hist_entry *a, struct hist_entry *b,
+  hpp_field_fn get_field)
+{
+   s64 ret;
+   int i, nr_members;
+   struct perf_evsel *evsel;
+   struct hist_entry *pair;
+   u64 *fields_a, *fields_b;
+
+   ret = field_cmp(get_field(a), get_field(b));
+   if (ret || !symbol_conf.event_group)
+   return ret;
+
+   evsel = hists_to_evsel(a->hists);
+   if (!perf_evsel__is_group_event(evsel))
+   return ret;
+
+   nr_members = evsel->nr_members;
+   fields_a = calloc(sizeof(*fields_a), nr_members);
+   fields_b = calloc(sizeof(*fields_b), nr_members);
+
+   if (!fields_a || !fields_b)
+   goto out;
+
+   list_for_each_entry(pair, &a->pairs.head, pairs.node) {
+   evsel = hists_to_evsel(pair->hists);
+   fields_a[perf_evsel__group_idx(evsel)] = get_field(pair);
+   }
+
+   list_for_each_entry(pair, &b->pairs.head, pairs.node) {
+   evsel = hists_to_evsel(pair->hists);
+   fields_b[perf_evsel__group_idx(evsel)] = get_field(pair);
+   }
+
+   for (i = 1; i < nr_members; i++) {
+   ret = field_cmp(fields_a[i], fields_b[i]);
+   if (ret)
+   break;
+   }
+
+out:
+   free(fields_a);
+   free(fields_b);
+
+   return ret;
+}
+
 #define __HPP_HEADER_FN(_type, _str, _min_width, _unit_width)  \
 static int hpp__header_##_type(struct perf_hpp_fmt *fmt __maybe_unused,
\
   struct perf_hpp *hpp,\
@@ -195,9 +251,7 @@ static int hpp__entry_##_type(struct perf_hpp_fmt *_fmt 
__maybe_unused, \
 #define __HPP_SORT_FN(_type, _field)   
\
 static int64_t hpp__sort_##_type(struct hist_entry *a, struct hist_entry *b)   
\
 {  
\
-   s64 __a = he_get_##_field(a);   
\
-   s64 __b = he_get_##_field(b);   
\
-   return __a - __b;   
\
+   return __hpp__sort(a, b, he_get_##_field);  
\
 }
 
 #define __HPP_ENTRY_RAW_FN(_type, _field)  
\
@@ -217,9 +271,7 @@ static int hpp__entry_##_type(struct perf_hpp_fmt *_fmt 
__maybe_unused, \
 #define __HPP_SORT_RAW_FN(_type, _field)   
\
 static int64_t hpp__sort_##_type(struct hist_entry *a, struct hist_entry *b)   
\
 {  
\
-   s64 __a = he_get_raw_##_field(a);   
\
-   s64 __b = he_get_raw_##_field(b);   
\
-   return __a - __b;   
\
+   return __hpp__sort(a, b, he_get_raw_##_field);  
\
 }
 
 
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 06/20] perf tools: Consolidate output field handling to hpp format routines

2014-05-18 Thread Namhyung Kim
Until now the hpp and sort functions do similar jobs different ways.
Since the sort functions converted/wrapped to hpp formats it can do
the job in a uniform way.

The perf_hpp__sort_list has a list of hpp formats to sort entries and
the perf_hpp__list has a list of hpp formats to print output result.

To have a backward compatiblity, it automatically adds 'overhead'
field in front of sort list.  And then all of fields in sort list
added to the output list (if it's not already there).

Acked-by: Ingo Molnar 
Signed-off-by: Namhyung Kim 
---
 tools/perf/ui/browsers/hists.c | 32 +++-
 tools/perf/ui/gtk/hists.c  | 31 
 tools/perf/ui/hist.c   | 26 
 tools/perf/ui/stdio/hist.c | 55 +-
 tools/perf/util/hist.c |  2 +-
 tools/perf/util/hist.h |  1 +
 6 files changed, 65 insertions(+), 82 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index b0861e3e50a5..b87d9baf237e 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -760,8 +760,8 @@ static int hist_browser__show_entry(struct hist_browser 
*browser,
if (!browser->b.navkeypressed)
width += 1;
 
-   hist_entry__sort_snprintf(entry, s, sizeof(s), browser->hists);
-   slsmg_write_nstring(s, width);
+   slsmg_write_nstring("", width);
+
++row;
++printed;
} else
@@ -1104,27 +1104,35 @@ static int hist_browser__fprintf_entry(struct 
hist_browser *browser,
   struct hist_entry *he, FILE *fp)
 {
char s[8192];
-   double percent;
int printed = 0;
char folded_sign = ' ';
+   struct perf_hpp hpp = {
+   .buf = s,
+   .size = sizeof(s),
+   };
+   struct perf_hpp_fmt *fmt;
+   bool first = true;
+   int ret;
 
if (symbol_conf.use_callchain)
folded_sign = hist_entry__folded(he);
 
-   hist_entry__sort_snprintf(he, s, sizeof(s), browser->hists);
-   percent = (he->stat.period * 100.0) / 
browser->hists->stats.total_period;
-
if (symbol_conf.use_callchain)
printed += fprintf(fp, "%c ", folded_sign);
 
-   printed += fprintf(fp, " %5.2f%%", percent);
-
-   if (symbol_conf.show_nr_samples)
-   printed += fprintf(fp, " %11u", he->stat.nr_events);
+   perf_hpp__for_each_format(fmt) {
+   if (perf_hpp__should_skip(fmt))
+   continue;
 
-   if (symbol_conf.show_total_period)
-   printed += fprintf(fp, " %12" PRIu64, he->stat.period);
+   if (!first) {
+   ret = scnprintf(hpp.buf, hpp.size, "  ");
+   advance_hpp(&hpp, ret);
+   } else
+   first = false;
 
+   ret = fmt->entry(fmt, &hpp, he);
+   advance_hpp(&hpp, ret);
+   }
printed += fprintf(fp, "%s\n", rtrim(s));
 
if (folded_sign == '-')
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 91f10f3f6dd1..d5c336e1bb14 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -153,7 +153,6 @@ static void perf_gtk__show_hists(GtkWidget *window, struct 
hists *hists,
struct perf_hpp_fmt *fmt;
GType col_types[MAX_COLUMNS];
GtkCellRenderer *renderer;
-   struct sort_entry *se;
GtkTreeStore *store;
struct rb_node *nd;
GtkWidget *view;
@@ -172,16 +171,6 @@ static void perf_gtk__show_hists(GtkWidget *window, struct 
hists *hists,
perf_hpp__for_each_format(fmt)
col_types[nr_cols++] = G_TYPE_STRING;
 
-   list_for_each_entry(se, &hist_entry__sort_list, list) {
-   if (se->elide)
-   continue;
-
-   if (se == &sort_sym)
-   sym_col = nr_cols;
-
-   col_types[nr_cols++] = G_TYPE_STRING;
-   }
-
store = gtk_tree_store_newv(nr_cols, col_types);
 
view = gtk_tree_view_new();
@@ -199,16 +188,6 @@ static void perf_gtk__show_hists(GtkWidget *window, struct 
hists *hists,
col_idx++, NULL);
}
 
-   list_for_each_entry(se, &hist_entry__sort_list, list) {
-   if (se->elide)
-   continue;
-
-   gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
-   -1, se->se_header,
-   renderer, "text",
-   col_idx++, NULL);
-   }
-
for (col_idx = 0; col_idx < nr_cols; col_idx++) {
GtkTreeViewColumn *column;
 
@@ -253,16 +232,6 @@ static void perf_gtk__show_hists(G

[PATCH 01/20] perf tools: Add ->cmp(), ->collapse() and ->sort() to perf_hpp_fmt

2014-05-18 Thread Namhyung Kim
Those function pointers will be used to sort report output based on
the selected fields.  This is a preparation of later change.

Acked-by: Ingo Molnar 
Signed-off-by: Namhyung Kim 
---
 tools/perf/ui/hist.c   | 39 +++
 tools/perf/util/hist.h |  3 +++
 2 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 0912805c08f4..d4a4f2e7eb43 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -192,6 +192,14 @@ static int hpp__entry_##_type(struct perf_hpp_fmt *_fmt 
__maybe_unused,\
  hpp_entry_scnprintf, true);   
\
 }
 
+#define __HPP_SORT_FN(_type, _field)   
\
+static int64_t hpp__sort_##_type(struct hist_entry *a, struct hist_entry *b)   
\
+{  
\
+   s64 __a = he_get_##_field(a);   
\
+   s64 __b = he_get_##_field(b);   
\
+   return __a - __b;   
\
+}
+
 #define __HPP_ENTRY_RAW_FN(_type, _field)  
\
 static u64 he_get_raw_##_field(struct hist_entry *he)  
\
 {  
\
@@ -206,16 +214,27 @@ static int hpp__entry_##_type(struct perf_hpp_fmt *_fmt 
__maybe_unused,   \
  hpp_entry_scnprintf, false);  
\
 }
 
+#define __HPP_SORT_RAW_FN(_type, _field)   
\
+static int64_t hpp__sort_##_type(struct hist_entry *a, struct hist_entry *b)   
\
+{  
\
+   s64 __a = he_get_raw_##_field(a);   
\
+   s64 __b = he_get_raw_##_field(b);   
\
+   return __a - __b;   
\
+}
+
+
 #define HPP_PERCENT_FNS(_type, _str, _field, _min_width, _unit_width)  \
 __HPP_HEADER_FN(_type, _str, _min_width, _unit_width)  \
 __HPP_WIDTH_FN(_type, _min_width, _unit_width) \
 __HPP_COLOR_PERCENT_FN(_type, _field)  \
-__HPP_ENTRY_PERCENT_FN(_type, _field)
+__HPP_ENTRY_PERCENT_FN(_type, _field)  \
+__HPP_SORT_FN(_type, _field)
 
 #define HPP_RAW_FNS(_type, _str, _field, _min_width, _unit_width)  \
 __HPP_HEADER_FN(_type, _str, _min_width, _unit_width)  \
 __HPP_WIDTH_FN(_type, _min_width, _unit_width) \
-__HPP_ENTRY_RAW_FN(_type, _field)
+__HPP_ENTRY_RAW_FN(_type, _field)  \
+__HPP_SORT_RAW_FN(_type, _field)
 
 
 HPP_PERCENT_FNS(overhead, "Overhead", period, 8, 8)
@@ -227,19 +246,31 @@ HPP_PERCENT_FNS(overhead_guest_us, "guest usr", 
period_guest_us, 9, 8)
 HPP_RAW_FNS(samples, "Samples", nr_events, 12, 12)
 HPP_RAW_FNS(period, "Period", period, 12, 12)
 
+static int64_t hpp__nop_cmp(struct hist_entry *a __maybe_unused,
+   struct hist_entry *b __maybe_unused)
+{
+   return 0;
+}
+
 #define HPP__COLOR_PRINT_FNS(_name)\
{   \
.header = hpp__header_ ## _name,\
.width  = hpp__width_ ## _name, \
.color  = hpp__color_ ## _name, \
-   .entry  = hpp__entry_ ## _name  \
+   .entry  = hpp__entry_ ## _name, \
+   .cmp= hpp__nop_cmp, \
+   .collapse = hpp__nop_cmp,   \
+   .sort   = hpp__sort_ ## _name,  \
}
 
 #define HPP__PRINT_FNS(_name)  \
{   \
.header = hpp__header_ ## _name,\
.width  = hpp__width_ ## _name, \
-   .entry  = hpp__entry_ ## _name  \
+   .entry  = hpp__entry_ ## _name, \
+   .cmp= hpp__nop_cmp, \
+   .collapse = hpp__nop_cmp,   \
+   .sort   = hpp__sort_ ## _name,  \
}
 
 struct perf_hpp_fmt perf_hpp__format[] = {
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 38c3e874c164..36dbe00e3cc8 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -160,6 +160,9 @@ struct perf_hpp_fmt {
 struct hist_entry *he);
int (*entry)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 struct hist_entry *he);
+   int64_t (*cmp)(struct hist_entry *a, struct hist_entry *b);
+   int64_t (*collapse)(struct hist_entry *a

[PATCH 18/20] perf tools: Introduce reset_output_field()

2014-05-18 Thread Namhyung Kim
The reset_output_field() function is for clearing output field
settings and will be used for test code in later patch.

Signed-off-by: Namhyung Kim 
---
 tools/perf/ui/hist.c   | 17 +
 tools/perf/util/hist.h |  7 +++
 tools/perf/util/sort.c | 11 +++
 tools/perf/util/sort.h |  1 +
 4 files changed, 36 insertions(+)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 61cf31e094f3..4484f5bd1b14 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -459,6 +459,23 @@ next:
}
 }
 
+void perf_hpp__reset_output_field(void)
+{
+   struct perf_hpp_fmt *fmt, *tmp;
+
+   /* reset output fields */
+   perf_hpp__for_each_format_safe(fmt, tmp) {
+   list_del_init(&fmt->list);
+   list_del_init(&fmt->sort_list);
+   }
+
+   /* reset sort keys */
+   perf_hpp__for_each_sort_list_safe(fmt, tmp) {
+   list_del_init(&fmt->list);
+   list_del_init(&fmt->sort_list);
+   }
+}
+
 /*
  * See hists__fprintf to match the column widths
  */
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 034db761630e..a8418d19808d 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -174,9 +174,15 @@ extern struct list_head perf_hpp__sort_list;
 #define perf_hpp__for_each_format(format) \
list_for_each_entry(format, &perf_hpp__list, list)
 
+#define perf_hpp__for_each_format_safe(format, tmp)\
+   list_for_each_entry_safe(format, tmp, &perf_hpp__list, list)
+
 #define perf_hpp__for_each_sort_list(format) \
list_for_each_entry(format, &perf_hpp__sort_list, sort_list)
 
+#define perf_hpp__for_each_sort_list_safe(format, tmp) \
+   list_for_each_entry_safe(format, tmp, &perf_hpp__sort_list, sort_list)
+
 extern struct perf_hpp_fmt perf_hpp__format[];
 
 enum {
@@ -197,6 +203,7 @@ void perf_hpp__column_register(struct perf_hpp_fmt *format);
 void perf_hpp__column_enable(unsigned col);
 void perf_hpp__register_sort_field(struct perf_hpp_fmt *format);
 void perf_hpp__setup_output_field(void);
+void perf_hpp__reset_output_field(void);
 void perf_hpp__append_sort_keys(void);
 
 bool perf_hpp__is_sort_entry(struct perf_hpp_fmt *format);
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index d9132069d3b1..901b9bece2ee 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1573,3 +1573,14 @@ int setup_sorting(void)
 
return 0;
 }
+
+void reset_output_field(void)
+{
+   sort__need_collapse = 0;
+   sort__has_parent = 0;
+   sort__has_sym = 0;
+   sort__has_dso = 0;
+
+   reset_dimensions();
+   perf_hpp__reset_output_field();
+}
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index f5a831c3d0fb..5f38d925e92f 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -194,6 +194,7 @@ extern struct list_head hist_entry__sort_list;
 
 int setup_sorting(void);
 int setup_output_field(void);
+void reset_output_field(void);
 extern int sort_dimension__add(const char *);
 void sort__setup_elide(FILE *fp);
 
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 17/20] perf tools: Get rid of obsolete hist_entry__sort_list

2014-05-18 Thread Namhyung Kim
Now we moved to the perf_hpp_[_sort]_list so no need to keep the old
hist_entry__sort_list and sort__first_dimension.  Also the
hist_entry__sort_snprintf() can be gone as hist_entry__snprintf()
provides the functionality.

Signed-off-by: Namhyung Kim 
---
 tools/perf/ui/hist.c   | 36 +---
 tools/perf/ui/stdio/hist.c | 22 +++---
 tools/perf/util/sort.c | 35 +++
 3 files changed, 43 insertions(+), 50 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index b114c6668865..61cf31e094f3 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -459,47 +459,29 @@ next:
}
 }
 
-int hist_entry__sort_snprintf(struct hist_entry *he, char *s, size_t size,
- struct hists *hists)
-{
-   const char *sep = symbol_conf.field_sep;
-   struct sort_entry *se;
-   int ret = 0;
-
-   list_for_each_entry(se, &hist_entry__sort_list, list) {
-   if (se->elide)
-   continue;
-
-   ret += scnprintf(s + ret, size - ret, "%s", sep ?: "  ");
-   ret += se->se_snprintf(he, s + ret, size - ret,
-  hists__col_len(hists, se->se_width_idx));
-   }
-
-   return ret;
-}
-
 /*
  * See hists__fprintf to match the column widths
  */
 unsigned int hists__sort_list_width(struct hists *hists)
 {
struct perf_hpp_fmt *fmt;
-   struct sort_entry *se;
-   int i = 0, ret = 0;
+   int ret = 0;
+   bool first = true;
struct perf_hpp dummy_hpp;
 
perf_hpp__for_each_format(fmt) {
-   if (i)
+   if (perf_hpp__should_skip(fmt))
+   continue;
+
+   if (first)
+   first = false;
+   else
ret += 2;
 
ret += fmt->width(fmt, &dummy_hpp, hists_to_evsel(hists));
}
 
-   list_for_each_entry(se, &hist_entry__sort_list, list)
-   if (!se->elide)
-   ret += 2 + hists__col_len(hists, se->se_width_idx);
-
-   if (verbose) /* Addr + origin */
+   if (verbose && sort__has_sym) /* Addr + origin */
ret += 3 + BITS_PER_LONG / 4;
 
return ret;
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index cfcd3f6fd1c5..9f57991025a9 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -183,7 +183,8 @@ static size_t callchain__fprintf_graph(FILE *fp, struct 
rb_root *root,
 * the symbol. No need to print it otherwise it appears 
as
 * displayed twice.
 */
-   if (!i++ && sort__first_dimension == SORT_SYM)
+   if (!i++ && field_order == NULL &&
+   sort_order && !prefixcmp(sort_order, "sym"))
continue;
if (!printed) {
ret += callchain__fprintf_left_margin(fp, 
left_margin);
@@ -296,13 +297,20 @@ static size_t hist_entry__callchain_fprintf(struct 
hist_entry *he,
int left_margin = 0;
u64 total_period = hists->stats.total_period;
 
-   if (sort__first_dimension == SORT_COMM) {
-   struct sort_entry *se = list_first_entry(&hist_entry__sort_list,
-typeof(*se), list);
-   left_margin = hists__col_len(hists, se->se_width_idx);
-   left_margin -= thread__comm_len(he->thread);
-   }
+   if (field_order == NULL && (sort_order == NULL ||
+   !prefixcmp(sort_order, "comm"))) {
+   struct perf_hpp_fmt *fmt;
+
+   perf_hpp__for_each_format(fmt) {
+   if (!perf_hpp__is_sort_entry(fmt))
+   continue;
 
+   /* must be 'comm' sort entry */
+   left_margin = fmt->width(fmt, NULL, 
hists_to_evsel(hists));
+   left_margin -= thread__comm_len(he->thread);
+   break;
+   }
+   }
return hist_entry_callchain__fprintf(he, total_period, left_margin, fp);
 }
 
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 9bee7288465f..d9132069d3b1 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -22,9 +22,6 @@ int   sort__has_sym = 0;
 intsort__has_dso = 0;
 enum sort_mode sort__mode = SORT_MODE__NORMAL;
 
-enum sort_type sort__first_dimension;
-
-LIST_HEAD(hist_entry__sort_list);
 
 static int repsep_snprintf(char *bf, size_t size, const char *fmt, ...)
 {
@@ -1190,7 +1187,7 @@ static int __sort_dimension__add_hpp_output(struct 
sort_dimension *sd)
return 0;
 }
 
-static int __sort_dimension__add(struct sort_dimension *sd, enum sort_type idx)
+static int __sort_dimension__add(str

[PATCH 16/20] perf hists: Reset width of output fields with header length

2014-05-18 Thread Namhyung Kim
Some fields missed to set default column length so it broke align in
--stdio output.  Add perf_hpp__reset_width() to set it to a sane
default value.

Note that this change will ignore -w/--column-widths option for now.

Before:
  $ perf report -F cpu,comm,overhead --stdio
  ...
  # CPU  Command  Overhead
  #   ...  
  #
0  firefox 2.65%
0  kworker/0:0 1.45%
0  swapper 5.52%
0 synergys 0.92%
1  firefox 4.54%

After:
  # CPU  Command  Overhead
  # ...  ...  
  #
  0  firefox 2.65%
  0  kworker/0:0 1.45%
  0  swapper 5.52%
  0 synergys 0.92%
  1  firefox 4.54%

Signed-off-by: Namhyung Kim 
---
 tools/perf/ui/stdio/hist.c | 21 +++--
 tools/perf/util/hist.h |  1 +
 tools/perf/util/sort.c | 12 
 3 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index e3fdf4e869fc..cfcd3f6fd1c5 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -369,12 +369,10 @@ size_t hists__fprintf(struct hists *hists, bool 
show_header, int max_rows,
  int max_cols, float min_pcnt, FILE *fp)
 {
struct perf_hpp_fmt *fmt;
-   struct sort_entry *se;
struct rb_node *nd;
size_t ret = 0;
unsigned int width;
const char *sep = symbol_conf.field_sep;
-   const char *col_width = symbol_conf.col_width_list_str;
int nr_rows = 0;
char bf[96];
struct perf_hpp dummy_hpp = {
@@ -387,22 +385,9 @@ size_t hists__fprintf(struct hists *hists, bool 
show_header, int max_rows,
 
init_rem_hits();
 
-   list_for_each_entry(se, &hist_entry__sort_list, list) {
-   if (se->elide)
-   continue;
-   width = strlen(se->se_header);
-   if (symbol_conf.col_width_list_str) {
-   if (col_width) {
-   hists__set_col_len(hists, se->se_width_idx,
-  atoi(col_width));
-   col_width = strchr(col_width, ',');
-   if (col_width)
-   ++col_width;
-   }
-   }
-   if (!hists__new_col_len(hists, se->se_width_idx, width))
-   width = hists__col_len(hists, se->se_width_idx);
-   }
+
+   perf_hpp__for_each_format(fmt)
+   perf_hpp__reset_width(fmt, hists);
 
if (!show_header)
goto print_entries;
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index f67feb432a44..034db761630e 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -202,6 +202,7 @@ void perf_hpp__append_sort_keys(void);
 bool perf_hpp__is_sort_entry(struct perf_hpp_fmt *format);
 bool perf_hpp__same_sort_entry(struct perf_hpp_fmt *a, struct perf_hpp_fmt *b);
 bool perf_hpp__should_skip(struct perf_hpp_fmt *format);
+void perf_hpp__reset_width(struct perf_hpp_fmt *fmt, struct hists *hists);
 
 typedef u64 (*hpp_field_fn)(struct hist_entry *he);
 typedef int (*hpp_callback_fn)(struct perf_hpp *hpp, bool front);
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 0fe7cbe47ea3..9bee7288465f 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1089,6 +1089,18 @@ bool perf_hpp__same_sort_entry(struct perf_hpp_fmt *a, 
struct perf_hpp_fmt *b)
return hse_a->se == hse_b->se;
 }
 
+void perf_hpp__reset_width(struct perf_hpp_fmt *fmt, struct hists *hists)
+{
+   struct hpp_sort_entry *hse;
+
+   if (!perf_hpp__is_sort_entry(fmt))
+   return;
+
+   hse = container_of(fmt, struct hpp_sort_entry, hpp);
+   hists__new_col_len(hists, hse->se->se_width_idx,
+  strlen(hse->se->se_header));
+}
+
 static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
  struct perf_evsel *evsel)
 {
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 15/20] perf tools: Skip elided sort entries

2014-05-18 Thread Namhyung Kim
When it converted sort entries to hpp formats, it missed se->elide
handling, so add it for compatibility.

Signed-off-by: Namhyung Kim 
---
 tools/perf/ui/browsers/hists.c |  3 +++
 tools/perf/ui/gtk/hists.c  |  6 ++
 tools/perf/ui/stdio/hist.c |  9 +
 tools/perf/util/hist.c |  9 +
 tools/perf/util/hist.h |  1 +
 tools/perf/util/sort.c | 11 +++
 6 files changed, 39 insertions(+)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index e21b305fe9ea..1c331b934ffc 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -711,6 +711,9 @@ static int hist_browser__show_entry(struct hist_browser 
*browser,
ui_browser__gotorc(&browser->b, row, 0);
 
perf_hpp__for_each_format(fmt) {
+   if (perf_hpp__should_skip(fmt))
+   continue;
+
if (current_entry && browser->b.navkeypressed) {
ui_browser__set_color(&browser->b,
  HE_COLORSET_SELECTED);
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index fd52669018ee..9d90683914d4 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -178,6 +178,9 @@ static void perf_gtk__show_hists(GtkWidget *window, struct 
hists *hists,
col_idx = 0;
 
perf_hpp__for_each_format(fmt) {
+   if (perf_hpp__should_skip(fmt))
+   continue;
+
fmt->header(fmt, &hpp, hists_to_evsel(hists));
 
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
@@ -222,6 +225,9 @@ static void perf_gtk__show_hists(GtkWidget *window, struct 
hists *hists,
col_idx = 0;
 
perf_hpp__for_each_format(fmt) {
+   if (perf_hpp__should_skip(fmt))
+   continue;
+
if (fmt->color)
fmt->color(fmt, &hpp, h);
else
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 49e2e4a7346a..e3fdf4e869fc 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -318,6 +318,9 @@ static int hist_entry__snprintf(struct hist_entry *he, 
struct perf_hpp *hpp)
return 0;
 
perf_hpp__for_each_format(fmt) {
+   if (perf_hpp__should_skip(fmt))
+   continue;
+
/*
 * If there's no field_sep, we still need
 * to display initial '  '.
@@ -407,6 +410,9 @@ size_t hists__fprintf(struct hists *hists, bool 
show_header, int max_rows,
fprintf(fp, "# ");
 
perf_hpp__for_each_format(fmt) {
+   if (perf_hpp__should_skip(fmt))
+   continue;
+
if (!first)
fprintf(fp, "%s", sep ?: "  ");
else
@@ -430,6 +436,9 @@ size_t hists__fprintf(struct hists *hists, bool 
show_header, int max_rows,
perf_hpp__for_each_format(fmt) {
unsigned int i;
 
+   if (perf_hpp__should_skip(fmt))
+   continue;
+
if (!first)
fprintf(fp, "%s", sep ?: "  ");
else
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index ae13c2dbd27a..b262b44b7a65 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -436,6 +436,9 @@ hist_entry__cmp(struct hist_entry *left, struct hist_entry 
*right)
int64_t cmp = 0;
 
perf_hpp__for_each_sort_list(fmt) {
+   if (perf_hpp__should_skip(fmt))
+   continue;
+
cmp = fmt->cmp(left, right);
if (cmp)
break;
@@ -451,6 +454,9 @@ hist_entry__collapse(struct hist_entry *left, struct 
hist_entry *right)
int64_t cmp = 0;
 
perf_hpp__for_each_sort_list(fmt) {
+   if (perf_hpp__should_skip(fmt))
+   continue;
+
cmp = fmt->collapse(left, right);
if (cmp)
break;
@@ -570,6 +576,9 @@ static int hist_entry__sort(struct hist_entry *a, struct 
hist_entry *b)
int64_t cmp = 0;
 
perf_hpp__for_each_sort_list(fmt) {
+   if (perf_hpp__should_skip(fmt))
+   continue;
+
cmp = fmt->sort(a, b);
if (cmp)
break;
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index f3713b79742d..f67feb432a44 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -201,6 +201,7 @@ void perf_hpp__append_sort_keys(void);
 
 bool perf_hpp__is_sort_entry(struct perf_hpp_fmt *format);
 bool perf_hpp__same_sort_entry(struct perf_hpp_fmt *a, struct perf_hpp_fmt *b);
+bool perf_hpp__should_skip(struct perf_hpp_fmt *format);
 
 typedef u

[PATCH 08/20] perf tools: Allow hpp fields to be sort keys

2014-05-18 Thread Namhyung Kim
Add overhead{,_sys,_us,_guest_sys,_guest_us}, sample and period sort
keys so that they can be selected with --sort/-s option.

  $ perf report -s period,comm --stdio
  ...
  # OverheadPeriod  Command
  #     ...
  #
  47.06%   152  swapper
  13.93%45  qemu-system-arm
  12.38%40 synergys
   3.72%12  firefox
   2.48% 8xchat

Acked-by: Ingo Molnar 
Signed-off-by: Namhyung Kim 
---
 tools/perf/Documentation/perf-diff.txt   |  5 ++--
 tools/perf/Documentation/perf-report.txt |  9 
 tools/perf/Documentation/perf-top.txt|  5 ++--
 tools/perf/builtin-diff.c|  3 ++-
 tools/perf/builtin-report.c  |  6 ++---
 tools/perf/builtin-top.c |  4 ++--
 tools/perf/ui/hist.c |  9 ++--
 tools/perf/util/sort.c   | 39 
 8 files changed, 67 insertions(+), 13 deletions(-)

diff --git a/tools/perf/Documentation/perf-diff.txt 
b/tools/perf/Documentation/perf-diff.txt
index fbfa1192923c..b3b8abae62b8 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -50,7 +50,8 @@ OPTIONS
 
 -s::
 --sort=::
-   Sort by key(s): pid, comm, dso, symbol.
+   Sort by key(s): pid, comm, dso, symbol, cpu, parent, srcline.
+   Please see description of --sort in the perf-report man page.
 
 -t::
 --field-separator=::
@@ -202,4 +203,4 @@ If specified the 'Weighted diff' column is displayed with 
value 'd' computed as:
 
 SEE ALSO
 
-linkperf:perf-record[1]
+linkperf:perf-record[1], linkperf:perf-report[1]
diff --git a/tools/perf/Documentation/perf-report.txt 
b/tools/perf/Documentation/perf-report.txt
index 09af66298564..9babe915b6c4 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -79,6 +79,15 @@ OPTIONS
abort cost. This is the global weight.
- local_weight: Local weight version of the weight above.
- transaction: Transaction abort flags.
+   - overhead: Overhead percentage of sample
+   - overhead_sys: Overhead percentage of sample running in system mode
+   - overhead_us: Overhead percentage of sample running in user mode
+   - overhead_guest_sys: Overhead percentage of sample running in system 
mode
+   on guest machine
+   - overhead_guest_us: Overhead percentage of sample running in user mode 
on
+   guest machine
+   - sample: Number of sample
+   - period: Raw number of event count of sample
 
By default, comm, dso and symbol keys are used.
(i.e. --sort comm,dso,symbol)
diff --git a/tools/perf/Documentation/perf-top.txt 
b/tools/perf/Documentation/perf-top.txt
index 64ed79c43639..df863288752a 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -113,7 +113,8 @@ Default is to monitor all CPUS.
 -s::
 --sort::
Sort by key(s): pid, comm, dso, symbol, parent, srcline, weight,
-   local_weight, abort, in_tx, transaction
+   local_weight, abort, in_tx, transaction, overhead, sample, period.
+   Please see description of --sort in the perf-report man page.
 
 -n::
 --show-nr-samples::
@@ -212,4 +213,4 @@ Pressing any unmapped key displays a menu, and prompts for 
input.
 
 SEE ALSO
 
-linkperf:perf-stat[1], linkperf:perf-list[1]
+linkperf:perf-stat[1], linkperf:perf-list[1], linkperf:perf-report[1]
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index f3b10dcf6838..b60c711d4e72 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -741,7 +741,8 @@ static const struct option options[] = {
OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, 
"symbol[,symbol...]",
   "only consider these symbols"),
OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
-  "sort by key(s): pid, comm, dso, symbol, parent"),
+  "sort by key(s): pid, comm, dso, symbol, parent, cpu, 
srcline, ..."
+  " Please refer the man page for the complete list."),
OPT_STRING('t', "field-separator", &symbol_conf.field_sep, "separator",
   "separator for columns, no spaces will be added between "
   "columns '.' is reserved."),
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 89c95289fd51..d0180d5de781 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -699,10 +699,8 @@ int cmd_report(int argc, const char **argv, const char 
*prefix __maybe_unused)
OPT_BOOLEAN(0, "header-only", &report.header_only,
"Show only data header."),
OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
-  "sort by key(s): pid, comm, dso, symbol, parent, cpu, 
srcline,"
-  " dso_to, dso_from, 

[PATCHSET 00/20] perf report: Add -F option for specifying output fields (v6)

2014-05-18 Thread Namhyung Kim
Hello,

This is a patchset implementing -F/--fields option to setup output
field/column as Ingo requested.

The -F option can receive any sort keys that -s option recognize, plus
following fields (name can be changed):

  overhead, overhead_sys, overhead_us, sample, period

The overhead_guest_sys and overhead_guest_us might be avaiable when
you profile guest machines.

Output will be sorted by in order of fields and sort keys passed by -s
option will be added to the output field list automatically.  If you
want to change the order of sorting you can give -s option in addition
to -F option.  To support old behavior, it'll also prepend 'overhead'
field to the sort keys unless you give -F option explicitly.


  $ perf report -s dso,sym
  ...
  # Overhead  Shared Object  Symbol
  #   .  ..
  #
  13.75%  ld-2.17.so [.] strcmp
  10.00%  abc[.] a 
  10.00%  abc[.] b 
  10.00%  abc[.] c 
   8.75%  abc[.] main  
   7.50%  libc-2.17.so   [.] _setjmp   
   6.25%  abc[.] _init 
   6.25%  abc[.] frame_dummy   
   5.00%  abc[.] __libc_csu_init   
   5.00%  ld-2.17.so [.] _dl_name_match_p  
   3.75%  libc-2.17.so   [.] __new_exitfn  
   2.50%  libc-2.17.so   [.] __cxa_atexit  
   1.25%  ld-2.17.so [.] _dl_check_map_versions
   1.25%  ld-2.17.so [.] _dl_setup_hash
   1.25%  ld-2.17.so [.] _dl_sysdep_start  
   1.25%  ld-2.17.so [.] brk   
   1.25%  ld-2.17.so [.] calloc@plt
   1.25%  ld-2.17.so [.] dl_main   
   1.25%  ld-2.17.so [.] match_symbol  
   1.25%  ld-2.17.so [.] sbrk  
   1.25%  ld-2.17.so [.] strlen


  $ perf report -F sym,sample,overhead
  ...
  # Symbol   Samples  Overhead
  # ..    
  #
[.] __cxa_atexit   2 2.50%
[.] __libc_csu_init4 5.00%
[.] __new_exitfn   3 3.75%
[.] _dl_check_map_versions 1 1.25%
[.] _dl_name_match_p   4 5.00%
[.] _dl_setup_hash 1 1.25%
[.] _dl_sysdep_start   1 1.25%
[.] _init  5 6.25%
[.] _setjmp6 7.50%
[.] a  810.00%
[.] b  810.00%
[.] brk1 1.25%
[.] c  810.00%
[.] calloc@plt 1 1.25%
[.] dl_main1 1.25%
[.] frame_dummy5 6.25%
[.] main   7 8.75%
[.] match_symbol   1 1.25%
[.] sbrk   1 1.25%
[.] strcmp1113.75%
[.] strlen 1 1.25%


  $ perf report -F sym,sample -s overhead
  ...
  # Symbol   Samples  Overhead
  # ..    
  #
[.] strcmp1113.75%
[.] a  810.00%
[.] b  810.00%
[.] c  810.00%
[.] main   7 8.75%
[.] _setjmp6 7.50%
[.] _init  5 6.25%
[.] frame_dummy5 6.25%
[.] __libc_csu_init4 5.00%
[.] _dl_name_match_p   4 5.00%
[.] __new_exitfn   3 3.75%
[.] __cxa_atexit   2 2.50%
[.] _dl_check_map_versions 1 1.25%
[.] _dl_setup_hash 1 1.25%
[.] _dl_sysdep_start   1 1.25%
[.] brk1 1.25%
[.] calloc@plt 1 1.25%
[.] dl_main1 1.25%
[.] match_symbol   1 1.25%
[.] sbrk   1 1.25%
[.] strlen 1 1.25%


 * changes in v6:
  - rename hist_entry__snprintf()  (Jiri)
  - update documentation of new sort keys  (Jiri)
  - improve sort/field order initialization  (Jiri)
  - reset output field after each hist tests
  - get rid of unused old sort code/data

 * changes in v5:
  - add a testcase for hist output sorting

 * changes

[PATCH 19/20] perf tests: Factor out print_hists_*()

2014-05-18 Thread Namhyung Kim
Those print helper functions can be reused by later hist test cases so
factor them out to a common location.

Signed-off-by: Namhyung Kim 
---
 tools/perf/tests/hists_common.c | 57 +
 tools/perf/tests/hists_common.h |  3 +++
 tools/perf/tests/hists_filter.c | 37 --
 tools/perf/tests/hists_link.c   | 29 +
 4 files changed, 66 insertions(+), 60 deletions(-)

diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
index 44655b395bb9..040a85b17aee 100644
--- a/tools/perf/tests/hists_common.c
+++ b/tools/perf/tests/hists_common.c
@@ -146,3 +146,60 @@ out:
machine__delete(machine);
return NULL;
 }
+
+void print_hists_in(struct hists *hists)
+{
+   int i = 0;
+   struct rb_root *root;
+   struct rb_node *node;
+
+   if (sort__need_collapse)
+   root = &hists->entries_collapsed;
+   else
+   root = hists->entries_in;
+
+   pr_info("- %s \n", __func__);
+   node = rb_first(root);
+   while (node) {
+   struct hist_entry *he;
+
+   he = rb_entry(node, struct hist_entry, rb_node_in);
+
+   if (!he->filtered) {
+   pr_info("%2d: entry: %-8s [%-8s] %20s: period = 
%"PRIu64"\n",
+   i, thread__comm_str(he->thread),
+   he->ms.map->dso->short_name,
+   he->ms.sym->name, he->stat.period);
+   }
+
+   i++;
+   node = rb_next(node);
+   }
+}
+
+void print_hists_out(struct hists *hists)
+{
+   int i = 0;
+   struct rb_root *root;
+   struct rb_node *node;
+
+   root = &hists->entries;
+
+   pr_info("- %s \n", __func__);
+   node = rb_first(root);
+   while (node) {
+   struct hist_entry *he;
+
+   he = rb_entry(node, struct hist_entry, rb_node);
+
+   if (!he->filtered) {
+   pr_info("%2d: entry: %-8s [%-8s] %20s: period = 
%"PRIu64"\n",
+   i, thread__comm_str(he->thread),
+   he->ms.map->dso->short_name,
+   he->ms.sym->name, he->stat.period);
+   }
+
+   i++;
+   node = rb_next(node);
+   }
+}
diff --git a/tools/perf/tests/hists_common.h b/tools/perf/tests/hists_common.h
index 2528b8fc105a..1415ae69d7b6 100644
--- a/tools/perf/tests/hists_common.h
+++ b/tools/perf/tests/hists_common.h
@@ -41,4 +41,7 @@ struct machines;
  */
 struct machine *setup_fake_machine(struct machines *machines);
 
+void print_hists_in(struct hists *hists);
+void print_hists_out(struct hists *hists);
+
 #endif /* __PERF_TESTS__HISTS_COMMON_H__ */
diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c
index 4617a8bee29b..13c8cf49225e 100644
--- a/tools/perf/tests/hists_filter.c
+++ b/tools/perf/tests/hists_filter.c
@@ -98,33 +98,6 @@ out:
return TEST_FAIL;
 }
 
-static void print_hists(struct hists *hists)
-{
-   int i = 0;
-   struct rb_root *root;
-   struct rb_node *node;
-
-   root = &hists->entries;
-
-   pr_info("- %s \n", __func__);
-   node = rb_first(root);
-   while (node) {
-   struct hist_entry *he;
-
-   he = rb_entry(node, struct hist_entry, rb_node);
-
-   if (!he->filtered) {
-   pr_info("%2d: entry: %-8s [%-8s] %20s: period = 
%"PRIu64"\n",
-   i, thread__comm_str(he->thread),
-   he->ms.map->dso->short_name,
-   he->ms.sym->name, he->stat.period);
-   }
-
-   i++;
-   node = rb_next(node);
-   }
-}
-
 int test__hists_filter(void)
 {
int err = TEST_FAIL;
@@ -169,7 +142,7 @@ int test__hists_filter(void)
 
if (verbose > 2) {
pr_info("Normal histogram\n");
-   print_hists(hists);
+   print_hists_out(hists);
}
 
TEST_ASSERT_VAL("Invalid nr samples",
@@ -193,7 +166,7 @@ int test__hists_filter(void)
 
if (verbose > 2) {
pr_info("Histogram for thread filter\n");
-   print_hists(hists);
+   print_hists_out(hists);
}
 
/* normal stats should be invariant */
@@ -222,7 +195,7 @@ int test__hists_filter(void)
 
if (verbose > 2) {
pr_info("Histogram for dso filter\n");
-   print_hists(hists);
+   print_hists_out(hists);
}
 
/* normal stats should be invariant */
@@ -257,7 +230,7 @@ int test__hists_filter(void)
 
if (verbose > 2) {
pr_info("His

[PATCH Resend] driver/core: cpu: initialize opp table

2014-05-18 Thread Viresh Kumar
All drivers expecting CPU's OPPs from device tree initialize OPP table using
of_init_opp_table() and there is nothing driver specific in that. They all do it
in the same way adding to code redundancy.

It would be better if we can get rid of code redundancy by initializing CPU OPPs
from core code for all CPUs that have a "operating-points" property defined in
their node.

This patch initializes OPPs as soon as CPU device is registered in
register_cpu().

Cc: Greg Kroah-Hartman 
Cc: Amit Daniel Kachhap 
Cc: Kukjin Kim 
Cc: Shawn Guo 
Cc: Sudeep Holla 
Signed-off-by: Viresh Kumar 
---
V1-V2:
A colleague spotted some extra debug prints in my first mail :(

Replace
+ pr_err("%s: failed to init OPP table for cpu%d, err: %d\n",
with
+ pr_err("%s: failed to init OPP table for cpu%d, err: %d\n",

 drivers/base/cpu.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 006b1bc..74ce944 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "base.h"
 
@@ -349,11 +350,20 @@ int register_cpu(struct cpu *cpu, int num)
if (cpu->hotpluggable)
cpu->dev.groups = hotplugable_cpu_attr_groups;
error = device_register(&cpu->dev);
-   if (!error)
+   if (!error) {
per_cpu(cpu_sys_devices, num) = &cpu->dev;
-   if (!error)
register_cpu_under_node(num, cpu_to_node(num));
 
+   /* Initialize CPUs OPP table */
+   if (of_node_get(cpu->dev.of_node)) {
+   error = of_init_opp_table(&cpu->dev);
+   if (error && error != -ENODEV)
+   pr_err("%s: failed to init OPP table for cpu%d, 
err: %d\n",
+   __func__, num, error);
+   of_node_put(cpu->dev.of_node);
+   }
+   }
+
return error;
 }
 
-- 
2.0.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/20] perf tools: Convert sort entries to hpp formats

2014-05-18 Thread Namhyung Kim
This is a preparation of consolidating management of output field and
sort keys.

Acked-by: Ingo Molnar 
Signed-off-by: Namhyung Kim 
---
 tools/perf/ui/hist.c   |  6 
 tools/perf/util/hist.h |  6 
 tools/perf/util/sort.c | 80 +++---
 3 files changed, 88 insertions(+), 4 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index d4a4f2e7eb43..a6eea666b443 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -284,6 +284,7 @@ struct perf_hpp_fmt perf_hpp__format[] = {
 };
 
 LIST_HEAD(perf_hpp__list);
+LIST_HEAD(perf_hpp__sort_list);
 
 
 #undef HPP__COLOR_PRINT_FNS
@@ -325,6 +326,11 @@ void perf_hpp__column_register(struct perf_hpp_fmt *format)
list_add_tail(&format->list, &perf_hpp__list);
 }
 
+void perf_hpp__register_sort_field(struct perf_hpp_fmt *format)
+{
+   list_add_tail(&format->sort_list, &perf_hpp__sort_list);
+}
+
 void perf_hpp__column_enable(unsigned col)
 {
BUG_ON(col >= PERF_HPP__MAX_INDEX);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 36dbe00e3cc8..eee154a41723 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -165,13 +165,18 @@ struct perf_hpp_fmt {
int64_t (*sort)(struct hist_entry *a, struct hist_entry *b);
 
struct list_head list;
+   struct list_head sort_list;
 };
 
 extern struct list_head perf_hpp__list;
+extern struct list_head perf_hpp__sort_list;
 
 #define perf_hpp__for_each_format(format) \
list_for_each_entry(format, &perf_hpp__list, list)
 
+#define perf_hpp__for_each_sort_list(format) \
+   list_for_each_entry(format, &perf_hpp__sort_list, sort_list)
+
 extern struct perf_hpp_fmt perf_hpp__format[];
 
 enum {
@@ -190,6 +195,7 @@ enum {
 void perf_hpp__init(void);
 void perf_hpp__column_register(struct perf_hpp_fmt *format);
 void perf_hpp__column_enable(unsigned col);
+void perf_hpp__register_sort_field(struct perf_hpp_fmt *format);
 
 typedef u64 (*hpp_field_fn)(struct hist_entry *he);
 typedef int (*hpp_callback_fn)(struct perf_hpp *hpp, bool front);
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 635cd8f8b22e..b2829f947053 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -2,6 +2,7 @@
 #include "hist.h"
 #include "comm.h"
 #include "symbol.h"
+#include "evsel.h"
 
 regex_tparent_regex;
 const char default_parent_pattern[] = "^sys_|^do_page_fault";
@@ -1027,10 +1028,80 @@ static struct sort_dimension memory_sort_dimensions[] = 
{
 
 #undef DIM
 
-static void __sort_dimension__add(struct sort_dimension *sd, enum sort_type 
idx)
+struct hpp_sort_entry {
+   struct perf_hpp_fmt hpp;
+   struct sort_entry *se;
+};
+
+static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
+ struct perf_evsel *evsel)
+{
+   struct hpp_sort_entry *hse;
+   size_t len;
+
+   hse = container_of(fmt, struct hpp_sort_entry, hpp);
+   len = hists__col_len(&evsel->hists, hse->se->se_width_idx);
+
+   return scnprintf(hpp->buf, hpp->size, "%*s", len, hse->se->se_header);
+}
+
+static int __sort__hpp_width(struct perf_hpp_fmt *fmt,
+struct perf_hpp *hpp __maybe_unused,
+struct perf_evsel *evsel)
+{
+   struct hpp_sort_entry *hse;
+
+   hse = container_of(fmt, struct hpp_sort_entry, hpp);
+
+   return hists__col_len(&evsel->hists, hse->se->se_width_idx);
+}
+
+static int __sort__hpp_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
+struct hist_entry *he)
+{
+   struct hpp_sort_entry *hse;
+   size_t len;
+
+   hse = container_of(fmt, struct hpp_sort_entry, hpp);
+   len = hists__col_len(he->hists, hse->se->se_width_idx);
+
+   return hse->se->se_snprintf(he, hpp->buf, hpp->size, len);
+}
+
+static int __sort_dimension__add_hpp(struct sort_dimension *sd)
+{
+   struct hpp_sort_entry *hse;
+
+   hse = malloc(sizeof(*hse));
+   if (hse == NULL) {
+   pr_err("Memory allocation failed\n");
+   return -1;
+   }
+
+   hse->se = sd->entry;
+   hse->hpp.header = __sort__hpp_header;
+   hse->hpp.width = __sort__hpp_width;
+   hse->hpp.entry = __sort__hpp_entry;
+   hse->hpp.color = NULL;
+
+   hse->hpp.cmp = sd->entry->se_cmp;
+   hse->hpp.collapse = sd->entry->se_collapse ? : sd->entry->se_cmp;
+   hse->hpp.sort = hse->hpp.collapse;
+
+   INIT_LIST_HEAD(&hse->hpp.list);
+   INIT_LIST_HEAD(&hse->hpp.sort_list);
+
+   perf_hpp__register_sort_field(&hse->hpp);
+   return 0;
+}
+
+static int __sort_dimension__add(struct sort_dimension *sd, enum sort_type idx)
 {
if (sd->taken)
-   return;
+   return 0;
+
+   if (__sort_dimension__add_hpp(sd) < 0)
+   return -1;
 
if (sd->entry->se_collapse)
sort__need_collapse = 1;
@@ -1040,6 +,8 @@ s

[PATCH 05/20] perf tools: Use hpp formats to sort final output

2014-05-18 Thread Namhyung Kim
Convert output sorting function to use ->sort hpp functions.

Acked-by: Ingo Molnar 
Signed-off-by: Namhyung Kim 
---
 tools/perf/util/hist.c | 62 +++---
 1 file changed, 8 insertions(+), 54 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 38373c986e97..c99ae4dd973e 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -564,64 +564,18 @@ void hists__collapse_resort(struct hists *hists, struct 
ui_progress *prog)
}
 }
 
-/*
- * reverse the map, sort on period.
- */
-
-static int period_cmp(u64 period_a, u64 period_b)
+static int hist_entry__sort(struct hist_entry *a, struct hist_entry *b)
 {
-   if (period_a > period_b)
-   return 1;
-   if (period_a < period_b)
-   return -1;
-   return 0;
-}
-
-static int hist_entry__sort_on_period(struct hist_entry *a,
- struct hist_entry *b)
-{
-   int ret;
-   int i, nr_members;
-   struct perf_evsel *evsel;
-   struct hist_entry *pair;
-   u64 *periods_a, *periods_b;
-
-   ret = period_cmp(a->stat.period, b->stat.period);
-   if (ret || !symbol_conf.event_group)
-   return ret;
-
-   evsel = hists_to_evsel(a->hists);
-   nr_members = evsel->nr_members;
-   if (nr_members <= 1)
-   return ret;
-
-   periods_a = zalloc(sizeof(periods_a) * nr_members);
-   periods_b = zalloc(sizeof(periods_b) * nr_members);
-
-   if (!periods_a || !periods_b)
-   goto out;
-
-   list_for_each_entry(pair, &a->pairs.head, pairs.node) {
-   evsel = hists_to_evsel(pair->hists);
-   periods_a[perf_evsel__group_idx(evsel)] = pair->stat.period;
-   }
-
-   list_for_each_entry(pair, &b->pairs.head, pairs.node) {
-   evsel = hists_to_evsel(pair->hists);
-   periods_b[perf_evsel__group_idx(evsel)] = pair->stat.period;
-   }
+   struct perf_hpp_fmt *fmt;
+   int64_t cmp = 0;
 
-   for (i = 1; i < nr_members; i++) {
-   ret = period_cmp(periods_a[i], periods_b[i]);
-   if (ret)
+   perf_hpp__for_each_format(fmt) {
+   cmp = fmt->sort(a, b);
+   if (cmp)
break;
}
 
-out:
-   free(periods_a);
-   free(periods_b);
-
-   return ret;
+   return cmp;
 }
 
 static void hists__reset_filter_stats(struct hists *hists)
@@ -669,7 +623,7 @@ static void __hists__insert_output_entry(struct rb_root 
*entries,
parent = *p;
iter = rb_entry(parent, struct hist_entry, rb_node);
 
-   if (hist_entry__sort_on_period(he, iter) > 0)
+   if (hist_entry__sort(he, iter) > 0)
p = &(*p)->rb_left;
else
p = &(*p)->rb_right;
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/20] perf report: Add -F option to specify output fields

2014-05-18 Thread Namhyung Kim
The -F/--fields option is to allow user setup output field in any
order.  It can recieve any sort keys and following (hpp) fields:

  overhead, overhead_sys, overhead_us, sample and period

If guest profiling is enabled, overhead_guest_{sys,us} will be
available too.

The output fields also affect sort order unless you give -s/--sort
option.  And any keys specified on -s option, will also be added to
the output field list automatically.

  $ perf report -F sym,sample,overhead
  ...
  # Symbol   Samples  Overhead
  # ..    
  #
[.] __cxa_atexit   2 2.50%
[.] __libc_csu_init4 5.00%
[.] __new_exitfn   3 3.75%
[.] _dl_check_map_versions 1 1.25%
[.] _dl_name_match_p   4 5.00%
[.] _dl_setup_hash 1 1.25%
[.] _dl_sysdep_start   1 1.25%
[.] _init  5 6.25%
[.] _setjmp6 7.50%
[.] a  810.00%
[.] b  810.00%
[.] brk1 1.25%
[.] c  810.00%

Note that, the example output above is captured after applying next
patch which fixes sort/comparing behavior.

Requested-by: Ingo Molnar 
Acked-by: Ingo Molnar 
Signed-off-by: Namhyung Kim 
---
 tools/perf/Documentation/perf-report.txt |  10 ++
 tools/perf/builtin-report.c  |  15 ++-
 tools/perf/ui/hist.c |  59 -
 tools/perf/util/hist.h   |   4 +
 tools/perf/util/sort.c   | 209 ++-
 tools/perf/util/sort.h   |   2 +
 6 files changed, 282 insertions(+), 17 deletions(-)

diff --git a/tools/perf/Documentation/perf-report.txt 
b/tools/perf/Documentation/perf-report.txt
index 9babe915b6c4..a1b5185402d5 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -107,6 +107,16 @@ OPTIONS
And default sort keys are changed to comm, dso_from, symbol_from, dso_to
and symbol_to, see '--branch-stack'.
 
+-F::
+--fields=::
+   Specify output field - multiple keys can be specified in CSV format.
+   Following fields are available:
+   overhead, overhead_sys, overhead_us, sample and period.
+   Also it can contain any sort key(s).
+
+   By default, every sort keys not specified in -F will be appended
+   automatically.
+
 -p::
 --parent=::
 A regex filter to identify parent. The parent is a caller of this
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index c4dab7acbdbb..bc0eec1ce4be 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -701,6 +701,8 @@ int cmd_report(int argc, const char **argv, const char 
*prefix __maybe_unused)
OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
   "sort by key(s): pid, comm, dso, symbol, parent, cpu, 
srcline, ..."
   " Please refer the man page for the complete list."),
+   OPT_STRING('F', "fields", &field_order, "key[,keys...]",
+  "output field(s): overhead, period, sample plus all of sort 
keys"),
OPT_BOOLEAN(0, "showcpuutilization", &symbol_conf.show_cpu_utilization,
"Show sample percentage for different cpu modes"),
OPT_STRING('p', "parent", &parent_pattern, "regex",
@@ -814,17 +816,14 @@ repeat:
}
 
if (setup_sorting() < 0) {
-   parse_options_usage(report_usage, options, "s", 1);
+   if (sort_order)
+   parse_options_usage(report_usage, options, "s", 1);
+   if (field_order)
+   parse_options_usage(sort_order ? NULL : report_usage,
+   options, "F", 1);
goto error;
}
 
-   if (parent_pattern != default_parent_pattern) {
-   if (sort_dimension__add("parent") < 0)
-   goto error;
-   }
-
-   perf_hpp__init();
-
/* Force tty output for header output. */
if (report.header || report.header_only)
use_browser = 0;
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 24116a48298f..b114c6668865 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -355,6 +355,12 @@ void perf_hpp__init(void)
INIT_LIST_HEAD(&fmt->sort_list);
}
 
+   /*
+* If user specified field order, no need to setup default fields.
+*/
+   if (field_order)
+   return;
+
perf_hpp__column_enable(PERF_HPP__OVERHEAD);
 
if (symbol_conf.show_cpu_utilization) {
@@ -377,8 +383,6 @@ void perf_hpp__init(void)
list = &perf_hpp__format[PERF_HPP__OVERH

[PATCH 03/20] perf tools: Use hpp formats to sort hist entries

2014-05-18 Thread Namhyung Kim
It wrapped sort entries to hpp functions, so using the hpp sort list
to sort entries.

Acked-by: Ingo Molnar 
Signed-off-by: Namhyung Kim 
---
 tools/perf/util/hist.c | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 7f0236cea4fe..38373c986e97 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -432,11 +432,11 @@ struct hist_entry *__hists__add_entry(struct hists *hists,
 int64_t
 hist_entry__cmp(struct hist_entry *left, struct hist_entry *right)
 {
-   struct sort_entry *se;
+   struct perf_hpp_fmt *fmt;
int64_t cmp = 0;
 
-   list_for_each_entry(se, &hist_entry__sort_list, list) {
-   cmp = se->se_cmp(left, right);
+   perf_hpp__for_each_sort_list(fmt) {
+   cmp = fmt->cmp(left, right);
if (cmp)
break;
}
@@ -447,15 +447,11 @@ hist_entry__cmp(struct hist_entry *left, struct 
hist_entry *right)
 int64_t
 hist_entry__collapse(struct hist_entry *left, struct hist_entry *right)
 {
-   struct sort_entry *se;
+   struct perf_hpp_fmt *fmt;
int64_t cmp = 0;
 
-   list_for_each_entry(se, &hist_entry__sort_list, list) {
-   int64_t (*f)(struct hist_entry *, struct hist_entry *);
-
-   f = se->se_collapse ?: se->se_cmp;
-
-   cmp = f(left, right);
+   perf_hpp__for_each_sort_list(fmt) {
+   cmp = fmt->collapse(left, right);
if (cmp)
break;
}
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 20/20] perf tests: Add a testcase for histogram output sorting

2014-05-18 Thread Namhyung Kim
With new output fields option, its internal implementation was changed
so add a new testcase to verify whether it breaks things.

Signed-off-by: Namhyung Kim 
---
 tools/perf/Makefile.perf|   1 +
 tools/perf/tests/builtin-test.c |   4 +
 tools/perf/tests/hists_common.c |   4 +-
 tools/perf/tests/hists_filter.c |   1 +
 tools/perf/tests/hists_link.c   |   1 +
 tools/perf/tests/hists_output.c | 618 
 tools/perf/tests/tests.h|   1 +
 7 files changed, 628 insertions(+), 2 deletions(-)
 create mode 100644 tools/perf/tests/hists_output.c

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 2baf61cec7ff..25a5d46eb08c 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -399,6 +399,7 @@ LIB_OBJS += $(OUTPUT)tests/pmu.o
 LIB_OBJS += $(OUTPUT)tests/hists_common.o
 LIB_OBJS += $(OUTPUT)tests/hists_link.o
 LIB_OBJS += $(OUTPUT)tests/hists_filter.o
+LIB_OBJS += $(OUTPUT)tests/hists_output.o
 LIB_OBJS += $(OUTPUT)tests/python-use.o
 LIB_OBJS += $(OUTPUT)tests/bp_signal.o
 LIB_OBJS += $(OUTPUT)tests/bp_signal_overflow.o
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 0d5afaf72944..6f39cb80fdc2 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -136,6 +136,10 @@ static struct test {
.func = test__thread_mg_share,
},
{
+   .desc = "Test output sorting of hist entries",
+   .func = test__hists_output,
+   },
+   {
.func = NULL,
},
 };
diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
index 040a85b17aee..e4e01aadc3be 100644
--- a/tools/perf/tests/hists_common.c
+++ b/tools/perf/tests/hists_common.c
@@ -193,8 +193,8 @@ void print_hists_out(struct hists *hists)
he = rb_entry(node, struct hist_entry, rb_node);
 
if (!he->filtered) {
-   pr_info("%2d: entry: %-8s [%-8s] %20s: period = 
%"PRIu64"\n",
-   i, thread__comm_str(he->thread),
+   pr_info("%2d: entry: %8s:%5d [%-8s] %20s: period = 
%"PRIu64"\n",
+   i, thread__comm_str(he->thread), 
he->thread->tid,
he->ms.map->dso->short_name,
he->ms.sym->name, he->stat.period);
}
diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c
index 13c8cf49225e..c5ba924a3581 100644
--- a/tools/perf/tests/hists_filter.c
+++ b/tools/perf/tests/hists_filter.c
@@ -283,6 +283,7 @@ int test__hists_filter(void)
 out:
/* tear down everything */
perf_evlist__delete(evlist);
+   reset_output_field();
machines__exit(&machines);
 
return err;
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index 4e783db60bba..5ffa2c3eb77d 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -332,6 +332,7 @@ int test__hists_link(void)
 out:
/* tear down everything */
perf_evlist__delete(evlist);
+   reset_output_field();
machines__exit(&machines);
 
return err;
diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c
new file mode 100644
index ..a16850551797
--- /dev/null
+++ b/tools/perf/tests/hists_output.c
@@ -0,0 +1,618 @@
+#include "perf.h"
+#include "util/debug.h"
+#include "util/symbol.h"
+#include "util/sort.h"
+#include "util/evsel.h"
+#include "util/evlist.h"
+#include "util/machine.h"
+#include "util/thread.h"
+#include "util/parse-events.h"
+#include "tests/tests.h"
+#include "tests/hists_common.h"
+
+struct sample {
+   u32 cpu;
+   u32 pid;
+   u64 ip;
+   struct thread *thread;
+   struct map *map;
+   struct symbol *sym;
+};
+
+/* For the numbers, see hists_common.c */
+static struct sample fake_samples[] = {
+   /* perf [kernel] schedule() */
+   { .cpu = 0, .pid = 100, .ip = 0xf + 700, },
+   /* perf [perf]   main() */
+   { .cpu = 1, .pid = 100, .ip = 0x4 + 700, },
+   /* perf [perf]   cmd_record() */
+   { .cpu = 1, .pid = 100, .ip = 0x4 + 900, },
+   /* perf [libc]   malloc() */
+   { .cpu = 1, .pid = 100, .ip = 0x5 + 700, },
+   /* perf [libc]   free() */
+   { .cpu = 2, .pid = 100, .ip = 0x5 + 800, },
+   /* perf [perf]   main() */
+   { .cpu = 2, .pid = 200, .ip = 0x4 + 700, },
+   /* perf [kernel] page_fault() */
+   { .cpu = 2, .pid = 200, .ip = 0xf + 800, },
+   /* bash [bash]   main() */
+   { .cpu = 3, .pid = 300, .ip = 0x4 + 700, },
+   /* bash [bash]   xmalloc() */
+   { .cpu = 0, .pid = 300, .ip = 0x4 + 800, },
+   /* bash [kernel] page_fault() */
+   { .cpu = 1, .pid = 300, .ip = 0xf + 800, },
+};
+
+static int add_hist_entries(struct hists *hists, struct machine *machine)
+{
+   s

Re: [PATCH 2/2] ARM: imx: convert camera init to use platform_device_register_full()

2014-05-18 Thread Uwe Kleine-König
Hello Emil,

thanks for your effort.

On Sun, May 18, 2014 at 10:51:00PM +0200, Emil Goode wrote:
> This converts the imx camera allocation and initialization functions
> to use platform_device_register_full() thus simplifying the code.
> 
> Signed-off-by: Emil Goode 
> ---
> Only build tested, unfortunately I currently don't have the hardware.
> 
>  arch/arm/mach-imx/devices/platform-ipu-core.c |   43 
> +
>  arch/arm/mach-imx/mach-mx31_3ds.c |5 ++-
>  arch/arm/mach-imx/mach-mx31moboard.c  |6 ++--
>  arch/arm/mach-imx/mach-mx35_3ds.c |5 ++-
>  arch/arm/mach-imx/mach-pcm037.c   |5 ++-
>  5 files changed, 23 insertions(+), 41 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/devices/platform-ipu-core.c 
> b/arch/arm/mach-imx/devices/platform-ipu-core.c
> index 6bd7c3f..13ea542 100644
> --- a/arch/arm/mach-imx/devices/platform-ipu-core.c
> +++ b/arch/arm/mach-imx/devices/platform-ipu-core.c
> @@ -69,42 +69,29 @@ struct platform_device *__init imx_alloc_mx3_camera(
IMHO you should better rename the function because now it doesn't only
allocate the device, but also registers it.

Also I doubt that it's OK to call dma_declare_coherent_memory after the
device is added. In this case maybe extend
platform_device_register_full? And also add a warning to
dma_declare_coherent_memory if it is called for an already added device?
(Added a few people to Cc: that might be able to comment this. I don't
even know if there is a reliable way to check if a device is already
added.)

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 13/20] perf report/tui: Fix a bug when --fields/sort is given

2014-05-18 Thread Namhyung Kim
The hists__filter_entries() function is called when down arrow key is
pressed for navigating through the entries in TUI.  It has a check for
filtering out entries that have very small overhead (under min_pcnt).

However it just assumed the entries are sorted by the overhead so when
it saw such a small overheaded entry, it just stopped navigating as an
optimization.  But it's not true anymore due to new --fields and
--sort optoin behavior and this case users cannot go down to a next
entry if ther's an entry with small overhead in-between.

Signed-off-by: Namhyung Kim 
---
 tools/perf/ui/browsers/hists.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 2d39e982ab8c..e21b305fe9ea 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -812,10 +812,7 @@ static struct rb_node *hists__filter_entries(struct 
rb_node *nd,
if (total)
percent = h->stat.period * 100.0 / total;
 
-   if (percent < min_pcnt)
-   return NULL;
-
-   if (!h->filtered)
+   if (!h->filtered && percent >= min_pcnt)
return nd;
 
nd = rb_next(nd);
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 10/20] perf tools: Call perf_hpp__init() before setting up GUI browsers

2014-05-18 Thread Namhyung Kim
So that it can be set properly prior to set up output fields.  That
makes easy to handle/warn errors during the setup since it doesn't
need to be bothered with the GUI.

Signed-off-by: Namhyung Kim 
---
 tools/perf/builtin-report.c| 6 +++---
 tools/perf/builtin-top.c   | 2 ++
 tools/perf/ui/browsers/hists.c | 2 --
 tools/perf/ui/gtk/hists.c  | 2 --
 tools/perf/ui/setup.c  | 2 --
 5 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index f4d640cfdf16..c4dab7acbdbb 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -823,16 +823,16 @@ repeat:
goto error;
}
 
+   perf_hpp__init();
+
/* Force tty output for header output. */
if (report.header || report.header_only)
use_browser = 0;
 
if (strcmp(input_name, "-") != 0)
setup_browser(true);
-   else {
+   else
use_browser = 0;
-   perf_hpp__init();
-   }
 
if (report.header || report.header_only) {
perf_session__fprintf_info(session, stdout,
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 34764b6eabf9..280945bab66d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1147,6 +1147,8 @@ int cmd_top(int argc, const char **argv, const char 
*prefix __maybe_unused)
/* display thread wants entries to be collapsed in a different tree */
sort__need_collapse = 1;
 
+   perf_hpp__init();
+
if (top.use_stdio)
use_browser = 0;
else if (top.use_tui)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 4e9b82b5fb1f..2d39e982ab8c 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -661,8 +661,6 @@ __HPP_COLOR_PERCENT_FN(overhead_guest_us, period_guest_us)
 
 void hist_browser__init_hpp(void)
 {
-   perf_hpp__init();
-
perf_hpp__format[PERF_HPP__OVERHEAD].color =
hist_browser__hpp_color_overhead;
perf_hpp__format[PERF_HPP__OVERHEAD_SYS].color =
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 2237245bfac0..fd52669018ee 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -58,8 +58,6 @@ __HPP_COLOR_PERCENT_FN(overhead_guest_us, period_guest_us)
 
 void perf_gtk__init_hpp(void)
 {
-   perf_hpp__init();
-
perf_hpp__format[PERF_HPP__OVERHEAD].color =
perf_gtk__hpp_color_overhead;
perf_hpp__format[PERF_HPP__OVERHEAD_SYS].color =
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index 5df5140a9f29..ba51fa8a1176 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -86,8 +86,6 @@ void setup_browser(bool fallback_to_pager)
use_browser = 0;
if (fallback_to_pager)
setup_pager();
-
-   perf_hpp__init();
break;
}
 }
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 14/20] perf top: Add --fields option to specify output fields

2014-05-18 Thread Namhyung Kim
The --fields option is to allow user setup output field in any order.
It can recieve any sort keys and following (hpp) fields:

  overhead, overhead_sys, overhead_us, sample and period

If guest profiling is enabled, overhead_guest_{sys,us} will be
available too.

More more information, please see previous patch "perf report:
Add -F option to specify output fields"

Signed-off-by: Namhyung Kim 
---
 tools/perf/Documentation/perf-top.txt |  9 +
 tools/perf/builtin-top.c  | 15 +--
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/tools/perf/Documentation/perf-top.txt 
b/tools/perf/Documentation/perf-top.txt
index df863288752a..dcfa54c851e9 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -116,6 +116,15 @@ Default is to monitor all CPUS.
local_weight, abort, in_tx, transaction, overhead, sample, period.
Please see description of --sort in the perf-report man page.
 
+--fields=::
+   Specify output field - multiple keys can be specified in CSV format.
+   Following fields are available:
+   overhead, overhead_sys, overhead_us, sample and period.
+   Also it can contain any sort key(s).
+
+   By default, every sort keys not specified in --field will be appended
+   automatically.
+
 -n::
 --show-nr-samples::
Show a column with the number of samples.
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 280945bab66d..5b389ce4cd15 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1085,6 +1085,8 @@ int cmd_top(int argc, const char **argv, const char 
*prefix __maybe_unused)
OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
   "sort by key(s): pid, comm, dso, symbol, parent, cpu, 
srcline, ..."
   " Please refer the man page for the complete list."),
+   OPT_STRING(0, "fields", &field_order, "key[,keys...]",
+  "output field(s): overhead, period, sample plus all of sort 
keys"),
OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples,
"Show a column with the number of samples"),
OPT_CALLBACK_NOOPT('g', NULL, &top.record_opts,
@@ -1138,17 +1140,18 @@ int cmd_top(int argc, const char **argv, const char 
*prefix __maybe_unused)
usage_with_options(top_usage, options);
 
sort__mode = SORT_MODE__TOP;
+   /* display thread wants entries to be collapsed in a different tree */
+   sort__need_collapse = 1;
 
if (setup_sorting() < 0) {
-   parse_options_usage(top_usage, options, "s", 1);
+   if (sort_order)
+   parse_options_usage(top_usage, options, "s", 1);
+   if (field_order)
+   parse_options_usage(sort_order ? NULL : top_usage,
+   options, "fields", 0);
goto out_delete_evlist;
}
 
-   /* display thread wants entries to be collapsed in a different tree */
-   sort__need_collapse = 1;
-
-   perf_hpp__init();
-
if (top.use_stdio)
use_browser = 0;
else if (top.use_tui)
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 09/20] perf tools: Consolidate management of default sort orders

2014-05-18 Thread Namhyung Kim
The perf uses different default sort orders for different use-cases,
and this was scattered throughout the code.  Add get_default_sort_
order() function to handle this and change initial value of sort_order
to NULL to distinguish it from user-given one.

Cc: Stephane Eranian 
Signed-off-by: Namhyung Kim 
---
 tools/perf/builtin-diff.c   |  4 ++--
 tools/perf/builtin-report.c | 18 --
 tools/perf/builtin-top.c|  3 +--
 tools/perf/util/sort.c  | 28 ++--
 tools/perf/util/sort.h  |  2 ++
 5 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index b60c711d4e72..8bff543acaab 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -60,7 +60,6 @@ static int data__files_cnt;
 #define data__for_each_file(i, d) data__for_each_file_start(i, d, 0)
 #define data__for_each_file_new(i, d) data__for_each_file_start(i, d, 1)
 
-static char diff__default_sort_order[] = "dso,symbol";
 static bool force;
 static bool show_period;
 static bool show_formula;
@@ -1142,7 +1141,6 @@ int cmd_diff(int argc, const char **argv, const char 
*prefix __maybe_unused)
 {
perf_config(perf_default_config, NULL);
 
-   sort_order = diff__default_sort_order;
argc = parse_options(argc, argv, options, diff_usage, 0);
 
if (symbol__init() < 0)
@@ -1153,6 +1151,8 @@ int cmd_diff(int argc, const char **argv, const char 
*prefix __maybe_unused)
 
ui_init();
 
+   sort__mode = SORT_MODE__DIFF;
+
if (setup_sorting() < 0)
usage_with_options(diff_usage, options);
 
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index d0180d5de781..f4d640cfdf16 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -805,30 +805,12 @@ repeat:
if (branch_mode == -1 && has_br_stack)
sort__mode = SORT_MODE__BRANCH;
 
-   /* sort__mode could be NORMAL if --no-branch-stack */
-   if (sort__mode == SORT_MODE__BRANCH) {
-   /*
-* if no sort_order is provided, then specify
-* branch-mode specific order
-*/
-   if (sort_order == default_sort_order)
-   sort_order = "comm,dso_from,symbol_from,"
-"dso_to,symbol_to";
-
-   }
if (report.mem_mode) {
if (sort__mode == SORT_MODE__BRANCH) {
pr_err("branch and mem mode incompatible\n");
goto error;
}
sort__mode = SORT_MODE__MEMORY;
-
-   /*
-* if no sort_order is provided, then specify
-* branch-mode specific order
-*/
-   if (sort_order == default_sort_order)
-   sort_order = 
"local_weight,mem,sym,dso,symbol_daddr,dso_daddr,snoop,tlb,locked";
}
 
if (setup_sorting() < 0) {
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 4fef1e415129..34764b6eabf9 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1137,8 +1137,7 @@ int cmd_top(int argc, const char **argv, const char 
*prefix __maybe_unused)
if (argc)
usage_with_options(top_usage, options);
 
-   if (sort_order == default_sort_order)
-   sort_order = "dso,symbol";
+   sort__mode = SORT_MODE__TOP;
 
if (setup_sorting() < 0) {
parse_options_usage(top_usage, options, "s", 1);
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 916652af8304..d64c1e58f1b1 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -8,7 +8,11 @@ regex_tparent_regex;
 const char default_parent_pattern[] = "^sys_|^do_page_fault";
 const char *parent_pattern = default_parent_pattern;
 const char default_sort_order[] = "comm,dso,symbol";
-const char *sort_order = default_sort_order;
+const char default_branch_sort_order[] = 
"comm,dso_from,symbol_from,dso_to,symbol_to";
+const char default_mem_sort_order[] = 
"local_weight,mem,sym,dso,symbol_daddr,dso_daddr,snoop,tlb,locked";
+const char default_top_sort_order[] = "dso,symbol";
+const char default_diff_sort_order[] = "dso,symbol";
+const char *sort_order;
 regex_tignore_callees_regex;
 inthave_ignore_callees = 0;
 intsort__need_collapse = 0;
@@ -1218,11 +1222,31 @@ int sort_dimension__add(const char *tok)
return -ESRCH;
 }
 
+static const char *get_default_sort_order(void)
+{
+   const char *default_sort_orders[] = {
+   default_sort_order,
+   default_branch_sort_order,
+   default_mem_sort_order,
+   default_top_sort_order,
+   default_diff_sort_order,
+   };
+
+   BUG_ON(sort__mode >= ARRAY_SIZE(default_sort_orders));
+
+   return default_sort_orde

[PATCH 12/20] perf tools: Add ->sort() member to struct sort_entry

2014-05-18 Thread Namhyung Kim
Currently, what the sort_entry does is just identifying hist entries
so that they can be grouped properly.  However, with -F option
support, it indeed needs to sort entries appropriately to be shown to
users.  So add ->sort() member to do it.

Acked-by: Ingo Molnar 
Signed-off-by: Namhyung Kim 
---
 tools/perf/util/sort.c | 27 ++-
 tools/perf/util/sort.h |  1 +
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index b748b02fcb78..5414ba541e47 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -99,6 +99,12 @@ sort__comm_collapse(struct hist_entry *left, struct 
hist_entry *right)
return comm__str(right->comm) - comm__str(left->comm);
 }
 
+static int64_t
+sort__comm_sort(struct hist_entry *left, struct hist_entry *right)
+{
+   return strcmp(comm__str(right->comm), comm__str(left->comm));
+}
+
 static int hist_entry__comm_snprintf(struct hist_entry *he, char *bf,
 size_t size, unsigned int width)
 {
@@ -109,6 +115,7 @@ struct sort_entry sort_comm = {
.se_header  = "Command",
.se_cmp = sort__comm_cmp,
.se_collapse= sort__comm_collapse,
+   .se_sort= sort__comm_sort,
.se_snprintf= hist_entry__comm_snprintf,
.se_width_idx   = HISTC_COMM,
 };
@@ -122,7 +129,7 @@ static int64_t _sort__dso_cmp(struct map *map_l, struct map 
*map_r)
const char *dso_name_l, *dso_name_r;
 
if (!dso_l || !dso_r)
-   return cmp_null(dso_l, dso_r);
+   return cmp_null(dso_r, dso_l);
 
if (verbose) {
dso_name_l = dso_l->long_name;
@@ -138,7 +145,7 @@ static int64_t _sort__dso_cmp(struct map *map_l, struct map 
*map_r)
 static int64_t
 sort__dso_cmp(struct hist_entry *left, struct hist_entry *right)
 {
-   return _sort__dso_cmp(left->ms.map, right->ms.map);
+   return _sort__dso_cmp(right->ms.map, left->ms.map);
 }
 
 static int _hist_entry__dso_snprintf(struct map *map, char *bf,
@@ -210,6 +217,15 @@ sort__sym_cmp(struct hist_entry *left, struct hist_entry 
*right)
return _sort__sym_cmp(left->ms.sym, right->ms.sym);
 }
 
+static int64_t
+sort__sym_sort(struct hist_entry *left, struct hist_entry *right)
+{
+   if (!left->ms.sym || !right->ms.sym)
+   return cmp_null(left->ms.sym, right->ms.sym);
+
+   return strcmp(right->ms.sym->name, left->ms.sym->name);
+}
+
 static int _hist_entry__sym_snprintf(struct map *map, struct symbol *sym,
 u64 ip, char level, char *bf, size_t size,
 unsigned int width)
@@ -256,6 +272,7 @@ static int hist_entry__sym_snprintf(struct hist_entry *he, 
char *bf,
 struct sort_entry sort_sym = {
.se_header  = "Symbol",
.se_cmp = sort__sym_cmp,
+   .se_sort= sort__sym_sort,
.se_snprintf= hist_entry__sym_snprintf,
.se_width_idx   = HISTC_SYMBOL,
 };
@@ -283,7 +300,7 @@ sort__srcline_cmp(struct hist_entry *left, struct 
hist_entry *right)
map__rip_2objdump(map, right->ip));
}
}
-   return strcmp(left->srcline, right->srcline);
+   return strcmp(right->srcline, left->srcline);
 }
 
 static int hist_entry__srcline_snprintf(struct hist_entry *he, char *bf,
@@ -311,7 +328,7 @@ sort__parent_cmp(struct hist_entry *left, struct hist_entry 
*right)
if (!sym_l || !sym_r)
return cmp_null(sym_l, sym_r);
 
-   return strcmp(sym_l->name, sym_r->name);
+   return strcmp(sym_r->name, sym_l->name);
 }
 
 static int hist_entry__parent_snprintf(struct hist_entry *he, char *bf,
@@ -1126,7 +1143,7 @@ __sort_dimension__alloc_hpp(struct sort_dimension *sd)
 
hse->hpp.cmp = sd->entry->se_cmp;
hse->hpp.collapse = sd->entry->se_collapse ? : sd->entry->se_cmp;
-   hse->hpp.sort = hse->hpp.collapse;
+   hse->hpp.sort = sd->entry->se_sort ? : hse->hpp.collapse;
 
INIT_LIST_HEAD(&hse->hpp.list);
INIT_LIST_HEAD(&hse->hpp.sort_list);
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 89e5057ca378..f5a831c3d0fb 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -182,6 +182,7 @@ struct sort_entry {
 
int64_t (*se_cmp)(struct hist_entry *, struct hist_entry *);
int64_t (*se_collapse)(struct hist_entry *, struct hist_entry *);
+   int64_t (*se_sort)(struct hist_entry *, struct hist_entry *);
int (*se_snprintf)(struct hist_entry *he, char *bf, size_t size,
   unsigned int width);
u8  se_width_idx;
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/5] cpufreq: exynos5440: don't initialize opp table

2014-05-18 Thread Viresh Kumar
OPP tables are already initialized for CPU0 by cpufreq core and so we don't need
to reinitialize them from exynos5440's driver.

Cc: Amit Daniel Kachhap 
Cc: Kukjin Kim 
Signed-off-by: Viresh Kumar 
---
 drivers/cpufreq/exynos5440-cpufreq.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/cpufreq/exynos5440-cpufreq.c 
b/drivers/cpufreq/exynos5440-cpufreq.c
index f33f25b..72a4206 100644
--- a/drivers/cpufreq/exynos5440-cpufreq.c
+++ b/drivers/cpufreq/exynos5440-cpufreq.c
@@ -360,12 +360,6 @@ static int exynos_cpufreq_probe(struct platform_device 
*pdev)
goto err_put_node;
}
 
-   ret = of_init_opp_table(dvfs_info->dev);
-   if (ret) {
-   dev_err(dvfs_info->dev, "failed to init OPP table: %d\n", ret);
-   goto err_put_node;
-   }
-
ret = dev_pm_opp_init_cpufreq_table(dvfs_info->dev,
&dvfs_info->freq_table);
if (ret) {
-- 
2.0.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/5] driver/core: cpu: initialize opp table

2014-05-18 Thread Viresh Kumar
All drivers expecting CPU's OPPs from device tree initialize OPP table using
of_init_opp_table() and there is nothing driver specific in that. They all do it
in the same way adding to code redundancy.

It would be better if we can get rid of code redundancy by initializing CPU OPPs
from core code for all CPUs that have a "operating-points" property defined in
their node.

This patch initializes OPPs as soon as CPU device is registered in
register_cpu().

Cc: Greg Kroah-Hartman 
Cc: Amit Daniel Kachhap 
Cc: Kukjin Kim 
Cc: Shawn Guo 
Cc: Sudeep Holla 
Signed-off-by: Viresh Kumar 
---
 drivers/base/cpu.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 006b1bc..c787b5b 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "base.h"
 
@@ -349,11 +350,20 @@ int register_cpu(struct cpu *cpu, int num)
if (cpu->hotpluggable)
cpu->dev.groups = hotplugable_cpu_attr_groups;
error = device_register(&cpu->dev);
-   if (!error)
+   if (!error) {
per_cpu(cpu_sys_devices, num) = &cpu->dev;
-   if (!error)
register_cpu_under_node(num, cpu_to_node(num));
 
+   /* Initialize CPUs OPP table */
+   if (of_node_get(cpu->dev.of_node)) {
+   error = of_init_opp_table(&cpu->dev);
+   if (error && error != -ENODEV)
+   pr_err("%s: failed to init OPP table for 
cpu%d, err: %d\n",
+   __func__, num, error);
+   of_node_put(cpu->dev.of_node);
+   }
+   }
+
return error;
 }
 
-- 
2.0.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/5] cpufreq: cpufreq-cpu0: don't initialize opp table

2014-05-18 Thread Viresh Kumar
OPP tables are already initialized for CPU0 by cpufreq core and so we don't need
to reinitialize them from cpufreq-cpu0 driver.

Cc: Shawn Guo 
Signed-off-by: Viresh Kumar 
---
 drivers/cpufreq/cpufreq-cpu0.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index 1bf6bba..4301c7c 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -152,12 +152,6 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
goto out_put_node;
}
 
-   ret = of_init_opp_table(cpu_dev);
-   if (ret) {
-   pr_err("failed to init OPP table: %d\n", ret);
-   goto out_put_node;
-   }
-
ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);
if (ret) {
pr_err("failed to init cpufreq table: %d\n", ret);
-- 
2.0.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/5] cpufreq: arm_big_little: don't initialize opp table

2014-05-18 Thread Viresh Kumar
OPP tables are already initialized for all CPUs by cpufreq core and so we don't
need to reinitialize them from arm_big_little_dt driver.

Also, as the arm_big_little_dt driver doesn't have a .init_opp_table() callback
anymore, make it optional in arm_big_little driver.

Cc: Sudeep Holla 
Signed-off-by: Viresh Kumar 
---
 drivers/cpufreq/arm_big_little.c| 12 +++-
 drivers/cpufreq/arm_big_little_dt.c | 18 --
 2 files changed, 7 insertions(+), 23 deletions(-)

diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 1f4d4e3..561261e 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -325,11 +325,13 @@ static int _get_cluster_clk_and_freq_table(struct device 
*cpu_dev)
if (freq_table[cluster])
return 0;
 
-   ret = arm_bL_ops->init_opp_table(cpu_dev);
-   if (ret) {
-   dev_err(cpu_dev, "%s: init_opp_table failed, cpu: %d, err: 
%d\n",
+   if (arm_bL_ops->init_opp_table) {
+   ret = arm_bL_ops->init_opp_table(cpu_dev);
+   if (ret) {
+   dev_err(cpu_dev, "%s: init_opp_table failed, cpu: %d, 
err: %d\n",
__func__, cpu_dev->id, ret);
-   goto out;
+   goto out;
+   }
}
 
ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table[cluster]);
@@ -542,7 +544,7 @@ int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops)
return -EBUSY;
}
 
-   if (!ops || !strlen(ops->name) || !ops->init_opp_table) {
+   if (!ops || !strlen(ops->name)) {
pr_err("%s: Invalid arm_bL_ops, exiting\n", __func__);
return -ENODEV;
}
diff --git a/drivers/cpufreq/arm_big_little_dt.c 
b/drivers/cpufreq/arm_big_little_dt.c
index 8d9d591..502182d 100644
--- a/drivers/cpufreq/arm_big_little_dt.c
+++ b/drivers/cpufreq/arm_big_little_dt.c
@@ -43,23 +43,6 @@ static struct device_node *get_cpu_node_with_valid_op(int 
cpu)
return np;
 }
 
-static int dt_init_opp_table(struct device *cpu_dev)
-{
-   struct device_node *np;
-   int ret;
-
-   np = of_node_get(cpu_dev->of_node);
-   if (!np) {
-   pr_err("failed to find cpu%d node\n", cpu_dev->id);
-   return -ENOENT;
-   }
-
-   ret = of_init_opp_table(cpu_dev);
-   of_node_put(np);
-
-   return ret;
-}
-
 static int dt_get_transition_latency(struct device *cpu_dev)
 {
struct device_node *np;
@@ -81,7 +64,6 @@ static int dt_get_transition_latency(struct device *cpu_dev)
 static struct cpufreq_arm_bL_ops dt_bL_ops = {
.name   = "dt-bl",
.get_transition_latency = dt_get_transition_latency,
-   .init_opp_table = dt_init_opp_table,
 };
 
 static int generic_bL_probe(struct platform_device *pdev)
-- 
2.0.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/5] cpufreq: imx6q: don't initialize opp table

2014-05-18 Thread Viresh Kumar
OPP tables are already initialized for CPU0 by cpufreq core and so we don't need
to reinitialize them from imx6q specific code.

Cc: Shawn Guo 
Signed-off-by: Viresh Kumar 
---
 arch/arm/mach-imx/mach-imx6q.c  | 36 
 drivers/cpufreq/imx6q-cpufreq.c | 20 +---
 2 files changed, 9 insertions(+), 47 deletions(-)

diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index e60456d..03819e7 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -290,12 +290,18 @@ static void __init imx6q_init_machine(void)
 #define OCOTP_CFG3_SPEED_996MHZ0x2
 #define OCOTP_CFG3_SPEED_852MHZ0x1
 
-static void __init imx6q_opp_check_speed_grading(struct device *cpu_dev)
+static void __init imx6q_opp_check_speed_grading(void)
 {
+   struct device *cpu_dev = get_cpu_device(0);
struct device_node *np;
void __iomem *base;
u32 val;
 
+   if (!cpu_dev) {
+   pr_warn("failed to get cpu0 device\n");
+   return;
+   }
+
np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-ocotp");
if (!np) {
pr_warn("failed to find ocotp node\n");
@@ -336,32 +342,6 @@ put_node:
of_node_put(np);
 }
 
-static void __init imx6q_opp_init(void)
-{
-   struct device_node *np;
-   struct device *cpu_dev = get_cpu_device(0);
-
-   if (!cpu_dev) {
-   pr_warn("failed to get cpu0 device\n");
-   return;
-   }
-   np = of_node_get(cpu_dev->of_node);
-   if (!np) {
-   pr_warn("failed to find cpu0 node\n");
-   return;
-   }
-
-   if (of_init_opp_table(cpu_dev)) {
-   pr_warn("failed to init OPP table\n");
-   goto put_node;
-   }
-
-   imx6q_opp_check_speed_grading(cpu_dev);
-
-put_node:
-   of_node_put(np);
-}
-
 static struct platform_device imx6q_cpufreq_pdev = {
.name = "imx6q-cpufreq",
 };
@@ -376,7 +356,7 @@ static void __init imx6q_init_late(void)
imx6q_cpuidle_init();
 
if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ)) {
-   imx6q_opp_init();
+   imx6q_opp_check_speed_grading();
platform_device_register(&imx6q_cpufreq_pdev);
}
 }
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index e27fca8..c4c4e70 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -191,26 +191,8 @@ static int imx6q_cpufreq_probe(struct platform_device 
*pdev)
goto put_node;
}
 
-   /*
-* We expect an OPP table supplied by platform.
-* Just, incase the platform did not supply the OPP
-* table, it will try to get it.
-*/
num = dev_pm_opp_get_opp_count(cpu_dev);
-   if (num < 0) {
-   ret = of_init_opp_table(cpu_dev);
-   if (ret < 0) {
-   dev_err(cpu_dev, "failed to init OPP table: %d\n", ret);
-   goto put_node;
-   }
-
-   num = dev_pm_opp_get_opp_count(cpu_dev);
-   if (num < 0) {
-   ret = num;
-   dev_err(cpu_dev, "no OPP table is found: %d\n", ret);
-   goto put_node;
-   }
-   }
+   WARN_ON(num < 0);
 
ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);
if (ret) {
-- 
2.0.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/5] CPUFreq: Initialize CPU's OPP tables from core

2014-05-18 Thread Viresh Kumar
All drivers expecting CPU's OPPs from device tree initialize OPP table using
of_init_opp_table() and there is nothing driver specific in that. They all do it
in the same way adding to code redundancy.

It would be better if we can get rid of code redundancy by initializing CPU OPPs
from core code for all CPUs that have a "operating-points" property defined in
their node.

First patch initializes OPPs as soon as CPU device is registered in
register_cpu(). Following patches get rid of these calls from individual drivers
which are currently initializing OPPs.

The idea was initially discussed here: https://lkml.org/lkml/2014/5/17/123

Cc: Greg Kroah-Hartman 
Cc: Amit Daniel Kachhap 
Cc: Kukjin Kim 
Cc: Shawn Guo 
Cc: Sudeep Holla 

Viresh Kumar (5):
  driver/core: cpu: initialize opp table
  cpufreq: arm_big_little: don't initialize opp table
  cpufreq: imx6q: don't initialize opp table
  cpufreq: cpufreq-cpu0: don't initialize opp table
  cpufreq: exynos5440: don't initialize opp table

 arch/arm/mach-imx/mach-imx6q.c   | 36 
 drivers/base/cpu.c   | 14 --
 drivers/cpufreq/arm_big_little.c | 12 +++-
 drivers/cpufreq/arm_big_little_dt.c  | 18 --
 drivers/cpufreq/cpufreq-cpu0.c   |  6 --
 drivers/cpufreq/exynos5440-cpufreq.c |  6 --
 drivers/cpufreq/imx6q-cpufreq.c  | 20 +---
 7 files changed, 28 insertions(+), 84 deletions(-)

-- 
2.0.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/10] thermal: exynos: various cleanups

2014-05-18 Thread Amit Kachhap
On 5/15/14, Zhang Rui  wrote:
> On 一, 2014-05-05 at 13:15 +0200, Bartlomiej Zolnierkiewicz wrote:
>> Hi,
>>
>> This patch series contains various cleanups for EXYNOS thermal
>> driver.  Overall it decreases driver's LOC by 13%.  It is based
>> on next-20140428 kernel.  It should not cause any functionality
>> changes.
>>
> Amit,
>
> what do you think of this patch set?
>
> thanks,
> rui

I agreed to many of the cleanups in the patch but tmu controller
features should be retained as they will allow adding quick soc
support and also avoid unnecessary churning of code in the future.

Thanks,
Amit

>> Best regards,
>> --
>> Bartlomiej Zolnierkiewicz
>> Samsung R&D Institute Poland
>> Samsung Electronics
>>
>>
>> Bartlomiej Zolnierkiewicz (10):
>>   thermal: exynos: remove unused struct exynos_tmu_registers entries
>>   thermal: exynos: remove unused defines
>>   thermal: exynos: remove dead code for HW_MODE calibration
>>   thermal: exynos: remove dead code for TYPE_TWO_POINT_TRIMMING
>> calibration
>>   thermal: exynos: remove redundant pdata checks from
>> exynos_tmu_initialize()
>>   thermal: exynos: remove redundant threshold_code checks from
>> exynos_tmu_initialize()
>>   thermal: exynos: simplify temp_to_code() and code_to_temp()
>>   thermal: exynos: cache non_hw_trigger_levels in pdata
>>   thermal: exynos: remove redundant pdata checks from
>> exynos_tmu_control()
>>   thermal: exynos: remove identical values from exynos*_tmu_registers
>> structures
>>
>>  drivers/thermal/samsung/exynos_thermal_common.h |   1 -
>>  drivers/thermal/samsung/exynos_tmu.c| 181
>> 
>>  drivers/thermal/samsung/exynos_tmu.h|  86 +--
>>  drivers/thermal/samsung/exynos_tmu_data.c   |  40 +-
>>  drivers/thermal/samsung/exynos_tmu_data.h   |  32 +
>>  5 files changed, 37 insertions(+), 303 deletions(-)
>>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 10/10] thermal: exynos: remove identical values from exynos*_tmu_registers structures

2014-05-18 Thread Amit Kachhap
On 5/5/14, Bartlomiej Zolnierkiewicz  wrote:
> There is no need for abstracting configuration for registers that
> are identical on all SoC types.
Changes look fine and also that shift and masks may not change in
future socs also.
Reviewed-by: Amit Daniel Kachhap
>
> There should be no functional changes caused by this patch.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz 
> ---
>  drivers/thermal/samsung/exynos_tmu.c  | 12 ++--
>  drivers/thermal/samsung/exynos_tmu.h  | 11 ---
>  drivers/thermal/samsung/exynos_tmu_data.c | 15 ---
>  3 files changed, 6 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> b/drivers/thermal/samsung/exynos_tmu.c
> index 45d7c6f..d37e755 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -215,11 +215,11 @@ static void exynos_tmu_control(struct platform_device
> *pdev, bool on)
>   if (pdata->test_mux)
>   con |= (pdata->test_mux << reg->test_mux_addr_shift);
>
> - con &= ~(reg->buf_vref_sel_mask << reg->buf_vref_sel_shift);
> - con |= pdata->reference_voltage << reg->buf_vref_sel_shift;
> + con &= ~(EXYNOS_TMU_REF_VOLTAGE_MASK << EXYNOS_TMU_REF_VOLTAGE_SHIFT);
> + con |= pdata->reference_voltage << EXYNOS_TMU_REF_VOLTAGE_SHIFT;
>
> - con &= ~(reg->buf_slope_sel_mask << reg->buf_slope_sel_shift);
> - con |= (pdata->gain << reg->buf_slope_sel_shift);
> + con &= ~(EXYNOS_TMU_BUF_SLOPE_SEL_MASK <<
> EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT);
> + con |= (pdata->gain << EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT);
>
>   if (pdata->noise_cancel_mode) {
>   con &= ~(reg->therm_trip_mode_mask <<
> @@ -228,7 +228,7 @@ static void exynos_tmu_control(struct platform_device
> *pdev, bool on)
>   }
>
>   if (on) {
> - con |= (1 << reg->core_en_shift);
> + con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
>   interrupt_en =
>   pdata->trigger_enable[3] << reg->inten_rise3_shift |
>   pdata->trigger_enable[2] << reg->inten_rise2_shift |
> @@ -238,7 +238,7 @@ static void exynos_tmu_control(struct platform_device
> *pdev, bool on)
>   interrupt_en |=
>   interrupt_en << reg->inten_fall0_shift;
>   } else {
> - con &= ~(1 << reg->core_en_shift);
> + con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT);
>   interrupt_en = 0; /* Disable all interrupts */
>   }
>   writel(interrupt_en, data->base + reg->tmu_inten);
> diff --git a/drivers/thermal/samsung/exynos_tmu.h
> b/drivers/thermal/samsung/exynos_tmu.h
> index 4845171..5c25a4b 100644
> --- a/drivers/thermal/samsung/exynos_tmu.h
> +++ b/drivers/thermal/samsung/exynos_tmu.h
> @@ -69,15 +69,9 @@ enum soc_type {
>   * @triminfo_ctrl: trim info controller register.
>   * @tmu_ctrl: TMU main controller register.
>   * @test_mux_addr_shift: shift bits of test mux address.
> - * @buf_vref_sel_shift: shift bits of reference voltage in tmu_ctrl
> register.
> - * @buf_vref_sel_mask: mask bits of reference voltage in tmu_ctrl
> register.
>   * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl
> register.
>   * @therm_trip_mode_mask: mask bits of tripping mode in tmu_ctrl register.
>   * @therm_trip_en_shift: shift bits of tripping enable in tmu_ctrl
> register.
> - * @buf_slope_sel_shift: shift bits of amplifier gain value in tmu_ctrl
> - register.
> - * @buf_slope_sel_mask: mask bits of amplifier gain value in tmu_ctrl
> register.
> - * @core_en_shift: shift bits of TMU core enable bit in tmu_ctrl register.
>   * @tmu_status: register drescribing the TMU status.
>   * @tmu_cur_temp: register containing the current temperature of the TMU.
>   * @threshold_temp: register containing the base threshold level.
> @@ -111,14 +105,9 @@ struct exynos_tmu_registers {
>
>   u32 tmu_ctrl;
>   u32 test_mux_addr_shift;
> - u32 buf_vref_sel_shift;
> - u32 buf_vref_sel_mask;
>   u32 therm_trip_mode_shift;
>   u32 therm_trip_mode_mask;
>   u32 therm_trip_en_shift;
> - u32 buf_slope_sel_shift;
> - u32 buf_slope_sel_mask;
> - u32 core_en_shift;
>
>   u32 tmu_status;
>
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.c
> b/drivers/thermal/samsung/exynos_tmu_data.c
> index ef7f186..32530dc 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.c
> +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> @@ -28,11 +28,6 @@
>  static const struct exynos_tmu_registers exynos4210_tmu_registers = {
>   .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
>   .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
> - .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT,
> - .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK,
> - .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT,
> - .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK,
> - .core_en_shift = EXYNOS_TMU_CO

Re: [PATCH v2] ARM: imx: remove unused defines

2014-05-18 Thread Shawn Guo
On Fri, May 16, 2014 at 11:09:29AM +0200, Paul Bolle wrote:
> None of the defines "for modules using static and dynamic DMA channels"
> are used. Remove these.
> 
> Signed-off-by: Paul Bolle 

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 09/10] thermal: exynos: remove redundant pdata checks from exynos_tmu_control()

2014-05-18 Thread Amit Kachhap
Hi Bartlomiej,
On 5/5/14, Bartlomiej Zolnierkiewicz  wrote:
> pdata->reference_voltage and pdata->gain are always defined
> to non-zero values so remove the redundant checks from
> exynos_tmu_control().
I prefer to have these checks for the same reason that new soc support
should not add these same code again.
>
> There should be no functional changes caused by this patch.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz 
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 12 
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> b/drivers/thermal/samsung/exynos_tmu.c
> index a8d9524..45d7c6f 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -215,15 +215,11 @@ static void exynos_tmu_control(struct platform_device
> *pdev, bool on)
>   if (pdata->test_mux)
>   con |= (pdata->test_mux << reg->test_mux_addr_shift);
>
> - if (pdata->reference_voltage) {
> - con &= ~(reg->buf_vref_sel_mask << reg->buf_vref_sel_shift);
> - con |= pdata->reference_voltage << reg->buf_vref_sel_shift;
> - }
> + con &= ~(reg->buf_vref_sel_mask << reg->buf_vref_sel_shift);
> + con |= pdata->reference_voltage << reg->buf_vref_sel_shift;
>
> - if (pdata->gain) {
> - con &= ~(reg->buf_slope_sel_mask << reg->buf_slope_sel_shift);
> - con |= (pdata->gain << reg->buf_slope_sel_shift);
> - }
> + con &= ~(reg->buf_slope_sel_mask << reg->buf_slope_sel_shift);
> + con |= (pdata->gain << reg->buf_slope_sel_shift);
>
>   if (pdata->noise_cancel_mode) {
>   con &= ~(reg->therm_trip_mode_mask <<
> --
> 1.8.2.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] dma: pl330: Add support for DMA_PAUSE command

2014-05-18 Thread Lars-Peter Clausen

On 05/19/2014 05:10 AM, Tushar Behera wrote:

On 16 May 2014 00:51, Lars-Peter Clausen  wrote:

On 05/15/2014 02:01 PM, Tushar Behera wrote:


On 14 May 2014 17:54, Lars-Peter Clausen  wrote:


On 05/14/2014 02:07 PM, Tushar Behera wrote:



On 14 May 2014 17:29, Jassi Brar  wrote:



On Wed, May 14, 2014 at 8:53 AM, Tushar Behera

wrote:



While playing back audio, pmc_dmaengine requests the DMA channel to
stop DMA transmission through DMA_PAUSE command.

Currently PL330 driver doesn't support DMA pause command, leaving
the DMA state inconsistent when the system resumes. Instead, it would
be better to terminate the DMA transfer during suspend and restart
again during resume.

Tested with audio playback across a suspend-resume cycle.


What is pmc_dmaengine? How does DMA_PAUSE help, when there is no
DMA_RESUME?



Sorry, it is a typo.

sound/core/pcm_dmaengine.c:snd_dmaengine_pcm_trigger() -->
dmaengine_pause() is called during system suspend.




It is only called if the DMA driver has support for pausing and resuming
DMA
transfers. Or at least that is the intention.

- Lars



During suspend, snd_dmaengine_pcm_trigger():SNDRV_PCM_TRIGGER_SUSPEND
is called which unconditionally calls dmaengine_pause(). Should we
update snd_dmaengine_pcm_trigger() to check for DMA pause/resume
support and call dmaengine_pause() or dmaengine_terminate_all()
accordingly?



As far as I understand it we do not have to do anything for TRIGGER_SUSPEND
if we do not set the SNDRV_PCM_INFO_RESUME flag. It looks like
TRIGGER_SUSPEND is called unconditionally during suspend. But since the
error code is ignored it should be fine if we just call dmaengine_pause()
and that return -ENOSYS or similar.

Are you seeing an actual issue that you are trying to fix with your patch?

- Lars



Without this patch applied, if audio is playing back while suspend is
triggered, it doesn't playback after resume. Stopping the stream and
replaying works.



Ok, I think your second suggestion was correct. Call 
dmaengine_terminate_all() instead of damengine_pause() in 
snd_dmaengine_pcm_trigger() if the dmaengine driver does not support pausing 
the transfer.


- Lars
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 13/13] s390/irq: make return of 0 explicit

2014-05-18 Thread Heiko Carstens
On Mon, May 19, 2014 at 06:31:15AM +0200, Julia Lawall wrote:
> From: Julia Lawall 
> 
> Delete unnecessary local variable whose value is always 0 and that hides
> the fact that the result is always 0.
> 
> A simplified version of the semantic patch that fixes this problem is as
> follows: (http://coccinelle.lip6.fr/)
> 
> Signed-off-by: Julia Lawall 
> 
> ---
>  arch/s390/oprofile/hwsampler.c |6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/s390/oprofile/hwsampler.c b/arch/s390/oprofile/hwsampler.c
> index 276f2e2..28b2760 100644
> --- a/arch/s390/oprofile/hwsampler.c
> +++ b/arch/s390/oprofile/hwsampler.c
> @@ -212,10 +212,8 @@ static void init_all_cpu_buffers(void)
>  static int prepare_cpu_buffers(void)
>  {
>   int cpu;
> - int rc;
>   struct hws_cpu_buffer *cb;
> 
> - rc = 0;
>   for_each_online_cpu(cpu) {
>   cb = &per_cpu(sampler_cpu_buffer, cpu);
>   atomic_set(&cb->ext_params, 0);
> @@ -231,7 +229,7 @@ static int prepare_cpu_buffers(void)
>   cb->stop_mode = 0;
>   }
> 
> - return rc;
> + return 0;
>  }

Thanks Julia,

I applied a slightly different version which also turns prepare_cpu_buffers
into a void returning function.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 11/20] perf report: Add -F option to specify output fields

2014-05-18 Thread Namhyung Kim
On Fri, 16 May 2014 15:33:14 +0900, Namhyung Kim wrote:
> On Thu, 15 May 2014 15:17:17 +0200, Jiri Olsa wrote:
>> On Mon, May 12, 2014 at 03:28:44PM +0900, Namhyung Kim wrote:
>>
>> SNIP
>>
>>> +
>>> +int setup_output_field(void)
>>> +{
>>> +   char *tmp, *tok, *str;
>>> +   int ret = 0;
>>> +
>>> +   if (field_order == NULL)
>>> +   goto out;
>>> +
>>> +   reset_dimensions();
>>
>> Do we want to call this in setup_sorting as well? In case
>> we mix the order of setup_output_field and setup_sorting
>> in the future?
>
> Yeah, looks like a good idea.

Hmm.. I misunderstood your point.  The thing is that the initialization
step needs to be done in a specific order (due to their implicit
dependency).  So I change it to be called in one place, setup_sorting().

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 08/20] perf tools: Allow hpp fields to be sort keys

2014-05-18 Thread Namhyung Kim
Hi Jiri,

On Fri, 16 May 2014 15:30:29 +0900, Namhyung Kim wrote:
> On Thu, 15 May 2014 14:51:32 +0200, Jiri Olsa wrote:
>> On Mon, May 12, 2014 at 03:28:41PM +0900, Namhyung Kim wrote:
>>
>> SNIP
>>
>>> +static struct hpp_dimension hpp_sort_dimensions[] = {
>>> +   DIM(PERF_HPP__OVERHEAD, "overhead"),
>>> +   DIM(PERF_HPP__OVERHEAD_SYS, "overhead_sys"),
>>> +   DIM(PERF_HPP__OVERHEAD_US, "overhead_us"),
>>> +   DIM(PERF_HPP__OVERHEAD_GUEST_SYS, "overhead_guest_sys"),
>>> +   DIM(PERF_HPP__OVERHEAD_GUEST_US, "overhead_guest_us"),
>>> +   DIM(PERF_HPP__SAMPLES, "sample"),
>>> +   DIM(PERF_HPP__PERIOD, "period"),
>>> +};
>>
>> just a nit.. overhead_guest_us|sys misplace are not properly aligned

Ah.. this is a pre-existing bug and I plan to fix it (along with other
related things) in a different series soon.  So let's skip this for
now. ;-p

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 3/7] Input: pixcir_i2c_ts: Get rid of pdata->attb_read_val()

2014-05-18 Thread Dmitry Torokhov
On Tue, May 06, 2014 at 02:06:08PM +0300, Roger Quadros wrote:
> Get rid of the attb_read_val() platform hook. Instead,
> read the ATTB gpio directly from the driver.
> 
> Fail if valid ATTB gpio is not provided by patform data.
> 
> Signed-off-by: Roger Quadros 
> Acked-by: Mugunthan V N 

Applied, thank you.

> ---
>  drivers/input/touchscreen/pixcir_i2c_ts.c | 16 +++-
>  include/linux/input/pixcir_ts.h   |  2 +-
>  2 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c 
> b/drivers/input/touchscreen/pixcir_i2c_ts.c
> index 96a1b1e..8a7da61 100644
> --- a/drivers/input/touchscreen/pixcir_i2c_ts.c
> +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
> @@ -24,6 +24,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  struct pixcir_i2c_ts_data {
>   struct i2c_client *client;
> @@ -87,11 +88,12 @@ static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data 
> *data)
>  static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
>  {
>   struct pixcir_i2c_ts_data *tsdata = dev_id;
> + const struct pixcir_ts_platform_data *pdata = tsdata->chip;
>  
>   while (tsdata->running) {
>   pixcir_ts_poscheck(tsdata);
>  
> - if (tsdata->chip->attb_read_val())
> + if (gpio_get_value(pdata->gpio_attb))
>   break;
>  
>   msleep(20);
> @@ -296,6 +298,11 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>   if (!pdata) {
>   dev_err(&client->dev, "platform data not defined\n");
>   return -EINVAL;
> + } else {
> + if (!gpio_is_valid(pdata->gpio_attb)) {
> + dev_err(dev, "Invalid gpio_attb in pdata\n");
> + return -EINVAL;
> + }
>   }
>  
>   tsdata = devm_kzalloc(dev, sizeof(*tsdata), GFP_KERNEL);
> @@ -328,6 +335,13 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>  
>   input_set_drvdata(input, tsdata);
>  
> + error = devm_gpio_request_one(dev, pdata->gpio_attb,
> +   GPIOF_DIR_IN, "pixcir_i2c_attb");
> + if (error) {
> + dev_err(dev, "Failed to request ATTB gpio\n");
> + return error;
> + }
> +
>   error = devm_request_threaded_irq(dev, client->irq, NULL, pixcir_ts_isr,
> IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> client->name, tsdata);
> diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
> index 7942804..160cf35 100644
> --- a/include/linux/input/pixcir_ts.h
> +++ b/include/linux/input/pixcir_ts.h
> @@ -44,9 +44,9 @@ enum pixcir_int_mode {
>  #define PIXCIR_INT_POL_HIGH  (1UL << 2)
>  
>  struct pixcir_ts_platform_data {
> - int (*attb_read_val)(void);
>   int x_max;
>   int y_max;
> + int gpio_attb;  /* GPIO connected to ATTB line */
>  };
>  
>  #endif
> -- 
> 1.8.3.2
> 

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 6/7] Input: pixcir_i2c_ts: Implement wakeup from suspend

2014-05-18 Thread Dmitry Torokhov
On Tue, May 06, 2014 at 02:06:11PM +0300, Roger Quadros wrote:
> Improve the suspend and resume handlers to allow the device
> to wakeup the system from suspend.
> 
> Signed-off-by: Roger Quadros 
> Acked-by: Mugunthan V N 

Applied, thank you.

> ---
>  drivers/input/touchscreen/pixcir_i2c_ts.c | 47 
> ---
>  1 file changed, 43 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c 
> b/drivers/input/touchscreen/pixcir_i2c_ts.c
> index 0728c04..b0f7680 100644
> --- a/drivers/input/touchscreen/pixcir_i2c_ts.c
> +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
> @@ -348,21 +348,59 @@ static void pixcir_input_close(struct input_dev *dev)
>  static int pixcir_i2c_ts_suspend(struct device *dev)
>  {
>   struct i2c_client *client = to_i2c_client(dev);
> + struct pixcir_i2c_ts_data *ts = i2c_get_clientdata(client);
> + struct input_dev *input = ts->input;
> + int ret = 0;
> +
> + mutex_lock(&input->mutex);
> +
> + if (device_may_wakeup(&client->dev)) {
> + if (!input->users) {
> + ret = pixcir_start(ts);
> + if (ret) {
> + dev_err(dev, "Failed to start\n");
> + goto unlock;
> + }
> + }
>  
> - if (device_may_wakeup(&client->dev))
>   enable_irq_wake(client->irq);
> + } else if (input->users) {
> + ret = pixcir_stop(ts);
> + }
>  
> - return 0;
> +unlock:
> + mutex_unlock(&input->mutex);
> +
> + return ret;
>  }
>  
>  static int pixcir_i2c_ts_resume(struct device *dev)
>  {
>   struct i2c_client *client = to_i2c_client(dev);
> + struct pixcir_i2c_ts_data *ts = i2c_get_clientdata(client);
> + struct input_dev *input = ts->input;
> + int ret = 0;
> +
> + mutex_lock(&input->mutex);
>  
> - if (device_may_wakeup(&client->dev))
> + if (device_may_wakeup(&client->dev)) {
>   disable_irq_wake(client->irq);
>  
> - return 0;
> + if (!input->users) {
> + ret = pixcir_stop(ts);
> + if (ret) {
> + dev_err(dev, "Failed to stop\n");
> + goto unlock;
> + }
> + }
> + } else if (input->users) {
> + ret = pixcir_start(ts);
> + }
> +
> +unlock:
> + mutex_unlock(&input->mutex);
> +
> + return ret;
>  }
>  #endif
>  
> @@ -469,6 +507,7 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>   if (error)
>   return error;
>  
> + i2c_set_clientdata(client, tsdata);
>   device_init_wakeup(&client->dev, 1);
>  
>   return 0;
> -- 
> 1.8.3.2
> 

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 08/10] thermal: exynos: cache non_hw_trigger_levels in pdata

2014-05-18 Thread Amit Kachhap
On 5/5/14, Bartlomiej Zolnierkiewicz  wrote:
> Cache number of non-hardware trigger levels in a new pdata field
> (non_hw_trigger_levels) and convert code in exynos_tmu_initialize()
> accordingly.
Changes looks fine,
Reviewed-by: Amit Daniel Kachhap
>
> There should be no functional changes caused by this patch.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz 
> ---
>  drivers/thermal/samsung/exynos_tmu.c  | 16 +++-
>  drivers/thermal/samsung/exynos_tmu.h  |  2 ++
>  drivers/thermal/samsung/exynos_tmu_data.c |  3 +++
>  3 files changed, 8 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> b/drivers/thermal/samsung/exynos_tmu.c
> index 20379eb..a8d9524 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -90,7 +90,7 @@ static int exynos_tmu_initialize(struct platform_device
> *pdev)
>   const struct exynos_tmu_registers *reg = pdata->registers;
>   unsigned int status, trim_info = 0, con;
>   unsigned int rising_threshold = 0, falling_threshold = 0;
> - int ret = 0, threshold_code, i, trigger_levs = 0;
> + int ret = 0, threshold_code, i;
>
>   mutex_lock(&data->lock);
>   clk_enable(data->clk);
> @@ -134,29 +134,19 @@ static int exynos_tmu_initialize(struct
> platform_device *pdev)
>   data->temp_error > pdata->max_efuse_value)
>   data->temp_error = pdata->efuse_value & EXYNOS_TMU_TEMP_MASK;
>
> - for (i = 0; i < pdata->max_trigger_level; i++) {
> - if (!pdata->trigger_levels[i])
> - continue;
> -
> - /* Count trigger levels except the HW trip*/
> - if (!(pdata->trigger_type[i] == HW_TRIP))
> - trigger_levs++;
> - }
> -
>   if (data->soc == SOC_ARCH_EXYNOS4210) {
>   /* Write temperature code for threshold */
>   threshold_code = temp_to_code(data, pdata->threshold);
>   writeb(threshold_code,
>   data->base + reg->threshold_temp);
> - for (i = 0; i < trigger_levs; i++)
> + for (i = 0; i < pdata->non_hw_trigger_levels; i++)
>   writeb(pdata->trigger_levels[i], data->base +
>   reg->threshold_th0 + i * sizeof(reg->threshold_th0));
>
>   writel(reg->inten_rise_mask, data->base + reg->tmu_intclear);
>   } else {
>   /* Write temperature code for rising and falling threshold */
> - for (i = 0;
> - i < trigger_levs && i < EXYNOS_MAX_TRIGGER_PER_REG; i++) {
> + for (i = 0; i < pdata->non_hw_trigger_levels; i++) {
>   threshold_code = temp_to_code(data,
>   pdata->trigger_levels[i]);
>   rising_threshold |= threshold_code << 8 * i;
> diff --git a/drivers/thermal/samsung/exynos_tmu.h
> b/drivers/thermal/samsung/exynos_tmu.h
> index 186e39e..4845171 100644
> --- a/drivers/thermal/samsung/exynos_tmu.h
> +++ b/drivers/thermal/samsung/exynos_tmu.h
> @@ -183,6 +183,7 @@ struct exynos_tmu_registers {
>   *   1 = enable trigger_level[] interrupt,
>   *   0 = disable trigger_level[] interrupt
>   * @max_trigger_level: max trigger level supported by the TMU
> + * @non_hw_trigger_levels: number of defined non-hardware trigger levels
>   * @gain: gain of amplifier in the positive-TC generator block
>   *   0 <= gain <= 15
>   * @reference_voltage: reference voltage of amplifier
> @@ -213,6 +214,7 @@ struct exynos_tmu_platform_data {
>   enum trigger_type trigger_type[MAX_TRIP_COUNT];
>   bool trigger_enable[MAX_TRIP_COUNT];
>   u8 max_trigger_level;
> + u8 non_hw_trigger_levels;
>   u8 gain;
>   u8 reference_voltage;
>   u8 noise_cancel_mode;
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.c
> b/drivers/thermal/samsung/exynos_tmu_data.c
> index c32d186..ef7f186 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.c
> +++ b/drivers/thermal/samsung/exynos_tmu_data.c
> @@ -62,6 +62,7 @@ struct exynos_tmu_init_data const
> exynos4210_default_tmu_data = {
>   .trigger_type[1] = THROTTLE_ACTIVE,
>   .trigger_type[2] = SW_TRIP,
>   .max_trigger_level = 4,
> + .non_hw_trigger_levels = 3,
>   .gain = 15,
>   .reference_voltage = 7,
>   .min_efuse_value = 40,
> @@ -135,6 +136,7 @@ static const struct exynos_tmu_registers
> exynos4412_tmu_registers = {
>   .trigger_type[2] = SW_TRIP, \
>   .trigger_type[3] = HW_TRIP, \
>   .max_trigger_level = 4, \
> + .non_hw_trigger_levels = 3, \
>   .gain = 8, \
>   .reference_voltage = 16, \
>   .noise_cancel_mode = 4, \
> @@ -225,6 +227,7 @@ static const struct exynos_tmu_registers
> exynos5440_tmu_registers = {
>   .trigger_type[0] = SW_TRIP, \
>   .trigger_type[4] = HW_TRIP, \
>   .max_trigger_level = 5, \
> + .non_hw_trigger_levels = 1,

Re: [PATCH v5 4/7] Input: pixcir_i2c_ts: Use Type-B Multi-Touch protocol

2014-05-18 Thread Dmitry Torokhov
On Tue, May 06, 2014 at 02:06:09PM +0300, Roger Quadros wrote:
> Switch to using the Type-B Multi-Touch protocol.
> 

Henrik, any chance you could take a look at MT-B support?

> Signed-off-by: Roger Quadros 
> ---
>  drivers/input/touchscreen/pixcir_i2c_ts.c | 125 
> ++
>  1 file changed, 94 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c 
> b/drivers/input/touchscreen/pixcir_i2c_ts.c
> index 8a7da61..1b6e4e5 100644
> --- a/drivers/input/touchscreen/pixcir_i2c_ts.c
> +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
> @@ -23,9 +23,12 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> +#define PIXCIR_MAX_SLOTS   2
> +
>  struct pixcir_i2c_ts_data {
>   struct i2c_client *client;
>   struct input_dev *input;
> @@ -33,12 +36,25 @@ struct pixcir_i2c_ts_data {
>   bool running;
>  };
>  
> -static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data *data)
> +struct pixcir_touch {
> + int x;
> + int y;
> +};
> +
> +struct pixcir_report_data {
> + int num_touches;
> + struct pixcir_touch touches[PIXCIR_MAX_SLOTS];
> +};
> +
> +static void pixcir_ts_parse(struct pixcir_i2c_ts_data *tsdata,
> + struct pixcir_report_data *report)
>  {
> - struct pixcir_i2c_ts_data *tsdata = data;
>   u8 rdbuf[10], wrbuf[1] = { 0 };
> + u8 *bufptr;
>   u8 touch;
> - int ret;
> + int ret, i;
> +
> + memset(report, 0, sizeof(struct pixcir_report_data));
>  
>   ret = i2c_master_send(tsdata->client, wrbuf, sizeof(wrbuf));
>   if (ret != sizeof(wrbuf)) {
> @@ -56,45 +72,85 @@ static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data 
> *data)
>   return;
>   }
>  
> - touch = rdbuf[0];
> - if (touch) {
> - u16 posx1 = (rdbuf[3] << 8) | rdbuf[2];
> - u16 posy1 = (rdbuf[5] << 8) | rdbuf[4];
> - u16 posx2 = (rdbuf[7] << 8) | rdbuf[6];
> - u16 posy2 = (rdbuf[9] << 8) | rdbuf[8];
> -
> - input_report_key(tsdata->input, BTN_TOUCH, 1);
> - input_report_abs(tsdata->input, ABS_X, posx1);
> - input_report_abs(tsdata->input, ABS_Y, posy1);
> -
> - input_report_abs(tsdata->input, ABS_MT_POSITION_X, posx1);
> - input_report_abs(tsdata->input, ABS_MT_POSITION_Y, posy1);
> - input_mt_sync(tsdata->input);
> -
> - if (touch == 2) {
> - input_report_abs(tsdata->input,
> -  ABS_MT_POSITION_X, posx2);
> - input_report_abs(tsdata->input,
> -  ABS_MT_POSITION_Y, posy2);
> - input_mt_sync(tsdata->input);
> - }
> - } else {
> - input_report_key(tsdata->input, BTN_TOUCH, 0);
> + touch = rdbuf[0] & 0x7;
> + if (touch > PIXCIR_MAX_SLOTS)
> + touch = PIXCIR_MAX_SLOTS;
> +
> + report->num_touches = touch;
> + bufptr = &rdbuf[2];
> +
> + for (i = 0; i < touch; i++) {
> + report->touches[i].x = (bufptr[1] << 8) | bufptr[0];
> + report->touches[i].y = (bufptr[3] << 8) | bufptr[2];
> +
> + bufptr = &bufptr[4];
>   }
> +}
> +
> +static void pixcir_ts_report(struct pixcir_i2c_ts_data *ts,
> +  struct pixcir_report_data *report)
> +{
> + struct input_mt_pos pos[PIXCIR_MAX_SLOTS];
> + int slots[PIXCIR_MAX_SLOTS];
> + struct pixcir_touch *touch;
> + int n, i, slot;
> + struct device *dev = &ts->client->dev;
>  
> - input_sync(tsdata->input);
> + n = report->num_touches;
> + if (n > PIXCIR_MAX_SLOTS)
> + n = PIXCIR_MAX_SLOTS;
> +
> + for (i = 0; i < n; i++) {
> + touch = &report->touches[i];
> + pos[i].x = touch->x;
> + pos[i].y = touch->y;
> + }
> +
> + input_mt_assign_slots(ts->input, slots, pos, n);
> +
> + for (i = 0; i < n; i++) {
> + touch = &report->touches[i];
> + slot = slots[i];
> +
> + input_mt_slot(ts->input, slot);
> + input_mt_report_slot_state(ts->input,
> +MT_TOOL_FINGER, true);
> +
> + input_event(ts->input, EV_ABS, ABS_MT_POSITION_X, touch->x);
> + input_event(ts->input, EV_ABS, ABS_MT_POSITION_Y, touch->y);
> +
> + dev_dbg(dev, "%d: slot %d, x %d, y %d\n",
> + i, slot, touch->x, touch->y);
> + }
> +
> + input_mt_sync_frame(ts->input);
> + input_sync(ts->input);
>  }
>  
>  static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
>  {
>   struct pixcir_i2c_ts_data *tsdata = dev_id;
>   const struct pixcir_ts_platform_data *pdata = tsdata->chip;
> + struct pixcir_report_data report;
>  
>   while (tsdata->running) {
> - pixcir_ts_poscheck(tsdata);
> -
> - if (gpio_get_value(pdat

Re: [PATCH v5 1/7] Input: pixcir_i2c_ts: Use devres managed resource allocations

2014-05-18 Thread Dmitry Torokhov
On Tue, May 06, 2014 at 02:06:06PM +0300, Roger Quadros wrote:
> Use devm_() and friends for allocating memory, input device
> and IRQ.
> 
> Signed-off-by: Roger Quadros 
> Acked-by: Mugunthan V N 

Applied, thank you.

> ---
>  drivers/input/touchscreen/pixcir_i2c_ts.c | 38 
> ---
>  1 file changed, 15 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c 
> b/drivers/input/touchscreen/pixcir_i2c_ts.c
> index 02392d2..8a083bd 100644
> --- a/drivers/input/touchscreen/pixcir_i2c_ts.c
> +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
> @@ -130,6 +130,7 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
>  {
>   const struct pixcir_ts_platform_data *pdata =
>   dev_get_platdata(&client->dev);
> + struct device *dev = &client->dev;
>   struct pixcir_i2c_ts_data *tsdata;
>   struct input_dev *input;
>   int error;
> @@ -139,12 +140,14 @@ static int pixcir_i2c_ts_probe(struct i2c_client 
> *client,
>   return -EINVAL;
>   }
>  
> - tsdata = kzalloc(sizeof(*tsdata), GFP_KERNEL);
> - input = input_allocate_device();
> - if (!tsdata || !input) {
> - dev_err(&client->dev, "Failed to allocate driver data!\n");
> - error = -ENOMEM;
> - goto err_free_mem;
> + tsdata = devm_kzalloc(dev, sizeof(*tsdata), GFP_KERNEL);
> + if (!tsdata)
> + return -ENOMEM;
> +
> + input = devm_input_allocate_device(dev);
> + if (!input) {
> + dev_err(&client->dev, "Failed to allocate input device\n");
> + return -ENOMEM;
>   }
>  
>   tsdata->client = client;
> @@ -165,29 +168,22 @@ static int pixcir_i2c_ts_probe(struct i2c_client 
> *client,
>  
>   input_set_drvdata(input, tsdata);
>  
> - error = request_threaded_irq(client->irq, NULL, pixcir_ts_isr,
> -  IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> -  client->name, tsdata);
> + error = devm_request_threaded_irq(dev, client->irq, NULL, pixcir_ts_isr,
> +   IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> +   client->name, tsdata);
>   if (error) {
> - dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
> - goto err_free_mem;
> + dev_err(dev, "failed to request irq %d\n", client->irq);
> + return error;
>   }
>  
>   error = input_register_device(input);
>   if (error)
> - goto err_free_irq;
> + return error;
>  
>   i2c_set_clientdata(client, tsdata);
>   device_init_wakeup(&client->dev, 1);
>  
>   return 0;
> -
> -err_free_irq:
> - free_irq(client->irq, tsdata);
> -err_free_mem:
> - input_free_device(input);
> - kfree(tsdata);
> - return error;
>  }
>  
>  static int pixcir_i2c_ts_remove(struct i2c_client *client)
> @@ -198,10 +194,6 @@ static int pixcir_i2c_ts_remove(struct i2c_client 
> *client)
>  
>   tsdata->exiting = true;
>   mb();
> - free_irq(client->irq, tsdata);
> -
> - input_unregister_device(tsdata->input);
> - kfree(tsdata);
>  
>   return 0;
>  }
> -- 
> 1.8.3.2
> 

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 2/7] Input: pixcir_i2c_ts - initialize interrupt mode and power mode

2014-05-18 Thread Dmitry Torokhov
On Tue, May 06, 2014 at 02:06:07PM +0300, Roger Quadros wrote:
> Introduce helper functions to configure power and interrupt registers.
> Default to IDLE mode on probe as device supports auto wakeup to ACVIE mode
> on detecting finger touch.
> 
> Configure interrupt mode and polarity on start up.  Power down on device
> closure or module removal.
> 
> Signed-off-by: Roger Quadros 
> Acked-by: Mugunthan V N 
> Signed-off-by: Dmitry Torokhov 

Applied, thank you.

> ---
>  drivers/input/touchscreen/pixcir_i2c_ts.c | 182 
> --
>  include/linux/input/pixcir_ts.h   |  42 +++
>  2 files changed, 216 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c 
> b/drivers/input/touchscreen/pixcir_i2c_ts.c
> index 8a083bd..96a1b1e 100644
> --- a/drivers/input/touchscreen/pixcir_i2c_ts.c
> +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
> @@ -29,7 +29,7 @@ struct pixcir_i2c_ts_data {
>   struct i2c_client *client;
>   struct input_dev *input;
>   const struct pixcir_ts_platform_data *chip;
> - bool exiting;
> + bool running;
>  };
>  
>  static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data *data)
> @@ -88,7 +88,7 @@ static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
>  {
>   struct pixcir_i2c_ts_data *tsdata = dev_id;
>  
> - while (!tsdata->exiting) {
> + while (tsdata->running) {
>   pixcir_ts_poscheck(tsdata);
>  
>   if (tsdata->chip->attb_read_val())
> @@ -100,6 +100,164 @@ static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
>   return IRQ_HANDLED;
>  }
>  
> +static int pixcir_set_power_mode(struct pixcir_i2c_ts_data *ts,
> +  enum pixcir_power_mode mode)
> +{
> + struct device *dev = &ts->client->dev;
> + int ret;
> +
> + ret = i2c_smbus_read_byte_data(ts->client, PIXCIR_REG_POWER_MODE);
> + if (ret < 0) {
> + dev_err(dev, "%s: can't read reg 0x%x : %d\n",
> + __func__, PIXCIR_REG_POWER_MODE, ret);
> + return ret;
> + }
> +
> + ret &= ~PIXCIR_POWER_MODE_MASK;
> + ret |= mode;
> +
> + /* Always AUTO_IDLE */
> + ret |= PIXCIR_POWER_ALLOW_IDLE;
> +
> + ret = i2c_smbus_write_byte_data(ts->client, PIXCIR_REG_POWER_MODE, ret);
> + if (ret < 0) {
> + dev_err(dev, "%s: can't write reg 0x%x : %d\n",
> + __func__, PIXCIR_REG_POWER_MODE, ret);
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +/*
> + * Set the interrupt mode for the device i.e. ATTB line behaviour
> + *
> + * @polarity : 1 for active high, 0 for active low.
> + */
> +static int pixcir_set_int_mode(struct pixcir_i2c_ts_data *ts,
> +enum pixcir_int_mode mode, bool polarity)
> +{
> + struct device *dev = &ts->client->dev;
> + int ret;
> +
> + ret = i2c_smbus_read_byte_data(ts->client, PIXCIR_REG_INT_MODE);
> + if (ret < 0) {
> + dev_err(dev, "%s: can't read reg 0x%x : %d\n",
> + __func__, PIXCIR_REG_INT_MODE, ret);
> + return ret;
> + }
> +
> + ret &= ~PIXCIR_INT_MODE_MASK;
> + ret |= mode;
> +
> + if (polarity)
> + ret |= PIXCIR_INT_POL_HIGH;
> + else
> + ret &= ~PIXCIR_INT_POL_HIGH;
> +
> + ret = i2c_smbus_write_byte_data(ts->client, PIXCIR_REG_INT_MODE, ret);
> + if (ret < 0) {
> + dev_err(dev, "%s: can't write reg 0x%x : %d\n",
> + __func__, PIXCIR_REG_INT_MODE, ret);
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +/*
> + * Enable/disable interrupt generation
> + */
> +static int pixcir_int_enable(struct pixcir_i2c_ts_data *ts, bool enable)
> +{
> + struct device *dev = &ts->client->dev;
> + int ret;
> +
> + ret = i2c_smbus_read_byte_data(ts->client, PIXCIR_REG_INT_MODE);
> + if (ret < 0) {
> + dev_err(dev, "%s: can't read reg 0x%x : %d\n",
> + __func__, PIXCIR_REG_INT_MODE, ret);
> + return ret;
> + }
> +
> + if (enable)
> + ret |= PIXCIR_INT_ENABLE;
> + else
> + ret &= ~PIXCIR_INT_ENABLE;
> +
> + ret = i2c_smbus_write_byte_data(ts->client, PIXCIR_REG_INT_MODE, ret);
> + if (ret < 0) {
> + dev_err(dev, "%s: can't write reg 0x%x : %d\n",
> + __func__, PIXCIR_REG_INT_MODE, ret);
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static int pixcir_start(struct pixcir_i2c_ts_data *ts)
> +{
> + struct device *dev = &ts->client->dev;
> + int error;
> +
> + /* LEVEL_TOUCH interrupt with active low polarity */
> + error = pixcir_set_int_mode(ts, PIXCIR_INT_LEVEL_TOUCH, 0);
> + if (error) {
> + dev_err(dev, "Failed to set interrupt mode: %d\n", error);
> + return error;
> + }
> +
> + ts->running = true;
> + mb();   /* Update status before IRQ can fire 

Re: [PATCH 07/10] thermal: exynos: simplify temp_to_code() and code_to_temp()

2014-05-18 Thread Amit Kachhap
On 5/5/14, Bartlomiej Zolnierkiewicz  wrote:
> * Remove dead temp check from temp_to_code() (this function users
>   in exynos_tmu_initialize() always pass correct temperatures and
>   exynos_tmu_set_emulation() returns early for EXYNOS4210 because
>   TMU_SUPPORT_EMULATION flag is not set on this SoC).
>
> * Move temp_code check from code_to_temp() to exynos_tmu_read()
>   (code_to_temp() only user).
>
> There should be no functional changes caused by this patch.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz 

Changes looks fine.
Reviewed-by: Amit Daniel Kachhap

> ---
>  drivers/thermal/samsung/exynos_tmu.c | 38
> +++-
>  1 file changed, 11 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> b/drivers/thermal/samsung/exynos_tmu.c
> index a415829..20379eb 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -71,19 +71,7 @@ struct exynos_tmu_data {
>   */
>  static int temp_to_code(struct exynos_tmu_data *data, u8 temp)
>  {
> - struct exynos_tmu_platform_data *pdata = data->pdata;
> - int temp_code;
> -
> - if (data->soc == SOC_ARCH_EXYNOS4210)
> - /* temp should range between 25 and 125 */
> - if (temp < 25 || temp > 125) {
> - temp_code = -EINVAL;
> - goto out;
> - }
> -
> - temp_code = temp + data->temp_error - pdata->first_point_trim;
> -out:
> - return temp_code;
> + return temp + data->temp_error - data->pdata->first_point_trim;
>  }
>
>  /*
> @@ -92,19 +80,7 @@ out:
>   */
>  static int code_to_temp(struct exynos_tmu_data *data, u8 temp_code)
>  {
> - struct exynos_tmu_platform_data *pdata = data->pdata;
> - int temp;
> -
> - if (data->soc == SOC_ARCH_EXYNOS4210)
> - /* temp_code should range between 75 and 175 */
> - if (temp_code < 75 || temp_code > 175) {
> - temp = -ENODATA;
> - goto out;
> - }
> -
> - temp = temp_code - data->temp_error + pdata->first_point_trim;
> -out:
> - return temp;
> + return temp_code - data->temp_error + data->pdata->first_point_trim;
>  }
>
>  static int exynos_tmu_initialize(struct platform_device *pdev)
> @@ -297,8 +273,16 @@ static int exynos_tmu_read(struct exynos_tmu_data
> *data)
>   clk_enable(data->clk);
>
>   temp_code = readb(data->base + reg->tmu_cur_temp);
> - temp = code_to_temp(data, temp_code);
>
> + if (data->soc == SOC_ARCH_EXYNOS4210)
> + /* temp_code should range between 75 and 175 */
> + if (temp_code < 75 || temp_code > 175) {
> + temp = -ENODATA;
> + goto out;
> + }
> +
> + temp = code_to_temp(data, temp_code);
> +out:
>   clk_disable(data->clk);
>   mutex_unlock(&data->lock);
>
> --
> 1.8.2.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc"
> in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 7/7] Input: pixcir_i2c_ts: Add device tree support

2014-05-18 Thread Dmitry Torokhov
On Tue, May 06, 2014 at 02:06:12PM +0300, Roger Quadros wrote:
> Provide device tree support and binding information.
> Also provide support for a new chip "pixcir_tangoc".
> 
> Signed-off-by: Roger Quadros 
> ---
>  .../bindings/input/touchscreen/pixcir_i2c_ts.txt   | 26 
>  .../devicetree/bindings/vendor-prefixes.txt|  1 +
>  drivers/input/touchscreen/pixcir_i2c_ts.c  | 78 
> ++
>  3 files changed, 105 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
> 
> diff --git 
> a/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt 
> b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
> new file mode 100644
> index 000..0ab9505
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/touchscreen/pixcir_i2c_ts.txt
> @@ -0,0 +1,26 @@
> +* Pixcir I2C touchscreen controllers
> +
> +Required properties:
> +- compatible: must be "pixcir,pixcir_ts" or "pixcir,pixcir_tangoc"
> +- reg: I2C address of the chip
> +- interrupts: interrupt to which the chip is connected
> +- attb-gpio: GPIO connected to the ATTB line of the chip
> +- x-size: horizontal resolution of touchscreen
> +- y-size: vertical resolution of touchscreen

There is a patch by Sebastian Reichel trying to unify touchscreen OF
properties, I think it would be nice if we used the same properties
here.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] pwm: i.MX: Avoid sample FIFO overflow for i.MX PWM version2

2014-05-18 Thread Lothar Waßmann
Hi,

Liu Ying wrote:
[...]
> @@ -30,6 +32,7 @@
>  /* i.MX27, i.MX31, i.MX35 share the same PWM function block: */
>  
>  #define MX3_PWMCR 0x00/* PWM Control Register */
> +#define MX3_PWMIR 0x08/* PWM Interrupt Register */
>  #define MX3_PWMSAR0x0C/* PWM Sample Register */
>  #define MX3_PWMPR 0x10/* PWM Period Register */
>  #define MX3_PWMCR_PRESCALER(x)(((x - 1) & 0xFFF) << 4)
> @@ -38,7 +41,12 @@
>  #define MX3_PWMCR_DBGEN  (1 << 22)
>  #define MX3_PWMCR_CLKSRC_IPG_HIGH (2 << 16)
>  #define MX3_PWMCR_CLKSRC_IPG  (1 << 16)
> +#define MX3_PWMCR_SWR  (1 << 3)
>  #define MX3_PWMCR_EN  (1 << 0)
> +#define MX3_PWMSR_ROV (1 << 4)
> +#define MX3_PWMIR_RIE (1 << 1)
> +
You should decide whether to use tabs or spaces for indentation.
And probably cleanup the indentation of the existing definitions to use
all the same indentation style.

> @@ -128,6 +160,13 @@ static int imx_pwm_config_v2(struct pwm_chip *chip,
>   else
>   period_cycles = 0;
>  
> + if (!enable || duty_cycles == 0)
> + imx_pwm_software_reset_v2(chip);
> + else if (readl(imx->mmio_base + MX3_PWMSAR))
> + /* No rollover irq generated if duty peroid is zero. */
typo: 'period'.

> @@ -135,27 +174,55 @@ static int imx_pwm_config_v2(struct pwm_chip *chip,
>   MX3_PWMCR_DOZEEN | MX3_PWMCR_WAITEN |
>   MX3_PWMCR_DBGEN | MX3_PWMCR_CLKSRC_IPG_HIGH;
>  
> - if (test_bit(PWMF_ENABLED, &pwm->flags))
> + if (enable)
>   cr |= MX3_PWMCR_EN;
>  
>   writel(cr, imx->mmio_base + MX3_PWMCR);
>  
> + if (enable && duty_cycles)
> + /* No rollover irq generated if duty peroid is zero. */
dto.


Lothar Waßmann
-- 
___

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

www.karo-electronics.de | i...@karo-electronics.de
___
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH] CMA: drivers/base/Kconfig: restrict CMA size to non-zero value

2014-05-18 Thread Joonsoo Kim
On Mon, May 19, 2014 at 10:47:12AM +0900, Gioh Kim wrote:
> Thank you for your advice. I didn't notice it.
> 
> I'm adding followings according to your advice:
> 
> - range restrict for CMA_SIZE_MBYTES and *CMA_SIZE_PERCENTAGE*
> I think this can prevent the wrong kernel option.
> 
> - change size_cmdline into default value SZ_16M
> I am not sure this can prevent if cma=0 cmdline option is also with base and 
> limit options.

Hello,

I think that this problem is originated from atomic_pool_init().
If configured coherent_pool size is larger than default cma size,
it can be failed even if this patch is applied.

How about below patch?
It uses fallback allocation if CMA is failed.

Thanks.

-8<-
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 6b00be1..2909ab9 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -379,7 +379,7 @@ static int __init atomic_pool_init(void)
unsigned long *bitmap;
struct page *page;
struct page **pages;
-   void *ptr;
+   void *ptr = NULL;
int bitmap_size = BITS_TO_LONGS(nr_pages) * sizeof(long);
 
bitmap = kzalloc(bitmap_size, GFP_KERNEL);
@@ -393,7 +393,7 @@ static int __init atomic_pool_init(void)
if (IS_ENABLED(CONFIG_DMA_CMA))
ptr = __alloc_from_contiguous(NULL, pool->size, prot, &page,
  atomic_pool_init);
-   else
+   if (!ptr)
ptr = __alloc_remap_buffer(NULL, pool->size, gfp, prot, &page,
   atomic_pool_init);
if (ptr) {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 06/10] thermal: exynos: remove redundant threshold_code checks from exynos_tmu_initialize()

2014-05-18 Thread Amit Kachhap
On 5/5/14, Bartlomiej Zolnierkiewicz  wrote:
> Remove runtime checks for negative return values of temp_to_code()
> from exynos_tmu_initialize().  The current level temperature data
> hardcoded in pdata will never cause a negative temp_to_code()
> return values and for the new code potential mistakes should be
> caught during development/review phases.
Your arguments looks fine.
>
> Theres should be no functional changes caused by this patch.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz 

> ---
>  drivers/thermal/samsung/exynos_tmu.c | 16 +---
>  1 file changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> b/drivers/thermal/samsung/exynos_tmu.c
> index 789d745..a415829 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -170,10 +170,6 @@ static int exynos_tmu_initialize(struct platform_device
> *pdev)
>   if (data->soc == SOC_ARCH_EXYNOS4210) {
>   /* Write temperature code for threshold */
>   threshold_code = temp_to_code(data, pdata->threshold);
> - if (threshold_code < 0) {
> - ret = threshold_code;
> - goto out;
> - }
>   writeb(threshold_code,
>   data->base + reg->threshold_temp);
>   for (i = 0; i < trigger_levs; i++)
> @@ -187,18 +183,12 @@ static int exynos_tmu_initialize(struct
> platform_device *pdev)
>   i < trigger_levs && i < EXYNOS_MAX_TRIGGER_PER_REG; i++) {
>   threshold_code = temp_to_code(data,
>   pdata->trigger_levels[i]);
> - if (threshold_code < 0) {
> - ret = threshold_code;
> - goto out;
> - }
>   rising_threshold |= threshold_code << 8 * i;
>   if (pdata->threshold_falling) {
>   threshold_code = temp_to_code(data,
>   pdata->trigger_levels[i] -
>   pdata->threshold_falling);
> - if (threshold_code > 0)
> - falling_threshold |=
> - threshold_code << 8 * i;
> + falling_threshold |= threshold_code << 8 * i;
>   }
>   }
>
> @@ -217,10 +207,6 @@ static int exynos_tmu_initialize(struct platform_device
> *pdev)
>   (pdata->trigger_type[i] == HW_TRIP)) {
>   threshold_code = temp_to_code(data,
>   pdata->trigger_levels[i]);
> - if (threshold_code < 0) {
> - ret = threshold_code;
> - goto out;
> - }
>   if (i == EXYNOS_MAX_TRIGGER_PER_REG - 1) {
>   /* 1-4 level to be assigned in th0 reg */
>   rising_threshold |= threshold_code << 8 * i;
> --
> 1.8.2.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 05/10] thermal: exynos: remove redundant pdata checks from exynos_tmu_initialize()

2014-05-18 Thread Amit Kachhap
On 5/15/14, Bartlomiej Zolnierkiewicz  wrote:
> On Thursday, May 15, 2014 10:47:40 AM Eduardo Valentin wrote:
>> Hello Bartlomiej,
>
> Hi,
>
>> On Mon, May 05, 2014 at 01:15:34PM +0200, Bartlomiej Zolnierkiewicz
>> wrote:
>> > Remove runtime checks for pdata sanity from exynos_tmu_initialize().
>> > The current values hardcoded in pdata will never trigger the checks
>> > and for the new code potential mistakes should be caught during
>> > development/review phases.
>> >
>> > There should be no functional changes caused by this patch.
>> >
>> > Signed-off-by: Bartlomiej Zolnierkiewicz 
>> > ---
>> >  drivers/thermal/samsung/exynos_thermal_common.h |  1 -
>> >  drivers/thermal/samsung/exynos_tmu.c| 13 -
>> >  2 files changed, 14 deletions(-)
>> >
>> > diff --git a/drivers/thermal/samsung/exynos_thermal_common.h
>> > b/drivers/thermal/samsung/exynos_thermal_common.h
>> > index 3eb2ed9..cd44719 100644
>> > --- a/drivers/thermal/samsung/exynos_thermal_common.h
>> > +++ b/drivers/thermal/samsung/exynos_thermal_common.h
>> > @@ -27,7 +27,6 @@
>> >  #define SENSOR_NAME_LEN   16
>> >  #define MAX_TRIP_COUNT8
>> >  #define MAX_COOLING_DEVICE 4
>> > -#define MAX_THRESHOLD_LEVS 5
>> >
>> >  #define ACTIVE_INTERVAL 500
>> >  #define IDLE_INTERVAL 1
>> > diff --git a/drivers/thermal/samsung/exynos_tmu.c
>> > b/drivers/thermal/samsung/exynos_tmu.c
>> > index 903566f..789d745 100644
>> > --- a/drivers/thermal/samsung/exynos_tmu.c
>> > +++ b/drivers/thermal/samsung/exynos_tmu.c
>> > @@ -158,23 +158,10 @@ static int exynos_tmu_initialize(struct
>> > platform_device *pdev)
>> >data->temp_error > pdata->max_efuse_value)
>> >data->temp_error = pdata->efuse_value & EXYNOS_TMU_TEMP_MASK;
>> >
>> > -  if (pdata->max_trigger_level > MAX_THRESHOLD_LEVS) {
>> > -  dev_err(&pdev->dev, "Invalid max trigger level\n");
>> > -  ret = -EINVAL;
>> > -  goto out;
>> > -  }
>> > -
>> >for (i = 0; i < pdata->max_trigger_level; i++) {
>> >if (!pdata->trigger_levels[i])
>> >continue;
>> >
>> > -  if ((pdata->trigger_type[i] == HW_TRIP) &&
>> > -  (!pdata->trigger_levels[pdata->max_trigger_level - 1])) {
>> > -  dev_err(&pdev->dev, "Invalid hw trigger level\n");
>> > -  ret = -EINVAL;
>> > -  goto out;
>> > -  }
>> > -
>>
>> Does it mean no new pdata are going to be written? i.e., no new soc is
>> going to be supported by this driver that needs proper pdata checking?
>
> This is not a proper checking.  The checks in question are done at runtime
> in a production code for data that is hardcoded inside driver during
> development time and later it doesn't change.  Such data should be verified
> during development and review time (i.e. by a script parsing relevant data
> from exynos_tmu_data.c, one can also argue that verification to be done is
> so simple that the review by a maintainer should be enough).
Agreed to your arguments. These changes looks fine.
>
>> >/* Count trigger levels except the HW trip*/
>> >if (!(pdata->trigger_type[i] == HW_TRIP))
>> >trigger_levs++;
>
> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R&D Institute Poland
> Samsung Electronics
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc"
> in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] x86 fixes for 3.15-rc6

2014-05-18 Thread H. Peter Anvin
Hi Linus,

The following changes since commit d6d211db37e75de2ddc3a4f979038c40df7cc79c:

  Linux 3.15-rc5 (2014-05-09 13:10:52 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-for-linus

for you to fetch changes up to fa81511bb0bbb2b1aace3695ce869da9762624ff:

  x86-64, modify_ldt: Make support for 16-bit segments a runtime option 
(2014-05-14 16:33:54 -0700)


Anthony Iliopoulos (1):
  x86, mm, hugetlb: Add missing TLB page invalidation for hugetlb_cow()

H. Peter Anvin (1):
  x86, rdrand: When nordrand is specified, disable RDSEED as well

Linus Torvalds (1):
  x86-64, modify_ldt: Make support for 16-bit segments a runtime option

 Documentation/kernel-parameters.txt | 8 
 arch/x86/include/asm/hugetlb.h  | 1 +
 arch/x86/kernel/cpu/rdrand.c| 1 +
 arch/x86/kernel/ldt.c   | 4 +++-
 arch/x86/vdso/vdso32-setup.c| 8 
 5 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
index 43842177b771..30a8ad0dae53 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2218,10 +2218,10 @@ bytes respectively. Such letter suffixes can also be 
entirely omitted.
noreplace-smp   [X86-32,SMP] Don't replace SMP instructions
with UP alternatives
 
-   nordrand[X86] Disable the direct use of the RDRAND
-   instruction even if it is supported by the
-   processor.  RDRAND is still available to user
-   space applications.
+   nordrand[X86] Disable kernel use of the RDRAND and
+   RDSEED instructions even if they are supported
+   by the processor.  RDRAND and RDSEED are still
+   available to user space applications.
 
noresume[SWSUSP] Disables resume and restores original swap
space.
diff --git a/arch/x86/include/asm/hugetlb.h b/arch/x86/include/asm/hugetlb.h
index a8091216963b..68c05398bba9 100644
--- a/arch/x86/include/asm/hugetlb.h
+++ b/arch/x86/include/asm/hugetlb.h
@@ -52,6 +52,7 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct 
*mm,
 static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
 unsigned long addr, pte_t *ptep)
 {
+   ptep_clear_flush(vma, addr, ptep);
 }
 
 static inline int huge_pte_none(pte_t pte)
diff --git a/arch/x86/kernel/cpu/rdrand.c b/arch/x86/kernel/cpu/rdrand.c
index 384df5105fbc..136ac74dee82 100644
--- a/arch/x86/kernel/cpu/rdrand.c
+++ b/arch/x86/kernel/cpu/rdrand.c
@@ -27,6 +27,7 @@
 static int __init x86_rdrand_setup(char *s)
 {
setup_clear_cpu_cap(X86_FEATURE_RDRAND);
+   setup_clear_cpu_cap(X86_FEATURE_RDSEED);
return 1;
 }
 __setup("nordrand", x86_rdrand_setup);
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
index af1d14a9ebda..dcbbaa165bde 100644
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -20,6 +20,8 @@
 #include 
 #include 
 
+int sysctl_ldt16 = 0;
+
 #ifdef CONFIG_SMP
 static void flush_ldt(void *current_mm)
 {
@@ -234,7 +236,7 @@ static int write_ldt(void __user *ptr, unsigned long 
bytecount, int oldmode)
 * IRET leaking the high bits of the kernel stack address.
 */
 #ifdef CONFIG_X86_64
-   if (!ldt_info.seg_32bit) {
+   if (!ldt_info.seg_32bit && !sysctl_ldt16) {
error = -EINVAL;
goto out_unlock;
}
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 00348980a3a6..e1f220e3ca68 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -39,6 +39,7 @@
 #ifdef CONFIG_X86_64
 #define vdso_enabled   sysctl_vsyscall32
 #define arch_setup_additional_pagessyscall32_setup_pages
+extern int sysctl_ldt16;
 #endif
 
 /*
@@ -249,6 +250,13 @@ static struct ctl_table abi_table2[] = {
.mode   = 0644,
.proc_handler   = proc_dointvec
},
+   {
+   .procname   = "ldt16",
+   .data   = &sysctl_ldt16,
+   .maxlen = sizeof(int),
+   .mode   = 0644,
+   .proc_handler   = proc_dointvec
+   },
{}
 };
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 04/10] thermal: exynos: remove dead code for TYPE_TWO_POINT_TRIMMING calibration

2014-05-18 Thread Amit Kachhap
On 5/5/14, Bartlomiej Zolnierkiewicz  wrote:
> Only TYPE_ONE_POINT_TRIMMING calibration is used so remove
> the dead code for TYPE_TWO_POINT_TRIMMING calibration.
I prefer to retain this feature as it is provided by the TMU
controller. This will avoid unnecessary churning of code when some new
soc wants to use it. 2 point trimming should ideally give best
compensated thermal values.
>
> There should be no functional changes caused by this patch.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz 
> ---
>  drivers/thermal/samsung/exynos_tmu.c  | 55
> ++-
>  drivers/thermal/samsung/exynos_tmu.h  | 20 +--
>  drivers/thermal/samsung/exynos_tmu_data.c | 17 +-
>  drivers/thermal/samsung/exynos_tmu_data.h |  2 --
>  4 files changed, 12 insertions(+), 82 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> b/drivers/thermal/samsung/exynos_tmu.c
> index 9f2a5ee..903566f 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -47,8 +47,7 @@
>   * @irq_work: pointer to the irq work structure.
>   * @lock: lock to implement synchronization.
>   * @clk: pointer to the clock structure.
> - * @temp_error1: fused value of the first point trim.
> - * @temp_error2: fused value of the second point trim.
> + * @temp_error: fused value of the first point trim.
>   * @regulator: pointer to the TMU regulator structure.
>   * @reg_conf: pointer to structure to register with core thermal.
>   */
> @@ -62,14 +61,13 @@ struct exynos_tmu_data {
>   struct work_struct irq_work;
>   struct mutex lock;
>   struct clk *clk;
> - u8 temp_error1, temp_error2;
> + u8 temp_error;
>   struct regulator *regulator;
>   struct thermal_sensor_conf *reg_conf;
>  };
>
>  /*
>   * TMU treats temperature as a mapped temperature code.
> - * The temperature is converted differently depending on the calibration
> type.
>   */
>  static int temp_to_code(struct exynos_tmu_data *data, u8 temp)
>  {
> @@ -83,20 +81,7 @@ static int temp_to_code(struct exynos_tmu_data *data, u8
> temp)
>   goto out;
>   }
>
> - switch (pdata->cal_type) {
> - case TYPE_TWO_POINT_TRIMMING:
> - temp_code = (temp - pdata->first_point_trim) *
> - (data->temp_error2 - data->temp_error1) /
> - (pdata->second_point_trim - pdata->first_point_trim) +
> - data->temp_error1;
> - break;
> - case TYPE_ONE_POINT_TRIMMING:
> - temp_code = temp + data->temp_error1 - pdata->first_point_trim;
> - break;
> - default:
> - temp_code = temp + pdata->default_temp_offset;
> - break;
> - }
> + temp_code = temp + data->temp_error - pdata->first_point_trim;
>  out:
>   return temp_code;
>  }
> @@ -117,20 +102,7 @@ static int code_to_temp(struct exynos_tmu_data *data,
> u8 temp_code)
>   goto out;
>   }
>
> - switch (pdata->cal_type) {
> - case TYPE_TWO_POINT_TRIMMING:
> - temp = (temp_code - data->temp_error1) *
> - (pdata->second_point_trim - pdata->first_point_trim) /
> - (data->temp_error2 - data->temp_error1) +
> - pdata->first_point_trim;
> - break;
> - case TYPE_ONE_POINT_TRIMMING:
> - temp = temp_code - data->temp_error1 + pdata->first_point_trim;
> - break;
> - default:
> - temp = temp_code - pdata->default_temp_offset;
> - break;
> - }
> + temp = temp_code - data->temp_error + pdata->first_point_trim;
>  out:
>   return temp;
>  }
> @@ -179,19 +151,12 @@ static int exynos_tmu_initialize(struct
> platform_device *pdev)
>   } else {
>   trim_info = readl(data->base + reg->triminfo_data);
>   }
> - data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK;
> - data->temp_error2 = ((trim_info >> reg->triminfo_85_shift) &
> - EXYNOS_TMU_TEMP_MASK);
> -
> - if (!data->temp_error1 ||
> - (pdata->min_efuse_value > data->temp_error1) ||
> - (data->temp_error1 > pdata->max_efuse_value))
> - data->temp_error1 = pdata->efuse_value & EXYNOS_TMU_TEMP_MASK;
> -
> - if (!data->temp_error2)
> - data->temp_error2 =
> - (pdata->efuse_value >> reg->triminfo_85_shift) &
> - EXYNOS_TMU_TEMP_MASK;
> + data->temp_error = trim_info & EXYNOS_TMU_TEMP_MASK;
> +
> + if (!data->temp_error ||
> + pdata->min_efuse_value > data->temp_error ||
> + data->temp_error > pdata->max_efuse_value)
> + data->temp_error = pdata->efuse_value & EXYNOS_TMU_TEMP_MASK;
>
>   if (pdata->max_trigger_level > MAX_THRESHOLD_LEVS) {
>   dev_err(&pdev->dev, "Invalid max trigger level\n");
> diff --git a/drivers/thermal/samsung/exynos_tmu.h
> b/

Re: [PATCH] Fix for possible null pointer dereference in dma.c

2014-05-18 Thread Lothar Waßmann
Hi,

Rickard Strandqvist wrote:
> There is otherwise a risk of a possible null pointer dereference.
> 
> Was largely found by using a static code analysis program called cppcheck.
> 
> Signed-off-by: Rickard Strandqvist 
> ---
>  sound/soc/samsung/dma.c |   10 ++
>  1 fil ändrad, 6 tillägg(+), 4 borttagningar(-)
> 
> diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
> index dc09b71..b1f6757 100644
> --- a/sound/soc/samsung/dma.c
> +++ b/sound/soc/samsung/dma.c
> @@ -115,17 +115,19 @@ static void dma_enqueue(struct snd_pcm_substream 
> *substream)
>  static void audio_buffdone(void *data)
>  {
>   struct snd_pcm_substream *substream = data;
> - struct runtime_data *prtd = substream->runtime->private_data;
> + struct runtime_data *prtd = NULL;
>  
>   pr_debug("Entered %s\n", __func__);
>  
> - if (prtd->state & ST_RUNNING) {
> + if(substream)
>
Missing space.


Lothar Waßmann
-- 
___

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

www.karo-electronics.de | i...@karo-electronics.de
___
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 0/6] add cpuidle support for Exynos5420

2014-05-18 Thread Chander Kashyap
Hi Daniel/Kgene,

On 16 May 2014 13:33, Chander Kashyap  wrote:
> Exynos5420 is a big-little Soc from Samsung. It has 4 A15 and 4 A7 cores.
>
> This patchset adds cpuidle support for Exynos5420 SoC based on
> generic big.little cpuidle driver.
>
> Tested on SMDK5420.
>
> This patch set depends on:
> 1. [PATCH 0/5] MCPM backend for Exynos5420
>http://www.spinics.net/lists/arm-kernel/msg331100.html
> Changelog is in respective patches.
> Chander Kashyap (5):
>   driver: cpuidle-big-little: add of_device_id structure
>   arm: exynos: add generic function to calculate cpu number
>   cpuidle: config: Add ARCH_EXYNOS entry to select cpuidle-big-little
> driver
>   driver: cpuidle: cpuidle-big-little: init driver for Exynos5420
>   exynos: cpuidle: do not allow cpuidle registration for Exynos5420
>   mcpm: exynos: populate suspend and powered_up callbacks
>
>  arch/arm/mach-exynos/exynos.c|4 +++-
>  arch/arm/mach-exynos/mcpm-exynos.c   |   36 
> ++
>  arch/arm/mach-exynos/regs-pmu.h  |9 +
>  drivers/cpuidle/Kconfig.arm  |2 +-
>  drivers/cpuidle/cpuidle-big_little.c |   12 +++-
>  5 files changed, 60 insertions(+), 3 deletions(-)
>
> --
> 1.7.9.5
>

As dependency patches are merged. If their are no further comment, can
these patches be taken?

-- 
with warm regards,
Chander Kashyap
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv3 1/5] Input: add common DT binding for touchscreens

2014-05-18 Thread Dmitry Torokhov
On Tue, May 06, 2014 at 01:04:12AM +0200, Sebastian Reichel wrote:
> On Mon, May 05, 2014 at 12:51:39PM -0700, Dmitry Torokhov wrote:
> > On Mon, May 05, 2014 at 12:41:26PM -0700, Tony Lindgren wrote:
> > > * Sebastian Reichel  [140425 16:56]:
> > > > Add common DT binding documentation for touchscreen devices and
> > > > implement input_parse_touchscreen_of_params, which parses the common
> > > > properties and configures the input device accordingly.
> > > > 
> > > > The method currently does not interpret the axis inversion properties,
> > > > since there is no matching flag in the generic linux input device.
> > > > 
> > > > Signed-off-by: Sebastian Reichel 
> > > > ---
> > > >  .../bindings/input/touchscreen/touchscreen.txt | 27 
> > > > +
> > > >  drivers/input/input.c  | 34 
> > > > ++
> > > >  include/linux/input.h  |  8 +
> > > >  3 files changed, 69 insertions(+)
> > > >  create mode 100644 
> > > > Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > > 
> > > > diff --git 
> > > > a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt 
> > > > b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > > new file mode 100644
> > > > index 000..d8e0616
> > > > --- /dev/null
> > > > +++ 
> > > > b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
> > > > @@ -0,0 +1,27 @@
> > > > +General Touchscreen Properties:
> > > > +
> > > > +Optional properties for Touchscreens:
> > > > + - touchscreen-size-x  : horizontal resolution of touchscreen
> > > > + (in pixels)
> > > > + - touchscreen-size-y  : vertical resolution of touchscreen
> > > > + (in pixels)
> > > > + - touchscreen-max-pressure: maximum reported pressure (arbitrary 
> > > > range
> > > > + dependent on the controller)
> > > > + - touchscreen-fuzz-x  : horizontal noise value of the 
> > > > absolute input
> > > > + device (in pixels)
> > > > + - touchscreen-fuzz-y  : vertical noise value of the absolute 
> > > > input
> > > > + device (in pixels)
> > > > + - touchscreen-fuzz-pressure   : pressure noise value of the absolute 
> > > > input
> > > > + device (arbitrary range dependent on 
> > > > the
> > > > + controller)
> > 
> > Fuzz seems like linux-specific property, not generic one.
> 
> I don't know about the term "fuzz", but the idea is pretty generic
> IMHO. It's similar to debouncing switches/buttons.

OK, fair enough.

> 
> > > > + - touchscreen-inverted-x  : X axis is inverted (boolean)
> > > > + - touchscreen-inverted-y  : Y axis is inverted (boolean)
> > > 
> > > We probably also need something to swap x and y depending on the
> > > display orientation in addition to the touchscreen-inverted-x and y.
> > > Just swapping x and y is not enough depending if we rotate by 270
> > > degrees instead of 90 degrees.
> > > 
> > > Naturally that part can be added later.
> > 
> > So far we've been relying on upper layers (such as tslib) to perform
> > such transformations rather than re-implementing it in every driver. Are
> > we saying that we need to implement this in input core?
> 
> I would appreciate to add this later to move on with this patchset.
> Having the N900's touchscreen working via DT in 3.16 would be nice
> now that the display is working :)
> 

Please remove the "inverted" bits and move touchscreen OF parsing into a
separate file/module, similarly to support for sparse and matrix keymaps
that we have - it does not really belong to input core.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] sched/rt: don't try to balance rt_runtime when it is futile

2014-05-18 Thread Paul E. McKenney
On Mon, May 19, 2014 at 04:44:41AM +0200, Mike Galbraith wrote:
> On Sun, 2014-05-18 at 08:58 -0700, Paul E. McKenney wrote: 
> > On Sun, May 18, 2014 at 10:36:41AM +0200, Mike Galbraith wrote:
> > > On Sat, 2014-05-17 at 22:20 -0700, Paul E. McKenney wrote:
> > > 
> > > > If you are saying that turning on nohz_full doesn't help unless you
> > > > also ensure that there is only one runnable task per CPU, I completely
> > > > agree.  If you are saying something else, you lost me.  ;-)
> > > 
> > > Yup, that's it more or less.  It's not only single task loads that could
> > > benefit from better isolation, but if isolation improving measures are
> > > tied to nohz_full, other sensitive loads will suffer if they try to use
> > > isolation improvements.
> > 
> > So you are arguing for a separate Kconfig variable that does the isolation?
> > So that NO_HZ_FULL selects this new variable, and (for example) RCU
> > uses this new variable to decide when to pin the grace-period kthreads
> > onto the housekeeping CPU?
> 
> I'm thinking more about runtime, but yes.
> 
> The tick mode really wants to be selectable per set (in my boxen you can
> switch between nohz off/idle, but not yet nohz_full, that might get real
> interesting).  You saw in my numbers that ticked is far better for the
> threaded rt load, but what if the total load has both sensitive rt and
> compute components to worry about?  The rt component wants relief from
> the jitter that flipping the tick inflicts, but also wants as little
> disturbance as possible, so RCU offload and whatever other measures that
> are or become available are perhaps interesting to it as well.  The
> numbers showed that here and now the two modes can work together in the
> same box, I can have my rt set ticking away, and other cores doing
> tickless compute, but enabling that via common config (distros don't
> want to ship many kernel flavors) has a cost to rt performance.
> 
> Ideally, bean counting would be switchable too, giving all components
> the environment they like best.

Sounds like a question for Frederic (now CCed).  ;-)

Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv3 2/5] Input: tsc2005: use dev_err for error messages

2014-05-18 Thread Dmitry Torokhov
On Sat, Apr 26, 2014 at 01:56:16AM +0200, Sebastian Reichel wrote:
> Change some dev_dbg() invocations to dev_err() ones, because they
> are supposed to output error messages.
> 
> Signed-off-by: Sebastian Reichel 

Applied, thank you.

> ---
>  drivers/input/touchscreen/tsc2005.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/tsc2005.c 
> b/drivers/input/touchscreen/tsc2005.c
> index 550adcb..520e673 100644
> --- a/drivers/input/touchscreen/tsc2005.c
> +++ b/drivers/input/touchscreen/tsc2005.c
> @@ -579,7 +579,7 @@ static int tsc2005_probe(struct spi_device *spi)
>   int error;
>  
>   if (!pdata) {
> - dev_dbg(&spi->dev, "no platform data\n");
> + dev_err(&spi->dev, "no platform data\n");
>   return -ENODEV;
>   }
>  
> @@ -591,7 +591,7 @@ static int tsc2005_probe(struct spi_device *spi)
>   max_p   = pdata->ts_pressure_max   ? : MAX_12BIT;
>  
>   if (spi->irq <= 0) {
> - dev_dbg(&spi->dev, "no irq\n");
> + dev_err(&spi->dev, "no irq\n");
>   return -ENODEV;
>   }
>  
> -- 
> 1.9.2
> 

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv3 3/5] Input: tsc2005: convert driver to use devm_*

2014-05-18 Thread Dmitry Torokhov
On Sat, Apr 26, 2014 at 01:56:17AM +0200, Sebastian Reichel wrote:
> Simplify the driver by using managed resources for memory allocation of
> internal struct, input device allocation and irq request.
> 
> Signed-off-by: Sebastian Reichel 

Applied, thank you.

> ---
>  drivers/input/touchscreen/tsc2005.c | 30 ++
>  1 file changed, 10 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/tsc2005.c 
> b/drivers/input/touchscreen/tsc2005.c
> index 520e673..9daaddd 100644
> --- a/drivers/input/touchscreen/tsc2005.c
> +++ b/drivers/input/touchscreen/tsc2005.c
> @@ -604,12 +604,10 @@ static int tsc2005_probe(struct spi_device *spi)
>   if (error)
>   return error;
>  
> - ts = kzalloc(sizeof(*ts), GFP_KERNEL);
> - input_dev = input_allocate_device();
> - if (!ts || !input_dev) {
> - error = -ENOMEM;
> - goto err_free_mem;
> - }
> + ts = devm_kzalloc(&spi->dev, sizeof(*ts), GFP_KERNEL);
> + input_dev = devm_input_allocate_device(&spi->dev);
> + if (!ts || !input_dev)
> + return -ENOMEM;
>  
>   ts->spi = spi;
>   ts->idev = input_dev;
> @@ -649,12 +647,13 @@ static int tsc2005_probe(struct spi_device *spi)
>   /* Ensure the touchscreen is off */
>   tsc2005_stop_scan(ts);
>  
> - error = request_threaded_irq(spi->irq, NULL, tsc2005_irq_thread,
> -  IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> -  "tsc2005", ts);
> + error = devm_request_threaded_irq(&spi->dev, spi->irq, NULL,
> +   tsc2005_irq_thread,
> +   IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> +   "tsc2005", ts);
>   if (error) {
>   dev_err(&spi->dev, "Failed to request irq, err: %d\n", error);
> - goto err_free_mem;
> + return error;
>   }
>  
>   spi_set_drvdata(spi, ts);
> @@ -662,7 +661,7 @@ static int tsc2005_probe(struct spi_device *spi)
>   if (error) {
>   dev_err(&spi->dev,
>   "Failed to create sysfs attributes, err: %d\n", error);
> - goto err_clear_drvdata;
> + return error;
>   }
>  
>   error = input_register_device(ts->idev);
> @@ -677,11 +676,6 @@ static int tsc2005_probe(struct spi_device *spi)
>  
>  err_remove_sysfs:
>   sysfs_remove_group(&spi->dev.kobj, &tsc2005_attr_group);
> -err_clear_drvdata:
> - free_irq(spi->irq, ts);
> -err_free_mem:
> - input_free_device(input_dev);
> - kfree(ts);
>   return error;
>  }
>  
> @@ -691,10 +685,6 @@ static int tsc2005_remove(struct spi_device *spi)
>  
>   sysfs_remove_group(&ts->spi->dev.kobj, &tsc2005_attr_group);
>  
> - free_irq(ts->spi->irq, ts);
> - input_unregister_device(ts->idev);
> - kfree(ts);
> -
>   return 0;
>  }
>  
> -- 
> 1.9.2
> 

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 03/10] thermal: exynos: remove dead code for HW_MODE calibration

2014-05-18 Thread Amit Kachhap
Hi Bartlomiej,

On 5/5/14, Bartlomiej Zolnierkiewicz  wrote:
> There should be no functional changes caused by this patch.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz 
> ---
>  drivers/thermal/samsung/exynos_tmu.c  | 33
> +--
>  drivers/thermal/samsung/exynos_tmu.h  | 13 
>  drivers/thermal/samsung/exynos_tmu_data.c |  3 ---
>  drivers/thermal/samsung/exynos_tmu_data.h |  2 --
>  4 files changed, 1 insertion(+), 50 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> b/drivers/thermal/samsung/exynos_tmu.c
> index 0d96a51..9f2a5ee 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -76,9 +76,6 @@ static int temp_to_code(struct exynos_tmu_data *data, u8
> temp)
>   struct exynos_tmu_platform_data *pdata = data->pdata;
>   int temp_code;
>
> - if (pdata->cal_mode == HW_MODE)
> - return temp;
> -
I suggest to retain the hw mode generic feature as it is provided by
the TMU controller.  However below unused defines for 5440 might be
removed as the h/w mode relevant values were wrongly fused.
>   if (data->soc == SOC_ARCH_EXYNOS4210)
>   /* temp should range between 25 and 125 */
>   if (temp < 25 || temp > 125) {
> @@ -113,9 +110,6 @@ static int code_to_temp(struct exynos_tmu_data *data, u8
> temp_code)
>   struct exynos_tmu_platform_data *pdata = data->pdata;
>   int temp;
>
> - if (pdata->cal_mode == HW_MODE)
> - return temp_code;
> -
>   if (data->soc == SOC_ARCH_EXYNOS4210)
>   /* temp_code should range between 75 and 175 */
>   if (temp_code < 75 || temp_code > 175) {
> @@ -164,9 +158,6 @@ static int exynos_tmu_initialize(struct platform_device
> *pdev)
>   if (TMU_SUPPORTS(pdata, TRIM_RELOAD))
>   __raw_writel(1, data->base + reg->triminfo_ctrl);
>
> - if (pdata->cal_mode == HW_MODE)
> - goto skip_calib_data;
> -
>   /* Save trimming info in order to perform calibration */
>   if (data->soc == SOC_ARCH_EXYNOS5440) {
>   /*
> @@ -202,7 +193,6 @@ static int exynos_tmu_initialize(struct platform_device
> *pdev)
>   (pdata->efuse_value >> reg->triminfo_85_shift) &
>   EXYNOS_TMU_TEMP_MASK;
>
> -skip_calib_data:
>   if (pdata->max_trigger_level > MAX_THRESHOLD_LEVS) {
>   dev_err(&pdev->dev, "Invalid max trigger level\n");
>   ret = -EINVAL;
> @@ -311,7 +301,7 @@ static void exynos_tmu_control(struct platform_device
> *pdev, bool on)
>   struct exynos_tmu_data *data = platform_get_drvdata(pdev);
>   struct exynos_tmu_platform_data *pdata = data->pdata;
>   const struct exynos_tmu_registers *reg = pdata->registers;
> - unsigned int con, interrupt_en, cal_val;
> + unsigned int con, interrupt_en;
>
>   mutex_lock(&data->lock);
>   clk_enable(data->clk);
> @@ -337,27 +327,6 @@ static void exynos_tmu_control(struct platform_device
> *pdev, bool on)
>   con |= (pdata->noise_cancel_mode << reg->therm_trip_mode_shift);
>   }
>
> - if (pdata->cal_mode == HW_MODE) {
> - con &= ~(reg->calib_mode_mask << reg->calib_mode_shift);
> - cal_val = 0;
> - switch (pdata->cal_type) {
> - case TYPE_TWO_POINT_TRIMMING:
> - cal_val = 3;
> - break;
> - case TYPE_ONE_POINT_TRIMMING_85:
> - cal_val = 2;
> - break;
> - case TYPE_ONE_POINT_TRIMMING_25:
> - cal_val = 1;
> - break;
> - case TYPE_NONE:
> - break;
> - default:
> - dev_err(&pdev->dev, "Invalid calibration type, using 
> none\n");
> - }
> - con |= cal_val << reg->calib_mode_shift;
> - }
> -
>   if (on) {
>   con |= (1 << reg->core_en_shift);
>   interrupt_en =
> diff --git a/drivers/thermal/samsung/exynos_tmu.h
> b/drivers/thermal/samsung/exynos_tmu.h
> index 80dc899..e417af8 100644
> --- a/drivers/thermal/samsung/exynos_tmu.h
> +++ b/drivers/thermal/samsung/exynos_tmu.h
> @@ -34,11 +34,6 @@ enum calibration_type {
>   TYPE_NONE,
>  };
>
> -enum calibration_mode {
> - SW_MODE,
> - HW_MODE,
> -};
> -
>  enum soc_type {
>   SOC_ARCH_EXYNOS4210 = 1,
>   SOC_ARCH_EXYNOS4412,
> @@ -92,10 +87,6 @@ enum soc_type {
>   * @buf_slope_sel_shift: shift bits of amplifier gain value in tmu_ctrl
>   register.
>   * @buf_slope_sel_mask: mask bits of amplifier gain value in tmu_ctrl
> register.
> - * @calib_mode_shift: shift bits of calibration mode value in tmu_ctrl
> - register.
> - * @calib_mode_mask: mask bits of calibration mode value in tmu_ctrl
> - register.
>   * @core_en_shift: shift bits of TMU core enable bit in tmu_ctrl register.
>   * @tmu_status: register drescribi

[PATCH] cpufreq: cpufreq-cpu0: remove dependency on thermal

2014-05-18 Thread Viresh Kumar
cpufreq-cpu0 uses thermal framework to register a cooling device, but doesn't
depend on it as there are dummy calls provided by thermal layer when
CONFIG_THERMAL=n. So, we don't really need to mention thermal as a dependency
for cpufreq-cpu0 in Kconfig.

Remove it.

Signed-off-by: Viresh Kumar 
---
 drivers/cpufreq/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index 1fbe11f..4310997 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -185,7 +185,7 @@ config CPU_FREQ_GOV_CONSERVATIVE
 
 config GENERIC_CPUFREQ_CPU0
tristate "Generic CPU0 cpufreq driver"
-   depends on HAVE_CLK && REGULATOR && OF && THERMAL && CPU_THERMAL
+   depends on HAVE_CLK && REGULATOR && OF
select PM_OPP
help
  This adds a generic cpufreq driver for CPU0 frequency management.
-- 
2.0.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 02/10] thermal: exynos: remove unused defines

2014-05-18 Thread Amit Kachhap
Hi Bartlomiej,

On 5/5/14, Bartlomiej Zolnierkiewicz  wrote:
> There should be no functional changes caused by this patch.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz 
> ---
>  drivers/thermal/samsung/exynos_tmu_data.h | 27 +--
>  1 file changed, 1 insertion(+), 26 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu_data.h
> b/drivers/thermal/samsung/exynos_tmu_data.h
> index 06c4345..d4eeddb 100644
> --- a/drivers/thermal/samsung/exynos_tmu_data.h
> +++ b/drivers/thermal/samsung/exynos_tmu_data.h
> @@ -42,20 +42,8 @@
>  /* Exynos4210 specific registers */
>  #define EXYNOS4210_TMU_REG_THRESHOLD_TEMP0x44
>  #define EXYNOS4210_TMU_REG_TRIG_LEVEL0   0x50
> -#define EXYNOS4210_TMU_REG_TRIG_LEVEL1   0x54
> -#define EXYNOS4210_TMU_REG_TRIG_LEVEL2   0x58
> -#define EXYNOS4210_TMU_REG_TRIG_LEVEL3   0x5C
> -#define EXYNOS4210_TMU_REG_PAST_TEMP00x60
> -#define EXYNOS4210_TMU_REG_PAST_TEMP10x64
> -#define EXYNOS4210_TMU_REG_PAST_TEMP20x68
> -#define EXYNOS4210_TMU_REG_PAST_TEMP30x6C
> -
This removal looks fine as 4210 is an old soc.
> -#define EXYNOS4210_TMU_TRIG_LEVEL0_MASK  0x1
> -#define EXYNOS4210_TMU_TRIG_LEVEL1_MASK  0x10
> -#define EXYNOS4210_TMU_TRIG_LEVEL2_MASK  0x100
> -#define EXYNOS4210_TMU_TRIG_LEVEL3_MASK  0x1000
> +
>  #define EXYNOS4210_TMU_TRIG_LEVEL_MASK   0x
> -#define EXYNOS4210_TMU_INTCLEAR_VAL  0x
>
>  /* Exynos5250 and Exynos4412 specific registers */
>  #define EXYNOS_TMU_TRIMINFO_CON  0x14
> @@ -69,8 +57,6 @@
>  #define EXYNOS_TMU_RISE_INT_SHIFT0
>  #define EXYNOS_TMU_FALL_INT_MASK 0x111
>  #define EXYNOS_TMU_FALL_INT_SHIFT12
> -#define EXYNOS_TMU_CLEAR_RISE_INT0x111
> -#define EXYNOS_TMU_CLEAR_FALL_INT(0x111 << 12)
>  #define EXYNOS_TMU_TRIP_MODE_SHIFT   13
>  #define EXYNOS_TMU_TRIP_MODE_MASK0x7
>  #define EXYNOS_TMU_THERM_TRIP_EN_SHIFT   12
> @@ -82,8 +68,6 @@
>  #define EXYNOS_TMU_INTEN_RISE2_SHIFT 8
>  #define EXYNOS_TMU_INTEN_RISE3_SHIFT 12
>  #define EXYNOS_TMU_INTEN_FALL0_SHIFT 16
> -#define EXYNOS_TMU_INTEN_FALL1_SHIFT 20
> -#define EXYNOS_TMU_INTEN_FALL2_SHIFT 24
I suggest to retain this generic soc macros as they might be used in future.
>
>  #define EXYNOS_EMUL_TIME 0x57F0
>  #define EXYNOS_EMUL_TIME_MASK0x
> @@ -107,13 +91,11 @@
>  #define EXYNOS5440_TMU_S0_7_TH0  0x110
>  #define EXYNOS5440_TMU_S0_7_TH1  0x130
>  #define EXYNOS5440_TMU_S0_7_TH2  0x150
> -#define EXYNOS5440_TMU_S0_7_EVTEN0x1F0
>  #define EXYNOS5440_TMU_S0_7_IRQEN0x210
>  #define EXYNOS5440_TMU_S0_7_IRQ  0x230
>  /* exynos5440 common registers */
>  #define EXYNOS5440_TMU_IRQ_STATUS0x000
>  #define EXYNOS5440_TMU_PMIN  0x004
> -#define EXYNOS5440_TMU_TEMP  0x008
>
>  #define EXYNOS5440_TMU_RISE_INT_MASK 0xf
>  #define EXYNOS5440_TMU_RISE_INT_SHIFT0
> @@ -124,13 +106,6 @@
>  #define EXYNOS5440_TMU_INTEN_RISE2_SHIFT 2
>  #define EXYNOS5440_TMU_INTEN_RISE3_SHIFT 3
>  #define EXYNOS5440_TMU_INTEN_FALL0_SHIFT 4
> -#define EXYNOS5440_TMU_INTEN_FALL1_SHIFT 5
> -#define EXYNOS5440_TMU_INTEN_FALL2_SHIFT 6
> -#define EXYNOS5440_TMU_INTEN_FALL3_SHIFT 7
> -#define EXYNOS5440_TMU_TH_RISE0_SHIFT0
> -#define EXYNOS5440_TMU_TH_RISE1_SHIFT8
> -#define EXYNOS5440_TMU_TH_RISE2_SHIFT16
> -#define EXYNOS5440_TMU_TH_RISE3_SHIFT24
5440 is an old soc so can be removed.
>  #define EXYNOS5440_TMU_TH_RISE4_SHIFT24
>  #define EXYNOS5440_EFUSE_SWAP_OFFSET 8
>
> --
> 1.8.2.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/10] thermal: exynos: remove unused struct exynos_tmu_registers entries

2014-05-18 Thread Amit Kachhap
Hi Bartlomiej,

On 5/5/14, Bartlomiej Zolnierkiewicz  wrote:
> There should be no functional changes caused by this patch.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz 
> ---
>  drivers/thermal/samsung/exynos_tmu.h  | 40
> ---
>  drivers/thermal/samsung/exynos_tmu_data.c |  2 --
>  drivers/thermal/samsung/exynos_tmu_data.h |  1 -
>  3 files changed, 43 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.h
> b/drivers/thermal/samsung/exynos_tmu.h
> index 3fb6554..80dc899 100644
> --- a/drivers/thermal/samsung/exynos_tmu.h
> +++ b/drivers/thermal/samsung/exynos_tmu.h
> @@ -82,8 +82,6 @@ enum soc_type {
>   * @triminfo_25_shift: shift bit of the 25 C trim value in triminfo_data
> reg.
>   * @triminfo_85_shift: shift bit of the 85 C trim value in triminfo_data
> reg.
>   * @triminfo_ctrl: trim info controller register.
> - * @triminfo_reload_shift: shift of triminfo reload enable bit in
> triminfo_ctrl
> - reg.
>   * @tmu_ctrl: TMU main controller register.
>   * @test_mux_addr_shift: shift bits of test mux address.
>   * @buf_vref_sel_shift: shift bits of reference voltage in tmu_ctrl
> register.
> @@ -98,27 +96,13 @@ enum soc_type {
>   register.
>   * @calib_mode_mask: mask bits of calibration mode value in tmu_ctrl
>   register.
> - * @therm_trip_tq_en_shift: shift bits of thermal trip enable by TQ pin in
> - tmu_ctrl register.
>   * @core_en_shift: shift bits of TMU core enable bit in tmu_ctrl register.
>   * @tmu_status: register drescribing the TMU status.
>   * @tmu_cur_temp: register containing the current temperature of the TMU.
> - * @tmu_cur_temp_shift: shift bits of current temp value in tmu_cur_temp
> - register.
>   * @threshold_temp: register containing the base threshold level.
>   * @threshold_th0: Register containing first set of rising levels.
> - * @threshold_th0_l0_shift: shift bits of level0 threshold temperature.
> - * @threshold_th0_l1_shift: shift bits of level1 threshold temperature.
> - * @threshold_th0_l2_shift: shift bits of level2 threshold temperature.
> - * @threshold_th0_l3_shift: shift bits of level3 threshold temperature.
>   * @threshold_th1: Register containing second set of rising levels.
> - * @threshold_th1_l0_shift: shift bits of level0 threshold temperature.
> - * @threshold_th1_l1_shift: shift bits of level1 threshold temperature.
> - * @threshold_th1_l2_shift: shift bits of level2 threshold temperature.
> - * @threshold_th1_l3_shift: shift bits of level3 threshold temperature.
>   * @threshold_th2: Register containing third set of rising levels.
> - * @threshold_th2_l0_shift: shift bits of level0 threshold temperature.
> - * @threshold_th3: Register containing fourth set of rising levels.
>   * @threshold_th3_l0_shift: shift bits of level0 threshold temperature.
>   * @tmu_inten: register containing the different threshold interrupt
>   enable bits.
> @@ -131,15 +115,11 @@ enum soc_type {
>   * @inten_rise2_shift: shift bits of rising 2 interrupt bits.
>   * @inten_rise3_shift: shift bits of rising 3 interrupt bits.
>   * @inten_fall0_shift: shift bits of falling 0 interrupt bits.
> - * @inten_fall1_shift: shift bits of falling 1 interrupt bits.
> - * @inten_fall2_shift: shift bits of falling 2 interrupt bits.
> - * @inten_fall3_shift: shift bits of falling 3 interrupt bits.
>   * @tmu_intstat: Register containing the interrupt status values.
>   * @tmu_intclear: Register for clearing the raised interrupt status.
>   * @emul_con: TMU emulation controller register.
>   * @emul_temp_shift: shift bits of emulation temperature.
>   * @emul_time_shift: shift bits of emulation time.
> - * @emul_time_mask: mask bits of emulation time.
>   * @tmu_irqstatus: register to find which TMU generated interrupts.
>   * @tmu_pmin: register to get/set the Pmin value.

I prefer to have these register description as they describe the h/w
and are used for capturing those parameters. My argument here is that
adding new soc should have minimum changes. However some unused macros
removed below makes sense.
>   */
> @@ -149,7 +129,6 @@ struct exynos_tmu_registers {
>   u32 triminfo_85_shift;
>
>   u32 triminfo_ctrl;
> - u32 triminfo_reload_shift;
>
>   u32 tmu_ctrl;
>   u32 test_mux_addr_shift;
> @@ -162,32 +141,17 @@ struct exynos_tmu_registers {
>   u32 buf_slope_sel_mask;
>   u32 calib_mode_shift;
>   u32 calib_mode_mask;
> - u32 therm_trip_tq_en_shift;
>   u32 core_en_shift;
>
>   u32 tmu_status;
>
>   u32 tmu_cur_temp;
> - u32 tmu_cur_temp_shift;
>
>   u32 threshold_temp;
>
>   u32 threshold_th0;
> - u32 threshold_th0_l0_shift;
> - u32 threshold_th0_l1_shift;
> - u32 threshold_th0_l2_shift;
> - u32 threshold_th0_l3_shift;
> -
>   u32 threshold_th1;
> - u32 threshold_th1_l0_shift;
> - u32 threshold_th1_l1_shift;
> - u32 threshold_th1_l2_s

[PATCH 2/13 v2] [SCSI] qla2xxx: make return of 0 explicit

2014-05-18 Thread Julia Lawall
From: Julia Lawall 

Delete unnecessary use of a local variable to immediately return 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// 

Signed-off-by: Julia Lawall 

---
Changed subject line, which was not appreciated by some spam filters.

 drivers/scsi/qla2xxx/qla_init.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 38aeb54..a63f9b6 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4593,8 +4593,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
if (unlikely(pci_channel_offline(ha->pdev) &&
ha->flags.pci_channel_io_perm_failure)) {
clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
-   status = 0;
-   return status;
+   return 0;
}
 
ha->isp_ops->get_flash_version(vha, req->ring);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 2/3] CMA: aggressively allocate the pages on cma reserved memory when not used

2014-05-18 Thread Joonsoo Kim
On Mon, May 19, 2014 at 11:53:05AM +0900, Minchan Kim wrote:
> On Mon, May 19, 2014 at 11:11:21AM +0900, Joonsoo Kim wrote:
> > On Thu, May 15, 2014 at 11:43:53AM +0900, Minchan Kim wrote:
> > > On Thu, May 15, 2014 at 10:53:01AM +0900, Joonsoo Kim wrote:
> > > > On Tue, May 13, 2014 at 12:00:57PM +0900, Minchan Kim wrote:
> > > > > Hey Joonsoo,
> > > > > 
> > > > > On Thu, May 08, 2014 at 09:32:23AM +0900, Joonsoo Kim wrote:
> > > > > > CMA is introduced to provide physically contiguous pages at runtime.
> > > > > > For this purpose, it reserves memory at boot time. Although it 
> > > > > > reserve
> > > > > > memory, this reserved memory can be used for movable memory 
> > > > > > allocation
> > > > > > request. This usecase is beneficial to the system that needs this 
> > > > > > CMA
> > > > > > reserved memory infrequently and it is one of main purpose of
> > > > > > introducing CMA.
> > > > > > 
> > > > > > But, there is a problem in current implementation. The problem is 
> > > > > > that
> > > > > > it works like as just reserved memory approach. The pages on cma 
> > > > > > reserved
> > > > > > memory are hardly used for movable memory allocation. This is 
> > > > > > caused by
> > > > > > combination of allocation and reclaim policy.
> > > > > > 
> > > > > > The pages on cma reserved memory are allocated if there is no 
> > > > > > movable
> > > > > > memory, that is, as fallback allocation. So the time this fallback
> > > > > > allocation is started is under heavy memory pressure. Although it 
> > > > > > is under
> > > > > > memory pressure, movable allocation easily succeed, since there 
> > > > > > would be
> > > > > > many pages on cma reserved memory. But this is not the case for 
> > > > > > unmovable
> > > > > > and reclaimable allocation, because they can't use the pages on cma
> > > > > > reserved memory. These allocations regard system's free memory as
> > > > > > (free pages - free cma pages) on watermark checking, that is, free
> > > > > > unmovable pages + free reclaimable pages + free movable pages. 
> > > > > > Because
> > > > > > we already exhausted movable pages, only free pages we have are 
> > > > > > unmovable
> > > > > > and reclaimable types and this would be really small amount. So 
> > > > > > watermark
> > > > > > checking would be failed. It will wake up kswapd to make enough free
> > > > > > memory for unmovable and reclaimable allocation and kswapd will do.
> > > > > > So before we fully utilize pages on cma reserved memory, kswapd 
> > > > > > start to
> > > > > > reclaim memory and try to make free memory over the high watermark. 
> > > > > > This
> > > > > > watermark checking by kswapd doesn't take care free cma pages so 
> > > > > > many
> > > > > > movable pages would be reclaimed. After then, we have a lot of 
> > > > > > movable
> > > > > > pages again, so fallback allocation doesn't happen again. To 
> > > > > > conclude,
> > > > > > amount of free memory on meminfo which includes free CMA pages is 
> > > > > > moving
> > > > > > around 512 MB if I reserve 512 MB memory for CMA.
> > > > > > 
> > > > > > I found this problem on following experiment.
> > > > > > 
> > > > > > 4 CPUs, 1024 MB, VIRTUAL MACHINE
> > > > > > make -j24
> > > > > > 
> > > > > > CMA reserve:0 MB512 MB
> > > > > > Elapsed-time:   234.8   361.8
> > > > > > Average-MemFree:283880 KB   530851 KB
> > > > > > 
> > > > > > To solve this problem, I can think following 2 possible solutions.
> > > > > > 1. allocate the pages on cma reserved memory first, and if they are
> > > > > >exhausted, allocate movable pages.
> > > > > > 2. interleaved allocation: try to allocate specific amounts of 
> > > > > > memory
> > > > > >from cma reserved memory and then allocate from free movable 
> > > > > > memory.
> > > > > 
> > > > > I love this idea but when I see the code, I don't like that.
> > > > > In allocation path, just try to allocate pages by round-robin so it's 
> > > > > role
> > > > > of allocator. If one of migratetype is full, just pass mission to 
> > > > > reclaimer
> > > > > with hint(ie, Hey reclaimer, it's non-movable allocation fail
> > > > > so there is pointless if you reclaim MIGRATE_CMA pages) so that
> > > > > reclaimer can filter it out during page scanning.
> > > > > We already have an tool to achieve it(ie, isolate_mode_t).
> > > > 
> > > > Hello,
> > > > 
> > > > I agree with leaving fast allocation path as simple as possible.
> > > > I will remove runtime computation for determining ratio in
> > > > __rmqueue_cma() and, instead, will use pre-computed value calculated
> > > > on the other path.
> > > 
> > > Sounds good.
> > > 
> > > > 
> > > > I am not sure that whether your second suggestion(Hey relaimer part)
> > > > is good or not. In my quick thought, that could be helpful in the
> > > > situation that many free cma pages remained. But, it would be not 
> > > > helpful
> > > > when there are neither free movable 

[PATCH 4/13] wimax/i2400m: make return of 0 explicit

2014-05-18 Thread Julia Lawall
From: Julia Lawall 

Delete unnecessary local variable whose value is always 0 and that hides
the fact that the result is always 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// 

Signed-off-by: Julia Lawall 

---
Alternatively, is an error code wanted under the if?

 drivers/net/wimax/i2400m/driver.c |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wimax/i2400m/driver.c 
b/drivers/net/wimax/i2400m/driver.c
index 9c34d2f..901a534 100644
--- a/drivers/net/wimax/i2400m/driver.c
+++ b/drivers/net/wimax/i2400m/driver.c
@@ -500,26 +500,23 @@ int i2400m_pm_notifier(struct notifier_block *notifier,
  */
 int i2400m_pre_reset(struct i2400m *i2400m)
 {
-   int result;
struct device *dev = i2400m_dev(i2400m);
 
d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
d_printf(1, dev, "pre-reset shut down\n");
 
-   result = 0;
mutex_lock(&i2400m->init_mutex);
if (i2400m->updown) {
netif_tx_disable(i2400m->wimax_dev.net_dev);
__i2400m_dev_stop(i2400m);
-   result = 0;
/* down't set updown to zero -- this way
 * post_reset can restore properly */
}
mutex_unlock(&i2400m->init_mutex);
if (i2400m->bus_release)
i2400m->bus_release(i2400m);
-   d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result);
-   return result;
+   d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, 0);
+   return 0;
 }
 EXPORT_SYMBOL_GPL(i2400m_pre_reset);
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/13] usb: gadget: make return of 0 explicit

2014-05-18 Thread Julia Lawall
From: Julia Lawall 

Delete unnecessary local variable whose value is always 0 and that hides
the fact that the result is always 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// 

Signed-off-by: Julia Lawall 

---
 drivers/usb/gadget/composite.c |6 ++
 drivers/usb/gadget/dummy_hcd.c |4 +---
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 042c66b..f801519 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1312,9 +1312,7 @@ static void fill_ext_compat(struct usb_configuration *c, 
u8 *buf)
 static int count_ext_prop(struct usb_configuration *c, int interface)
 {
struct usb_function *f;
-   int j, res;
-
-   res = 0;
+   int j;
 
f = c->interface[interface];
for (j = 0; j < f->os_desc_n; ++j) {
@@ -1326,7 +1324,7 @@ static int count_ext_prop(struct usb_configuration *c, 
int interface)
if (d && d->ext_compat_id)
return d->ext_prop_count;
}
-   return res;
+   return 0;
 }
 
 static int len_ext_prop(struct usb_configuration *c, int interface)
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 8c06430..2b54955 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -561,7 +561,6 @@ static int dummy_disable(struct usb_ep *_ep)
struct dummy_ep *ep;
struct dummy*dum;
unsigned long   flags;
-   int retval;
 
ep = usb_ep_to_dummy_ep(_ep);
if (!_ep || !ep->desc || _ep->name == ep0name)
@@ -571,12 +570,11 @@ static int dummy_disable(struct usb_ep *_ep)
spin_lock_irqsave(&dum->lock, flags);
ep->desc = NULL;
ep->stream_en = 0;
-   retval = 0;
nuke(dum, ep);
spin_unlock_irqrestore(&dum->lock, flags);
 
dev_dbg(udc_dev(dum), "disabled %s\n", _ep->name);
-   return retval;
+   return 0;
 }
 
 static struct usb_request *dummy_alloc_request(struct usb_ep *_ep,

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/13] CLK: TI: DRA7: make return of 0 explicit

2014-05-18 Thread Julia Lawall
From: Julia Lawall 

Delete unnecessary local variable whose value is always 0 and that hides
the fact that the result is always 0.

Additionally dropped some unneeded braces in an affected if.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// 

Signed-off-by: Julia Lawall 

---
Alternatively, is an error code wanted in either of the MAX_APLL_WAIT_TRIES
cases?

 drivers/clk/ti/apll.c |   13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/ti/apll.c b/drivers/clk/ti/apll.c
index b986f61..659032a 100644
--- a/drivers/clk/ti/apll.c
+++ b/drivers/clk/ti/apll.c
@@ -37,7 +37,7 @@
 static int dra7_apll_enable(struct clk_hw *hw)
 {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
-   int r = 0, i = 0;
+   int i = 0;
struct dpll_data *ad;
const char *clk_name;
u8 state = 1;
@@ -55,7 +55,7 @@ static int dra7_apll_enable(struct clk_hw *hw)
v = ti_clk_ll_ops->clk_readl(ad->idlest_reg);
 
if ((v & ad->idlest_mask) == state)
-   return r;
+   return 0;
 
v = ti_clk_ll_ops->clk_readl(ad->control_reg);
v &= ~ad->enable_mask;
@@ -74,17 +74,14 @@ static int dra7_apll_enable(struct clk_hw *hw)
udelay(1);
}
 
-   if (i == MAX_APLL_WAIT_TRIES) {
+   if (i == MAX_APLL_WAIT_TRIES)
pr_warn("clock: %s failed transition to '%s'\n",
clk_name, (state) ? "locked" : "bypassed");
-   } else {
+   else
pr_debug("clock: %s transition to '%s' in %d loops\n",
 clk_name, (state) ? "locked" : "bypassed", i);
 
-   r = 0;
-   }
-
-   return r;
+   return 0;
 }
 
 static void dra7_apll_disable(struct clk_hw *hw)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/13] libertas: make return of 0 explicit

2014-05-18 Thread Julia Lawall
From: Julia Lawall 

Delete unnecessary local variable whose value is always 0 and that hides
the fact that the result is always 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// 

Signed-off-by: Julia Lawall 

---
Alternatively, was an error code intended in the bad length case, as is
done in process_brxed_802_11_packet?

 drivers/net/wireless/libertas/rx.c |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/libertas/rx.c 
b/drivers/net/wireless/libertas/rx.c
index c7366b0..807c5b8 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -55,7 +55,6 @@ static int process_rxed_802_11_packet(struct lbs_private 
*priv,
  */
 int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
 {
-   int ret = 0;
struct net_device *dev = priv->dev;
struct rxpackethdr *p_rx_pkt;
struct rxpd *p_rx_pd;
@@ -86,7 +85,6 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct 
sk_buff *skb)
if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
lbs_deb_rx("rx err: frame received with bad length\n");
dev->stats.rx_length_errors++;
-   ret = 0;
dev_kfree_skb(skb);
goto done;
}
@@ -154,10 +152,9 @@ int lbs_process_rxed_packet(struct lbs_private *priv, 
struct sk_buff *skb)
else
netif_rx_ni(skb);
 
-   ret = 0;
 done:
-   lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
-   return ret;
+   lbs_deb_leave_args(LBS_DEB_RX, "ret %d", 0);
+   return 0;
 }
 EXPORT_SYMBOL_GPL(lbs_process_rxed_packet);
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/13] [NETFILTER]: arp_tables: make return of 0 explicit

2014-05-18 Thread Julia Lawall
From: Julia Lawall 

Delete unnecessary local variable whose value is always 0 and that hides
the fact that the result is always 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// 

Signed-off-by: Julia Lawall 

---
 net/ipv4/netfilter/arp_tables.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index f95b6f9..89f6737 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -1289,9 +1289,8 @@ compat_copy_entry_from_user(struct compat_arpt_entry *e, 
void **dstptr,
struct xt_target *target;
struct arpt_entry *de;
unsigned int origsize;
-   int ret, h;
+   int h;
 
-   ret = 0;
origsize = *size;
de = (struct arpt_entry *)*dstptr;
memcpy(de, e, sizeof(struct arpt_entry));
@@ -1312,7 +1311,7 @@ compat_copy_entry_from_user(struct compat_arpt_entry *e, 
void **dstptr,
if ((unsigned char *)de - base < newinfo->underflow[h])
newinfo->underflow[h] -= origsize - *size;
}
-   return ret;
+   return 0;
 }
 
 static int translate_compat_table(const char *name,

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 7/13] staging: wlags49_h2: make return of 0 explicit

2014-05-18 Thread Julia Lawall
From: Julia Lawall 

Delete unnecessary local variable whose value is always 0 and that hides
the fact that the result is always 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// 

Signed-off-by: Julia Lawall 

---
I'm not sure to understand this code.  There seem to be two cases where
ret was undefined at the point of the return (on failure of the case 0
test and in the default case).

 drivers/staging/wlags49_h2/wl_wext.c |   11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wlags49_h2/wl_wext.c 
b/drivers/staging/wlags49_h2/wl_wext.c
index 49eeeae..3aeff81 100644
--- a/drivers/staging/wlags49_h2/wl_wext.c
+++ b/drivers/staging/wlags49_h2/wl_wext.c
@@ -159,15 +159,12 @@ static int hermes_set_tkip_keys(ltv_t *ltv, u16 key_idx, 
u8 *addr,
 /* Set up the LTV to clear the appropriate key */
 static int hermes_clear_tkip_keys(ltv_t *ltv, u16 key_idx, u8 *addr)
 {
-   int ret;
-
switch (key_idx) {
case 0:
if (!is_broadcast_ether_addr(addr)) {
ltv->len = 7;
ltv->typ = CFG_REMOVE_TKIP_MAPPED_KEY;
memcpy(u.u8[0], addr, ETH_ALEN);
-   ret = 0;
}
break;
case 1:
@@ -178,13 +175,12 @@ static int hermes_clear_tkip_keys(ltv_t *ltv, u16 
key_idx, u8 *addr)
ltv->typ = CFG_REMOVE_TKIP_DEFAULT_KEY;
ltv->u.u16[0] = cpu_to_le16(key_idx);
 
-   ret = 0;
break;
default:
break;
}
 
-   return ret;
+   return 0;
 }
 
 /* Set the WEP keys in the wl_private structure */
@@ -3027,13 +3023,10 @@ static int wireless_set_genie(struct net_device *dev,
  struct iw_point *data, char *extra)
 
 {
-   int   ret = 0;
-
/* We can't write this to the card, but apparently this
 * operation needs to succeed */
-   ret = 0;
 
-   return ret;
+   return 0;
 }
 
/**/
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 8/13] sound: mpu401.c: make return of 0 explicit

2014-05-18 Thread Julia Lawall
From: Julia Lawall 

Delete unnecessary local variable whose value is always 0 and that hides
the fact that the result is always 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// 

Signed-off-by: Julia Lawall 

---
 sound/oss/mpu401.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/oss/mpu401.c b/sound/oss/mpu401.c
index 25e4609..3bbc3ec 100644
--- a/sound/oss/mpu401.c
+++ b/sound/oss/mpu401.c
@@ -567,7 +567,6 @@ static int mpu401_out(int dev, unsigned char midi_byte)
 static int mpu401_command(int dev, mpu_command_rec * cmd)
 {
int i, timeout, ok;
-   int ret = 0;
unsigned long   flags;
struct mpu_config *devc;
 
@@ -644,7 +643,6 @@ retry:
}
}
}
-   ret = 0;
cmd->data[0] = 0;
 
if (cmd->nr_returns)
@@ -666,7 +664,7 @@ retry:
}
}
spin_unlock_irqrestore(&devc->lock,flags);
-   return ret;
+   return 0;
 }
 
 static int mpu_cmd(int dev, int cmd, int data)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/13] make return of 0 explicit

2014-05-18 Thread Julia Lawall
Sometimes a local variable is used as a return value in a case where the
return value is always 0.  The result is more apparent if this variable is
just replaced by 0.  This is done by the following semantic patch, although
some cleanups may be needed. (http://coccinelle.lip6.fr/)

// 
@r exists@
local idexpression ret;
identifier reti;
expression e;
position p;
@@

ret@reti = 0;
... when != \(ret = e\|ret &= e\|ret |= e\|ret += e\|ret -= e\|ret *= e\|ret ^= 
e\)
when != \(++ret\|--ret\|ret++\|ret--\)
when != &ret
return ret;@p

@bad1 exists@
expression e != 0;
local idexpression r.ret;
position r.p;
@@

 \(ret = e\|ret &= e\|ret |= e\|ret += e\|ret -= e\|ret *= e\|ret ^= 
e\|++ret\|--ret\|ret++\|ret--\|&ret\)
 ...
 return ret;@p

@bad2 exists@
identifier r.reti;
position r.p;
identifier f;
type T;
@@

f(...,T reti,...) {
 ...
 return reti;@p
}

@change depends on !bad1 && !bad2@
position r.p;
local idexpression r.ret;
identifier f;
@@

f(...) { <+...
return 
-ret
+0
;@p
...+> }

@rewrite@
local idexpression r.ret;
expression e;
position p;
identifier change.f;
@@

f(...) { <+...
 \(ret@p = e\|&ret@p\)
...+> }

@depends on change@
local idexpression r.ret;
position p != rewrite.p;
identifier change.f;
@@

f(...) { <+...
(
break;
|
ret = 0;
... when exists
ret@p
... when any
|
- ret = 0;
)
...+> }

@depends on change@
identifier r.reti;
type T;
constant C;
identifier change.f;
@@

f(...) { ... when any
-T reti = C;
 ... when != reti
 when strict
 }

@depends on change@
identifier r.reti;
type T;
identifier change.f;
@@

f(...) { ... when any
-T reti;
 ... when != reti
 when strict
 }
// 

The first four rules detect cases where only 0 reaches a return.  The
remaining rules clean up any variable initializations or declarations that
are made unnecessary by this change.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 10/13] staging: rtl8192e: make return of 0 explicit

2014-05-18 Thread Julia Lawall
From: Julia Lawall 

Delete unnecessary use of a local variable to immediately return 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// 

Signed-off-by: Julia Lawall 

---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c 
b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 356d521..2920e40 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1915,8 +1915,7 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb, struct 
net_device *dev)
memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev));
if (queue_index == TXCMD_QUEUE) {
rtl8192_tx_cmd(dev, skb);
-   ret = 0;
-   return ret;
+   return 0;
} else {
tcb_desc->RATRIndex = 7;
tcb_desc->bTxDisableRateFallBack = 1;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 9/13] md: make return of 0 explicit

2014-05-18 Thread Julia Lawall
From: Julia Lawall 

Delete unnecessary local variable whose value is always 0 and that hides
the fact that the result is always 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// 

Signed-off-by: Julia Lawall 

---
Alternatively, was an error code intended in the MD_MAX_BADBLOCKS case?

 drivers/md/md.c |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index f477e4c..23b7fee 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -8297,7 +8297,6 @@ static int md_clear_badblocks(struct badblocks *bb, 
sector_t s, int sectors)
u64 *p;
int lo, hi;
sector_t target = s + sectors;
-   int rv = 0;
 
if (bb->shift > 0) {
/* When clearing we round the start up and the end down.
@@ -8339,10 +8338,8 @@ static int md_clear_badblocks(struct badblocks *bb, 
sector_t s, int sectors)
 
if (a < s) {
/* we need to split this range */
-   if (bb->count >= MD_MAX_BADBLOCKS) {
-   rv = 0;
+   if (bb->count >= MD_MAX_BADBLOCKS)
goto out;
-   }
memmove(p+lo+1, p+lo, (bb->count - lo) * 8);
bb->count++;
p[lo] = BB_MAKE(a, s-a, ack);
@@ -8378,7 +8375,7 @@ static int md_clear_badblocks(struct badblocks *bb, 
sector_t s, int sectors)
bb->changed = 1;
 out:
write_sequnlock_irq(&bb->lock);
-   return rv;
+   return 0;
 }
 
 int rdev_clear_badblocks(struct md_rdev *rdev, sector_t s, int sectors,

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/13] ufs: make return of 0 explicit

2014-05-18 Thread Julia Lawall
From: Julia Lawall 

Delete unnecessary local variable whose value is always 0 and that hides
the fact that the result is always 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// 

Signed-off-by: Julia Lawall 

---
 fs/ufs/truncate.c |8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index f04f89f..a17f0a9 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -72,7 +72,6 @@ static int ufs_trunc_direct(struct inode *inode)
u64 frag1, frag2, frag3, frag4, block1, block2;
unsigned frag_to_free, free_count;
unsigned i, tmp;
-   int retry;

UFSD("ENTER: ino %lu\n", inode->i_ino);
 
@@ -81,7 +80,6 @@ static int ufs_trunc_direct(struct inode *inode)

frag_to_free = 0;
free_count = 0;
-   retry = 0;

frag1 = DIRECT_FRAGMENT;
frag4 = min_t(u64, UFS_NDIR_FRAGMENT, ufsi->i_lastfrag);
@@ -164,7 +162,7 @@ next1:
  next3:
 
UFSD("EXIT: ino %lu\n", inode->i_ino);
-   return retry;
+   return 0;
 }
 
 
@@ -176,7 +174,6 @@ static int ufs_trunc_indirect(struct inode *inode, u64 
offset, void *p)
void *ind;
u64 tmp, indirect_block, i, frag_to_free;
unsigned free_count;
-   int retry;
 
UFSD("ENTER: ino %lu, offset %llu, p: %p\n",
 inode->i_ino, (unsigned long long)offset, p);
@@ -188,7 +185,6 @@ static int ufs_trunc_indirect(struct inode *inode, u64 
offset, void *p)
 
frag_to_free = 0;
free_count = 0;
-   retry = 0;

tmp = ufs_data_ptr_to_cpu(sb, p);
if (!tmp)
@@ -248,7 +244,7 @@ static int ufs_trunc_indirect(struct inode *inode, u64 
offset, void *p)

UFSD("EXIT: ino %lu\n", inode->i_ino);

-   return retry;
+   return 0;
 }
 
 static int ufs_trunc_dindirect(struct inode *inode, u64 offset, void *p)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 13/13] s390/irq: make return of 0 explicit

2014-05-18 Thread Julia Lawall
From: Julia Lawall 

Delete unnecessary local variable whose value is always 0 and that hides
the fact that the result is always 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// 

Signed-off-by: Julia Lawall 

---
 arch/s390/oprofile/hwsampler.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/s390/oprofile/hwsampler.c b/arch/s390/oprofile/hwsampler.c
index 276f2e2..28b2760 100644
--- a/arch/s390/oprofile/hwsampler.c
+++ b/arch/s390/oprofile/hwsampler.c
@@ -212,10 +212,8 @@ static void init_all_cpu_buffers(void)
 static int prepare_cpu_buffers(void)
 {
int cpu;
-   int rc;
struct hws_cpu_buffer *cb;
 
-   rc = 0;
for_each_online_cpu(cpu) {
cb = &per_cpu(sampler_cpu_buffer, cpu);
atomic_set(&cb->ext_params, 0);
@@ -231,7 +229,7 @@ static int prepare_cpu_buffers(void)
cb->stop_mode = 0;
}
 
-   return rc;
+   return 0;
 }
 
 /*
@@ -1156,7 +1154,7 @@ int hwsampler_stop_all(void)
rc = 0;
if (hws_state == HWS_INIT) {
mutex_unlock(&hws_sem);
-   return rc;
+   return 0;
}
hws_state = HWS_STOPPING;
mutex_unlock(&hws_sem);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/13] brcmsmac: make return of 0 explicit

2014-05-18 Thread Julia Lawall
From: Julia Lawall 

Delete unnecessary local variable whose value is always 0 and that hides
the fact that the result is always 0.

A simplified version of the semantic patch that fixes this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
@r exists@
local idexpression ret;
expression e;
position p;
@@

-ret = 0;
... when != ret = e
return 
- ret
+ 0
  ;
// 

Signed-off-by: Julia Lawall 

---
 drivers/net/wireless/brcm80211/brcmsmac/main.c |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c 
b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 9417cb5..3054725 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -4875,9 +4875,6 @@ static int brcms_b_detach(struct brcms_c_info *wlc)
uint i;
struct brcms_hw_band *band;
struct brcms_hardware *wlc_hw = wlc->hw;
-   int callbacks;
-
-   callbacks = 0;
 
brcms_b_detach_dmapio(wlc_hw);
 
@@ -4901,7 +4898,7 @@ static int brcms_b_detach(struct brcms_c_info *wlc)
wlc_hw->sih = NULL;
}
 
-   return callbacks;
+   return 0;
 
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 03/06] staging: crypto: skein: rename skein1024_ctx to skein_1024_ctx

2014-05-18 Thread Anton Saraev
Code have skein_512_ctx and skein_256_ctx but skein1024_ctx.
It would be logical to convert these names to a single form.

Signed-off-by: Anton Saraev 
---
 drivers/staging/skein/include/skein.h   | 14 +++---
 drivers/staging/skein/include/skeinApi.h|  2 +-
 drivers/staging/skein/include/skein_block.h |  2 +-
 drivers/staging/skein/skein.c   | 12 ++--
 drivers/staging/skein/skeinBlockNo3F.c  |  2 +-
 drivers/staging/skein/skein_block.c |  2 +-
 6 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/skein/include/skein.h 
b/drivers/staging/skein/include/skein.h
index deaa9c8..09e96d6 100644
--- a/drivers/staging/skein/include/skein.h
+++ b/drivers/staging/skein/include/skein.h
@@ -81,7 +81,7 @@ struct skein_512_ctx { /* 512-bit Skein hash context 
structure */
u8 b[SKEIN_512_BLOCK_BYTES];/* partial block buf (8-byte aligned) */
 };
 
-struct skein1024_ctx { /* 1024-bit Skein hash context structure */
+struct skein_1024_ctx { /* 1024-bit Skein hash context structure */
struct skein_ctx_hdr h; /* common header context variables */
u64 X[SKEIN1024_STATE_WORDS];   /* chaining variables */
u8 b[SKEIN1024_BLOCK_BYTES];/* partial block buf (8-byte aligned) */
@@ -90,18 +90,18 @@ struct skein1024_ctx { /* 1024-bit Skein hash context 
structure */
 /* Skein APIs for (incremental) "straight hashing" */
 int skein_256_init(struct skein_256_ctx *ctx, size_t hash_bit_len);
 int skein_512_init(struct skein_512_ctx *ctx, size_t hash_bit_len);
-int skein_1024_init(struct skein1024_ctx *ctx, size_t hash_bit_len);
+int skein_1024_init(struct skein_1024_ctx *ctx, size_t hash_bit_len);
 
 int skein_256_update(struct skein_256_ctx *ctx, const u8 *msg,
 size_t msg_byte_cnt);
 int skein_512_update(struct skein_512_ctx *ctx, const u8 *msg,
 size_t msg_byte_cnt);
-int skein_1024_update(struct skein1024_ctx *ctx, const u8 *msg,
+int skein_1024_update(struct skein_1024_ctx *ctx, const u8 *msg,
  size_t msg_byte_cnt);
 
 int skein_256_final(struct skein_256_ctx *ctx, u8 *hash_val);
 int skein_512_final(struct skein_512_ctx *ctx, u8 *hash_val);
-int skein_1024_final(struct skein1024_ctx *ctx, u8 *hash_val);
+int skein_1024_final(struct skein_1024_ctx *ctx, u8 *hash_val);
 
 /*
 **   Skein APIs for "extended" initialization: MAC keys, tree hashing.
@@ -121,7 +121,7 @@ int skein_256_init_ext(struct skein_256_ctx *ctx, size_t 
hash_bit_len,
   u64 tree_info, const u8 *key, size_t key_bytes);
 int skein_512_init_ext(struct skein_512_ctx *ctx, size_t hash_bit_len,
   u64 tree_info, const u8 *key, size_t key_bytes);
-int skein_1024_init_ext(struct skein1024_ctx *ctx, size_t hash_bit_len,
+int skein_1024_init_ext(struct skein_1024_ctx *ctx, size_t hash_bit_len,
u64 tree_info, const u8 *key, size_t key_bytes);
 
 /*
@@ -131,7 +131,7 @@ int skein_1024_init_ext(struct skein1024_ctx *ctx, size_t 
hash_bit_len,
 */
 int skein_256_final_pad(struct skein_256_ctx *ctx, u8 *hash_val);
 int skein_512_final_pad(struct skein_512_ctx *ctx, u8 *hash_val);
-int skein_1024_final_pad(struct skein1024_ctx *ctx, u8 *hash_val);
+int skein_1024_final_pad(struct skein_1024_ctx *ctx, u8 *hash_val);
 
 #ifndef SKEIN_TREE_HASH
 #define SKEIN_TREE_HASH (1)
@@ -139,7 +139,7 @@ int skein_1024_final_pad(struct skein1024_ctx *ctx, u8 
*hash_val);
 #if  SKEIN_TREE_HASH
 int skein_256_output(struct skein_256_ctx *ctx, u8 *hash_val);
 int skein_512_output(struct skein_512_ctx *ctx, u8 *hash_val);
-int skein_1024_output(struct skein1024_ctx *ctx, u8 *hash_val);
+int skein_1024_output(struct skein_1024_ctx *ctx, u8 *hash_val);
 #endif
 
 /*
diff --git a/drivers/staging/skein/include/skeinApi.h 
b/drivers/staging/skein/include/skeinApi.h
index 11ecab8..850d5c9 100644
--- a/drivers/staging/skein/include/skeinApi.h
+++ b/drivers/staging/skein/include/skeinApi.h
@@ -105,7 +105,7 @@ struct skein_ctx {
struct skein_ctx_hdr h;
struct skein_256_ctx s256;
struct skein_512_ctx s512;
-   struct skein1024_ctx s1024;
+   struct skein_1024_ctx s1024;
} m;
 };
 
diff --git a/drivers/staging/skein/include/skein_block.h 
b/drivers/staging/skein/include/skein_block.h
index ec787a3..a8dd083 100644
--- a/drivers/staging/skein/include/skein_block.h
+++ b/drivers/staging/skein/include/skein_block.h
@@ -16,7 +16,7 @@ void skein_256_process_block(struct skein_256_ctx *ctx, const 
u8 *blk_ptr,
 size_t blk_cnt, size_t byte_cnt_add);
 void skein_512_process_block(struct skein_512_ctx *ctx, const u8 *blk_ptr,
 size_t blk_cnt, size_t byte_cnt_add);
-void skein_1024_process_block(struct skein1024_ctx *ctx, const u8 *blk_ptr,
+void skein_1024_process_block(struct skein_

RE: [PATCHv4 2/2] regmap: add DT endianness binding support.

2014-05-18 Thread li.xi...@freescale.com
> Subject: Re: [PATCHv4 2/2] regmap: add DT endianness binding support.
> 
> On Fri, May 09, 2014 at 03:04:33AM +0100, Xiubo Li wrote:
> > For many drivers which will support rich endianness of CPU<-->Dev
> > need define DT properties by itself without the binding support.
> >
> > The endianness using regmap:
> > IndexCPU   Device Endianess flag for DT bool property
> > 
> > 1LELE -
> > 2LEBE 'big-endian-{val,reg}'
> > 3BEBE -
> > 4BELE 'little-endian-{val,reg}'
> 
> Get rid of the CPU column. It has precisely _nothing_ to do with the
> device.
> 
> If you happen to have a device that can be integrated with varying
> endianness, the endianness should be described regardless of whether
> this happens to be the same as the CPU endianness. The kernel can then
> choose to do the right thing regardless.
> 
> Assuming LE or BE by default is sane if most implementations are one
> rather than the other. Probing and figuring it out dynamically is also
> fine. Assuming that it's the same as the kernel is broken in general,
> and should be avoided -- those cases _require_ a *-endian property to
> work if the CPU can function in either endianness.
> 

Yes, If my understanding is correct, if we need inverting the bytes order, 
should be add one property here, regardless of the CPU's endianesses.


> > Please see the following documetation for detail:
> > Documentation/devicetree/bindings/endianness/endianness.txt
> 
> I don't think this is sufficient. That document describes the preferred
> idiom, not the meaning w.r.t. a specific binding.
> 
> [...]
> 
> > +   case REGMAP_ENDIAN_REG:
> > +   if (of_property_read_bool(np, "big-endian-reg"))
> > +   *endian = REGMAP_ENDIAN_BIG;
> > +   else if (of_property_read_bool(np, "little-endian-reg"))
> > +   *endian = REGMAP_ENDIAN_LITTLE;
> 
> While this follows the guidelines you've added, context is still
> required to understand precisely what this means. We need a binding
> document describing what *-endian-reg means for this binding (i.e. what
> does -reg cover? All registers? some? buffers?).
> 

Yes, for now the 'reg' is for all registers of the device.
And the 'val' is for all the values and buffers of the device.

@Mark Brown,
Do you have any correction here ?


> Imagine I added a little-endian-foo property. You'd be able to reason
> that something is little endian, but you'd have no idea of precisely
> what without reading documentation or code. As not everyone wants to
> read several thousand lines of Linux kernel code to write a dts we
> require documentation.
> 

@Mark Rutland, @Mark Brown,
Yes, where should I locate the documentation ?
Is Documentation/devicetree/bindings/regmap/ okay ?


Thanks,

BRs
Xiubo


> > +   case REGMAP_ENDIAN_VAL:
> > +   if (of_property_read_bool(np, "big-endian-val"))
> > +   *endian = REGMAP_ENDIAN_BIG;
> > +   else if (of_property_read_bool(np, "little-endian-val"))
> > +   *endian = REGMAP_ENDIAN_LITTLE;
> 
> Likewise.
> 
> Cheers,
> Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 06/06] staging: crypto: skein: rename files

2014-05-18 Thread Anton Saraev
camelCase is not accepted in the Linux Kernel. To prepare skein
driver for mainline inclusion, we rename all files to
non-camelCase equivalents.

Signed-off-by: Anton Saraev 
---
 drivers/staging/skein/Makefile | 10 +-
 drivers/staging/skein/TODO |  1 -
 drivers/staging/skein/include/{skeinApi.h => skein_api.h}  |  4 ++--
 .../staging/skein/include/{threefishApi.h => threefish_api.h}  |  2 +-
 drivers/staging/skein/{skeinApi.c => skein_api.c}  |  2 +-
 .../staging/skein/{skeinBlockNo3F.c => skein_block_no_3f.c}|  2 +-
 .../skein/{threefish1024Block.c => threefish_1024_block.c} |  2 +-
 .../skein/{threefish256Block.c => threefish_256_block.c}   |  2 +-
 .../skein/{threefish512Block.c => threefish_512_block.c}   |  2 +-
 drivers/staging/skein/{threefishApi.c => threefish_api.c}  |  3 +--
 10 files changed, 14 insertions(+), 16 deletions(-)
 rename drivers/staging/skein/include/{skeinApi.h => skein_api.h} (99%)
 rename drivers/staging/skein/include/{threefishApi.h => threefish_api.h} (99%)
 rename drivers/staging/skein/{skeinApi.c => skein_api.c} (99%)
 rename drivers/staging/skein/{skeinBlockNo3F.c => skein_block_no_3f.c} (99%)
 rename drivers/staging/skein/{threefish1024Block.c => threefish_1024_block.c} 
(99%)
 rename drivers/staging/skein/{threefish256Block.c => threefish_256_block.c} 
(99%)
 rename drivers/staging/skein/{threefish512Block.c => threefish_512_block.c} 
(99%)
 rename drivers/staging/skein/{threefishApi.c => threefish_api.c} (98%)

diff --git a/drivers/staging/skein/Makefile b/drivers/staging/skein/Makefile
index 2bb386e..29f51bf 100644
--- a/drivers/staging/skein/Makefile
+++ b/drivers/staging/skein/Makefile
@@ -4,10 +4,10 @@
 subdir-ccflags-y := -I$(src)/include/
 
 obj-$(CONFIG_CRYPTO_SKEIN) +=   skein.o \
-   skeinApi.o \
+   skein_api.o \
skein_block.o
 
-obj-$(CONFIG_CRYPTO_THREEFISH) += threefish1024Block.o \
- threefish256Block.o \
- threefish512Block.o \
- threefishApi.o
+obj-$(CONFIG_CRYPTO_THREEFISH) += threefish_1024_block.o \
+ threefish_256_block.o \
+ threefish_512_block.o \
+ threefish_api.o
diff --git a/drivers/staging/skein/TODO b/drivers/staging/skein/TODO
index 88a6e81..cd3508d 100644
--- a/drivers/staging/skein/TODO
+++ b/drivers/staging/skein/TODO
@@ -1,6 +1,5 @@
 skein/threefish TODO
 
- - rename files
  - move macros into appropriate header files
  - add / pass test vectors
  - module support
diff --git a/drivers/staging/skein/include/skeinApi.h 
b/drivers/staging/skein/include/skein_api.h
similarity index 99%
rename from drivers/staging/skein/include/skeinApi.h
rename to drivers/staging/skein/include/skein_api.h
index b4e879d..87f769a 100644
--- a/drivers/staging/skein/include/skeinApi.h
+++ b/drivers/staging/skein/include/skein_api.h
@@ -28,7 +28,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #define SKEINAPI_H
 
 /**
- * @file skeinApi.h
+ * @file skein_api.h
  * @brief A Skein API and its functions.
  * @{
  *
@@ -44,7 +44,7 @@ OTHER DEALINGS IN THE SOFTWARE.
  *
  * @code
  *
- * #include 
+ * #include 
  *
  * ...
  * struct skein_ctx ctx; // a Skein hash or MAC context
diff --git a/drivers/staging/skein/include/threefishApi.h 
b/drivers/staging/skein/include/threefish_api.h
similarity index 99%
rename from drivers/staging/skein/include/threefishApi.h
rename to drivers/staging/skein/include/threefish_api.h
index 96cc0e8..fe28981 100644
--- a/drivers/staging/skein/include/threefishApi.h
+++ b/drivers/staging/skein/include/threefish_api.h
@@ -3,7 +3,7 @@
 #define THREEFISHAPI_H
 
 /**
- * @file threefishApi.h
+ * @file threefish_api.h
  * @brief A Threefish cipher API and its functions.
  * @{
  *
diff --git a/drivers/staging/skein/skeinApi.c 
b/drivers/staging/skein/skein_api.c
similarity index 99%
rename from drivers/staging/skein/skeinApi.c
rename to drivers/staging/skein/skein_api.c
index 16d596b..7fb0160 100644
--- a/drivers/staging/skein/skeinApi.c
+++ b/drivers/staging/skein/skein_api.c
@@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 */
 
 #include 
-#include 
+#include 
 
 int skein_ctx_prepare(struct skein_ctx *ctx, enum skein_size size)
 {
diff --git a/drivers/staging/skein/skeinBlockNo3F.c 
b/drivers/staging/skein/skein_block_no_3f.c
similarity index 99%
rename from drivers/staging/skein/skeinBlockNo3F.c
rename to drivers/staging/skein/skein_block_no_3f.c
index 4ee7f9f..23a3ac5 100644
--- a/drivers/staging/skein/skeinBlockNo3F.c
+++ b/drivers/staging/skein/skein_block_no_3f.c
@@ -1,7 +1,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 
 /*  Skein_256 **/
diff --git a/drivers/staging/skein/threefish1024B

[PATCH v2 01/06] staging: crypto: skein: rename camelcase functions

2014-05-18 Thread Anton Saraev
camelCase is not accepted in the Linux Kernel. To prepare skein
driver for mainline inclusion, we rename all functions to
non-camelCase equivalents.

Signed-off-by: Anton Saraev 
---
 drivers/staging/skein/TODO   |   1 -
 drivers/staging/skein/include/skein.h|  66 
 drivers/staging/skein/include/skeinApi.h |  38 -
 drivers/staging/skein/include/skein_block.h  |  12 +--
 drivers/staging/skein/include/threefishApi.h |  44 ++-
 drivers/staging/skein/skein.c| 114 +--
 drivers/staging/skein/skeinApi.c |  72 -
 drivers/staging/skein/skeinBlockNo3F.c   |  24 +++---
 drivers/staging/skein/skein_block.c  |  40 +-
 drivers/staging/skein/threefish1024Block.c   |   6 +-
 drivers/staging/skein/threefish256Block.c|   6 +-
 drivers/staging/skein/threefish512Block.c|   6 +-
 drivers/staging/skein/threefishApi.c |  38 -
 13 files changed, 239 insertions(+), 228 deletions(-)

diff --git a/drivers/staging/skein/TODO b/drivers/staging/skein/TODO
index f5c167a..bc42fb8 100644
--- a/drivers/staging/skein/TODO
+++ b/drivers/staging/skein/TODO
@@ -1,7 +1,6 @@
 skein/threefish TODO
 
  - rename camelcase vars
- - rename camelcase functions
  - rename files
  - move macros into appropriate header files
  - add / pass test vectors
diff --git a/drivers/staging/skein/include/skein.h 
b/drivers/staging/skein/include/skein.h
index 0a2abce..15ff60f 100644
--- a/drivers/staging/skein/include/skein.h
+++ b/drivers/staging/skein/include/skein.h
@@ -86,59 +86,59 @@ struct skein1024_ctx { /* 1024-bit Skein hash context 
structure */
u8  b[SKEIN1024_BLOCK_BYTES];   /* partial block buf (8-byte aligned) */
 };
 
-/*   Skein APIs for (incremental) "straight hashing" */
-int  Skein_256_Init(struct skein_256_ctx *ctx, size_t hashBitLen);
-int  Skein_512_Init(struct skein_512_ctx *ctx, size_t hashBitLen);
-int  Skein1024_Init(struct skein1024_ctx *ctx, size_t hashBitLen);
-
-int  Skein_256_Update(struct skein_256_ctx *ctx, const u8 *msg,
-   size_t msgByteCnt);
-int  Skein_512_Update(struct skein_512_ctx *ctx, const u8 *msg,
-   size_t msgByteCnt);
-int  Skein1024_Update(struct skein1024_ctx *ctx, const u8 *msg,
-   size_t msgByteCnt);
-
-int  Skein_256_Final(struct skein_256_ctx *ctx, u8 *hashVal);
-int  Skein_512_Final(struct skein_512_ctx *ctx, u8 *hashVal);
-int  Skein1024_Final(struct skein1024_ctx *ctx, u8 *hashVal);
+/* Skein APIs for (incremental) "straight hashing" */
+int skein_256_init(struct skein_256_ctx *ctx, size_t hashBitLen);
+int skein_512_init(struct skein_512_ctx *ctx, size_t hashBitLen);
+int skein_1024_init(struct skein1024_ctx *ctx, size_t hashBitLen);
+
+int skein_256_update(struct skein_256_ctx *ctx, const u8 *msg,
+size_t msgByteCnt);
+int skein_512_update(struct skein_512_ctx *ctx, const u8 *msg,
+size_t msgByteCnt);
+int skein_1024_update(struct skein1024_ctx *ctx, const u8 *msg,
+ size_t msgByteCnt);
+
+int skein_256_final(struct skein_256_ctx *ctx, u8 *hashVal);
+int skein_512_final(struct skein_512_ctx *ctx, u8 *hashVal);
+int skein_1024_final(struct skein1024_ctx *ctx, u8 *hashVal);
 
 /*
 **   Skein APIs for "extended" initialization: MAC keys, tree hashing.
-**   After an InitExt() call, just use Update/Final calls as with Init().
+**   After an init_ext() call, just use update/final calls as with init().
 **
-**   Notes: Same parameters as _Init() calls, plus treeInfo/key/keyBytes.
+**   Notes: Same parameters as _init() calls, plus treeInfo/key/keyBytes.
 **  When keyBytes == 0 and treeInfo == SKEIN_SEQUENTIAL,
-**  the results of InitExt() are identical to calling Init().
-**  The function Init() may be called once to "precompute" the IV for
+**  the results of init_ext() are identical to calling init().
+**  The function init() may be called once to "precompute" the IV for
 **  a given hashBitLen value, then by saving a copy of the context
 **  the IV computation may be avoided in later calls.
-**  Similarly, the function InitExt() may be called once per MAC key
+**  Similarly, the function init_ext() may be called once per MAC key
 **  to precompute the MAC IV, then a copy of the context saved and
 **  reused for each new MAC computation.
 **/
-int  Skein_256_InitExt(struct skein_256_ctx *ctx, size_t hashBitLen,
-   u64 treeInfo, const u8 *key, size_t keyBytes);
-int  Skein_512_InitExt(struct skein_512_ctx *ctx, size_t hashBitLen,
-   u64 treeInfo, const u8 *key, size_t keyBytes);
-int  Skein1024_InitExt(struct skein1024_ctx *ctx, size_t hashBitLen,
+int skein_256_init_ext(struct skein_256_ctx *ctx, size_t hashBitLen,
+  u64 treeInfo, const u8 *ke

[PATCH v2 00/06] staging: crypto: skein: fixing style issues

2014-05-18 Thread Anton Saraev
Hi! To prepare skein driver for mainline inclusion we fixing most of
style issues (wrong names of functions, vars, macros, files) and 
checkpatch problems in this patch set. For example, existing code 
is widely use camelCase names. This patch fix it.

Anton Saraev (6):
  staging: crypto: skein: rename camelcase functions
  staging: crypto: skein: rename camelcase vars
  staging: crypto: skein: rename skein1024_ctx to skein_1024_ctx
  staging: crypto: skein: rename enums
  staging: crypto: skein: rename macros
  staging: crypto: skein: rename files

 drivers/staging/skein/Makefile |  10 +-
 drivers/staging/skein/TODO |   3 -
 drivers/staging/skein/include/skein.h  | 180 +++
 .../skein/include/{skeinApi.h => skein_api.h}  |  66 +--
 drivers/staging/skein/include/skein_block.h|  12 +-
 drivers/staging/skein/include/skein_iv.h   |   6 +-
 .../include/{threefishApi.h => threefish_api.h}|  84 +--
 drivers/staging/skein/skein.c  | 577 +++--
 drivers/staging/skein/{skeinApi.c => skein_api.c}  | 170 +++---
 drivers/staging/skein/skein_block.c| 411 +++
 .../{skeinBlockNo3F.c => skein_block_no_3f.c}  |  62 +--
 drivers/staging/skein/threefishApi.c   |  79 ---
 ...threefish1024Block.c => threefish_1024_block.c} |  80 +--
 .../{threefish256Block.c => threefish_256_block.c} |  32 +-
 .../{threefish512Block.c => threefish_512_block.c} |  48 +-
 drivers/staging/skein/threefish_api.c  |  78 +++
 16 files changed, 959 insertions(+), 939 deletions(-)
 rename drivers/staging/skein/include/{skeinApi.h => skein_api.h} (79%)
 rename drivers/staging/skein/include/{threefishApi.h => threefish_api.h} (66%)
 rename drivers/staging/skein/{skeinApi.c => skein_api.c} (52%)
 rename drivers/staging/skein/{skeinBlockNo3F.c => skein_block_no_3f.c} (66%)
 delete mode 100644 drivers/staging/skein/threefishApi.c
 rename drivers/staging/skein/{threefish1024Block.c => threefish_1024_block.c} 
(98%)
 rename drivers/staging/skein/{threefish256Block.c => threefish_256_block.c} 
(96%)
 rename drivers/staging/skein/{threefish512Block.c => threefish_512_block.c} 
(97%)
 create mode 100644 drivers/staging/skein/threefish_api.c

-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 04/06] staging: crypto: skein: rename enums

2014-05-18 Thread Anton Saraev
Linux Kernel use capitalized names for enum. To prepare skein
driver to mainline inclusion, we rename all enums to capitalized
names.

Signed-off-by: Anton Saraev 
---
 drivers/staging/skein/include/skein.h|  6 +++---
 drivers/staging/skein/include/skeinApi.h |  8 
 drivers/staging/skein/include/threefishApi.h | 18 +-
 drivers/staging/skein/skeinApi.c | 24 
 drivers/staging/skein/skeinBlockNo3F.c   |  6 +++---
 drivers/staging/skein/skein_block.c  |  6 +++---
 drivers/staging/skein/threefishApi.c | 12 ++--
 7 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/skein/include/skein.h 
b/drivers/staging/skein/include/skein.h
index 09e96d6..8ecd720 100644
--- a/drivers/staging/skein/include/skein.h
+++ b/drivers/staging/skein/include/skein.h
@@ -293,7 +293,7 @@ int skein_1024_output(struct skein_1024_ctx *ctx, u8 
*hash_val);
 ** Skein block function constants (shared across Ref and Opt code)
 **/
 enum {
-   /* Skein_256 round rotation constants */
+   /* SKEIN_256 round rotation constants */
R_256_0_0 = 14, R_256_0_1 = 16,
R_256_1_0 = 52, R_256_1_1 = 57,
R_256_2_0 = 23, R_256_2_1 = 40,
@@ -303,7 +303,7 @@ enum {
R_256_6_0 = 58, R_256_6_1 = 22,
R_256_7_0 = 32, R_256_7_1 = 32,
 
-   /* Skein_512 round rotation constants */
+   /* SKEIN_512 round rotation constants */
R_512_0_0 = 46, R_512_0_1 = 36, R_512_0_2 = 19, R_512_0_3 = 37,
R_512_1_0 = 33, R_512_1_1 = 27, R_512_1_2 = 14, R_512_1_3 = 42,
R_512_2_0 = 17, R_512_2_1 = 49, R_512_2_2 = 36, R_512_2_3 = 39,
@@ -313,7 +313,7 @@ enum {
R_512_6_0 = 25, R_512_6_1 = 29, R_512_6_2 = 39, R_512_6_3 = 43,
R_512_7_0 =  8, R_512_7_1 = 35, R_512_7_2 = 56, R_512_7_3 = 22,
 
-   /* Skein1024 round rotation constants */
+   /* SKEIN_1024 round rotation constants */
R1024_0_0 = 24, R1024_0_1 = 13, R1024_0_2 =  8, R1024_0_3 = 47,
R1024_0_4 =  8, R1024_0_5 = 17, R1024_0_6 = 22, R1024_0_7 = 37,
R1024_1_0 = 38, R1024_1_1 = 19, R1024_1_2 = 10, R1024_1_3 = 55,
diff --git a/drivers/staging/skein/include/skeinApi.h 
b/drivers/staging/skein/include/skeinApi.h
index 850d5c9..b4e879d 100644
--- a/drivers/staging/skein/include/skeinApi.h
+++ b/drivers/staging/skein/include/skeinApi.h
@@ -50,7 +50,7 @@ OTHER DEALINGS IN THE SOFTWARE.
  * struct skein_ctx ctx; // a Skein hash or MAC context
  *
  * // prepare context, here for a Skein with a state size of 512 bits.
- * skein_ctx_prepare(&ctx, Skein512);
+ * skein_ctx_prepare(&ctx, SKEIN_512);
  *
  * // Initialize the context to set the requested hash length in bits
  * // here request a output hash size of 31 bits (Skein supports variable
@@ -85,9 +85,9 @@ OTHER DEALINGS IN THE SOFTWARE.
  * Which Skein size to use
  */
 enum skein_size {
-   Skein256 = 256, /*!< Skein with 256 bit state */
-   Skein512 = 512, /*!< Skein with 512 bit state */
-   Skein1024 = 1024/*!< Skein with 1024 bit state */
+   SKEIN_256 = 256, /*!< Skein with 256 bit state */
+   SKEIN_512 = 512, /*!< Skein with 512 bit state */
+   SKEIN_1024 = 1024/*!< Skein with 1024 bit state */
 };
 
 /**
diff --git a/drivers/staging/skein/include/threefishApi.h 
b/drivers/staging/skein/include/threefishApi.h
index 37f6e63..63030e5 100644
--- a/drivers/staging/skein/include/threefishApi.h
+++ b/drivers/staging/skein/include/threefishApi.h
@@ -17,14 +17,14 @@
  * functions.
  *
 @code
-// Threefish cipher context data
-struct threefish_key key_ctx;
+   // Threefish cipher context data
+   struct threefish_key key_ctx;
 
-// Initialize the context
-threefish_set_key(&key_ctx, Threefish512, key, tweak);
+   // Initialize the context
+   threefish_set_key(&key_ctx, THREEFISH_512, key, tweak);
 
-// Encrypt
-threefish_encrypt_block_bytes(&key_ctx, input, cipher);
+   // Encrypt
+   threefish_encrypt_block_bytes(&key_ctx, input, cipher);
 @endcode
  */
 
@@ -37,9 +37,9 @@
  * Which Threefish size to use
  */
 enum threefish_size {
-   Threefish256 = 256, /*!< Skein with 256 bit state */
-   Threefish512 = 512, /*!< Skein with 512 bit state */
-   Threefish1024 = 1024/*!< Skein with 1024 bit state */
+   THREEFISH_256 = 256, /*!< Skein with 256 bit state */
+   THREEFISH_512 = 512, /*!< Skein with 512 bit state */
+   THREEFISH_1024 = 1024/*!< Skein with 1024 bit state */
 };
 
 /**
diff --git a/drivers/staging/skein/skeinApi.c b/drivers/staging/skein/skeinApi.c
index 3426392..87b3ff2 100644
--- a/drivers/staging/skein/skeinApi.c
+++ b/drivers/staging/skein/skeinApi.c
@@ -57,15 +57,15 @@ int skein_init(struct skein_ctx *ctx, size_t hash_bit_len)
 * the save chaining variables.
 */

[PATCH] mm/vmscan.c: use DIV_ROUND_UP for calculation of zone's balance_gap and correct comments.

2014-05-18 Thread Jianyu Zhan
Currently, we use (zone->managed_pages + KSWAPD_ZONE_BALANCE_GAP_RATIO-1) /
KSWAPD_ZONE_BALANCE_GAP_RATIO to avoid a zero gap value. It's better to
use DIV_ROUND_UP macro for neater code and clear meaning.

Besides, the gap value is calculated against the per-zone "managed pages",
not "present pages". This patch also corrects the comment and do some
rephrasing.

Signed-off-by: Jianyu Zhan 
---
 include/linux/swap.h |  8 
 mm/vmscan.c  | 10 --
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/include/linux/swap.h b/include/linux/swap.h
index 5a14b92..58e1696 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -166,10 +166,10 @@ enum {
 #define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX
 
 /*
- * Ratio between the present memory in the zone and the "gap" that
- * we're allowing kswapd to shrink in addition to the per-zone high
- * wmark, even for zones that already have the high wmark satisfied,
- * in order to provide better per-zone lru behavior. We are ok to
+ * Ratio between zone->managed_pages and the "gap" that above the per-zone
+ * "high_wmark". While balancing nodes, We allow kswapd to shrink zones that
+ * do not meet the (high_wmark + gap) watermark, even which already met the
+ * high_wmark, in order to provide better per-zone lru behavior. We are ok to
  * spend not more than 1% of the memory for this zone balancing "gap".
  */
 #define KSWAPD_ZONE_BALANCE_GAP_RATIO 100
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 32c661d..9ef9f6c 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2268,9 +2268,8 @@ static inline bool compaction_ready(struct zone *zone, 
struct scan_control *sc)
 * there is a buffer of free pages available to give compaction
 * a reasonable chance of completing and allocating the page
 */
-   balance_gap = min(low_wmark_pages(zone),
-   (zone->managed_pages + KSWAPD_ZONE_BALANCE_GAP_RATIO-1) /
-   KSWAPD_ZONE_BALANCE_GAP_RATIO);
+   balance_gap = min(low_wmark_pages(zone), DIV_ROUND_UP(
+   zone->managed_pages, KSWAPD_ZONE_BALANCE_GAP_RATIO));
watermark = high_wmark_pages(zone) + balance_gap + (2UL << sc->order);
watermark_ok = zone_watermark_ok_safe(zone, 0, watermark, 0, 0);
 
@@ -2891,9 +2890,8 @@ static bool kswapd_shrink_zone(struct zone *zone,
 * high wmark plus a "gap" where the gap is either the low
 * watermark or 1% of the zone, whichever is smaller.
 */
-   balance_gap = min(low_wmark_pages(zone),
-   (zone->managed_pages + KSWAPD_ZONE_BALANCE_GAP_RATIO-1) /
-   KSWAPD_ZONE_BALANCE_GAP_RATIO);
+   balance_gap = min(low_wmark_pages(zone), DIV_ROUND_UP(
+   zone->managed_pages, KSWAPD_ZONE_BALANCE_GAP_RATIO));
 
/*
 * If there is no low memory pressure or the zone is balanced then no
-- 
2.0.0-rc3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] mtd: Add sysfs attr to expose ECC stats

2014-05-18 Thread Ezequiel Garcia
On 12 May 11:26 PM, Ezequiel Garcia wrote:
> On 12 May 05:50 PM, Brian Norris wrote:
> > > There are some guidelines about attributes in 
> > > 'Documentation/filesystems/sysfs.txt'
> > > Though it's acceptable to put array of values of the "same type" in 
> > > single sysfs file,
> > > But I'm still not confident on having all members of 'struct ecc_stats' 
> > > being
> > > represented by single sysfs file
> > [...]
> > 
> > I agree, it looks like the sysfs policy would recommend against putting
> > distinct properties in the same file.
> > 
[..]
> > So I personally might lean toward "one file per attribute" here.
> > 

Brian,

Having agreed on doing one file per attribute, I'm now not sure how to
name them. Maybe you can give me a hand?

Let me add some context: these are the per-MTD partition fields of the
mtd_ecc_stats struct, although two of them aren't related to ECC, but to
the bad blocks management. This is the struct:

struct mtd_ecc_stats {
__u32 corrected;
__u32 failed;
__u32 badblocks;
__u32 bbtblocks;
};

How about the following?

* corrected_bits
* uncorrectable_errors
* badblocks
* bbtblocks
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Ich brauche Ihre dringende Antwort

2014-05-18 Thread Mr chinsang



--
Ich brauche Ihre dringende Antwort

   Ich bin mit diesem Medium, um Sie Transaktion in meiner Bank in 
China, Sie als Empfänger zu informieren, die die Übertragung von 
21.500.000 $ (Zwanzig Millionen fünfhunderttausend US-Dollar). Das wird 
100% sicher, verstorben der Zahl Kunden.


   Bitte auf meiner privaten E-Mail unter Kontakt für Fragen und 
weiteren Informationen.


   Mit freundlichen Grüßen,
   sang Chin
   E-mail: chinsan...@yahoo.com.hk
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v9 1/3] ARM: EXYNOS: Add support for EXYNOS5410 SoC

2014-05-18 Thread Tarek Dakhran
EXYNOS5410 is SoC in Samsung's Exynos5 SoC series.
Add initial support for this SoC.

Signed-off-by: Tarek Dakhran 
Signed-off-by: Vyacheslav Tyrtov 
Reviewed-by: Tomasz Figa 
---
 arch/arm/mach-exynos/Kconfig |8 
 arch/arm/mach-exynos/exynos.c|1 +
 arch/arm/mach-exynos/platsmp.c   |4 
 arch/arm/plat-samsung/include/plat/cpu.h |   11 ++-
 4 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 1602abc..79a3e85 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -84,6 +84,14 @@ config SOC_EXYNOS5250
help
  Enable EXYNOS5250 SoC support
 
+config SOC_EXYNOS5410
+   bool "SAMSUNG EXYNOS5410"
+   default y
+   depends on ARCH_EXYNOS5
+   select PM_GENERIC_DOMAINS if PM_RUNTIME
+   help
+ Enable EXYNOS5410 SoC support
+
 config SOC_EXYNOS5420
bool "SAMSUNG EXYNOS5420"
default y
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index e973ff5..12db6cf 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -312,6 +312,7 @@ static char const *exynos_dt_compat[] __initconst = {
"samsung,exynos4412",
"samsung,exynos5",
"samsung,exynos5250",
+   "samsung,exynos5410",
"samsung,exynos5420",
"samsung,exynos5440",
NULL
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 78002c7..a95213d 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -60,6 +60,8 @@ static inline void __iomem *cpu_boot_reg_base(void)
 {
if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1)
return S5P_INFORM5;
+   if (soc_is_exynos5410())
+   return sysram_ns_base_addr;
return sysram_base_addr;
 }
 
@@ -72,6 +74,8 @@ static inline void __iomem *cpu_boot_reg(int cpu)
return ERR_PTR(-ENODEV);
if (soc_is_exynos4412())
boot_reg += 4*cpu;
+   else if (soc_is_exynos5410())
+   boot_reg += (0x1c);
else if (soc_is_exynos5420())
boot_reg += 4;
return boot_reg;
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h 
b/arch/arm/plat-samsung/include/plat/cpu.h
index 5992b8d..21db380 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -49,6 +49,7 @@ extern unsigned long samsung_cpu_id;
 #define EXYNOS4_CPU_MASK   0xFFFE
 
 #define EXYNOS5250_SOC_ID  0x4352
+#define EXYNOS5410_SOC_ID  0xE541
 #define EXYNOS5420_SOC_ID  0xE542
 #define EXYNOS5440_SOC_ID  0xE544
 #define EXYNOS5_SOC_MASK   0xF000
@@ -72,6 +73,7 @@ IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, 
EXYNOS4_CPU_MASK)
 IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
 IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
 IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
+IS_SAMSUNG_CPU(exynos5410, EXYNOS5410_SOC_ID, EXYNOS5_SOC_MASK)
 IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK)
 IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
 
@@ -154,6 +156,12 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, 
EXYNOS5_SOC_MASK)
 # define soc_is_exynos5250()   0
 #endif
 
+#if defined(CONFIG_SOC_EXYNOS5410)
+# define soc_is_exynos5410()   is_samsung_exynos5410()
+#else
+# define soc_is_exynos5410()   0
+#endif
+
 #if defined(CONFIG_SOC_EXYNOS5420)
 # define soc_is_exynos5420()   is_samsung_exynos5420()
 #else
@@ -168,7 +176,8 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, 
EXYNOS5_SOC_MASK)
 
 #define soc_is_exynos4() (soc_is_exynos4210() || soc_is_exynos4212() || \
  soc_is_exynos4412())
-#define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5420())
+#define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5410() || \
+ soc_is_exynos5420())
 
 #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, 
__phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: build failure after merge of the net-next tree

2014-05-18 Thread Stephen Rothwell
Hi all,

After merging the net-next tree, today's linux-next build (arm
multi_v7_defconfig, gcc 4.6.3) failed like this:

drivers/built-in.o: In function `cdc_ncm_get_coalesce':
ak8975.c:(.text+0x1ac994): undefined reference to `__aeabi_uldivmod'

(The file name above seems to be rubbish, the above function is in
drivers/net/usb/cdc_ncm.c)

Probably caused by commit 6c4e548ff366 ("net: cdc_ncm: use ethtool to
tune coalescing settings").  I assume that there are some 64 bit
divides in that function.

I have used the net-next tree from next-20140516 for today.
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


signature.asc
Description: PGP signature


[PATCH v9 2/3] clk: exynos5410: register clocks using common clock framework

2014-05-18 Thread Tarek Dakhran
The EXYNOS5410 clocks are statically listed and registered
using the Samsung specific common clock helper functions.

Signed-off-by: Tarek Dakhran 
Signed-off-by: Vyacheslav Tyrtov 
Acked-by: Tomasz Figa 
---
 .../devicetree/bindings/clock/exynos5410-clock.txt |   51 +
 drivers/clk/samsung/Makefile   |1 +
 drivers/clk/samsung/clk-exynos5410.c   |  223 
 include/dt-bindings/clock/exynos5410.h |   33 +++
 4 files changed, 308 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/exynos5410-clock.txt
 create mode 100644 drivers/clk/samsung/clk-exynos5410.c
 create mode 100644 include/dt-bindings/clock/exynos5410.h

diff --git a/Documentation/devicetree/bindings/clock/exynos5410-clock.txt 
b/Documentation/devicetree/bindings/clock/exynos5410-clock.txt
new file mode 100644
index 000..82337c4
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/exynos5410-clock.txt
@@ -0,0 +1,51 @@
+* Samsung Exynos5410 Clock Controller
+
+The Exynos5410 clock controller generates and supplies clock to various
+controllers within the Exynos5410 SoC.
+
+Required Properties:
+
+- compatible: should be "samsung,exynos5410-clock"
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- #clock-cells: should be 1.
+
+All available clocks are defined as preprocessor macros in
+dt-bindings/clock/exynos5410.h header and can be used in device
+tree sources.
+
+External clock:
+There is clock that is generated outside the SoC. It is expected
+that it is defined using standard clock bindings with following
+ - compatible: should be "samsung,exynos5410-oscclk"
+
+Example 1: An example of a clock controller node is listed below.
+
+   clock: clock-controller@0x1001 {
+   compatible = "samsung,exynos5410-clock";
+   reg = <0x1001 0x3>;
+   #clock-cells = <1>;
+   };
+
+Example 2: Required external clock.
+
+   fixed-rate-clocks {
+   oscclk {
+   compatible = "samsung,exynos5410-oscclk";
+   clock-frequency = <2400>;
+   };
+   };
+
+Example 3: UART controller node that consumes the clock generated by the clock
+  controller. Refer to the standard clock bindings for information
+  about 'clocks' and 'clock-names' property.
+
+   serial@12C2 {
+   compatible = "samsung,exynos4210-uart";
+   reg = <0x12C0 0x100>;
+   interrupts = <0 51 0>;
+   clocks = <&clock CLK_UART0>, <&clock CLK_SCLK_UART0>;
+   clock-names = "uart", "clk_uart_baud0";
+   };
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile
index 8eb4799..b572dd7 100644
--- a/drivers/clk/samsung/Makefile
+++ b/drivers/clk/samsung/Makefile
@@ -5,6 +5,7 @@
 obj-$(CONFIG_COMMON_CLK)   += clk.o clk-pll.o
 obj-$(CONFIG_ARCH_EXYNOS4) += clk-exynos4.o
 obj-$(CONFIG_SOC_EXYNOS5250)   += clk-exynos5250.o
+obj-$(CONFIG_SOC_EXYNOS5410)   += clk-exynos5410.o
 obj-$(CONFIG_SOC_EXYNOS5420)   += clk-exynos5420.o
 obj-$(CONFIG_SOC_EXYNOS5440)   += clk-exynos5440.o
 obj-$(CONFIG_ARCH_EXYNOS)  += clk-exynos-audss.o
diff --git a/drivers/clk/samsung/clk-exynos5410.c 
b/drivers/clk/samsung/clk-exynos5410.c
new file mode 100644
index 000..7fdc17a
--- /dev/null
+++ b/drivers/clk/samsung/clk-exynos5410.c
@@ -0,0 +1,223 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Author: Tarek Dakhran 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Common Clock Framework support for Exynos5410 SoC.
+*/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "clk.h"
+
+#define APLL_LOCK   0x0
+#define APLL_CON0   0x100
+#define CPLL_LOCK   0x10020
+#define CPLL_CON0   0x10120
+#define MPLL_LOCK   0x4000
+#define MPLL_CON0   0x4100
+#define BPLL_LOCK   0x20010
+#define BPLL_CON0   0x20110
+#define KPLL_LOCK   0x28000
+#define KPLL_CON0   0x28100
+
+#define SRC_CPU0x200
+#define DIV_CPU0   0x500
+#define SRC_CPERI1 0x4204
+#define DIV_TOP0   0x10510
+#define DIV_TOP1   0x10514
+#define DIV_FSYS1  0x1054c
+#define DIV_FSYS2  0x10550
+#define DIV_PERIC0 0x10558
+#define SRC_TOP0   0x10210
+#define SRC_TOP1   0x10214
+#define SRC_TOP2   0x10218
+#define SRC_FSYS   0x10244
+#define SRC_PERIC0 0x10250
+#define SRC_MASK_FSYS  0x10340
+#define SRC_MASK_PERIC00x10350
+#define GATE_BUS_FSYS0 0x10740
+#define GATE_IP_FSYS   0x1094

[PATCH v9 3/3] ARM: dts: Add initial device tree support for EXYNOS5410

2014-05-18 Thread Tarek Dakhran
Add initial device tree nodes for EXYNOS5410 SoC and SMDK5410 board.

Signed-off-by: Tarek Dakhran 
Signed-off-by: Vyacheslav Tyrtov 
Reviewed-by: Tomasz Figa 
---
 arch/arm/boot/dts/Makefile|1 +
 arch/arm/boot/dts/exynos5410-smdk5410.dts |   65 
 arch/arm/boot/dts/exynos5410.dtsi |  158 +
 3 files changed, 224 insertions(+)
 create mode 100644 arch/arm/boot/dts/exynos5410-smdk5410.dts
 create mode 100644 arch/arm/boot/dts/exynos5410.dtsi

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 3220e29..2fcde9a 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -73,6 +73,7 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
exynos5250-arndale.dtb \
exynos5250-smdk5250.dtb \
exynos5250-snow.dtb \
+   exynos5410-smdk5410.dtb \
exynos5420-arndale-octa.dtb \
exynos5420-peach-pit.dtb \
exynos5420-smdk5420.dtb \
diff --git a/arch/arm/boot/dts/exynos5410-smdk5410.dts 
b/arch/arm/boot/dts/exynos5410-smdk5410.dts
new file mode 100644
index 000..d69e152
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5410-smdk5410.dts
@@ -0,0 +1,65 @@
+/*
+ * SAMSUNG SMDK5410 board device tree source
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+/dts-v1/;
+#include "exynos5410.dtsi"
+/ {
+   model = "Samsung SMDK5410 board based on EXYNOS5410";
+   compatible = "samsung,smdk5410", "samsung,exynos5410";
+
+   memory {
+   reg = <0x4000 0x8000>;
+   };
+
+   chosen {
+   bootargs = "console=ttySAC2,115200";
+   };
+
+   fixed-rate-clocks {
+   oscclk {
+   compatible = "samsung,exynos5410-oscclk";
+   clock-frequency = <2400>;
+   };
+   };
+
+   mmc@1220 {
+   status = "okay";
+   num-slots = <1>;
+   supports-highspeed;
+   broken-cd;
+   card-detect-delay = <200>;
+   samsung,dw-mshc-ciu-div = <3>;
+   samsung,dw-mshc-sdr-timing = <2 3>;
+   samsung,dw-mshc-ddr-timing = <1 2>;
+
+   slot@0 {
+   reg = <0>;
+   bus-width = <8>;
+   };
+   };
+
+   mmc@1222 {
+   status = "okay";
+   num-slots = <1>;
+   supports-highspeed;
+   card-detect-delay = <200>;
+   samsung,dw-mshc-ciu-div = <3>;
+   samsung,dw-mshc-sdr-timing = <2 3>;
+   samsung,dw-mshc-ddr-timing = <1 2>;
+
+   slot@0 {
+   reg = <0>;
+   bus-width = <4>;
+   disable-wp;
+   };
+   };
+
+};
diff --git a/arch/arm/boot/dts/exynos5410.dtsi 
b/arch/arm/boot/dts/exynos5410.dtsi
new file mode 100644
index 000..e134afc
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5410.dtsi
@@ -0,0 +1,158 @@
+/*
+ * SAMSUNG EXYNOS5410 SoC device tree source
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * SAMSUNG EXYNOS5410 SoC device nodes are listed in this file.
+ * EXYNOS5410 based board files can include this file and provide
+ * values for board specfic bindings.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include "exynos5.dtsi"
+/ {
+   compatible = "samsung,exynos5410", "samsung,exynos5";
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   CPU0: cpu@0 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a15";
+   reg = <0>;
+   clock-frequency = <16>;
+   };
+
+   CPU1: cpu@1 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a15";
+   reg = <1>;
+   clock-frequency = <16>;
+   };
+
+   CPU2: cpu@2 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a15";
+   reg = <2>;
+   clock-frequency = <16>;
+   };
+
+   CPU3: cpu@3 {
+   device_type = "cpu";
+   compatible = "arm,cortex-a15";
+   reg = <3>;
+   clock-frequency = <16>;
+   };
+   };
+
+   sysram@0202 {
+  

[PATCH v9 0/3] Exynos 5410 support

2014-05-18 Thread Tarek Dakhran
The series of patches represent support of Exynos 5410 SoC

The Exynos 5410 is the first Samsung SoC based on big.LITTLE architecture

Patches add new platform description, support of clock controller and device
tree for Exynos 5410.

Has been build on Samsung Linux Kernel
  (branch: for-next, commit: ccf5511 ARM: EXYNOS: Add MCPM call-back functions)
Has been tested on: 1) Exynos 5410 reference board (exynos_defconfig)
2) Odroid-XU board (exynos_defconfig)

Tarek.

Tarek Dakhran (3):
  ARM: EXYNOS: Add support for EXYNOS5410 SoC
  clk: exynos5410: register clocks using common clock framework
  ARM: dts: Add initial device tree support for EXYNOS5410

 .../devicetree/bindings/clock/exynos5410-clock.txt |   51 +
 arch/arm/boot/dts/Makefile |1 +
 arch/arm/boot/dts/exynos5410-smdk5410.dts  |   65 ++
 arch/arm/boot/dts/exynos5410.dtsi  |  158 ++
 arch/arm/mach-exynos/Kconfig   |8 +
 arch/arm/mach-exynos/exynos.c  |1 +
 arch/arm/mach-exynos/platsmp.c |4 +
 arch/arm/plat-samsung/include/plat/cpu.h   |   11 +-
 drivers/clk/samsung/Makefile   |1 +
 drivers/clk/samsung/clk-exynos5410.c   |  223 
 include/dt-bindings/clock/exynos5410.h |   33 +++
 11 files changed, 555 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/clock/exynos5410-clock.txt
 create mode 100644 arch/arm/boot/dts/exynos5410-smdk5410.dts
 create mode 100644 arch/arm/boot/dts/exynos5410.dtsi
 create mode 100644 drivers/clk/samsung/clk-exynos5410.c
 create mode 100644 include/dt-bindings/clock/exynos5410.h

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   >