[PATCH RESEND] media: atomisp: do not select COMMON_CLK to fix builds

2021-03-16 Thread Krzysztof Kozlowski
From: Krzysztof Kozlowski 

COMMON_CLK is a user-selectable option with its own dependencies.  The
most important dependency is !HAVE_LEGACY_CLK.  User-selectable drivers
should not select COMMON_CLK because they will create a dependency cycle
and build failures.

Signed-off-by: Krzysztof Kozlowski 
Reviewed-by: Stephen Boyd 
---
 drivers/staging/media/atomisp/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/Kconfig 
b/drivers/staging/media/atomisp/Kconfig
index 37577bb72998..742edb261d85 100644
--- a/drivers/staging/media/atomisp/Kconfig
+++ b/drivers/staging/media/atomisp/Kconfig
@@ -2,9 +2,9 @@
 menuconfig INTEL_ATOMISP
bool "Enable support to Intel Atom ISP camera drivers"
depends on X86 && EFI && PCI && ACPI
+   depends on COMMON_CLK
select IOSF_MBI
select MEDIA_CONTROLLER
-   select COMMON_CLK
help
  Enable support for the Intel ISP2 camera interfaces and MIPI
  sensor drivers.
-- 
2.25.1

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


Re: [PATCH v2 00/48] Introduce core voltage scaling for NVIDIA Tegra20/30 SoCs

2021-01-05 Thread Krzysztof Kozlowski
On Thu, Dec 17, 2020 at 09:05:50PM +0300, Dmitry Osipenko wrote:
> Introduce core voltage scaling for NVIDIA Tegra20/30 SoCs, which reduces
> power consumption and heating of the Tegra chips. Tegra SoC has multiple
> hardware units which belong to a core power domain of the SoC and share
> the core voltage. The voltage must be selected in accordance to a minimum
> requirement of every core hardware unit.
> 
> The minimum core voltage requirement depends on:
> 
>   1. Clock enable state of a hardware unit.
>   2. Clock frequency.
>   3. Unit's internal idling/active state.
> 
> This series is tested on Acer A500 (T20), AC100 (T20), Nexus 7 (T30),
> Ouya (T30), TK1 (T124) and some others. I also added voltage scaling to
> the Ventana (T20) and Cardhu (T30) boards which are tested by NVIDIA's CI
> farm. Tegra30 is now couple degrees cooler on Nexus 7 and stays cool on
> Ouya (instead of becoming burning hot) while system is idling. It should
> be possible to improve this further by implementing a more advanced power
> management features for the kernel drivers.
> 
> The DVFS support is opt-in for all boards, meaning that older DTBs will
> continue to work like they did it before this series. It should be possible
> to easily add the core voltage scaling support for Tegra114+ SoCs based on
> this grounding work later on, if anyone will want to implement it.

The same comment as for your interconnect work: for sets touching
multiple systems please mention the dependencies between patches in the
cover letter. Not as a reply to such remark like I make here, but as a
separate entry in the cover letter.

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


Re: [PATCH v2 41/48] memory: tegra20-emc: Use devm_tegra_core_dev_init_opp_table()

2020-12-19 Thread Krzysztof Kozlowski
On Thu, Dec 17, 2020 at 09:06:31PM +0300, Dmitry Osipenko wrote:
> Use common devm_tegra_core_dev_init_opp_table() helper for the OPP table
> initialization.
> 
> Signed-off-by: Dmitry Osipenko 
> ---
>  drivers/memory/tegra/tegra20-emc.c | 57 +++---
>  1 file changed, 4 insertions(+), 53 deletions(-)

If there was no more Tegra MC work planned, this could easily go via
Tegra SoC tree. However I expect still work of your interconnect
patches, so maybe it's better to stick these in same tree.

In such case I would need a stable tag with the
devm_tegra_core_dev_init_opp_table() helper for memory controller tree.

Best regards,
Krzysztof

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


Re: [PATCH v2 07/48] dt-bindings: arm: tegra: Add binding for core power domain

2020-12-19 Thread Krzysztof Kozlowski
On Thu, Dec 17, 2020 at 09:05:57PM +0300, Dmitry Osipenko wrote:
> All NVIDIA Tegra SoCs have a core power domain where majority of hardware
> blocks reside. Add binding for the core power domain.
> 
> Signed-off-by: Dmitry Osipenko 
> ---
>  .../arm/tegra/nvidia,tegra20-core-domain.yaml | 48 +++
>  1 file changed, 48 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-core-domain.yaml
> 
> diff --git 
> a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-core-domain.yaml 
> b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-core-domain.yaml
> new file mode 100644
> index ..f3d8fd2d8371
> --- /dev/null
> +++ 
> b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-core-domain.yaml
> @@ -0,0 +1,48 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/arm/tegra/nvidia,tegra20-core-domain.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: NVIDIA Tegra Core Power Domain
> +
> +maintainers:
> +  - Dmitry Osipenko 
> +  - Jon Hunter 
> +  - Thierry Reding 
> +
> +properties:
> +  compatible:
> +enum:
> +  - nvidia,tegra20-core-domain
> +  - nvidia,tegra30-core-domain

The file should be in bindings/power.
Include also the power-domain.yaml schema.

> +
> +  operating-points-v2:
> +description:
> +  Should contain level, voltages and opp-supported-hw property.
> +  The supported-hw is a bitfield indicating SoC speedo or process
> +  ID mask.
> +
> +  "#power-domain-cells":
> +const: 0
> +
> +  power-supply:
> +description:
> +  Phandle to voltage regulator connected to the SoC Core power rail.
> +
> +required:
> +  - compatible
> +  - operating-points-v2
> +  - "#power-domain-cells"
> +  - power-supply
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +core-domain {

power-domain (to follow schema and devicetree spec)

Best regards,
Krzysztof


> +compatible = "nvidia,tegra20-core-domain";
> +operating-points-v2 = <_table>;
> +power-supply = <>;
> +#power-domain-cells = <0>;
> +};
> -- 
> 2.29.2
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/3] clk: fix redefinition of clk_prepare on MIPS with HAVE_LEGACY_CLK

2020-11-25 Thread Krzysztof Kozlowski
On Tue, Nov 24, 2020 at 04:11:31PM -0800, Stephen Boyd wrote:
> Quoting Krzysztof Kozlowski (2020-11-17 23:48:12)
> > On Tue, Nov 17, 2020 at 11:41:57PM -0800, Stephen Boyd wrote:
> > > Quoting Krzysztof Kozlowski (2020-11-15 09:09:48)
> > > > COMMON_CLK even though is a user-selectable symbol, is still selected by
> > > > multiple other config options.  COMMON_CLK should not be used when
> > > > legacy clocks are provided by architecture, so it correctly depends on
> > > > !HAVE_LEGACY_CLK.
> > > > 
> > > > However it is possible to create a config which selects both COMMON_CLK
> > > > (by SND_SUN8I_CODEC) and HAVE_LEGACY_CLK (by SOC_RT305X) which leads to
> > > 
> > > Why is SND_SUN8I_CODEC selecting COMMON_CLK? Or really, why is
> > > SOC_RT305X selecting HAVE_LEGACY_CLK?
> > 
> > The SND_SUN8I_CODEC I fixed in following patch (I sent separately v2 of
> > it).
> > 
> > The SOC_RT305X select HAVE_LEGACY_CLK? because it is an old, Ralink
> > platform, not converted to Common clock frm. Few clock operations are
> > defined in: arch/mips/ralink/clk.c
> > 
> 
> Ok so this patch isn't necessary then?

For this particular build failure - it is not necessary anymore.

However there might more of such errors - just not discovered yet. Also,
the clock bulk API has such ifdefs so it kind of symmetrical and
consistent approach.

> It seems OK to select
> HAVE_LEGACY_CLK but not to select COMMON_CLK unless it's architecture
> code that can't be enabled when the other architecture code is selecting
> HAVE_LEGACY_CLK.

Best regards,
Krzysztof

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


Re: [PATCH 1/3] clk: fix redefinition of clk_prepare on MIPS with HAVE_LEGACY_CLK

2020-11-17 Thread Krzysztof Kozlowski
On Tue, Nov 17, 2020 at 11:41:57PM -0800, Stephen Boyd wrote:
> Quoting Krzysztof Kozlowski (2020-11-15 09:09:48)
> > COMMON_CLK even though is a user-selectable symbol, is still selected by
> > multiple other config options.  COMMON_CLK should not be used when
> > legacy clocks are provided by architecture, so it correctly depends on
> > !HAVE_LEGACY_CLK.
> > 
> > However it is possible to create a config which selects both COMMON_CLK
> > (by SND_SUN8I_CODEC) and HAVE_LEGACY_CLK (by SOC_RT305X) which leads to
> 
> Why is SND_SUN8I_CODEC selecting COMMON_CLK? Or really, why is
> SOC_RT305X selecting HAVE_LEGACY_CLK?

The SND_SUN8I_CODEC I fixed in following patch (I sent separately v2 of
it).

The SOC_RT305X select HAVE_LEGACY_CLK? because it is an old, Ralink
platform, not converted to Common clock frm. Few clock operations are
defined in: arch/mips/ralink/clk.c

Best regards,
Krzysztof

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


Re: [RFC 2/3] ARM: sunxi: do not select COMMON_CLK to fix builds

2020-11-16 Thread Krzysztof Kozlowski
On Mon, Nov 16, 2020 at 10:36:12PM -0600, Samuel Holland wrote:
> On 11/15/20 11:09 AM, Krzysztof Kozlowski wrote:
> > COMMON_CLK is a user-selectable option with its own dependencies.  The
> > most important dependency is !HAVE_LEGACY_CLK.  User-selectable drivers
> > should not select COMMON_CLK because they will create a dependency cycle
> > and build failures.  For example on MIPS a configuration with COMMON_CLK
> > (selected by SND_SUN8I_CODEC) and HAVE_LEGACY_CLK (selected by
> > SOC_RT305X) is possible:
> 
> Ah, that makes sense.
> 
> > 
> >   WARNING: unmet direct dependencies detected for COMMON_CLK
> > Depends on [n]: !HAVE_LEGACY_CLK [=y]
> > Selected by [y]:
> > - SND_SUN8I_CODEC [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC 
> > [=y] &&
> >   (ARCH_SUNXI || COMPILE_TEST [=y]) && OF [=y] && (MACH_SUN8I || ARM64 
> > && ARCH_SUNXI || COMPILE_TEST [=y])
> > 
> > /usr/bin/mips-linux-gnu-ld: drivers/clk/clk.o: in function 
> > `clk_set_rate':
> > (.text+0xaeb4): multiple definition of `clk_set_rate'; 
> > arch/mips/ralink/clk.o:(.text+0x88): first defined here
> > 
> > Signed-off-by: Krzysztof Kozlowski 
> > ---
> >  arch/arm/mach-sunxi/Kconfig | 1 +
> >  sound/soc/sunxi/Kconfig | 2 +-
> >  2 files changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
> > index eeadb1a4dcfe..4d9f9b6d329d 100644
> > --- a/arch/arm/mach-sunxi/Kconfig
> > +++ b/arch/arm/mach-sunxi/Kconfig
> > @@ -4,6 +4,7 @@ menuconfig ARCH_SUNXI
> > depends on ARCH_MULTI_V5 || ARCH_MULTI_V7
> > select ARCH_HAS_RESET_CONTROLLER
> > select CLKSRC_MMIO
> > +   select COMMON_CLK
> 
> This is not necessary, since ARCH_SUNXI depends (through ARCH_MULTI_V{5,7}) on
> ARCH_MULTIPLATFORM, which selects COMMON_CLK already.

Thanks. I'll send a v2 with changes and your review.

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


[PATCH 1/3] clk: fix redefinition of clk_prepare on MIPS with HAVE_LEGACY_CLK

2020-11-15 Thread Krzysztof Kozlowski
COMMON_CLK even though is a user-selectable symbol, is still selected by
multiple other config options.  COMMON_CLK should not be used when
legacy clocks are provided by architecture, so it correctly depends on
!HAVE_LEGACY_CLK.

However it is possible to create a config which selects both COMMON_CLK
(by SND_SUN8I_CODEC) and HAVE_LEGACY_CLK (by SOC_RT305X) which leads to
compile errors (MIPS architecture):

drivers/clk/clk.c:855:6: error: redefinition of ‘clk_unprepare’
In file included from drivers/clk/clk.c:9:
include/linux/clk.h:263:20: note: previous definition of ‘clk_unprepare’ 
was here

The definitions clk_bulk_prepare() (and unprepare) already have proper
surrounding #ifdef so add them also for clk_prepare()/clk_unprepare().

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/clk/clk.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index f83dac54ed85..f4f68c7c2fb5 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -841,6 +841,7 @@ static void clk_core_unprepare_lock(struct clk_core *core)
clk_prepare_unlock();
 }
 
