Re: 3.11-rc6 genetlink locking fix offends lockdep

2013-08-20 Thread Borislav Petkov
On Tue, Aug 20, 2013 at 10:28:58AM +0200, Johannes Berg wrote:
 Something like the patch below, perhaps? Completely untested so far.

Yeah, this one seems to fix it here (I was seeing the same lockdep splat
as Hugh).

Thanks.

-- 
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
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] mfd: mc13xxx: make it possible to use the codec without pdata

2013-08-20 Thread Lee Jones
   In case of devicetree, we currently don't have a way to append pdata for
   the codec. This patch makes it possible to probe the codec without pdata
   for that case.
   
   Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de
   ---
drivers/mfd/mc13xxx-core.c | 11 +++
1 file changed, 7 insertions(+), 4 deletions(-)
  
  This patch doesn't apply. What tree is it based on?
 Please wait a bit before applying this one. I'd like to get Dmitry's
 feedback on the input one first.

It's okay, I didn't intend on actually applying it. I just wanted to
see the full file changes. I usually apply it, then do a `git log -p
-U1000` to get the full picture. However, I can't even do that yet,
which suggests it's based on some non-upstream tree.

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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 06/17] ARM: imx: remove custom .init_time hook

2013-08-20 Thread Sascha Hauer
On Tue, Aug 20, 2013 at 10:48:44AM +0200, Sebastian Hesselbarth wrote:
 On 08/20/2013 09:26 AM, Sascha Hauer wrote:
 On i.MX5 the init_time hook calls mx5x_clocks_init_dt which calls
 mx5x_clocks_init which not only calls of_clk_init() but also registers
 all clocks in the system. You can't remove it.
 
 I am missing some
 
 CLK_OF_DECLARE(imx51, fsl,imx51-ccm, imx51_clocks_init);
 CLK_OF_DECLARE(imx53, fsl,imx53-ccm, imx53_clocks_init);
 
 Somewhere.
 
 Sascha,
 
 you are right, I forgot to add the two lines above as replacement for
 the now removed direct call. If the general approach is accepted, I'll
 add them for sure.
 
 Do imx51/imx53 still boot with CLK_OF_DECLARE added?

I can test this once the whole series arrived here. So far I only have
6/16 and 10/17. I probably need at least 1/17.

Sascha


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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/33] ARM: ux500: Supply the I2C clocks lookup to the DBX500 DT

2013-08-20 Thread Linus Walleij
On Thu, Jun 6, 2013 at 2:16 PM, Lee Jones lee.jo...@linaro.org wrote:

 +++ b/arch/arm/boot/dts/dbx5x0.dtsi
 @@ -572,6 +572,8 @@
 v-i2c-supply = db8500_vape_reg;

 clock-frequency = 40;
 +   clocks = prcc_kclk 3 3, prcc_pclk 3 3;
 +   clock-names = nmk-i2c.0, apb_pclk;

To avoid confusing the clock name nmk-i2c.0 with the device
name in Linux of that device instance, can we use a name such
that it is clear that this is not a dev_name match?

i2c0 works just fine as name I think?

Linus
--
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] iio: adc: Add bindigs documentation for twl6030 GPADC

2013-08-20 Thread Mark Rutland
Hi Oleksandr,

[Adding Jonathan Cameron and Guenter Roeck to Cc]

Apologies for the delay replying to this. In attempting to verify this
made sense I went and read the IIO bindings documentation, and I'm
somewhat confused by the model.

As far as I can see, the only consumer of IIO channels is the
iio-hwmon binding, which seems to be a binding for Linux-specific
infrastructure rather than any actual device. This runs counter to the
way DT is supposed to function (describing the hardware rather than how
it's used). As far as I can see, this linkage is described because only
a subset of the ADCs on the device are actually wired to something?

I also see a couple of IIO bindings (adi,adf435x*, and adi,ad7303)
which don't describe any iio channel cells at all, so I'm somewhat
confused by what the IIO channels actually represent, and why they must
be consumed elsewhere. As far as I can see, an IIO channel represents a
single ADC's registers in an IIO device, so I'm not sure why this must
be exported via the channel concept -- it's not physically wired.

Have I misunderstood something here?

Thanks,
Mark.

On Mon, Aug 19, 2013 at 12:29:25PM +0100, Oleksandr Kozaruk wrote:
 Add required documentation for twl6030 GPADC device tree
 bindings.
 
 Signed-off-by: Oleksandr Kozaruk oleksandr.koza...@ti.com
 ---
  .../devicetree/bindings/iio/adc/twl6030-gpadc.txt  | 45 
 ++
  1 file changed, 45 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/iio/adc/twl6030-gpadc.txt
 
 diff --git a/Documentation/devicetree/bindings/iio/adc/twl6030-gpadc.txt 
 b/Documentation/devicetree/bindings/iio/adc/twl6030-gpadc.txt
 new file mode 100644
 index 000..6cd3ef3
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/iio/adc/twl6030-gpadc.txt
 @@ -0,0 +1,45 @@
 +Texas Instruments twl6030/twl6032 GPADC device driver
 +
 +Required properties:
 + - compatible: must be ti,twl6030-gpadc for TWL6030 or
 +   ti,twl6032-gpadc for TWL6032
 + - interrupts: interrupt number associated with it
 + - #io-channel-cells: must be 1 - multiple IIO outputs are present
 +   iio consumers can use following io-channels:
 + twl6030:
 + 0 - battery type
 + 1 - battery temperature resistor value
 + 2 - audio accessory/general purpose
 + 3 - general purpose
 + 4 - temperature/general purpose
 + 5 - general purpose
 + 6 - general purpose
 + 7 - main battery
 + 8 - backup battery
 + 9 - charger input
 + 10 - VBUS
 + 11 - VBUS charging current
 + 14 - USB ID
 + twl6032:
 + 0 - battery type
 + 1 - battery temperature resistor value
 + 2 - audio accessory/general purpose
 + 3 - temperature with external diode/general purpose
 + 4 - temperature/general purpose
 + 5 - general purpose
 + 6 - general purpose
 + 7 - system supply
 + 8 - backup battery
 + 9 - charger input
 + 10 - VBUS
 + 11 - VBUS charging current
 + 14 - USB ID
 + 17 - battery charging current
 + 18 - battery voltage
 +
 +Example:
 + adc {
 + compatible = ti,twl6030-gpadc;
 + interrupts = 3;
 + #io-channel-cells = 1;
 + };
 -- 
 1.8.1.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/


Re: [PATCH 1/7] PCI: tegra: replace devm_request_and_ioremap by devm_ioremap_resource

2013-08-20 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr

Use devm_ioremap_resource instead of devm_request_and_ioremap.

This was done using the semantic patch
scripts/coccinelle/api/devm_ioremap_resource.cocci

Error-handling code was manually removed from the associated calls to
platform_get_resource.

Adjust the comment at the third platform_get_resource_byname to make clear
why ioremap is not done at this point.

Signed-off-by: Julia Lawall julia.law...@lip6.fr
Acked-by: Thierry Reding thierry.red...@gmail.com
Tested-by: Thierry Reding thierry.red...@gmail.com

---
v2: add the change to the comment

 drivers/pci/host/pci-tegra.c |   31 ++-
 1 file changed, 10 insertions(+), 21 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 7356741..2e9888a 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -1031,32 +1031,21 @@ static int tegra_pcie_get_resources(struct tegra_pcie 
*pcie)
return err;
}

-   /* request and remap controller registers */
pads = platform_get_resource_byname(pdev, IORESOURCE_MEM, pads);
-   if (!pads) {
-   err = -EADDRNOTAVAIL;
+   pcie-pads = devm_ioremap_resource(pdev-dev, pads);
+   if (IS_ERR(pcie-pads)) {
+   err = PTR_ERR(pcie-pads);
goto poweroff;
}

afi = platform_get_resource_byname(pdev, IORESOURCE_MEM, afi);
-   if (!afi) {
-   err = -EADDRNOTAVAIL;
-   goto poweroff;
-   }
-
-   pcie-pads = devm_request_and_ioremap(pdev-dev, pads);
-   if (!pcie-pads) {
-   err = -EADDRNOTAVAIL;
-   goto poweroff;
-   }
-
-   pcie-afi = devm_request_and_ioremap(pdev-dev, afi);
-   if (!pcie-afi) {
-   err = -EADDRNOTAVAIL;
+   pcie-afi = devm_ioremap_resource(pdev-dev, afi);
+   if (IS_ERR(pcie-afi)) {
+   err = PTR_ERR(pcie-afi);
goto poweroff;
}

-   /* request and remap configuration space */
+   /* request configuration space, but remap later, on demand */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, cs);
if (!res) {
err = -EADDRNOTAVAIL;
@@ -1492,9 +1481,9 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
rp-lanes = value;
rp-pcie = pcie;

-   rp-base = devm_request_and_ioremap(pcie-dev, rp-regs);
-   if (!rp-base)
-   return -EADDRNOTAVAIL;
+   rp-base = devm_ioremap_resource(pcie-dev, rp-regs);
+   if (IS_ERR(rp-base))
+   return PTR_ERR(rp-base);

list_add_tail(rp-list, pcie-ports);
}
--
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 3/16] arch/arm/mach-ux500/cpu-db8500.c: Avoid using ARRAY_AND_SIZE(e) as a function argument

2013-08-20 Thread Linus Walleij
On Sun, Aug 11, 2013 at 6:51 PM, Julia Lawall julia.law...@lip6.fr wrote:

 From: Julia Lawall julia.law...@lip6.fr

 Replace ARRAY_AND_SIZE(e) in function argument position to avoid hiding the
 arity of the called function.

Patch applied.

Yours,
Linus Walleij
--
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] Soft limit rework

2013-08-20 Thread Michal Hocko
On Mon 19-08-13 12:35:12, Johannes Weiner wrote:
 On Tue, Jun 18, 2013 at 02:09:39PM +0200, Michal Hocko wrote:
  Hi,
  
  This is the fifth version of the patchset.
  
  Summary of versions:
  The first version has been posted here: 
  http://permalink.gmane.org/gmane.linux.kernel.mm/97973
  (lkml wasn't CCed at the time so I cannot find it in lwn.net
  archives). There were no major objections. 
 
 Except there are.

Good to know that late... It would have been much more helpful to have
such a principal feedback few months ago (this work is here since early
Jun).
 
  My primary test case was a parallel kernel build with 2 groups (make
  is running with -j4 with a distribution .config in a separate cgroup
  without any hard limit) on a 8 CPU machine booted with 1GB memory.  I
  was mostly interested in 2 setups. Default - no soft limit set and - and
  0 soft limit set to both groups.
  The first one should tell us whether the rework regresses the default
  behavior while the second one should show us improvements in an extreme
  case where both workloads are always over the soft limit.
 
 Two kernel builds with 1G of memory means that reclaim is purely
 trimming the cache every once in a while.  Changes in memory pressure
 are not measurable up to a certain point, because whether you trim old
 cache or not does not affect the build jobs.
 
 Also you tested the no-softlimit case and an extreme soft limit case.
 Where are the common soft limit cases?

v5.1 had some more tests. I have added soft limitted stream IO resp. kbuild vs
unlimitted mem_eater loads. Have you checked those?

[...]
  So to wrap this up. The series is still doing good and improves the soft
  limit.
 
 The soft limit tree is a bunch of isolated code that's completely
 straight-forward.  This is replaced by convoluted memcg iterators,
 convoluted lruvec shrinkers, spreading even more memcg callbacks with
 questionable semantics into already complicated generic reclaim code.

I was trying to keep the convolution into vmscan as small as possible.
Maybe it can get reduced even more. I will think about it.

Predicate for memcg iterator has been added to address your concern
about a potential regression with too many groups. And that looked like
the least convoluting solution.

 This series considerably worsens readability and maintainability of
 both the generic reclaim code as well as the memcg counterpart of it.

I am really surprised that you are coming with this concerns that late.
This code has been posted quite some ago, hasn't it? We have even had
that calm discussion with Tejun about predicates and you were silent
at the time.

 The point of naturalizing the memcg code is to reduce data structures
 and redundancy and to break open opaque interfaces like do soft
 reclaim and report back.  But you didn't actually reduce complexity,
 you added even more opaque callbacks (should_soft_reclaim?
 soft_reclaim_eligible?).  You didn't integrate soft limit into generic
 reclaim code, you just made the soft limit API more complicated.

I can certainly think about simplifications. But it would be nicer if
you were more specific on the more complicated part. The soft reclaim
is a natural part of the reclaim now. Which I find as an improvement.
Do some memcg magic and get back was a bad idea IMO.
Hiding the soft limit decisions into the iterators as a searching
criteria doesn't sound as a totally bad idea to me. Soft limit is an
additional criteria who to reclaim, isn't it?
Well, I could have open coded it but that would mean a more code into
vmscan or getting back to call some memcg magic and get back to me.

 And, as I mentioned repeatedly in previous submissions, your benchmark
 numbers don't actually say anything useful about this change.

I would really welcome suggestions for improvements. I have tried The
most interesting test case would be how it behaves if some groups are
over the soft limits while others are not. with v5.1 where I had
memeater unlimited and kbuild resp. stream IO being limited. 

 I'm against merging this upstream at this point.

Can we at least find some middle ground here? The way how the current
soft limit is done is a disaster. Ditching the whole series sounds like
a step back to me.
-- 
Michal Hocko
SUSE Labs
--
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 06/17] ARM: imx: remove custom .init_time hook

2013-08-20 Thread Sebastian Hesselbarth

On 08/20/2013 11:10 AM, Sascha Hauer wrote:

On Tue, Aug 20, 2013 at 10:48:44AM +0200, Sebastian Hesselbarth wrote:

On 08/20/2013 09:26 AM, Sascha Hauer wrote:

On i.MX5 the init_time hook calls mx5x_clocks_init_dt which calls
mx5x_clocks_init which not only calls of_clk_init() but also registers
all clocks in the system. You can't remove it.

I am missing some

CLK_OF_DECLARE(imx51, fsl,imx51-ccm, imx51_clocks_init);
CLK_OF_DECLARE(imx53, fsl,imx53-ccm, imx53_clocks_init);

Somewhere.


Sascha,

you are right, I forgot to add the two lines above as replacement for
the now removed direct call. If the general approach is accepted, I'll
add them for sure.

Do imx51/imx53 still boot with CLK_OF_DECLARE added?


I can test this once the whole series arrived here. So far I only have
6/16 and 10/17. I probably need at least 1/17.


Yeah, I am having troubles with linux-arm-kernel rejecting my mails
because of a suspicious header. I have no clue, what has changed lately
with my mails sent by git send-email to make them get stuck.

I didn't add all sub-arch maintainers to the whole set, that would
have been simply too many.

You need patches [1], [2], and 6 for imx which I will send a v2 in
a second. Ok for you to get them from lkml?

Sebastian

[1] https://lkml.org/lkml/2013/8/19/591
[2] https://lkml.org/lkml/2013/8/19/592

--
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/8] ARM: at91: move peripheral id definitions to dt-bindings include dir