+#ifdef CONFIG_HAVE_CLK_PREPARE
 /**
  * clk_unprepare - undo preparation of a clock source
  * @clk: the clk being unprepared
@@ -860,6 +861,7 @@ void clk_unprepare(struct clk *clk)
clk_core_unprepare_lock(clk->core);
 }
 EXPORT_SYMBOL_GPL(clk_unprepare);
+#endif
 
 static int clk_core_prepare(struct clk_core *core)
 {
@@ -921,6 +923,7 @@ static int clk_core_prepare_lock(struct clk_core *core)
return ret;
 }
 
+#ifdef CONFIG_HAVE_CLK_PREPARE
 /**
  * clk_prepare - prepare a clock source
  * @clk: the clk being prepared
@@ -941,6 +944,7 @@ int clk_prepare(struct clk *clk)
return clk_core_prepare_lock(clk->core);
 }
 EXPORT_SYMBOL_GPL(clk_prepare);
+#endif /* CONFIG_HAVE_CLK_PREPARE */
 
 static void clk_core_disable(struct clk_core *core)
 {
-- 
2.25.1

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


[PATCH 0/3] clk/sunxi/media: Fix builds with COMMON_CLK and HAVE_LEGACY_CLK

2020-11-15 Thread Krzysztof Kozlowski
Hi,

Multiple configurations create unbuildable config by selecting
COMMON_CLK and HAVE_LEGACY_CLK.  The first simply should not be
selected.

The patches 2/3 and 3/3 address this specific problem.  I performed few
compile tests and I am still building other configurations, therefore
they were marked as RFC.

Best regards,
Krzysztof


Krzysztof Kozlowski (3):
  clk: fix redefinition of clk_prepare on MIPS with HAVE_LEGACY_CLK
  ARM: sunxi: do not select COMMON_CLK to fix builds
  media: atomisp: do not select COMMON_CLK to fix builds

 arch/arm/mach-sunxi/Kconfig   | 1 +
 drivers/clk/clk.c | 4 
 drivers/staging/media/atomisp/Kconfig | 2 +-
 sound/soc/sunxi/Kconfig   | 2 +-
 4 files changed, 7 insertions(+), 2 deletions(-)

-- 
2.25.1

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


[RFC 2/3] ARM: sunxi: do not select COMMON_CLK to fix builds

2020-11-15 Thread Krzysztof Kozlowski
COMMON_CLK is a user-selectable option with its own dependencies.  The
most important dependency is !HAVE_LEGACY_CLK.  User-selectable drivers
should not select COMMON_CLK because they will create a dependency cycle
and build failures.  For example on MIPS a configuration with COMMON_CLK
(selected by SND_SUN8I_CODEC) and HAVE_LEGACY_CLK (selected by
SOC_RT305X) is possible:

  WARNING: unmet direct dependencies detected for COMMON_CLK
Depends on [n]: !HAVE_LEGACY_CLK [=y]
Selected by [y]:
- SND_SUN8I_CODEC [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] &&
  (ARCH_SUNXI || COMPILE_TEST [=y]) && OF [=y] && (MACH_SUN8I || ARM64 && 
ARCH_SUNXI || COMPILE_TEST [=y])

/usr/bin/mips-linux-gnu-ld: drivers/clk/clk.o: in function `clk_set_rate':
(.text+0xaeb4): multiple definition of `clk_set_rate'; 
arch/mips/ralink/clk.o:(.text+0x88): first defined here

Signed-off-by: Krzysztof Kozlowski 
---
 arch/arm/mach-sunxi/Kconfig | 1 +
 sound/soc/sunxi/Kconfig | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index eeadb1a4dcfe..4d9f9b6d329d 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -4,6 +4,7 @@ menuconfig ARCH_SUNXI
depends on ARCH_MULTI_V5 || ARCH_MULTI_V7
select ARCH_HAS_RESET_CONTROLLER
select CLKSRC_MMIO
+   select COMMON_CLK
select GENERIC_IRQ_CHIP
select GPIOLIB
select PINCTRL
diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig
index 69b9d8515335..ddcaaa98d3cb 100644
--- a/sound/soc/sunxi/Kconfig
+++ b/sound/soc/sunxi/Kconfig
@@ -14,7 +14,7 @@ config SND_SUN8I_CODEC
tristate "Allwinner SUN8I audio codec"
depends on OF
depends on MACH_SUN8I || (ARM64 && ARCH_SUNXI) || COMPILE_TEST
-   select COMMON_CLK
+   depends on COMMON_CLK
select REGMAP_MMIO
help
  This option enables the digital part of the internal audio codec for
-- 
2.25.1

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


[RFC 3/3] media: atomisp: do not select COMMON_CLK to fix builds

2020-11-15 Thread Krzysztof Kozlowski
COMMON_CLK is a user-selectable option with its own dependencies.  The
most important dependency is !HAVE_LEGACY_CLK.  User-selectable drivers
should not select COMMON_CLK because they will create a dependency cycle
and build failures.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/staging/media/atomisp/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/Kconfig 
b/drivers/staging/media/atomisp/Kconfig
index 37577bb72998..742edb261d85 100644
--- a/drivers/staging/media/atomisp/Kconfig
+++ b/drivers/staging/media/atomisp/Kconfig
@@ -2,9 +2,9 @@
 menuconfig INTEL_ATOMISP
bool "Enable support to Intel Atom ISP camera drivers"
depends on X86 && EFI && PCI && ACPI
+   depends on COMMON_CLK
select IOSF_MBI
select MEDIA_CONTROLLER
-   select COMMON_CLK
help
  Enable support for the Intel ISP2 camera interfaces and MIPI
  sensor drivers.
-- 
2.25.1

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


[PATCH] staging: fwserial: Fix Kconfig indentation (seven spaces)

2019-11-21 Thread Krzysztof Kozlowski
Adjust indentation from seven spaces to tab (+optional two spaces) as in
coding style with command like:
$ sed -e 's/^   /\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/staging/fwserial/Kconfig | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/fwserial/Kconfig b/drivers/staging/fwserial/Kconfig
index d21124a1a127..6964aac2a7ed 100644
--- a/drivers/staging/fwserial/Kconfig
+++ b/drivers/staging/fwserial/Kconfig
@@ -1,8 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 config FIREWIRE_SERIAL
-   tristate "TTY over Firewire"
-   depends on FIREWIRE && TTY
-   help
+   tristate "TTY over Firewire"
+   depends on FIREWIRE && TTY
+   help
  This enables TTY over IEEE 1394, providing high-speed serial
  connectivity to cabled peers. This driver implements a
  ad-hoc transport protocol and is currently limited to
@@ -14,17 +14,17 @@ config FIREWIRE_SERIAL
 if FIREWIRE_SERIAL
 
 config FWTTY_MAX_TOTAL_PORTS
-   int "Maximum number of serial ports supported"
-   default "64"
-   help
+   int "Maximum number of serial ports supported"
+   default "64"
+   help
  Set this to the maximum number of serial ports you want the
  firewire-serial driver to support.
 
 config FWTTY_MAX_CARD_PORTS
-   int "Maximum number of serial ports supported per adapter"
-   range 0 FWTTY_MAX_TOTAL_PORTS
-   default "32"
-   help
+   int "Maximum number of serial ports supported per adapter"
+   range 0 FWTTY_MAX_TOTAL_PORTS
+   default "32"
+   help
  Set this to the maximum number of serial ports each firewire
  adapter supports. The actual number of serial ports registered
  is set with the module parameter "ttys".
-- 
2.17.1

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


[PATCH v2] staging: fwserial: Fix Kconfig indentation

2019-11-20 Thread Krzysztof Kozlowski
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
$ sed -e 's/^/\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski 

---

Changes since v1:
1. Fix also 7-space and tab+1 space indentation issues.
---
 drivers/staging/fwserial/Kconfig | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/fwserial/Kconfig b/drivers/staging/fwserial/Kconfig
index 9543f8454af9..6964aac2a7ed 100644
--- a/drivers/staging/fwserial/Kconfig
+++ b/drivers/staging/fwserial/Kconfig
@@ -1,9 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
 config FIREWIRE_SERIAL
-   tristate "TTY over Firewire"
-   depends on FIREWIRE && TTY
-   help
-  This enables TTY over IEEE 1394, providing high-speed serial
+   tristate "TTY over Firewire"
+   depends on FIREWIRE && TTY
+   help
+ This enables TTY over IEEE 1394, providing high-speed serial
  connectivity to cabled peers. This driver implements a
  ad-hoc transport protocol and is currently limited to
  Linux-to-Linux communication.
@@ -14,18 +14,18 @@ config FIREWIRE_SERIAL
 if FIREWIRE_SERIAL
 
 config FWTTY_MAX_TOTAL_PORTS
-   int "Maximum number of serial ports supported"
-   default "64"
-   help
-  Set this to the maximum number of serial ports you want the
+   int "Maximum number of serial ports supported"
+   default "64"
+   help
+ Set this to the maximum number of serial ports you want the
  firewire-serial driver to support.
 
 config FWTTY_MAX_CARD_PORTS
-   int "Maximum number of serial ports supported per adapter"
-   range 0 FWTTY_MAX_TOTAL_PORTS
-   default "32"
-   help
-  Set this to the maximum number of serial ports each firewire
+   int "Maximum number of serial ports supported per adapter"
+   range 0 FWTTY_MAX_TOTAL_PORTS
+   default "32"
+   help
+ Set this to the maximum number of serial ports each firewire
  adapter supports. The actual number of serial ports registered
  is set with the module parameter "ttys".
 
-- 
2.7.4

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


[PATCH] staging: pi433: Fix Kconfig indentation

2019-11-20 Thread Krzysztof Kozlowski
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
$ sed -e 's/^/\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/staging/pi433/Kconfig | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/pi433/Kconfig b/drivers/staging/pi433/Kconfig
index 8acde0814206..dd9e4709d1a8 100644
--- a/drivers/staging/pi433/Kconfig
+++ b/drivers/staging/pi433/Kconfig
@@ -1,17 +1,17 @@
 # SPDX-License-Identifier: GPL-2.0
 config PI433
-tristate "Pi433 - a 433MHz radio module for Raspberry Pi"
-depends on SPI
-help
-  This option allows you to enable support for the radio module Pi433.
+   tristate "Pi433 - a 433MHz radio module for Raspberry Pi"
+   depends on SPI
+   help
+ This option allows you to enable support for the radio module Pi433.
 
-  Pi433 is a shield that fits onto the GPIO header of a Raspberry Pi
-  or compatible. It extends the Raspberry Pi with the option, to
-  send and receive data in the 433MHz ISM band - for example to
-  communicate between two systems without using ethernet or bluetooth
-  or for control or read sockets, actors, sensors, widely available
-  for low price.
+ Pi433 is a shield that fits onto the GPIO header of a Raspberry Pi
+ or compatible. It extends the Raspberry Pi with the option, to
+ send and receive data in the 433MHz ISM band - for example to
+ communicate between two systems without using ethernet or bluetooth
+ or for control or read sockets, actors, sensors, widely available
+ for low price.
 
-  For details or the option to buy, please visit 
https://pi433.de/en.html
+ For details or the option to buy, please visit 
https://pi433.de/en.html
 
-  If in doubt, say N here, but saying yes most probably won't hurt
+ If in doubt, say N here, but saying yes most probably won't hurt
-- 
2.17.1

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


[PATCH] staging: nvec: Fix Kconfig indentation

2019-11-20 Thread Krzysztof Kozlowski
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
$ sed -e 's/^/\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/staging/nvec/Kconfig | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/nvec/Kconfig b/drivers/staging/nvec/Kconfig
index 5c12cacf75e1..9fa98c16f1d9 100644
--- a/drivers/staging/nvec/Kconfig
+++ b/drivers/staging/nvec/Kconfig
@@ -8,7 +8,7 @@ config MFD_NVEC
controller.
 
To compile this driver as a module, say M here: the module will be
-called mfd-nvec
+   called mfd-nvec
 
 config KEYBOARD_NVEC
tristate "Keyboard on nVidia compliant EC"
@@ -18,7 +18,7 @@ config KEYBOARD_NVEC
  a nVidia compliant embedded controller.
 
  To compile this driver as a module, say M here: the module will be
-  called keyboard-nvec
+ called keyboard-nvec
 
 config SERIO_NVEC_PS2
tristate "PS2 on nVidia EC"
@@ -28,7 +28,7 @@ config SERIO_NVEC_PS2
  to a nVidia compliant embedded controller.
 
  To compile this driver as a module, say M here: the module will be
-  called serio-nvec-ps2
+ called serio-nvec-ps2
 
 
 config NVEC_POWER
@@ -39,7 +39,7 @@ config NVEC_POWER
  nVidia compliant embedded controllers.
 
  To compile this driver as a module, say M here: the module will be
-  called nvec-power
+ called nvec-power
 
 
 config NVEC_PAZ00
@@ -50,5 +50,5 @@ config NVEC_PAZ00
  devices, e.g. Toshbia AC100 and Dynabooks AZ netbooks.
 
  To compile this driver as a module, say M here: the module will be
-  called nvec-paz00
+ called nvec-paz00
 
-- 
2.17.1

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


[PATCH] staging: vc04: Fix Kconfig indentation

2019-11-20 Thread Krzysztof Kozlowski
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
$ sed -e 's/^/\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/staging/vc04_services/bcm2835-audio/Kconfig | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/Kconfig 
b/drivers/staging/vc04_services/bcm2835-audio/Kconfig
index f66319512faf..d32ea348e846 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/Kconfig
+++ b/drivers/staging/vc04_services/bcm2835-audio/Kconfig
@@ -1,9 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
 config SND_BCM2835
-tristate "BCM2835 Audio"
-depends on (ARCH_BCM2835 || COMPILE_TEST) && SND
-select SND_PCM
-select BCM2835_VCHIQ
-help
-  Say Y or M if you want to support BCM2835 built in audio
+   tristate "BCM2835 Audio"
+   depends on (ARCH_BCM2835 || COMPILE_TEST) && SND
+   select SND_PCM
+   select BCM2835_VCHIQ
+   help
+ Say Y or M if you want to support BCM2835 built in audio
 
-- 
2.17.1

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


[PATCH] staging: fbtft: Fix Kconfig indentation

2019-11-20 Thread Krzysztof Kozlowski
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
$ sed -e 's/^/\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/staging/fbtft/Kconfig | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig
index d994aea84b21..19d9d88e9150 100644
--- a/drivers/staging/fbtft/Kconfig
+++ b/drivers/staging/fbtft/Kconfig
@@ -95,8 +95,8 @@ config FB_TFT_PCD8544
  Generic Framebuffer support for PCD8544
 
 config FB_TFT_RA8875
-tristate "FB driver for the RA8875 LCD Controller"
-depends on FB_TFT
+   tristate "FB driver for the RA8875 LCD Controller"
+   depends on FB_TFT
help
  Generic Framebuffer support for RA8875
 
@@ -132,10 +132,10 @@ config FB_TFT_SSD1289
  Framebuffer support for SSD1289
 
 config FB_TFT_SSD1305
-tristate "FB driver for the SSD1305 OLED Controller"
-depends on FB_TFT
-help
-  Framebuffer support for SSD1305
+   tristate "FB driver for the SSD1305 OLED Controller"
+   depends on FB_TFT
+   help
+ Framebuffer support for SSD1305
 
 config FB_TFT_SSD1306
tristate "FB driver for the SSD1306 OLED Controller"
-- 
2.17.1

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


[PATCH] staging: fwserial: Fix Kconfig indentation

2019-11-20 Thread Krzysztof Kozlowski
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
$ sed -e 's/^/\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/staging/fwserial/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fwserial/Kconfig b/drivers/staging/fwserial/Kconfig
index 9543f8454af9..d21124a1a127 100644
--- a/drivers/staging/fwserial/Kconfig
+++ b/drivers/staging/fwserial/Kconfig
@@ -3,7 +3,7 @@ config FIREWIRE_SERIAL
tristate "TTY over Firewire"
depends on FIREWIRE && TTY
help
-  This enables TTY over IEEE 1394, providing high-speed serial
+ This enables TTY over IEEE 1394, providing high-speed serial
  connectivity to cabled peers. This driver implements a
  ad-hoc transport protocol and is currently limited to
  Linux-to-Linux communication.
@@ -17,7 +17,7 @@ config FWTTY_MAX_TOTAL_PORTS
int "Maximum number of serial ports supported"
default "64"
help
-  Set this to the maximum number of serial ports you want the
+ Set this to the maximum number of serial ports you want the
  firewire-serial driver to support.
 
 config FWTTY_MAX_CARD_PORTS
@@ -25,7 +25,7 @@ config FWTTY_MAX_CARD_PORTS
range 0 FWTTY_MAX_TOTAL_PORTS
default "32"
help
-  Set this to the maximum number of serial ports each firewire
+ Set this to the maximum number of serial ports each firewire
  adapter supports. The actual number of serial ports registered
  is set with the module parameter "ttys".
 
-- 
2.17.1

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


[PATCH] staging: most: Fix Kconfig indentation

2019-11-20 Thread Krzysztof Kozlowski
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
$ sed -e 's/^/\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/staging/most/Kconfig | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig
index 8948d5246409..6262eb25c80b 100644
--- a/drivers/staging/most/Kconfig
+++ b/drivers/staging/most/Kconfig
@@ -1,9 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
 menuconfig MOST
-tristate "MOST support"
+   tristate "MOST support"
depends on HAS_DMA && CONFIGFS_FS
-default n
-help
+   default n
+   help
  Say Y here if you want to enable MOST support.
  This driver needs at least one additional component to enable the
  desired access from userspace (e.g. character devices) and one that
@@ -12,7 +12,7 @@ menuconfig MOST
  To compile this driver as a module, choose M here: the
  module will be called most_core.
 
-  If in doubt, say N here.
+ If in doubt, say N here.
 
 
 
-- 
2.17.1

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


[RESEND TRIVIAL 2/3] treewide: Fix Kconfig indentation

2019-10-04 Thread Krzysztof Kozlowski
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
$ sed -e 's/^/\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski 
---
 certs/Kconfig  | 14 ++---
 init/Kconfig   | 28 +-
 kernel/trace/Kconfig   |  8 
 lib/Kconfig|  2 +-
 lib/Kconfig.debug  | 36 +-
 lib/Kconfig.kgdb   |  8 
 mm/Kconfig | 28 +-
 samples/Kconfig|  2 +-
 security/apparmor/Kconfig  |  2 +-
 security/integrity/Kconfig | 24 +++
 security/integrity/ima/Kconfig | 12 ++--
 security/safesetid/Kconfig | 24 +++
 12 files changed, 94 insertions(+), 94 deletions(-)

diff --git a/certs/Kconfig b/certs/Kconfig
index c94e93d8bccf..0358c66d3d7c 100644
--- a/certs/Kconfig
+++ b/certs/Kconfig
@@ -6,14 +6,14 @@ config MODULE_SIG_KEY
default "certs/signing_key.pem"
depends on MODULE_SIG
help
- Provide the file name of a private key/certificate in PEM format,
- or a PKCS#11 URI according to RFC7512. The file should contain, or
- the URI should identify, both the certificate and its corresponding
- private key.
+Provide the file name of a private key/certificate in PEM format,
+or a PKCS#11 URI according to RFC7512. The file should contain, or
+the URI should identify, both the certificate and its corresponding
+private key.
 
- If this option is unchanged from its default "certs/signing_key.pem",
- then the kernel will automatically generate the private key and
- certificate as described in 
Documentation/admin-guide/module-signing.rst
+If this option is unchanged from its default "certs/signing_key.pem",
+then the kernel will automatically generate the private key and
+certificate as described in 
Documentation/admin-guide/module-signing.rst
 
 config SYSTEM_TRUSTED_KEYRING
bool "Provide system-wide ring of trusted keys"
diff --git a/init/Kconfig b/init/Kconfig
index b4daad2bac23..e1a6f31da281 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -169,10 +169,10 @@ config BUILD_SALT
string "Build ID Salt"
default ""
help
-  The build ID is used to link binaries and their debug info. Setting
-  this option will use the value in the calculation of the build id.
-  This is mostly useful for distributions which want to ensure the
-  build is unique between builds. It's safe to leave the default.
+ The build ID is used to link binaries and their debug info. Setting
+ this option will use the value in the calculation of the build id.
+ This is mostly useful for distributions which want to ensure the
+ build is unique between builds. It's safe to leave the default.
 
 config HAVE_KERNEL_GZIP
bool
@@ -1327,9 +1327,9 @@ menuconfig EXPERT
select DEBUG_KERNEL
help
  This option allows certain base kernel options and settings
-  to be disabled or tweaked. This is for specialized
-  environments which can tolerate a "non-standard" kernel.
-  Only use this if you really know what you are doing.
+ to be disabled or tweaked. This is for specialized
+ environments which can tolerate a "non-standard" kernel.
+ Only use this if you really know what you are doing.
 
 config UID16
bool "Enable 16-bit UID system calls" if EXPERT
@@ -1439,11 +1439,11 @@ config BUG
bool "BUG() support" if EXPERT
default y
help
-  Disabling this option eliminates support for BUG and WARN, reducing
-  the size of your kernel image and potentially quietly ignoring
-  numerous fatal conditions. You should only consider disabling this
-  option for embedded systems with no facilities for reporting errors.
-  Just say Y.
+ Disabling this option eliminates support for BUG and WARN, reducing
+ the size of your kernel image and potentially quietly ignoring
+ numerous fatal conditions. You should only consider disabling this
+ option for embedded systems with no facilities for reporting errors.
+ Just say Y.
 
 config ELF_CORE
depends on COREDUMP
@@ -1459,8 +1459,8 @@ config PCSPKR_PLATFORM
select I8253_LOCK
default y
help
-  This option allows to disable the internal PC-Speaker
-  support, saving some memory.
+ This option allows to disable the internal PC-Speaker
+ support, saving some memory.
 
 config BASE_FULL
default y
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index e0

[RESEND TRIVIAL 1/3] treewide: drivers: Fix Kconfig indentation

2019-10-04 Thread Krzysztof Kozlowski
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
$ sed -e 's/^/\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/acpi/Kconfig  |  8 +-
 drivers/ata/Kconfig   | 12 +--
 drivers/auxdisplay/Kconfig| 14 +--
 drivers/base/firmware_loader/Kconfig  |  2 +-
 drivers/block/Kconfig | 28 +++---
 drivers/block/mtip32xx/Kconfig|  2 +-
 drivers/char/Kconfig  |  6 +-
 drivers/char/agp/Kconfig  |  2 +-
 drivers/char/hw_random/Kconfig| 10 +-
 drivers/char/ipmi/Kconfig | 20 ++--
 drivers/clk/Kconfig   |  2 +-
 drivers/clk/mediatek/Kconfig  | 10 +-
 drivers/clk/versatile/Kconfig |  2 +-
 drivers/clocksource/Kconfig   | 20 ++--
 drivers/cpufreq/Kconfig.x86   |  6 +-
 drivers/cpuidle/Kconfig   |  8 +-
 drivers/cpuidle/Kconfig.arm   | 16 ++--
 drivers/crypto/Kconfig|  4 +-
 drivers/crypto/caam/Kconfig   | 14 +--
 drivers/crypto/chelsio/Kconfig| 30 +++---
 drivers/crypto/stm32/Kconfig  |  6 +-
 drivers/crypto/ux500/Kconfig  | 16 ++--
 drivers/devfreq/Kconfig   |  6 +-
 drivers/dma/Kconfig   | 46 -
 drivers/edac/Kconfig  |  2 +-
 drivers/firmware/Kconfig  |  4 +-
 drivers/firmware/efi/Kconfig  |  2 +-
 drivers/hid/Kconfig   |  2 +-
 drivers/hwmon/Kconfig | 14 +--
 drivers/i2c/busses/Kconfig| 16 ++--
 drivers/i2c/muxes/Kconfig | 18 ++--
 drivers/iio/gyro/Kconfig  |  8 +-
 drivers/infiniband/hw/bnxt_re/Kconfig | 12 +--
 drivers/input/keyboard/Kconfig|  8 +-
 drivers/input/mouse/Kconfig   |  6 +-
 drivers/input/tablet/Kconfig  | 20 ++--
 drivers/input/touchscreen/Kconfig |  2 +-
 drivers/iommu/Kconfig |  2 +-
 drivers/irqchip/Kconfig   | 10 +-
 drivers/isdn/hardware/mISDN/Kconfig   |  2 +-
 drivers/macintosh/Kconfig |  6 +-
 drivers/md/Kconfig| 54 +--
 drivers/media/Kconfig |  6 +-
 drivers/media/radio/si470x/Kconfig|  4 +-
 drivers/memstick/core/Kconfig | 18 ++--
 drivers/memstick/host/Kconfig |  4 +-
 drivers/misc/Kconfig  | 16 ++--
 drivers/mtd/nand/onenand/Kconfig  | 12 +--
 drivers/nfc/nfcmrvl/Kconfig   |  2 +-
 drivers/pci/Kconfig   | 24 ++---
 drivers/pci/controller/dwc/Kconfig|  6 +-
 drivers/pci/hotplug/Kconfig   |  2 +-
 drivers/perf/Kconfig  | 14 +--
 drivers/phy/hisilicon/Kconfig |  6 +-
 drivers/pinctrl/Kconfig   | 18 ++--
 drivers/pinctrl/freescale/Kconfig | 12 +--
 drivers/pinctrl/qcom/Kconfig  | 34 +++
 drivers/platform/chrome/Kconfig   |  6 +-
 drivers/platform/mellanox/Kconfig |  4 +-
 drivers/platform/x86/Kconfig  | 48 +-
 drivers/power/avs/Kconfig | 12 +--
 drivers/power/supply/Kconfig  | 30 +++---
 drivers/regulator/Kconfig |  8 +-
 drivers/rpmsg/Kconfig |  2 +-
 drivers/rtc/Kconfig   |  6 +-
 drivers/scsi/Kconfig  | 22 ++---
 drivers/scsi/aic7xxx/Kconfig.aic7xxx  | 14 +--
 drivers/scsi/pcmcia/Kconfig   |  2 +-
 drivers/scsi/qedf/Kconfig |  4 +-
 drivers/scsi/smartpqi/Kconfig |  8 +-
 drivers/soc/fsl/Kconfig   |  8 +-
 drivers/soc/qcom/Kconfig  | 22 ++---
 drivers/soc/rockchip/Kconfig  | 18 ++--
 drivers/spi/Kconfig   | 18 ++--
 drivers/staging/fbtft/Kconfig | 12 +--
 drivers/staging/fwserial/Kconfig  |  6 +-
 drivers/staging/most/Kconfig  |  8 +-
 drivers/staging/nvec/Kconfig  | 10 +-
 drivers/staging/pi433/Kconfig | 24 ++---
 drivers/staging/uwb/Kconfig   | 42 
 .../vc04_services/bcm2835-audio/Kconfig   | 12 +--
 drivers/staging/wusbcore/Kconfig  |  2 +-
 drivers/tty/Kconfig   | 26 ++---
 drivers/tty/hvc/Kconfig   |  4 +-
 drivers/tty/serial/8250/Kconfig   |  2 +-
 drivers/tty/serial/Kconfig

[RESEND TRIVIAL 3/3] treewide: arch: Fix Kconfig indentation

2019-10-04 Thread Krzysztof Kozlowski
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
$ sed -e 's/^/\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski 
---
 arch/Kconfig   |  4 ++--
 arch/alpha/Kconfig |  2 +-
 arch/arm/Kconfig.debug |  4 ++--
 arch/arm/mach-ep93xx/Kconfig   |  8 
 arch/arm/mach-hisi/Kconfig |  2 +-
 arch/arm/mach-ixp4xx/Kconfig   | 16 
 arch/arm/mach-mmp/Kconfig  |  2 +-
 arch/arm/mach-omap1/Kconfig| 14 +++---
 arch/arm/mach-prima2/Kconfig   |  6 +++---
 arch/arm/mach-s3c24xx/Kconfig  |  4 ++--
 arch/arm/mach-s3c64xx/Kconfig  |  6 +++---
 arch/arm/plat-samsung/Kconfig  |  2 +-
 arch/arm64/Kconfig |  6 +++---
 arch/arm64/Kconfig.debug   |  2 +-
 arch/h8300/Kconfig |  4 ++--
 arch/h8300/Kconfig.cpu |  4 ++--
 arch/m68k/Kconfig.bus  |  2 +-
 arch/m68k/Kconfig.debug| 16 
 arch/m68k/Kconfig.machine  |  8 
 arch/nds32/Kconfig.cpu | 18 +-
 arch/openrisc/Kconfig  | 26 +-
 arch/powerpc/Kconfig.debug | 18 +-
 arch/powerpc/platforms/Kconfig.cputype |  2 +-
 arch/riscv/Kconfig.socs|  2 +-
 arch/sh/boards/Kconfig |  2 +-
 arch/sh/mm/Kconfig |  2 +-
 arch/um/Kconfig|  2 +-
 arch/x86/Kconfig   | 18 +-
 28 files changed, 101 insertions(+), 101 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 5f8a5d84dbbe..8d4f77bbed29 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -76,7 +76,7 @@ config JUMP_LABEL
depends on HAVE_ARCH_JUMP_LABEL
depends on CC_HAS_ASM_GOTO
help
- This option enables a transparent branch optimization that
+This option enables a transparent branch optimization that
 makes certain almost-always-true or almost-always-false branch
 conditions even cheaper to execute within the kernel.
 
@@ -84,7 +84,7 @@ config JUMP_LABEL
 scheduler functionality, networking code and KVM have such
 branches and include support for this optimization technique.
 
- If it is detected that the compiler has support for "asm goto",
+If it is detected that the compiler has support for "asm goto",
 the kernel will compile such branches with just a nop
 instruction. When the condition flag is toggled to true, the
 nop will be converted to a jump instruction to execute the
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index ef179033a7c2..30a6291355cb 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -545,7 +545,7 @@ config NR_CPUS
default "4" if !ALPHA_GENERIC && !ALPHA_MARVEL
help
  MARVEL support can handle a maximum of 32 CPUs, all the others
-  with working support have a maximum of 4 CPUs.
+ with working support have a maximum of 4 CPUs.
 
 config ARCH_DISCONTIGMEM_ENABLE
bool "Discontiguous Memory Support"
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 8bcbd0cd739b..0e5d52fbddbd 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -274,7 +274,7 @@ choice
select DEBUG_UART_8250
help
  Say Y here if you want the debug print routines to direct
-  their output to the CNS3xxx UART0.
+ their output to the CNS3xxx UART0.
 
config DEBUG_DAVINCI_DA8XX_UART1
bool "Kernel low-level debugging on DaVinci DA8XX using UART1"
@@ -828,7 +828,7 @@ choice
select DEBUG_UART_8250
help
  Say Y here if you want kernel low-level debugging support
-  on Rockchip RV1108 based platforms.
+ on Rockchip RV1108 based platforms.
 
config DEBUG_RV1108_UART1
bool "Kernel low-level debugging messages via Rockchip RV1108 
UART1"
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index f2db5fd38145..bf81dfab7f1b 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -126,10 +126,10 @@ config MACH_MICRO9S
  Contec Micro9-Slim board.
 
 config MACH_SIM_ONE
-bool "Support Simplemachines Sim.One board"
-help
-  Say 'Y' here if you want your kernel to support the
-  Simplemachines Sim.One board.
+   bool "Support Simplemachines Sim.One board"
+   help
+ Say 'Y' here if you want your kernel to support the
+ Simplemachines Sim.One board.
 
 config MACH_SNAPPER_CL15
bool "Support B

[PATCH trivial 2/3] treewide: Fix Kconfig indentation

2019-09-23 Thread Krzysztof Kozlowski
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
$ sed -e 's/^/\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski 
---
 certs/Kconfig  | 14 ++---
 init/Kconfig   | 28 +-
 kernel/trace/Kconfig   |  8 
 lib/Kconfig|  2 +-
 lib/Kconfig.debug  | 36 +-
 lib/Kconfig.kgdb   |  8 
 mm/Kconfig | 28 +-
 samples/Kconfig|  2 +-
 security/apparmor/Kconfig  |  2 +-
 security/integrity/Kconfig | 24 +++
 security/integrity/ima/Kconfig | 12 ++--
 security/safesetid/Kconfig | 24 +++
 12 files changed, 94 insertions(+), 94 deletions(-)

diff --git a/certs/Kconfig b/certs/Kconfig
index c94e93d8bccf..0358c66d3d7c 100644
--- a/certs/Kconfig
+++ b/certs/Kconfig
@@ -6,14 +6,14 @@ config MODULE_SIG_KEY
default "certs/signing_key.pem"
depends on MODULE_SIG
help
- Provide the file name of a private key/certificate in PEM format,
- or a PKCS#11 URI according to RFC7512. The file should contain, or
- the URI should identify, both the certificate and its corresponding
- private key.
+Provide the file name of a private key/certificate in PEM format,
+or a PKCS#11 URI according to RFC7512. The file should contain, or
+the URI should identify, both the certificate and its corresponding
+private key.
 
- If this option is unchanged from its default "certs/signing_key.pem",
- then the kernel will automatically generate the private key and
- certificate as described in 
Documentation/admin-guide/module-signing.rst
+If this option is unchanged from its default "certs/signing_key.pem",
+then the kernel will automatically generate the private key and
+certificate as described in 
Documentation/admin-guide/module-signing.rst
 
 config SYSTEM_TRUSTED_KEYRING
bool "Provide system-wide ring of trusted keys"
diff --git a/init/Kconfig b/init/Kconfig
index 6d4db887f696..f59c854839d2 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -169,10 +169,10 @@ config BUILD_SALT
string "Build ID Salt"
default ""
help
-  The build ID is used to link binaries and their debug info. Setting
-  this option will use the value in the calculation of the build id.
-  This is mostly useful for distributions which want to ensure the
-  build is unique between builds. It's safe to leave the default.
+ The build ID is used to link binaries and their debug info. Setting
+ this option will use the value in the calculation of the build id.
+ This is mostly useful for distributions which want to ensure the
+ build is unique between builds. It's safe to leave the default.
 
 config HAVE_KERNEL_GZIP
bool
@@ -1327,9 +1327,9 @@ menuconfig EXPERT
select DEBUG_KERNEL
help
  This option allows certain base kernel options and settings
-  to be disabled or tweaked. This is for specialized
-  environments which can tolerate a "non-standard" kernel.
-  Only use this if you really know what you are doing.
+ to be disabled or tweaked. This is for specialized
+ environments which can tolerate a "non-standard" kernel.
+ Only use this if you really know what you are doing.
 
 config UID16
bool "Enable 16-bit UID system calls" if EXPERT
@@ -1439,11 +1439,11 @@ config BUG
bool "BUG() support" if EXPERT
default y
help
-  Disabling this option eliminates support for BUG and WARN, reducing
-  the size of your kernel image and potentially quietly ignoring
-  numerous fatal conditions. You should only consider disabling this
-  option for embedded systems with no facilities for reporting errors.
-  Just say Y.
+ Disabling this option eliminates support for BUG and WARN, reducing
+ the size of your kernel image and potentially quietly ignoring
+ numerous fatal conditions. You should only consider disabling this
+ option for embedded systems with no facilities for reporting errors.
+ Just say Y.
 
 config ELF_CORE
depends on COREDUMP
@@ -1459,8 +1459,8 @@ config PCSPKR_PLATFORM
select I8253_LOCK
default y
help
-  This option allows to disable the internal PC-Speaker
-  support, saving some memory.
+ This option allows to disable the internal PC-Speaker
+ support, saving some memory.
 
 config BASE_FULL
default y
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index e0

[PATCH trivial 1/3] treewide: drivers: Fix Kconfig indentation

2019-09-23 Thread Krzysztof Kozlowski
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
$ sed -e 's/^/\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/acpi/Kconfig  |  8 +-
 drivers/ata/Kconfig   | 12 +--
 drivers/auxdisplay/Kconfig| 14 +--
 drivers/base/firmware_loader/Kconfig  |  2 +-
 drivers/block/Kconfig | 28 +++---
 drivers/block/mtip32xx/Kconfig|  2 +-
 drivers/char/Kconfig  |  6 +-
 drivers/char/agp/Kconfig  |  2 +-
 drivers/char/hw_random/Kconfig| 10 +-
 drivers/char/ipmi/Kconfig | 20 ++--
 drivers/clk/Kconfig   |  2 +-
 drivers/clk/mediatek/Kconfig  | 10 +-
 drivers/clk/versatile/Kconfig |  2 +-
 drivers/clocksource/Kconfig   | 20 ++--
 drivers/cpufreq/Kconfig.x86   |  6 +-
 drivers/cpuidle/Kconfig   |  8 +-
 drivers/cpuidle/Kconfig.arm   | 16 ++--
 drivers/crypto/Kconfig|  4 +-
 drivers/crypto/caam/Kconfig   | 14 +--
 drivers/crypto/chelsio/Kconfig| 30 +++---
 drivers/crypto/stm32/Kconfig  |  6 +-
 drivers/crypto/ux500/Kconfig  | 16 ++--
 drivers/devfreq/Kconfig   |  6 +-
 drivers/dma/Kconfig   | 46 -
 drivers/edac/Kconfig  |  2 +-
 drivers/firmware/Kconfig  |  4 +-
 drivers/firmware/efi/Kconfig  |  2 +-
 drivers/hid/Kconfig   |  2 +-
 drivers/hwmon/Kconfig | 14 +--
 drivers/i2c/busses/Kconfig| 16 ++--
 drivers/i2c/muxes/Kconfig | 18 ++--
 drivers/iio/gyro/Kconfig  |  8 +-
 drivers/infiniband/hw/bnxt_re/Kconfig | 12 +--
 drivers/input/keyboard/Kconfig|  8 +-
 drivers/input/mouse/Kconfig   |  6 +-
 drivers/input/tablet/Kconfig  | 20 ++--
 drivers/input/touchscreen/Kconfig |  2 +-
 drivers/iommu/Kconfig |  2 +-
 drivers/irqchip/Kconfig   | 10 +-
 drivers/isdn/hardware/mISDN/Kconfig   |  2 +-
 drivers/macintosh/Kconfig |  6 +-
 drivers/md/Kconfig| 54 +--
 drivers/media/Kconfig |  6 +-
 drivers/media/radio/si470x/Kconfig|  4 +-
 drivers/memstick/core/Kconfig | 18 ++--
 drivers/memstick/host/Kconfig |  4 +-
 drivers/misc/Kconfig  | 16 ++--
 drivers/mtd/nand/onenand/Kconfig  | 12 +--
 drivers/nfc/nfcmrvl/Kconfig   |  2 +-
 drivers/pci/Kconfig   | 24 ++---
 drivers/pci/controller/dwc/Kconfig|  6 +-
 drivers/pci/hotplug/Kconfig   |  2 +-
 drivers/perf/Kconfig  | 14 +--
 drivers/phy/hisilicon/Kconfig |  6 +-
 drivers/pinctrl/Kconfig   | 18 ++--
 drivers/pinctrl/freescale/Kconfig | 12 +--
 drivers/pinctrl/qcom/Kconfig  | 34 +++
 drivers/platform/chrome/Kconfig   |  6 +-
 drivers/platform/mellanox/Kconfig |  4 +-
 drivers/platform/x86/Kconfig  | 48 +-
 drivers/power/avs/Kconfig | 12 +--
 drivers/power/supply/Kconfig  | 30 +++---
 drivers/regulator/Kconfig |  8 +-
 drivers/rpmsg/Kconfig |  2 +-
 drivers/rtc/Kconfig   |  6 +-
 drivers/scsi/Kconfig  | 22 ++---
 drivers/scsi/aic7xxx/Kconfig.aic7xxx  | 14 +--
 drivers/scsi/pcmcia/Kconfig   |  2 +-
 drivers/scsi/qedf/Kconfig |  4 +-
 drivers/scsi/smartpqi/Kconfig |  8 +-
 drivers/soc/fsl/Kconfig   |  8 +-
 drivers/soc/qcom/Kconfig  | 22 ++---
 drivers/soc/rockchip/Kconfig  | 18 ++--
 drivers/spi/Kconfig   | 18 ++--
 drivers/staging/fbtft/Kconfig | 12 +--
 drivers/staging/fwserial/Kconfig  |  6 +-
 drivers/staging/most/Kconfig  |  8 +-
 drivers/staging/nvec/Kconfig  | 10 +-
 drivers/staging/pi433/Kconfig | 24 ++---
 drivers/staging/uwb/Kconfig   | 42 
 .../vc04_services/bcm2835-audio/Kconfig   | 12 +--
 drivers/staging/wusbcore/Kconfig  |  2 +-
 drivers/tty/Kconfig   | 26 ++---
 drivers/tty/hvc/Kconfig   |  4 +-
 drivers/tty/serial/8250/Kconfig   |  2 +-
 drivers/tty/serial/Kconfig

[PATCH trivial 3/3] treewide: arch: Fix Kconfig indentation

2019-09-23 Thread Krzysztof Kozlowski
Adjust indentation from spaces to tab (+optional two spaces) as in
coding style with command like:
$ sed -e 's/^/\t/' -i */Kconfig

Signed-off-by: Krzysztof Kozlowski 
---
 arch/Kconfig   |  4 ++--
 arch/alpha/Kconfig |  2 +-
 arch/arm/Kconfig.debug |  4 ++--
 arch/arm/mach-ep93xx/Kconfig   |  8 
 arch/arm/mach-hisi/Kconfig |  2 +-
 arch/arm/mach-ixp4xx/Kconfig   | 16 
 arch/arm/mach-mmp/Kconfig  |  2 +-
 arch/arm/mach-omap1/Kconfig| 14 +++---
 arch/arm/mach-prima2/Kconfig   |  6 +++---
 arch/arm/mach-s3c24xx/Kconfig  |  4 ++--
 arch/arm/mach-s3c64xx/Kconfig  |  6 +++---
 arch/arm/plat-samsung/Kconfig  |  2 +-
 arch/arm64/Kconfig |  6 +++---
 arch/arm64/Kconfig.debug   |  2 +-
 arch/h8300/Kconfig |  4 ++--
 arch/h8300/Kconfig.cpu |  4 ++--
 arch/m68k/Kconfig.bus  |  2 +-
 arch/m68k/Kconfig.debug| 16 
 arch/m68k/Kconfig.machine  |  8 
 arch/nds32/Kconfig.cpu | 18 +-
 arch/openrisc/Kconfig  | 26 +-
 arch/powerpc/Kconfig.debug | 18 +-
 arch/powerpc/platforms/Kconfig.cputype |  2 +-
 arch/riscv/Kconfig.socs|  2 +-
 arch/sh/boards/Kconfig |  2 +-
 arch/sh/mm/Kconfig |  2 +-
 arch/um/Kconfig|  2 +-
 arch/x86/Kconfig   | 18 +-
 28 files changed, 101 insertions(+), 101 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 5f8a5d84dbbe..8d4f77bbed29 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -76,7 +76,7 @@ config JUMP_LABEL
depends on HAVE_ARCH_JUMP_LABEL
depends on CC_HAS_ASM_GOTO
help
- This option enables a transparent branch optimization that
+This option enables a transparent branch optimization that
 makes certain almost-always-true or almost-always-false branch
 conditions even cheaper to execute within the kernel.
 
@@ -84,7 +84,7 @@ config JUMP_LABEL
 scheduler functionality, networking code and KVM have such
 branches and include support for this optimization technique.
 
- If it is detected that the compiler has support for "asm goto",
+If it is detected that the compiler has support for "asm goto",
 the kernel will compile such branches with just a nop
 instruction. When the condition flag is toggled to true, the
 nop will be converted to a jump instruction to execute the
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index ef179033a7c2..30a6291355cb 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -545,7 +545,7 @@ config NR_CPUS
default "4" if !ALPHA_GENERIC && !ALPHA_MARVEL
help
  MARVEL support can handle a maximum of 32 CPUs, all the others
-  with working support have a maximum of 4 CPUs.
+ with working support have a maximum of 4 CPUs.
 
 config ARCH_DISCONTIGMEM_ENABLE
bool "Discontiguous Memory Support"
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 8bcbd0cd739b..0e5d52fbddbd 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -274,7 +274,7 @@ choice
select DEBUG_UART_8250
help
  Say Y here if you want the debug print routines to direct
-  their output to the CNS3xxx UART0.
+ their output to the CNS3xxx UART0.
 
config DEBUG_DAVINCI_DA8XX_UART1
bool "Kernel low-level debugging on DaVinci DA8XX using UART1"
@@ -828,7 +828,7 @@ choice
select DEBUG_UART_8250
help
  Say Y here if you want kernel low-level debugging support
-  on Rockchip RV1108 based platforms.
+ on Rockchip RV1108 based platforms.
 
config DEBUG_RV1108_UART1
bool "Kernel low-level debugging messages via Rockchip RV1108 
UART1"
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index f2db5fd38145..bf81dfab7f1b 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -126,10 +126,10 @@ config MACH_MICRO9S
  Contec Micro9-Slim board.
 
 config MACH_SIM_ONE
-bool "Support Simplemachines Sim.One board"
-help
-  Say 'Y' here if you want your kernel to support the
-  Simplemachines Sim.One board.
+   bool "Support Simplemachines Sim.One board"
+   help
+ Say 'Y' here if you want your kernel to support the
+ Simplemachines Sim.One board.
 
 config MACH_SNAPPER_CL15
bool "Support B

Re: [PATCH 0/6] lib/crc32: treewide: Use existing define with polynomial

2018-07-18 Thread Krzysztof Kozlowski
On 18 July 2018 at 02:12, Eric Biggers  wrote:
> Hi Krzysztof,
>
> On Tue, Jul 17, 2018 at 06:05:35PM +0200, Krzysztof Kozlowski wrote:
>> Hi,
>>
>> Kernel defines same polynomial for CRC-32 in few places.
>> This is unnecessary duplication of the same value. Also this might
>> be error-prone for future code - every driver will define the
>> polynomial again.
>>
>> This is an attempt to unify definition of polynomial.  Few obvious
>> hard-coded locations are fixed with define.
>>
>> All series depend on each 1/6 and 2/6.
>>
>> This could be merged in two different merge windows (1st lib/crc and then
>> the rest) or taken through one tree.
>>
>> It would be nice to get some testing. Only generic lib/crc, bunzip, xz_crc32
>> and Freescale's Ethernet driver were tested on HW.  Rest got just different
>> builds.
>>
>> Best regards,
>> Krzysztof
>>
>> Krzysztof Kozlowski (6):
>>   lib/crc: Move polynomial definition to separate header
>>   lib/crc: Use consistent naming for CRC-32 polynomials
>>   crypto: stm32_crc32 - Use existing define with polynomial
>>   net: ethernet: Use existing define with polynomial
>>   staging: rtl: Use existing define with polynomial
>>   lib: Use existing define with polynomial
>>
>>  drivers/crypto/stm32/stm32_crc32.c   | 11 ---
>>  drivers/net/ethernet/amd/xgbe/xgbe-dev.c |  4 ++--
>>  drivers/net/ethernet/apple/bmac.c|  8 ++--
>>  drivers/net/ethernet/broadcom/tg3.c  |  3 ++-
>>  drivers/net/ethernet/freescale/fec_main.c|  4 ++--
>>  drivers/net/ethernet/freescale/fs_enet/fec.h |  3 ---
>>  drivers/net/ethernet/freescale/fs_enet/mac-fec.c |  3 ++-
>>  drivers/net/ethernet/micrel/ks8851_mll.c |  3 ++-
>>  drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c|  4 ++--
>>  drivers/staging/rtl8712/rtl871x_security.c   |  5 ++---
>>  drivers/staging/rtl8723bs/core/rtw_security.c|  5 ++---
>>  include/linux/crc32poly.h| 20 
>>  lib/crc32.c  | 11 ++-
>>  lib/crc32defs.h  | 14 --
>>  lib/decompress_bunzip2.c |  3 ++-
>>  lib/gen_crc32table.c |  5 +++--
>>  lib/xz/xz_crc32.c|  3 ++-
>>  17 files changed, 55 insertions(+), 54 deletions(-)
>>  create mode 100644 include/linux/crc32poly.h
>>
>
> Did you check whether any of these users can be converted to use the CRC
> implementations in lib/, so they wouldn't need the polynomial definition
> themselves?

I did not check but that's interesting point... The Ethernet drivers
(xgbe, tg3, fec, ks8851, dwc-xlgmac) look like could be converted to
generic implementation. The apple/bmac looks weird. The rtl WiFi
drivers in long term can be converted to use generic lib80211 for
encryption (see commit 0d4876f4e977 ("staging:r8188eu: Use lib80211 to
encrypt (TKIP) tx frames")) but that is much bigger task. The
remaining use the polynomials in different aspect:
1. XZ and BUNZIP use it to create CRC tables - probably generic
gen_crc32table.c could be used,
2. stm32_crc32.c uses it to initialize HW CRC accelerator.

I can work on Freescale FEC, xz and bunzip code because these I can
test but I would prefer to do it as follow up.

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


[PATCH 0/6] lib/crc32: treewide: Use existing define with polynomial

2018-07-17 Thread Krzysztof Kozlowski
Hi,

Kernel defines same polynomial for CRC-32 in few places.
This is unnecessary duplication of the same value. Also this might
be error-prone for future code - every driver will define the
polynomial again.

This is an attempt to unify definition of polynomial.  Few obvious
hard-coded locations are fixed with define.

All series depend on each 1/6 and 2/6.

This could be merged in two different merge windows (1st lib/crc and then
the rest) or taken through one tree.

It would be nice to get some testing. Only generic lib/crc, bunzip, xz_crc32
and Freescale's Ethernet driver were tested on HW.  Rest got just different
builds.

Best regards,
Krzysztof




Krzysztof Kozlowski (6):
  lib/crc: Move polynomial definition to separate header
  lib/crc: Use consistent naming for CRC-32 polynomials
  crypto: stm32_crc32 - Use existing define with polynomial
  net: ethernet: Use existing define with polynomial
  staging: rtl: Use existing define with polynomial
  lib: Use existing define with polynomial

 drivers/crypto/stm32/stm32_crc32.c   | 11 ---
 drivers/net/ethernet/amd/xgbe/xgbe-dev.c |  4 ++--
 drivers/net/ethernet/apple/bmac.c|  8 ++--
 drivers/net/ethernet/broadcom/tg3.c  |  3 ++-
 drivers/net/ethernet/freescale/fec_main.c|  4 ++--
 drivers/net/ethernet/freescale/fs_enet/fec.h |  3 ---
 drivers/net/ethernet/freescale/fs_enet/mac-fec.c |  3 ++-
 drivers/net/ethernet/micrel/ks8851_mll.c |  3 ++-
 drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c|  4 ++--
 drivers/staging/rtl8712/rtl871x_security.c   |  5 ++---
 drivers/staging/rtl8723bs/core/rtw_security.c|  5 ++---
 include/linux/crc32poly.h| 20 
 lib/crc32.c  | 11 ++-
 lib/crc32defs.h  | 14 --
 lib/decompress_bunzip2.c |  3 ++-
 lib/gen_crc32table.c |  5 +++--
 lib/xz/xz_crc32.c|  3 ++-
 17 files changed, 55 insertions(+), 54 deletions(-)
 create mode 100644 include/linux/crc32poly.h

-- 
2.14.1

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


[PATCH 3/6] crypto: stm32_crc32 - Use existing define with polynomial

2018-07-17 Thread Krzysztof Kozlowski
Do not define again the polynomial but use header with existing define.

Signed-off-by: Krzysztof Kozlowski 
---
Not tested

It would be nice to get some testing. Only generic lib/crc, bunzip, xz_crc32
and Freescale's Ethernet driver were tested on HW.  Rest got just different
builds.


 drivers/crypto/stm32/stm32_crc32.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/crypto/stm32/stm32_crc32.c 
b/drivers/crypto/stm32/stm32_crc32.c
index 040bed5e7725..29d2095d9dfd 100644
--- a/drivers/crypto/stm32/stm32_crc32.c
+++ b/drivers/crypto/stm32/stm32_crc32.c
@@ -6,6 +6,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -30,10 +31,6 @@
 #define CRC_CR_REVERSE  (BIT(7) | BIT(6) | BIT(5))
 #define CRC_INIT_DEFAULT0x
 
-/* Polynomial reversed */
-#define POLY_CRC32  0xEDB88320
-#define POLY_CRC32C 0x82F63B78
-
 #define CRC_AUTOSUSPEND_DELAY  50
 
 struct stm32_crc {
@@ -70,7 +67,7 @@ static int stm32_crc32_cra_init(struct crypto_tfm *tfm)
struct stm32_crc_ctx *mctx = crypto_tfm_ctx(tfm);
 
mctx->key = CRC_INIT_DEFAULT;
-   mctx->poly = POLY_CRC32;
+   mctx->poly = CRC32_POLY_LE;
return 0;
 }
 
@@ -79,7 +76,7 @@ static int stm32_crc32c_cra_init(struct crypto_tfm *tfm)
struct stm32_crc_ctx *mctx = crypto_tfm_ctx(tfm);
 
mctx->key = CRC_INIT_DEFAULT;
-   mctx->poly = POLY_CRC32C;
+   mctx->poly = CRC32C_POLY_LE;
return 0;
 }
 
@@ -188,7 +185,7 @@ static int stm32_crc_final(struct shash_desc *desc, u8 *out)
struct stm32_crc_ctx *mctx = crypto_shash_ctx(desc->tfm);
 
/* Send computed CRC */
-   put_unaligned_le32(mctx->poly == POLY_CRC32C ?
+   put_unaligned_le32(mctx->poly == CRC32C_POLY_LE ?
   ~ctx->partial : ctx->partial, out);
 
return 0;
-- 
2.14.1

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


[PATCH 1/6] lib/crc: Move polynomial definition to separate header

2018-07-17 Thread Krzysztof Kozlowski
Allow other drivers and parts of kernel to use the same define for
CRC32 polynomial, instead of duplicating it in many places.  This code
does not bring any functional changes, except moving existing code.

Signed-off-by: Krzysztof Kozlowski 
---
 include/linux/crc32poly.h | 20 
 lib/crc32.c   |  1 +
 lib/crc32defs.h   | 14 --
 lib/gen_crc32table.c  |  1 +
 4 files changed, 22 insertions(+), 14 deletions(-)
 create mode 100644 include/linux/crc32poly.h

diff --git a/include/linux/crc32poly.h b/include/linux/crc32poly.h
new file mode 100644
index ..7ad5aa92d3c7
--- /dev/null
+++ b/include/linux/crc32poly.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_CRC32_POLY_H
+#define _LINUX_CRC32_POLY_H
+
+/*
+ * There are multiple 16-bit CRC polynomials in common use, but this is
+ * *the* standard CRC-32 polynomial, first popularized by Ethernet.
+ * x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x^1+x^0
+ */
+#define CRCPOLY_LE 0xedb88320
+#define CRCPOLY_BE 0x04c11db7
+
+/*
+ * This is the CRC32c polynomial, as outlined by Castagnoli.
+ * x^32+x^28+x^27+x^26+x^25+x^23+x^22+x^20+x^19+x^18+x^14+x^13+x^11+x^10+x^9+
+ * x^8+x^6+x^0
+ */
+#define CRC32C_POLY_LE 0x82F63B78
+
+#endif /* _LINUX_CRC32_POLY_H */
diff --git a/lib/crc32.c b/lib/crc32.c
index 2ef20fe84b69..341c54cb4edf 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -27,6 +27,7 @@
 /* see: Documentation/crc32.txt for a description of algorithms */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/lib/crc32defs.h b/lib/crc32defs.h
index cb275a28a750..0c8fb5923e7e 100644
--- a/lib/crc32defs.h
+++ b/lib/crc32defs.h
@@ -1,18 +1,4 @@
 /* SPDX-License-Identifier: GPL-2.0 */
-/*
- * There are multiple 16-bit CRC polynomials in common use, but this is
- * *the* standard CRC-32 polynomial, first popularized by Ethernet.
- * x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x^1+x^0
- */
-#define CRCPOLY_LE 0xedb88320
-#define CRCPOLY_BE 0x04c11db7
-
-/*
- * This is the CRC32c polynomial, as outlined by Castagnoli.
- * x^32+x^28+x^27+x^26+x^25+x^23+x^22+x^20+x^19+x^18+x^14+x^13+x^11+x^10+x^9+
- * x^8+x^6+x^0
- */
-#define CRC32C_POLY_LE 0x82F63B78
 
 /* Try to choose an implementation variant via Kconfig */
 #ifdef CONFIG_CRC32_SLICEBY8
diff --git a/lib/gen_crc32table.c b/lib/gen_crc32table.c
index 8f26660ea10a..34c3bc826f45 100644
--- a/lib/gen_crc32table.c
+++ b/lib/gen_crc32table.c
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include 
+#include "../include/linux/crc32poly.h"
 #include "../include/generated/autoconf.h"
 #include "crc32defs.h"
 #include 
-- 
2.14.1

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


[PATCH 4/6] net: ethernet: Use existing define with polynomial

2018-07-17 Thread Krzysztof Kozlowski
Do not define again the polynomial but use header with existing define.

Signed-off-by: Krzysztof Kozlowski 
---
Only Freescale FEC was tested

It would be nice to get some testing. Only generic lib/crc, bunzip, xz_crc32
and Freescale's Ethernet driver were tested on HW.  Rest got just different
builds.

 drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 4 ++--
 drivers/net/ethernet/apple/bmac.c| 8 ++--
 drivers/net/ethernet/broadcom/tg3.c  | 3 ++-
 drivers/net/ethernet/freescale/fec_main.c| 4 ++--
 drivers/net/ethernet/freescale/fs_enet/fec.h | 3 ---
 drivers/net/ethernet/freescale/fs_enet/mac-fec.c | 3 ++-
 drivers/net/ethernet/micrel/ks8851_mll.c | 3 ++-
 drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c| 4 ++--
 8 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c 
b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
index e107e180e2c8..1e929a1e4ca7 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
@@ -119,6 +119,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "xgbe.h"
 #include "xgbe-common.h"
@@ -887,7 +888,6 @@ static int xgbe_disable_rx_vlan_filtering(struct 
xgbe_prv_data *pdata)
 
 static u32 xgbe_vid_crc32_le(__le16 vid_le)
 {
-   u32 poly = 0xedb88320;  /* CRCPOLY_LE */
u32 crc = ~0;
u32 temp = 0;
unsigned char *data = (unsigned char *)_le;
@@ -904,7 +904,7 @@ static u32 xgbe_vid_crc32_le(__le16 vid_le)
data_byte >>= 1;
 
if (temp)
-   crc ^= poly;
+   crc ^= CRC32_POLY_LE;
}
 
return crc;
diff --git a/drivers/net/ethernet/apple/bmac.c 
b/drivers/net/ethernet/apple/bmac.c
index 5a655d289dd5..024998d6d8c6 100644
--- a/drivers/net/ethernet/apple/bmac.c
+++ b/drivers/net/ethernet/apple/bmac.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -37,11 +38,6 @@
 #define trunc_page(x)  ((void *)(((unsigned long)(x)) & ~((unsigned 
long)(PAGE_SIZE - 1
 #define round_page(x)  trunc_page(((unsigned long)(x)) + ((unsigned 
long)(PAGE_SIZE - 1)))
 
-/*
- * CRC polynomial - used in working out multicast filter bits.
- */
-#define ENET_CRCPOLY 0x04c11db7
-
 /* switch to use multicast code lifted from sunhme driver */
 #define SUNHME_MULTICAST
 
@@ -838,7 +834,7 @@ crc416(unsigned int curval, unsigned short nxtval)
next = next >> 1;
 
/* do the XOR */
-   if (high_crc_set ^ low_data_set) cur = cur ^ ENET_CRCPOLY;
+   if (high_crc_set ^ low_data_set) cur = cur ^ CRC32_POLY_BE;
}
return cur;
 }
diff --git a/drivers/net/ethernet/broadcom/tg3.c 
b/drivers/net/ethernet/broadcom/tg3.c
index 0a796d5ec893..3d526d99ac59 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -50,6 +50,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -9709,7 +9710,7 @@ static inline u32 calc_crc(unsigned char *buf, int len)
reg >>= 1;
 
if (tmp)
-   reg ^= 0xedb88320;
+   reg ^= CRC32_POLY_LE;
}
}
 
diff --git a/drivers/net/ethernet/freescale/fec_main.c 
b/drivers/net/ethernet/freescale/fec_main.c
index c729665107f5..a7cb378ef881 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -48,6 +48,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2949,7 +2950,6 @@ fec_enet_close(struct net_device *ndev)
  */
 
 #define FEC_HASH_BITS  6   /* #bits in hash */
-#define CRC32_POLY 0xEDB88320
 
 static void set_multicast_list(struct net_device *ndev)
 {
@@ -2989,7 +2989,7 @@ static void set_multicast_list(struct net_device *ndev)
data = ha->addr[i];
for (bit = 0; bit < 8; bit++, data >>= 1) {
crc = (crc >> 1) ^
-   (((crc ^ data) & 1) ? CRC32_POLY : 0);
+   (((crc ^ data) & 1) ? CRC32_POLY_LE : 0);
}
}
 
diff --git a/drivers/net/ethernet/freescale/fs_enet/fec.h 
b/drivers/net/ethernet/freescale/fs_enet/fec.h
index 7832db71dcb9..1dbee5d898b3 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fec.h
+++ b/drivers/net/ethernet/freescale/fs_enet/fec.h
@@ -2,9 +2,6 @@
 #ifndef FS_ENET_FEC_H
 #define FS_ENET_FEC_H
 
-/* CRC polynomium used by the FEC for the multicast group filtering */
-#define FEC_CRC_POLY   0x04C11DB7
-
 #define FEC_MAX_MULTICAST_ADDRS64
 
 /* Interrupt events/masks.
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c 
b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c
index 1fc27c97e3b2..

[PATCH 2/6] lib/crc: Use consistent naming for CRC-32 polynomials

2018-07-17 Thread Krzysztof Kozlowski
Header was defining CRCPOLY_LE/BE and CRC32C_POLY_LE but in fact all of
them are CRC-32 polynomials so use consistent naming.

Signed-off-by: Krzysztof Kozlowski 
---
 include/linux/crc32poly.h |  4 ++--
 lib/crc32.c   | 10 +-
 lib/gen_crc32table.c  |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/linux/crc32poly.h b/include/linux/crc32poly.h
index 7ad5aa92d3c7..62c4b7790a28 100644
--- a/include/linux/crc32poly.h
+++ b/include/linux/crc32poly.h
@@ -7,8 +7,8 @@
  * *the* standard CRC-32 polynomial, first popularized by Ethernet.
  * x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x^1+x^0
  */