2013-08-20 Thread Richard Genoud
2013/8/19 Nicolas Ferre nicolas.fe...@atmel.com:
 On 08/08/2013 06:09, boris brezillon :

 Hello Arnd,

 On 07/08/2013 22:24, Arnd Bergmann wrote:

 On Thursday 01 August 2013, Boris BREZILLON wrote:

 This patch moves peripheral id definitions from machine specific include
 dir (arch/arm/mach-at91/include/mach/'soc-name'.h) to dt-bindinds
 include
 dir (include/dt-bindings/at91/'soc-name'/peripherals.h).

 These definitions will be used inside dt to define interrupt ids and
 peripheral clk ids.

 Signed-off-by: Boris BREZILLON b.brezil...@overkiz.com

 This seems counterproductive, why would you do that?


 This was requested by Jean-Christophe Plagniol-Villard (and proposed by
 Richard Genoud)
 for the 3rd version of the ARM: at91: move to common clk framework
 patch series (see
 https://lkml.org/lkml/2013/7/29/361) and thought it was a good idea too
 (even if I didn't know
 where to put the macro files as there are no soc specific macro files in
 dt-bindings include
 dir).

 Indeed I found it much easier to detect bugs in dt definition using
 macros because
 the macro names and dt node names are the same (it does not protect
 against errors
 in the macro definitions).

 If you think these macro definitions should be dropped, I won't argue
 against this.
 But please, have a talk with Jean-Christophe first.


 [..]


 There is no sharing of identifiers across SoCs here, you just move the
 data around, and changing the .dts files to use the abstract macros would
 just end up making them harder to understand, not easier, since you then
 have to look up the numbers in another file.


 Boris, Jean-Christophe and Richard,

 Well, I must say that I do agree with Arnd on this point.

 I think that a simple numeric field in a cell has to be represented as a
 number and even if this simple information is used twice (interrupt number
 and clock bit position in PMC). The possibility of error is very low
 compared to the big amount of unneeded definitions added by this solution.

Well, maybe the use of macro there is a bit overkill...
But after reviewing the patches (and found an error), I thought it was
useful to use macros, because verifying each number according to the
SoC manual is a pain !
It's way easier to check the header once for all, then there's no
possible error in the dtsi (or at least, we can see it from far far
away...)
On the downside, I agree, it adds a lot of defines. (and once it has
been validated, the dtsi should not change)

my 2 cents...
--
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/


[RFC v2] ARM: imx: remove custom .init_time hook

2013-08-20 Thread Sebastian Hesselbarth
With arch/arm calling of_clk_init(NULL) from time_init(), we can now
remove custom .init_time hooks.

Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com
---
Notes:
- Although mx5_clocks_common_init() is shared with non-DT, removing
  of_clk_init(NULL) should be fine, as it only registers DT clk providers.
- For imx6q, printing of silicon revision has been moved from .init_time
  to .init_machine hook.

Changelog:
v1-v2:
- added missing CLK_OF_DECLARE for imx51 and imx53 (Reported by Sascha Hauer)
  mx53_clocks_init can be converted as it is used DT only, mx51_clocks_init
  still is used by non-DT.

Cc: Russell King li...@arm.linux.org.uk
Cc: Arnd Bergmann a...@arndb.de
Cc: Sascha Hauer ker...@pengutronix.de
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-imx/clk-imx51-imx53.c |   29 ++---
 arch/arm/mach-imx/common.h  |4 
 arch/arm/mach-imx/imx51-dt.c|6 --
 arch/arm/mach-imx/mach-imx53.c  |6 --
 arch/arm/mach-imx/mach-imx6q.c  |   14 +++---
 arch/arm/mach-imx/mach-imx6sl.c |7 ---
 arch/arm/mach-imx/mach-vf610.c  |9 -
 7 files changed, 13 insertions(+), 62 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c 
b/arch/arm/mach-imx/clk-imx51-imx53.c
index 1a56a33..1b796db 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -11,6 +11,7 @@
 #include linux/clk.h
 #include linux/io.h
 #include linux/clkdev.h
+#include linux/clk-provider.h
 #include linux/of.h
 #include linux/err.h
 
@@ -131,8 +132,6 @@ static void __init mx5_clocks_common_init(unsigned long 
rate_ckil,
 {
int i;
 
-   of_clk_init(NULL);
-
clk[dummy] = imx_clk_fixed(dummy, 0);
clk[ckil] = imx_obtain_fixed_clock(ckil, rate_ckil);
clk[osc] = imx_obtain_fixed_clock(osc, rate_osc);
@@ -465,12 +464,16 @@ int __init mx51_clocks_init(unsigned long rate_ckil, 
unsigned long rate_osc,
return 0;
 }
 
-int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
-   unsigned long rate_ckih1, unsigned long rate_ckih2)
+static void __init mx51_clocks_init_dt(struct device_node *np)
+{
+   mx51_clocks_init(0, 0, 0, 0);
+}
+CLK_OF_DECLARE(imx51_ccm, fsl,imx51-ccm, mx51_clocks_init_dt);
+
+static void __init mx53_clocks_init(struct device_node *np)
 {
int i;
unsigned long r;
-   struct device_node *np;
 
clk[pll1_sw] = imx_clk_pllv2(pll1_sw, osc, MX53_DPLL1_BASE);
clk[pll2_sw] = imx_clk_pllv2(pll2_sw, osc, MX53_DPLL2_BASE);
@@ -529,12 +532,11 @@ int __init mx53_clocks_init(unsigned long rate_ckil, 
unsigned long rate_osc,
pr_err(i.MX53 clk %d: register failed with %ld\n,
i, PTR_ERR(clk[i]));
 
-   np = of_find_compatible_node(NULL, NULL, fsl,imx53-ccm);
clk_data.clks = clk;
clk_data.clk_num = ARRAY_SIZE(clk);
of_clk_add_provider(np, of_clk_src_onecell_get, clk_data);
 
-   mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2);
+   mx5_clocks_common_init(0, 0, 0, 0);
 
clk_register_clkdev(clk[vpu_gate], NULL, imx53-vpu.0);
clk_register_clkdev(clk[i2c3_gate], NULL, imx21-i2c.2);
@@ -566,16 +568,5 @@ int __init mx53_clocks_init(unsigned long rate_ckil, 
unsigned long rate_osc,
 
r = clk_round_rate(clk[usboh3_per_gate], 5400);
clk_set_rate(clk[usboh3_per_gate], r);
-
-   return 0;
-}
-
-int __init mx51_clocks_init_dt(void)
-{
-   return mx51_clocks_init(0, 0, 0, 0);
-}
-
-int __init mx53_clocks_init_dt(void)
-{
-   return mx53_clocks_init(0, 0, 0, 0);
 }
+CLK_OF_DECLARE(imx53_ccm, fsl,imx53-ccm, mx53_clocks_init);
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 4517fd7..28e8ca0 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -63,13 +63,9 @@ extern int mx31_clocks_init(unsigned long fref);
 extern int mx35_clocks_init(void);
 extern int mx51_clocks_init(unsigned long ckil, unsigned long osc,
unsigned long ckih1, unsigned long ckih2);
-extern int mx53_clocks_init(unsigned long ckil, unsigned long osc,
-   unsigned long ckih1, unsigned long ckih2);
 extern int mx25_clocks_init_dt(void);
 extern int mx27_clocks_init_dt(void);
 extern int mx31_clocks_init_dt(void);
-extern int mx51_clocks_init_dt(void);
-extern int mx53_clocks_init_dt(void);
 extern struct platform_device *mxc_register_gpio(char *name, int id,
resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
 extern void mxc_set_cpu_type(unsigned int type);
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index 53e43e5..bece8a6 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -34,17 +34,11 @@ static const char *imx51_dt_board_compat[] __initdata = {
 

Re: [PATCH] i2c: move of helpers into the core

2013-08-20 Thread Mika Westerberg
[Added Jerry as he found out a problem when acpi_i2c is being build as a
module, this should solve it as well.]

On Tue, Aug 20, 2013 at 01:25:27AM +0200, Rafael J. Wysocki wrote:
 On Monday, August 19, 2013 04:56:19 PM Stephen Warren wrote:
  On 08/19/2013 05:04 PM, Rafael J. Wysocki wrote:
   On Monday, August 19, 2013 03:19:18 PM Wolfram Sang wrote:
   I2C of helpers used to live in of_i2c.c but experience (from SPI) shows
   that it is much cleaner to have this in the core. This also removes a
   circular dependency between the helpers and the core, and so we can
   finally register child nodes in the core instead of doing this manually
   in each driver. So, fix the drivers and documentation, too.
   
   Perhaps we should do the analogous for ACPI then?

Here is the ACPI version based on the current patch from Wolfram (there is
a compile error because of missing dummy implementation of
of_i2c_register_devices())

From: Mika Westerberg mika.westerb...@linux.intel.com
Subject: [PATCH] i2c: move ACPI helpers into the core

This follows what has already been done for the DeviceTree helpers. Move
the ACPI helpers from drivers/acpi/acpi_i2c.c to the I2C core and update
documentation accordingly.

This also solves a problem reported by Jerry Snitselaar that we can't build
the ACPI I2C helpers as a module.

Signed-off-by: Mika Westerberg mika.westerb...@linux.intel.com
---
 Documentation/acpi/enumeration.txt  |  15 +---
 drivers/acpi/Kconfig|   6 --
 drivers/acpi/Makefile   |   1 -
 drivers/acpi/acpi_i2c.c | 103 
 drivers/i2c/busses/i2c-designware-platdrv.c |   1 -
 drivers/i2c/i2c-core.c  |  91 
 include/linux/i2c.h |   6 --
 7 files changed, 94 insertions(+), 129 deletions(-)
 delete mode 100644 drivers/acpi/acpi_i2c.c

diff --git a/Documentation/acpi/enumeration.txt 
b/Documentation/acpi/enumeration.txt
index 958266e..d98 100644
--- a/Documentation/acpi/enumeration.txt
+++ b/Documentation/acpi/enumeration.txt
@@ -228,18 +228,9 @@ ACPI handle like:
 I2C serial bus support
 ~~
 The slaves behind I2C bus controller only need to add the ACPI IDs like
-with the platform and SPI drivers. However the I2C bus controller driver
-needs to call acpi_i2c_register_devices() after it has added the adapter.
-
-An I2C bus (controller) driver does:
-
-   ...
-   ret = i2c_add_numbered_adapter(adapter);
-   if (ret)
-   /* handle error */
-
-   /* Enumerate the slave devices behind this bus via ACPI */
-   acpi_i2c_register_devices(adapter);
+with the platform and SPI drivers. The I2C core automatically enumerates
+any slave devices behind the controller device once the adapter is
+registered.
 
 Below is an example of how to add ACPI support to the existing mpu3050
 input driver:
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 100bd72..4e0162f 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -180,12 +180,6 @@ config ACPI_DOCK
  This driver supports ACPI-controlled docking stations and removable
  drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
-config ACPI_I2C
-   def_tristate I2C
-   depends on I2C
-   help
- ACPI I2C enumeration support.
-
 config ACPI_PROCESSOR
tristate Processor
select THERMAL
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 81dbeb8..cdaf68b 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -73,7 +73,6 @@ obj-$(CONFIG_ACPI_HED)+= hed.o
 obj-$(CONFIG_ACPI_EC_DEBUGFS)  += ec_sys.o
 obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
 obj-$(CONFIG_ACPI_BGRT)+= bgrt.o
-obj-$(CONFIG_ACPI_I2C) += acpi_i2c.o
 
 # processor has its own processor. module_param namespace
 processor-y:= processor_driver.o processor_throttling.o
diff --git a/drivers/acpi/acpi_i2c.c b/drivers/acpi/acpi_i2c.c
deleted file mode 100644
index a82c762..000
--- a/drivers/acpi/acpi_i2c.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * ACPI I2C enumeration support
- *
- * Copyright (C) 2012, Intel Corporation
- * Author: Mika Westerberg mika.westerb...@linux.intel.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.
- */
-
-#include linux/acpi.h
-#include linux/device.h
-#include linux/export.h
-#include linux/i2c.h
-#include linux/ioport.h
-
-ACPI_MODULE_NAME(i2c);
-
-static int acpi_i2c_add_resource(struct acpi_resource *ares, void *data)
-{
-   struct i2c_board_info *info = data;
-
-   if (ares-type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {
-   struct acpi_resource_i2c_serialbus *sb;
-
-   sb = ares-data.i2c_serial_bus;
-   if (sb-type == 

Re: Build regressions/improvements in v3.11-rc6

2013-08-20 Thread Geert Uytterhoeven
On Tue, 20 Aug 2013, Geert Uytterhoeven wrote:
 JFYI, when comparing v3.11-rc6 to v3.11-rc5[3], the summaries are:
   - build errors: +6/-9

  + arch/powerpc/kvm/book3s_xics.c: error: implicit declaration of function 
'get_tb' [-Werror=implicit-function-declaration]:  = 812:3

powerpc-randconfig

  + error: No rule to make target /etc/sound/dsp001.ld:  = N/A

i386-randconfig

 [1] http://kisskb.ellerman.id.au/kisskb/head/6556/ (all 120 configs)
 [3] http://kisskb.ellerman.id.au/kisskb/head/6532/ (all 120 configs)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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 v4 18/19] cpufreq: pmac64-cpufreq: remove device tree parsing for cpu nodes

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Now that the cpu device registration initialises the of_node(if available)
appropriately for all the cpus, parsing here is redundant.

This patch removes all DT parsing and uses cpu-of_node instead.

Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Acked-by: Viresh Kumar viresh.ku...@linaro.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 drivers/cpufreq/pmac64-cpufreq.c | 47 ++--
 1 file changed, 11 insertions(+), 36 deletions(-)

diff --git a/drivers/cpufreq/pmac64-cpufreq.c b/drivers/cpufreq/pmac64-cpufreq.c
index 7ba4234..97b719f 100644
--- a/drivers/cpufreq/pmac64-cpufreq.c
+++ b/drivers/cpufreq/pmac64-cpufreq.c
@@ -22,6 +22,7 @@
 #include linux/init.h
 #include linux/completion.h
 #include linux/mutex.h
+#include linux/of_device.h
 #include asm/prom.h
 #include asm/machdep.h
 #include asm/irq.h
@@ -383,9 +384,8 @@ static struct cpufreq_driver g5_cpufreq_driver = {
 
 #ifdef CONFIG_PMAC_SMU
 
-static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
+static int __init g5_neo2_cpufreq_init(struct device_node *cpunode)
 {
-   struct device_node *cpunode;
unsigned int psize, ssize;
unsigned long max_freq;
char *freq_method, *volt_method;
@@ -405,20 +405,6 @@ static int __init g5_neo2_cpufreq_init(struct device_node 
*cpus)
else
return -ENODEV;
 
-   /* Get first CPU node */
-   for (cpunode = NULL;
-(cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
-   const u32 *reg = of_get_property(cpunode, reg, NULL);
-   if (reg == NULL || (*reg) != 0)
-   continue;
-   if (!strcmp(cpunode-type, cpu))
-   break;
-   }
-   if (cpunode == NULL) {
-   printk(KERN_ERR cpufreq: Can't find any CPU 0 node\n);
-   return -ENODEV;
-   }
-
/* Check 970FX for now */
valp = of_get_property(cpunode, cpu-version, NULL);
if (!valp) {
@@ -537,9 +523,9 @@ static int __init g5_neo2_cpufreq_init(struct device_node 
*cpus)
 #endif /* CONFIG_PMAC_SMU */
 
 
-static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
+static int __init g5_pm72_cpufreq_init(struct device_node *cpunode)
 {
-   struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL;
+   struct device_node *cpuid = NULL, *hwclock = NULL;
const u8 *eeprom = NULL;
const u32 *valp;
u64 max_freq, min_freq, ih, il;
@@ -548,17 +534,6 @@ static int __init g5_pm72_cpufreq_init(struct device_node 
*cpus)
DBG(cpufreq: Initializing for PowerMac7,2, PowerMac7,3 and
 RackMac3,1...\n);
 
-   /* Get first CPU node */
-   for (cpunode = NULL;
-(cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
-   if (!strcmp(cpunode-type, cpu))
-   break;
-   }
-   if (cpunode == NULL) {
-   printk(KERN_ERR cpufreq: Can't find any CPU node\n);
-   return -ENODEV;
-   }
-
/* Lookup the cpuid eeprom node */
 cpuid = of_find_node_by_path(/u3@0,f800/i2c@f8001000/cpuid@a0);
if (cpuid != NULL)
@@ -718,25 +693,25 @@ static int __init g5_pm72_cpufreq_init(struct device_node 
*cpus)
 
 static int __init g5_cpufreq_init(void)
 {
-   struct device_node *cpus;
+   struct device_node *cpunode;
int rc = 0;
 
-   cpus = of_find_node_by_path(/cpus);
-   if (cpus == NULL) {
-   DBG(No /cpus node !\n);
+   /* Get first CPU node */
+   cpunode = of_cpu_device_node_get(0);
+   if (cpunode == NULL) {
+   pr_err(cpufreq: Can't find any CPU node\n);
return -ENODEV;
}
 
if (of_machine_is_compatible(PowerMac7,2) ||
of_machine_is_compatible(PowerMac7,3) ||
of_machine_is_compatible(RackMac3,1))
-   rc = g5_pm72_cpufreq_init(cpus);
+   rc = g5_pm72_cpufreq_init(cpunode);
 #ifdef CONFIG_PMAC_SMU
else
-   rc = g5_neo2_cpufreq_init(cpus);
+   rc = g5_neo2_cpufreq_init(cpunode);
 #endif /* CONFIG_PMAC_SMU */
 
-   of_node_put(cpus);
return rc;
 }
 
-- 
1.8.1.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/


Re: [PATCH 09/33] ARM: ux500: Supply the I2C clocks lookup to the DBX500 DT

2013-08-20 Thread Sascha Hauer
On Tue, Aug 20, 2013 at 11:11:19AM +0200, Linus Walleij wrote:
 On Thu, Jun 6, 2013 at 2:16 PM, Lee Jones lee.jo...@linaro.org wrote:
 
  +++ b/arch/arm/boot/dts/dbx5x0.dtsi
  @@ -572,6 +572,8 @@
  v-i2c-supply = db8500_vape_reg;
 
  clock-frequency = 40;
  +   clocks = prcc_kclk 3 3, prcc_pclk 3 3;
  +   clock-names = nmk-i2c.0, apb_pclk;

Why do most clocks in this series have the instance number in the clock
names? This looks very wrong to me.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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 v4 16/19] cpufreq: arm_big_little: remove device tree parsing for cpu nodes

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Now that the cpu device registration initialises the of_node(if available)
appropriately for all the cpus, parsing here is redundant.

This patch removes all DT parsing and uses cpu-of_node instead.

Acked-by: Viresh Kumar viresh.ku...@linaro.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 drivers/cpufreq/arm_big_little_dt.c | 40 +
 1 file changed, 14 insertions(+), 26 deletions(-)

diff --git a/drivers/cpufreq/arm_big_little_dt.c 
b/drivers/cpufreq/arm_big_little_dt.c
index fd9e3ea..480c0bd 100644
--- a/drivers/cpufreq/arm_big_little_dt.c
+++ b/drivers/cpufreq/arm_big_little_dt.c
@@ -19,12 +19,11 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME :  fmt
 
-#include linux/cpu.h
 #include linux/cpufreq.h
 #include linux/device.h
 #include linux/export.h
 #include linux/module.h
-#include linux/of.h
+#include linux/of_device.h
 #include linux/opp.h
 #include linux/platform_device.h
 #include linux/slab.h
@@ -34,27 +33,13 @@
 /* get cpu node with valid operating-points */
 static struct device_node *get_cpu_node_with_valid_op(int cpu)
 {
-   struct device_node *np = NULL, *parent;
-   int count = 0;
+   struct device_node *np = of_cpu_device_node_get(cpu);
 
-   parent = of_find_node_by_path(/cpus);
-   if (!parent) {
-   pr_err(failed to find OF /cpus\n);
-   return NULL;
+   if (!of_get_property(np, operating-points, NULL)) {
+   of_node_put(np);
+   np = NULL;
}
 
-   for_each_child_of_node(parent, np) {
-   if (count++ != cpu)
-   continue;
-   if (!of_get_property(np, operating-points, NULL)) {
-   of_node_put(np);
-   np = NULL;
-   }
-
-   break;
-   }
-
-   of_node_put(parent);
return np;
 }
 
@@ -63,11 +48,12 @@ static int dt_init_opp_table(struct device *cpu_dev)
struct device_node *np;
int ret;
 
-   np = get_cpu_node_with_valid_op(cpu_dev-id);
-   if (!np)
-   return -ENODATA;
+   np = of_node_get(cpu_dev-of_node);
+   if (!np) {
+   pr_err(failed to find cpu%d node\n, cpu_dev-id);
+   return -ENOENT;
+   }
 
-   cpu_dev-of_node = np;
ret = of_init_opp_table(cpu_dev);
of_node_put(np);
 
@@ -79,9 +65,11 @@ static int dt_get_transition_latency(struct device *cpu_dev)
struct device_node *np;
u32 transition_latency = CPUFREQ_ETERNAL;
 
-   np = get_cpu_node_with_valid_op(cpu_dev-id);
-   if (!np)
+   np = of_node_get(cpu_dev-of_node);
+   if (!np) {
+   pr_info(Failed to find cpu node. Use CPUFREQ_ETERNAL 
transition latency\n);
return CPUFREQ_ETERNAL;
+   }
 
of_property_read_u32(np, clock-latency, transition_latency);
of_node_put(np);
-- 
1.8.1.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 v4 19/19] cpufreq: pmac32-cpufreq: remove device tree parsing for cpu nodes

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Now that the cpu device registration initialises the of_node(if available)
appropriately for all the cpus, parsing here is redundant.

This patch removes DT parsing and uses cpu-of_node instead.

Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Acked-by: Viresh Kumar viresh.ku...@linaro.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 drivers/cpufreq/pmac32-cpufreq.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c
index 3104fad..56bfb6f 100644
--- a/drivers/cpufreq/pmac32-cpufreq.c
+++ b/drivers/cpufreq/pmac32-cpufreq.c
@@ -25,6 +25,7 @@
 #include linux/init.h
 #include linux/device.h
 #include linux/hardirq.h
+#include linux/of_device.h
 #include asm/prom.h
 #include asm/machdep.h
 #include asm/irq.h
@@ -649,8 +650,8 @@ static int __init pmac_cpufreq_setup(void)
if (strstr(cmd_line, nocpufreq))
return 0;
 
-   /* Assume only one CPU */
-   cpunode = of_find_node_by_type(NULL, cpu);
+   /* Get first CPU node */
+   cpunode = of_cpu_device_node_get(0);
if (!cpunode)
goto out;
 
-- 
1.8.1.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 v4 13/19] cpufreq: highbank-cpufreq: remove device tree parsing for cpu nodes

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Now that the cpu device registration initialises the of_node(if available)
appropriately for all the cpus, parsing here is redundant.

This patch removes all DT parsing and uses cpu-of_node instead.

Cc: Mark Langsdorf mark.langsd...@calxeda.com
Acked-by: Rob Herring rob.herr...@calxeda.com
Acked-by: Viresh Kumar viresh.ku...@linaro.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 drivers/cpufreq/highbank-cpufreq.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/cpufreq/highbank-cpufreq.c 
b/drivers/cpufreq/highbank-cpufreq.c
index b61b5a3..794123f 100644
--- a/drivers/cpufreq/highbank-cpufreq.c
+++ b/drivers/cpufreq/highbank-cpufreq.c
@@ -69,23 +69,17 @@ static int hb_cpufreq_driver_init(void)
if (!of_machine_is_compatible(calxeda,highbank))
return -ENODEV;
 
-   for_each_child_of_node(of_find_node_by_path(/cpus), np)
-   if (of_get_property(np, operating-points, NULL))
-   break;
-
-   if (!np) {
-   pr_err(failed to find highbank cpufreq node\n);
-   return -ENOENT;
-   }
-
cpu_dev = get_cpu_device(0);
if (!cpu_dev) {
pr_err(failed to get highbank cpufreq device\n);
-   ret = -ENODEV;
-   goto out_put_node;
+   return -ENODEV;
}
 
-   cpu_dev-of_node = np;
+   np = of_node_get(cpu_dev-of_node);
+   if (!np) {
+   pr_err(failed to find highbank cpufreq node\n);
+   return -ENOENT;
+   }
 
cpu_clk = clk_get(cpu_dev, NULL);
if (IS_ERR(cpu_clk)) {
-- 
1.8.1.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 v4 17/19] cpufreq: maple-cpufreq: remove device tree parsing for cpu nodes

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Now that the cpu device registration initialises the of_node(if available)
appropriately for all the cpus, parsing here is redundant.

This patch removes all DT parsing and uses cpu-of_node instead.

Cc: Dmitry Eremin-Solenikov dbarysh...@gmail.com
Acked-by: Viresh Kumar viresh.ku...@linaro.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 drivers/cpufreq/maple-cpufreq.c | 23 +++
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/drivers/cpufreq/maple-cpufreq.c b/drivers/cpufreq/maple-cpufreq.c
index cdd6291..f071dc4 100644
--- a/drivers/cpufreq/maple-cpufreq.c
+++ b/drivers/cpufreq/maple-cpufreq.c
@@ -24,7 +24,7 @@
 #include linux/completion.h
 #include linux/mutex.h
 #include linux/time.h
-#include linux/of.h
+#include linux/of_device.h
 
 #define DBG(fmt...) pr_debug(fmt)
 
@@ -201,7 +201,6 @@ static struct cpufreq_driver maple_cpufreq_driver = {
 
 static int __init maple_cpufreq_init(void)
 {
-   struct device_node *cpus;
struct device_node *cpunode;
unsigned int psize;
unsigned long max_freq;
@@ -217,24 +216,11 @@ static int __init maple_cpufreq_init(void)
!of_machine_is_compatible(Momentum,Apache))
return 0;
 
-   cpus = of_find_node_by_path(/cpus);
-   if (cpus == NULL) {
-   DBG(No /cpus node !\n);
-   return -ENODEV;
-   }
-
/* Get first CPU node */
-   for (cpunode = NULL;
-(cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
-   const u32 *reg = of_get_property(cpunode, reg, NULL);
-   if (reg == NULL || (*reg) != 0)
-   continue;
-   if (!strcmp(cpunode-type, cpu))
-   break;
-   }
+   cpunode = of_cpu_device_node_get(0);
if (cpunode == NULL) {
printk(KERN_ERR cpufreq: Can't find any CPU 0 node\n);
-   goto bail_cpus;
+   goto bail_noprops;
}
 
/* Check 970FX for now */
@@ -290,14 +276,11 @@ static int __init maple_cpufreq_init(void)
rc = cpufreq_register_driver(maple_cpufreq_driver);
 
of_node_put(cpunode);
-   of_node_put(cpus);
 
return rc;
 
 bail_noprops:
of_node_put(cpunode);
-bail_cpus:
-   of_node_put(cpus);
 
return rc;
 }
-- 
1.8.1.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 v4 09/19] ARM: mvebu: remove device tree parsing for cpu nodes

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Currently set_secondary_cpus_clock assume the CPU logical ordering
and the MPDIR in DT are same, which is incorrect.

Since the CPU device nodes can be retrieved in the logical ordering
using the DT helper, we can remove the devices tree parsing.

This patch removes DT parsing by making use of of_get_cpu_node.

Cc: Andrew Lunn and...@lunn.ch
Cc: Jason Cooper ja...@lakedaemon.net
Acked-by: Gregory Clement gregory.clem...@free-electrons.com
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 arch/arm/mach-mvebu/platsmp.c | 51 +++
 1 file changed, 23 insertions(+), 28 deletions(-)

diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index ce81d30..594b63d 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -29,45 +29,40 @@
 #include pmsu.h
 #include coherency.h
 
+static struct clk *__init get_cpu_clk(int cpu)
+{
+   struct clk *cpu_clk;
+   struct device_node *np = of_get_cpu_node(cpu, NULL);
+
+   if (WARN(!np, missing cpu node\n))
+   return NULL;
+   cpu_clk = of_clk_get(np, 0);
+   if (WARN_ON(IS_ERR(cpu_clk)))
+   return NULL;
+   return cpu_clk;
+}
+
 void __init set_secondary_cpus_clock(void)
 {
-   int thiscpu;
+   int thiscpu, cpu;
unsigned long rate;
-   struct clk *cpu_clk = NULL;
-   struct device_node *np = NULL;
+   struct clk *cpu_clk;
 
thiscpu = smp_processor_id();
-   for_each_node_by_type(np, cpu) {
-   int err;
-   int cpu;
-
-   err = of_property_read_u32(np, reg, cpu);
-   if (WARN_ON(err))
-   return;
-
-   if (cpu == thiscpu) {
-   cpu_clk = of_clk_get(np, 0);
-   break;
-   }
-   }
-   if (WARN_ON(IS_ERR(cpu_clk)))
+   cpu_clk = get_cpu_clk(thiscpu);
+   if (!cpu_clk)
return;
clk_prepare_enable(cpu_clk);
rate = clk_get_rate(cpu_clk);
 
/* set all the other CPU clk to the same rate than the boot CPU */
-   for_each_node_by_type(np, cpu) {
-   int err;
-   int cpu;
-
-   err = of_property_read_u32(np, reg, cpu);
-   if (WARN_ON(err))
+   for_each_possible_cpu(cpu) {
+   if (cpu == thiscpu)
+   continue;
+   cpu_clk = get_cpu_clk(cpu);
+   if (!cpu_clk)
return;
-
-   if (cpu != thiscpu) {
-   cpu_clk = of_clk_get(np, 0);
-   clk_set_rate(cpu_clk, rate);
-   }
+   clk_set_rate(cpu_clk, rate);
}
 }
 
-- 
1.8.1.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 v4 14/19] cpufreq: spear-cpufreq: remove device tree parsing for cpu nodes

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Now that the cpu device registration initialises the of_node(if available)
appropriately for all the cpus, parsing here is redundant.

This patch removes all DT parsing and uses cpu-of_node instead.

Cc: Deepak Sikri sik...@qti.qualcomm.com
Acked-by: Viresh Kumar viresh.ku...@linaro.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 drivers/cpufreq/spear-cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c
index c3efa7f..19e364fa 100644
--- a/drivers/cpufreq/spear-cpufreq.c
+++ b/drivers/cpufreq/spear-cpufreq.c
@@ -18,7 +18,7 @@
 #include linux/err.h
 #include linux/init.h
 #include linux/module.h
-#include linux/of.h
+#include linux/of_device.h
 #include linux/slab.h
 #include linux/types.h
 
@@ -223,7 +223,7 @@ static int spear_cpufreq_driver_init(void)
const __be32 *val;
int cnt, i, ret;
 
-   np = of_find_node_by_path(/cpus/cpu@0);
+   np = of_cpu_device_node_get(0);
if (!np) {
pr_err(No cpu node found);
return -ENODEV;
-- 
1.8.1.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 v4 15/19] cpufreq: kirkwood-cpufreq: remove device tree parsing for cpu nodes

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Now that the cpu device registration initialises the of_node(if available)
appropriately for all the cpus, parsing here is redundant.

This patch removes all DT parsing and uses cpu-of_node instead.

Cc: Jason Cooper ja...@lakedaemon.net
Acked-by: Andrew Lunn and...@lunn.ch
Acked-by: Viresh Kumar viresh.ku...@linaro.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 drivers/cpufreq/kirkwood-cpufreq.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/kirkwood-cpufreq.c 
b/drivers/cpufreq/kirkwood-cpufreq.c
index c233ea6..25ac2cb 100644
--- a/drivers/cpufreq/kirkwood-cpufreq.c
+++ b/drivers/cpufreq/kirkwood-cpufreq.c
@@ -14,7 +14,7 @@
 #include linux/clk.h
 #include linux/clk-provider.h
 #include linux/cpufreq.h
-#include linux/of.h
+#include linux/of_device.h
 #include linux/platform_device.h
 #include linux/io.h
 #include asm/proc-fns.h
@@ -175,9 +175,11 @@ static int kirkwood_cpufreq_probe(struct platform_device 
*pdev)
if (IS_ERR(priv.base))
return PTR_ERR(priv.base);
 
-   np = of_find_node_by_path(/cpus/cpu@0);
-   if (!np)
+   np = of_cpu_device_node_get(0);
+   if (!np) {
+   dev_err(pdev-dev, failed to get cpu device node\n);
return -ENODEV;
+   }
 
priv.cpu_clk = of_clk_get_by_name(np, cpu_clk);
if (IS_ERR(priv.cpu_clk)) {
-- 
1.8.1.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 v4 03/19] powerpc: refactor of_get_cpu_node to support other architectures

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Currently different drivers requiring to access cpu device node are
parsing the device tree themselves. Since the ordering in the DT need
not match the logical cpu ordering, the parsing logic needs to consider
that. However, this has resulted in lots of code duplication and in some
cases even incorrect logic.

It's better to consolidate them by adding support for getting cpu
device node for a given logical cpu index in DT core library. However
logical to physical index mapping can be architecture specific.

PowerPC has it's own implementation to get the cpu node for a given
logical index.

This patch refactors the current implementation of of_get_cpu_node.
This in preparation to move the implementation to DT core library.
It separates out the logical to physical mapping so that a default
matching of the physical id to the logical cpu index can be added
when moved to common code. Architecture specific code can override it.

Cc: Rob Herring rob.herr...@calxeda.com
Cc: Grant Likely grant.lik...@linaro.org
Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 arch/powerpc/kernel/prom.c | 76 --
 1 file changed, 47 insertions(+), 29 deletions(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index eb23ac9..f7b8c0b 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -865,45 +865,63 @@ static int __init prom_reconfig_setup(void)
 __initcall(prom_reconfig_setup);
 #endif
 
+bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
+{
+   return (int)phys_id == get_hard_smp_processor_id(cpu);
+}
+
+static bool __of_find_n_match_cpu_property(struct device_node *cpun,
+   const char *prop_name, int cpu, unsigned int *thread)
+{
+   const __be32 *cell;
+   int ac, prop_len, tid;
+   u64 hwid;
+
+   ac = of_n_addr_cells(cpun);
+   cell = of_get_property(cpun, prop_name, prop_len);
+   if (!cell)
+   return false;
+   prop_len /= sizeof(*cell);
+   for (tid = 0; tid  prop_len; tid++) {
+   hwid = of_read_number(cell, ac);
+   if (arch_match_cpu_phys_id(cpu, hwid)) {
+   if (thread)
+   *thread = tid;
+   return true;
+   }
+   cell += ac;
+   }
+   return false;
+}
+
 /* Find the device node for a given logical cpu number, also returns the cpu
  * local thread number (index in ibm,interrupt-server#s) if relevant and
  * asked for (non NULL)
  */
 struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
 {
-   int hardid;
-   struct device_node *np;
+   struct device_node *cpun, *cpus;
 
-   hardid = get_hard_smp_processor_id(cpu);
+   cpus = of_find_node_by_path(/cpus);
+   if (!cpus) {
+   pr_warn(Missing cpus node, bailing out\n);
+   return NULL;
+   }
 
-   for_each_node_by_type(np, cpu) {
-   const u32 *intserv;
-   unsigned int plen, t;
+   for_each_child_of_node(cpus, cpun) {
+   if (of_node_cmp(cpun-type, cpu))
+   continue;
 
-   /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist
-* fallback to reg property and assume no threads
+   /* Check for non-standard ibm,ppc-interrupt-server#s property
+* for thread ids on PowerPC. If it doesn't exist fallback to
+* standard reg property.
 */
-   intserv = of_get_property(np, ibm,ppc-interrupt-server#s,
-   plen);
-   if (intserv == NULL) {
-   const u32 *reg = of_get_property(np, reg, NULL);
-   if (reg == NULL)
-   continue;
-   if (*reg == hardid) {
-   if (thread)
-   *thread = 0;
-   return np;
-   }
-   } else {
-   plen /= sizeof(u32);
-   for (t = 0; t  plen; t++) {
-   if (hardid == intserv[t]) {
-   if (thread)
-   *thread = t;
-   return np;
-   }
-   }
-   }
+   if (__of_find_n_match_cpu_property(cpun,
+   ibm,ppc-interrupt-server#s, cpu, thread))
+   return cpun;
+
+   if (__of_find_n_match_cpu_property(cpun, reg, cpu, thread))
+   return cpun;
}
return NULL;
 }
-- 
1.8.1.2


--
To unsubscribe from this list: send the line unsubscribe 

[PATCH v4 01/19] microblaze: remove undefined of_get_cpu_node declaration

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

This patch removes the declaration of the function 'of_get_cpu_node'
which is not defined for microblaze. This is in preparation to move
it's definition from PPC to DT common code.

Michal Simek says: it was just there because Microblaze
was based on powerpc code

Acked-by: Michal Simek mon...@monstr.eu
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 arch/microblaze/include/asm/prom.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/microblaze/include/asm/prom.h 
b/arch/microblaze/include/asm/prom.h
index 20c5e8e..9977816 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -50,9 +50,6 @@ void of_parse_dma_window(struct device_node *dn, const void 
*dma_window_prop,
 
 extern void kdump_move_device_tree(void);
 
-/* CPU OF node matching */
-struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
-
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 
-- 
1.8.1.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 v4 08/19] ARM: topology: remove hwid/MPIDR dependency from cpu_capacity

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Currently the topology code computes cpu capacity and stores it in
the list along with hwid(which is MPIDR) as it parses the CPU nodes
in the device tree. This is required as it needs to be mapped to the
logical CPU later.

Since the CPU device nodes can be retrieved in the logical ordering
using DT/OF helpers, its possible to store cpu_capacity also in logical
ordering and avoid storing hwid for each entry.

This patch removes hwid by making use of of_get_cpu_node.

Cc: Russell King li...@arm.linux.org.uk
Cc: Lorenzo Pieralisi lorenzo.pieral...@arm.com
Acked-by: Rob Herring rob.herr...@calxeda.com
Acked-by: Nicolas Pitre n...@linaro.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 arch/arm/kernel/topology.c | 61 +++---
 1 file changed, 19 insertions(+), 42 deletions(-)

diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index c5a5954..85a8737 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -74,12 +74,8 @@ struct cpu_efficiency table_efficiency[] = {
{NULL, },
 };
 
-struct cpu_capacity {
-   unsigned long hwid;
-   unsigned long capacity;
-};
-
-struct cpu_capacity *cpu_capacity;
+unsigned long *__cpu_capacity;
+#define cpu_capacity(cpu)  __cpu_capacity[cpu]
 
 unsigned long middle_capacity = 1;
 
@@ -100,15 +96,19 @@ static void __init parse_dt_topology(void)
unsigned long capacity = 0;
int alloc_size, cpu = 0;
 
-   alloc_size = nr_cpu_ids * sizeof(struct cpu_capacity);
-   cpu_capacity = kzalloc(alloc_size, GFP_NOWAIT);
+   alloc_size = nr_cpu_ids * sizeof(*__cpu_capacity);
+   __cpu_capacity = kzalloc(alloc_size, GFP_NOWAIT);
 
-   while ((cn = of_find_node_by_type(cn, cpu))) {
-   const u32 *rate, *reg;
+   for_each_possible_cpu(cpu) {
+   const u32 *rate;
int len;
 
-   if (cpu = num_possible_cpus())
-   break;
+   /* too early to use cpu-of_node */
+   cn = of_get_cpu_node(cpu, NULL);
+   if (!cn) {
+   pr_err(missing device node for CPU %d\n, cpu);
+   continue;
+   }
 
for (cpu_eff = table_efficiency; cpu_eff-compatible; cpu_eff++)
if (of_device_is_compatible(cn, cpu_eff-compatible))
@@ -124,12 +124,6 @@ static void __init parse_dt_topology(void)
continue;
}
 
-   reg = of_get_property(cn, reg, len);
-   if (!reg || len != 4) {
-   pr_err(%s missing reg property\n, cn-full_name);
-   continue;
-   }
-
capacity = ((be32_to_cpup(rate))  20) * cpu_eff-efficiency;
 
/* Save min capacity of the system */
@@ -140,13 +134,9 @@ static void __init parse_dt_topology(void)
if (capacity  max_capacity)
max_capacity = capacity;
 
-   cpu_capacity[cpu].capacity = capacity;
-   cpu_capacity[cpu++].hwid = be32_to_cpup(reg);
+   cpu_capacity(cpu) = capacity;
}
 
-   if (cpu  num_possible_cpus())
-   cpu_capacity[cpu].hwid = (unsigned long)(-1);
-
/* If min and max capacities are equals, we bypass the update of the
 * cpu_scale because all CPUs have the same capacity. Otherwise, we
 * compute a middle_capacity factor that will ensure that the capacity
@@ -154,9 +144,7 @@ static void __init parse_dt_topology(void)
 * SCHED_POWER_SCALE, which is the default value, but with the
 * constraint explained near table_efficiency[].
 */
-   if (min_capacity == max_capacity)
-   cpu_capacity[0].hwid = (unsigned long)(-1);
-   else if (4*max_capacity  (3*(max_capacity + min_capacity)))
+   if (4*max_capacity  (3*(max_capacity + min_capacity)))
middle_capacity = (min_capacity + max_capacity)
 (SCHED_POWER_SHIFT+1);
else
@@ -170,23 +158,12 @@ static void __init parse_dt_topology(void)
  * boot. The update of all CPUs is in O(n^2) for heteregeneous system but the
  * function returns directly for SMP system.
  */
-void update_cpu_power(unsigned int cpu, unsigned long hwid)
+void update_cpu_power(unsigned int cpu)
 {
-   unsigned int idx = 0;
-
-   /* look for the cpu's hwid in the cpu capacity table */
-   for (idx = 0; idx  num_possible_cpus(); idx++) {
-   if (cpu_capacity[idx].hwid == hwid)
-   break;
-
-   if (cpu_capacity[idx].hwid == -1)
-   return;
-   }
-
-   if (idx == num_possible_cpus())
+   if (!cpu_capacity(cpu))
return;
 
-   set_power_scale(cpu, cpu_capacity[idx].capacity / middle_capacity);
+   

[PATCH v4 12/19] cpufreq: cpufreq-cpu0: remove device tree parsing for cpu nodes

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Now that the cpu device registration initialises the of_node(if available)
appropriately for all the cpus, parsing here is redundant.

This patch removes all DT parsing and uses cpu-of_node instead.

Acked-by: Shawn Guo shawn@linaro.org
Acked-by: Rob Herring rob.herr...@calxeda.com
Acked-by: Viresh Kumar viresh.ku...@linaro.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 drivers/cpufreq/cpufreq-cpu0.c | 23 ---
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index ad1fde2..5b05c26 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -174,29 +174,17 @@ static struct cpufreq_driver cpu0_cpufreq_driver = {
 
 static int cpu0_cpufreq_probe(struct platform_device *pdev)
 {
-   struct device_node *np, *parent;
+   struct device_node *np;
int ret;
 
-   parent = of_find_node_by_path(/cpus);
-   if (!parent) {
-   pr_err(failed to find OF /cpus\n);
-   return -ENOENT;
-   }
-
-   for_each_child_of_node(parent, np) {
-   if (of_get_property(np, operating-points, NULL))
-   break;
-   }
+   cpu_dev = pdev-dev;
 
+   np = of_node_get(cpu_dev-of_node);
if (!np) {
pr_err(failed to find cpu0 node\n);
-   ret = -ENOENT;
-   goto out_put_parent;
+   return -ENOENT;
}
 
-   cpu_dev = pdev-dev;
-   cpu_dev-of_node = np;
-
cpu_reg = devm_regulator_get(cpu_dev, cpu0);
if (IS_ERR(cpu_reg)) {
/*
@@ -269,15 +257,12 @@ static int cpu0_cpufreq_probe(struct platform_device 
*pdev)
}
 
of_node_put(np);
-   of_node_put(parent);
return 0;
 
 out_free_table:
opp_free_cpufreq_table(cpu_dev, freq_table);
 out_put_node:
of_node_put(np);
-out_put_parent:
-   of_node_put(parent);
return ret;
 }
 
-- 
1.8.1.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 v4 02/19] openrisc: remove undefined of_get_cpu_node declaration

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

This patch removes the declaration of the function 'of_get_cpu_node'
which is not defined for openrisc. This is in preparation to move
it's definition from PPC to DT common code.

Again it could be there as it was originally copied from powerpc.

Cc: Jonas Bonn jo...@southpole.se
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 arch/openrisc/include/asm/prom.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/openrisc/include/asm/prom.h b/arch/openrisc/include/asm/prom.h
index bbb34e5..eb59bfe 100644
--- a/arch/openrisc/include/asm/prom.h
+++ b/arch/openrisc/include/asm/prom.h
@@ -44,9 +44,6 @@ void of_parse_dma_window(struct device_node *dn, const void 
*dma_window_prop,
 
 extern void kdump_move_device_tree(void);
 
-/* CPU OF node matching */
-struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
-
 /* Get the MAC address */
 extern const void *of_get_mac_address(struct device_node *np);
 
-- 
1.8.1.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/


[RFC PATCH v3] sched: Limit idle balance based on max cost per sched domain

2013-08-20 Thread Jason Low
Hi Peter,

So this is my sample implementation of the concept of matching the CPU's 
avg_idle 
with the maximum time we ever spend in a new idle load balance for each domain.
This is based on our previous patch which compares avg_idle with sd-avg_cost,
but I replaced sd-avg_cost with sd-max_cost.

Since we are comparing avg_idle with sd-max_cost, the existing avg_idle would 
not be accurate since it is limited based on migration_cost, so I increased the 
max avg_idle to 25*sched_migration_cost. Additionally, I updated avg_idle by 
calling update_avg() first. Then if the avg_idle exceeds the max, the avg_idle 
is set to the max. This is to prevent avg_idle from being set to the maximum 
after 1 long idle.

Since I have found idle balance to be beneficial when it is not failing to move 
tasks, I was thinking we can also not skip newidle balance (regardless of what 
avg_idle and max_cost are) if the previous attempt on the rq or domain 
succeeded in moving tasks. I was also wondering if we should periodically reset
the max cost. Both would require an extra field to be added to either the
rq or domain structure though.


Signed-off-by: Jason Low jason.l...@hp.com
---
 arch/metag/include/asm/topology.h |1 +
 include/linux/sched.h |1 +
 include/linux/topology.h  |3 +++
 kernel/sched/core.c   |9 +
 kernel/sched/fair.c   |   16 
 5 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/arch/metag/include/asm/topology.h 
b/arch/metag/include/asm/topology.h
index 23f5118..be400ad 100644
--- a/arch/metag/include/asm/topology.h
+++ b/arch/metag/include/asm/topology.h
@@ -26,6 +26,7 @@
.last_balance   = jiffies,  \
.balance_interval   = 1,\
.nr_balance_failed  = 0,\
+   .max_idle_balance_cost  = 0,\
 }
 
 #define cpu_to_node(cpu)   ((void)(cpu), 0)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index d722490..6e89421 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -818,6 +818,7 @@ struct sched_domain {
unsigned int nr_balance_failed; /* initialise to 0 */
 
u64 last_update;
+   u64 max_idle_balance_cost;
 
 #ifdef CONFIG_SCHEDSTATS
/* load_balance() stats */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index d3cf0d6..e3cfe88 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -106,6 +106,7 @@ int arch_update_cpu_topology(void);
.last_balance   = jiffies,  \
.balance_interval   = 1,\
.smt_gain   = 1178, /* 15% */   \
+   .max_idle_balance_cost  = 0,\
 }
 #endif
 #endif /* CONFIG_SCHED_SMT */
@@ -135,6 +136,7 @@ int arch_update_cpu_topology(void);
,   \
.last_balance   = jiffies,  \
.balance_interval   = 1,\
+   .max_idle_balance_cost  = 0,\
 }
 #endif
 #endif /* CONFIG_SCHED_MC */
@@ -166,6 +168,7 @@ int arch_update_cpu_topology(void);
,   \
.last_balance   = jiffies,  \
.balance_interval   = 1,\
+   .max_idle_balance_cost  = 0,\
 }
 #endif
 
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index b7c32cb..204e02c 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1343,12 +1343,13 @@ ttwu_do_wakeup(struct rq *rq, struct task_struct *p, 
int wake_flags)
 
if (rq-idle_stamp) {
u64 delta = rq_clock(rq) - rq-idle_stamp;
-   u64 max = 2*sysctl_sched_migration_cost;
+   u64 max = 25*sysctl_sched_migration_cost;
 
-   if (delta  max)
+   update_avg(rq-avg_idle, delta);
+
+   if (rq-avg_idle  max)
rq-avg_idle = max;
-   else
-   update_avg(rq-avg_idle, delta);
+
rq-idle_stamp = 0;
}
 #endif
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 9565645..1b76933 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5277,6 +5277,7 @@ void idle_balance(int this_cpu, struct rq *this_rq)
struct sched_domain *sd;
int pulled_task = 0;
unsigned long next_balance = jiffies + HZ;
+   u64 cost = 0;
 
this_rq-idle_stamp = rq_clock(this_rq);
 
@@ -5293,14 +5294,29 @@ void idle_balance(int this_cpu, struct rq *this_rq)
for_each_domain(this_cpu, sd) {
unsigned long interval;
int balance = 1;
+   u64 

[PATCH v4 11/19] cpufreq: imx6q-cpufreq: remove device tree parsing for cpu nodes

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Now that the cpu device registration initialises the of_node(if available)
appropriately for all the cpus, parsing here is redundant.

This patch removes all DT parsing and uses cpu-of_node instead.

Acked-by: Shawn Guo shawn@linaro.org
Acked-by: Viresh Kumar viresh.ku...@linaro.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 arch/arm/mach-imx/mach-imx6q.c  | 3 +--
 drivers/cpufreq/imx6q-cpufreq.c | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 7be13f8..a02f275 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -254,13 +254,12 @@ static void __init imx6q_opp_init(struct device *cpu_dev)
 {
struct device_node *np;
 
-   np = of_find_node_by_path(/cpus/cpu@0);
+   np = of_node_get(cpu_dev-of_node);
if (!np) {
pr_warn(failed to find cpu0 node\n);
return;
}
 
-   cpu_dev-of_node = np;
if (of_init_opp_table(cpu_dev)) {
pr_warn(failed to init OPP table\n);
goto put_node;
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index e37cdae..b16632b 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -221,14 +221,12 @@ static int imx6q_cpufreq_probe(struct platform_device 
*pdev)
 
cpu_dev = pdev-dev;
 
-   np = of_find_node_by_path(/cpus/cpu@0);
+   np = of_node_get(cpu_dev-of_node);
if (!np) {
dev_err(cpu_dev, failed to find cpu0 node\n);
return -ENOENT;
}
 
-   cpu_dev-of_node = np;
-
arm_clk = devm_clk_get(cpu_dev, arm);
pll1_sys_clk = devm_clk_get(cpu_dev, pll1_sys);
pll1_sw_clk = devm_clk_get(cpu_dev, pll1_sw);
-- 
1.8.1.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 v4 10/19] drivers/bus: arm-cci: avoid parsing DT for cpu device nodes

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Since the CPU device nodes can be retrieved using arch_of_get_cpu_node,
we can use it to avoid parsing the cpus node searching the cpu nodes and
mapping to logical index.

This patch removes parsing DT for cpu nodes by using of_get_cpu_node.

Cc: Lorenzo Pieralisi lorenzo.pieral...@arm.com
Acked-by: Nicolas Pitre n...@linaro.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 drivers/bus/arm-cci.c | 28 +++-
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
index 7332889..2009266 100644
--- a/drivers/bus/arm-cci.c
+++ b/drivers/bus/arm-cci.c
@@ -122,17 +122,8 @@ EXPORT_SYMBOL_GPL(cci_ace_get_port);
 
 static void __init cci_ace_init_ports(void)
 {
-   int port, ac, cpu;
-   u64 hwid;
-   const u32 *cell;
-   struct device_node *cpun, *cpus;
-
-   cpus = of_find_node_by_path(/cpus);
-   if (WARN(!cpus, Missing cpus node, bailing out\n))
-   return;
-
-   if (WARN_ON(of_property_read_u32(cpus, #address-cells, ac)))
-   ac = of_n_addr_cells(cpus);
+   int port, cpu;
+   struct device_node *cpun;
 
/*
 * Port index look-up speeds up the function disabling ports by CPU,
@@ -141,18 +132,13 @@ static void __init cci_ace_init_ports(void)
 * The stashed index array is initialized for all possible CPUs
 * at probe time.
 */
-   for_each_child_of_node(cpus, cpun) {
-   if (of_node_cmp(cpun-type, cpu))
-   continue;
-   cell = of_get_property(cpun, reg, NULL);
-   if (WARN(!cell, %s: missing reg property\n, cpun-full_name))
-   continue;
-
-   hwid = of_read_number(cell, ac);
-   cpu = get_logical_index(hwid  MPIDR_HWID_BITMASK);
+   for_each_possible_cpu(cpu) {
+   /* too early to use cpu-of_node */
+   cpun = of_get_cpu_node(cpu, NULL);
 
-   if (cpu  0 || !cpu_possible(cpu))
+   if (WARN(!cpun, Missing cpu device node\n))
continue;
+
port = __cci_ace_get_port(cpun, ACE_PORT);
if (port  0)
continue;
-- 
1.8.1.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/


Re: [PATCH] mc13xxx-ts: use zero as default value if no pdata was defined

2013-08-20 Thread Michael Grzeschik
On Tue, Aug 20, 2013 at 03:34:33AM +0200, Samuel Ortiz wrote:
 Hi Michael,
 
 On Tue, Aug 13, 2013 at 02:14:30PM +0200, Michael Grzeschik wrote:
  In case of devicetree, we currently don't have a way to append pdata for
  the touchscreen. The current approach is to bail out in that case.
  This patch makes it possible to probe the touchscreen without pdata
  and use zero as default values for the atox and ato adc conversion.
 Would that still make the touchscreen somehow functional ?

Yes, it still works. It just defaults to zero values in no pdata case.

 If that's the case, and if Dmitry is fine with the ts part of this
 patch, could you please separate the mfd part of this patch into a
 separate one ?

Why?

The purpose of this patch is to have both cases working, pdata and no
pdata. This patch is actually fixing the patch of Michael Thalmeier.
There we changed the mfd and touch in one patch as well.

http://lkml.indiana.edu/hypermail/linux/kernel/1201.1/01364.html

Thanks,
Michael

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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 v4 06/19] driver/core: cpu: initialize of_node in cpu's device struture

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

CPUs are also registered as devices but the of_node in these cpu
devices are not initialized. Currently different drivers requiring
to access cpu device node are parsing the nodes themselves and
initialising the of_node in cpu device.

The of_node in all the cpu devices needs to be initialized properly
and at one place. The best place to update this is CPU subsystem
driver when registering the cpu devices.

The OF/DT core library now provides of_get_cpu_node to retrieve a cpu
device node for a given logical index by abstracting the architecture
specific details.

This patch uses of_get_cpu_node to assign of_node when registering the
cpu devices.

Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Acked-by: Rob Herring rob.herr...@calxeda.com
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 drivers/base/cpu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 4c358bc..4cf0717 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -14,6 +14,7 @@
 #include linux/slab.h
 #include linux/percpu.h
 #include linux/acpi.h
+#include linux/of.h
 
 #include base.h
 
@@ -289,6 +290,7 @@ int register_cpu(struct cpu *cpu, int num)
cpu-dev.release = cpu_device_release;
cpu-dev.offline_disabled = !cpu-hotpluggable;
cpu-dev.offline = !cpu_online(num);
+   cpu-dev.of_node = of_get_cpu_node(num, NULL);
 #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
cpu-dev.bus-uevent = arch_cpu_uevent;
 #endif
-- 
1.8.1.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/


Re: [RFC PATCH] drm/radeon: rework to new fence interface

2013-08-20 Thread Maarten Lankhorst
Op 20-08-13 10:37, Christian König schreef:
 Am 19.08.2013 21:37, schrieb Maarten Lankhorst:
 Op 19-08-13 14:35, Christian König schreef:
 Am 19.08.2013 12:17, schrieb Maarten Lankhorst:
 [SNIP]
 @@ -190,25 +225,24 @@ void radeon_fence_process(struct radeon_device 
 *rdev, int ring)
}
} while (atomic64_xchg(rdev-fence_drv[ring].last_seq, seq)  seq);
-if (wake) {
 +if (wake)
rdev-fence_drv[ring].last_activity = jiffies;
 -wake_up_all(rdev-fence_queue);
 -}
 +return wake;
}
 Very bad idea, when sequence numbers change, you always want to wake up the 
 whole fence queue here.
 Yes, and the callers of this function call wake_up_all or wake_up_all_locked 
 themselves, based on the return value..

 And as I said that's a very bad idea. The fence processing shouldn't be 
 called with any locks held and should be self responsible for activating any 
 waiters.
The call point (enable_signaling) only needs to know whether its own counter 
has passed or not. This prevents the race where the counter
has elapsed, but the irq was not yet enabled.

I don't really care if enable_signaling updates last_seq or not, it only needs 
to check if it's own fence has been signaled after enabling sw_irqs.


 [SNIP]
 +/**
 + * radeon_fence_enable_signaling - enable signalling on fence
 + * @fence: fence
 + *
 + * This function is called with fence_queue lock held, and adds a callback
 + * to fence_queue that checks if this fence is signaled, and if so it
 + * signals the fence and removes itself.
 + */
 +static bool radeon_fence_enable_signaling(struct fence *f)
 +{
 +struct radeon_fence *fence = to_radeon_fence(f);
 +
 +if (atomic64_read(fence-rdev-fence_drv[fence-ring].last_seq) = 
 fence-seq ||
 +!fence-rdev-ddev-irq_enabled)
 +return false;
 +
 Do I get that right that you rely on IRQs to be enabled and working here? 
 Cause that would be a quite bad idea from the conceptual side.
 For cross-device synchronization it would be nice to have working irqs, it 
 allows signalling fences faster,
 and it allows for callbacks on completion to be called. For internal usage 
 it's no more required than it was before.

 That's a big NAK.

 The fence processing is actually very fine tuned to avoid IRQs and as far as 
 I can see you just leave them enabled by decrementing the atomic from IRQ 
 context. Additional to that we need allot of special handling in case of a 
 hardware lockup here, which isn't done if you abuse the fence interface like 
 this.
I think it's not needed to leave the irq enabled, it's a leftover from when I 
was debugging the mac and no interrupt occurred at all.

 Also your approach of leaking the IRQ context outside of the driver is a very 
 bad idea from the conceptual side. Please don't modify the fence interface at 
 all and instead use the wait functions already exposed by radeon_fence.c. If 
 you need some kind of signaling mechanism then wait inside a workqueue 
 instead.
The fence takes up the role of a single shot workqueue here. Manually resetting 
the counter and calling wake_up_all would end up waking all active fences, 
there's no special handling needed inside radeon for this.
The fence api does provide a synchronous wait function, but this causes a stall 
of whomever waits on it. When I was testing this with intel I used the fence 
callback to poke a register in i915, this allowed it to not block until it hits 
the wait op in the command stream, and even then only if the callback was not 
called first.

It's documented that the callbacks can be called from any context and will be 
called with irqs disabled, so nothing scary should be done. The kernel provides 
enough debug mechanisms to find any violators.
PROVE_LOCKING and DEBUG_ATOMIC_SLEEP for example.

~Maarten

--
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 v4 05/19] ARM: DT/kernel: define ARM specific arch_match_cpu_phys_id

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

OF/DT core library now provides architecture specific hook to match the
logical cpu index with the corresponding physical identifier. Most of the
cpu DT node parsing and initialisation is contained in devtree.c. So it's
better to define ARM specific arch_match_cpu_phys_id there.

This mainly helps to avoid replication of the code doing CPU node parsing
and physical(MPIDR) to logical mapping.

Cc: Russell King li...@arm.linux.org.uk
Cc: Lorenzo Pieralisi lorenzo.pieral...@arm.com
Acked-by: Rob Herring rob.herr...@calxeda.com
Acked-by: Nicolas Pitre n...@linaro.org
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 arch/arm/kernel/devtree.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index 5859c8b..2ee8a17 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -169,6 +169,11 @@ void __init arm_dt_init_cpu_maps(void)
}
 }
 
+bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
+{
+   return (phys_id  MPIDR_HWID_BITMASK) == cpu_logical_map(cpu);
+}
+
 /**
  * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
  * @dt_phys: physical address of dt blob
-- 
1.8.1.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 v4 04/19] of: move of_get_cpu_node implementation to DT core library

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

This patch moves the generalized implementation of of_get_cpu_node from
PowerPC to DT core library, thereby adding support for retrieving cpu
node for a given logical cpu index on any architecture.

The CPU subsystem can now use this function to assign of_node in the
cpu device while registering CPUs.

It is recommended to use these helper function only in pre-SMP/early
initialisation stages to retrieve CPU device node pointers in logical
ordering. Once the cpu devices are registered, it can be retrieved easily
from cpu device of_node which avoids unnecessary parsing and matching.

Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Cc: Grant Likely grant.lik...@linaro.org
Acked-by: Rob Herring rob.herr...@calxeda.com
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 arch/powerpc/include/asm/prom.h |  3 --
 arch/powerpc/kernel/prom.c  | 57 -
 drivers/of/base.c   | 95 +
 include/linux/cpu.h |  1 +
 include/linux/of.h  |  7 +++
 5 files changed, 103 insertions(+), 60 deletions(-)

diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index bc2da15..ac204e0 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -43,9 +43,6 @@ void of_parse_dma_window(struct device_node *dn, const void 
*dma_window_prop,
 
 extern void kdump_move_device_tree(void);
 
-/* CPU OF node matching */
-struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
-
 /* cache lookup */
 struct device_node *of_find_next_cache_node(struct device_node *np);
 
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index f7b8c0b..1c14cd4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -870,63 +870,6 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
return (int)phys_id == get_hard_smp_processor_id(cpu);
 }
 
-static bool __of_find_n_match_cpu_property(struct device_node *cpun,
-   const char *prop_name, int cpu, unsigned int *thread)
-{
-   const __be32 *cell;
-   int ac, prop_len, tid;
-   u64 hwid;
-
-   ac = of_n_addr_cells(cpun);
-   cell = of_get_property(cpun, prop_name, prop_len);
-   if (!cell)
-   return false;
-   prop_len /= sizeof(*cell);
-   for (tid = 0; tid  prop_len; tid++) {
-   hwid = of_read_number(cell, ac);
-   if (arch_match_cpu_phys_id(cpu, hwid)) {
-   if (thread)
-   *thread = tid;
-   return true;
-   }
-   cell += ac;
-   }
-   return false;
-}
-
-/* Find the device node for a given logical cpu number, also returns the cpu
- * local thread number (index in ibm,interrupt-server#s) if relevant and
- * asked for (non NULL)
- */
-struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
-{
-   struct device_node *cpun, *cpus;
-
-   cpus = of_find_node_by_path(/cpus);
-   if (!cpus) {
-   pr_warn(Missing cpus node, bailing out\n);
-   return NULL;
-   }
-
-   for_each_child_of_node(cpus, cpun) {
-   if (of_node_cmp(cpun-type, cpu))
-   continue;
-
-   /* Check for non-standard ibm,ppc-interrupt-server#s property
-* for thread ids on PowerPC. If it doesn't exist fallback to
-* standard reg property.
-*/
-   if (__of_find_n_match_cpu_property(cpun,
-   ibm,ppc-interrupt-server#s, cpu, thread))
-   return cpun;
-
-   if (__of_find_n_match_cpu_property(cpun, reg, cpu, thread))
-   return cpun;
-   }
-   return NULL;
-}
-EXPORT_SYMBOL(of_get_cpu_node);
-
 #if defined(CONFIG_DEBUG_FS)  defined(DEBUG)
 static struct debugfs_blob_wrapper flat_dt_blob;
 
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 5c54279..605afa9 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -18,6 +18,7 @@
  *  2 of the License, or (at your option) any later version.
  */
 #include linux/ctype.h
+#include linux/cpu.h
 #include linux/module.h
 #include linux/of.h
 #include linux/spinlock.h
@@ -230,6 +231,100 @@ const void *of_get_property(const struct device_node *np, 
const char *name,
 }
 EXPORT_SYMBOL(of_get_property);
 
+/*
+ * arch_match_cpu_phys_id - Match the given logical CPU and physical id
+ *
+ * @cpu: logical cpu index of a core/thread
+ * @phys_id: physical identifier of a core/thread
+ *
+ * CPU logical to physical index mapping is architecture specific.
+ * However this __weak function provides a default match of physical
+ * id to logical cpu index. phys_id provided here is usually values read
+ * from the device tree which must match the hardware internal registers.
+ *
+ * Returns true if the 

[PATCH v4 00/19] DT/core: update cpu device of_node

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

As more and more information is getting added into the cpu node, the number
of drivers needing to parse the device tree for CPU nodes are increasing.
Most of the time, the information needed from the cpu node is preferred
in the logical CPU order. Hence many drivers first parse and search the
CPU node, match them to logical index if needed and then search for the
required property inside a particular cpu node. Some of them assume the
logical and physical CPU ordering to be same which is incorrect.

This patch series initialises the of_node in all the cpu devices when
registering the CPU device.
1. This avoids different drivers having to parse the cpu nodes to obtain
   different attributes like operating points, latency,...etc.
2. This handles different physical and logical cpu ordering which is not
   the case in current code.
3. Also all the cpu nodes will have their of_node initialised correctly.
   Currently different drivers assign them partially and incorrectly.
4. Removes all the reduntant parsing in various drivers.

Changes v3-v4:
1. There was a conflict with the generic definition of of_get_cpu_node
   with the one defined in PPC with the same name but different arguments.
   This version refactored the PPC definition to support other architectures
   before moving the code to DT core. This part was separately posted and
   reviewed[1].
2. Updated the users of of_get_cpu_node with second argument(i.e. thread id
   mostly NULL as its currently used only in PPC).

Changes v2-v3:
1. Added new OF helper to get of_node from the cpu logical index.
   With the use of this help, removed lots of duplicated code from
   cpufreq drivers.
2. Fixed issue with property length calculation in of_get_cpu_node.
   (previously had assumed of_get_property returns number of cells)
3. Changed return type of arch_match_cpu_phys_id to bool(as suggested by Nico)
4. Re-ordered patch 2 and 3, and few typo fixes.
5. Rebased on v3.11-rc2(to avoid any conflicts with __cpuinit* deletion)

Changes v1-v2:
1. Moved most of arch_of_get_cpu_node to OF/DT core as of_get_cpu_node
   adding a provision for architecture specific hooks for matching
   logical and physical ids.
2. Extended removal of DT cpu node parsing to PPC cpufreq drivers
3. Added Acks from Viresh and Shawn

Regards,
Sudeep

v1: https://lkml.org/lkml/2013/7/15/128
v2: https://lkml.org/lkml/2013/7/17/341
v3: https://lkml.org/lkml/2013/7/22/219
[1] https://lkml.org/lkml/2013/8/15/319 (PPC refactoring)

Sudeep KarkadaNagesha (19):
  microblaze: remove undefined of_get_cpu_node declaration
  openrisc: remove undefined of_get_cpu_node declaration
  powerpc: refactor of_get_cpu_node to support other architectures
  of: move of_get_cpu_node implementation to DT core library
  ARM: DT/kernel: define ARM specific arch_match_cpu_phys_id
  driver/core: cpu: initialize of_node in cpu's device struture
  of/device: add helper to get cpu device node from logical cpu index
  ARM: topology: remove hwid/MPIDR dependency from cpu_capacity
  ARM: mvebu: remove device tree parsing for cpu nodes
  drivers/bus: arm-cci: avoid parsing DT for cpu device nodes
  cpufreq: imx6q-cpufreq: remove device tree parsing for cpu nodes
  cpufreq: cpufreq-cpu0: remove device tree parsing for cpu nodes
  cpufreq: highbank-cpufreq: remove device tree parsing for cpu nodes
  cpufreq: spear-cpufreq: remove device tree parsing for cpu nodes
  cpufreq: kirkwood-cpufreq: remove device tree parsing for cpu nodes
  cpufreq: arm_big_little: remove device tree parsing for cpu nodes
  cpufreq: maple-cpufreq: remove device tree parsing for cpu nodes
  cpufreq: pmac64-cpufreq: remove device tree parsing for cpu nodes
  cpufreq: pmac32-cpufreq: remove device tree parsing for cpu nodes

 arch/arm/kernel/devtree.c   |  5 ++
 arch/arm/kernel/topology.c  | 61 
 arch/arm/mach-imx/mach-imx6q.c  |  3 +-
 arch/arm/mach-mvebu/platsmp.c   | 51 +---
 arch/microblaze/include/asm/prom.h  |  3 --
 arch/openrisc/include/asm/prom.h|  3 --
 arch/powerpc/include/asm/prom.h |  3 --
 arch/powerpc/kernel/prom.c  | 43 +
 drivers/base/cpu.c  |  2 +
 drivers/bus/arm-cci.c   | 28 +++
 drivers/cpufreq/arm_big_little_dt.c | 40 ++--
 drivers/cpufreq/cpufreq-cpu0.c  | 23 ++---
 drivers/cpufreq/highbank-cpufreq.c  | 18 +++
 drivers/cpufreq/imx6q-cpufreq.c |  4 +-
 drivers/cpufreq/kirkwood-cpufreq.c  |  8 ++--
 drivers/cpufreq/maple-cpufreq.c | 23 ++---
 drivers/cpufreq/pmac32-cpufreq.c|  5 +-
 drivers/cpufreq/pmac64-cpufreq.c| 47 +-
 drivers/cpufreq/spear-cpufreq.c |  4 +-
 drivers/of/base.c   | 95 +
 include/linux/cpu.h |  1 +
 include/linux/of.h  |  7 +++
 include/linux/of_device.h   | 15 ++
 23 

[PATCH v4 07/19] of/device: add helper to get cpu device node from logical cpu index

2013-08-20 Thread Sudeep KarkadaNagesha
From: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com

Multiple drivers need to get the cpu device node from the cpu logical
index and then access the of_node.

This patch adds helper function to fetch the device node directly.

Acked-by: Rob Herring rob.herr...@calxeda.com
Signed-off-by: Sudeep KarkadaNagesha sudeep.karkadanage...@arm.com
---
 include/linux/of_device.h | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 9d27475..82ce324 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -1,6 +1,7 @@
 #ifndef _LINUX_OF_DEVICE_H
 #define _LINUX_OF_DEVICE_H
 
+#include linux/cpu.h
 #include linux/platform_device.h
 #include linux/of_platform.h /* temporary until merge */
 
@@ -43,6 +44,15 @@ static inline void of_device_node_put(struct device *dev)
of_node_put(dev-of_node);
 }
 
+static inline struct device_node *of_cpu_device_node_get(int cpu)
+{
+   struct device *cpu_dev;
+   cpu_dev = get_cpu_device(cpu);
+   if (!cpu_dev)
+   return NULL;
+   return of_node_get(cpu_dev-of_node);
+}
+
 #else /* CONFIG_OF */
 
 static inline int of_driver_match_device(struct device *dev,
@@ -67,6 +77,11 @@ static inline const struct of_device_id *of_match_device(
 {
return NULL;
 }
+
+static inline struct device_node *of_cpu_device_node_get(int cpu)
+{
+   return NULL;
+}
 #endif /* CONFIG_OF */
 
 #endif /* _LINUX_OF_DEVICE_H */
-- 
1.8.1.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/


Re: [PATCH 1/2] extcon: extcon-dra7xx: Add extcon driver for USB ID detection

2013-08-20 Thread George Cherian

Hi Chanwoo,

Thanks for your review.

On 8/20/2013 5:54 AM, Chanwoo Choi wrote:

Hi George,

On 08/16/2013 07:13 PM, George Cherian wrote:

Adding extcon driver for USB ID detection to dynamically
configure USB Host/Peripheral mode.

Signed-off-by: George Cherian george.cher...@ti.com
---
  .../devicetree/bindings/extcon/extcon-dra7xx.txt   |  19 ++
  drivers/extcon/Kconfig |   7 +
  drivers/extcon/Makefile|   1 +
  drivers/extcon/extcon-dra7xx.c | 234 +
  4 files changed, 261 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/extcon/extcon-dra7xx.txt
  create mode 100644 drivers/extcon/extcon-dra7xx.c

diff --git a/Documentation/devicetree/bindings/extcon/extcon-dra7xx.txt 
b/Documentation/devicetree/bindings/extcon/extcon-dra7xx.txt
new file mode 100644
index 000..37e4c22
--- /dev/null
+++ b/Documentation/devicetree/bindings/extcon/extcon-dra7xx.txt
@@ -0,0 +1,19 @@
+EXTCON FOR DRA7xx
+
+Required Properties:
+ - compatible : Should be ti,dra7xx-usb
+ - gpios : phandle to ID pin and interrupt gpio.
+
+Optional Properties:
+  - interrupt-parent : interrupt controller phandle
+  - interrupts : interrupt number
+
+
+dra7x_extcon1 {

You used 'dra7xx-usb' device name. Why did you use 'dra7x_extcon1' name?
What is meaning 'dra7x_extcon1'?


I will rename it to  dra7xx_extcon.

+   compatible = ti,dra7xx-usb;
+   gpios = pcf_usb 1 0,
+   gpio6 11 2;
+   interrupt-parent = gpio6;
+   interrupts = 11;
+   };

You have to keep indentation rule.


okay



+
diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
index f1d54a3..b9cf0b2 100644
--- a/drivers/extcon/Kconfig
+++ b/drivers/extcon/Kconfig
@@ -64,4 +64,11 @@ config EXTCON_PALMAS
  Say Y here to enable support for USB peripheral and USB host
  detection by palmas usb.
  
+config EXTCON_DRA7XX

+   tristate DRA7XX EXTCON support
+   help
+ Say Y here to enable support for USB peripheral and USB host
+ detection by pcf8575 using DRA7XX extcon.

You should explain detailed description about pcf8575 on patch description
and change description of EXTCON_DRA7xx as following:
using DRA7XX extcon - using DRA7XX device or using DRA7XX usb


okay



+
+

Remove unnecessary blank line.


okay



  endif # MULTISTATE_SWITCH
diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile
index e4fa8ba..e4778f9 100644
--- a/drivers/extcon/Makefile
+++ b/drivers/extcon/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_EXTCON_MAX77693) += extcon-max77693.o
  obj-$(CONFIG_EXTCON_MAX8997)  += extcon-max8997.o
  obj-$(CONFIG_EXTCON_ARIZONA)  += extcon-arizona.o
  obj-$(CONFIG_EXTCON_PALMAS)   += extcon-palmas.o
+obj-$(CONFIG_EXTCON_DRA7XX)+= extcon-dra7xx.o
diff --git a/drivers/extcon/extcon-dra7xx.c b/drivers/extcon/extcon-dra7xx.c
new file mode 100644
index 000..268c25e
--- /dev/null
+++ b/drivers/extcon/extcon-dra7xx.c
@@ -0,0 +1,234 @@
+/*
+ * DRA7XX USB ID pin detection driver
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Author: George Cherian george.cher...@ti.com
+ *
+ * Based on extcon-palmas.c
+ *
+ * Author: Kishon Vijay Abraham I kis...@ti.com
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/module.h
+#include linux/interrupt.h
+#include linux/kthread.h
+#include linux/freezer.h
+#include linux/platform_device.h
+#include linux/extcon.h
+#include linux/err.h
+#include linux/of.h
+#include linux/gpio.h
+#include linux/of_gpio.h
+#include linux/of_platform.h
+
+struct dra7xx_usb {
+   struct device *dev;
+
+   struct extcon_dev edev;
+   struct task_struct *thread_task;
+
+   /*GPIO pin */

Add space between /* and GPIO.


okay



+   int id_gpio;
+   int irq_gpio;
+
+   int id_prev;
+   int id_current;
+
+};
+
+static const char *dra7xx_extcon_cable[] = {
+   [0] = USB,
+   [1] = USB-HOST,
+   NULL,
+};
+
+static const int mutually_exclusive[] = {0x3, 0x0};
+
+static int id_poll_func(void *data)
+{
+   struct dra7xx_usb *dra7xx_usb = (struct dra7xx_usb *) data;
+
+   allow_signal(SIGINT);
+   allow_signal(SIGTERM);
+   allow_signal(SIGKILL);
+   allow_signal(SIGUSR1);
+
+   set_freezable();
+
+   while (!kthread_should_stop()) {
+   dra7xx_usb-id_current = gpio_get_value_cansleep
+   

[PATCH] blackfin: Ignore generated uImages

2013-08-20 Thread Mark Brown
From: Mark Brown broo...@linaro.org

We have the build infrastructure to generate uImages so we should ignore
the resulting generated files.

Signed-off-by: Mark Brown broo...@linaro.org
---
 arch/blackfin/boot/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/blackfin/boot/.gitignore b/arch/blackfin/boot/.gitignore
index 229e508..1287a54 100644
--- a/arch/blackfin/boot/.gitignore
+++ b/arch/blackfin/boot/.gitignore
@@ -1,2 +1,3 @@
 vmImage*
 vmlinux*
+uImage*
-- 
1.8.4.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/


[PATCH] xHCI:Fixing xhci_readl definition and function call

2013-08-20 Thread Kumar Gaurav
Fixing other programs in xhci driver which calls this function
Signed-off-by: Kumar Gaurav kumargauravgup...@gmail.com
---
 drivers/usb/host/xhci-dbg.c  |   36 +++
 drivers/usb/host/xhci-hub.c  |   72 +++---
 drivers/usb/host/xhci-mem.c  |   20 -
 drivers/usb/host/xhci-ring.c |   12 ++---
 drivers/usb/host/xhci.c  |  100 +-
 drivers/usb/host/xhci.h  |3 +-
 6 files changed, 121 insertions(+), 122 deletions(-)

diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c
index 5d5e58f..66dc1c0 100644
--- a/drivers/usb/host/xhci-dbg.c
+++ b/drivers/usb/host/xhci-dbg.c
@@ -32,7 +32,7 @@ void xhci_dbg_regs(struct xhci_hcd *xhci)
 
xhci_dbg(xhci, // xHCI capability registers at %p:\n,
xhci-cap_regs);
-   temp = xhci_readl(xhci, xhci-cap_regs-hc_capbase);
+   temp = xhci_readl(xhci-cap_regs-hc_capbase);
xhci_dbg(xhci, // @%p = 0x%x (CAPLENGTH AND HCIVERSION)\n,
xhci-cap_regs-hc_capbase, temp);
xhci_dbg(xhci, //   CAPLENGTH: 0x%x\n,
@@ -44,13 +44,13 @@ void xhci_dbg_regs(struct xhci_hcd *xhci)
 
xhci_dbg(xhci, // xHCI operational registers at %p:\n, xhci-op_regs);
 
-   temp = xhci_readl(xhci, xhci-cap_regs-run_regs_off);
+   temp = xhci_readl(xhci-cap_regs-run_regs_off);
xhci_dbg(xhci, // @%p = 0x%x RTSOFF\n,
xhci-cap_regs-run_regs_off,
(unsigned int) temp  RTSOFF_MASK);
xhci_dbg(xhci, // xHCI runtime registers at %p:\n, xhci-run_regs);
 
-   temp = xhci_readl(xhci, xhci-cap_regs-db_off);
+   temp = xhci_readl(xhci-cap_regs-db_off);
xhci_dbg(xhci, // @%p = 0x%x DBOFF\n, xhci-cap_regs-db_off, temp);
xhci_dbg(xhci, // Doorbell array at %p:\n, xhci-dba);
 }
@@ -61,7 +61,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci)
 
xhci_dbg(xhci, xHCI capability registers at %p:\n, xhci-cap_regs);
 
-   temp = xhci_readl(xhci, xhci-cap_regs-hc_capbase);
+   temp = xhci_readl(xhci-cap_regs-hc_capbase);
xhci_dbg(xhci, CAPLENGTH AND HCIVERSION 0x%x:\n,
(unsigned int) temp);
xhci_dbg(xhci, CAPLENGTH: 0x%x\n,
@@ -69,7 +69,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci)
xhci_dbg(xhci, HCIVERSION: 0x%x\n,
(unsigned int) HC_VERSION(temp));
 
-   temp = xhci_readl(xhci, xhci-cap_regs-hcs_params1);
+   temp = xhci_readl(xhci-cap_regs-hcs_params1);
xhci_dbg(xhci, HCSPARAMS 1: 0x%x\n,
(unsigned int) temp);
xhci_dbg(xhci,   Max device slots: %u\n,
@@ -79,7 +79,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci)
xhci_dbg(xhci,   Max ports: %u\n,
(unsigned int) HCS_MAX_PORTS(temp));
 
-   temp = xhci_readl(xhci, xhci-cap_regs-hcs_params2);
+   temp = xhci_readl(xhci-cap_regs-hcs_params2);
xhci_dbg(xhci, HCSPARAMS 2: 0x%x\n,
(unsigned int) temp);
xhci_dbg(xhci,   Isoc scheduling threshold: %u\n,
@@ -87,7 +87,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci)
xhci_dbg(xhci,   Maximum allowed segments in event ring: %u\n,
(unsigned int) HCS_ERST_MAX(temp));
 
-   temp = xhci_readl(xhci, xhci-cap_regs-hcs_params3);
+   temp = xhci_readl(xhci-cap_regs-hcs_params3);
xhci_dbg(xhci, HCSPARAMS 3 0x%x:\n,
(unsigned int) temp);
xhci_dbg(xhci,   Worst case U1 device exit latency: %u\n,
@@ -95,14 +95,14 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci)
xhci_dbg(xhci,   Worst case U2 device exit latency: %u\n,
(unsigned int) HCS_U2_LATENCY(temp));
 
-   temp = xhci_readl(xhci, xhci-cap_regs-hcc_params);
+   temp = xhci_readl(xhci-cap_regs-hcc_params);
xhci_dbg(xhci, HCC PARAMS 0x%x:\n, (unsigned int) temp);
xhci_dbg(xhci,   HC generates %s bit addresses\n,
HCC_64BIT_ADDR(temp) ? 64 : 32);
/* FIXME */
xhci_dbg(xhci,   FIXME: more HCCPARAMS debugging\n);
 
-   temp = xhci_readl(xhci, xhci-cap_regs-run_regs_off);
+   temp = xhci_readl(xhci-cap_regs-run_regs_off);
xhci_dbg(xhci, RTSOFF 0x%x:\n, temp  RTSOFF_MASK);
 }
 
@@ -110,7 +110,7 @@ static void xhci_print_command_reg(struct xhci_hcd *xhci)
 {
u32 temp;
 
-   temp = xhci_readl(xhci, xhci-op_regs-command);
+   temp = xhci_readl(xhci-op_regs-command);
xhci_dbg(xhci, USBCMD 0x%x:\n, temp);
xhci_dbg(xhci,   HC is %s\n,
(temp  CMD_RUN) ? running : being stopped);
@@ -128,7 +128,7 @@ static void xhci_print_status(struct xhci_hcd *xhci)
 {
u32 temp;
 
-   temp = xhci_readl(xhci, xhci-op_regs-status);
+   temp = xhci_readl(xhci-op_regs-status);
xhci_dbg(xhci, USBSTS 0x%x:\n, temp);

Re: [PATCH 0/3] refactor some ldb related clocks

2013-08-20 Thread Philipp Zabel
Am Dienstag, den 20.08.2013, 16:38 +0800 schrieb Liu Ying:
 The ldb_di[0/1]_ipu_div clock dividers in the CSCMR2 register
 of i.MX53, i.MX6Q and i.MX6DL SoCs can be configured to a 1/3.5
 drivider or a 1/7 divider. The common clock framework cannot
 deal with the two dividers directly even with the divider table
 which only supports integral dividers. So, the idea is to take
 the 1/3.5 and 1/7 dividers as separate fixed factor dividers and
 introduce a new multiplexer clock to be derived from the them.
 Then, the ldb display clock trees can be setup correctly.
 This series contains the necessary clock driver changes, dts code
 changes and imx-drm/ldb driver changes to fullfill the task.

I don't see how this improves the situation. Does this solve any real
problem?

While I admit to having introduced the combination of 1/3.5 fixed
divider and configurable 1/1,1/2 divder clocks to describe this
fractional divider for the reasons you state, I think the correct
solution would be to improve the table divider to support fractional
values and get rid of the virtual ldb_din_div_3_5 clocks, not
introduce more virtual clocks.

regards
Philipp

--
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 tip/core/rcu 8/9] rcu: Simplify _rcu_barrier() processing

2013-08-20 Thread Lai Jiangshan
On 08/20/2013 10:42 AM, Paul E. McKenney wrote:
 From: Paul E. McKenney paul...@linux.vnet.ibm.com
 
 This commit drops an unneeded ACCESS_ONCE() and simplifies an our work
 is done check in _rcu_barrier().  This applies feedback from Linus
 (https://lkml.org/lkml/2013/7/26/777) that he gave to similar code
 in an unrelated patch.
 
 Signed-off-by: Paul E. McKenney paul...@linux.vnet.ibm.com
 Reviewed-by: Josh Triplett j...@joshtriplett.org
 ---
  kernel/rcutree.c | 15 +--
  1 file changed, 13 insertions(+), 2 deletions(-)
 
 diff --git a/kernel/rcutree.c b/kernel/rcutree.c
 index c6a064a..612aff1 100644
 --- a/kernel/rcutree.c
 +++ b/kernel/rcutree.c
 @@ -2817,9 +2817,20 @@ static void _rcu_barrier(struct rcu_state *rsp)
* transition.  The if expression below therefore rounds the old
* value up to the next even number and adds two before comparing.
*/
 - snap_done = ACCESS_ONCE(rsp-n_barrier_done);
 + snap_done = rsp-n_barrier_done;
   _rcu_barrier_trace(rsp, Check, -1, snap_done);
 - if (ULONG_CMP_GE(snap_done, ((snap + 1)  ~0x1) + 2)) {
 +
 + /*
 +  * If the value in snap is odd, we needed to wait for the current
 +  * rcu_barrier() to complete, then wait for the next one, in other
 +  * words, we need the value of snap_done to be three larger than
 +  * the value of snap.  On the other hand, if the value in snap is
 +  * even, we only had to wait for the next rcu_barrier() to complete,
 +  * in other words, we need the value of snap_done to be only two
 +  * greater than the value of snap.  The (snap + 3)  0x1 computes

(snap + 3)  0x1
== (snap + 3)  ~0x1

 +  * this for us (thank you, Linus!).
 +  */
 + if (ULONG_CMP_GE(snap_done, (snap + 3)  ~0x1)) {
   _rcu_barrier_trace(rsp, EarlyExit, -1, snap_done);
   smp_mb(); /* caller's subsequent code after above check. */
   mutex_unlock(rsp-barrier_mutex);

--
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] mc13xxx-ts: use zero as default value if no pdata was defined

2013-08-20 Thread Samuel Ortiz
Hi Michael,

On Tue, Aug 20, 2013 at 11:34:32AM +0200, Michael Grzeschik wrote:
 On Tue, Aug 20, 2013 at 03:34:33AM +0200, Samuel Ortiz wrote:
  On Tue, Aug 13, 2013 at 02:14:30PM +0200, Michael Grzeschik wrote:
   In case of devicetree, we currently don't have a way to append pdata for
   the touchscreen. The current approach is to bail out in that case.
   This patch makes it possible to probe the touchscreen without pdata
   and use zero as default values for the atox and ato adc conversion.
  Would that still make the touchscreen somehow functional ?
 
 Yes, it still works. It just defaults to zero values in no pdata case.
 
  If that's the case, and if Dmitry is fine with the ts part of this
  patch, could you please separate the mfd part of this patch into a
  separate one ?
 
 Why?
To avoid cross tree commits as much as possible.


 The purpose of this patch is to have both cases working, pdata and no
 pdata. 
I understood that part. But you can still split the patch in 2 as the ts
driver will not be probed without pdata until the mfd patch is merged
upstream.

 This patch is actually fixing the patch of Michael Thalmeier.
 There we changed the mfd and touch in one patch as well.
There was a build time dependency between the ts driver and the MFD
changes, so the patch had to be merged atomically.
That is not the case with your patch.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.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/


Re: [RFC PATCH] drm/radeon: rework to new fence interface

2013-08-20 Thread Christian König

Am 20.08.2013 11:36, schrieb Maarten Lankhorst:
[SNIP]


[SNIP]
+/**
+ * radeon_fence_enable_signaling - enable signalling on fence
+ * @fence: fence
+ *
+ * This function is called with fence_queue lock held, and adds a callback
+ * to fence_queue that checks if this fence is signaled, and if so it
+ * signals the fence and removes itself.
+ */
+static bool radeon_fence_enable_signaling(struct fence *f)
+{
+struct radeon_fence *fence = to_radeon_fence(f);
+
+if (atomic64_read(fence-rdev-fence_drv[fence-ring].last_seq) = 
fence-seq ||
+!fence-rdev-ddev-irq_enabled)
+return false;
+

Do I get that right that you rely on IRQs to be enabled and working here? Cause 
that would be a quite bad idea from the conceptual side.

For cross-device synchronization it would be nice to have working irqs, it 
allows signalling fences faster,
and it allows for callbacks on completion to be called. For internal usage it's 
no more required than it was before.

That's a big NAK.

The fence processing is actually very fine tuned to avoid IRQs and as far as I 
can see you just leave them enabled by decrementing the atomic from IRQ 
context. Additional to that we need allot of special handling in case of a 
hardware lockup here, which isn't done if you abuse the fence interface like 
this.

I think it's not needed to leave the irq enabled, it's a leftover from when I 
was debugging the mac and no interrupt occurred at all.


Also your approach of leaking the IRQ context outside of the driver is a very 
bad idea from the conceptual side. Please don't modify the fence interface at 
all and instead use the wait functions already exposed by radeon_fence.c. If 
you need some kind of signaling mechanism then wait inside a workqueue instead.

The fence takes up the role of a single shot workqueue here. Manually resetting 
the counter and calling wake_up_all would end up waking all active fences, 
there's no special handling needed inside radeon for this.


Yeah that's actually the point here, you NEED to activate ALL fences, 
otherwise the fence handling inside the driver won't work.



The fence api does provide a synchronous wait function, but this causes a stall 
of whomever waits on it.


Which is perfectly fine. What actually is the use case of not stalling a 
process who wants to wait for something?



When I was testing this with intel I used the fence callback to poke a register 
in i915, this allowed it to not block until it hits the wait op in the command 
stream, and even then only if the callback was not called first.

It's documented that the callbacks can be called from any context and will be 
called with irqs disabled, so nothing scary should be done. The kernel provides 
enough debug mechanisms to find any violators.
PROVE_LOCKING and DEBUG_ATOMIC_SLEEP for example.


No thanks, we even abandoned that concept internal in the driver. Please 
use the blocking wait functions instead.


Christian.
--
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] mc13xxx-ts: use zero as default value if no pdata was defined

2013-08-20 Thread Michael Grzeschik
On Tue, Aug 20, 2013 at 11:50:48AM +0200, Samuel Ortiz wrote:
 Hi Michael,
 
 On Tue, Aug 20, 2013 at 11:34:32AM +0200, Michael Grzeschik wrote:
  On Tue, Aug 20, 2013 at 03:34:33AM +0200, Samuel Ortiz wrote:
   On Tue, Aug 13, 2013 at 02:14:30PM +0200, Michael Grzeschik wrote:
In case of devicetree, we currently don't have a way to append pdata for
the touchscreen. The current approach is to bail out in that case.
This patch makes it possible to probe the touchscreen without pdata
and use zero as default values for the atox and ato adc conversion.
   Would that still make the touchscreen somehow functional ?
  
  Yes, it still works. It just defaults to zero values in no pdata case.
  
   If that's the case, and if Dmitry is fine with the ts part of this
   patch, could you please separate the mfd part of this patch into a
   separate one ?
  
  Why?
 To avoid cross tree commits as much as possible.
 
 
  The purpose of this patch is to have both cases working, pdata and no
  pdata. 
 I understood that part. But you can still split the patch in 2 as the ts
 driver will not be probed without pdata until the mfd patch is merged
 upstream.
 
  This patch is actually fixing the patch of Michael Thalmeier.
  There we changed the mfd and touch in one patch as well.
 There was a build time dependency between the ts driver and the MFD
 changes, so the patch had to be merged atomically.
 That is not the case with your patch.

All right then. I will resend them and the codec mfd patch together with
the oftree patches I am currently working on.

Thanks,
Michael

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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 tip/core/rcu 1/9] rcu: Expedite grace periods during suspend/resume

2013-08-20 Thread Lai Jiangshan
On 08/20/2013 10:42 AM, Paul E. McKenney wrote:
 From: Borislav Petkov b...@alien8.de
 
 CONFIG_RCU_FAST_NO_HZ can increase grace-period durations by up to
 a factor of four, which can result in long suspend and resume times.
 Thus, this commit temporarily switches to expedited grace periods when
 suspending the box and return to normal settings when resuming.  Similar
 logic is applied to hibernation.
 
 Because expedited grace periods are of dubious benefit on very large
 systems, so this commit restricts their automated use during suspend
 and resume to systems of 256 or fewer CPUs.  (Some day a number of
 Linux-kernel facilities, including RCU's expedited grace periods,
 will be more scalable, but I need to see bug reports first.)
 
 [ paulmck: This also papers over an audio/irq bug, but hopefully that will
   be fixed soon. ]
 
 Signed-off-by: Borislav Petkov b...@suse.de
 Signed-off-by: Bjørn Mork bj...@mork.no
 Signed-off-by: Paul E. McKenney paul...@linux.vnet.ibm.com
 Reviewed-by: Josh Triplett j...@joshtriplett.org
 ---
  kernel/rcutree.c | 21 +
  1 file changed, 21 insertions(+)
 
 diff --git a/kernel/rcutree.c b/kernel/rcutree.c
 index 338f1d1..a7bf517 100644
 --- a/kernel/rcutree.c
 +++ b/kernel/rcutree.c
 @@ -54,6 +54,7 @@
  #include linux/stop_machine.h
  #include linux/random.h
  #include linux/ftrace_event.h
 +#include linux/suspend.h
  
  #include rcutree.h
  #include trace/events/rcu.h
 @@ -3032,6 +3033,25 @@ static int rcu_cpu_notify(struct notifier_block *self,
   return NOTIFY_OK;
  }
  
 +static int rcu_pm_notify(struct notifier_block *self,
 +  unsigned long action, void *hcpu)
 +{
 + switch (action) {
 + case PM_HIBERNATION_PREPARE:
 + case PM_SUSPEND_PREPARE:
 + if (nr_cpu_ids = 256) /* Expediting bad for large systems. */
 + rcu_expedited = 1;
 + break;
 + case PM_POST_HIBERNATION:
 + case PM_POST_SUSPEND:
 + rcu_expedited = 0;

Users can set it via sysfs, this notify will changes it.
I think we can introduce an rcu_expedited_syfs_saved;
thus we can change this line to:
-   rcu_expedited = 0;
+   rcu_expedited = rcu_expedited_syfs_saved;


rcu_init() {
...
+   rcu_expedited_syfs_saved = rcu_expedited;
}

static ssize_t rcu_expedited_store(struct kobject *kobj,
   struct kobj_attribute *attr,
   const char *buf, size_t count)
{
if (kstrtoint(buf, 0, rcu_expedited))
return -EINVAL;

+   rcu_expedited_syfs_saved = rcu_expedited;
return count;
}

 + break;
 + default:
 + break;
 + }
 + return NOTIFY_OK;
 +}
 +
  /*
   * Spawn the kthread that handles this RCU flavor's grace periods.
   */
 @@ -3273,6 +3293,7 @@ void __init rcu_init(void)
* or the scheduler are operational.
*/
   cpu_notifier(rcu_cpu_notify, 0);
 + pm_notifier(rcu_pm_notify, 0);
   for_each_online_cpu(cpu)
   rcu_cpu_notify(NULL, CPU_UP_PREPARE, (void *)(long)cpu);
  }

--
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 v4 1/3] usb: dwc3: msm: Add device tree binding information

2013-08-20 Thread Ivan T. Ivanov
From: Ivan T. Ivanov iiva...@mm-sol.com

MSM USB3.0 core wrapper consist of USB3.0 IP from Synopsys
(SNPS) and HS, SS PHY's control and configuration registers.

It could operate in device mode (SS, HS, FS) and host
mode (SS, HS, FS, LS).

Signed-off-by: Ivan T. Ivanov iiva...@mm-sol.com
---
 .../devicetree/bindings/usb/msm-ssusb.txt  |  104 
 1 file changed, 104 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/msm-ssusb.txt

diff --git a/Documentation/devicetree/bindings/usb/msm-ssusb.txt 
b/Documentation/devicetree/bindings/usb/msm-ssusb.txt
new file mode 100644
index 000..cacbd3b
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/msm-ssusb.txt
@@ -0,0 +1,104 @@
+MSM SuperSpeed DWC3 USB SoC controller
+
+
+DWC3 Highspeed USB PHY
+==
+Required properities :
+- compatible : sould be qcom,dwc3-hsphy;
+- reg : offset and length of the register set in the memory map
+- clocks : phandles to clock instances of the device tree nodes
+- clock-names :
+   xo : External reference clock 19 MHz
+   sleep_a : Sleep clock, used when USB3 core goes into low
+   power mode (U3).
+supply-name-supply : phandle to the regulator device tree node
+Required supply-name are:
+   v1p8 : 1.8v supply for HSPHY
+   v3p3 : 3.3v supply for HSPHY
+   vbus : vbus supply for host mode
+   vddcx : vdd supply for HS-PHY digital circuit operation
+
+DWC3 Superspeed USB PHY
+===
+Required properities :
+- compatible : sould be qcom,dwc3-ssphy;
+- reg : offset and length of the register set in the memory map
+- clocks : phandles to clock instances of the device tree nodes
+- clock-names :
+   xo : External reference clock 19 MHz
+   ref : Reference clock - used in host mode.
+supply-name-supply : phandle to the regulator device tree node
+Required supply-name are:
+   v1p8 : 1.8v supply for SS-PHY
+   vddcx : vdd supply for SS-PHY digital circuit operation
+
+DWC3 controller wrapper
+===
+Required properties :
+- compatible : should be qcom,dwc3
+- reg : offset and length of the register set in the memory map
+   offset and length of the TCSR register for routing USB
+   signals to either picoPHY0 or picoPHY1.
+- clocks : phandles to clock instances of the device tree nodes
+- clock-names :
+   core : Master/Core clock, have to be = 125 MHz for SS
+   operation and = 60MHz for HS operation
+   iface : System bus AXI clock
+   sleep : Sleep clock, used when USB3 core goes into low
+   power mode (U3).
+   utmi : Generated by HS-PHY. Used to clock the low power
+   parts of thr HS Link layer.
+Optional properties :
+- gdsc-supply : phandle to the globally distributed switch controller
+  regulator node to the USB controller.
+Required child node:
+A child node must exist to represent the core DWC3 IP block. The name of
+the node is not important. The content of the node is defined in dwc3.txt.
+
+Example device nodes:
+
+   dwc3_hsphy: phy@f92f8800 {
+   compatible = qcom,dwc3-hsphy;
+   reg = 0xf92f8800 0x30;
+
+   clocks = cxo, usb2a_phy_sleep_cxc;
+   clock-names = xo, sleep_a;
+
+   vbus-supply = supply;
+   vddcx-supply = supply;
+   v1p8-supply = supply;
+   v3p3-supply = supply;
+   };
+
+   dwc3_ssphy: phy@f92f8830 {
+   compatible = qcom,dwc3-ssphy;
+   reg = 0xf92f8830 0x30;
+
+   clocks = cxo, usb30_mock_utmi_cxc;
+   clock-names = xo, ref;
+
+   vddcx-supply = supply;
+   v1p8-supply = supply;
+   };
+
+   usb@fd4ab000 {
+   compatible = qcom,dwc3;
+   #address-cells = 1;
+   #size-cells = 1;
+   reg = 0xfd4ab000 0x4;
+
+   clocks = usb30_master_cxc, sys_noc_usb3_axi_cxc,
+   usb30_sleep_cxc, usb30_mock_utmi_cxc;
+   clock-names = core, iface, sleep, utmi;
+
+   gdsc-supply = supply;
+
+   ranges;
+   dwc3@f920 {
+   compatible = snps,dwc3;
+   reg = 0xf920 0xcd00;
+   interrupts = 0 131 0;
+   usb-phy = dwc3_hsphy, dwc3_ssphy;
+   tx-fifo-resize;
+   };
+   };
-- 
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/


[PATCH v4 3/3] usb: dwc3: Add Qualcomm DWC3 glue layer driver

2013-08-20 Thread Ivan T. Ivanov
From: Ivan T. Ivanov iiva...@mm-sol.com

DWC3 glue layer is hardware layer around Synopsys DesignWare
USB3 core. Its purpose is to supply Synopsys IP with required
clocks, voltages and interface it with the rest of the SoC.

Signed-off-by: Ivan T. Ivanov iiva...@mm-sol.com
---
 drivers/usb/dwc3/Kconfig|8 +++
 drivers/usb/dwc3/Makefile   |1 +
 drivers/usb/dwc3/dwc3-msm.c |  167 +++
 3 files changed, 176 insertions(+)
 create mode 100644 drivers/usb/dwc3/dwc3-msm.c

diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index f969ea2..d845966 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -71,6 +71,14 @@ config USB_DWC3_PCI
  One such PCIe-based platform is Synopsys' PCIe HAPS model of
  this IP.
 
+config USB_DWC3_MSM
+   tristate Qualcomm MSM/APQ Platforms
+   default USB_DWC3
+   select USB_MSM_DWC3_PHYS
+   help
+ Recent Qualcomm SoCs ship with one DesignWare Core USB3 IP inside,
+ say 'Y' or 'M' if you have one such device.
+
 comment Debugging features
 
 config USB_DWC3_DEBUG
diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
index dd17601..5226681 100644
--- a/drivers/usb/dwc3/Makefile
+++ b/drivers/usb/dwc3/Makefile
@@ -32,3 +32,4 @@ endif
 obj-$(CONFIG_USB_DWC3_OMAP)+= dwc3-omap.o
 obj-$(CONFIG_USB_DWC3_EXYNOS)  += dwc3-exynos.o
 obj-$(CONFIG_USB_DWC3_PCI) += dwc3-pci.o
+obj-$(CONFIG_USB_DWC3_MSM) += dwc3-msm.o
diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c
new file mode 100644
index 000..361076c
--- /dev/null
+++ b/drivers/usb/dwc3/dwc3-msm.c
@@ -0,0 +1,167 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/clk.h
+#include linux/err.h
+#include linux/io.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_platform.h
+#include linux/platform_device.h
+#include linux/regulator/consumer.h
+#include linux/usb/phy.h
+
+struct dwc3_msm {
+   struct device   *dev;
+
+   struct clk  *core_clk;
+   struct clk  *iface_clk;
+   struct clk  *sleep_clk;
+   struct clk  *utmi_clk;
+
+   struct regulator*gdsc;
+};
+
+static int dwc3_msm_probe(struct platform_device *pdev)
+{
+   struct device_node *node = pdev-dev.of_node;
+   struct dwc3_msm *mdwc;
+   struct resource *res;
+   void __iomem *tcsr;
+   int ret = 0;
+
+   mdwc = devm_kzalloc(pdev-dev, sizeof(*mdwc), GFP_KERNEL);
+   if (!mdwc)
+   return -ENOMEM;
+
+   platform_set_drvdata(pdev, mdwc);
+   mdwc-dev = pdev-dev;
+
+   mdwc-gdsc = devm_regulator_get(mdwc-dev, gdsc);
+
+   mdwc-core_clk = devm_clk_get(pdev-dev, core);
+   if (IS_ERR(mdwc-core_clk)) {
+   dev_dbg(pdev-dev, failed to get core clock\n);
+   return PTR_ERR(mdwc-core_clk);
+   }
+
+   mdwc-iface_clk = devm_clk_get(pdev-dev, iface);
+   if (IS_ERR(mdwc-iface_clk)) {
+   dev_dbg(pdev-dev, failed to get iface clock\n);
+   return PTR_ERR(mdwc-iface_clk);
+   }
+
+   mdwc-sleep_clk = devm_clk_get(pdev-dev, sleep );
+   if (IS_ERR(mdwc-sleep_clk)) {
+   dev_dbg(pdev-dev, failed to get sleep clock\n);
+   return  PTR_ERR(mdwc-sleep_clk);
+   }
+
+   mdwc-utmi_clk = devm_clk_get(pdev-dev, utmi);
+   if (IS_ERR(mdwc-utmi_clk)) {
+   dev_dbg(pdev-dev, failed to get utmi clock\n);
+   return  PTR_ERR(mdwc-utmi_clk);
+   }
+
+   if (!IS_ERR(mdwc-gdsc)) {
+   ret = regulator_enable(mdwc-gdsc);
+   if (ret)
+   dev_err(mdwc-dev, cannot enable usb3 gdsc\n);
+   }
+
+   /*
+* DWC3 Core requires its CORE CLK (aka master / bus clk) to
+* run at 125Mhz in SSUSB mode and 60MHZ for HSUSB mode.
+*/
+   clk_set_rate(mdwc-core_clk, 12500);
+   clk_prepare_enable(mdwc-core_clk);
+   clk_prepare_enable(mdwc-iface_clk);
+   clk_prepare_enable(mdwc-sleep_clk);
+   clk_prepare_enable(mdwc-utmi_clk);
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   tcsr = devm_ioremap_resource(pdev-dev, res);
+   if (!tcsr) {
+   ret = PTR_ERR(tcsr);
+   goto dis_clks;
+   }
+
+   /*
+* Primary USB port is shared between USB2 and USB3 controllers.
+   

[PATCH v4 0/3] DWC3 USB support for Qualcomm platform

2013-08-20 Thread Ivan T. Ivanov
From: Ivan T. Ivanov iiva...@mm-sol.com

Hi,

Here is fourth version of MSM USB3 drivers patches.

Changes since v3:
* Remove _clk suffix from clock names
* Clarify required child node for qcom,dwc3
* Fix comments in functions headers
* Use dbg instead err in drivers probe functions.

Changes since v2:
* Several improvements in devicetree bindings description
* Disable regulators in glue layer if there is error during 
  ioremap.

Changes since first version:
* Split devicetree bindings description file to separate patch
* Address comments for device bindings description
* Fix typo in 'gdsc' requlator name.

These patches add basic support for USB3.0 controllers found
on MSM platforms. USB3.0 core is based on Synopsys DesignWare 
SuperSpeed IP. 

Generated on top of Felipe 'testing' branch.

Ivan T. Ivanov (3):
  usb: dwc3: msm: Add device tree binding information
  usb: phy: Add Qualcomm SS-USB and HS-USB drivers for DWC3 core
  usb: dwc3: Add Qualcomm DWC3 glue layer driver

 .../devicetree/bindings/usb/msm-ssusb.txt  |  104 ++
 drivers/usb/dwc3/Kconfig   |8 +
 drivers/usb/dwc3/Makefile  |1 +
 drivers/usb/dwc3/dwc3-msm.c|  167 +
 drivers/usb/phy/Kconfig|   11 +
 drivers/usb/phy/Makefile   |2 +
 drivers/usb/phy/phy-msm-dwc3-hs.c  |  327 +
 drivers/usb/phy/phy-msm-dwc3-ss.c  |  374 
 8 files changed, 994 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/msm-ssusb.txt
 create mode 100644 drivers/usb/dwc3/dwc3-msm.c
 create mode 100644 drivers/usb/phy/phy-msm-dwc3-hs.c
 create mode 100644 drivers/usb/phy/phy-msm-dwc3-ss.c

-- 
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/


Re: [REGRESSION] 3.10.{6,7} crashes on network activity

2013-08-20 Thread Arend van Spriel

On 08/20/2013 10:36 AM, Tom Gundersen wrote:

On Tue, Aug 20, 2013 at 4:15 PM, Arend van Spriel ar...@broadcom.com wrote:

On 08/20/2013 06:56 AM, Felix Fietkau wrote:


On 2013-08-20 2:28 AM, Greg Kroah-Hartman wrote:


On Tue, Aug 20, 2013 at 08:26:11AM +0800, Tom Gundersen wrote:


On Tue, Aug 20, 2013 at 8:03 AM, Greg Kroah-Hartman
gre...@linuxfoundation.org wrote:


On Tue, Aug 20, 2013 at 07:59:47AM +0800, Tom Gundersen wrote:


Hi guys,

Starting with 3.10.6 (and still present in .7) I get an oops on
connecting to the network.

The attached picture shows the oops. In case it does not reach the ML,
the top of the call trace reads:

brcms_c_compute_rtscts_dur
brcms_c_ampdu_finalize
ampdu_finalize
dma_txfast
brcms_c_txfifo
brcms_c_sendpkt_mac80211
brcms_ops_tx
__ieee80211_tx

I bisected the problem and the first bad commit is

commit ef47a5e4f1aaf1d0e2e6875e34b2c9595897bef6
Author: Felix Fietkau n...@openwrt.org
Date:   Fri Jun 28 21:04:35 2013 +0200

  mac80211/minstrel_ht: fix cck rate sampling

  commit 1cd158573951f737fbc878a35cb5eb47bf9af3d5 upstream.

Reverting it on top of .7 fixes the problem.

I had the same (I suppose) problem on mainline some time ago, but I
have not bisected it, verified that the problem still occurs there, or
checked if reverting the upstream patch fixes it. I'd be happy to do
that if it would help though.

Let me know if you need any more information.



Do you have this same problem with 3.11-rc6 as well?



Yes, I just confirmed. I also confirmed that reverting the mainline
commit on top of -rc6 fixes the problem.



Great, thanks.

Felix and Johannes, any chance we can get this reverted in Linus tree
soon, and push that revert back to the 3.10 stable tree as well?


I'd like to avoid a revert, since that will simply replace one set of
issues with another. Let's limit the use of the feature that brcmsmac
can't handle to drivers that are known to work with it. Tom, Please
test this patch to see if it fixes your issue.



Hi Felix,

I have been diving into root causing why brcmsmac can not handle cck
fallback rates, because it should. Maybe it is better to flag no cck support
and only change brcmsmac.


Hi Arend,

In case you cannot reproduce, let me know if I can help with testing patches.


So far I have not been able to reproduce it. I have a patch to avoid the 
oops, but the transmit of the related frames will fail in the device so 
it is not a real fix. I will let you you know.


Regards,
Arend


Cheers,

Tom




--
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 v4 2/3] usb: phy: Add Qualcomm SS-USB and HS-USB drivers for DWC3 core

2013-08-20 Thread Ivan T. Ivanov
From: Ivan T. Ivanov iiva...@mm-sol.com

These drivers handles control and configuration of the HS
and SS USB PHY transceivers. They are part of the driver
which manage Synopsys DesignWare USB3 controller stack
inside Qualcomm SoC's.

Signed-off-by: Ivan T. Ivanov iiva...@mm-sol.com
---
 drivers/usb/phy/Kconfig   |   11 ++
 drivers/usb/phy/Makefile  |2 +
 drivers/usb/phy/phy-msm-dwc3-hs.c |  327 
 drivers/usb/phy/phy-msm-dwc3-ss.c |  374 +
 4 files changed, 714 insertions(+)
 create mode 100644 drivers/usb/phy/phy-msm-dwc3-hs.c
 create mode 100644 drivers/usb/phy/phy-msm-dwc3-ss.c

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index d5589f9..c525835 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -214,6 +214,17 @@ config USB_RCAR_PHY
  To compile this driver as a module, choose M here: the
  module will be called phy-rcar-usb.
 
+config USB_MSM_DWC3_PHYS
+   tristate Qualcomm DWC3 USB controller PHY's support
+   depends on (USB || USB_GADGET)  ARCH_MSM
+   select USB_PHY
+   help
+ Enable this to support the USB PHY transceivers on MSM chips with
+ DWC3 USB core. It handles PHY initialization, clock management
+ required after resetting the hardware and power management.
+ This driver is required even for peripheral only or host only
+ mode configurations.
+
 config USB_ULPI
bool Generic ULPI Transceiver Driver
depends on ARM
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 2135e85..8f2dd94 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -26,6 +26,8 @@ obj-$(CONFIG_USB_EHCI_TEGRA)  += phy-tegra-usb.o
 obj-$(CONFIG_USB_GPIO_VBUS)+= phy-gpio-vbus-usb.o
 obj-$(CONFIG_USB_ISP1301)  += phy-isp1301.o
 obj-$(CONFIG_USB_MSM_OTG)  += phy-msm-usb.o
+obj-$(CONFIG_USB_MSM_DWC3_PHYS)+= phy-msm-dwc3-hs.o
+obj-$(CONFIG_USB_MSM_DWC3_PHYS)+= phy-msm-dwc3-ss.o
 obj-$(CONFIG_USB_MV_OTG)   += phy-mv-usb.o
 obj-$(CONFIG_USB_MXS_PHY)  += phy-mxs-usb.o
 obj-$(CONFIG_USB_RCAR_PHY) += phy-rcar-usb.o
diff --git a/drivers/usb/phy/phy-msm-dwc3-hs.c 
b/drivers/usb/phy/phy-msm-dwc3-hs.c
new file mode 100644
index 000..840e766
--- /dev/null
+++ b/drivers/usb/phy/phy-msm-dwc3-hs.c
@@ -0,0 +1,327 @@
+/* Copyright (c) 2013, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/clk.h
+#include linux/err.h
+#include linux/io.h
+#include linux/module.h
+#include linux/of.h
+#include linux/platform_device.h
+#include linux/regulator/consumer.h
+#include linux/usb/phy.h
+
+/**
+ *  USB QSCRATCH Hardware registers
+ */
+#define QSCRATCH_CTRL_REG  (0x04)
+#define QSCRATCH_GENERAL_CFG   (0x08)
+#define PHY_CTRL_REG   (0x10)
+#define PARAMETER_OVERRIDE_X_REG   (0x14)
+#define CHARGING_DET_CTRL_REG  (0x18)
+#define CHARGING_DET_OUTPUT_REG(0x1c)
+#define ALT_INTERRUPT_EN_REG   (0x20)
+#define PHY_IRQ_STAT_REG   (0x24)
+#define CGCTL_REG  (0x28)
+
+#define PHY_3P3_VOL_MIN305 /* uV */
+#define PHY_3P3_VOL_MAX330 /* uV */
+#define PHY_3P3_HPM_LOAD   16000   /* uA */
+
+#define PHY_1P8_VOL_MIN180 /* uV */
+#define PHY_1P8_VOL_MAX180 /* uV */
+#define PHY_1P8_HPM_LOAD   19000   /* uA */
+
+/* TODO: these are suspicious */
+#define USB_VDDCX_NO   1   /* uV */
+#define USB_VDDCX_MIN  5   /* uV */
+#define USB_VDDCX_MAX  7   /* uV */
+
+struct msm_dwc3_hs_phy {
+   struct usb_phy  phy;
+   void __iomem*base;
+   struct device   *dev;
+
+   struct clk  *xo_clk;
+   struct clk  *sleep_a_clk;
+
+   struct regulator*v3p3;
+   struct regulator*v1p8;
+   struct regulator*vddcx;
+   struct regulator*vbus;
+};
+
+#definephy_to_dwc3_phy(x)  container_of((x), struct 
msm_dwc3_hs_phy, phy)
+
+
+/**
+ * Write register.
+ *
+ * @base - MSM DWC3 PHY base virtual address.
+ * @offset - register offset.
+ * @val - value to write.
+ */
+static inline void msm_dwc3_hs_write(void __iomem *base, u32 offset, u32 val)

Re: [PATCH tip/core/rcu 1/5] rcu: Add duplicate-callback tests to rcutorture

2013-08-20 Thread Lai Jiangshan
On 08/20/2013 10:51 AM, Paul E. McKenney wrote:
 From: Paul E. McKenney paul...@linux.vnet.ibm.com
 
 This commit adds a object_debug option to rcutorture to allow the
 debug-object-based checks for duplicate call_rcu() invocations to
 be deterministically tested.
 
 Signed-off-by: Paul E. McKenney paul...@linux.vnet.ibm.com
 Cc: Mathieu Desnoyers mathieu.desnoy...@efficios.com
 Cc: Sedat Dilek sedat.di...@gmail.com
 Cc: Davidlohr Bueso davidlohr.bu...@hp.com
 Cc: Rik van Riel r...@surriel.com
 Cc: Thomas Gleixner t...@linutronix.de
 Cc: Linus Torvalds torva...@linux-foundation.org
 Tested-by: Sedat Dilek sedat.di...@gmail.com
 [ paulmck: Banish mid-function ifdef, more or less per Josh Triplett. ]
 ---
  kernel/rcutorture.c | 45 +
  1 file changed, 45 insertions(+)
 
 diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
 index 3d936f0f..f5cf2bb 100644
 --- a/kernel/rcutorture.c
 +++ b/kernel/rcutorture.c
 @@ -66,6 +66,7 @@ static int fqs_duration;/* Duration of bursts (us), 0 
 to disable. */
  static int fqs_holdoff;  /* Hold time within burst (us). */
  static int fqs_stutter = 3;  /* Wait time between bursts (s). */
  static int n_barrier_cbs;/* Number of callbacks to test RCU barriers. */
 +static int object_debug; /* Test object-debug double call_rcu()?. */
  static int onoff_interval;   /* Wait time between CPU hotplugs, 0=disable. */
  static int onoff_holdoff;/* Seconds after boot before CPU hotplugs. */
  static int shutdown_secs;/* Shutdown time (s).  =0 for no shutdown. */
 @@ -100,6 +101,8 @@ module_param(fqs_stutter, int, 0444);
  MODULE_PARM_DESC(fqs_stutter, Wait time between fqs bursts (s));
  module_param(n_barrier_cbs, int, 0444);
  MODULE_PARM_DESC(n_barrier_cbs, # of callbacks/kthreads for barrier 
 testing);
 +module_param(object_debug, int, 0444);
 +MODULE_PARM_DESC(object_debug, Enable debug-object double call_rcu() 
 testing);
  module_param(onoff_interval, int, 0444);
  MODULE_PARM_DESC(onoff_interval, Time between CPU hotplugs (s), 0=disable);
  module_param(onoff_holdoff, int, 0444);
 @@ -1934,6 +1937,46 @@ rcu_torture_cleanup(void)
   rcu_torture_print_module_parms(cur_ops, End of test: SUCCESS);
  }
  
 +#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
 +static void rcu_torture_leak_cb(struct rcu_head *rhp)
 +{
 +}
 +
 +static void rcu_torture_err_cb(struct rcu_head *rhp)
 +{
 + /* This -might- happen due to race conditions, but is unlikely. */
 + pr_alert(rcutorture: duplicated callback was invoked.\n);
 +}
 +#endif /* #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD */
 +
 +/*
 + * Verify that double-free causes debug-objects to complain, but only
 + * if CONFIG_DEBUG_OBJECTS_RCU_HEAD=y.  Otherwise, say that the test
 + * cannot be carried out.
 + */
 +static void rcu_test_debug_objects(void)
 +{
 +#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
 + struct rcu_head rh1;
 + struct rcu_head rh2;
 +
 + init_rcu_head_on_stack(rh1);
 + init_rcu_head_on_stack(rh2);
 + pr_alert(rcutorture: WARN: Duplicate call_rcu() test starting.\n);
 + local_irq_disable(); /* Make it hard to finish grace period. */

you can use rcu_read_lock() directly.

 + call_rcu(rh1, rcu_torture_leak_cb); /* start grace period. */
 + call_rcu(rh2, rcu_torture_err_cb);
 + call_rcu(rh2, rcu_torture_err_cb); /* duplicate callback. */
 + local_irq_enable();
 + rcu_barrier();
 + pr_alert(rcutorture: WARN: Duplicate call_rcu() test complete.\n);
 + destroy_rcu_head_on_stack(rh1);
 + destroy_rcu_head_on_stack(rh2);
 +#else /* #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD */
 + pr_alert(rcutorture: !CONFIG_DEBUG_OBJECTS_RCU_HEAD, not testing 
 duplicate call_rcu()\n);
 +#endif /* #else #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD */
 +}
 +
  static int __init
  rcu_torture_init(void)
  {
 @@ -2163,6 +2206,8 @@ rcu_torture_init(void)
   firsterr = retval;
   goto unwind;
   }
 + if (object_debug)
 + rcu_test_debug_objects();
   rcutorture_record_test_transition();
   mutex_unlock(fullstop_mutex);
   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] of: reduce the number of PROBE_DEFERs

2013-08-20 Thread Jean-Francois Moine
This patch populates the platform from the device tree into two steps:
the first step creates the nodes that are referenced by a phandle,
the second step creates the other nodes.

This permits to reduce the number of PROBE_DEFERs.

Signed-off-by: Jean-Francois Moine moin...@free.fr
---
A better way to reduce probe deferral could be sorting the nodes
according to their phandle level in the DT blob at compilation time ...
---
 drivers/of/platform.c | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index e0a6514..a2ea858 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -382,8 +382,23 @@ static int of_platform_bus_create(struct device_node *bus,
if (!dev || !of_match_node(matches, bus))
return 0;
 
+   /* first step: create the nodes that are referenced by phandle */
for_each_child_of_node(bus, child) {
-   pr_debug(   create child: %s\n, child-full_name);
+   if (child-phandle == 0)
+   continue;
+   pr_debug(   create child 1: %s\n, child-full_name);
+   rc = of_platform_bus_create(child, matches, lookup, dev-dev, 
strict);
+   if (rc) {
+   of_node_put(child);
+   return rc;
+   }
+   }
+
+   /* second step: create the other nodes */
+   for_each_child_of_node(bus, child) {
+   if (child-phandle != 0)
+   continue;
+   pr_debug(   create child 2: %s\n, child-full_name);
rc = of_platform_bus_create(child, matches, lookup, dev-dev, 
strict);
if (rc) {
of_node_put(child);


-- 
Ken ar c'hentañ | ** Breizh ha Linux atav! **
Jef |   http://moinejf.free.fr/
--
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/


About perf,arm -- oops in validate_event

2013-08-20 Thread P J P

  Hello,

 - https://lkml.org/lkml/2013/8/7/259

I wanted to confirm if this above fix should also go into ARM64 build Or is 
ARM64 platform not vulnerable?


===
$ git diff
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index 9ba33c4..cbed82f 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -317,6 +317,9 @@ validate_event(struct pmu_hw_events *hw_events,
struct hw_perf_event fake_event = event-hw;
struct pmu *leader_pmu = event-group_leader-pmu;

+if (is_software_event(event))
+return 1;
+
if (event-pmu != leader_pmu || event-state = PERF_EVENT_STATE_OFF)
return 1;
===


Thank you.
--
Prasad J Pandit / Red Hat Security Response Team
DB7A 84C5 D3F9 7CD1 B5EB  C939 D048 7860 3655 602B
--
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 0/3] refactor some ldb related clocks

2013-08-20 Thread Liu Ying
On 08/20/2013 05:43 PM, Philipp Zabel wrote:
 Am Dienstag, den 20.08.2013, 16:38 +0800 schrieb Liu Ying:
 The ldb_di[0/1]_ipu_div clock dividers in the CSCMR2 register
 of i.MX53, i.MX6Q and i.MX6DL SoCs can be configured to a 1/3.5
 drivider or a 1/7 divider. The common clock framework cannot
 deal with the two dividers directly even with the divider table
 which only supports integral dividers. So, the idea is to take
 the 1/3.5 and 1/7 dividers as separate fixed factor dividers and
 introduce a new multiplexer clock to be derived from the them.
 Then, the ldb display clock trees can be setup correctly.
 This series contains the necessary clock driver changes, dts code
 changes and imx-drm/ldb driver changes to fullfill the task.
 
 I don't see how this improves the situation. Does this solve any real
 problem?


I don't see any functional problem without this series.
But, it may correct ldb_di[n] clock frequency returned from clk_get_rate() when 
using 1/7 divider.
Furthermore, since this series makes the ldb related clocks from pll to 
ldb_di[0/1] have the CLK_SET_RATE_PARENT flag set, the imx-drm/ldb driver may 
set the clocks' frequency more flexibly, i.e.,
only calling clk_set_rate() for ldb_di[n] clock would be an alternative.

 While I admit to having introduced the combination of 1/3.5 fixed
 divider and configurable 1/1,1/2 divder clocks to describe this
 fractional divider for the reasons you state, I think the correct
 solution would be to improve the table divider to support fractional
 values and get rid of the virtual ldb_din_div_3_5 clocks, not
 introduce more virtual clocks.

Yes, it's good to support fractional values for the table divider(not sure if 
there is any plan for this).
I see there is something similar in 'include/linux/sh_clk.h'.

 
 regards
 Philipp
 
 

Regards,
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] of: reduce the number of PROBE_DEFERs

2013-08-20 Thread Grant Likely
On Tue, Aug 20, 2013 at 11:01 AM, Jean-Francois Moine moin...@free.fr wrote:
 This patch populates the platform from the device tree into two steps:
 the first step creates the nodes that are referenced by a phandle,
 the second step creates the other nodes.

 This permits to reduce the number of PROBE_DEFERs.

 Signed-off-by: Jean-Francois Moine moin...@free.fr
 ---
 A better way to reduce probe deferral could be sorting the nodes
 according to their phandle level in the DT blob at compilation time ...

Have you got measurements or statistics that show this making a
difference? I suspect you'll find for boot time it will have little to
no affect since the device driver probe order is more closely related
to the kernel link order than the order that devices were registered.

g.

 ---
  drivers/of/platform.c | 17 -
  1 file changed, 16 insertions(+), 1 deletion(-)

 diff --git a/drivers/of/platform.c b/drivers/of/platform.c
 index e0a6514..a2ea858 100644
 --- a/drivers/of/platform.c
 +++ b/drivers/of/platform.c
 @@ -382,8 +382,23 @@ static int of_platform_bus_create(struct device_node 
 *bus,
 if (!dev || !of_match_node(matches, bus))
 return 0;

 +   /* first step: create the nodes that are referenced by phandle */
 for_each_child_of_node(bus, child) {
 -   pr_debug(   create child: %s\n, child-full_name);
 +   if (child-phandle == 0)
 +   continue;
 +   pr_debug(   create child 1: %s\n, child-full_name);
 +   rc = of_platform_bus_create(child, matches, lookup, 
 dev-dev, strict);
 +   if (rc) {
 +   of_node_put(child);
 +   return rc;
 +   }
 +   }
 +
 +   /* second step: create the other nodes */
 +   for_each_child_of_node(bus, child) {
 +   if (child-phandle != 0)
 +   continue;
 +   pr_debug(   create child 2: %s\n, child-full_name);
 rc = of_platform_bus_create(child, matches, lookup, 
 dev-dev, strict);
 if (rc) {
 of_node_put(child);


 --
 Ken ar c'hentañ | ** Breizh ha Linux atav! **
 Jef |   http://moinejf.free.fr/
--
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] [BUGFIX] crash/ioapic: Prevent crash_kexec() from deadlocking of ioapic_lock

2013-08-20 Thread Eric W. Biederman
Yoshihiro YUNOMAE yoshihiro.yunomae...@hitachi.com writes:

 Hi Ingo,

 Thank you for fixing typos!
 OK, I'll fix them and rename to ioapic_zap_locks().

 Thank you again!


The better fix for this would be to remove the disable_IO_APIC call from
crash_kexec.

I know last time it was investigated the kernel was very close to
working without needing that, and the code will be much more robust in
the long term if we can avoid disabling them in the crashing kernel.

Yoshihiro is there any chance you can look into removing the
disable_IO_APIC entirely?

The apic disablement and the disable_IO_APIC exists entirely due to
limitations in the kernel boot path.

Eric
--
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] writeback: fix NULL dereference when device is gone

2013-08-20 Thread Peter Wu
On Monday 19 August 2013 19:02:40 Tejun Heo wrote:
 On Tue, Aug 20, 2013 at 12:45:53AM +0200, Peter Wu wrote:
  diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
  index 68851ff..6e38a8b 100644
  --- a/fs/fs-writeback.c
  +++ b/fs/fs-writeback.c
  @@ -1007,7 +1007,8 @@ void bdi_writeback_workfn(struct work_struct *work)
  
  struct backing_dev_info *bdi = wb-bdi;
  long pages_written;
  
  -   set_worker_desc(flush-%s, dev_name(bdi-dev));
  +   if (bdi-dev)
  +   set_worker_desc(flush-%s, dev_name(bdi-dev));
 
 Hmmm... bdi-dev is cleared after bdi_wb_shutdown() so the work item
 should no longer be running.  It seems like something is queueing the
 work item after shutdown and the proper fix would be finding out which
 and fixing it.  Can you please verify whether adding
 WARN_ON(!bdi-dev) in bdi_wakeup_thread_delayed() trigger anything?

Initially I did not get any warnings, so I added more. The patch (on top of
v3.11-rc6-27-g94fc5d9 plus some unrelated r8169 patches):

---8---
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 68851ff..64a4cf9 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1007,7 +1007,9 @@ void bdi_writeback_workfn(struct work_struct *work)
struct backing_dev_info *bdi = wb-bdi;
long pages_written;
 
-   set_worker_desc(flush-%s, dev_name(bdi-dev));
+   WARN_ON(!bdi-dev);
+   if (bdi-dev)
+   set_worker_desc(flush-%s, dev_name(bdi-dev));
current-flags |= PF_SWAPWRITE;
 
if (likely(!current_is_workqueue_rescuer() ||
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index e04454c..6f754ed 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -290,6 +290,7 @@ void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi)
 {
unsigned long timeout;
 
+   WARN_ON(!bdi-dev);
timeout = msecs_to_jiffies(dirty_writeback_interval * 10);
mod_delayed_work(bdi_wq, bdi-wb.dwork, timeout);
 }
@@ -362,6 +363,7 @@ static void bdi_wb_shutdown(struct backing_dev_info *bdi)
 * @bdi-bdi_list is empty telling bdi_Writeback_workfn() that @bdi
 * is dying and its work_list needs to be drained no matter what.
 */
+   WARN_ON(!bdi-dev);
mod_delayed_work(bdi_wq, bdi-wb.dwork, 0);
flush_delayed_work(bdi-wb.dwork);
WARN_ON(!list_empty(bdi-work_list));
@@ -406,6 +408,10 @@ void bdi_unregister(struct backing_dev_info *bdi)
spin_unlock_bh(bdi-wb_lock);
 
device_unregister(dev);
+   if (delayed_work_pending(bdi-wb.dwork))
+   WARN(1, bdi-dwork is pending!);
+   else
+   WARN(1, in bdi_unregister);
}
 }
 EXPORT_SYMBOL(bdi_unregister);
---8---

In order to reproduce, I used the command:

sudo dd if=/dev/zero of=/dev/sdc bs=1M count=300 
sleep .1  sudo tee /sys/bus/usb/devices/6-2/remove 1

=== serial console ===
[  196.186205] usb 6-2: new SuperSpeed USB device number 2 using xhci_hcd
[  196.208702] usb 6-2: Parent hub missing LPM exit latency info.  Power 
management will be impacted.
[  196.221963] usb 6-2: New USB device found, idVendor=1058, idProduct=0748
[  196.228662] usb 6-2: New USB device strings: Mfr=1, Product=2, SerialNumber=5
[  196.235791] usb 6-2: Product: My Passport 0748
[  196.240234] usb 6-2: Manufacturer: Western Digital
[  196.245025] usb 6-2: SerialNumber: 57584231414E35383439
[  196.252492] usb-storage 6-2:1.0: USB Mass Storage device detected
[  196.258827] scsi13 : usb-storage 6-2:1.0
[  197.263013] scsi 13:0:0:0: Direct-Access WD   My Passport 0748 1022 
PQ: 0 ANSI: 6
[  197.271459] scsi 13:0:0:1: Enclosure WD   SES Device   1022 
PQ: 0 ANSI: 6
[  197.279981] sd 13:0:0:0: Attached scsi generic sg3 type 0
[  197.280207] sd 13:0:0:0: [sdc] 1953458176 512-byte logical blocks: (1.00 
TB/931 GiB)
[  197.280668] sd 13:0:0:0: [sdc] Write Protect is off
[  197.280670] sd 13:0:0:0: [sdc] Mode Sense: 47 00 10 08
[  197.281340] sd 13:0:0:0: [sdc] No Caching mode page present
[  197.281341] sd 13:0:0:0: [sdc] Assuming drive cache: write through
[  197.283092] sd 13:0:0:0: [sdc] No Caching mode page present
[  197.283093] sd 13:0:0:0: [sdc] Assuming drive cache: write through
[  197.283318]  sdc: unknown partition table
[  197.330898] scsi 13:0:0:1: Attached scsi generic sg4 type 13
[  197.338824] sd 13:0:0:0: [sdc] No Caching mode page present
[  197.39] sd 13:0:0:0: [sdc] Assuming drive cache: write through
[  197.350647] sd 13:0:0:0: [sdc] Attached SCSI disk
[  245.972280] [ cut here ]
[  245.976904] WARNING: CPU: 3 PID: 2605 at 
/home/pc/Linux-src/linux/mm/backing-dev.c:414 bdi_unregister+0x107/0x1c0()
[  245.978167] [ cut here ]
[  245.978170] WARNING: CPU: 1 PID: 2608 at 
/home/pc/Linux-src/linux/mm/backing-dev.c:293 
bdi_wakeup_thread_delayed+0x5e/0x60()
[  245.978189] Modules linked in: kvm_intel kvm dm_crypt binfmt_misc joydev 

Re: [RFC 06/17] ARM: imx: remove custom .init_time hook

2013-08-20 Thread Russell King - ARM Linux
On Tue, Aug 20, 2013 at 11:20:06AM +0200, Sebastian Hesselbarth wrote:
 Yeah, I am having troubles with linux-arm-kernel rejecting my mails
 because of a suspicious header. I have no clue, what has changed lately
 with my mails sent by git send-email to make them get stuck.

I believe David feels the same way as I do wrt thread hijacking on
mailing lists.  The problem is that it seems all too easy for people
to hit the reply button on some random message from the mailing list,
change the subject line, and then type an entirely new email into the
body not related to the message they hit reply on.

So, any message which doesn't look like it's a reply to the preceding
message gets held for moderation.  However, git came along and broke
that - because every patch sent as a threaded reply to a cover email
is effectively a hijack.  Therefore, there's an exception to this -
if the subject line starts with [PATCH then it will be allowed through.

This means if you want to send a RFC, it must be [PATCH RFC not just
[RFC, because [RFC isn't whitelisted.  Maybe it should be, but that
is David's decision now.
--
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 00/19] ARM: at91: move to common clk framework

2013-08-20 Thread boris brezillon

Hello Mike,

Could you take a look at this patch series ?

I'd like to have your opinion on some key points:

- at91 clk dt bindings
- in some clk_prepare (pll clks, main clk) callbacks I make use of 
wait_event to wait for an interrupt.

  Should I do it this way or instead use the cpu_relax function ?
- some clks define clk_prepare but not clk_enable (enabling work is done 
in clk_prepare).
  Is it okay to leave this callback empty and rely on the default 
behaviour (enable count increment) ?

- at91 clk implemetation in its whole


Best Regards,

Boris

On 08/08/2013 06:53, Boris BREZILLON wrote:

Hello,

This patch series is the 3rd version of the new at91 clock implementation
(using common clk framework).

Most of the clock provided by the PMC (Power Management Controller) are
implemented :
- main clock (main oscillator)
- pll clocks
- master clock
- programmable clocks
- utmi clock
- peripheral clocks
- system clocks

This implementation is only compatible with device tree definition.
The goal is to define the whole clock tree in the device tree.

Please feel free to comment the dt bindinds.

This patch series is based on linux-next and has been tested on sama5d31ek
board using device tree. It compiles for other SoCs and both with and
but it has not been tested (Richard, I did not add your Tested-by because
a lot of things have changed since v2).

BTW could other people test it on other boards (I only have a kizbox and
a sama5d31ek dev kit).

Best Regards,
Boris

Changes since v2:
  - fix several bugs in clk implementations
  - drop non-dt boards support
  - split the series to ease review and tests:
* 1 patch series for new clk implementations (this series)
* 1 patch series to move each at91 SoC to common clk framework (coming soon)
  - modify dt-bindings (add atmel,clk- prefix to atmel specific properties)
  - add clk macros for dt-bindings
  - add pmc framework (helper function to access pmc registers)
  - add interrupt support to enable passive wait in clk_prepare functions

Changes since v1:
  - fix bugs in pll, programmable and system clock implementations
(wrong bit position).
  - add usb clock configuration support (ohci and udc drivers +
clk_lookup for non dt boards)
  - rework of the system clock interfaces (no need to define a parent clock,
system clock is a gate with no rate info)
  - change system, peripheral and programmable clk dt bindings (1 master node
and multiple child nodes each defining a system/peripheral or prog clock)
  - fix bugs in sama5 dt definition

Boris BREZILLON (19):
   ARM: at91: move at91_pmc.h to include/linux/clk/at91_pmc.h
   ARM: at91: add Kconfig options for common clk support
   clk: at91: add PMC base support
   clk: at91: add PMC macro file for dt definitions
   clk: at91: add PMC main clock
   clk: at91: add PMC pll clocks
   clk: at91: add pll id macros for pll dt bindings
   clk: at91: add PMC master clock
   clk: at91: add PMC system clocks
   ARM: at91/dt: add system clk id definitions in dt-bindings include
 dir
   clk: at91: add PMC peripheral clocks
   clk: at91: add peripheral clk macros for peripheral clk dt bindings
   clk: at91: add PMC programmable clocks
   clk: at91: add PMC utmi clock
   clk: at91: add PMC usb clock
   clk: at91: add PMC smd clock
   clk: at91: add PMC clk device tree binding doc.
   ARM: at91: move pit timer to common clk framework
   ARM: at91: add new compatible strings for pmc driver

  .../devicetree/bindings/clock/at91-clock.txt   |  312 
  arch/arm/mach-at91/Kconfig |   44 ++
  arch/arm/mach-at91/Kconfig.non_dt  |6 +
  arch/arm/mach-at91/Makefile|2 +-
  arch/arm/mach-at91/at91rm9200.c|2 +-
  arch/arm/mach-at91/at91sam9260.c   |2 +-
  arch/arm/mach-at91/at91sam9261.c   |2 +-
  arch/arm/mach-at91/at91sam9263.c   |2 +-
  arch/arm/mach-at91/at91sam926x_time.c  |   14 +-
  arch/arm/mach-at91/at91sam9g45.c   |2 +-
  arch/arm/mach-at91/at91sam9n12.c   |2 +-
  arch/arm/mach-at91/at91sam9rl.c|2 +-
  arch/arm/mach-at91/at91sam9x5.c|2 +-
  arch/arm/mach-at91/clock.c |8 +-
  arch/arm/mach-at91/generic.h   |3 +-
  arch/arm/mach-at91/pm.c|2 +-
  arch/arm/mach-at91/pm_slowclock.S  |2 +-
  arch/arm/mach-at91/sama5d3.c   |2 +-
  arch/arm/mach-at91/setup.c |8 +-
  drivers/clk/Makefile   |1 +
  drivers/clk/at91/Makefile  |   12 +
  drivers/clk/at91/clk-main.c|  171 +++
  drivers/clk/at91/clk-master.c  |  386 +++
  drivers/clk/at91/clk-peripheral.c  |  401 

Re: Kernel summit 2013: Call for Hobbyists

2013-08-20 Thread Rob Landley

On 08/18/2013 03:26:03 AM, Geert Uytterhoeven wrote:
On Fri, Aug 16, 2013 at 11:02 PM, Francois Romieu  
rom...@fr.zoreil.com wrote:

 As a hobbyist, I have less time than most pro and must cope with
 whatever brain juice remains after the paid work. It doesn't make me

Indeed. And the dosing of brain juice is not always aligned with the  
steady
pace of Linux kernel development, causing hobyists to miss merge  
windows,

resubmissions, and general follow-up.


And those of us who don't have follow linux-kernel as part of a day  
job's responsibilities tend to be several days behind, so it's hard to  
participate in coversations.


I seldom get paid to work on a current kernel. I _have_ been paid to  
beat some horrible vendor board support package with a rock until it  
sticks to the hardware, but this is invariably multiple years behind  
current and has a lineage like vanilla kernel, forked by android for  
ice cream sandwich, then forked by TI's Netra Board Support Package,  
then forked by Polycom because implementing Skype in hardware seemed  
like a good idea at the time. (My last contract involved Centos 6.3, a  
fresh release with a 4 year old kernel. Lots of backporting stuff from  
~3.4 to 2.6.32 or whatever it was using. Because that's when what I  
needed was feature complete and there were fewer API changes than  
current, that's why.)


I do sometimes get to chip bits off and port them to upstream, after  
the fact, if there's time, and if my boss can shield the effort from  
every legal department's ironclad desire to do the absolute minimum  
required and no more. Usually there's just a nominal source tarball  
snapshot (no source control history, that's confidential) posted to  
some obscure website when the hardware finally ships (and the dev  
team's broken up), and if you _do_ diff this obsolete thing against  
vanilla the diff is multiple megabytes and most of it wasn't our  
changes.


Intermittently getting paid to do that means I _don't_ qualify as a  
hobbyist, apparently. Even though the vast majority of actual open  
soruce programming I get done is in the downtime _between_ contracts.


(I'm listed in MAINTAINERS for trying to prevent documentation from  
falling through the cracks when nobody else merges it through their  
tree. I got paid to work on Linux documentation once, for a very nice 6  
months back in 2007, but I didn't get listed in MAINTAINERS until ~3  
years after that stopped.)


Rob--
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 tip/core/rcu 0/3] Documentation updates for 3.12

2013-08-20 Thread Rob Landley

On 08/17/2013 08:25:22 PM, Paul E. McKenney wrote:

Hello!

This series provides a few documentation updates:

1.  Update rcu_barrier() documentation to note that it no longer is
guaranteed to wait for a full grace period.  This guarantee was
a victim of energy efficiency.

2.  Update RTFP documentation.

3.  Fix a control-dependency example in the memory-barriers
documentation.


Acked-by: Rob Landley r...@landley.net

(I'm just happy you don't have gratuitous quizzes mixed through it...)

Rob--
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: [REGRESSION] 3.10.{6,7} crashes on network activity

2013-08-20 Thread Georgios Magklaras
I verify the same issue on a Latitude E6520 running both the
vanilla/clean and the Fedora 19 specific kernels. I thought it was the
NVIDIA/nouveau driver and I reproduce by switching to non graphical mode
and performing scp transfers.

GM


On Tue, 2013-08-20 at 11:58 +0200, Arend van Spriel wrote:
 On 08/20/2013 10:36 AM, Tom Gundersen wrote:
  On Tue, Aug 20, 2013 at 4:15 PM, Arend van Spriel ar...@broadcom.com 
  wrote:
  On 08/20/2013 06:56 AM, Felix Fietkau wrote:
 
  On 2013-08-20 2:28 AM, Greg Kroah-Hartman wrote:
 
  On Tue, Aug 20, 2013 at 08:26:11AM +0800, Tom Gundersen wrote:
 
  On Tue, Aug 20, 2013 at 8:03 AM, Greg Kroah-Hartman
  gre...@linuxfoundation.org wrote:
 
  On Tue, Aug 20, 2013 at 07:59:47AM +0800, Tom Gundersen wrote:
 
  Hi guys,
 
  Starting with 3.10.6 (and still present in .7) I get an oops on
  connecting to the network.
 
  The attached picture shows the oops. In case it does not reach the ML,
  the top of the call trace reads:
 
  brcms_c_compute_rtscts_dur
  brcms_c_ampdu_finalize
  ampdu_finalize
  dma_txfast
  brcms_c_txfifo
  brcms_c_sendpkt_mac80211
  brcms_ops_tx
  __ieee80211_tx
 
  I bisected the problem and the first bad commit is
 
  commit ef47a5e4f1aaf1d0e2e6875e34b2c9595897bef6
  Author: Felix Fietkau n...@openwrt.org
  Date:   Fri Jun 28 21:04:35 2013 +0200
 
mac80211/minstrel_ht: fix cck rate sampling
 
commit 1cd158573951f737fbc878a35cb5eb47bf9af3d5 upstream.
 
  Reverting it on top of .7 fixes the problem.
 
  I had the same (I suppose) problem on mainline some time ago, but I
  have not bisected it, verified that the problem still occurs there, or
  checked if reverting the upstream patch fixes it. I'd be happy to do
  that if it would help though.
 
  Let me know if you need any more information.
 
 
  Do you have this same problem with 3.11-rc6 as well?
 
 
  Yes, I just confirmed. I also confirmed that reverting the mainline
  commit on top of -rc6 fixes the problem.
 
 
  Great, thanks.
 
  Felix and Johannes, any chance we can get this reverted in Linus tree
  soon, and push that revert back to the 3.10 stable tree as well?
 
  I'd like to avoid a revert, since that will simply replace one set of
  issues with another. Let's limit the use of the feature that brcmsmac
  can't handle to drivers that are known to work with it. Tom, Please
  test this patch to see if it fixes your issue.
 
 
  Hi Felix,
 
  I have been diving into root causing why brcmsmac can not handle cck
  fallback rates, because it should. Maybe it is better to flag no cck 
  support
  and only change brcmsmac.
 
  Hi Arend,
 
  In case you cannot reproduce, let me know if I can help with testing 
  patches.
 
 So far I have not been able to reproduce it. I have a patch to avoid the 
 oops, but the transmit of the related frames will fail in the device so 
 it is not a real fix. I will let you you know.
 
 Regards,
 Arend
 
  Cheers,
 
  Tom
 
 
 
 --
 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/


--
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] HID: i2c-hid: use correct type for ACPI _DSM parameter

2013-08-20 Thread Jiri Kosina
On Mon, 19 Aug 2013, Benjamin Tissoires wrote:

  ACPI 5.0 specification requires the fourth parameter to the _DSM (Device
  Specific Method) to be of type package instead of integer. Failing to do
  that we get following warning on the console:
  
ACPI Warning: \_SB_.PCI0.I2C1.TPL0._DSM: Argument #4 type mismatch - 
  Found [Integer],
  ACPI requires [Package] (20130517/nsarguments-95)
  
  Fix this by passing an empty package to the _DSM method. The HID over I2C
  specification doesn't require any specific values to be passed with this
  parameter.
  
  Signed-off-by: Mika Westerberg mika.westerb...@linux.intel.com
  ---
 
 Looks simple and straightforward :)
 
 Reviewed-by: Benjamin Tissoires benjamin.tissoi...@redhat.com

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs
--
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] extcon: extcon-dra7xx: Add extcon driver for USB ID detection

2013-08-20 Thread Chanwoo Choi
Hi George,

 diff --git a/Documentation/devicetree/bindings/extcon/extcon-dra7xx.txt 
 b/Documentation/devicetree/bindings/extcon/extcon-dra7xx.txt
 new file mode 100644
 index 000..37e4c22
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/extcon/extcon-dra7xx.txt
 @@ -0,0 +1,19 @@
 +EXTCON FOR DRA7xx
 +
 +Required Properties:
 + - compatible : Should be ti,dra7xx-usb
 + - gpios : phandle to ID pin and interrupt gpio.
 +
 +Optional Properties:
 +  - interrupt-parent : interrupt controller phandle
 +  - interrupts : interrupt number
 +
 +
 +dra7x_extcon1 {
 You used 'dra7xx-usb' device name. Why did you use 'dra7x_extcon1' name?
 What is meaning 'dra7x_extcon1'?
 
 I will rename it to  dra7xx_extcon.

extcon naming means various external connector device. e.g., usb, jack, etc...
So, I prefer 'dra7xx_usb' instead of 'dra7xx_extcon'. I have plan to divide
extcon device driver according to the kind of device.


 +static int id_poll_func(void *data)
 +{
 +struct dra7xx_usb *dra7xx_usb = (struct dra7xx_usb *) data;
 +
 +allow_signal(SIGINT);
 +allow_signal(SIGTERM);
 +allow_signal(SIGKILL);
 +allow_signal(SIGUSR1);
 +
 +set_freezable();
 +
 +while (!kthread_should_stop()) {
 +dra7xx_usb-id_current = gpio_get_value_cansleep
 +(dra7xx_usb-id_gpio);
 +if (dra7xx_usb-id_current == dra7xx_usb-id_prev) {
 +schedule_timeout_interruptible
 +(msecs_to_jiffies(2*1000));
 +continue;
 +} else if (dra7xx_usb-id_current == 0) {
 +extcon_set_cable_state(dra7xx_usb-edev, USB, false);
 +extcon_set_cable_state(dra7xx_usb-edev,
 +USB-HOST, true);
 +} else {
 +extcon_set_cable_state(dra7xx_usb-edev,
 +USB-HOST, false);
 +extcon_set_cable_state(dra7xx_usb-edev, USB, true);
 +}
 Should dra7xx_usb keep always connected state with either USB or USB-HOST 
 cable?
 I don't understand. So please explain detailed operation method of 
 dra7xx_usb device.
 
 In dra7xx only ID pin is connected to the SoC gpio. There is no way, 
 currently to detect the VBUS on/off.
 So I always default to either HOST/DEVICE mode solely depending on the ID pin 
 value.
OK.

But I don't want to use kthread with polling method.
I recommend that you use interrupt method for cable detection.
All of extcon device driver have only used interrupt method without polling.

 

 +dra7xx_usb-id_prev = dra7xx_usb-id_current;
 +}
 +
 +return 0;
 +}
 +
 +static irqreturn_t id_irq_handler(int irq, void *data)
 +{
 +struct dra7xx_usb *dra7xx_usb = (struct dra7xx_usb *) data;
 +
 +dra7xx_usb-id_current = gpio_get_value_cansleep(dra7xx_usb-id_gpio);
 +
 +if (dra7xx_usb-id_current == dra7xx_usb-id_prev) {
 +return IRQ_NONE;
 +} else if (dra7xx_usb-id_current == 0) {

You should define some constant variable to clarify '0' meaning instead of 
using '0' directly.


 +dra7xx_usb = devm_kzalloc(pdev-dev, sizeof(*dra7xx_usb), GFP_KERNEL);
 +if (!dra7xx_usb)
 +return -ENOMEM;
 You have to add error message with dev_err().
 
 devm_kzalloc itself should give some message.

ok.


 +status = extcon_dev_register(dra7xx_usb-edev, dra7xx_usb-dev);
 +if (status) {
 +dev_err(pdev-dev, failed to register extcon device\n);
 +return status;
 You should restore previous operation about dra7xx_usb-irq_gpio.
 
 okay

 +}
 +
 +dra7xx_usb-id_prev = gpio_get_value_cansleep(dra7xx_usb-id_gpio);
 +if (dra7xx_usb-id_prev) {

ditto.
You should define some constant variable to clarify 'dra7xx_usb-id_prev' 
meaning.

 +extcon_set_cable_state(dra7xx_usb-edev, USB-HOST, false);
 +extcon_set_cable_state(dra7xx_usb-edev, USB, true);
 +} else {
 +extcon_set_cable_state(dra7xx_usb-edev, USB, false);
 +extcon_set_cable_state(dra7xx_usb-edev, USB-HOST, true);
 +}
 why did you do keep always connected state?
 
 There is no way, currently to detect the VBUS on/off.
 So I always default to either HOST/DEVICE mode solely depending on the ID pin 
 value.
 
 +
 +if (dra7xx_usb-irq_gpio) {
 +status = devm_request_threaded_irq(dra7xx_usb-dev, irq_num,
 +NULL, id_irq_handler, IRQF_SHARED |
 +IRQF_ONESHOT | IRQF_TRIGGER_FALLING,
 +dev_name(pdev-dev), (void *) dra7xx_usb);
 +if (status)
 +dev_err(dra7xx_usb-dev, failed to request irq #%d\n,
 +irq_num);
 If devm_request_threaded_irq() return fail state, why did not you do add 
 error exception?
 
 If interrupt fails I fallback to polling thread.
 +else
 +return 0;
 If devm_request_threaded_irq() return success state, why did you directly 
 call 'return'?
 kthread_create operation isn't necessary?
 
 Yes kthread is optional. Some boards doenot have the ID pin hooked onto the 
 GPIO.
 In 

Re: [PATCH v2 1/2] input: document gamepad API and add extra keycodes

2013-08-20 Thread Jiri Kosina
On Fri, 16 Aug 2013, David Herrmann wrote:

 Hm, I just noticed that this got merged without the 
 Documentation/input/gamepad.txt description. Was this intentional? 
 https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d09bbfd2a8408a995419dff0d2ba906013cf4cc9

My git-fu horribly failed in this case, sorry for that. Now queued, thanks 
a lot for noticing.

-- 
Jiri Kosina
SUSE Labs
--
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 06/17] ARM: imx: remove custom .init_time hook

2013-08-20 Thread Sebastian Hesselbarth

On 08/20/13 12:20, Russell King - ARM Linux wrote:

On Tue, Aug 20, 2013 at 11:20:06AM +0200, Sebastian Hesselbarth wrote:

Yeah, I am having troubles with linux-arm-kernel rejecting my mails
because of a suspicious header. I have no clue, what has changed lately
with my mails sent by git send-email to make them get stuck.


I believe David feels the same way as I do wrt thread hijacking on
mailing lists.  The problem is that it seems all too easy for people
to hit the reply button on some random message from the mailing list,
change the subject line, and then type an entirely new email into the
body not related to the message they hit reply on.

So, any message which doesn't look like it's a reply to the preceding
message gets held for moderation.  However, git came along and broke
that - because every patch sent as a threaded reply to a cover email
is effectively a hijack.  Therefore, there's an exception to this -
if the subject line starts with [PATCH then it will be allowed through.

This means if you want to send a RFC, it must be [PATCH RFC not just
[RFC, because [RFC isn't whitelisted.  Maybe it should be, but that
is David's decision now.


Russell,

I already guessed it has something to do with the In-reply-to line, as
only the patches but not the cover letter gets stuck. Thanks for
pointing me at the missing PATCH prefix and sorry for the noise on
the moderators screen.

For me it is fine not to expand the whitelist and after reading
SubmittingPatches again, it clearly says that RFC is just a tag to be
added after PATCH.

Sebastian

--
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 v2 1/2] input: document gamepad API and add extra keycodes

2013-08-20 Thread David Herrmann
Hi

On Tue, Aug 20, 2013 at 12:32 PM, Jiri Kosina jkos...@suse.cz wrote:
 On Fri, 16 Aug 2013, David Herrmann wrote:

 Hm, I just noticed that this got merged without the
 Documentation/input/gamepad.txt description. Was this intentional?
 https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d09bbfd2a8408a995419dff0d2ba906013cf4cc9

 My git-fu horribly failed in this case, sorry for that. Now queued, thanks
 a lot for noticing.

Took me 2 month noticing ;) Thanks for picking it up.

Regards
David
--
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: About perf,arm -- oops in validate_event

2013-08-20 Thread Catalin Marinas
On 20 August 2013 11:03, P J P ppan...@redhat.com wrote:
  - https://lkml.org/lkml/2013/8/7/259

 I wanted to confirm if this above fix should also go into ARM64 build Or is
 ARM64 platform not vulnerable?

It is and I'll push patches to mainline (Will is preparing them).

Catalin
--
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-SR9700] Merge USB 1.1 Ethernet Adapter SR9700 Device Driver into the Linux Kernel

2013-08-20 Thread liujunliang_ljl
Dear all :

I am the software engineer Liu Junliang from ShenZhen CoreChips 
high technology company, on the market of SR9700 chip is designed and owned by 
us. 
SR9700 is a type of USB to Ethernet Converter and is compatible with 
USB 1.1 protocol, We want to merge SR9700 device driver into the Linux Kernel. 
The following is the Linux 3.10.7 version patch for SR9700, Please give us the 
assessment and support.
Thanks a lot.

[PATCH] : 
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 287cc62..a94b196 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -272,6 +272,14 @@ config USB_NET_DM9601
  This option adds support for Davicom DM9601 based USB 1.1
  10/100 Ethernet adapters.
 
+config USB_NET_SR9700
+   tristate CoreChip-sz SR9700 based USB 1.1 10/100 ethernet devices
+   depends on USB_USBNET
+   select CRC32
+   help
+ This option adds support for CoreChip-sz SR9700 based USB 1.1
+ 10/100 Ethernet adapters.
+
 config USB_NET_SMSC75XX
tristate SMSC LAN75XX based USB 2.0 gigabit ethernet devices
depends on USB_USBNET
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index 9ab5c9d..bba87a2 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_USB_NET_AX88179_178A)  += ax88179_178a.o
 obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
 obj-$(CONFIG_USB_NET_CDC_EEM)  += cdc_eem.o
 obj-$(CONFIG_USB_NET_DM9601)   += dm9601.o
+obj-$(CONFIG_USB_NET_SR9700)   += sr9700.o
 obj-$(CONFIG_USB_NET_SMSC75XX) += smsc75xx.o
 obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o
 obj-$(CONFIG_USB_NET_GL620A)   += gl620a.o
diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c
new file mode 100644
index 000..6a6429a
--- /dev/null
+++ b/drivers/net/usb/sr9700.c
@@ -0,0 +1,557 @@
+/*
+ * CoreChip-sz SR9700 one chip USB 1.1 Ethernet Devices
+ *
+ * Author : liujl liujunliang_...@163.com
+ *
+ * Based on dm9601.c
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed as is without any warranty of any
+ * kind, whether express or implied.
+ */
+
+//#define DEBUG
+
+#include linux/module.h
+#include linux/sched.h
+#include linux/stddef.h
+#include linux/init.h
+#include linux/netdevice.h
+#include linux/etherdevice.h
+#include linux/ethtool.h
+#include linux/mii.h
+#include linux/usb.h
+#include linux/crc32.h
+#include linux/usb/usbnet.h
+
+#include sr9700.h
+
+static int sr_read(struct usbnet *dev, u8 reg, u16 length, void *data)
+{
+   int err;
+
+   err = usbnet_read_cmd(dev, SR_RD_REGS, SR_REQ_RD_REG,
+   0, reg, data, length);
+   if(err != length  err = 0)
+   err = -EINVAL;
+   return err;
+}
+
+static int sr_write(struct usbnet *dev, u8 reg, u16 length, void *data)
+{
+   int err;
+
+   err = usbnet_write_cmd(dev, SR_WR_REGS, SR_REQ_WR_REG,
+   0, reg, data, length);
+   if (err = 0  err  length)
+   err = -EINVAL;
+   
+   return err;
+}
+
+static int sr_read_reg(struct usbnet *dev, u8 reg, u8 *value)
+{
+   return sr_read(dev, reg, 1, value);
+}
+
+static int sr_write_reg(struct usbnet *dev, u8 reg, u8 value)
+{
+   return usbnet_write_cmd(dev, SR_WR_REGS, SR_REQ_WR_REG,
+  value, reg, NULL, 0);
+}
+
+static void sr_write_async(struct usbnet *dev, u8 reg, u16 length, void *data)
+{
+   usbnet_write_cmd_async(dev, SR_WR_REGS, SR_REQ_WR_REG,
+   0, reg, data, length);
+}
+
+static void sr_write_reg_async(struct usbnet *dev, u8 reg, u8 value)
+{
+   usbnet_write_cmd_async(dev, SR_WR_REGS, SR_REQ_WR_REG,
+   value, reg, NULL, 0);
+}
+
+static int sr_share_read_word(struct usbnet *dev, int phy, u8 reg, __le16 
*value)
+{
+   int ret, i;
+
+   mutex_lock(dev-phy_mutex);
+
+   sr_write_reg(dev, EPAR, phy ? (reg | 0x40) : reg);
+   sr_write_reg(dev, EPCR, phy ? 0xc : 0x4);
+
+   for (i = 0; i  SR_SHARE_TIMEOUT; i++) {
+   u8 tmp = 0;
+
+   udelay(1);
+   ret = sr_read_reg(dev, EPCR, tmp);
+   if (ret  0)
+   goto out;
+
+   /* ready */
+   if ((tmp  1) == 0)
+   break;
+   }
+
+   if (i = SR_SHARE_TIMEOUT) {
+   netdev_err(dev-net, %s read timed out!, phy ? phy : 
eeprom);
+   ret = -EIO;
+   goto out;
+   }
+
+   sr_write_reg(dev, EPCR, 0x0);
+   ret = sr_read(dev, EPDR, 2, value);
+
+   netdev_dbg(dev-net, read shared %d 0x%02x returned 0x%04x, %d,
+  phy, reg, *value, ret);
+
+ out:
+   mutex_unlock(dev-phy_mutex);
+   return ret;
+}
+
+static int sr_share_write_word(struct usbnet 

Re: [PATCH] drivers/spi/spi-tegra114.c clean use of devm_ioremap_resource()

2013-08-20 Thread Mark Brown
On Tue, May 14, 2013 at 12:07:12PM +0200, Laurent Navet wrote:
 Check of 'r' and calls to dev_err are already done in devm_ioremap_resource,
 so no need to do them twice.

Applied, thanks.


signature.asc
Description: Digital signature


Re: [PATCH] pinctrl: palmas: Fix device name in Kconfig text

2013-08-20 Thread Laxman Dewangan

On Monday 19 August 2013 08:37 PM, Mark Brown wrote:

From: Mark Brown broo...@linaro.org

The device family is called Palmas so there should be a 's' on the end of
the name.

Signed-off-by: Mark Brown broo...@linaro.org
---



Acked-by: Laxman Dewangan ldewan...@nvidia.com

Thanks,
Laxman
--
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] f2fs: fix wrong BUG_ON condition

2013-08-20 Thread Jaegeuk Kim
This patch removes a false-alaramed BUG_ON.
The previous BUG_ON condition didn't cover the following true scenario.

In f2fs_add_link, 1) get_new_data_page gives an uptodate page successfully,
and then, 2) init_inode_metadata returns -ENOSPC.
At this moment, a new clean data page is remained in the page cache, but its
block address still indicates NEW_ADDR.
After then, even if sync is called, this clean data page cannot be written to
the disk due to the clean state.

So this means that get_lock_data_page should make a new empty page when its
block address is NEW_ADDR and its page is not uptodated.

Signed-off-by: Jaegeuk Kim jaegeuk@samsung.com
---
 fs/f2fs/data.c | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index ea3cb29..6b328de 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -259,8 +259,17 @@ repeat:
if (PageUptodate(page))
return page;
 
-   BUG_ON(dn.data_blkaddr == NEW_ADDR);
-   BUG_ON(dn.data_blkaddr == NULL_ADDR);
+   /*
+* A new dentry page is allocated but not able to be written, since its
+* new inode page couldn't be allocated due to -ENOSPC.
+* In such the case, its blkaddr can be remained as NEW_ADDR.
+* see, f2fs_add_link - get_new_data_page - init_inode_metadata.
+*/
+   if (dn.data_blkaddr == NEW_ADDR) {
+   zero_user_segment(page, 0, PAGE_CACHE_SIZE);
+   SetPageUptodate(page);
+   return page;
+   }
 
err = f2fs_readpage(sbi, page, dn.data_blkaddr, READ_SYNC);
if (err)
-- 
1.8.3.1.437.g0dbd812

--
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] trivial: fix a typo in Documentation/00-INDEX

2013-08-20 Thread Jiri Kosina
On Mon, 19 Aug 2013, Murilo Opsfelder Araujo wrote:

 ---
  Documentation/00-INDEX | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
 index 0c4cc68..38f8444 100644
 --- a/Documentation/00-INDEX
 +++ b/Documentation/00-INDEX
 @@ -40,7 +40,7 @@ IPMI.txt
  IRQ-affinity.txt
   - how to select which CPU(s) handle which interrupt events on SMP.
  IRQ-domain.txt
 - - info on inerrupt numbering and setting up IRQ domains.
 + - info on interrupt numbering and setting up IRQ domains.
  IRQ.txt
   - description of what an IRQ is.
  Intel-IOMMU.txt

Please resend your patch with proper Signed-off-by: line as documented in 
Documentation/SubmittingPatches, so that it could be applied.

Thanks,

-- 
Jiri Kosina
SUSE Labs
--
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 06/17] ARM: imx: remove custom .init_time hook

2013-08-20 Thread Sebastian Hesselbarth

On 08/20/13 12:42, Russell King - ARM Linux wrote:

On Tue, Aug 20, 2013 at 12:37:18PM +0200, Sebastian Hesselbarth wrote:

I already guessed it has something to do with the In-reply-to line, as
only the patches but not the cover letter gets stuck. Thanks for
pointing me at the missing PATCH prefix and sorry for the noise on
the moderators screen.


I just want to be clear about something there: I have nothing what so
ever to do with the running of these lists anymore.

While I may know some of the policies, that is as far as it goes; I
don't have any access to the admin or moderation side of these lists.



Small typo, huge difference: It should have been moderator's screen,
i.e. David's, of course.

Sebastian
--
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 06/17] ARM: imx: remove custom .init_time hook

2013-08-20 Thread Russell King - ARM Linux
On Tue, Aug 20, 2013 at 12:37:18PM +0200, Sebastian Hesselbarth wrote:
 I already guessed it has something to do with the In-reply-to line, as
 only the patches but not the cover letter gets stuck. Thanks for
 pointing me at the missing PATCH prefix and sorry for the noise on
 the moderators screen.

I just want to be clear about something there: I have nothing what so
ever to do with the running of these lists anymore.

While I may know some of the policies, that is as far as it goes; I
don't have any access to the admin or moderation side of these lists.
--
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-SR9700] Merge USB 1.1 Ethernet Adapter SR9700 Device Driver into the Linux Kernel

2013-08-20 Thread liujunliang_ljl
Dear Gregkh  all :

I am the software engineer Liu Junliang from ShenZhen CoreChips 
high technology company, on the market of SR9700 chip is designed and owned by 
us. 
SR9700 is a type of USB to Ethernet Converter and is compatible with 
USB 1.1 protocol, We want to merge SR9700 device driver into the Linux Kernel. 
The following is the Linux 3.10.7 version patch for SR9700, Please give us the 
assessment and support.
Thanks a lot.

[PATCH] : 
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 287cc62..a94b196 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -272,6 +272,14 @@ config USB_NET_DM9601
  This option adds support for Davicom DM9601 based USB 1.1
  10/100 Ethernet adapters.
 
+config USB_NET_SR9700
+   tristate CoreChip-sz SR9700 based USB 1.1 10/100 ethernet devices
+   depends on USB_USBNET
+   select CRC32
+   help
+ This option adds support for CoreChip-sz SR9700 based USB 1.1
+ 10/100 Ethernet adapters.
+
 config USB_NET_SMSC75XX
tristate SMSC LAN75XX based USB 2.0 gigabit ethernet devices
depends on USB_USBNET
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index 9ab5c9d..bba87a2 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_USB_NET_AX88179_178A)  += ax88179_178a.o
 obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o
 obj-$(CONFIG_USB_NET_CDC_EEM)  += cdc_eem.o
 obj-$(CONFIG_USB_NET_DM9601)   += dm9601.o
+obj-$(CONFIG_USB_NET_SR9700)   += sr9700.o
 obj-$(CONFIG_USB_NET_SMSC75XX) += smsc75xx.o
 obj-$(CONFIG_USB_NET_SMSC95XX) += smsc95xx.o
 obj-$(CONFIG_USB_NET_GL620A)   += gl620a.o
diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c
new file mode 100644
index 000..6a6429a
--- /dev/null
+++ b/drivers/net/usb/sr9700.c
@@ -0,0 +1,557 @@
+/*
+ * CoreChip-sz SR9700 one chip USB 1.1 Ethernet Devices
+ *
+ * Author : liujl liujunliang_...@163.com
+ *
+ * Based on dm9601.c
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed as is without any warranty of any
+ * kind, whether express or implied.
+ */
+
+//#define DEBUG
+
+#include linux/module.h
+#include linux/sched.h
+#include linux/stddef.h
+#include linux/init.h
+#include linux/netdevice.h
+#include linux/etherdevice.h
+#include linux/ethtool.h
+#include linux/mii.h
+#include linux/usb.h
+#include linux/crc32.h
+#include linux/usb/usbnet.h
+
+#include sr9700.h
+
+static int sr_read(struct usbnet *dev, u8 reg, u16 length, void *data)
+{
+   int err;
+
+   err = usbnet_read_cmd(dev, SR_RD_REGS, SR_REQ_RD_REG,
+   0, reg, data, length);
+   if(err != length  err = 0)
+   err = -EINVAL;
+   return err;
+}
+
+static int sr_write(struct usbnet *dev, u8 reg, u16 length, void *data)
+{
+   int err;
+
+   err = usbnet_write_cmd(dev, SR_WR_REGS, SR_REQ_WR_REG,
+   0, reg, data, length);
+   if (err = 0  err  length)
+   err = -EINVAL;
+   
+   return err;
+}
+
+static int sr_read_reg(struct usbnet *dev, u8 reg, u8 *value)
+{
+   return sr_read(dev, reg, 1, value);
+}
+
+static int sr_write_reg(struct usbnet *dev, u8 reg, u8 value)
+{
+   return usbnet_write_cmd(dev, SR_WR_REGS, SR_REQ_WR_REG,
+  value, reg, NULL, 0);
+}
+
+static void sr_write_async(struct usbnet *dev, u8 reg, u16 length, void *data)
+{
+   usbnet_write_cmd_async(dev, SR_WR_REGS, SR_REQ_WR_REG,
+   0, reg, data, length);
+}
+
+static void sr_write_reg_async(struct usbnet *dev, u8 reg, u8 value)
+{
+   usbnet_write_cmd_async(dev, SR_WR_REGS, SR_REQ_WR_REG,
+   value, reg, NULL, 0);
+}
+
+static int sr_share_read_word(struct usbnet *dev, int phy, u8 reg, __le16 
*value)
+{
+   int ret, i;
+
+   mutex_lock(dev-phy_mutex);
+
+   sr_write_reg(dev, EPAR, phy ? (reg | 0x40) : reg);
+   sr_write_reg(dev, EPCR, phy ? 0xc : 0x4);
+
+   for (i = 0; i  SR_SHARE_TIMEOUT; i++) {
+   u8 tmp = 0;
+
+   udelay(1);
+   ret = sr_read_reg(dev, EPCR, tmp);
+   if (ret  0)
+   goto out;
+
+   /* ready */
+   if ((tmp  1) == 0)
+   break;
+   }
+
+   if (i = SR_SHARE_TIMEOUT) {
+   netdev_err(dev-net, %s read timed out!, phy ? phy : 
eeprom);
+   ret = -EIO;
+   goto out;
+   }
+
+   sr_write_reg(dev, EPCR, 0x0);
+   ret = sr_read(dev, EPDR, 2, value);
+
+   netdev_dbg(dev-net, read shared %d 0x%02x returned 0x%04x, %d,
+  phy, reg, *value, ret);
+
+ out:
+   mutex_unlock(dev-phy_mutex);
+   return ret;
+}
+
+static int sr_share_write_word(struct 

Re: [PULL] Miscellaneous trivialities

2013-08-20 Thread Jiri Kosina
On Mon, 19 Aug 2013, Michael Witten wrote:

 I've updated the series to make that change instead; the updated
 series is here:
 
   https://github.com/mfwitten/linux.git trivial/misc/2
 
 Sorry for the churn.

Please send a proper new pull request, or just bounce the series through 
e-mail.

Thanks,

-- 
Jiri Kosina
SUSE Labs
--
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/6] ASoC: omap: simplify platform_get_resource_byname/devm_ioremap_resource

2013-08-20 Thread Mark Brown
On Mon, Aug 19, 2013 at 10:51:51AM +0200, Julia Lawall wrote:
 From: Julia Lawall julia.law...@lip6.fr
 
 Remove unneeded error handling on the result of a call to
 platform_get_resource_byname when the value is passed to 
 devm_ioremap_resource.

Applied, thanks.


signature.asc
Description: Digital signature


Re: linux-next: manual merge of the xilinx tree

2013-08-20 Thread Michal Simek
Hi Stephen,

On 07/03/2013 08:02 AM, Stephen Rothwell wrote:
 Hi Michal,
 
 On Wed, 03 Jul 2013 07:53:32 +0200 Michal Simek mon...@monstr.eu wrote:

 I have fixed it - it should be fixed there soon.
 
 Thanks.
 
 But I am thinking about removing this tree from linux-next
 because we are pushing arm changes through arm-soc tree
 and they require to have specific feature branches.
 
 Just let me know when you decide.
 

Please remove this tree from the linux-next testing.

xilinx  git git://git.xilinx.com/linux-xlnx.git#arm-next

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng), OpenPGP - KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform




signature.asc
Description: OpenPGP digital signature


[PATCH 1/2] Documentation/printk-formats.txt: No casts needed for u64/s64

2013-08-20 Thread Geert Uytterhoeven
Now all 64-bit architectures have been converted to int-ll64.h in kernel
space, casting to (unsigned) long long is no longer needed when formatting
u64/s64.

For backwards compatibility, alpha, ia64, mips64, and powerpc64 still use
int-l64.h in userspace.

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
Acked-by: Randy Dunlap rdun...@xenotime.net
Cc: linux-...@vger.kernel.org
---
This is the documentation part of more than two year old
asm/types.h: All architectures use int-ll64.h in kernelspace
(https://lkml.org/lkml/2011/8/13/104)

 Documentation/printk-formats.txt |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
index 3e8cb73..41aaed7 100644
--- a/Documentation/printk-formats.txt
+++ b/Documentation/printk-formats.txt
@@ -185,11 +185,11 @@ struct va_format:
 
 u64 SHOULD be printed with %llu/%llx, (unsigned long long):
 
-   printk(%llu, (unsigned long long)u64_var);
+   printk(%llu, u64_var);
 
 s64 SHOULD be printed with %lld/%llx, (long long):
 
-   printk(%lld, (long long)s64_var);
+   printk(%lld, s64_var);
 
 If type is dependent on a config option for its size (e.g., sector_t,
 blkcnt_t) or is architecture-dependent for its size (e.g., tcflag_t), use a
-- 
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/


[PATCH 2/2] asm/types.h: Remove include/asm-generic/int-l64.h

2013-08-20 Thread Geert Uytterhoeven
Now all 64-bit architectures have been converted to int-ll64.h, we can
remove int-l64.h in kernelspace.

For backwards compatibility, alpha, ia64, mips64, and powerpc64 still use
int-l64.h in userspace.

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
This is the (reworked for UAPI) non-documentation part of more than two
year old asm/types.h: All architectures use int-ll64.h in kernelspace
(https://lkml.org/lkml/2011/8/13/104)

Since asm/types.h (from include/uapi/asm-generic/types.h) is used for
both kernel and user space, include/asm-generic/int-ll64.h cannot just
become include/asm-generic/types.h, as Arnd suggested.

 include/asm-generic/int-l64.h|   49 --
 include/uapi/asm-generic/types.h |3 +--
 2 files changed, 1 insertion(+), 51 deletions(-)
 delete mode 100644 include/asm-generic/int-l64.h

diff --git a/include/asm-generic/int-l64.h b/include/asm-generic/int-l64.h
deleted file mode 100644
index 27d4ec0..000
--- a/include/asm-generic/int-l64.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * asm-generic/int-l64.h
- *
- * Integer declarations for architectures which use long
- * for 64-bit types.
- */
-#ifndef _ASM_GENERIC_INT_L64_H
-#define _ASM_GENERIC_INT_L64_H
-
-#include uapi/asm-generic/int-l64.h
-
-
-#ifndef __ASSEMBLY__
-
-typedef signed char s8;
-typedef unsigned char u8;
-
-typedef signed short s16;
-typedef unsigned short u16;
-
-typedef signed int s32;
-typedef unsigned int u32;
-
-typedef signed long s64;
-typedef unsigned long u64;
-
-#define S8_C(x)  x
-#define U8_C(x)  x ## U
-#define S16_C(x) x
-#define U16_C(x) x ## U
-#define S32_C(x) x
-#define U32_C(x) x ## U
-#define S64_C(x) x ## L
-#define U64_C(x) x ## UL
-
-#else /* __ASSEMBLY__ */
-
-#define S8_C(x)  x
-#define U8_C(x)  x
-#define S16_C(x) x
-#define U16_C(x) x
-#define S32_C(x) x
-#define U32_C(x) x
-#define S64_C(x) x
-#define U64_C(x) x
-
-#endif /* __ASSEMBLY__ */
-
-#endif /* _ASM_GENERIC_INT_L64_H */
diff --git a/include/uapi/asm-generic/types.h b/include/uapi/asm-generic/types.h
index bd39806..a387792 100644
--- a/include/uapi/asm-generic/types.h
+++ b/include/uapi/asm-generic/types.h
@@ -1,8 +1,7 @@
 #ifndef _ASM_GENERIC_TYPES_H
 #define _ASM_GENERIC_TYPES_H
 /*
- * int-ll64 is used practically everywhere now,
- * so use it as a reasonable default.
+ * int-ll64 is used everywhere now.
  */
 #include asm-generic/int-ll64.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/


Re: [PATCH] ACPI / PM: Hold acpi_scan_lock over system PM transitions

2013-08-20 Thread Mika Westerberg
On Tue, Aug 20, 2013 at 01:47:57AM +0200, Rafael J. Wysocki wrote:
 From: Rafael J. Wysocki rafael.j.wyso...@intel.com
 
 Bad things happen if ACPI hotplug events are handled during system
 PM transitions, especially if devices are removed as a result.
 To prevent those bad things from happening, acquire acpi_scan_lock
 when a transition is started and release it when that transition
 is complete or has been aborted.
 
 This fixes resume lockup on my test-bed Acer Aspire S5 that happens
 when Thunderbolt devices are disconnected from the machine while
 suspended.
 
 Signed-off-by: Rafael J. Wysocki rafael.j.wyso...@intel.com

I tested this on Intel DZ77RE-75K and after the patch is applied the
machine didn't hang anymore once resuming.

Feel free to add my tested-by.
--
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 2/5] page_migrate: Fix wrong comment in address_space_operations-migratepage()

2013-08-20 Thread Jiri Kosina
On Thu, 20 Jun 2013, Tang Chen wrote:

 There is no parameter sync in address_space_operations-migratepage().
 It should be mograte_mode. And the comment is for MIGRATE_ASYNC.

I am fixing this typo in changelog :) and applying the series.

 
 Signed-off-by: Tang Chen tangc...@cn.fujitsu.com
 ---
  include/linux/fs.h |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/include/linux/fs.h b/include/linux/fs.h
 index 43db02e..c1a76ac 100644
 --- a/include/linux/fs.h
 +++ b/include/linux/fs.h
 @@ -372,8 +372,8 @@ struct address_space_operations {
   int (*get_xip_mem)(struct address_space *, pgoff_t, int,
   void **, unsigned long *);
   /*
 -  * migrate the contents of a page to the specified target. If sync
 -  * is false, it must not block.
 +  * migrate the contents of a page to the specified target. If
 +  * migrate_mode is MIGRATE_ASYNC, it must not block.
*/
   int (*migratepage) (struct address_space *,
   struct page *, struct page *, enum migrate_mode);
 -- 
 1.7.1
 

-- 
Jiri Kosina
SUSE Labs
--
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 2/5] page_migrate: Fix wrong comment in address_space_operations-migratepage()

2013-08-20 Thread Tang Chen

On 08/20/2013 07:02 PM, Jiri Kosina wrote:

On Thu, 20 Jun 2013, Tang Chen wrote:


There is no parameter sync in address_space_operations-migratepage().
It should be mograte_mode. And the comment is for MIGRATE_ASYNC.


I am fixing this typo in changelog :) and applying the series.


Hi Jiri,

Thanks a lot. :)





Signed-off-by: Tang Chentangc...@cn.fujitsu.com
---
  include/linux/fs.h |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 43db02e..c1a76ac 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -372,8 +372,8 @@ struct address_space_operations {
int (*get_xip_mem)(struct address_space *, pgoff_t, int,
void **, unsigned long *);
/*
-* migrate the contents of a page to the specified target. If sync
-* is false, it must not block.
+* migrate the contents of a page to the specified target. If
+* migrate_mode is MIGRATE_ASYNC, it must not block.
 */
int (*migratepage) (struct address_space *,
struct page *, struct page *, enum migrate_mode);
--
1.7.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]amilo-rfkill: add depends on i8042 in Kconfig

2013-08-20 Thread Jiri Kosina
On Fri, 12 Jul 2013, Xiong Zhou wrote:

  Fix randconfig build failure for Amilo x86 platform driver.
  AMILO_RFKILL requires SERIO_I8042 being available.
 
  amilo-rfkill.c:(.text+0x108b5b): undefined reference to 
  `i8042_lock_chip'
  amilo-rfkill.c:(.text+0x108b69): undefined reference to `i8042_command'
  amilo-rfkill.c:(.text+0x108b71): undefined reference to 
  `i8042_unlock_chip'
 
  Reported-by: Jim Davis jim.ep...@gmail.com
  Signed-off-by: Xiong Zhou jencce.ker...@gmail.com
 
  Acked-by: Ben Hutchings b...@decadent.org.uk
 
  But I thought somehow sent this same fix a while back...
 
  Yes, I reported it and sent a patch for it that you acked...
  I guess my patch was never picked up.
 
 
  ... Better someone pick this up.
 
 
  This build error is still occurring in linux-next (20130627).
  I first reported it and posted a patch for it on May-15 2013.
 
  Please merge either patch...
 
  Is anybody out there?
 
 
 
 
  Ben.
 
  ---
   drivers/platform/x86/Kconfig |1 +
   1 file changed, 1 insertion(+)
 
  diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
  index 8577261..37645b9 100644
  --- a/drivers/platform/x86/Kconfig
  +++ b/drivers/platform/x86/Kconfig
  @@ -176,6 +176,7 @@ config FUJITSU_TABLET
   config AMILO_RFKILL
   tristate Fujitsu-Siemens Amilo rfkill support
   depends on RFKILL
  +depends on SERIO_I8042
   ---help---
 This is a driver for enabling wifi on some Fujitsu-Siemens Amilo
 laptops.
 
 
 
  --
  ~Randy
  --
 
 
  --
  ~Randy
 
 
 
 cc Jiri Kosina triv...@kernel.org

Please resend the patch properly, it's not easy to dig it from the 
multi-depth quoted text.

-- 
Jiri Kosina
SUSE Labs
--
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/4] mfd: as3722: introduce core driver file

2013-08-20 Thread Florian Lobmaier

Signed-off-by: Florian Lobmaier florian.lobma...@ams.com
---
 drivers/mfd/as3722-core.c |  747 +
 1 files changed, 747 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/as3722-core.c

diff --git a/drivers/mfd/as3722-core.c b/drivers/mfd/as3722-core.c
new file mode 100644
index 000..ddb39c7
--- /dev/null
+++ b/drivers/mfd/as3722-core.c
@@ -0,0 +1,747 @@
+/*
+ * as3722-core.c - core driver for AS3722 PMICs
+ *
+ * Copyright (C) 2013 ams AG
+ *
+ * Author: Florian Lobmaier florian.lobma...@ams.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/slab.h
+#include linux/i2c.h
+#include linux/interrupt.h
+#include linux/irq.h
+#include linux/regmap.h
+#include linux/err.h
+#include linux/delay.h
+#include linux/mfd/core.h
+#include linux/interrupt.h
+#include linux/mfd/as3722-reg.h
+#include linux/mfd/as3722-plat.h
+
+enum as3722_ids {
+   AS3722_GPIO_ID,
+   AS3722_REGULATOR_ID,
+   AS3722_RTC_ID,
+   AS3722_WATCHDOG_ID,
+   AS3722_PWM_ID,
+};
+
+static const struct resource as3722_rtc_resource[] = {
+   {
+   .name = as3722-rtc-alarm,
+   .start = AS3722_IRQ_RTC_ALARM,
+   .end = AS3722_IRQ_RTC_ALARM,
+   .flags = IORESOURCE_IRQ,
+   },
+};
+
+static const struct resource as3722_wdt_resource[] = {
+   {
+   .name = as3722-watchdog-ping,
+   .start = AS3722_IRQ_WATCHDOG,
+   .end = AS3722_IRQ_WATCHDOG,
+   .flags = IORESOURCE_IRQ,
+   },
+};
+
+static struct mfd_cell as3722_devs[] = {
+   {
+   .name = as3722-gpio,
+   .id = AS3722_GPIO_ID,
+   },
+   {
+   .name = as3722-regulator,
+   .id = AS3722_REGULATOR_ID,
+   },
+   {
+   .name = as3722-rtc,
+   .num_resources = ARRAY_SIZE(as3722_rtc_resource),
+   .resources = as3722_rtc_resource,
+   .id = AS3722_RTC_ID,
+   },
+   {
+   .name = as3722-wdt,
+   .num_resources = ARRAY_SIZE(as3722_wdt_resource),
+   .resources = as3722_wdt_resource,
+   .id = AS3722_WATCHDOG_ID,
+   },
+   {
+   .name = as3722-pwm,
+   .id = AS3722_PWM_ID,
+   },
+};
+
+static const struct regmap_irq as3722_irqs[] = {
+   /* INT1 IRQs */
+   [AS3722_IRQ_LID] = {
+   .mask = AS3722_IRQ_MASK_LID,
+   },
+   [AS3722_IRQ_ACOK] = {
+   .mask = AS3722_IRQ_MASK_ACOK,
+   },
+   [AS3722_IRQ_ENABLE1] = {
+   .mask = AS3722_IRQ_MASK_ENABLE1,
+   },
+   [AS3722_IRQ_SD0] = {
+   .mask = AS3722_IRQ_MASK_SD0,
+   },
+   [AS3722_IRQ_ONKEY_LONG] = {
+   .mask = AS3722_IRQ_MASK_ONKEY_LONG,
+   },
+   [AS3722_IRQ_ONKEY] = {
+   .mask = AS3722_IRQ_MASK_ONKEY,
+   },
+   [AS3722_IRQ_OVTMP] = {
+   .mask = AS3722_IRQ_MASK_OVTMP,
+   },
+   [AS3722_IRQ_LOWBAT] = {
+   .mask = AS3722_IRQ_MASK_LOWBAT,
+   },
+   [AS3722_IRQ_RTC_REP] = {
+   .mask = AS3722_IRQ_MASK_RTC_REP,
+   .reg_offset = 1,
+   },
+   [AS3722_IRQ_RTC_ALARM] = {
+   .mask = AS3722_IRQ_MASK_RTC_ALARM,
+   .reg_offset = 2,
+   },
+   [AS3722_IRQ_WATCHDOG] = {
+   .mask = AS3722_IRQ_MASK_WATCHDOG,
+   .reg_offset = 2,
+   },
+   [AS3722_IRQ_ADC] = {
+   .mask = AS3722_IRQ_MASK_ADC,
+   .reg_offset = 3,
+   },
+   [AS3722_IRQ_GPIO1] = {
+   .mask = AS3722_IRQ_MASK_GPIO1,
+   .reg_offset = 2,
+   },
+   [AS3722_IRQ_GPIO2] = {
+   .mask = AS3722_IRQ_MASK_GPIO2,
+   .reg_offset = 2,
+   },
+   [AS3722_IRQ_GPIO3] = {
+   .mask = AS3722_IRQ_MASK_GPIO3,
+   .reg_offset = 2,
+   },
+   [AS3722_IRQ_GPIO4] = {
+   .mask = AS3722_IRQ_MASK_GPIO4,
+   .reg_offset = 2,
+   },
+   [AS3722_IRQ_GPIO5] = {
+   .mask = AS3722_IRQ_MASK_GPIO5,
+   .reg_offset = 2,
+   },
+   

mfd: as3722: introducing ams AS3722 PMIC driver

2013-08-20 Thread Florian Lobmaier
Thank you for the response regarding the correct formatting of the patches. I 
will try to fulfill the requirements as expected. Now tried to introduce the 
as3722 mfd driver in logical steps. Please keep in mind that the driver is 
already fully written, so the bit-by-bit introduction within the files would be 
a really hard requirement to fulfill.

One question I have still in mind: How do I reply correctly to already sent 
mails? Which command is recommended in this case?

Thanks in addition to Mark Brown who already commented on the driver itself. I 
will try to integrate as much of your suggestions as possible.

Br,
Florian
--
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/4] mfd: as3722: introduce regmap support

2013-08-20 Thread Florian Lobmaier

Signed-off-by: Florian Lobmaier florian.lobma...@ams.com
---
 drivers/mfd/as3722-regmap.c |  417 +++
 1 files changed, 417 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/as3722-regmap.c

diff --git a/drivers/mfd/as3722-regmap.c b/drivers/mfd/as3722-regmap.c
new file mode 100644
index 000..725722e
--- /dev/null
+++ b/drivers/mfd/as3722-regmap.c
@@ -0,0 +1,417 @@
+/*
+ * as3722-regmap.c - regmap for AS3722 PMICs
+ *
+ * Copyright (C) 2013 ams AG
+ *
+ * Author: Florian Lobmaier florian.lobma...@ams.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+
+#include linux/mfd/as3722-reg.h
+
+/* Default Register Values (for caching)
+ * Please make sure to update (or update cache at startup)
+ * after device is OTP programmed! */
+static struct reg_default as3722_defaults[] = {
+   { 0x, 0x }, /* SD0 Voltage */
+   { 0x0001, 0x }, /* SD1 Voltage */
+   { 0x0002, 0x }, /* SD2 Voltage */
+   { 0x0003, 0x }, /* SD3 Voltage */
+   { 0x0004, 0x }, /* SD4 Voltage */
+   { 0x0005, 0x }, /* SD5 Voltage */
+   { 0x0006, 0x }, /* SD6 Voltage */
+   { 0x0008, 0x0003 }, /* GPIO0 Control */
+   { 0x0009, 0x0003 }, /* GPIO1 Control */
+   { 0x000a, 0x0003 }, /* GPIO2 Control */
+   { 0x000b, 0x0003 }, /* GPIO3 Control */
+   { 0x000c, 0x0003 }, /* GPIO4 Control */
+   { 0x000d, 0x0003 }, /* GPIO5 Control */
+   { 0x000e, 0x0003 }, /* GPIO6 Control */
+   { 0x000f, 0x0003 }, /* GPIO7 Control */
+   { 0x0010, 0x }, /* LDO0 Voltage */
+   { 0x0011, 0x }, /* LDO1 Voltage */
+   { 0x0012, 0x }, /* LDO2 Voltage */
+   { 0x0013, 0x }, /* LDO3 Voltage */
+   { 0x0014, 0x }, /* LDO4 Voltage */
+   { 0x0015, 0x }, /* LDO5 Voltage */
+   { 0x0016, 0x }, /* LDO6 Voltage */
+   { 0x0017, 0x }, /* LDO7 Voltage */
+   { 0x0019, 0x }, /* LDO9 Voltage */
+   { 0x001a, 0x }, /* LDO10 Voltage */
+   { 0x001b, 0x }, /* LDO11 Voltage */
+   { 0x001d, 0x }, /* LDO3 Settings */
+   { 0x001e, 0x }, /* GPIO deb1 */
+   { 0x001f, 0x }, /* GPIO deb2 */
+   { 0x0020, 0x }, /* GPIO Signal Out */
+   { 0x0021, 0x }, /* GPIO Signal In */
+   { 0x0022, 0x }, /* Reg_sequ_mod1 */
+   { 0x0023, 0x }, /* Reg_sequ_mod2 */
+   { 0x0024, 0x }, /* Reg_sequ_mod3 */
+   { 0x0027, 0x }, /* SD_phsw_ctrl */
+   { 0x0028, 0x }, /* SD_phsw_status */
+   { 0x0029, 0x }, /* SD0 Control */
+   { 0x002a, 0x0001 }, /* SD1 Control */
+   { 0x002b, 0x }, /* SDmph Control */
+   { 0x002c, 0x }, /* SD23 Control */
+   { 0x002d, 0x }, /* SD4 Control */
+   { 0x002e, 0x }, /* SD5 Control */
+   { 0x002f, 0x0001 }, /* SD6 Control */
+   { 0x0030, 0x }, /* SD_dvm */
+   { 0x0031, 0x }, /* Resetreason */
+   { 0x0032, 0x }, /* Battery Voltage Monitor */
+   { 0x0033, 0x }, /* Startup Control */
+   { 0x0034, 0x0008 }, /* RestTimer */
+   { 0x0035, 0x }, /* ReferenceControl */
+   { 0x0036, 0x }, /* ResetControl */
+   { 0x0037, 0x0001 }, /* OvertemperatureControl */
+   { 0x0038, 0x }, /* WatchdogControl */
+   { 0x0039, 0x }, /* Reg_standby_mod1 */
+   { 0x003a, 0x }, /* Reg_standby_mod2 */
+   { 0x003b, 0x }, /* Reg_standby_mod3 */
+   { 0x003c, 0x }, /* Enable Control 1 */
+   { 0x003d, 0x }, /* Enable Control 2 */
+   { 0x003e, 0x }, /* Enable Control 3 */
+   { 0x003f, 0x }, /* Enable Control 4 */
+   { 0x0040, 0x }, /* Enable Control 5 */
+   { 0x0041, 0x }, /* PWM Control low */
+   { 0x0042, 0x }, /* PWM Control high */
+   { 0x0046, 0x }, /* Watchdog Timer */
+   { 0x0048, 0x }, /* Watchdog Software Signal */
+   { 0x0049, 0x }, /* IO Voltage */
+   { 0x004a, 0x }, /* Battery_voltage_monitor2 */
+   { 0x004d, 0x007f }, /* SDcontrol */
+   { 0x004e, 0x00ff }, /* LDOcontrol0 */
+   { 0x004f, 0x000e }, /* LDOcontrol1 */
+   { 0x0050, 0x }, /* SD0_protect */
+   { 0x0051, 0x }, /* SD6_protect */
+   { 0x0052, 0x }, /* PWM_vcontrol1 */
+ 

[PATCH 1/4] mfd: as3722: driver introduction in Kconfig and Makefile

2013-08-20 Thread Florian Lobmaier

Signed-off-by: Florian Lobmaier florian.lobma...@ams.com
---
 drivers/mfd/Kconfig  |   15 +++
 drivers/mfd/Makefile |1 +
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index aecd6dd..a02777c 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -27,6 +27,21 @@ config MFD_AS3711
help
  Support for the AS3711 PMIC from AMS
 
+config MFD_AS3722
+tristate Support for ams AS3722 PMIC
+select MFD_CORE
+select REGMAP_I2C
+select REGMAP_IRQ
+depends on I2C=y
+help
+  Core support for the ams AS3722 PMIC. Additional
+  drivers must be enabled in order to use the functionality of the
+  device.
+  Related drivers are:
+* ams AS3722 PMIC regulators
+* ams AS3722 GPIO
+* ams AS3722 RTC
+
 config PMIC_ADP5520
bool Analog Devices ADP5520/01 MFD PMIC Core Support
depends on I2C=y
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 3c90051..358e46e 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -159,3 +159,4 @@ obj-$(CONFIG_MFD_LM3533)+= lm3533-core.o 
lm3533-ctrlbank.o
 obj-$(CONFIG_VEXPRESS_CONFIG)  += vexpress-config.o vexpress-sysreg.o
 obj-$(CONFIG_MFD_RETU) += retu-mfd.o
 obj-$(CONFIG_MFD_AS3711)   += as3711.o
+obj-$(CONFIG_MFD_AS3722)+= as3722-core.o as3722-regmap.o
-- 
1.7.2.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/


[PATCH 3/4] mfd: as3722: introduce platform and register include files

2013-08-20 Thread Florian Lobmaier

Signed-off-by: Florian Lobmaier florian.lobma...@ams.com
---
 include/linux/mfd/as3722-plat.h |  238 +++
 include/linux/mfd/as3722-reg.h  |  495 +++
 2 files changed, 733 insertions(+), 0 deletions(-)
 create mode 100644 include/linux/mfd/as3722-plat.h
 create mode 100644 include/linux/mfd/as3722-reg.h

diff --git a/include/linux/mfd/as3722-plat.h b/include/linux/mfd/as3722-plat.h
new file mode 100644
index 000..0fc3fb7
--- /dev/null
+++ b/include/linux/mfd/as3722-plat.h
@@ -0,0 +1,238 @@
+/*
+ * as3722.h definitions
+ *
+ * Copyright (C) 2013 ams
+ *
+ * Author: Florian Lobmaier florian.lobma...@ams.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ */
+
+#ifndef __LINUX_MFD_AS3722_PLAT_H
+#define __LINUX_MFD_AS3722_PLAT_H
+
+#include linux/mutex.h
+#include linux/completion.h
+#include linux/platform_device.h
+#include linux/interrupt.h
+#include linux/workqueue.h
+#include linux/power_supply.h
+#include linux/irq.h
+#include linux/irqdomain.h
+#include linux/regmap.h
+#include linux/regulator/machine.h
+#include linux/pwm.h
+#include linux/mfd/as3722-reg.h
+
+struct as3722_reg_init {
+   u32 reg;
+   u32 val;
+};
+
+extern const struct regmap_config as3722_regmap_config;
+
+struct as3722_rtc {
+   struct rtc_device *rtc;
+   int alarm_enabled;  /* used for suspend/resume */
+};
+
+struct as3722 {
+   struct device *dev;
+   struct regmap *regmap;
+   struct regmap_irq_chip_data *irq_data;
+   struct regulator_dev *rdevs[AS3722_NUM_REGULATORS];
+   struct as3722_rtc rtc;
+   struct pwm_chip as3722_pwm;
+
+   struct mutex adc_mutex;
+
+   int chip_irq;
+   int reg_stby_counter;
+};
+
+enum {
+   AS3722_GPIO_CFG_NO_INVERT = 0,
+   AS3722_GPIO_CFG_INVERT = 1,
+};
+
+enum {
+   AS3722_GPIO_CFG_OUTPUT_DISABLED = 0,
+   AS3722_GPIO_CFG_OUTPUT_ENABLED = 1,
+};
+
+struct as3722_gpio_config {
+   int gpio;
+   int mode;
+   int invert;
+   int iosf;
+   int output_state;
+};
+
+enum as3722_off_delay {
+   AS3722_OFF_DELAY_NONE = 0,
+   AS3722_OFF_DELAY_8ms = 1,
+   AS3722_OFF_DELAY_16ms = 2,
+   AS3722_OFF_DELAY_32ms = 3,
+};
+
+enum as3722_bit {
+   AS3722_BIT_OFF = 0,
+   AS3722_BIT_ON = 1,
+};
+
+enum as3722_vmask_time {
+   AS3722_NO_MASKING = 0,
+   AS3722_VMASK_4us = 1,
+   AS3722_VMASK_8us = 2,
+};
+
+enum as3722_lv_deb_time {
+   AS3722_NO_DEBOUNCING = 0,
+   AS3722_DEB_1us = 1,
+   AS3722_DEB_4us = 2,
+   AS3722_DEB_20us = 3,
+};
+
+enum as3722_ovc_alarm {
+   AS3722_OVC_ALARM_DISABLED = 0,
+   AS3722_OVC_ALARM_1_6A = 1,
+   AS3722_OVC_ALARM_1_8A = 2,
+   AS3722_OVC_ALARM_2_0A = 3,
+   AS3722_OVC_ALARM_2_2A = 4,
+   AS3722_OVC_ALARM_2_4A = 5,
+   AS3722_OVC_ALARM_2_6A = 6,
+   AS3722_OVC_ALARM_2_8A = 7,
+};
+
+struct as3722_platform_data {
+   struct regulator_init_data *reg_init[AS3722_NUM_REGULATORS];
+
+   /* register initialisation */
+   struct as3722_reg_init *core_init_data;
+   int gpio_base;
+   int irq_base;
+   int irq_type;
+
+   int use_internal_int_pullup;
+   int use_internal_i2c_pullup;
+   int enable_clk32out_pin;
+
+   int num_gpio_cfgs;
+   struct as3722_gpio_config *gpio_cfgs;
+
+   /* enable1 pin standby control */
+   enum as3722_off_delay off_delay;
+   int enable1_deepsleep;
+   int enable1_invert;
+
+   /* thermal shutdown control */
+   enum as3722_bit mask_ovtemp;
+
+   /* overcurrent / powergood settings */
+   enum as3722_vmask_time pg_sd6_vmask_time;
+   enum as3722_lv_deb_time sd6_lv_deb_time;
+   enum as3722_lv_deb_time sd1_lv_deb_time;
+   enum as3722_lv_deb_time sd0_lv_deb_time;
+   enum as3722_bit pg_vresfall_mask;
+   enum as3722_bit pg_ovcurr_sd0_mask;
+   enum as3722_bit pg_pwrgood_sd0_mask;
+   enum as3722_bit pg_gpio5_mask;
+   enum as3722_bit pg_gpio4_mask;
+   enum as3722_bit pg_gpio3_mask;
+   enum as3722_bit pg_ac_ok_mask;
+   enum as3722_bit pg_ac_ok_inv;
+   enum as3722_bit pg_ovcurr_sd6_mask;
+   enum as3722_bit pg_pwrgood_sd6_mask;
+   enum as3722_ovc_alarm pg_sd6_ovc_alarm;
+   enum as3722_vmask_time pg_sd0_vmask_time;

[sched next] overflowed cpu time for kernel threads in /proc/PID/stat

2013-08-20 Thread Sergey Senozhatsky
Hello,
3.11.0-rc6-next-20130820

at some point an overflowed cpu time is reported in /proc/PID/stat

cat /proc/10/stat
10 (rcu_preempt) S 2 0 0 0 -1 2129984 0 0 0 0 0 406 0 0 20 0 1 0 10 0 0 
18446744073709551615 0 0 0 0 0 0 0 2147483647 0 18446744073709551615 0 0 17 0 0 
0 0 0 0 0 0 0 0 0 0 0 0
cat /proc/10/stat
10 (rcu_preempt) S 2 0 0 0 -1 2129984 0 0 0 0 0 406 0 0 20 0 1 0 10 0 0 
18446744073709551615 0 0 0 0 0 0 0 2147483647 0 18446744073709551615 0 0 17 0 0 
0 0 0 0 0 0 0 0 0 0 0 0
cat /proc/10/stat
10 (rcu_preempt) S 2 0 0 0 -1 2129984 0 0 0 0 0 407 0 0 20 0 1 0 10 0 0 
18446744073709551615 0 0 0 0 0 0 0 2147483647 0 18446744073709551615 0 0 17 0 0 
0 0 0 0 0 0 0 0 0 0 0 0
cat /proc/10/stat
10 (rcu_preempt) S 2 0 0 0 -1 2129984 0 0 0 0 0 407 0 0 20 0 1 0 10 0 0 
18446744073709551615 0 0 0 0 0 0 0 2147483647 0 18446744073709551615 0 0 17 0 0 
0 0 0 0 0 0 0 0 0 0 0 0
cat /proc/10/stat
10 (rcu_preempt) S 2 0 0 0 -1 2129984 0 0 0 0 1844674407370 477 0 0 20 0 1 0 10 
0 0 18446744073709551615 0 0 0 0 0 0 0 2147483647 0 18446744073709551615 0 0 17 
0 0 0 0 0 0 0 0 0 0 0 0 0 0
^
cat /proc/10/stat
10 (rcu_preempt) S 2 0 0 0 -1 2129984 0 0 0 0 1844674407370 597 0 0 20 0 1 0 10 
0 0 18446744073709551615 0 0 0 0 0 0 0 2147483647 0 18446744073709551615 0 0 17 
0 0 0 0 0 0 0 0 0 0 0 0 0 0

(seems there are several more -1UL in output)


oddly enough, I see this happening only for RCU

 ps aux | grep rcu
 root 8  0.0  0.0  0 0 ?S12:42   0:00  [rcuc/0]
 root 9  0.0  0.0  0 0 ?S12:42   0:00  [rcub/0]
 root10 62422329  0.0  0 0 ?R12:42 21114581:37  
[rcu_preempt]
 root11  0.1  0.0  0 0 ?S12:42   0:02  [rcuop/0]
 root12 62422329  0.0  0 0 ?S12:42 21114581:35  
[rcuop/1]

-ss
--
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/12] Btrfs: Do not truncate sector_t on 32-bit with CONFIG_LBDAF=y

2013-08-20 Thread Geert Uytterhoeven
sector_t may be either u64 (always 64 bit) or unsigned long (32 or 64
bit).  Casting it to unsigned long will truncate it on 32-bit platforms
where CONFIG_LBDAF=y.

Cast to unsigned long long and format using ll instead.

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 fs/btrfs/check-integrity.c |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 2fe6f31..01f9cc3 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -2949,9 +2949,10 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh)
if (dev_state-state-print_mask 
BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH)
printk(KERN_INFO
-  submit_bh(rw=0x%x, blocknr=%lu (bytenr %llu),
+  submit_bh(rw=0x%x, blocknr=%llu (bytenr %llu),
size=%lu, data=%p, bdev=%p)\n,
-  rw, (unsigned long)bh-b_blocknr, dev_bytenr,
+  rw, (unsigned long long)bh-b_blocknr,
+  dev_bytenr,
   (unsigned long)bh-b_size, bh-b_data,
   bh-b_bdev);
btrfsic_process_written_block(dev_state, dev_bytenr,
@@ -3018,9 +3019,10 @@ void btrfsic_submit_bio(int rw, struct bio *bio)
BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH)
printk(KERN_INFO
   submit_bio(rw=0x%x, bi_vcnt=%u,
-   bi_sector=%lu (bytenr %llu), bi_bdev=%p)\n,
-  rw, bio-bi_vcnt, (unsigned long)bio-bi_sector,
-  dev_bytenr, bio-bi_bdev);
+   bi_sector=%llu (bytenr %llu), bi_bdev=%p)\n,
+  rw, bio-bi_vcnt,
+  (unsigned long long)bio-bi_sector, dev_bytenr,
+  bio-bi_bdev);
 
mapped_datav = kmalloc(sizeof(*mapped_datav) * bio-bi_vcnt,
   GFP_NOFS);
-- 
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/


[PATCH 05/12] Btrfs: Make btrfs_device_uuid() return unsigned long

2013-08-20 Thread Geert Uytterhoeven
All callers of btrfs_device_uuid() cast its return type to unsigned long.

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 fs/btrfs/ctree.h   |4 ++--
 fs/btrfs/volumes.c |   10 --
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 2ab606c..2771f88 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2130,9 +2130,9 @@ BTRFS_SETGET_STACK_FUNCS(stack_device_bandwidth, struct 
btrfs_dev_item,
 BTRFS_SETGET_STACK_FUNCS(stack_device_generation, struct btrfs_dev_item,
 generation, 64);
 
-static inline char *btrfs_device_uuid(struct btrfs_dev_item *d)
+static inline unsigned long btrfs_device_uuid(struct btrfs_dev_item *d)
 {
-   return (char *)d + offsetof(struct btrfs_dev_item, uuid);
+   return (unsigned long)d + offsetof(struct btrfs_dev_item, uuid);
 }
 
 static inline char *btrfs_device_fsid(struct btrfs_dev_item *d)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index bdad547..9abffc1 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1390,7 +1390,7 @@ static int btrfs_add_device(struct btrfs_trans_handle 
*trans,
btrfs_set_device_bandwidth(leaf, dev_item, 0);
btrfs_set_device_start_offset(leaf, dev_item, 0);
 
-   ptr = (unsigned long)btrfs_device_uuid(dev_item);
+   ptr = btrfs_device_uuid(dev_item);
write_extent_buffer(leaf, device-uuid, ptr, BTRFS_UUID_SIZE);
ptr = (unsigned long)btrfs_device_fsid(dev_item);
write_extent_buffer(leaf, root-fs_info-fsid, ptr, BTRFS_UUID_SIZE);
@@ -1888,8 +1888,7 @@ next_slot:
dev_item = btrfs_item_ptr(leaf, path-slots[0],
  struct btrfs_dev_item);
devid = btrfs_device_id(leaf, dev_item);
-   read_extent_buffer(leaf, dev_uuid,
-  (unsigned long)btrfs_device_uuid(dev_item),
+   read_extent_buffer(leaf, dev_uuid, btrfs_device_uuid(dev_item),
   BTRFS_UUID_SIZE);
read_extent_buffer(leaf, fs_uuid,
   (unsigned long)btrfs_device_fsid(dev_item),
@@ -5433,7 +5432,7 @@ static void fill_device_from_item(struct extent_buffer 
*leaf,
WARN_ON(device-devid == BTRFS_DEV_REPLACE_DEVID);
device-is_tgtdev_for_dev_replace = 0;
 
-   ptr = (unsigned long)btrfs_device_uuid(dev_item);
+   ptr = btrfs_device_uuid(dev_item);
read_extent_buffer(leaf, device-uuid, ptr, BTRFS_UUID_SIZE);
 }
 
@@ -5496,8 +5495,7 @@ static int read_one_dev(struct btrfs_root *root,
u8 dev_uuid[BTRFS_UUID_SIZE];
 
devid = btrfs_device_id(leaf, dev_item);
-   read_extent_buffer(leaf, dev_uuid,
-  (unsigned long)btrfs_device_uuid(dev_item),
+   read_extent_buffer(leaf, dev_uuid, btrfs_device_uuid(dev_item),
   BTRFS_UUID_SIZE);
read_extent_buffer(leaf, fs_uuid,
   (unsigned long)btrfs_device_fsid(dev_item),
-- 
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/


[PATCH 09/12] Btrfs: Make btrfs_header_chunk_tree_uuid() return unsigned long

2013-08-20 Thread Geert Uytterhoeven
Internally, btrfs_header_chunk_tree_uuid() calculates an unsigned long, but
casts it to a pointer, while all callers cast it to unsigned long again.

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 fs/btrfs/ctree.c   |7 +++
 fs/btrfs/ctree.h   |5 ++---
 fs/btrfs/disk-io.c |5 ++---
 fs/btrfs/ioctl.c   |2 +-
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 9e3b259..a93d0c7 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -3143,8 +3143,7 @@ static noinline int insert_new_root(struct 
btrfs_trans_handle *trans,
BTRFS_FSID_SIZE);
 
write_extent_buffer(c, root-fs_info-chunk_tree_uuid,
-   (unsigned long)btrfs_header_chunk_tree_uuid(c),
-   BTRFS_UUID_SIZE);
+   btrfs_header_chunk_tree_uuid(c), BTRFS_UUID_SIZE);
 
btrfs_set_node_key(c, lower_key, 0);
btrfs_set_node_blockptr(c, 0, lower-start);
@@ -3281,7 +3280,7 @@ static noinline int split_node(struct btrfs_trans_handle 
*trans,
write_extent_buffer(split, root-fs_info-fsid,
btrfs_header_fsid(split), BTRFS_FSID_SIZE);
write_extent_buffer(split, root-fs_info-chunk_tree_uuid,
-   (unsigned long)btrfs_header_chunk_tree_uuid(split),
+   btrfs_header_chunk_tree_uuid(split),
BTRFS_UUID_SIZE);
 
tree_mod_log_eb_copy(root-fs_info, split, c, 0, mid, c_nritems - mid);
@@ -4037,7 +4036,7 @@ again:
btrfs_header_fsid(right), BTRFS_FSID_SIZE);
 
write_extent_buffer(right, root-fs_info-chunk_tree_uuid,
-   (unsigned long)btrfs_header_chunk_tree_uuid(right),
+   btrfs_header_chunk_tree_uuid(right),
BTRFS_UUID_SIZE);
 
if (split == 0) {
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 509963a..f54be20 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2608,10 +2608,9 @@ static inline unsigned long btrfs_header_fsid(struct 
extent_buffer *eb)
return offsetof(struct btrfs_header, fsid);
 }
 
-static inline u8 *btrfs_header_chunk_tree_uuid(struct extent_buffer *eb)
+static inline unsigned long btrfs_header_chunk_tree_uuid(struct extent_buffer 
*eb)
 {
-   unsigned long ptr = offsetof(struct btrfs_header, chunk_tree_uuid);
-   return (u8 *)ptr;
+   return offsetof(struct btrfs_header, chunk_tree_uuid);
 }
 
 static inline int btrfs_is_leaf(struct extent_buffer *eb)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4b61698..4a6c0e5 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1288,7 +1288,7 @@ struct btrfs_root *btrfs_create_tree(struct 
btrfs_trans_handle *trans,
write_extent_buffer(leaf, fs_info-fsid, btrfs_header_fsid(leaf),
BTRFS_FSID_SIZE);
write_extent_buffer(leaf, fs_info-chunk_tree_uuid,
-   (unsigned long)btrfs_header_chunk_tree_uuid(leaf),
+   btrfs_header_chunk_tree_uuid(leaf),
BTRFS_UUID_SIZE);
btrfs_mark_buffer_dirty(leaf);
 
@@ -2607,8 +2607,7 @@ int open_ctree(struct super_block *sb,
chunk_root-commit_root = btrfs_root_node(chunk_root);
 
read_extent_buffer(chunk_root-node, fs_info-chunk_tree_uuid,
-  (unsigned long)btrfs_header_chunk_tree_uuid(chunk_root-node),
-  BTRFS_UUID_SIZE);
+  btrfs_header_chunk_tree_uuid(chunk_root-node), BTRFS_UUID_SIZE);
 
ret = btrfs_read_chunk_tree(chunk_root);
if (ret) {
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 593a0ec..a39034e 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -428,7 +428,7 @@ static noinline int create_subvol(struct inode *dir,
write_extent_buffer(leaf, root-fs_info-fsid, btrfs_header_fsid(leaf),
BTRFS_FSID_SIZE);
write_extent_buffer(leaf, root-fs_info-chunk_tree_uuid,
-   (unsigned long)btrfs_header_chunk_tree_uuid(leaf),
+   btrfs_header_chunk_tree_uuid(leaf),
BTRFS_UUID_SIZE);
btrfs_mark_buffer_dirty(leaf);
 
-- 
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/


[PATCH 08/12] Btrfs: Make btrfs_header_fsid() return unsigned long

2013-08-20 Thread Geert Uytterhoeven
Internally, btrfs_header_fsid() calculates an unsigned long, but casts
it to a pointer, while all callers cast it to unsigned long again.

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 fs/btrfs/ctree.c   |   15 +--
 fs/btrfs/ctree.h   |5 ++---
 fs/btrfs/disk-io.c |9 +++--
 fs/btrfs/ioctl.c   |3 +--
 4 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index b208df3..9e3b259 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -274,8 +274,7 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
else
btrfs_set_header_owner(cow, new_root_objectid);
 
-   write_extent_buffer(cow, root-fs_info-fsid,
-   (unsigned long)btrfs_header_fsid(cow),
+   write_extent_buffer(cow, root-fs_info-fsid, btrfs_header_fsid(cow),
BTRFS_FSID_SIZE);
 
WARN_ON(btrfs_header_generation(buf)  trans-transid);
@@ -1046,8 +1045,7 @@ static noinline int __btrfs_cow_block(struct 
btrfs_trans_handle *trans,
else
btrfs_set_header_owner(cow, root-root_key.objectid);
 
-   write_extent_buffer(cow, root-fs_info-fsid,
-   (unsigned long)btrfs_header_fsid(cow),
+   write_extent_buffer(cow, root-fs_info-fsid, btrfs_header_fsid(cow),
BTRFS_FSID_SIZE);
 
ret = update_ref_for_cow(trans, root, buf, cow, last_ref);
@@ -3141,8 +3139,7 @@ static noinline int insert_new_root(struct 
btrfs_trans_handle *trans,
btrfs_set_header_backref_rev(c, BTRFS_MIXED_BACKREF_REV);
btrfs_set_header_owner(c, root-root_key.objectid);
 
-   write_extent_buffer(c, root-fs_info-fsid,
-   (unsigned long)btrfs_header_fsid(c),
+   write_extent_buffer(c, root-fs_info-fsid, btrfs_header_fsid(c),
BTRFS_FSID_SIZE);
 
write_extent_buffer(c, root-fs_info-chunk_tree_uuid,
@@ -3282,8 +3279,7 @@ static noinline int split_node(struct btrfs_trans_handle 
*trans,
btrfs_set_header_backref_rev(split, BTRFS_MIXED_BACKREF_REV);
btrfs_set_header_owner(split, root-root_key.objectid);
write_extent_buffer(split, root-fs_info-fsid,
-   (unsigned long)btrfs_header_fsid(split),
-   BTRFS_FSID_SIZE);
+   btrfs_header_fsid(split), BTRFS_FSID_SIZE);
write_extent_buffer(split, root-fs_info-chunk_tree_uuid,
(unsigned long)btrfs_header_chunk_tree_uuid(split),
BTRFS_UUID_SIZE);
@@ -4038,8 +4034,7 @@ again:
btrfs_set_header_owner(right, root-root_key.objectid);
btrfs_set_header_level(right, 0);
write_extent_buffer(right, root-fs_info-fsid,
-   (unsigned long)btrfs_header_fsid(right),
-   BTRFS_FSID_SIZE);
+   btrfs_header_fsid(right), BTRFS_FSID_SIZE);
 
write_extent_buffer(right, root-fs_info-chunk_tree_uuid,
(unsigned long)btrfs_header_chunk_tree_uuid(right),
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 21f9632..509963a 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2603,10 +2603,9 @@ static inline void btrfs_set_header_backref_rev(struct 
extent_buffer *eb,
btrfs_set_header_flags(eb, flags);
 }
 
-static inline u8 *btrfs_header_fsid(struct extent_buffer *eb)
+static inline unsigned long btrfs_header_fsid(struct extent_buffer *eb)
 {
-   unsigned long ptr = offsetof(struct btrfs_header, fsid);
-   return (u8 *)ptr;
+   return offsetof(struct btrfs_header, fsid);
 }
 
 static inline u8 *btrfs_header_chunk_tree_uuid(struct extent_buffer *eb)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index e5a68d2..4b61698 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -494,8 +494,7 @@ static int check_tree_block_fsid(struct btrfs_root *root,
u8 fsid[BTRFS_UUID_SIZE];
int ret = 1;
 
-   read_extent_buffer(eb, fsid, (unsigned long)btrfs_header_fsid(eb),
-  BTRFS_FSID_SIZE);
+   read_extent_buffer(eb, fsid, btrfs_header_fsid(eb), BTRFS_FSID_SIZE);
while (fs_devices) {
if (!memcmp(fsid, fs_devices-fsid, BTRFS_FSID_SIZE)) {
ret = 0;
@@ -1286,8 +1285,7 @@ struct btrfs_root *btrfs_create_tree(struct 
btrfs_trans_handle *trans,
btrfs_set_header_owner(leaf, objectid);
root-node = leaf;
 
-   write_extent_buffer(leaf, fs_info-fsid,
-   (unsigned long)btrfs_header_fsid(leaf),
+   write_extent_buffer(leaf, fs_info-fsid, btrfs_header_fsid(leaf),
BTRFS_FSID_SIZE);
write_extent_buffer(leaf, fs_info-chunk_tree_uuid,
(unsigned long)btrfs_header_chunk_tree_uuid(leaf),
@@ -1374,8 +1372,7 @@ static struct btrfs_root 

[PATCH 00/12] Btrfs: cast cleanups

2013-08-20 Thread Geert Uytterhoeven
Hi Chris,

This is a collection of cast cleanups I created after burning my eyes
by the btrfs code.

  - [01/12] Btrfs: Remove superfluous casts from u64 to unsigned long long
  - [02/12] Btrfs: Make BTRFS_DEV_REPLACE_DEVID an unsigned long long constant
  - [03/12] Btrfs: Format PAGE_SIZE as unsigned long
  - [04/12] Btrfs: Format mirror_num as int
  - [05/12] Btrfs: Make btrfs_device_uuid() return unsigned long
  - [06/12] Btrfs: Make btrfs_device_fsid() return unsigned long
  - [07/12] Btrfs: Make btrfs_dev_extent_chunk_tree_uuid() return unsigned long
  - [08/12] Btrfs: Make btrfs_header_fsid() return unsigned long
  - [09/12] Btrfs: Make btrfs_header_chunk_tree_uuid() return unsigned long
  - [10/12] Btrfs: PAGE_CACHE_SIZE is already unsigned long
  - [11/12] Btrfs: Do not truncate sector_t on 32-bit with CONFIG_LBDAF=y
  - [12/12] Btrfs: Use %z to format size_t

None of them are real bugs, except for [11/12] Btrfs: Do not truncate
sector_t on 32-bit with CONFIG_LBDAF=y, which may print truncated values.

This was only compile-tested.

 fs/btrfs/backref.c  |   24 ++--
 fs/btrfs/check-integrity.c  |  313 +++
 fs/btrfs/compression.c  |5 +-
 fs/btrfs/ctree.c|   28 ++--
 fs/btrfs/ctree.h|   24 ++--
 fs/btrfs/delayed-inode.c|   10 +-
 fs/btrfs/dev-replace.c  |4 +-
 fs/btrfs/disk-io.c  |   39 ++
 fs/btrfs/extent-tree.c  |   47 +++
 fs/btrfs/extent_io.c|   48 +++
 fs/btrfs/file-item.c|4 +-
 fs/btrfs/free-space-cache.c |6 +-
 fs/btrfs/inode.c|   24 ++--
 fs/btrfs/ioctl.c|   15 +--
 fs/btrfs/ordered-data.c |   11 +-
 fs/btrfs/print-tree.c   |   80 ---
 fs/btrfs/qgroup.c   |   10 +-
 fs/btrfs/relocation.c   |7 +-
 fs/btrfs/root-tree.c|3 +-
 fs/btrfs/scrub.c|   25 ++--
 fs/btrfs/super.c|   10 +-
 fs/btrfs/transaction.c  |3 +-
 fs/btrfs/volumes.c  |   40 +++---
 23 files changed, 279 insertions(+), 501 deletions(-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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/12] Btrfs: Make BTRFS_DEV_REPLACE_DEVID an unsigned long long constant

2013-08-20 Thread Geert Uytterhoeven
The internal btrfs device id is a u64, hence make the constant
BTRFS_DEV_REPLACE_DEVID unsigned long long as well, so we no longer need
a cast to print it.

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 fs/btrfs/ctree.h   |2 +-
 fs/btrfs/dev-replace.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index e795bf1..2ab606c 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -142,7 +142,7 @@ struct btrfs_ordered_sum;
 
 #define BTRFS_EMPTY_SUBVOL_DIR_OBJECTID 2
 
-#define BTRFS_DEV_REPLACE_DEVID 0
+#define BTRFS_DEV_REPLACE_DEVID 0ULL
 
 /*
  * the max metadata block size.  This limit is somewhat artificial,
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index e34e72f..af800ef 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -154,7 +154,7 @@ no_valid_dev_replace_entry_found:
!btrfs_test_opt(dev_root, DEGRADED)) {
ret = -EIO;
pr_warn(btrfs: cannot mount because device replace 
operation is ongoing and\n tgtdev (devid %llu) is missing, need to run btrfs 
dev scan?\n,
-   (unsigned long long)BTRFS_DEV_REPLACE_DEVID);
+   BTRFS_DEV_REPLACE_DEVID);
}
if (dev_replace-tgtdev) {
if (dev_replace-srcdev) {
-- 
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/


[PATCH 12/12] Btrfs: Use %z to format size_t

2013-08-20 Thread Geert Uytterhoeven
Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 fs/btrfs/check-integrity.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 01f9cc3..3754aa6 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -2950,11 +2950,9 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh)
BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH)
printk(KERN_INFO
   submit_bh(rw=0x%x, blocknr=%llu (bytenr %llu),
-   size=%lu, data=%p, bdev=%p)\n,
+   size=%zu, data=%p, bdev=%p)\n,
   rw, (unsigned long long)bh-b_blocknr,
-  dev_bytenr,
-  (unsigned long)bh-b_size, bh-b_data,
-  bh-b_bdev);
+  dev_bytenr, bh-b_size, bh-b_data, bh-b_bdev);
btrfsic_process_written_block(dev_state, dev_bytenr,
  bh-b_data, 1, NULL,
  NULL, bh, rw);
-- 
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/


[PATCH 10/12] Btrfs: PAGE_CACHE_SIZE is already unsigned long

2013-08-20 Thread Geert Uytterhoeven
PAGE_CACHE_SIZE == PAGE_SIZE is unsigned long everywhere, so there's no
need to cast it to unsigned long.

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 fs/btrfs/check-integrity.c |9 -
 fs/btrfs/extent_io.c   |   18 +-
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 4bf75bb..2fe6f31 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -1232,8 +1232,7 @@ static void btrfsic_read_from_block_data(
unsigned long i = (start_offset + offset)  PAGE_CACHE_SHIFT;
 
WARN_ON(offset + len  block_ctx-len);
-   offset_in_page = (start_offset + offset) 
-((unsigned long)PAGE_CACHE_SIZE - 1);
+   offset_in_page = (start_offset + offset)  (PAGE_CACHE_SIZE - 1);
 
while (len  0) {
cur = min(len, ((size_t)PAGE_CACHE_SIZE - offset_in_page));
@@ -3113,19 +3112,19 @@ int btrfsic_mount(struct btrfs_root *root,
if (root-nodesize  ((u64)PAGE_CACHE_SIZE - 1)) {
printk(KERN_INFO
   btrfsic: cannot handle nodesize %d not being a multiple 
of PAGE_CACHE_SIZE %ld!\n,
-  root-nodesize, (unsigned long)PAGE_CACHE_SIZE);
+  root-nodesize, PAGE_CACHE_SIZE);
return -1;
}
if (root-leafsize  ((u64)PAGE_CACHE_SIZE - 1)) {
printk(KERN_INFO
   btrfsic: cannot handle leafsize %d not being a multiple 
of PAGE_CACHE_SIZE %ld!\n,
-  root-leafsize, (unsigned long)PAGE_CACHE_SIZE);
+  root-leafsize, PAGE_CACHE_SIZE);
return -1;
}
if (root-sectorsize  ((u64)PAGE_CACHE_SIZE - 1)) {
printk(KERN_INFO
   btrfsic: cannot handle sectorsize %d not being a 
multiple of PAGE_CACHE_SIZE %ld!\n,
-  root-sectorsize, (unsigned long)PAGE_CACHE_SIZE);
+  root-sectorsize, PAGE_CACHE_SIZE);
return -1;
}
state = kzalloc(sizeof(*state), GFP_NOFS);
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 454edd5..38acc94 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -4763,7 +4763,7 @@ void read_extent_buffer(struct extent_buffer *eb, void 
*dstv,
WARN_ON(start  eb-len);
WARN_ON(start + len  eb-start + eb-len);
 
-   offset = (start_offset + start)  ((unsigned long)PAGE_CACHE_SIZE - 1);
+   offset = (start_offset + start)  (PAGE_CACHE_SIZE - 1);
 
while (len  0) {
page = extent_buffer_page(eb, i);
@@ -4833,7 +4833,7 @@ int memcmp_extent_buffer(struct extent_buffer *eb, const 
void *ptrv,
WARN_ON(start  eb-len);
WARN_ON(start + len  eb-start + eb-len);
 
-   offset = (start_offset + start)  ((unsigned long)PAGE_CACHE_SIZE - 1);
+   offset = (start_offset + start)  (PAGE_CACHE_SIZE - 1);
 
while (len  0) {
page = extent_buffer_page(eb, i);
@@ -4867,7 +4867,7 @@ void write_extent_buffer(struct extent_buffer *eb, const 
void *srcv,
WARN_ON(start  eb-len);
WARN_ON(start + len  eb-start + eb-len);
 
-   offset = (start_offset + start)  ((unsigned long)PAGE_CACHE_SIZE - 1);
+   offset = (start_offset + start)  (PAGE_CACHE_SIZE - 1);
 
while (len  0) {
page = extent_buffer_page(eb, i);
@@ -4897,7 +4897,7 @@ void memset_extent_buffer(struct extent_buffer *eb, char 
c,
WARN_ON(start  eb-len);
WARN_ON(start + len  eb-start + eb-len);
 
-   offset = (start_offset + start)  ((unsigned long)PAGE_CACHE_SIZE - 1);
+   offset = (start_offset + start)  (PAGE_CACHE_SIZE - 1);
 
while (len  0) {
page = extent_buffer_page(eb, i);
@@ -4928,7 +4928,7 @@ void copy_extent_buffer(struct extent_buffer *dst, struct 
extent_buffer *src,
WARN_ON(src-len != dst_len);
 
offset = (start_offset + dst_offset) 
-   ((unsigned long)PAGE_CACHE_SIZE - 1);
+   (PAGE_CACHE_SIZE - 1);
 
while (len  0) {
page = extent_buffer_page(dst, i);
@@ -5014,9 +5014,9 @@ void memcpy_extent_buffer(struct extent_buffer *dst, 
unsigned long dst_offset,
 
while (len  0) {
dst_off_in_page = (start_offset + dst_offset) 
-   ((unsigned long)PAGE_CACHE_SIZE - 1);
+   (PAGE_CACHE_SIZE - 1);
src_off_in_page = (start_offset + src_offset) 
-   ((unsigned long)PAGE_CACHE_SIZE - 1);
+   (PAGE_CACHE_SIZE - 1);
 
dst_i = (start_offset + dst_offset)  PAGE_CACHE_SHIFT;
src_i = (start_offset + src_offset)  PAGE_CACHE_SHIFT;
@@ -5067,9 +5067,9 @@ void memmove_extent_buffer(struct extent_buffer *dst, 
unsigned long dst_offset,
src_i = (start_offset + src_end)  

<    5   6   7   8   9   10   11   12   13   14   >