-#define CRCPOLY_LE 0xedb88320
-#define CRCPOLY_BE 0x04c11db7
+#define CRC32_POLY_LE 0xedb88320
+#define CRC32_POLY_BE 0x04c11db7
 
 /*
  * This is the CRC32c polynomial, as outlined by Castagnoli.
diff --git a/lib/crc32.c b/lib/crc32.c
index 341c54cb4edf..a6c9afafc8c8 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -185,7 +185,7 @@ static inline u32 __pure crc32_le_generic(u32 crc, unsigned 
char const *p,
 #if CRC_LE_BITS == 1
 u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len)
 {
-   return crc32_le_generic(crc, p, len, NULL, CRCPOLY_LE);
+   return crc32_le_generic(crc, p, len, NULL, CRC32_POLY_LE);
 }
 u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len)
 {
@@ -195,7 +195,7 @@ u32 __pure __crc32c_le(u32 crc, unsigned char const *p, 
size_t len)
 u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len)
 {
return crc32_le_generic(crc, p, len,
-   (const u32 (*)[256])crc32table_le, CRCPOLY_LE);
+   (const u32 (*)[256])crc32table_le, CRC32_POLY_LE);
 }
 u32 __pure __crc32c_le(u32 crc, unsigned char const *p, size_t len)
 {
@@ -269,7 +269,7 @@ static u32 __attribute_const__ crc32_generic_shift(u32 crc, 
size_t len,
 
 u32 __attribute_const__ crc32_le_shift(u32 crc, size_t len)
 {
-   return crc32_generic_shift(crc, len, CRCPOLY_LE);
+   return crc32_generic_shift(crc, len, CRC32_POLY_LE);
 }
 
 u32 __attribute_const__ __crc32c_le_shift(u32 crc, size_t len)
@@ -331,13 +331,13 @@ static inline u32 __pure crc32_be_generic(u32 crc, 
unsigned char const *p,
 #if CRC_LE_BITS == 1
 u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len)
 {
-   return crc32_be_generic(crc, p, len, NULL, CRCPOLY_BE);
+   return crc32_be_generic(crc, p, len, NULL, CRC32_POLY_BE);
 }
 #else
 u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len)
 {
return crc32_be_generic(crc, p, len,
-   (const u32 (*)[256])crc32table_be, CRCPOLY_BE);
+   (const u32 (*)[256])crc32table_be, CRC32_POLY_BE);
 }
 #endif
 EXPORT_SYMBOL(crc32_be);
diff --git a/lib/gen_crc32table.c b/lib/gen_crc32table.c
index 34c3bc826f45..f755b997b967 100644
--- a/lib/gen_crc32table.c
+++ b/lib/gen_crc32table.c
@@ -58,7 +58,7 @@ static void crc32init_le_generic(const uint32_t polynomial,
 
 static void crc32init_le(void)
 {
-   crc32init_le_generic(CRCPOLY_LE, crc32table_le);
+   crc32init_le_generic(CRC32_POLY_LE, crc32table_le);
 }
 
 static void crc32cinit_le(void)
@@ -77,7 +77,7 @@ static void crc32init_be(void)
crc32table_be[0][0] = 0;
 
for (i = 1; i < BE_TABLE_SIZE; i <<= 1) {
-   crc = (crc << 1) ^ ((crc & 0x8000) ? CRCPOLY_BE : 0);
+   crc = (crc << 1) ^ ((crc & 0x8000) ? CRC32_POLY_BE : 0);
for (j = 0; j < i; j++)
crc32table_be[0][i + j] = crc ^ crc32table_be[0][j];
}
-- 
2.14.1

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


[PATCH 6/6] lib: Use existing define with polynomial

2018-07-17 Thread Krzysztof Kozlowski
Do not define again the polynomial but use header with existing define.

Signed-off-by: Krzysztof Kozlowski 
---
 lib/decompress_bunzip2.c | 3 ++-
 lib/xz/xz_crc32.c| 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c
index 0234361b24b8..7c4932eed748 100644
--- a/lib/decompress_bunzip2.c
+++ b/lib/decompress_bunzip2.c
@@ -51,6 +51,7 @@
 #endif /* STATIC */
 
 #include 
+#include 
 
 #ifndef INT_MAX
 #define INT_MAX 0x7fff
@@ -654,7 +655,7 @@ static int INIT start_bunzip(struct bunzip_data **bdp, void 
*inbuf, long len,
for (i = 0; i < 256; i++) {
c = i << 24;
for (j = 8; j; j--)
-   c = c&0x8000 ? (c << 1)^0x04c11db7 : (c << 1);
+   c = c&0x8000 ? (c << 1)^(CRC32_POLY_BE) : (c << 1);
bd->crc32Table[i] = c;
}
 
diff --git a/lib/xz/xz_crc32.c b/lib/xz/xz_crc32.c
index 34532d14fd4c..25a5d87e2e4c 100644
--- a/lib/xz/xz_crc32.c
+++ b/lib/xz/xz_crc32.c
@@ -15,6 +15,7 @@
  * but they are bigger and use more memory for the lookup table.
  */
 
+#include 
 #include "xz_private.h"
 
 /*
@@ -29,7 +30,7 @@ STATIC_RW_DATA uint32_t xz_crc32_table[256];
 
 XZ_EXTERN void xz_crc32_init(void)
 {
-   const uint32_t poly = 0xEDB88320;
+   const uint32_t poly = CRC32_POLY_LE;
 
uint32_t i;
uint32_t j;
-- 
2.14.1

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


[PATCH 5/6] staging: rtl: Use existing define with polynomial

2018-07-17 Thread Krzysztof Kozlowski
Do not define again the polynomial but use header with existing define.

Signed-off-by: Krzysztof Kozlowski 
---
Not tested

It would be nice to get some testing. Only generic lib/crc, bunzip, xz_crc32
and Freescale's Ethernet driver were tested on HW.  Rest got just different
builds.

 drivers/staging/rtl8712/rtl871x_security.c| 5 ++---
 drivers/staging/rtl8723bs/core/rtw_security.c | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_security.c 
b/drivers/staging/rtl8712/rtl871x_security.c
index 7bc74d7d8a3a..1075eacdb441 100644
--- a/drivers/staging/rtl8712/rtl871x_security.c
+++ b/drivers/staging/rtl8712/rtl871x_security.c
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "osdep_service.h"
@@ -49,8 +50,6 @@
 
 /* =WEP related= */
 
-#define CRC32_POLY 0x04c11db7
-
 struct arc4context {
u32 x;
u32 y;
@@ -135,7 +134,7 @@ static void crc32_init(void)
for (i = 0; i < 256; ++i) {
k = crc32_reverseBit((u8)i);
for (c = ((u32)k) << 24, j = 8; j > 0; --j)
-   c = c & 0x8000 ? (c << 1) ^ CRC32_POLY : (c << 1);
+   c = c & 0x8000 ? (c << 1) ^ CRC32_POLY_BE : (c << 
1);
p1 = (u8 *)_table[i];
p1[0] = crc32_reverseBit(p[3]);
p1[1] = crc32_reverseBit(p[2]);
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c 
b/drivers/staging/rtl8723bs/core/rtw_security.c
index 612277a555d2..6c8ac9e86c9f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -6,6 +6,7 @@
  
**/
 #define  _RTW_SECURITY_C_
 
+#include 
 #include 
 #include 
 
@@ -87,8 +88,6 @@ const char *security_type_str(u8 value)
 
 /* WEP related = */
 
-#define CRC32_POLY 0x04c11db7
-
 struct arc4context {
u32 x;
u32 y;
@@ -178,7 +177,7 @@ static void crc32_init(void)
for (i = 0; i < 256; ++i) {
k = crc32_reverseBit((u8)i);
for (c = ((u32)k) << 24, j = 8; j > 0; --j) {
-   c = c & 0x8000 ? (c << 1) ^ CRC32_POLY : (c 
<< 1);
+   c = c & 0x8000 ? (c << 1) ^ CRC32_POLY_BE : 
(c << 1);
}
p1 = (u8 *)_table[i];
 
-- 
2.14.1

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


Re: [PATCH] mtd: nand: Rename nand.h into rawnand.h

2017-08-07 Thread Krzysztof Kozlowski
On Fri, Aug 04, 2017 at 05:29:10PM +0200, Boris Brezillon wrote:
> We are planning to share more code between different NAND based
> devices (SPI NAND, OneNAND and raw NANDs), but before doing that
> we need to move the existing include/linux/mtd/nand.h file into
> include/linux/mtd/rawnand.h so we can later create a nand.h header
> containing all common structure and function prototypes.
> 
> Signed-off-by: Boris Brezillon <boris.brezil...@free-electrons.com>
> Signed-off-by: Peter Pan <peterpand...@micron.com>
> Cc: Jonathan Corbet <cor...@lwn.net>
> Cc: Sekhar Nori <nsek...@ti.com>
> Cc: Kevin Hilman <khil...@kernel.org>
> Cc: Jason Cooper <ja...@lakedaemon.net>
> Cc: Andrew Lunn <and...@lunn.ch>
> Cc: Sebastian Hesselbarth <sebastian.hesselba...@gmail.com>
> Cc: Gregory Clement <gregory.clem...@free-electrons.com>
> Cc: Hartley Sweeten <hswee...@visionengravers.com>
> Cc: Alexander Sverdlin <alexander.sverd...@gmail.com>
> Cc: Shawn Guo <shawn...@kernel.org>
> Cc: Sascha Hauer <ker...@pengutronix.de>
> Cc: Fabio Estevam <fabio.este...@nxp.com>
> Cc: Imre Kaloz <ka...@openwrt.org>
> Cc: Krzysztof Halasa <khal...@piap.pl>
> Cc: Eric Miao <eric.y.m...@gmail.com>
> Cc: Haojian Zhuang <haojian.zhu...@gmail.com>
> Cc: Aaro Koskinen <aaro.koski...@iki.fi>
> Cc: Tony Lindgren <t...@atomide.com>
> Cc: Alexander Clouter <a...@digriz.org.uk>
> Cc: Daniel Mack <dan...@zonque.org>
> Cc: Robert Jarzmik <robert.jarz...@free.fr>
> Cc: Marek Vasut <marek.va...@gmail.com>
> Cc: Kukjin Kim <kg...@kernel.org>
> Cc: Krzysztof Kozlowski <k...@kernel.org>
> Cc: Simtec Linux Team <li...@simtec.co.uk>
> Cc: Steven Miao <real...@gmail.com>
> Cc: Mikael Starvik <star...@axis.com>
> Cc: Jesper Nilsson <jesper.nils...@axis.com>
> Cc: Ralf Baechle <r...@linux-mips.org>
> Cc: Yoshinori Sato <ys...@users.sourceforge.jp>
> Cc: Rich Felker <dal...@libc.org>
> Cc: Wenyou Yang <wenyou.y...@atmel.com>
> Cc: Josh Wu <rainyfeel...@outlook.com>
> Cc: Kamal Dasu <kdasu.k...@gmail.com>
> Cc: Masahiro Yamada <yamada.masah...@socionext.com>
> Cc: Han Xu <han...@nxp.com>
> Cc: Harvey Hunt <harveyhuntne...@gmail.com>
> Cc: Vladimir Zapolskiy <v...@mleia.com>
> Cc: Sylvain Lemieux <slemieux.t...@gmail.com>
> Cc: Matthias Brugger <matthias@gmail.com>
> Cc: Wan ZongShun <mcuos@gmail.com>
> Cc: Neil Armstrong <narmstr...@baylibre.com>
> Cc: Ezequiel Garcia <ezequiel.gar...@free-electrons.com>
> Cc: Maxim Levitsky <maximlevit...@gmail.com>
> Cc: Marc Gonzalez <marc_gonza...@sigmadesigns.com>
> Cc: Stefan Agner <ste...@agner.ch>
> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
> Cc: Mauro Carvalho Chehab <mche...@kernel.org>
> Cc: linux-...@vger.kernel.org
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: linux-o...@vger.kernel.org
> Cc: linux-samsung-...@vger.kernel.org
> Cc: adi-buildroot-de...@lists.sourceforge.net
> Cc: linux-cris-ker...@axis.com
> Cc: linux-m...@linux-mips.org
> Cc: linux...@vger.kernel.org
> Cc: bcm-kernel-feedback-l...@broadcom.com
> Cc: linux-media...@lists.infradead.org
> Cc: linux-ox...@lists.tuxfamily.org
> Cc: linuxppc-...@lists.ozlabs.org
> Cc: de...@driverdev.osuosl.org
> ---
> Hi All,
> 
> Sorry for the huge Cc list, but I'd like to collect as much acks as
> possible for this patch which is actually part of a bigger series [1].
> 
> Note that there's nothing complicated here, it's just a mechanical
> s/nand\.h/rawnand\.h/ replacement, but it impacts several architectures,
> the doc and staging directories.
> 
> Regards,
> 
> Boris
> 
> [1]https://lwn.net/Articles/723694/
> ---
>  Documentation/driver-api/mtdnand.rst| 8 
>  MAINTAINERS | 2 +-
>  arch/arm/mach-davinci/board-da850-evm.c | 2 +-
>  arch/arm/mach-davinci/board-dm355-evm.c | 2 +-
>  arch/arm/mach-davinci/board-dm355-leopard.c | 2 +-
>  arch/arm/mach-davinci/board-dm365-evm.c | 2 +-
>  arch/arm/mach-davinci/board-dm644x-evm.c| 2 +-
>  arch/arm/mach-davinci/board-dm646x-evm.c| 2 +-
>  arch/arm/mach-davinci/board-sffsdr.c| 2 +-
>  arch/arm/mach-dove/dove-db-setup.c  | 2 +-
>  arch/arm/mach-ep93xx/snappercl15.c  | 2 +-
>  arch/arm/mach-ep93xx/ts72xx.c   | 2 +-
>  arch/arm/mach-imx/mach-qong.c   | 2 +-
>  arch/arm/mach-ixp4xx/ixdp425-setup.c| 2 +-
>  arch/arm/mach-mmp/aspenite.c   

Re: [rtc-linux] [RFC 06/15] pinctrl: rockchip: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 17:03 GMT+09:00 Krzysztof Kozlowski <k.kozlow...@samsung.com>:
> The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
> direct dependencies.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
> ---
>  drivers/pinctrl/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
> index fb8200b8e8ec..dc7ab58d4d74 100644
> --- a/drivers/pinctrl/Kconfig
> +++ b/drivers/pinctrl/Kconfig
> @@ -131,6 +131,7 @@ config PINCTRL_MESON
>
>  config PINCTRL_ROCKCHIP
> bool
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select PINMUX

False alarm, no need for the patch (non-selectable symbol)

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


Re: [rtc-linux] [RFC 07/15] pinctrl: mvebu: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 17:03 GMT+09:00 Krzysztof Kozlowski <k.kozlow...@samsung.com>:
> The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
> direct dependencies.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
> ---
>  drivers/pinctrl/mvebu/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pinctrl/mvebu/Kconfig b/drivers/pinctrl/mvebu/Kconfig
> index 170602407c0d..13685923729c 100644
> --- a/drivers/pinctrl/mvebu/Kconfig
> +++ b/drivers/pinctrl/mvebu/Kconfig
> @@ -7,6 +7,7 @@ config PINCTRL_MVEBU
>
>  config PINCTRL_DOVE
> bool
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select PINCTRL_MVEBU
> select MFD_SYSCON

False alarm, no need for the patch (non-selectable symbol)

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


Re: [rtc-linux] [RFC 12/15] soc: qcom: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 17:03 GMT+09:00 Krzysztof Kozlowski <k.kozlow...@samsung.com>:
> The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
> direct dependencies.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
> ---
>  drivers/soc/qcom/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
> index 461b387d03cc..24de48134c15 100644
> --- a/drivers/soc/qcom/Kconfig
> +++ b/drivers/soc/qcom/Kconfig
> @@ -4,6 +4,7 @@
>  config QCOM_GSBI
>  tristate "QCOM General Serial Bus Interface"
>  depends on ARCH_QCOM
> +depends on HAS_IOMEM   # For MFD_SYSCON
>  select MFD_SYSCON

False alarm, no need for the patch (this depends on ARCH_QCOM).

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


Re: [rtc-linux] [RFC 13/15] staging: media: omap4iss: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 17:03 GMT+09:00 Krzysztof Kozlowski <k.kozlow...@samsung.com>:
> The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
> direct dependencies.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
> ---
>  drivers/staging/media/omap4iss/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/staging/media/omap4iss/Kconfig 
> b/drivers/staging/media/omap4iss/Kconfig
> index 46183464ee79..7dea072172aa 100644
> --- a/drivers/staging/media/omap4iss/Kconfig
> +++ b/drivers/staging/media/omap4iss/Kconfig
> @@ -2,6 +2,7 @@ config VIDEO_OMAP4
> tristate "OMAP 4 Camera support"
> depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && I2C && ARCH_OMAP4
> depends on HAS_DMA
> +   depends on HAS_IOMEM# For MFD_SYSCON
> select MFD_SYSCON
> select VIDEOBUF2_DMA_CONTIG
> ---help---

False alarm, no need for the patch (this depends on ARCH_OMAP4).

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


Re: [rtc-linux] Re: [RFC 09/15] media: platform: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 19:57 GMT+09:00 Arnd Bergmann <a...@arndb.de>:
> On Thursday 03 March 2016 17:03:35 Krzysztof Kozlowski wrote:
>> diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
>> index 201f5c296a95..e5931e434fa2 100644
>> --- a/drivers/media/platform/Kconfig
>> +++ b/drivers/media/platform/Kconfig
>> @@ -79,6 +79,7 @@ config VIDEO_OMAP3
>> depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
>> depends on HAS_DMA && OF
>> depends on OMAP_IOMMU
>> +   depends on HAS_IOMEM# For MFD_SYSCON
>> select ARM_DMA_USE_IOMMU
>> select VIDEOBUF2_DMA_CONTIG
>
> This is only built for OMAP3, so we won't get here without HAS_IOMEM

Indeed.

>
>> select MFD_SYSCON
>> diff --git a/drivers/media/platform/exynos4-is/Kconfig 
>> b/drivers/media/platform/exynos4-is/Kconfig
>> index 57d42c6172c5..c4317b99d257 100644
>> --- a/drivers/media/platform/exynos4-is/Kconfig
>> +++ b/drivers/media/platform/exynos4-is/Kconfig
>> @@ -17,6 +17,7 @@ config VIDEO_S5P_FIMC
>> tristate "S5P/EXYNOS4 FIMC/CAMIF camera interface driver"
>> depends on I2C
>> depends on HAS_DMA
>> +   depends on HAS_IOMEM# For MFD_SYSCON
>> select VIDEOBUF2_DMA_CONTIG
>> select V4L2_MEM2MEM_DEV
>
> This  is guarded by HAS_DMA, which implies HAS_IOMEM afaik.

Looking at Kconfigs - no, it is not implied (or am I missing
something)... and sometimes dependency on HAS_IOMEM is next to
HAS_DMA.

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


Re: [rtc-linux] Re: [RFC 11/15] power: reset: keystone: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 21:33 GMT+09:00 Sebastian Reichel <s...@kernel.org>:
> Hi,
>
> On Thu, Mar 03, 2016 at 12:00:14PM +0100, Arnd Bergmann wrote:
>> On Thursday 03 March 2016 17:03:37 Krzysztof Kozlowski wrote:
>> > diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
>> > index 0a6408a39c66..0f34846ae80d 100644
>> > --- a/drivers/power/reset/Kconfig
>> > +++ b/drivers/power/reset/Kconfig
>> > @@ -141,6 +141,7 @@ config POWER_RESET_XGENE
>> >  config POWER_RESET_KEYSTONE
>> > bool "Keystone reset driver"
>> > depends on ARCH_KEYSTONE
>> > +   depends on HAS_IOMEM# For MFD_SYSCON
>> > select MFD_SYSCON
>> > help
>> >   Reboot support for the KEYSTONE SoCs.
>> >
>>
>> This is platform specific, but we should probably add || COMPILE_TEST
>> along with the HAS_IOMEM dependency.
>
> Sounds sensible. Will you guys send an updated patch?
>

Sure, I'll make some compile tests and send a v2.

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


Re: [rtc-linux] Re: [RFC 15/15] mfd: syscon: Fix build of missing ioremap on UM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 19:50 GMT+09:00 Arnd Bergmann <a...@arndb.de>:
> On Thursday 03 March 2016 17:03:41 Krzysztof Kozlowski wrote:
>> Since commit c89c0114955a ("mfd: syscon: Set regmap max_register in
>> of_syscon_register") the syscon uses ioremap so it fails on COMPILE_TEST
>> without HAS_IOMEM:
>>
>> drivers/mfd/syscon.c: In function ‘of_syscon_register’:
>> drivers/mfd/syscon.c:67:9: error: implicit declaration of function ‘ioremap’ 
>> [-Werror=implicit-function-declaration]
>>   base = ioremap(res.start, resource_size());
>>  ^
>> drivers/mfd/syscon.c:67:7: warning: assignment makes pointer from integer 
>> without a cast [-Wint-conversion]
>>   base = ioremap(res.start, resource_size());
>>^
>> drivers/mfd/syscon.c:109:2: error: implicit declaration of function 
>> ‘iounmap’ [-Werror=implicit-function-declaration]
>>   iounmap(base);
>>
>> When selecting MFD_SYSCON, depend on HAS_IOMEM to avoid unmet direct
>> dependencies.
>>
>> Reported-by: kbuild test robot <l...@intel.com>
>> Fixes: c89c0114955a ("mfd: syscon: Set regmap max_register in 
>> of_syscon_register")
>> Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
>> ---
>
> Thanks for looking into this, the patches all look right to me, but
> I fear we are forever playing catch-up here, as the number of syscon users
> is only growing, and it's not obvious to the average driver developer
> why they have to select this symbol.

Actually I screwed something because entire MFD menuconfig (including
MFD_SYSCON) is already guarded by if HAS_IOMEM.

I was fixing the problem from the end (the build error) and then hit
these unmet direct dependencies (mentioned this in other mail).

I think this patch 15/15 is not needed.

>
> Interestingly, when I try to build an allmodconfig kernel for UML,
> it seems to reject any driver calling ioremap/iounmap but not
> the wrapper functions around that (of_iomap, devm_ioremap,
> devm_ioremap_resource, ...)

The declaration of devm-like functions is always there. However it
should fail during linking stage (see my other patches like for
thermal, nvram etc. this is still in progress because I did not manage
to build allyesconfig on UML yet).

> or the actual accessors that make no
> sense without ioremap (readl, writel, inb, outb, iowrite32, ...).
>
> I've played with this a bit, and arrived at the patch below, is this
> something we want as well?
>
> Arnd
>
>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>> index aa21dc55eb15..2e5b1e525a1d 100644
>> --- a/drivers/mfd/Kconfig
>> +++ b/drivers/mfd/Kconfig
>> @@ -1034,6 +1034,7 @@ config MFD_SUN6I_PRCM
>>
>>  config MFD_SYSCON
>>   bool "System Controller Register R/W Based on Regmap"
>> + depends on HAS_IOMEM
>>   select REGMAP_MMIO
>>   help
>> Select this option to enable accessing system control registers
>>
>
>
>  arch/um/include/asm/io.h   |1 +
>  drivers/char/Kconfig   |3 +++
>  drivers/char/mem.c |   16 
>  drivers/clocksource/Kconfig|3 +++
>  drivers/fmc/Kconfig|1 +
>  drivers/fpga/Kconfig   |1 +
>  drivers/hwtracing/intel_th/Kconfig |1 +
>  drivers/mfd/Kconfig|1 +
>  drivers/misc/altera-stapl/Kconfig  |2 +-
>  drivers/mtd/chips/Kconfig  |4 
>  drivers/mtd/lpddr/Kconfig  |1 +
>  drivers/mtd/maps/Kconfig   |3 ++-
>  drivers/mtd/nand/Kconfig   |2 +-
>  drivers/mtd/spi-nor/Kconfig|1 +
>  drivers/net/can/Kconfig|1 +
>  drivers/net/hamradio/Kconfig   |9 ++---
>  drivers/nvmem/Kconfig  |1 +
>  drivers/phy/Kconfig|9 +++--
>  drivers/power/reset/Kconfig|4 +++-
>  drivers/staging/comedi/Kconfig |6 +-
>  drivers/thermal/Kconfig|   11 +--

For some of these I already started fixing:
https://lkml.org/lkml/2016/3/3/147
http://comments.gmane.org/gmane.linux.kernel/2167664


>  include/linux/irq.h|2 ++
>  include/linux/mtd/cfi.h|2 ++
>  include/linux/mtd/map.h|2 ++
>  kernel/resource.c  |2 ++
>  lib/Kconfig|7 ++-
>  mm/bootmem.c   |4 ++--
>  27 files changed, 85 insertions(+), 15 deletions(-)
>
> diff --git a/arch/um/include/asm/io.h b/arch/um/include/asm/io.h
> new file mode 100644
> index 000..618ff13
> --- /dev/null
> +++ b/arch/um/include/asm

Re: [rtc-linux] Re: [RFC 04/15] irqchip: st: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
2016-03-03 19:53 GMT+09:00 Arnd Bergmann <a...@arndb.de>:
> On Thursday 03 March 2016 17:03:30 Krzysztof Kozlowski wrote:
>>  config ST_IRQCHIP
>> bool
>> select REGMAP
>> +   depends on HAS_IOMEM# For MFD_SYSCON
>> select MFD_SYSCON
>> help
>>   Enables SysCfg Controlled IRQs on STi based platforms.
>>
>
> Not user visible.

Hmmm... you are right (here and in other patches) but why am I getting
all these errors:
warning: (ST_IRQCHIP && HIP04_ETH && STMMAC_PLATFORM && DWMAC_IPQ806X
&& DWMAC_LPC18XX && DWMAC_ROCKCHIP && DWMAC_SOCFPGA && DWMAC_STI &&
TI_CPSW && PINCTRL_ROCKCHIP && PINCTRL_DOVE && POWER_RESET_KEYSTONE &&
S3C2410_WATCHDOG && VIDEO_OMAP3 && VIDEO_S5P_FIMC && USB_XHCI_MTK &&
RTC_DRV_AT91SAM9 && LPC18XX_DMAMUX && VIDEO_OMAP4 && HWSPINLOCK_QCOM
&& ATMEL_ST && QCOM_GSBI && PHY_HI6220_USB) selects MFD_SYSCON which
has unmet direct dependencies (HAS_IOMEM)
?
(ARCH=um, allyesconfig)
Adding depends here (and in other places) really helps... but it
should not have any impact...

Thanks for comments,
Krzysztof
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RFC 15/15] mfd: syscon: Fix build of missing ioremap on UM

2016-03-03 Thread Krzysztof Kozlowski
Since commit c89c0114955a ("mfd: syscon: Set regmap max_register in
of_syscon_register") the syscon uses ioremap so it fails on COMPILE_TEST
without HAS_IOMEM:

drivers/mfd/syscon.c: In function ‘of_syscon_register’:
drivers/mfd/syscon.c:67:9: error: implicit declaration of function ‘ioremap’ 
[-Werror=implicit-function-declaration]
  base = ioremap(res.start, resource_size());
 ^
drivers/mfd/syscon.c:67:7: warning: assignment makes pointer from integer 
without a cast [-Wint-conversion]
  base = ioremap(res.start, resource_size());
   ^
drivers/mfd/syscon.c:109:2: error: implicit declaration of function ‘iounmap’ 
[-Werror=implicit-function-declaration]
  iounmap(base);

When selecting MFD_SYSCON, depend on HAS_IOMEM to avoid unmet direct
dependencies.

Reported-by: kbuild test robot <l...@intel.com>
Fixes: c89c0114955a ("mfd: syscon: Set regmap max_register in 
of_syscon_register")
Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/mfd/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index aa21dc55eb15..2e5b1e525a1d 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1034,6 +1034,7 @@ config MFD_SUN6I_PRCM
 
 config MFD_SYSCON
bool "System Controller Register R/W Based on Regmap"
+   depends on HAS_IOMEM
select REGMAP_MMIO
help
  Select this option to enable accessing system control registers
-- 
2.5.0

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


[RFC 12/15] soc: qcom: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/soc/qcom/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index 461b387d03cc..24de48134c15 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -4,6 +4,7 @@
 config QCOM_GSBI
 tristate "QCOM General Serial Bus Interface"
 depends on ARCH_QCOM
+depends on HAS_IOMEM   # For MFD_SYSCON
 select MFD_SYSCON
 help
   Say y here to enable GSBI support.  The GSBI provides control
-- 
2.5.0

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


[RFC 13/15] staging: media: omap4iss: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/staging/media/omap4iss/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/media/omap4iss/Kconfig 
b/drivers/staging/media/omap4iss/Kconfig
index 46183464ee79..7dea072172aa 100644
--- a/drivers/staging/media/omap4iss/Kconfig
+++ b/drivers/staging/media/omap4iss/Kconfig
@@ -2,6 +2,7 @@ config VIDEO_OMAP4
tristate "OMAP 4 Camera support"
depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && I2C && ARCH_OMAP4
depends on HAS_DMA
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
select VIDEOBUF2_DMA_CONTIG
---help---
-- 
2.5.0

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


[RFC 11/15] power: reset: keystone: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/power/reset/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index 0a6408a39c66..0f34846ae80d 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -141,6 +141,7 @@ config POWER_RESET_XGENE
 config POWER_RESET_KEYSTONE
bool "Keystone reset driver"
depends on ARCH_KEYSTONE
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
help
  Reboot support for the KEYSTONE SoCs.
-- 
2.5.0

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


[RFC 09/15] media: platform: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/media/platform/Kconfig| 1 +
 drivers/media/platform/exynos4-is/Kconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 201f5c296a95..e5931e434fa2 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -79,6 +79,7 @@ config VIDEO_OMAP3
depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
depends on HAS_DMA && OF
depends on OMAP_IOMMU
+   depends on HAS_IOMEM# For MFD_SYSCON
select ARM_DMA_USE_IOMMU
select VIDEOBUF2_DMA_CONTIG
select MFD_SYSCON
diff --git a/drivers/media/platform/exynos4-is/Kconfig 
b/drivers/media/platform/exynos4-is/Kconfig
index 57d42c6172c5..c4317b99d257 100644
--- a/drivers/media/platform/exynos4-is/Kconfig
+++ b/drivers/media/platform/exynos4-is/Kconfig
@@ -17,6 +17,7 @@ config VIDEO_S5P_FIMC
tristate "S5P/EXYNOS4 FIMC/CAMIF camera interface driver"
depends on I2C
depends on HAS_DMA
+   depends on HAS_IOMEM# For MFD_SYSCON
select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV
select MFD_SYSCON
-- 
2.5.0

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


[RFC 10/15] net: ethernet: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/net/ethernet/hisilicon/Kconfig  | 1 +
 drivers/net/ethernet/stmicro/stmmac/Kconfig | 6 ++
 drivers/net/ethernet/ti/Kconfig | 1 +
 3 files changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/Kconfig 
b/drivers/net/ethernet/hisilicon/Kconfig
index 74beb1867230..6a9c91781bf9 100644
--- a/drivers/net/ethernet/hisilicon/Kconfig
+++ b/drivers/net/ethernet/hisilicon/Kconfig
@@ -26,6 +26,7 @@ config HIX5HD2_GMAC
 config HIP04_ETH
tristate "HISILICON P04 Ethernet support"
select MARVELL_PHY
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
select HNS_MDIO
---help---
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig 
b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index cec147d1d34f..d6902bf6e90f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -16,6 +16,7 @@ if STMMAC_ETH
 config STMMAC_PLATFORM
tristate "STMMAC Platform bus support"
depends on STMMAC_ETH
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
default y
---help---
@@ -41,6 +42,7 @@ config DWMAC_IPQ806X
tristate "QCA IPQ806x DWMAC support"
default ARCH_QCOM
depends on OF
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
help
  Support for QCA IPQ806X DWMAC Ethernet.
@@ -54,6 +56,7 @@ config DWMAC_LPC18XX
tristate "NXP LPC18xx/43xx DWMAC support"
default ARCH_LPC18XX
depends on OF
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
---help---
  Support for NXP LPC18xx/43xx DWMAC Ethernet.
@@ -73,6 +76,7 @@ config DWMAC_ROCKCHIP
tristate "Rockchip dwmac support"
default ARCH_ROCKCHIP
depends on OF
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
help
  Support for Ethernet controller on Rockchip RK3288 SoC.
@@ -84,6 +88,7 @@ config DWMAC_SOCFPGA
tristate "SOCFPGA dwmac support"
default ARCH_SOCFPGA
depends on OF
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
help
  Support for ethernet controller on Altera SOCFPGA
@@ -96,6 +101,7 @@ config DWMAC_STI
tristate "STi GMAC support"
default ARCH_STI
depends on OF
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
---help---
  Support for ethernet controller on STi SOCs.
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index e7f0b7d95b65..ec56cebe929d 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -62,6 +62,7 @@ config TI_CPSW_ALE
 config TI_CPSW
tristate "TI CPSW Switch Support"
depends on ARCH_DAVINCI || ARCH_OMAP2PLUS
+   depends on HAS_IOMEM# For MFD_SYSCON
select TI_DAVINCI_CPDMA
select TI_DAVINCI_MDIO
select TI_CPSW_PHY_SEL
-- 
2.5.0

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


[RFC 14/15] usb: xhci: mtk: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/usb/host/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 8c20ebbc049c..f759a778d606 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -45,6 +45,7 @@ config USB_XHCI_PLATFORM
 
 config USB_XHCI_MTK
tristate "xHCI support for Mediatek MT65xx"
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
depends on ARCH_MEDIATEK || COMPILE_TEST
---help---
-- 
2.5.0

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


[RFC 08/15] rtc: at91sam9: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/rtc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 0da40e2e4280..5c530b6b125d 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1302,6 +1302,7 @@ config RTC_DRV_AT91RM9200
 config RTC_DRV_AT91SAM9
tristate "AT91SAM9 RTT as RTC"
depends on ARCH_AT91 || COMPILE_TEST
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
help
  Some AT91SAM9 SoCs provide an RTT (Real Time Timer) block which
-- 
2.5.0

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


[RFC 07/15] pinctrl: mvebu: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/pinctrl/mvebu/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/mvebu/Kconfig b/drivers/pinctrl/mvebu/Kconfig
index 170602407c0d..13685923729c 100644
--- a/drivers/pinctrl/mvebu/Kconfig
+++ b/drivers/pinctrl/mvebu/Kconfig
@@ -7,6 +7,7 @@ config PINCTRL_MVEBU
 
 config PINCTRL_DOVE
bool
+   depends on HAS_IOMEM# For MFD_SYSCON
select PINCTRL_MVEBU
select MFD_SYSCON
 
-- 
2.5.0

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


[RFC 06/15] pinctrl: rockchip: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/pinctrl/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index fb8200b8e8ec..dc7ab58d4d74 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -131,6 +131,7 @@ config PINCTRL_MESON
 
 config PINCTRL_ROCKCHIP
bool
+   depends on HAS_IOMEM# For MFD_SYSCON
select PINMUX
select GENERIC_PINCONF
select GENERIC_IRQ_CHIP
-- 
2.5.0

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


[RFC 04/15] irqchip: st: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/irqchip/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 00bbec6eca0b..10775b099daa 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -157,6 +157,7 @@ config RENESAS_IRQC
 config ST_IRQCHIP
bool
select REGMAP
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
help
  Enables SysCfg Controlled IRQs on STi based platforms.
-- 
2.5.0

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


[RFC 02/15] dmaengine: nxp: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/dma/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index c77f214c9466..7fbf96bff280 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -290,6 +290,7 @@ config LPC18XX_DMAMUX
bool "NXP LPC18xx/43xx DMA MUX for PL080"
depends on ARCH_LPC18XX || COMPILE_TEST
depends on OF && AMBA_PL08X
+   depends on HAS_IOMEM# For MFD_SYSCON
select MFD_SYSCON
help
  Enable support for DMA on NXP LPC18xx/43xx platforms
-- 
2.5.0

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


[RFC 03/15] hwspinlock: qcom: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/hwspinlock/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hwspinlock/Kconfig b/drivers/hwspinlock/Kconfig
index 73a401662853..5ab2d51dc147 100644
--- a/drivers/hwspinlock/Kconfig
+++ b/drivers/hwspinlock/Kconfig
@@ -21,6 +21,7 @@ config HWSPINLOCK_OMAP
 config HWSPINLOCK_QCOM
tristate "Qualcomm Hardware Spinlock device"
depends on ARCH_QCOM
+   depends on HAS_IOMEM# For MFD_SYSCON
select HWSPINLOCK
select MFD_SYSCON
help
-- 
2.5.0

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


[RFC 05/15] phy: hi6220: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/phy/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 0124d17bd9fe..cfdb3551a675 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -225,6 +225,7 @@ config PHY_MT65XX_USB3
 config PHY_HI6220_USB
tristate "hi6220 USB PHY support"
depends on (ARCH_HISI && ARM64) || COMPILE_TEST
+   depends on HAS_IOMEM# For MFD_SYSCON
select GENERIC_PHY
select MFD_SYSCON
help
-- 
2.5.0

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


[RFC 01/15] clocksource: atmel: Add missing MFD_SYSCON dependency on HAS_IOMEM

2016-03-03 Thread Krzysztof Kozlowski
The MFD_SYSCON depends on HAS_IOMEM so when selecting it avoid unmet
direct dependencies.

Signed-off-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>
---
 drivers/clocksource/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index c346be650892..5927944b46e0 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -239,6 +239,7 @@ config ATMEL_PIT
 
 config ATMEL_ST
bool
+   depends on HAS_IOMEM# For MFD_SYSCON
select CLKSRC_OF
select MFD_SYSCON
 
-- 
2.5.0

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


[RFC 00/15] tree-wide: mfd: syscon: Fix unmet ioremap dependency

2016-03-03 Thread Krzysztof Kozlowski
Hi,

Building allyesconfig on ARCH=um fails with:
   drivers/mfd/syscon.c: In function ‘of_syscon_register’:
   drivers/mfd/syscon.c:67:9: error: implicit declaration of function ‘ioremap’ 
[-Werror=implicit-function-declaration]
  base = ioremap(res.start, resource_size());

Since commit c89c0114955a ("mfd: syscon: Set regmap max_register in
of_syscon_register") the syscon depends on HAS_IOMEM because
it uses the ioremap().

However syscon is often directly selected... so first the dependency on
HAS_IOMEM has to be added to all selecting symbols.

Comments are welcomed whether this is appropriate approach.


The last patch "mfd: syscon: Fix build of missing ioremap on UM" should
enter all other to avoid kbuild complains like:

warning: (ST_IRQCHIP && HIP04_ETH && STMMAC_PLATFORM && DWMAC_IPQ806X &&
DWMAC_LPC18XX && DWMAC_ROCKCHIP && DWMAC_SOCFPGA && DWMAC_STI && TI_CPSW
&& PINCTRL_ROCKCHIP && PINCTRL_DOVE && POWER_RESET_KEYSTONE &&
S3C2410_WATCHDOG && VIDEO_OMAP3 && VIDEO_S5P_FIMC && USB_XHCI_MTK &&
RTC_DRV_AT91SAM9 && LPC18XX_DMAMUX && VIDEO_OMAP4 && HWSPINLOCK_QCOM && ATMEL_ST
&& QCOM_GSBI && PHY_HI6220_USB)
selects MFD_SYSCON which has unmet direct dependencies (HAS_IOMEM)


Best regards,
Krzysztof


Krzysztof Kozlowski (15):
  clocksource: atmel: Add missing MFD_SYSCON dependency on HAS_IOMEM
  dmaengine: nxp: Add missing MFD_SYSCON dependency on HAS_IOMEM
  hwspinlock: qcom: Add missing MFD_SYSCON dependency on HAS_IOMEM
  irqchip: st: Add missing MFD_SYSCON dependency on HAS_IOMEM
  phy: hi6220: Add missing MFD_SYSCON dependency on HAS_IOMEM
  pinctrl: rockchip: Add missing MFD_SYSCON dependency on HAS_IOMEM
  pinctrl: mvebu: Add missing MFD_SYSCON dependency on HAS_IOMEM
  rtc: at91sam9: Add missing MFD_SYSCON dependency on HAS_IOMEM
  media: platform: Add missing MFD_SYSCON dependency on HAS_IOMEM
  net: ethernet: Add missing MFD_SYSCON dependency on HAS_IOMEM
  power: reset: keystone: Add missing MFD_SYSCON dependency on HAS_IOMEM
  soc: qcom: Add missing MFD_SYSCON dependency on HAS_IOMEM
  staging: media: omap4iss: Add missing MFD_SYSCON dependency on
HAS_IOMEM
  usb: xhci: mtk: Add missing MFD_SYSCON dependency on HAS_IOMEM
  mfd: syscon: Fix build of missing ioremap on UM

 drivers/clocksource/Kconfig | 1 +
 drivers/dma/Kconfig | 1 +
 drivers/hwspinlock/Kconfig  | 1 +
 drivers/irqchip/Kconfig | 1 +
 drivers/media/platform/Kconfig  | 1 +
 drivers/media/platform/exynos4-is/Kconfig   | 1 +
 drivers/mfd/Kconfig | 1 +
 drivers/net/ethernet/hisilicon/Kconfig  | 1 +
 drivers/net/ethernet/stmicro/stmmac/Kconfig | 6 ++
 drivers/net/ethernet/ti/Kconfig | 1 +
 drivers/phy/Kconfig | 1 +
 drivers/pinctrl/Kconfig | 1 +
 drivers/pinctrl/mvebu/Kconfig   | 1 +
 drivers/power/reset/Kconfig | 1 +
 drivers/rtc/Kconfig | 1 +
 drivers/soc/qcom/Kconfig| 1 +
 drivers/staging/media/omap4iss/Kconfig  | 1 +
 drivers/usb/host/Kconfig| 1 +
 18 files changed, 23 insertions(+)

-- 
2.5.0

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


Re: [PATCH v4 38/58] mtd: nand: s3c2410: use the mtd instance embedded in struct nand_chip

2015-12-10 Thread Krzysztof Kozlowski
On 10.12.2015 17:00, Boris Brezillon wrote:
> struct nand_chip now embeds an mtd device. Make use of this mtd instance.
> 
> Signed-off-by: Boris Brezillon <boris.brezil...@free-electrons.com>
> ---
> Changes generated with the following coccinelle script
> 
> --->8---
> virtual patch
> 
> @fix1@
> identifier __chipfield, __mtdfield;
> type __type;
> @@
> (
>   __type {
>   ...
>   struct nand_chip __chipfield;
>   ...
> - struct mtd_info __mtdfield;
>   ...
>   };
> |
>   __type {
>   ...
> - struct mtd_info __mtdfield;
>   ...
>   struct nand_chip __chipfield;
>   ...
>   };
> )
> 
> @fix2 depends on fix1@
> identifier fix1.__chipfield, fix1.__mtdfield;
> identifier __subfield;
> type fix1.__type;
> __type *__priv;
> @@
> (
> - __priv->__mtdfield.__subfield
> + nand_to_mtd(&__priv->__chipfield)->__subfield
> |
> - &(__priv->__mtdfield)
> + nand_to_mtd(&__priv->__chipfield)
> )
> --->8---
> ---
>  drivers/mtd/nand/s3c2410.c | 23 ++-
>  1 file changed, 14 insertions(+), 9 deletions(-)
> 

Looks correct:

Reviewed-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>

Best regards,
Krzysztof


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


Re: [PATCH 04/23] mtd: nand: s3c2410: kill the ->ecc_layout field

2015-12-07 Thread Krzysztof Kozlowski
On 08.12.2015 07:25, Boris Brezillon wrote:
> The s3c2410 is allowing board data to overload the default ECC layout
> defined inside the driver, but this feature is not used by board
> specific definitions.
> Kill this field so that we can easily move to a model where ecclayout
> are dynamically allocated by the NAND controller driver.
> 
> Signed-off-by: Boris Brezillon <boris.brezil...@free-electrons.com>
> ---
>  arch/arm/plat-samsung/devs.c   | 9 -
>  drivers/mtd/nand/s3c2410.c | 3 ---
>  include/linux/platform_data/mtd-nand-s3c2410.h | 1 -
>  3 files changed, 13 deletions(-)

Acked-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>

Best regards,
Krzysztof



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


Re: [PATCH v2 3/3] [media] include/media: move platform_data to linux/platform_data/media

2015-11-16 Thread Krzysztof Kozlowski
W dniu 16.11.2015 o 20:00, Mauro Carvalho Chehab pisze:
> Let's not mix platform_data headers with the core headers. Instead, let's
> create a subdir at linux/platform_data and move the headers to that
> common place, adding it to MAINTAINERS.
> 
> The headers were moved with:
>   mkdir include/linux/platform_data/media/; git mv 
> include/media/gpio-ir-recv.h include/media/ir-rx51.h 
> include/media/mmp-camera.h include/media/omap1_camera.h 
> include/media/omap4iss.h include/media/s5p_hdmi.h include/media/si4713.h 
> include/media/sii9234.h include/media/smiapp.h include/media/soc_camera.h 
> include/media/soc_camera_platform.h include/media/timb_radio.h 
> include/media/timb_video.h include/linux/platform_data/media/
> 
> And the references fixed with this script:
> MAIN_DIR="linux/platform_data/"
> PREV_DIR="media/"
> DIRS="media/"
> 
> echo "Checking affected files" >&2
> for i in $DIRS; do
>   for j in $(find include/$MAIN_DIR/$i -type f -name '*.h'); do
>n=`basename $j`
>   git grep -l $n
>   done
> done|sort|uniq >files && (
>   echo "Handling files..." >&2;
>   echo "for i in \$(cat files|grep -v Documentation); do cat \$i | \\";
>   (
>   cd include/$MAIN_DIR;
>   for j in $DIRS; do
>   for i in $(ls $j); do
>   echo "perl -ne 's,(include 
> [\\\"\\<])$PREV_DIR($i)([\\\"\\>]),\1$MAIN_DIR$j\2\3,; print \$_' |\\";
>   done;
>   done;
>   echo "cat > a && mv a \$i; done";
>   );
>   echo "Handling documentation..." >&2;
>   echo "for i in MAINTAINERS \$(cat files); do cat \$i | \\";
>   (
>   cd include/$MAIN_DIR;
>   for j in $DIRS; do
>   for i in $(ls $j); do
>   echo "  perl -ne 
> 's,include/$PREV_DIR($i)\b,include/$MAIN_DIR$j\1,; print \$_' |\\";
>   done;
>   done;
>   echo "cat > a && mv a \$i; done"
>   );
> ) >script && . ./script
> 
> Signed-off-by: Mauro Carvalho Chehab <mche...@osg.samsung.com>
> ---
>  Documentation/video4linux/omap4_camera.txt| 2 +-
>  Documentation/video4linux/si4713.txt  | 2 +-
>  MAINTAINERS   | 1 +
>  arch/arm/mach-omap1/include/mach/camera.h | 2 +-
>  arch/arm/mach-omap2/board-rx51-peripherals.c  | 4 ++--
>  arch/arm/plat-samsung/devs.c  | 2 +-

Acked-by: Krzysztof Kozlowski <k.kozlow...@samsung.com>

Best regards,
Krzysztof

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


[PATCH 2/3] staging: media: Drop owner assignment from i2c_driver

2015-07-10 Thread Krzysztof Kozlowski
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com

---

The coccinelle script which generated the patch was sent here:
http://www.spinics.net/lists/kernel/msg2029903.html
---
 drivers/staging/media/lirc/lirc_zilog.c | 1 -
 drivers/staging/media/mn88472/mn88472.c | 1 -
 drivers/staging/media/mn88473/mn88473.c | 1 -
 3 files changed, 3 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_zilog.c 
b/drivers/staging/media/lirc/lirc_zilog.c
index 261e27d6b054..d032745081ee 100644
--- a/drivers/staging/media/lirc/lirc_zilog.c
+++ b/drivers/staging/media/lirc/lirc_zilog.c
@@ -1367,7 +1367,6 @@ static const struct i2c_device_id ir_transceiver_id[] = {
 
 static struct i2c_driver driver = {
.driver = {
-   .owner  = THIS_MODULE,
.name   = Zilog/Hauppauge i2c IR,
},
.probe  = ir_probe,
diff --git a/drivers/staging/media/mn88472/mn88472.c 
b/drivers/staging/media/mn88472/mn88472.c
index a8d45f44765c..cf2e96bcf395 100644
--- a/drivers/staging/media/mn88472/mn88472.c
+++ b/drivers/staging/media/mn88472/mn88472.c
@@ -561,7 +561,6 @@ MODULE_DEVICE_TABLE(i2c, mn88472_id_table);
 
 static struct i2c_driver mn88472_driver = {
.driver = {
-   .owner  = THIS_MODULE,
.name   = mn88472,
},
.probe  = mn88472_probe,
diff --git a/drivers/staging/media/mn88473/mn88473.c 
b/drivers/staging/media/mn88473/mn88473.c
index f9146a146d07..a222e99935d2 100644
--- a/drivers/staging/media/mn88473/mn88473.c
+++ b/drivers/staging/media/mn88473/mn88473.c
@@ -507,7 +507,6 @@ MODULE_DEVICE_TABLE(i2c, mn88473_id_table);
 
 static struct i2c_driver mn88473_driver = {
.driver = {
-   .owner  = THIS_MODULE,
.name   = mn88473,
},
.probe  = mn88473_probe,
-- 
1.9.1

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


[PATCH 3/3] staging: Drop owner assignment from i2c_driver

2015-07-10 Thread Krzysztof Kozlowski
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com

---

The coccinelle script which generated the patch was sent here:
http://www.spinics.net/lists/kernel/msg2029903.html
---
 drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c 
b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
index 0f524bb7b41d..1f9ba8beb061 100644
--- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
+++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
@@ -1126,7 +1126,6 @@ MODULE_DEVICE_TABLE(i2c, synaptics_rmi4_id_table);
 static struct i2c_driver synaptics_rmi4_driver = {
.driver = {
.name   =   DRIVER_NAME,
-   .owner  =   THIS_MODULE,
.pm =   synaptics_rmi4_dev_pm_ops,
},
.probe  =   synaptics_rmi4_probe,
-- 
1.9.1

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


[PATCH 1/3] staging: iio: Drop owner assignment from i2c_driver

2015-07-10 Thread Krzysztof Kozlowski
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com

---

The coccinelle script which generated the patch was sent here:
http://www.spinics.net/lists/kernel/msg2029903.html
---
 drivers/staging/iio/addac/adt7316-i2c.c | 1 -
 drivers/staging/iio/light/isl29018.c| 1 -
 drivers/staging/iio/light/isl29028.c| 1 -
 3 files changed, 3 deletions(-)

diff --git a/drivers/staging/iio/addac/adt7316-i2c.c 
b/drivers/staging/iio/addac/adt7316-i2c.c
index 75ddd4f801a3..78fe0b557280 100644
--- a/drivers/staging/iio/addac/adt7316-i2c.c
+++ b/drivers/staging/iio/addac/adt7316-i2c.c
@@ -124,7 +124,6 @@ static struct i2c_driver adt7316_driver = {
.driver = {
.name = adt7316,
.pm = ADT7316_PM_OPS,
-   .owner  = THIS_MODULE,
},
.probe = adt7316_i2c_probe,
.id_table = adt7316_i2c_id,
diff --git a/drivers/staging/iio/light/isl29018.c 
b/drivers/staging/iio/light/isl29018.c
index e646c5d24004..019ba5245c23 100644
--- a/drivers/staging/iio/light/isl29018.c
+++ b/drivers/staging/iio/light/isl29018.c
@@ -838,7 +838,6 @@ static struct i2c_driver isl29018_driver = {
.name = isl29018,
.acpi_match_table = ACPI_PTR(isl29018_acpi_match),
.pm = ISL29018_PM_OPS,
-   .owner = THIS_MODULE,
.of_match_table = isl29018_of_match,
},
.probe   = isl29018_probe,
diff --git a/drivers/staging/iio/light/isl29028.c 
b/drivers/staging/iio/light/isl29028.c
index e5b2fdc2334b..cd6f2727aa58 100644
--- a/drivers/staging/iio/light/isl29028.c
+++ b/drivers/staging/iio/light/isl29028.c
@@ -547,7 +547,6 @@ static struct i2c_driver isl29028_driver = {
.class  = I2C_CLASS_HWMON,
.driver  = {
.name = isl29028,
-   .owner = THIS_MODULE,
.of_match_table = isl29028_of_match,
},
.probe   = isl29028_probe,
-- 
1.9.1

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


[PATCH] Drop owner assignment from i2c_driver (and platform left-overs)

2015-07-10 Thread Krzysztof Kozlowski
Hi,


The i2c drivers also do not have to set 'owner' field because
i2c_register_driver() will do it instead.

'owner' is removed from i2c drivers, which I was able to compile
with allyesconfig (arm, arm64, i386, x86_64, ppc64).
Only compile-tested.

The coccinelle script which generated the patch was sent here:
http://www.spinics.net/lists/kernel/msg2029903.html


Best regards,
Krzysztof


Krzysztof Kozlowski (3):
  staging: iio: Drop owner assignment from i2c_driver
  staging: media: Drop owner assignment from i2c_driver
  staging: Drop owner assignment from i2c_driver

 drivers/staging/iio/addac/adt7316-i2c.c   | 1 -
 drivers/staging/iio/light/isl29018.c  | 1 -
 drivers/staging/iio/light/isl29028.c  | 1 -
 drivers/staging/media/lirc/lirc_zilog.c   | 1 -
 drivers/staging/media/mn88472/mn88472.c   | 1 -
 drivers/staging/media/mn88473/mn88473.c   | 1 -
 drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | 1 -
 7 files changed, 7 deletions(-)

-- 
1.9.1

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


[PATCH] staging: iio: ad7606_par: Constify platform_device_id

2015-05-01 Thread Krzysztof Kozlowski
The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski k.kozlowsk...@gmail.com
---
 drivers/staging/iio/adc/ad7606_par.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/adc/ad7606_par.c 
b/drivers/staging/iio/adc/ad7606_par.c
index 9e24b4d4455f..1d48ae381d16 100644
--- a/drivers/staging/iio/adc/ad7606_par.c
+++ b/drivers/staging/iio/adc/ad7606_par.c
@@ -119,7 +119,7 @@ static const struct dev_pm_ops ad7606_pm_ops = {
 #define AD7606_PAR_PM_OPS NULL
 #endif  /* CONFIG_PM */
 
-static struct platform_device_id ad7606_driver_ids[] = {
+static const struct platform_device_id ad7606_driver_ids[] = {
{
.name   = ad7606-8,
.driver_data= ID_AD7606_8,
-- 
2.1.4

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


[PATCH] staging: media: omap4iss: Constify platform_device_id

2015-05-01 Thread Krzysztof Kozlowski
The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski k.kozlowsk...@gmail.com
---
 drivers/staging/media/omap4iss/iss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/omap4iss/iss.c 
b/drivers/staging/media/omap4iss/iss.c
index e0ad5e520e2d..68867f286afd 100644
--- a/drivers/staging/media/omap4iss/iss.c
+++ b/drivers/staging/media/omap4iss/iss.c
@@ -1478,7 +1478,7 @@ static int iss_remove(struct platform_device *pdev)
return 0;
 }
 
-static struct platform_device_id omap4iss_id_table[] = {
+static const struct platform_device_id omap4iss_id_table[] = {
{ omap4iss, 0 },
{ },
 };
-- 
2.1.4

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


[PATCH v6 09/22] mfd: ab8500: Use power_supply_*() API for accessing function attrs

2015-03-10 Thread Krzysztof Kozlowski
Replace direct calls to power supply function attributes with wrappers.
Wrappers provide safe access in case of unregistering the power
supply (e.g. by removing the driver). Replace:
 - get_property - power_supply_get_property

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Jonghwa Lee jonghwa3@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Acked-by: Lee Jones lee.jo...@linaro.org
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/mfd/ab8500-sysctrl.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
index cfff0b643f1b..d4a4b24be7c6 100644
--- a/drivers/mfd/ab8500-sysctrl.c
+++ b/drivers/mfd/ab8500-sysctrl.c
@@ -49,7 +49,8 @@ static void ab8500_power_off(void)
if (!psy)
continue;
 
-   ret = psy-get_property(psy, POWER_SUPPLY_PROP_ONLINE, val);
+   ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
+   val);
 
if (!ret  val.intval) {
charger_present = true;
@@ -63,8 +64,8 @@ static void ab8500_power_off(void)
/* Check if battery is known */
psy = power_supply_get_by_name(ab8500_btemp);
if (psy) {
-   ret = psy-get_property(psy, POWER_SUPPLY_PROP_TECHNOLOGY,
-   val);
+   ret = power_supply_get_property(psy,
+   POWER_SUPPLY_PROP_TECHNOLOGY, val);
if (!ret  val.intval != POWER_SUPPLY_TECHNOLOGY_UNKNOWN) {
printk(KERN_INFO
   Charger \%s\ is connected with known battery.
-- 
1.9.1

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


[PATCH v6 19/22] power_supply: 88pm860x_charger: Decrement the power supply's device reference counter

2015-03-10 Thread Krzysztof Kozlowski
Use power_supply_put() to decrement the power supply's device reference
counter.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/power/88pm860x_charger.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/power/88pm860x_charger.c b/drivers/power/88pm860x_charger.c
index a7f32a5b2299..bf822aa00c14 100644
--- a/drivers/power/88pm860x_charger.c
+++ b/drivers/power/88pm860x_charger.c
@@ -298,13 +298,18 @@ static int set_charging_fsm(struct pm860x_charger_info 
*info)
return -EINVAL;
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_VOLTAGE_NOW,
data);
-   if (ret)
+   if (ret) {
+   power_supply_put(psy);
return ret;
+   }
vbatt = data.intval / 1000;
 
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_PRESENT, data);
-   if (ret)
+   if (ret) {
+   power_supply_put(psy);
return ret;
+   }
+   power_supply_put(psy);
 
mutex_lock(info-lock);
info-present = data.intval;
@@ -447,6 +452,7 @@ static irqreturn_t pm860x_temp_handler(int irq, void *data)
 
set_charging_fsm(info);
 out:
+   power_supply_put(psy);
return IRQ_HANDLED;
 }
 
@@ -507,6 +513,7 @@ static irqreturn_t pm860x_done_handler(int irq, void *data)
 
 out:
mutex_unlock(info-lock);
+   power_supply_put(psy);
dev_dbg(info-dev, %s, Allowed: %d\n, __func__, info-allowed);
set_charging_fsm(info);
 
-- 
1.9.1

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


[PATCH v6 17/22] x86/olpc/xo1/sci: Use newly added power_supply_put API

2015-03-10 Thread Krzysztof Kozlowski
Replace direct usage of put_device() with new API: power_supply_put().

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 arch/x86/platform/olpc/olpc-xo1-sci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c 
b/arch/x86/platform/olpc/olpc-xo1-sci.c
index e4ed28bbf79d..7fa8b3b53bc0 100644
--- a/arch/x86/platform/olpc/olpc-xo1-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
@@ -61,7 +61,7 @@ static void battery_status_changed(void)
 
if (psy) {
power_supply_changed(psy);
-   put_device(psy-dev);
+   power_supply_put(psy);
}
 }
 
@@ -71,7 +71,7 @@ static void ac_status_changed(void)
 
if (psy) {
power_supply_changed(psy);
-   put_device(psy-dev);
+   power_supply_put(psy);
}
 }
 
-- 
1.9.1

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


[PATCH v6 15/22] power_supply: Increment power supply use counter when obtaining references

2015-03-10 Thread Krzysztof Kozlowski
Increment the power_supply.use_cnt usage counter on:
 - power_supply_get_by_phandle()
 - power_supply_get_by_name()
and decrement it on power_supply_put() call.

This helps tracking of valid usage of power supply instance by
consumers. The usage counter itself also allows safe calling of
power_supply_get_property-like functions even when driver unregisters
this power supply.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
---
 drivers/power/power_supply_core.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/power/power_supply_core.c 
b/drivers/power/power_supply_core.c
index b4ec14683b7f..2ed4a4a6b3c5 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -349,10 +349,16 @@ static int power_supply_match_device_by_name(struct 
device *dev, const void *dat
  */
 struct power_supply *power_supply_get_by_name(const char *name)
 {
+   struct power_supply *psy = NULL;
struct device *dev = class_find_device(power_supply_class, NULL, name,
power_supply_match_device_by_name);
 
-   return dev ? dev_get_drvdata(dev) : NULL;
+   if (dev) {
+   psy = dev_get_drvdata(dev);
+   atomic_inc(psy-use_cnt);
+   }
+
+   return psy;
 }
 EXPORT_SYMBOL_GPL(power_supply_get_by_name);
 
@@ -367,6 +373,7 @@ void power_supply_put(struct power_supply *psy)
 {
might_sleep();
 
+   atomic_dec(psy-use_cnt);
put_device(psy-dev);
 }
 EXPORT_SYMBOL_GPL(power_supply_put);
@@ -393,6 +400,7 @@ struct power_supply *power_supply_get_by_phandle(struct 
device_node *np,
const char *property)
 {
struct device_node *power_supply_np;
+   struct power_supply *psy = NULL;
struct device *dev;
 
power_supply_np = of_parse_phandle(np, property, 0);
@@ -404,7 +412,12 @@ struct power_supply *power_supply_get_by_phandle(struct 
device_node *np,
 
of_node_put(power_supply_np);
 
-   return dev ? dev_get_drvdata(dev) : NULL;
+   if (dev) {
+   psy = dev_get_drvdata(dev);
+   atomic_inc(psy-use_cnt);
+   }
+
+   return psy;
 }
 EXPORT_SYMBOL_GPL(power_supply_get_by_phandle);
 #endif /* CONFIG_OF */
-- 
1.9.1

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


[PATCH v6 22/22] arm: mach-pxa: Decrement the power supply's device reference counter

2015-03-10 Thread Krzysztof Kozlowski
Use power_supply_put() to decrement the power supply's device reference
counter.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
Acked-by: Robert Jarzmik robert.jarz...@free.fr
Acked-by: Pavel Machek pa...@ucw.cz
---
 arch/arm/mach-pxa/raumfeld.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index a762b23ac830..6dc4f025e674 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -758,8 +758,10 @@ static void raumfeld_power_signal_charged(void)
struct power_supply *psy =
power_supply_get_by_name(raumfeld_power_supplicants[0]);
 
-   if (psy)
+   if (psy) {
power_supply_set_battery_charged(psy);
+   power_supply_put(psy);
+   }
 }
 
 static int raumfeld_power_resume(void)
-- 
1.9.1

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


[PATCH v6 18/22] x86/olpc/xo15/sci: Use newly added power_supply_put API

2015-03-10 Thread Krzysztof Kozlowski
Replace direct usage of put_device() with new API: power_supply_put().

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 arch/x86/platform/olpc/olpc-xo15-sci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c 
b/arch/x86/platform/olpc/olpc-xo15-sci.c
index 186634e9021d..55130846ac87 100644
--- a/arch/x86/platform/olpc/olpc-xo15-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo15-sci.c
@@ -83,7 +83,7 @@ static void battery_status_changed(void)
 
if (psy) {
power_supply_changed(psy);
-   put_device(psy-dev);
+   power_supply_put(psy);
}
 }
 
@@ -93,7 +93,7 @@ static void ac_status_changed(void)
 
if (psy) {
power_supply_changed(psy);
-   put_device(psy-dev);
+   power_supply_put(psy);
}
 }
 
-- 
1.9.1

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


[PATCH v6 10/22] power_supply: apm_power: Use power_supply_*() API for accessing function attrs

2015-03-10 Thread Krzysztof Kozlowski
Replace direct calls to power supply function attributes with wrappers.
Wrappers provide safe access in case of unregistering the power
supply (e.g. by removing the driver). Replace:
 - get_property - power_supply_get_property

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Jonghwa Lee jonghwa3@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/power/apm_power.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/apm_power.c b/drivers/power/apm_power.c
index 39763015b360..2206f9ff6488 100644
--- a/drivers/power/apm_power.c
+++ b/drivers/power/apm_power.c
@@ -15,10 +15,10 @@
 #include linux/apm-emulation.h
 
 
-#define PSY_PROP(psy, prop, val) (psy-get_property(psy, \
+#define PSY_PROP(psy, prop, val) (power_supply_get_property(psy, \
 POWER_SUPPLY_PROP_##prop, val))
 
-#define _MPSY_PROP(prop, val) (main_battery-get_property(main_battery, \
+#define _MPSY_PROP(prop, val) (power_supply_get_property(main_battery, \
 prop, val))
 
 #define MPSY_PROP(prop, val) _MPSY_PROP(POWER_SUPPLY_PROP_##prop, val)
-- 
1.9.1

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


[PATCH v6 12/22] power_supply: charger-manager: Use power_supply_*() API for accessing function attrs

2015-03-10 Thread Krzysztof Kozlowski
Replace direct calls to power supply function attributes with wrappers.
Wrappers provide safe access in case of unregistering the power
supply (e.g. by removing the driver). Replace:
 - get_property - power_supply_get_property

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Jonghwa Lee jonghwa3@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/power/charger-manager.c | 37 -
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index df27600880b9..a5b86b60d244 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -103,8 +103,8 @@ static bool is_batt_present(struct charger_manager *cm)
if (!psy)
break;
 
-   ret = psy-get_property(psy,
-   POWER_SUPPLY_PROP_PRESENT, val);
+   ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_PRESENT,
+   val);
if (ret == 0  val.intval)
present = true;
break;
@@ -118,8 +118,8 @@ static bool is_batt_present(struct charger_manager *cm)
continue;
}
 
-   ret = psy-get_property(psy, POWER_SUPPLY_PROP_PRESENT,
-   val);
+   ret = power_supply_get_property(psy,
+   POWER_SUPPLY_PROP_PRESENT, val);
if (ret == 0  val.intval) {
present = true;
break;
@@ -155,7 +155,8 @@ static bool is_ext_pwr_online(struct charger_manager *cm)
continue;
}
 
-   ret = psy-get_property(psy, POWER_SUPPLY_PROP_ONLINE, val);
+   ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
+   val);
if (ret == 0  val.intval) {
online = true;
break;
@@ -183,7 +184,7 @@ static int get_batt_uV(struct charger_manager *cm, int *uV)
if (!fuel_gauge)
return -ENODEV;
 
-   ret = fuel_gauge-get_property(fuel_gauge,
+   ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_VOLTAGE_NOW, val);
if (ret)
return ret;
@@ -223,7 +224,8 @@ static bool is_charging(struct charger_manager *cm)
}
 
/* 2. The charger should be online (ext-power) */
-   ret = psy-get_property(psy, POWER_SUPPLY_PROP_ONLINE, val);
+   ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
+   val);
if (ret) {
dev_warn(cm-dev, Cannot read ONLINE value from %s\n,
 cm-desc-psy_charger_stat[i]);
@@ -236,7 +238,8 @@ static bool is_charging(struct charger_manager *cm)
 * 3. The charger should not be FULL, DISCHARGING,
 * or NOT_CHARGING.
 */
-   ret = psy-get_property(psy, POWER_SUPPLY_PROP_STATUS, val);
+   ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_STATUS,
+   val);
if (ret) {
dev_warn(cm-dev, Cannot read STATUS value from %s\n,
 cm-desc-psy_charger_stat[i]);
@@ -279,7 +282,7 @@ static bool is_full_charged(struct charger_manager *cm)
val.intval = 0;
 
/* Not full if capacity of fuel gauge isn't full */
-   ret = fuel_gauge-get_property(fuel_gauge,
+   ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CHARGE_FULL, val);
if (!ret  val.intval  desc-fullbatt_full_capacity)
return true;
@@ -296,7 +299,7 @@ static bool is_full_charged(struct charger_manager *cm)
if (desc-fullbatt_soc  0) {
val.intval = 0;
 
-   ret = fuel_gauge-get_property(fuel_gauge,
+   ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CAPACITY, val);
if (!ret  val.intval = desc-fullbatt_soc)
return true;
@@ -580,7 +583,7 @@ static int cm_get_battery_temperature_by_psy(struct 
charger_manager *cm,
if (!fuel_gauge)
return -ENODEV;
 
-   return fuel_gauge-get_property(fuel_gauge,
+   return power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_TEMP,
(union power_supply_propval *)temp);
 }
@@ -900,7 +903,7 @@ static int

[PATCH v6 02/22] compal-laptop: Check return value of power_supply_register

2015-03-10 Thread Krzysztof Kozlowski
The return value of power_supply_register() call was not checked and
even on error probe() function returned 0. If registering failed then
during unbind the driver tried to unregister power supply which was not
actually registered.

This could lead to memory corruption because power_supply_unregister()
unconditionally cleans up given power supply.

Fix this by checking return status of power_supply_register() call. In
case of failure, clean up sysfs entries and fail the probe.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Fixes: 9be0fcb5ed46 (compal-laptop: add JHL90, battery  hwmon interface)
Cc: sta...@vger.kernel.org

---
Changes since previous submission:
1. Add Darren's ack.
   http://lkml.iu.edu/hypermail/linux/kernel/1503.0/01897.html
---
 drivers/platform/x86/compal-laptop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/compal-laptop.c 
b/drivers/platform/x86/compal-laptop.c
index eb9885e7fb0e..bceb30b539f3 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -1036,7 +1036,9 @@ static int compal_probe(struct platform_device *pdev)
 
/* Power supply */
initialize_power_supply_data(data);
-   power_supply_register(compal_device-dev, data-psy);
+   err = power_supply_register(compal_device-dev, data-psy);
+   if (err  0)
+   goto remove;
 
platform_set_drvdata(pdev, data);
 
-- 
1.9.1

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


[PATCH v6 06/22] power_supply: sysfs: Use power_supply_*() API for accessing function attrs

2015-03-10 Thread Krzysztof Kozlowski
Replace direct calls to power supply function attributes with wrappers.
Wrappers provide safe access in case of unregistering the power
supply (e.g. by removing the driver). Replace:
 - get_property - power_supply_get_property
 - set_property - power_supply_set_property
 - property_is_writeable - power_supply_property_is_writeable

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Jonghwa Lee jonghwa3@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/power/power_supply_sysfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/power/power_supply_sysfs.c 
b/drivers/power/power_supply_sysfs.c
index 62653f50a524..f817aab80813 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -76,7 +76,7 @@ static ssize_t power_supply_show_property(struct device *dev,
if (off == POWER_SUPPLY_PROP_TYPE) {
value.intval = psy-type;
} else {
-   ret = psy-get_property(psy, off, value);
+   ret = power_supply_get_property(psy, off, value);
 
if (ret  0) {
if (ret == -ENODATA)
@@ -125,7 +125,7 @@ static ssize_t power_supply_store_property(struct device 
*dev,
 
value.intval = long_val;
 
-   ret = psy-set_property(psy, off, value);
+   ret = power_supply_set_property(psy, off, value);
if (ret  0)
return ret;
 
@@ -223,7 +223,7 @@ static umode_t power_supply_attr_is_visible(struct kobject 
*kobj,
 
if (property == attrno) {
if (psy-property_is_writeable 
-   psy-property_is_writeable(psy, property)  0)
+   power_supply_property_is_writeable(psy, property)  
0)
mode |= S_IWUSR;
 
return mode;
-- 
1.9.1

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


[PATCH v6 08/22] power_supply: ab8500: Use power_supply_*() API for accessing function attrs

2015-03-10 Thread Krzysztof Kozlowski
Replace direct calls to power supply function attributes with wrappers.
Wrappers provide safe access in case of unregistering the power
supply (e.g. by removing the driver). Replace:
 - get_property - power_supply_get_property

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Jonghwa Lee jonghwa3@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Acked-by: Linus Walleij linus.wall...@linaro.org
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/power/ab8500_btemp.c| 2 +-
 drivers/power/ab8500_charger.c  | 2 +-
 drivers/power/ab8500_fg.c   | 2 +-
 drivers/power/abx500_chargalg.c | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c
index d5683f503a4e..4d18464d6400 100644
--- a/drivers/power/ab8500_btemp.c
+++ b/drivers/power/ab8500_btemp.c
@@ -938,7 +938,7 @@ static int ab8500_btemp_get_ext_psy_data(struct device 
*dev, void *data)
enum power_supply_property prop;
prop = ext-properties[j];
 
-   if (ext-get_property(ext, prop, ret))
+   if (power_supply_get_property(ext, prop, ret))
continue;
 
switch (prop) {
diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c
index cee9b9e46825..f9eb7fff1d65 100644
--- a/drivers/power/ab8500_charger.c
+++ b/drivers/power/ab8500_charger.c
@@ -1957,7 +1957,7 @@ static int ab8500_charger_get_ext_psy_data(struct device 
*dev, void *data)
enum power_supply_property prop;
prop = ext-properties[j];
 
-   if (ext-get_property(ext, prop, ret))
+   if (power_supply_get_property(ext, prop, ret))
continue;
 
switch (prop) {
diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c
index 73bdb4dc4142..7a2e3ac44cf3 100644
--- a/drivers/power/ab8500_fg.c
+++ b/drivers/power/ab8500_fg.c
@@ -2200,7 +2200,7 @@ static int ab8500_fg_get_ext_psy_data(struct device *dev, 
void *data)
enum power_supply_property prop;
prop = ext-properties[j];
 
-   if (ext-get_property(ext, prop, ret))
+   if (power_supply_get_property(ext, prop, ret))
continue;
 
switch (prop) {
diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c
index 0da4415cbc10..ac6f4a22f846 100644
--- a/drivers/power/abx500_chargalg.c
+++ b/drivers/power/abx500_chargalg.c
@@ -1001,7 +1001,7 @@ static int abx500_chargalg_get_ext_psy_data(struct device 
*dev, void *data)
 * property because of handling that sysfs entry on its own, this is
 * the place to get the battery capacity.
 */
-   if (!ext-get_property(ext, POWER_SUPPLY_PROP_CAPACITY, ret)) {
+   if (!power_supply_get_property(ext, POWER_SUPPLY_PROP_CAPACITY, ret)) {
di-batt_data.percent = ret.intval;
capacity_updated = true;
}
@@ -1019,7 +1019,7 @@ static int abx500_chargalg_get_ext_psy_data(struct device 
*dev, void *data)
ext-type == POWER_SUPPLY_TYPE_USB)
di-usb_chg = psy_to_ux500_charger(ext);
 
-   if (ext-get_property(ext, prop, ret))
+   if (power_supply_get_property(ext, prop, ret))
continue;
switch (prop) {
case POWER_SUPPLY_PROP_PRESENT:
-- 
1.9.1

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


[PATCH v6 16/22] power_supply: charger-manager: Decrement the power supply's device reference counter

2015-03-10 Thread Krzysztof Kozlowski
Use power_supply_put() to decrement the power supply's device reference
counter.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/power/charger-manager.c | 70 +++--
 1 file changed, 47 insertions(+), 23 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 5c47409c6889..e23b7ba2cbd2 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -107,6 +107,7 @@ static bool is_batt_present(struct charger_manager *cm)
val);
if (ret == 0  val.intval)
present = true;
+   power_supply_put(psy);
break;
case CM_CHARGER_STAT:
for (i = 0; cm-desc-psy_charger_stat[i]; i++) {
@@ -120,6 +121,7 @@ static bool is_batt_present(struct charger_manager *cm)
 
ret = power_supply_get_property(psy,
POWER_SUPPLY_PROP_PRESENT, val);
+   power_supply_put(psy);
if (ret == 0  val.intval) {
present = true;
break;
@@ -157,6 +159,7 @@ static bool is_ext_pwr_online(struct charger_manager *cm)
 
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
val);
+   power_supply_put(psy);
if (ret == 0  val.intval) {
online = true;
break;
@@ -186,6 +189,7 @@ static int get_batt_uV(struct charger_manager *cm, int *uV)
 
ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_VOLTAGE_NOW, val);
+   power_supply_put(fuel_gauge);
if (ret)
return ret;
 
@@ -229,10 +233,13 @@ static bool is_charging(struct charger_manager *cm)
if (ret) {
dev_warn(cm-dev, Cannot read ONLINE value from %s\n,
 cm-desc-psy_charger_stat[i]);
+   power_supply_put(psy);
continue;
}
-   if (val.intval == 0)
+   if (val.intval == 0) {
+   power_supply_put(psy);
continue;
+   }
 
/*
 * 3. The charger should not be FULL, DISCHARGING,
@@ -240,6 +247,7 @@ static bool is_charging(struct charger_manager *cm)
 */
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_STATUS,
val);
+   power_supply_put(psy);
if (ret) {
dev_warn(cm-dev, Cannot read STATUS value from %s\n,
 cm-desc-psy_charger_stat[i]);
@@ -267,6 +275,7 @@ static bool is_full_charged(struct charger_manager *cm)
struct charger_desc *desc = cm-desc;
union power_supply_propval val;
struct power_supply *fuel_gauge;
+   bool is_full = false;
int ret = 0;
int uV;
 
@@ -284,15 +293,19 @@ static bool is_full_charged(struct charger_manager *cm)
/* Not full if capacity of fuel gauge isn't full */
ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CHARGE_FULL, val);
-   if (!ret  val.intval  desc-fullbatt_full_capacity)
-   return true;
+   if (!ret  val.intval  desc-fullbatt_full_capacity) {
+   is_full = true;
+   goto out;
+   }
}
 
/* Full, if it's over the fullbatt voltage */
if (desc-fullbatt_uV  0) {
ret = get_batt_uV(cm, uV);
-   if (!ret  uV = desc-fullbatt_uV)
-   return true;
+   if (!ret  uV = desc-fullbatt_uV) {
+   is_full = true;
+   goto out;
+   }
}
 
/* Full, if the capacity is more than fullbatt_soc */
@@ -301,11 +314,15 @@ static bool is_full_charged(struct charger_manager *cm)
 
ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CAPACITY, val);
-   if (!ret  val.intval = desc-fullbatt_soc)
-   return true;
+   if (!ret  val.intval = desc-fullbatt_soc) {
+   is_full = true;
+   goto out;
+   }
}
 
-   return false;
+out:
+   power_supply_put(fuel_gauge);
+   return is_full;
 }
 
 /**
@@ -578,14 +595,18 @@ static int cm_get_battery_temperature_by_psy(struct 
charger_manager *cm,
int *temp

[PATCH v6 00/22] power_supply: Allow safe usage of power supply

2015-03-10 Thread Krzysztof Kozlowski
Hi,


The patchset fixes invalid memory accesses in certain race scenarios by
moving ownership of struct power_supply to the core. All drivers are
modified.


TLDR for driver and subsystem maintainers
=
Two patches of patchset change power_supply_register() function so in
the same time they touch all drivers. I am kindly asking for acks,
review and help in testing.

Especially please take a look at:
 - patch 4: power_supply: Move run-time configuration to separate structure
 - patch 13: power_supply: Change ownership from driver to core

I still need acks for changes in subsystems:
1. x86/olpc,
2. ACPI,
3. HID.


Problem to fix
==
Patchset tries to fix invalid memory accesses occurring in following
race scenario:

Thread 1: charger manager, CONSUMER
Thread 2: power supply driver, PROVIDER

THREAD 1 (consumer)THREAD 2 (provider)
======
psy = power_supply_get_by_name()
   Driver unbind, .remove
 power_supply_unregister()
 Device fully removed
psy-get_property()

The consumer of power supply will reference invalid memory because
the provider already freed it.


The fix
===
To properly fix the race the patchset:
1. Moves ownership of power_supply structure from driver (provider) to
   power supply core.
2. Adds power_supply_get_property()-like API for safe access by consumer.
3. Adds power_supply_put() which will reclaim memory.


I modifed all drivers I found. However I only compile tested them
(plus Smatch, Sparse and coccicheck). I did not test them on real
hardware (except max14577, max77693, max17040, max17042
and charger-manager).


What the patchset does in steps
===
1. Some preparation steps are necessary - patch 3 and 4. The driver
   implementing power supply won't be able to fill structure before
   calling power_supply_register(). So 'power_supply_config'
   is introduced in patch 4 (power_supply: Move run-time configuration
   to separate structure). Unfortunately this touches all drivers.
   *All drivers are touched.*

2. Safe API wrappers (and usage counter) are added (power_supply_*()).

3. Patch 13: ownership of 'struct power_supply' is moved from driver
   to the core.
   *All drivers are touched.*

4. power_supply_put() is added which reclaims resources.


Dependencies

The patchset is rebased on v4.0-rc1 and latest battery tree.

Bisect-ability is preserved. All later patches depend on previous ones
so it could be pulled in steps, but cherry-picking won't work.

Patchset is available also here:
https://git.linaro.org/people/marek.szyprowski/linux-srpol.git
branch: v4.0-rc1-power-supply-core-ownership


Changes since v5

1. Add two fixes for compal-laptop to beginning of this patchset
   to avoid conflicts. They touch the same place as this patchset.
   I got acks for them (Darren Hart).
2. Rebased on current battery tree. This introduced new changes:
   - updated bq27x00_battery driver,
   - new driver: axp288_fuel_gauge.
3. Add acks: Pavel Machek's (patch 22/22), Darren Hart (p. 1 and 2),
   Guenter Roeck (p. 1).

Changes since v4

1. Rebased on current battery tree. This introduced new changes:
   - new devm-like register functions,
   - new driver: da9150-charger.
2. Add acks: Darren Hart (compal-laptop.c, p. 11), Lee Jones
   (mfd, p. 11).

Changes since v3

1. Fix Jonghwa's email in his ack (spotted by Stefan Wahren)
2. Update power_supply_register() documentation.
3. Fix putting the reference to power supply in bq2415x_charger.c (put
   it when it is non-NULL).
4. Add acks: Robert Jarzmik (patch 20), Darren Hart (p. 2), Pavel
   Machek (p. 1-3), Marc Dietrich (p. 2 and 11).

Changes since v2

1. Rewrite all drivers to new power_supply_register().
2. Add reviewed-by Bartlomiej Zolnierkiewicz (internal review)
3. Add reviewed-by Sebastian Reichel [2] (to patches which I did not
   change in major way between v2 and v3).
4. Use atomic usage counter of power supply on each of:
   a. register/unregister,
   b. get/put.

Changes since v1

1. Add new patches (1, 2, 11, 19).
2. Preserved ack-s where there weren't any changes.
3. Patch 3: Add use counter.
4. Patch 3: Don't add wrapper for set_charged() because already exists
   one.


[1] https://lkml.org/lkml/2015/1/21/471
[2] https://lkml.org/lkml/2015/2/20/150

Best regards,
Krzysztof


Krzysztof Kozlowski (22):
  compal-laptop: Fix leaking hwmon device
  compal-laptop: Check return value of power_supply_register
  power_supply: Add driver private data
  power_supply: Move run-time configuration to separate structure
  power_supply: Add API for safe access of power supply function attrs
  power_supply: sysfs: Use power_supply_*() API for accessing function
attrs
  power_supply: 88pm860x_charger

[PATCH v6 03/22] power_supply: Add driver private data

2015-03-10 Thread Krzysztof Kozlowski
Allow drivers to store private data inside power_supply structure for
later usage in power supply operations.

Usage of driver private data is necessary to access driver's state
container object from power supply calls (like get_property()) if struct
'power_supply' is a stored there as a pointer, for example:

struct some_driver_info {
struct i2c_client   *client;
struct power_supply *power_supply;
...
}

In such case one cannot use container_of() and must store pointer to
state container as private data.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
Acked-by: Pavel Machek pa...@ucw.cz
---
 drivers/power/power_supply_core.c | 6 ++
 include/linux/power_supply.h  | 4 
 2 files changed, 10 insertions(+)

diff --git a/drivers/power/power_supply_core.c 
b/drivers/power/power_supply_core.c
index 44c810456212..1c0978f961ea 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -674,6 +674,12 @@ void power_supply_unregister(struct power_supply *psy)
 }
 EXPORT_SYMBOL_GPL(power_supply_unregister);
 
+void *power_supply_get_drvdata(struct power_supply *psy)
+{
+   return psy-drv_data;
+}
+EXPORT_SYMBOL_GPL(power_supply_get_drvdata);
+
 static int __init power_supply_class_init(void)
 {
power_supply_class = class_create(THIS_MODULE, power_supply);
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index f606d6b4bd56..e30d85c0158d 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -209,6 +209,9 @@ struct power_supply {
/* For APM emulation, think legacy userspace. */
int use_for_apm;
 
+   /* Driver private data */
+   void *drv_data;
+
/* private */
struct device *dev;
struct work_struct changed_work;
@@ -285,6 +288,7 @@ extern int devm_power_supply_register_no_ws(struct device 
*parent,
 extern void power_supply_unregister(struct power_supply *psy);
 extern int power_supply_powers(struct power_supply *psy, struct device *dev);
 
+extern void *power_supply_get_drvdata(struct power_supply *psy);
 /* For APM emulation, think legacy userspace. */
 extern struct class *power_supply_class;
 
-- 
1.9.1

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


[PATCH v6 01/22] compal-laptop: Fix leaking hwmon device

2015-03-10 Thread Krzysztof Kozlowski
The commit c2be45f09bb0 (compal-laptop: Use
devm_hwmon_device_register_with_groups) wanted to change the
registering of hwmon device to resource-managed version. It mostly did
it except the main thing - it forgot to use devm-like function so the
hwmon device leaked after device removal or probe failure.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Fixes: c2be45f09bb0 (compal-laptop: Use 
devm_hwmon_device_register_with_groups)
Cc: sta...@vger.kernel.org
Acked-by: Guenter Roeck li...@roeck-us.net
Acked-by: Darren Hart dvh...@linux.intel.com

---
Changes since previous submission:
1. Add Darren's ack.
   http://lkml.iu.edu/hypermail/linux/kernel/1503.0/01895.html
---
 drivers/platform/x86/compal-laptop.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/compal-laptop.c 
b/drivers/platform/x86/compal-laptop.c
index 15c0fab2bfa1..eb9885e7fb0e 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -1026,9 +1026,9 @@ static int compal_probe(struct platform_device *pdev)
if (err)
return err;
 
-   hwmon_dev = hwmon_device_register_with_groups(pdev-dev,
- compal, data,
- compal_hwmon_groups);
+   hwmon_dev = devm_hwmon_device_register_with_groups(pdev-dev,
+  compal, data,
+  compal_hwmon_groups);
if (IS_ERR(hwmon_dev)) {
err = PTR_ERR(hwmon_dev);
goto remove;
-- 
1.9.1

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


[PATCH v6 21/22] mfd: ab8500: Decrement the power supply's device reference counter

2015-03-10 Thread Krzysztof Kozlowski
Use power_supply_put() to decrement the power supply's device reference
counter.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Acked-by: Linus Walleij linus.wall...@linaro.org
Acked-by: Lee Jones lee.jo...@linaro.org
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/mfd/ab8500-sysctrl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
index d4a4b24be7c6..0d1825696153 100644
--- a/drivers/mfd/ab8500-sysctrl.c
+++ b/drivers/mfd/ab8500-sysctrl.c
@@ -51,6 +51,7 @@ static void ab8500_power_off(void)
 
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
val);
+   power_supply_put(psy);
 
if (!ret  val.intval) {
charger_present = true;
@@ -73,6 +74,7 @@ static void ab8500_power_off(void)
   pss[i]);
machine_restart(charging);
}
+   power_supply_put(psy);
}
 
 shutdown:
-- 
1.9.1

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


[PATCH v6 14/22] power_supply: Add power_supply_put for decrementing device reference counter

2015-03-10 Thread Krzysztof Kozlowski
The power_supply_get_by_phandle() and power_supply_get_by_name() use
function class_find_device() for obtaining the reference to power
supply. Each use of class_find_device() increases the power supply's
device reference counter.

However the reference counter was not decreased by users of this API.
Thus final device_unregister() call from power_supply_unregister() could
not release the device and clean up its resources. This lead to memory
leak if at least once power_supply_get_by_*() was called between
registering and unregistering the power supply.

Add and document new API power_supply_put() for decrementing the
reference counter.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/power/power_supply_core.c | 38 ++
 include/linux/power_supply.h  |  1 +
 2 files changed, 39 insertions(+)

diff --git a/drivers/power/power_supply_core.c 
b/drivers/power/power_supply_core.c
index e51405b176c8..b4ec14683b7f 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -336,6 +336,17 @@ static int power_supply_match_device_by_name(struct device 
*dev, const void *dat
return strcmp(psy-desc-name, name) == 0;
 }
 
+/**
+ * power_supply_get_by_name() - Search for a power supply and returns its ref
+ * @name: Power supply name to fetch
+ *
+ * If power supply was found, it increases reference count for the
+ * internal power supply's device. The user should power_supply_put()
+ * after usage.
+ *
+ * Return: On success returns a reference to a power supply with
+ * matching name equals to @name, a NULL otherwise.
+ */
 struct power_supply *power_supply_get_by_name(const char *name)
 {
struct device *dev = class_find_device(power_supply_class, NULL, name,
@@ -345,12 +356,39 @@ struct power_supply *power_supply_get_by_name(const char 
*name)
 }
 EXPORT_SYMBOL_GPL(power_supply_get_by_name);
 
+/**
+ * power_supply_put() - Drop reference obtained with power_supply_get_by_name
+ * @psy: Reference to put
+ *
+ * The reference to power supply should be put before unregistering
+ * the power supply.
+ */
+void power_supply_put(struct power_supply *psy)
+{
+   might_sleep();
+
+   put_device(psy-dev);
+}
+EXPORT_SYMBOL_GPL(power_supply_put);
+
 #ifdef CONFIG_OF
 static int power_supply_match_device_node(struct device *dev, const void *data)
 {
return dev-parent  dev-parent-of_node == data;
 }
 
+/**
+ * power_supply_get_by_phandle() - Search for a power supply and returns its 
ref
+ * @np: Pointer to device node holding phandle property
+ * @phandle_name: Name of property holding a power supply name
+ *
+ * If power supply was found, it increases reference count for the
+ * internal power supply's device. The user should power_supply_put()
+ * after usage.
+ *
+ * Return: On success returns a reference to a power supply with
+ * matching name equals to value under @property, NULL or ERR_PTR otherwise.
+ */
 struct power_supply *power_supply_get_by_phandle(struct device_node *np,
const char *property)
 {
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index ea15eb68f609..75a1dd8dc56e 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -282,6 +282,7 @@ extern struct atomic_notifier_head power_supply_notifier;
 extern int power_supply_reg_notifier(struct notifier_block *nb);
 extern void power_supply_unreg_notifier(struct notifier_block *nb);
 extern struct power_supply *power_supply_get_by_name(const char *name);
+extern void power_supply_put(struct power_supply *psy);
 #ifdef CONFIG_OF
 extern struct power_supply *power_supply_get_by_phandle(struct device_node *np,
const char *property);
-- 
1.9.1

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


[PATCH v6 11/22] power_supply: bq2415x_charger: Use power_supply_*() API for accessing function attrs

2015-03-10 Thread Krzysztof Kozlowski
Replace direct calls to power supply function attributes with wrappers.
Wrappers provide safe access in case of unregistering the power
supply (e.g. by removing the driver). Replace:
 - get_property - power_supply_get_property

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Jonghwa Lee jonghwa3@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/power/bq2415x_charger.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
index 9b509025d687..d31ccc7935d0 100644
--- a/drivers/power/bq2415x_charger.c
+++ b/drivers/power/bq2415x_charger.c
@@ -809,7 +809,8 @@ static int bq2415x_notifier_call(struct notifier_block *nb,
 
dev_dbg(bq-dev, notifier call was called\n);
 
-   ret = psy-get_property(psy, POWER_SUPPLY_PROP_CURRENT_MAX, prop);
+   ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_CURRENT_MAX,
+   prop);
if (ret != 0)
return NOTIFY_OK;
 
-- 
1.9.1

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


[PATCH v5 16/20] x86/olpc/xo15/sci: Use newly added power_supply_put API

2015-02-27 Thread Krzysztof Kozlowski
Replace direct usage of put_device() with new API: power_supply_put().

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 arch/x86/platform/olpc/olpc-xo15-sci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c 
b/arch/x86/platform/olpc/olpc-xo15-sci.c
index 186634e9021d..55130846ac87 100644
--- a/arch/x86/platform/olpc/olpc-xo15-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo15-sci.c
@@ -83,7 +83,7 @@ static void battery_status_changed(void)
 
if (psy) {
power_supply_changed(psy);
-   put_device(psy-dev);
+   power_supply_put(psy);
}
 }
 
@@ -93,7 +93,7 @@ static void ac_status_changed(void)
 
if (psy) {
power_supply_changed(psy);
-   put_device(psy-dev);
+   power_supply_put(psy);
}
 }
 
-- 
1.9.1

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


[PATCH v5 15/20] x86/olpc/xo1/sci: Use newly added power_supply_put API

2015-02-27 Thread Krzysztof Kozlowski
Replace direct usage of put_device() with new API: power_supply_put().

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 arch/x86/platform/olpc/olpc-xo1-sci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c 
b/arch/x86/platform/olpc/olpc-xo1-sci.c
index e4ed28bbf79d..7fa8b3b53bc0 100644
--- a/arch/x86/platform/olpc/olpc-xo1-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
@@ -61,7 +61,7 @@ static void battery_status_changed(void)
 
if (psy) {
power_supply_changed(psy);
-   put_device(psy-dev);
+   power_supply_put(psy);
}
 }
 
@@ -71,7 +71,7 @@ static void ac_status_changed(void)
 
if (psy) {
power_supply_changed(psy);
-   put_device(psy-dev);
+   power_supply_put(psy);
}
 }
 
-- 
1.9.1

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


[PATCH v5 02/20] power_supply: Move run-time configuration to separate structure

2015-02-27 Thread Krzysztof Kozlowski
Add new structure 'power_supply_config' for holding run-time
initialization data like of_node, supplies and private driver data.

The power_supply_register() function is changed so all power supply
drivers need updating.

When registering the power supply this new 'power_supply_config' should be
used instead of directly initializing 'struct power_supply'. This allows
changing the ownership of power_supply structure from driver to the
power supply core in next patches.

When a driver does not use of_node or supplies then it should use NULL
as config. If driver uses of_node or supplies then it should allocate
config on stack and initialize it with proper values.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz

[for the nvec part]
Reviewed-by: Marc Dietrich marvi...@gmx.de

[for drivers/platform/x86/compal-laptop.c]
Reviewed-by: Darren Hart dvh...@linux.intel.com
---
 drivers/acpi/ac.c |  2 +-
 drivers/acpi/battery.c|  3 ++-
 drivers/acpi/sbs.c|  4 ++--
 drivers/hid/hid-input.c   |  2 +-
 drivers/hid/hid-sony.c|  2 +-
 drivers/hid/hid-wiimote-modules.c |  2 +-
 drivers/hid/wacom_sys.c   |  5 +++--
 drivers/platform/x86/compal-laptop.c  |  2 +-
 drivers/power/88pm860x_battery.c  |  2 +-
 drivers/power/88pm860x_charger.c  |  7 ---
 drivers/power/ab8500_btemp.c  |  7 ---
 drivers/power/ab8500_charger.c| 15 +--
 drivers/power/ab8500_fg.c |  8 +---
 drivers/power/abx500_chargalg.c   |  8 +---
 drivers/power/bq2415x_charger.c   |  2 +-
 drivers/power/bq24190_charger.c   |  4 ++--
 drivers/power/bq24735-charger.c   | 10 ++
 drivers/power/bq27x00_battery.c   |  2 +-
 drivers/power/charger-manager.c   |  2 +-
 drivers/power/collie_battery.c|  4 ++--
 drivers/power/da9030_battery.c|  2 +-
 drivers/power/da9052-battery.c|  2 +-
 drivers/power/da9150-charger.c|  4 ++--
 drivers/power/ds2760_battery.c|  2 +-
 drivers/power/ds2780_battery.c|  2 +-
 drivers/power/ds2781_battery.c|  2 +-
 drivers/power/ds2782_battery.c|  2 +-
 drivers/power/generic-adc-battery.c   |  2 +-
 drivers/power/goldfish_battery.c  |  4 ++--
 drivers/power/gpio-charger.c  | 10 ++
 drivers/power/intel_mid_battery.c |  4 ++--
 drivers/power/ipaq_micro_battery.c|  4 ++--
 drivers/power/isp1704_charger.c   |  2 +-
 drivers/power/jz4740-battery.c|  2 +-
 drivers/power/lp8727_charger.c| 14 +++---
 drivers/power/lp8788-charger.c| 11 +++
 drivers/power/ltc2941-battery-gauge.c |  2 +-
 drivers/power/max14577_charger.c  |  2 +-
 drivers/power/max17040_battery.c  |  2 +-
 drivers/power/max17042_battery.c  |  2 +-
 drivers/power/max77693_charger.c  |  2 +-
 drivers/power/max8903_charger.c   |  2 +-
 drivers/power/max8925_power.c | 14 +++---
 drivers/power/max8997_charger.c   |  2 +-
 drivers/power/max8998_charger.c   |  2 +-
 drivers/power/olpc_battery.c  |  4 ++--
 drivers/power/pcf50633-charger.c  | 16 +++-
 drivers/power/pda_power.c | 18 --
 drivers/power/pm2301_charger.c|  8 +---
 drivers/power/pmu_battery.c   |  4 ++--
 drivers/power/power_supply_core.c | 30 +-
 drivers/power/rt5033_battery.c|  2 +-
 drivers/power/rx51_battery.c  |  2 +-
 drivers/power/s3c_adc_battery.c   |  4 ++--
 drivers/power/sbs-battery.c   |  6 --
 drivers/power/smb347-charger.c| 13 ++---
 drivers/power/test_power.c| 21 -
 drivers/power/tosa_battery.c  |  6 +++---
 drivers/power/tps65090-charger.c  | 10 ++
 drivers/power/twl4030_charger.c   |  4 ++--
 drivers/power/twl4030_madc_battery.c  |  2 +-
 drivers/power/wm831x_backup.c |  2 +-
 drivers/power/wm831x_power.c  |  6 +++---
 drivers/power/wm8350_power.c  |  6 +++---
 drivers/power/wm97xx_battery.c|  2 +-
 drivers/power/z2_battery.c|  2 +-
 drivers/staging/nvec/nvec_power.c |  7 ---
 include/linux/power_supply.h  | 22 ++
 68 files changed, 223 insertions(+), 166 deletions(-)

diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 36b0e61f9c09..8bf516885ede 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -351,7 +351,7 @@ static int acpi_ac_add(struct acpi_device *device)
ac-charger.properties = ac_props;
ac-charger.num_properties = ARRAY_SIZE(ac_props);
ac-charger.get_property = get_ac_property;
-   result = power_supply_register(ac-device-dev, ac-charger);
+   result = power_supply_register(ac-device-dev, ac-charger, NULL

[PATCH v5 09/20] power_supply: bq2415x_charger: Use power_supply_*() API for accessing function attrs

2015-02-27 Thread Krzysztof Kozlowski
Replace direct calls to power supply function attributes with wrappers.
Wrappers provide safe access in case of unregistering the power
supply (e.g. by removing the driver). Replace:
 - get_property - power_supply_get_property

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Jonghwa Lee jonghwa3@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/power/bq2415x_charger.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
index d7357cbc3e3e..7985e4b1fc7e 100644
--- a/drivers/power/bq2415x_charger.c
+++ b/drivers/power/bq2415x_charger.c
@@ -810,7 +810,8 @@ static int bq2415x_notifier_call(struct notifier_block *nb,
 
dev_dbg(bq-dev, notifier call was called\n);
 
-   ret = psy-get_property(psy, POWER_SUPPLY_PROP_CURRENT_MAX, prop);
+   ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_CURRENT_MAX,
+   prop);
if (ret != 0)
return NOTIFY_OK;
 
-- 
1.9.1

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


[PATCH v5 19/20] mfd: ab8500: Decrement the power supply's device reference counter

2015-02-27 Thread Krzysztof Kozlowski
Use power_supply_put() to decrement the power supply's device reference
counter.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Acked-by: Linus Walleij linus.wall...@linaro.org
Acked-by: Lee Jones lee.jo...@linaro.org
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/mfd/ab8500-sysctrl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
index d4a4b24be7c6..0d1825696153 100644
--- a/drivers/mfd/ab8500-sysctrl.c
+++ b/drivers/mfd/ab8500-sysctrl.c
@@ -51,6 +51,7 @@ static void ab8500_power_off(void)
 
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
val);
+   power_supply_put(psy);
 
if (!ret  val.intval) {
charger_present = true;
@@ -73,6 +74,7 @@ static void ab8500_power_off(void)
   pss[i]);
machine_restart(charging);
}
+   power_supply_put(psy);
}
 
 shutdown:
-- 
1.9.1

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


[PATCH v5 14/20] power_supply: charger-manager: Decrement the power supply's device reference counter

2015-02-27 Thread Krzysztof Kozlowski
Use power_supply_put() to decrement the power supply's device reference
counter.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/power/charger-manager.c | 70 +++--
 1 file changed, 47 insertions(+), 23 deletions(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 5c47409c6889..e23b7ba2cbd2 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -107,6 +107,7 @@ static bool is_batt_present(struct charger_manager *cm)
val);
if (ret == 0  val.intval)
present = true;
+   power_supply_put(psy);
break;
case CM_CHARGER_STAT:
for (i = 0; cm-desc-psy_charger_stat[i]; i++) {
@@ -120,6 +121,7 @@ static bool is_batt_present(struct charger_manager *cm)
 
ret = power_supply_get_property(psy,
POWER_SUPPLY_PROP_PRESENT, val);
+   power_supply_put(psy);
if (ret == 0  val.intval) {
present = true;
break;
@@ -157,6 +159,7 @@ static bool is_ext_pwr_online(struct charger_manager *cm)
 
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
val);
+   power_supply_put(psy);
if (ret == 0  val.intval) {
online = true;
break;
@@ -186,6 +189,7 @@ static int get_batt_uV(struct charger_manager *cm, int *uV)
 
ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_VOLTAGE_NOW, val);
+   power_supply_put(fuel_gauge);
if (ret)
return ret;
 
@@ -229,10 +233,13 @@ static bool is_charging(struct charger_manager *cm)
if (ret) {
dev_warn(cm-dev, Cannot read ONLINE value from %s\n,
 cm-desc-psy_charger_stat[i]);
+   power_supply_put(psy);
continue;
}
-   if (val.intval == 0)
+   if (val.intval == 0) {
+   power_supply_put(psy);
continue;
+   }
 
/*
 * 3. The charger should not be FULL, DISCHARGING,
@@ -240,6 +247,7 @@ static bool is_charging(struct charger_manager *cm)
 */
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_STATUS,
val);
+   power_supply_put(psy);
if (ret) {
dev_warn(cm-dev, Cannot read STATUS value from %s\n,
 cm-desc-psy_charger_stat[i]);
@@ -267,6 +275,7 @@ static bool is_full_charged(struct charger_manager *cm)
struct charger_desc *desc = cm-desc;
union power_supply_propval val;
struct power_supply *fuel_gauge;
+   bool is_full = false;
int ret = 0;
int uV;
 
@@ -284,15 +293,19 @@ static bool is_full_charged(struct charger_manager *cm)
/* Not full if capacity of fuel gauge isn't full */
ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CHARGE_FULL, val);
-   if (!ret  val.intval  desc-fullbatt_full_capacity)
-   return true;
+   if (!ret  val.intval  desc-fullbatt_full_capacity) {
+   is_full = true;
+   goto out;
+   }
}
 
/* Full, if it's over the fullbatt voltage */
if (desc-fullbatt_uV  0) {
ret = get_batt_uV(cm, uV);
-   if (!ret  uV = desc-fullbatt_uV)
-   return true;
+   if (!ret  uV = desc-fullbatt_uV) {
+   is_full = true;
+   goto out;
+   }
}
 
/* Full, if the capacity is more than fullbatt_soc */
@@ -301,11 +314,15 @@ static bool is_full_charged(struct charger_manager *cm)
 
ret = power_supply_get_property(fuel_gauge,
POWER_SUPPLY_PROP_CAPACITY, val);
-   if (!ret  val.intval = desc-fullbatt_soc)
-   return true;
+   if (!ret  val.intval = desc-fullbatt_soc) {
+   is_full = true;
+   goto out;
+   }
}
 
-   return false;
+out:
+   power_supply_put(fuel_gauge);
+   return is_full;
 }
 
 /**
@@ -578,14 +595,18 @@ static int cm_get_battery_temperature_by_psy(struct 
charger_manager *cm,
int *temp

[PATCH v5 13/20] power_supply: Increment power supply use counter when obtaining references

2015-02-27 Thread Krzysztof Kozlowski
Increment the power_supply.use_cnt usage counter on:
 - power_supply_get_by_phandle()
 - power_supply_get_by_name()
and decrement it on power_supply_put() call.

This helps tracking of valid usage of power supply instance by
consumers. The usage counter itself also allows safe calling of
power_supply_get_property-like functions even when driver unregisters
this power supply.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
---
 drivers/power/power_supply_core.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/power/power_supply_core.c 
b/drivers/power/power_supply_core.c
index b4ec14683b7f..2ed4a4a6b3c5 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -349,10 +349,16 @@ static int power_supply_match_device_by_name(struct 
device *dev, const void *dat
  */
 struct power_supply *power_supply_get_by_name(const char *name)
 {
+   struct power_supply *psy = NULL;
struct device *dev = class_find_device(power_supply_class, NULL, name,
power_supply_match_device_by_name);
 
-   return dev ? dev_get_drvdata(dev) : NULL;
+   if (dev) {
+   psy = dev_get_drvdata(dev);
+   atomic_inc(psy-use_cnt);
+   }
+
+   return psy;
 }
 EXPORT_SYMBOL_GPL(power_supply_get_by_name);
 
@@ -367,6 +373,7 @@ void power_supply_put(struct power_supply *psy)
 {
might_sleep();
 
+   atomic_dec(psy-use_cnt);
put_device(psy-dev);
 }
 EXPORT_SYMBOL_GPL(power_supply_put);
@@ -393,6 +400,7 @@ struct power_supply *power_supply_get_by_phandle(struct 
device_node *np,
const char *property)
 {
struct device_node *power_supply_np;
+   struct power_supply *psy = NULL;
struct device *dev;
 
power_supply_np = of_parse_phandle(np, property, 0);
@@ -404,7 +412,12 @@ struct power_supply *power_supply_get_by_phandle(struct 
device_node *np,
 
of_node_put(power_supply_np);
 
-   return dev ? dev_get_drvdata(dev) : NULL;
+   if (dev) {
+   psy = dev_get_drvdata(dev);
+   atomic_inc(psy-use_cnt);
+   }
+
+   return psy;
 }
 EXPORT_SYMBOL_GPL(power_supply_get_by_phandle);
 #endif /* CONFIG_OF */
-- 
1.9.1

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


[PATCH v5 18/20] power_supply: bq2415x_charger: Decrement the power supply's device reference counter

2015-02-27 Thread Krzysztof Kozlowski
Use power_supply_put() to decrement the power supply's device reference
counter (increased by power_supply_get_by_name() or
power_supply_get_by_phandle()).

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/power/bq2415x_charger.c | 31 ++-
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
index 413fcaa0f15c..10a81a8f928f 100644
--- a/drivers/power/bq2415x_charger.c
+++ b/drivers/power/bq2415x_charger.c
@@ -1595,27 +1595,27 @@ static int bq2415x_probe(struct i2c_client *client,
ret = of_property_read_u32(np, ti,current-limit,
bq-init_data.current_limit);
if (ret)
-   goto error_2;
+   goto error_3;
ret = of_property_read_u32(np, ti,weak-battery-voltage,
bq-init_data.weak_battery_voltage);
if (ret)
-   goto error_2;
+   goto error_3;
ret = of_property_read_u32(np, ti,battery-regulation-voltage,
bq-init_data.battery_regulation_voltage);
if (ret)
-   goto error_2;
+   goto error_3;
ret = of_property_read_u32(np, ti,charge-current,
bq-init_data.charge_current);
if (ret)
-   goto error_2;
+   goto error_3;
ret = of_property_read_u32(np, ti,termination-current,
bq-init_data.termination_current);
if (ret)
-   goto error_2;
+   goto error_3;
ret = of_property_read_u32(np, ti,resistor-sense,
bq-init_data.resistor_sense);
if (ret)
-   goto error_2;
+   goto error_3;
} else {
memcpy(bq-init_data, pdata, sizeof(bq-init_data));
}
@@ -1625,19 +1625,19 @@ static int bq2415x_probe(struct i2c_client *client,
ret = bq2415x_power_supply_init(bq);
if (ret) {
dev_err(bq-dev, failed to register power supply: %d\n, ret);
-   goto error_2;
+   goto error_3;
}
 
ret = bq2415x_sysfs_init(bq);
if (ret) {
dev_err(bq-dev, failed to create sysfs entries: %d\n, ret);
-   goto error_3;
+   goto error_4;
}
 
ret = bq2415x_set_defaults(bq);
if (ret) {
dev_err(bq-dev, failed to set default values: %d\n, ret);
-   goto error_4;
+   goto error_5;
}
 
if (bq-notify_psy) {
@@ -1645,7 +1645,7 @@ static int bq2415x_probe(struct i2c_client *client,
ret = power_supply_reg_notifier(bq-nb);
if (ret) {
dev_err(bq-dev, failed to reg notifier: %d\n, ret);
-   goto error_5;
+   goto error_6;
}
 
/* Query for initial reported_mode and set it */
@@ -1665,11 +1665,14 @@ static int bq2415x_probe(struct i2c_client *client,
dev_info(bq-dev, driver registered\n);
return 0;
 
+error_6:
 error_5:
-error_4:
bq2415x_sysfs_exit(bq);
-error_3:
+error_4:
bq2415x_power_supply_exit(bq);
+error_3:
+   if (bq-notify_psy)
+   power_supply_put(bq-notify_psy);
 error_2:
kfree(name);
 error_1:
@@ -1686,8 +1689,10 @@ static int bq2415x_remove(struct i2c_client *client)
 {
struct bq2415x_device *bq = i2c_get_clientdata(client);
 
-   if (bq-notify_psy)
+   if (bq-notify_psy) {
power_supply_unreg_notifier(bq-nb);
+   power_supply_put(bq-notify_psy);
+   }
 
bq2415x_sysfs_exit(bq);
bq2415x_power_supply_exit(bq);
-- 
1.9.1

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


[PATCH v5 20/20] arm: mach-pxa: Decrement the power supply's device reference counter

2015-02-27 Thread Krzysztof Kozlowski
Use power_supply_put() to decrement the power supply's device reference
counter.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
Acked-by: Robert Jarzmik robert.jarz...@free.fr
---
 arch/arm/mach-pxa/raumfeld.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index a762b23ac830..6dc4f025e674 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -758,8 +758,10 @@ static void raumfeld_power_signal_charged(void)
struct power_supply *psy =
power_supply_get_by_name(raumfeld_power_supplicants[0]);
 
-   if (psy)
+   if (psy) {
power_supply_set_battery_charged(psy);
+   power_supply_put(psy);
+   }
 }
 
 static int raumfeld_power_resume(void)
-- 
1.9.1

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


[PATCH v5 17/20] power_supply: 88pm860x_charger: Decrement the power supply's device reference counter

2015-02-27 Thread Krzysztof Kozlowski
Use power_supply_put() to decrement the power supply's device reference
counter.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/power/88pm860x_charger.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/power/88pm860x_charger.c b/drivers/power/88pm860x_charger.c
index a7f32a5b2299..bf822aa00c14 100644
--- a/drivers/power/88pm860x_charger.c
+++ b/drivers/power/88pm860x_charger.c
@@ -298,13 +298,18 @@ static int set_charging_fsm(struct pm860x_charger_info 
*info)
return -EINVAL;
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_VOLTAGE_NOW,
data);
-   if (ret)
+   if (ret) {
+   power_supply_put(psy);
return ret;
+   }
vbatt = data.intval / 1000;
 
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_PRESENT, data);
-   if (ret)
+   if (ret) {
+   power_supply_put(psy);
return ret;
+   }
+   power_supply_put(psy);
 
mutex_lock(info-lock);
info-present = data.intval;
@@ -447,6 +452,7 @@ static irqreturn_t pm860x_temp_handler(int irq, void *data)
 
set_charging_fsm(info);
 out:
+   power_supply_put(psy);
return IRQ_HANDLED;
 }
 
@@ -507,6 +513,7 @@ static irqreturn_t pm860x_done_handler(int irq, void *data)
 
 out:
mutex_unlock(info-lock);
+   power_supply_put(psy);
dev_dbg(info-dev, %s, Allowed: %d\n, __func__, info-allowed);
set_charging_fsm(info);
 
-- 
1.9.1

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


[PATCH v5 05/20] power_supply: 88pm860x_charger: Use power_supply_*() API for accessing function attrs

2015-02-27 Thread Krzysztof Kozlowski
Replace direct calls to power supply function attributes with wrappers.
Wrappers provide safe access in case of unregistering the power
supply (e.g. by removing the driver). Replace:
 - get_property - power_supply_get_property
 - set_property - power_supply_set_property

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Jonghwa Lee jonghwa3@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/power/88pm860x_charger.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/power/88pm860x_charger.c b/drivers/power/88pm860x_charger.c
index ac352a6c03ea..98e31419d9cf 100644
--- a/drivers/power/88pm860x_charger.c
+++ b/drivers/power/88pm860x_charger.c
@@ -296,12 +296,13 @@ static int set_charging_fsm(struct pm860x_charger_info 
*info)
psy = power_supply_get_by_name(pm860x_supplied_to[0]);
if (!psy)
return -EINVAL;
-   ret = psy-get_property(psy, POWER_SUPPLY_PROP_VOLTAGE_NOW, data);
+   ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_VOLTAGE_NOW,
+   data);
if (ret)
return ret;
vbatt = data.intval / 1000;
 
-   ret = psy-get_property(psy, POWER_SUPPLY_PROP_PRESENT, data);
+   ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_PRESENT, data);
if (ret)
return ret;
 
@@ -430,7 +431,7 @@ static irqreturn_t pm860x_temp_handler(int irq, void *data)
psy = power_supply_get_by_name(pm860x_supplied_to[0]);
if (!psy)
goto out;
-   ret = psy-get_property(psy, POWER_SUPPLY_PROP_TEMP, temp);
+   ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_TEMP, temp);
if (ret)
goto out;
value = temp.intval / 10;
@@ -485,7 +486,8 @@ static irqreturn_t pm860x_done_handler(int irq, void *data)
psy = power_supply_get_by_name(pm860x_supplied_to[0]);
if (!psy)
goto out;
-   ret = psy-get_property(psy, POWER_SUPPLY_PROP_VOLTAGE_NOW, val);
+   ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_VOLTAGE_NOW,
+   val);
if (ret)
goto out;
vbatt = val.intval / 1000;
@@ -500,7 +502,8 @@ static irqreturn_t pm860x_done_handler(int irq, void *data)
if (ret  0)
goto out;
if (vbatt  CHARGE_THRESHOLD  ret  STATUS2_CHG)
-   psy-set_property(psy, POWER_SUPPLY_PROP_CHARGE_FULL, val);
+   power_supply_set_property(psy, POWER_SUPPLY_PROP_CHARGE_FULL,
+   val);
 
 out:
mutex_unlock(info-lock);
-- 
1.9.1

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


[PATCH v5 00/20] power_supply: Allow safe usage of power supply

2015-02-27 Thread Krzysztof Kozlowski
Hi,


The patchset fixes invalid memory accesses in certain race scenarios by
moving ownership of struct power_supply to the core. All drivers are
modified.


TLDR for driver and subsystem maintainers
=
Two patches of patchset change power_supply_register() function so in
the same time they touch all drivers. I am kindly asking for acks,
review and help in testing.

Especially please take a look at:
 - patch 2: power_supply: Move run-time configuration to separate structure
 - patch 11: power_supply: Change ownership from driver to core

I still need acks for changes in subsystems:
1. x86/olpc,
2. ACPI,
3. HID.


Problem to fix
==
Patchset tries to fix invalid memory accesses occurring in following
race scenario:

Thread 1: charger manager, CONSUMER
Thread 2: power supply driver, PROVIDER

THREAD 1 (consumer)THREAD 2 (provider)
======
psy = power_supply_get_by_name()
   Driver unbind, .remove
 power_supply_unregister()
 Device fully removed
psy-get_property()

The consumer of power supply will reference invalid memory because
the provider already freed it.


The fix
===
To properly fix the race the patchset:
1. Moves ownership of power_supply structure from driver (provider) to
   power supply core.
2. Adds power_supply_get_property()-like API for safe access by consumer.
3. Adds power_supply_put() which will reclaim memory.


I modifed all drivers I found. However I only compile tested them
(plus Smatch, Sparse and coccicheck). I did not test them on real
hardware (except max14577, max77693, max17040, max17042
and charger-manager).


What the patchset does in steps
===
1. Some preparation steps are necessary - patch 1 and 2. The driver
   implementing power supply won't be able to fill structure before
   calling power_supply_register(). So 'power_supply_config'
   is introduced in patch 2 (power_supply: Move run-time configuration
   to separate structure). Unfortunately this touches all drivers.
   *All drivers are touched.*

2. Safe API wrappers (and usage counter) are added (power_supply_*()).

3. Patch 11: ownership of 'struct power_supply' is moved from driver
   to the core.
   *All drivers are touched.*

4. power_supply_put() is added which reclaims resources.


Dependencies

The patchset is rebased on v4.0-rc1, latest battery tree and my latest
power supply changes:
1. compal-laptop: two fixes [1].

Bisect-ability is preserved. All later patches depend on previous ones
so it could be pulled in steps, but cherry-picking won't work.

Patchset is available also here:
https://git.linaro.org/people/marek.szyprowski/linux-srpol.git
branch: v4.0-rc1-power-supply-core-ownership


Changes since v4

1. Rebased on current battery tree. This introduced new changes:
   - new devm-like register functions,
   - new driver: da9150-charger.
2. Add acks: Darren Hart (compal-laptop.c, p. 11), Lee Jones
   (mfd, p. 11).

Changes since v3

1. Fix Jonghwa's email in his ack (spotted by Stefan Wahren)
2. Update power_supply_register() documentation.
3. Fix putting the reference to power supply in bq2415x_charger.c (put
   it when it is non-NULL).
4. Add acks: Robert Jarzmik (patch 20), Darren Hart (p. 2), Pavel
   Machek (p. 1-3), Marc Dietrich (p. 2 and 11).

Changes since v2

1. Rewrite all drivers to new power_supply_register().
2. Add reviewed-by Bartlomiej Zolnierkiewicz (internal review)
3. Add reviewed-by Sebastian Reichel [2] (to patches which I did not
   change in major way between v2 and v3).
4. Use atomic usage counter of power supply on each of:
   a. register/unregister,
   b. get/put.

Changes since v1

1. Add new patches (1, 2, 11, 19).
2. Preserved ack-s where there weren't any changes.
3. Patch 3: Add use counter.
4. Patch 3: Don't add wrapper for set_charged() because already exists
   one.


[1] https://lkml.org/lkml/2015/1/21/471
[2] https://lkml.org/lkml/2015/2/20/150

Best regards,
Krzysztof


Krzysztof Kozlowski (20):
  power_supply: Add driver private data
  power_supply: Move run-time configuration to separate structure
  power_supply: Add API for safe access of power supply function attrs
  power_supply: sysfs: Use power_supply_*() API for accessing function
attrs
  power_supply: 88pm860x_charger: Use power_supply_*() API for accessing
function attrs
  power_supply: ab8500: Use power_supply_*() API for accessing function
attrs
  mfd: ab8500: Use power_supply_*() API for accessing function attrs
  power_supply: apm_power: Use power_supply_*() API for accessing
function attrs
  power_supply: bq2415x_charger: Use power_supply_*() API for accessing
function attrs
  power_supply: charger-manager: Use power_supply_*() API for accessing
function attrs

[PATCH v5 03/20] power_supply: Add API for safe access of power supply function attrs

2015-02-27 Thread Krzysztof Kozlowski
Add simple wrappers for accessing power supply's function attributes:
 - get_property - power_supply_get_property
 - set_property - power_supply_set_property
 - property_is_writeable - power_supply_property_is_writeable
 - external_power_changed - power_supply_external_power_changed

This API along with atomic usage counter adds a safe way of accessing a
power supply from another driver. If power supply is unregistered after
obtaining reference to it by some driver, then the API wrappers won't be
executed in invalid (freed) context.

Next patch changing the ownership of power supply class is still needed
to fully fix race conditions in accessing freed power supply.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
Acked-by: Pavel Machek pa...@ucw.cz
---
 drivers/power/power_supply_core.c | 47 ++-
 include/linux/power_supply.h  | 16 +
 2 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/drivers/power/power_supply_core.c 
b/drivers/power/power_supply_core.c
index a21e36ed8d41..583dece8845b 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -314,7 +314,9 @@ EXPORT_SYMBOL_GPL(power_supply_is_system_supplied);
 
 int power_supply_set_battery_charged(struct power_supply *psy)
 {
-   if (psy-type == POWER_SUPPLY_TYPE_BATTERY  psy-set_charged) {
+   if (atomic_read(psy-use_cnt) = 0 
+   psy-type == POWER_SUPPLY_TYPE_BATTERY 
+   psy-set_charged) {
psy-set_charged(psy);
return 0;
}
@@ -366,6 +368,47 @@ struct power_supply *power_supply_get_by_phandle(struct 
device_node *np,
 EXPORT_SYMBOL_GPL(power_supply_get_by_phandle);
 #endif /* CONFIG_OF */
 
+int power_supply_get_property(struct power_supply *psy,
+   enum power_supply_property psp,
+   union power_supply_propval *val)
+{
+   if (atomic_read(psy-use_cnt) = 0)
+   return -ENODEV;
+
+   return psy-get_property(psy, psp, val);
+}
+EXPORT_SYMBOL_GPL(power_supply_get_property);
+
+int power_supply_set_property(struct power_supply *psy,
+   enum power_supply_property psp,
+   const union power_supply_propval *val)
+{
+   if (atomic_read(psy-use_cnt) = 0 || !psy-set_property)
+   return -ENODEV;
+
+   return psy-set_property(psy, psp, val);
+}
+EXPORT_SYMBOL_GPL(power_supply_set_property);
+
+int power_supply_property_is_writeable(struct power_supply *psy,
+   enum power_supply_property psp)
+{
+   if (atomic_read(psy-use_cnt) = 0 || !psy-property_is_writeable)
+   return -ENODEV;
+
+   return psy-property_is_writeable(psy, psp);
+}
+EXPORT_SYMBOL_GPL(power_supply_property_is_writeable);
+
+void power_supply_external_power_changed(struct power_supply *psy)
+{
+   if (atomic_read(psy-use_cnt) = 0 || !psy-external_power_changed)
+   return;
+
+   psy-external_power_changed(psy);
+}
+EXPORT_SYMBOL_GPL(power_supply_external_power_changed);
+
 int power_supply_powers(struct power_supply *psy, struct device *dev)
 {
return sysfs_create_link(psy-dev-kobj, dev-kobj, powers);
@@ -555,6 +598,7 @@ static int __power_supply_register(struct device *parent,
dev-release = power_supply_dev_release;
dev_set_drvdata(dev, psy);
psy-dev = dev;
+   atomic_inc(psy-use_cnt);
if (cfg) {
psy-drv_data = cfg-drv_data;
psy-of_node = cfg-of_node;
@@ -676,6 +720,7 @@ EXPORT_SYMBOL_GPL(devm_power_supply_register_no_ws);
 
 void power_supply_unregister(struct power_supply *psy)
 {
+   WARN_ON(atomic_dec_return(psy-use_cnt));
cancel_work_sync(psy-changed_work);
sysfs_remove_link(psy-dev-kobj, powers);
power_supply_remove_triggers(psy);
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 0d7c95f634a5..7ae60346465f 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -199,6 +199,12 @@ struct power_supply {
size_t num_supplies;
struct device_node *of_node;
 
+   /*
+* Functions for drivers implementing power supply class.
+* These shouldn't be called directly by other drivers for accessing
+* this power supply. Instead use power_supply_*() functions (for
+* example power_supply_get_property()).
+*/
int (*get_property)(struct power_supply *psy,
enum power_supply_property psp,
union power_supply_propval *val);
@@ -227,6 +233,7 @@ struct power_supply {
struct work_struct changed_work;
spinlock_t changed_lock;
bool changed;
+   atomic_t use_cnt;
 #ifdef CONFIG_THERMAL
struct

[PATCH v5 04/20] power_supply: sysfs: Use power_supply_*() API for accessing function attrs

2015-02-27 Thread Krzysztof Kozlowski
Replace direct calls to power supply function attributes with wrappers.
Wrappers provide safe access in case of unregistering the power
supply (e.g. by removing the driver). Replace:
 - get_property - power_supply_get_property
 - set_property - power_supply_set_property
 - property_is_writeable - power_supply_property_is_writeable

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Jonghwa Lee jonghwa3@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/power/power_supply_sysfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/power/power_supply_sysfs.c 
b/drivers/power/power_supply_sysfs.c
index 62653f50a524..f817aab80813 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -76,7 +76,7 @@ static ssize_t power_supply_show_property(struct device *dev,
if (off == POWER_SUPPLY_PROP_TYPE) {
value.intval = psy-type;
} else {
-   ret = psy-get_property(psy, off, value);
+   ret = power_supply_get_property(psy, off, value);
 
if (ret  0) {
if (ret == -ENODATA)
@@ -125,7 +125,7 @@ static ssize_t power_supply_store_property(struct device 
*dev,
 
value.intval = long_val;
 
-   ret = psy-set_property(psy, off, value);
+   ret = power_supply_set_property(psy, off, value);
if (ret  0)
return ret;
 
@@ -223,7 +223,7 @@ static umode_t power_supply_attr_is_visible(struct kobject 
*kobj,
 
if (property == attrno) {
if (psy-property_is_writeable 
-   psy-property_is_writeable(psy, property)  0)
+   power_supply_property_is_writeable(psy, property)  
0)
mode |= S_IWUSR;
 
return mode;
-- 
1.9.1

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


[PATCH v5 07/20] mfd: ab8500: Use power_supply_*() API for accessing function attrs

2015-02-27 Thread Krzysztof Kozlowski
Replace direct calls to power supply function attributes with wrappers.
Wrappers provide safe access in case of unregistering the power
supply (e.g. by removing the driver). Replace:
 - get_property - power_supply_get_property

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
Acked-by: Jonghwa Lee jonghwa3@samsung.com
Acked-by: Pavel Machek pa...@ucw.cz
Acked-by: Lee Jones lee.jo...@linaro.org
Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com
Reviewed-by: Sebastian Reichel s...@kernel.org
---
 drivers/mfd/ab8500-sysctrl.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/ab8500-sysctrl.c b/drivers/mfd/ab8500-sysctrl.c
index cfff0b643f1b..d4a4b24be7c6 100644
--- a/drivers/mfd/ab8500-sysctrl.c
+++ b/drivers/mfd/ab8500-sysctrl.c
@@ -49,7 +49,8 @@ static void ab8500_power_off(void)
if (!psy)
continue;
 
-   ret = psy-get_property(psy, POWER_SUPPLY_PROP_ONLINE, val);
+   ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_ONLINE,
+   val);
 
if (!ret  val.intval) {
charger_present = true;
@@ -63,8 +64,8 @@ static void ab8500_power_off(void)
/* Check if battery is known */
psy = power_supply_get_by_name(ab8500_btemp);
if (psy) {
-   ret = psy-get_property(psy, POWER_SUPPLY_PROP_TECHNOLOGY,
-   val);
+   ret = power_supply_get_property(psy,
+   POWER_SUPPLY_PROP_TECHNOLOGY, val);
if (!ret  val.intval != POWER_SUPPLY_TECHNOLOGY_UNKNOWN) {
printk(KERN_INFO
   Charger \%s\ is connected with known battery.
-- 
1.9.1

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


  1   2   >